aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-12-07 01:28:35 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2009-12-07 01:29:22 -0500
commit6548698f929814375fa5d62ae1db96959b0418c1 (patch)
tree340924ae82cb0946aa15045b2b72186de52a8146 /include
parent1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff)
parent22763c5cf3690a681551162c15d34d935308c8d7 (diff)
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date with 2.6.32. Although no conflicting changes were made in between, it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h53
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpixf.h10
-rw-r--r--include/acpi/actbl.h78
-rw-r--r--include/acpi/actbl1.h872
-rw-r--r--include/acpi/actbl2.h868
-rw-r--r--include/acpi/actypes.h94
-rw-r--r--include/acpi/button.h25
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h4
-rw-r--r--include/asm-generic/Kbuild.asm5
-rw-r--r--include/asm-generic/cputime.h1
-rw-r--r--include/asm-generic/device.h3
-rw-r--r--include/asm-generic/dma-mapping-common.h6
-rw-r--r--include/asm-generic/fcntl.h28
-rw-r--r--include/asm-generic/gpio.h9
-rw-r--r--include/asm-generic/hardirq.h2
-rw-r--r--include/asm-generic/kmap_types.h47
-rw-r--r--include/asm-generic/mman-common.h4
-rw-r--r--include/asm-generic/mman.h1
-rw-r--r--include/asm-generic/pci.h13
-rw-r--r--include/asm-generic/percpu.h3
-rw-r--r--include/asm-generic/sections.h16
-rw-r--r--include/asm-generic/siginfo.h8
-rw-r--r--include/asm-generic/socket.h3
-rw-r--r--include/asm-generic/syscall.h8
-rw-r--r--include/asm-generic/topology.h17
-rw-r--r--include/asm-generic/unistd.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h33
-rw-r--r--include/crypto/algapi.h37
-rw-r--r--include/crypto/cryptd.h17
-rw-r--r--include/crypto/hash.h147
-rw-r--r--include/crypto/internal/hash.h147
-rw-r--r--include/crypto/sha.h20
-rw-r--r--include/crypto/vmac.h61
-rw-r--r--include/drm/drmP.h57
-rw-r--r--include/drm/drm_cache.h38
-rw-r--r--include/drm/drm_crtc.h28
-rw-r--r--include/drm/drm_crtc_helper.h10
-rw-r--r--include/drm/drm_encoder_slave.h162
-rw-r--r--include/drm/drm_fb_helper.h111
-rw-r--r--include/drm/drm_memory.h2
-rw-r--r--include/drm/drm_mm.h7
-rw-r--r--include/drm/drm_mode.h11
-rw-r--r--include/drm/drm_pciids.h5
-rw-r--r--include/drm/drm_sysfs.h12
-rw-r--r--include/drm/i915_drm.h19
-rw-r--r--include/drm/radeon_drm.h12
-rw-r--r--include/drm/ttm/ttm_bo_api.h13
-rw-r--r--include/drm/ttm/ttm_bo_driver.h94
-rw-r--r--include/drm/ttm/ttm_memory.h43
-rw-r--r--include/drm/ttm/ttm_module.h2
-rw-r--r--include/keys/rxrpc-type.h107
-rw-r--r--include/linux/Kbuild6
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/agp_backend.h7
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/amba/bus.h5
-rw-r--r--include/linux/amba/mmci.h18
-rw-r--r--include/linux/amba/pl022.h8
-rw-r--r--include/linux/amba/pl093.h80
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/arcdevice.h3
-rw-r--r--include/linux/async_tx.h129
-rw-r--r--include/linux/ata.h43
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/attribute_container.h2
-rw-r--r--include/linux/backing-dev.h57
-rw-r--r--include/linux/backlight.h7
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/bio.h69
-rw-r--r--include/linux/blk-iopoll.h48
-rw-r--r--include/linux/blkdev.h88
-rw-r--r--include/linux/blktrace_api.h2
-rw-r--r--include/linux/bootmem.h5
-rw-r--r--include/linux/can/dev.h1
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/cgroup.h55
-rw-r--r--include/linux/clocksource.h122
-rw-r--r--include/linux/cn_proc.h10
-rw-r--r--include/linux/configfs.h4
-rw-r--r--include/linux/connector.h11
-rw-r--r--include/linux/cpu.h17
-rw-r--r--include/linux/cpufreq.h17
-rw-r--r--include/linux/cpumask.h721
-rw-r--r--include/linux/cred.h56
-rw-r--r--include/linux/crypto.h43
-rw-r--r--include/linux/cyclades.h11
-rw-r--r--include/linux/dca.h11
-rw-r--r--include/linux/dcbnl.h18
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/delayacct.h1
-rw-r--r--include/linux/device.h65
-rw-r--r--include/linux/dma-mapping.h6
-rw-r--r--include/linux/dmaengine.h179
-rw-r--r--include/linux/dmi.h13
-rw-r--r--include/linux/dtlk.h19
-rw-r--r--include/linux/dvb/dmx.h2
-rw-r--r--include/linux/dvb/frontend.h46
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/enclosure.h5
-rw-r--r--include/linux/ethtool.h15
-rw-r--r--include/linux/eventfd.h6
-rw-r--r--include/linux/ext3_fs_i.h8
-rw-r--r--include/linux/fb.h7
-rw-r--r--include/linux/fips.h10
-rw-r--r--include/linux/firewire.h14
-rw-r--r--include/linux/flex_array.h32
-rw-r--r--include/linux/fs.h78
-rw-r--r--include/linux/fscache-cache.h40
-rw-r--r--include/linux/fscache.h27
-rw-r--r--include/linux/ftrace.h7
-rw-r--r--include/linux/ftrace_event.h67
-rw-r--r--include/linux/fuse.h29
-rw-r--r--include/linux/futex.h14
-rw-r--r--include/linux/genhd.h25
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/gfs2_ondisk.h22
-rw-r--r--include/linux/gpio.h11
-rw-r--r--include/linux/hardirq.h10
-rw-r--r--include/linux/hayesesp.h1
-rw-r--r--include/linux/hdlc.h8
-rw-r--r--include/linux/hid-debug.h48
-rw-r--r--include/linux/hid.h25
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hugetlb.h44
-rw-r--r--include/linux/i2c-id.h11
-rw-r--r--include/linux/i2c-pnx.h2
-rw-r--r--include/linux/i2c.h20
-rw-r--r--include/linux/i2c/adp5588.h92
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/twl4030.h113
-rw-r--r--include/linux/i8042.h30
-rw-r--r--include/linux/icmpv6.h2
-rw-r--r--include/linux/ide.h30
-rw-r--r--include/linux/ieee80211.h31
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ether.h4
-rw-r--r--include/linux/if_frad.h5
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/init.h13
-rw-r--r--include/linux/init_task.h25
-rw-r--r--include/linux/input.h6
-rw-r--r--include/linux/input/eeti_ts.h9
-rw-r--r--include/linux/input/matrix_keypad.h32
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h9
-rw-r--r--include/linux/io-mapping.h17
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/iova.h1
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/irq.h18
-rw-r--r--include/linux/irqnr.h6
-rw-r--r--include/linux/isdn/hdlc.h82
-rw-r--r--include/linux/isdn_ppp.h2
-rw-r--r--include/linux/jbd.h28
-rw-r--r--include/linux/jbd2.h29
-rw-r--r--include/linux/kernel.h27
-rw-r--r--include/linux/key.h8
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/kmemcheck.h18
-rw-r--r--include/linux/kmemleak.h18
-rw-r--r--include/linux/kprobes.h4
-rw-r--r--include/linux/kref.h1
-rw-r--r--include/linux/ksm.h79
-rw-r--r--include/linux/kvm.h127
-rw-r--r--include/linux/kvm_host.h115
-rw-r--r--include/linux/kvm_para.h1
-rw-r--r--include/linux/libata.h15
-rw-r--r--include/linux/libps2.h3
-rw-r--r--include/linux/linkage.h2
-rw-r--r--include/linux/lis3lv02d.h11
-rw-r--r--include/linux/lockd/lockd.h45
-rw-r--r--include/linux/lockdep.h18
-rw-r--r--include/linux/lsm_audit.h12
-rw-r--r--include/linux/mISDNhw.h1
-rw-r--r--include/linux/mISDNif.h18
-rw-r--r--include/linux/magic.h6
-rw-r--r--include/linux/marker.h221
-rw-r--r--include/linux/mdio.h2
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--include/linux/memory_hotplug.h8
-rw-r--r--include/linux/mempool.h10
-rw-r--r--include/linux/mfd/ab3100.h37
-rw-r--r--include/linux/mfd/core.h1
-rw-r--r--include/linux/mfd/da903x.h4
-rw-r--r--include/linux/mfd/ezx-pcap.h7
-rw-r--r--include/linux/mfd/mc13783-private.h396
-rw-r--r--include/linux/mfd/mc13783.h84
-rw-r--r--include/linux/mfd/pcf50633/adc.h3
-rw-r--r--include/linux/mfd/pcf50633/core.h1
-rw-r--r--include/linux/mfd/wm831x/auxadc.h216
-rw-r--r--include/linux/mfd/wm831x/core.h289
-rw-r--r--include/linux/mfd/wm831x/gpio.h55
-rw-r--r--include/linux/mfd/wm831x/irq.h764
-rw-r--r--include/linux/mfd/wm831x/otp.h162
-rw-r--r--include/linux/mfd/wm831x/pdata.h113
-rw-r--r--include/linux/mfd/wm831x/pmu.h189
-rw-r--r--include/linux/mfd/wm831x/regulator.h1218
-rw-r--r--include/linux/mfd/wm831x/status.h34
-rw-r--r--include/linux/mfd/wm831x/watchdog.h52
-rw-r--r--include/linux/mfd/wm8350/core.h7
-rw-r--r--include/linux/miscdevice.h3
-rw-r--r--include/linux/mm.h49
-rw-r--r--include/linux/mm_inline.h31
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/card.h12
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/host.h59
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sdio_func.h3
-rw-r--r--include/linux/mmc/sdio_ids.h6
-rw-r--r--include/linux/mmu_context.h9
-rw-r--r--include/linux/mmu_notifier.h34
-rw-r--r--include/linux/mmzone.h30
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/linux/module.h42
-rw-r--r--include/linux/moduleparam.h1
-rw-r--r--include/linux/mroute.h4
-rw-r--r--include/linux/mroute6.h4
-rw-r--r--include/linux/mtd/nand.h5
-rw-r--r--include/linux/mtd/nand_ecc.h6
-rw-r--r--include/linux/mtd/onenand.h8
-rw-r--r--include/linux/mtd/onenand_regs.h3
-rw-r--r--include/linux/mtd/partitions.h2
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/net.h13
-rw-r--r--include/linux/net_dropmon.h1
-rw-r--r--include/linux/netdevice.h58
-rw-r--r--include/linux/netfilter.h4
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h6
-rw-r--r--include/linux/netfilter/xt_MARK.h17
-rw-r--r--include/linux/netfilter/xt_connmark.h5
-rw-r--r--include/linux/netfilter/xt_conntrack.h36
-rw-r--r--include/linux/netfilter/xt_mark.h5
-rw-r--r--include/linux/netfilter_arp/arp_tables.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/linux/netfilter_ipv4/Kbuild32
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLASSIFY.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_CONNMARK.h19
-rw-r--r--include/linux/netfilter_ipv4/ipt_DSCP.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_ECN.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_TCPMSS.h9
-rw-r--r--include/linux/netfilter_ipv4/ipt_TOS.h12
-rw-r--r--include/linux/netfilter_ipv4/ipt_comment.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h18
-rw-r--r--include/linux/netfilter_ipv4/ipt_connmark.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_conntrack.h28
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_dscp.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_esp.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_hashlimit.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_length.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h9
-rw-r--r--include/linux/netfilter_ipv4/ipt_multiport.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_owner.h20
-rw-r--r--include/linux/netfilter_ipv4/ipt_physdev.h17
-rw-r--r--include/linux/netfilter_ipv4/ipt_pkttype.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h23
-rw-r--r--include/linux/netfilter_ipv4/ipt_recent.h21
-rw-r--r--include/linux/netfilter_ipv4/ipt_sctp.h105
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_tcpmss.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_tos.h13
-rw-r--r--include/linux/netfilter_ipv6/Kbuild12
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_MARK.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_esp.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_length.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_limit.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mac.h7
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mark.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_multiport.h14
-rw-r--r--include/linux/netfilter_ipv6/ip6t_owner.h18
-rw-r--r--include/linux/netfilter_ipv6/ip6t_physdev.h17
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h23
-rw-r--r--include/linux/netlink.h20
-rw-r--r--include/linux/nfs4.h3
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nfs_fs_sb.h9
-rw-r--r--include/linux/nfsd/nfsd.h9
-rw-r--r--include/linux/nfsd/state.h77
-rw-r--r--include/linux/nfsd/xdr4.h19
-rw-r--r--include/linux/nilfs2_fs.h9
-rw-r--r--include/linux/nl80211.h174
-rw-r--r--include/linux/nl802154.h6
-rw-r--r--include/linux/nmi.h19
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/oom.h11
-rw-r--r--include/linux/oprofile.h5
-rw-r--r--include/linux/page-flags.h46
-rw-r--r--include/linux/page_cgroup.h17
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pci.h14
-rw-r--r--include/linux/pci_hotplug.h16
-rw-r--r--include/linux/pci_ids.h34
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu-defs.h82
-rw-r--r--include/linux/percpu.h88
-rw-r--r--include/linux/perf_counter.h459
-rw-r--r--include/linux/perf_event.h863
-rw-r--r--include/linux/phonet.h21
-rw-r--r--include/linux/platform_device.h5
-rw-r--r--include/linux/pm.h115
-rw-r--r--include/linux/pm_runtime.h114
-rw-r--r--include/linux/pnp.h1
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/poll.h2
-rw-r--r--include/linux/power_supply.h21
-rw-r--r--include/linux/prctl.h18
-rw-r--r--include/linux/proc_fs.h16
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcuclassic.h178
-rw-r--r--include/linux/rculist_nulls.h2
-rw-r--r--include/linux/rcupdate.h143
-rw-r--r--include/linux/rcupreempt.h127
-rw-r--r--include/linux/rcupreempt_trace.h97
-rw-r--r--include/linux/rcutree.h267
-rw-r--r--include/linux/rds.h12
-rw-r--r--include/linux/regulator/consumer.h4
-rw-r--r--include/linux/regulator/driver.h7
-rw-r--r--include/linux/regulator/fixed.h24
-rw-r--r--include/linux/regulator/machine.h26
-rw-r--r--include/linux/regulator/max1586.h4
-rw-r--r--include/linux/relay.h2
-rw-r--r--include/linux/res_counter.h58
-rw-r--r--include/linux/rfkill.h38
-rw-r--r--include/linux/ring_buffer.h24
-rw-r--r--include/linux/rmap.h27
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/rxrpc.h7
-rw-r--r--include/linux/sched.h224
-rw-r--r--include/linux/security.h156
-rw-r--r--include/linux/selinux.h9
-rw-r--r--include/linux/seq_file.h38
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h100
-rw-r--r--include/linux/serio.h2
-rw-r--r--include/linux/sfi.h206
-rw-r--r--include/linux/sfi_acpi.h93
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/shmem_fs.h5
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h12
-rw-r--r--include/linux/slob_def.h5
-rw-r--r--include/linux/slow-work.h72
-rw-r--r--include/linux/slub_def.h8
-rw-r--r--include/linux/smp.h11
-rw-r--r--include/linux/socket.h21
-rw-r--r--include/linux/spi/lms283gf05.h28
-rw-r--r--include/linux/spi/mc33880.h10
-rw-r--r--include/linux/spi/spi.h51
-rw-r--r--include/linux/spinlock.h64
-rw-r--r--include/linux/spinlock_api_smp.h394
-rw-r--r--include/linux/ssb/ssb.h69
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h10
-rw-r--r--include/linux/ssb/ssb_regs.h66
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/cache.h40
-rw-r--r--include/linux/sunrpc/clnt.h157
-rw-r--r--include/linux/sunrpc/msg_prot.h17
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h20
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h1
-rw-r--r--include/linux/sunrpc/svcsock.h1
-rw-r--r--include/linux/sunrpc/xdr.h11
-rw-r--r--include/linux/sunrpc/xprt.h21
-rw-r--r--include/linux/sunrpc/xprtrdma.h5
-rw-r--r--include/linux/sunrpc/xprtsock.h11
-rw-r--r--include/linux/suspend.h21
-rw-r--r--include/linux/swap.h61
-rw-r--r--include/linux/swapops.h38
-rw-r--r--include/linux/swiotlb.h11
-rw-r--r--include/linux/syscalls.h132
-rw-r--r--include/linux/sysctl.h19
-rw-r--r--include/linux/taskstats_kern.h1
-rw-r--r--include/linux/tboot.h162
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/time.h38
-rw-r--r--include/linux/timer.h5
-rw-r--r--include/linux/tipc.h2
-rw-r--r--include/linux/topology.h168
-rw-r--r--include/linux/trace_seq.h2
-rw-r--r--include/linux/tracehook.h34
-rw-r--r--include/linux/tracepoint.h33
-rw-r--r--include/linux/transport_class.h2
-rw-r--r--include/linux/tty.h27
-rw-r--r--include/linux/tty_driver.h13
-rw-r--r--include/linux/ucb1400.h19
-rw-r--r--include/linux/unaligned/be_byteshift.h2
-rw-r--r--include/linux/unaligned/le_byteshift.h2
-rw-r--r--include/linux/usb.h31
-rw-r--r--include/linux/usb/audio.h287
-rw-r--r--include/linux/usb/ch9.h8
-rw-r--r--include/linux/usb/ehci_def.h35
-rw-r--r--include/linux/usb/isp1362.h46
-rw-r--r--include/linux/usb/isp1760.h18
-rw-r--r--include/linux/usb/m66592.h44
-rw-r--r--include/linux/usb/r8a66597.h375
-rw-r--r--include/linux/usb/rndis_host.h13
-rw-r--r--include/linux/usb/serial.h13
-rw-r--r--include/linux/usb/usbnet.h19
-rw-r--r--include/linux/usb/video.h164
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--include/linux/utsname.h1
-rw-r--r--include/linux/uwb.h2
-rw-r--r--include/linux/vgaarb.h210
-rw-r--r--include/linux/videodev2.h108
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_9p.h3
-rw-r--r--include/linux/virtio_balloon.h4
-rw-r--r--include/linux/virtio_blk.h23
-rw-r--r--include/linux/virtio_config.h3
-rw-r--r--include/linux/virtio_console.h4
-rw-r--r--include/linux/virtio_ids.h17
-rw-r--r--include/linux/virtio_net.h4
-rw-r--r--include/linux/virtio_rng.h4
-rw-r--r--include/linux/vmalloc.h6
-rw-r--r--include/linux/vmstat.h16
-rw-r--r--include/linux/vt.h32
-rw-r--r--include/linux/vt_kern.h16
-rw-r--r--include/linux/wait.h4
-rw-r--r--include/linux/wireless.h8
-rw-r--r--include/linux/wm97xx.h25
-rw-r--r--include/linux/wm97xx_batt.h18
-rw-r--r--include/linux/workqueue.h3
-rw-r--r--include/linux/writeback.h39
-rw-r--r--include/linux/xattr.h1
-rw-r--r--include/media/davinci/ccdc_types.h43
-rw-r--r--include/media/davinci/dm355_ccdc.h321
-rw-r--r--include/media/davinci/dm644x_ccdc.h184
-rw-r--r--include/media/davinci/vpfe_capture.h198
-rw-r--r--include/media/davinci/vpfe_types.h51
-rw-r--r--include/media/davinci/vpss.h69
-rw-r--r--include/media/ir-common.h138
-rw-r--r--include/media/ir-kbd-i2c.h22
-rw-r--r--include/media/radio-si4713.h30
-rw-r--r--include/media/si4713.h49
-rw-r--r--include/media/soc_camera.h113
-rw-r--r--include/media/soc_camera_platform.h9
-rw-r--r--include/media/tuner.h3
-rw-r--r--include/media/tvp514x.h4
-rw-r--r--include/media/v4l2-chip-ident.h3
-rw-r--r--include/media/v4l2-common.h24
-rw-r--r--include/media/v4l2-dev.h6
-rw-r--r--include/media/v4l2-subdev.h5
-rw-r--r--include/net/9p/9p.h3
-rw-r--r--include/net/9p/client.h7
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/af_ieee802154.h (renamed from include/net/ieee802154/af_ieee802154.h)6
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci_core.h10
-rw-r--r--include/net/bluetooth/l2cap.h134
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/cfg80211.h570
-rw-r--r--include/net/compat.h4
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dst.h23
-rw-r--r--include/net/dst_ops.h28
-rw-r--r--include/net/genetlink.h66
-rw-r--r--include/net/ieee802154.h (renamed from include/net/ieee802154/mac_def.h)4
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/ieee802154_netdev.h (renamed from include/net/ieee802154/netdevice.h)6
-rw-r--r--include/net/inet_connection_sock.h6
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/ip.h6
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ip_vs.h119
-rw-r--r--include/net/ipip.h8
-rw-r--r--include/net/ipv6.h16
-rw-r--r--include/net/irda/ircomm_event.h2
-rw-r--r--include/net/irda/ircomm_tty_attach.h4
-rw-r--r--include/net/irda/irlap_event.h2
-rw-r--r--include/net/irda/irlmp_event.h4
-rw-r--r--include/net/iw_handler.h8
-rw-r--r--include/net/mac80211.h203
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h6
-rw-r--r--include/net/net_namespace.h26
-rw-r--r--include/net/netfilter/nf_conntrack.h8
-rw-r--r--include/net/netfilter/nf_nat_core.h2
-rw-r--r--include/net/netfilter/nf_nat_helper.h4
-rw-r--r--include/net/netlink.h4
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/netns/x_tables.h3
-rw-r--r--include/net/nl802154.h126
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--include/net/protocol.h13
-rw-r--r--include/net/rtnetlink.h5
-rw-r--r--include/net/sch_generic.h22
-rw-r--r--include/net/scm.h2
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/constants.h13
-rw-r--r--include/net/sctp/sctp.h7
-rw-r--r--include/net/sctp/structs.h70
-rw-r--r--include/net/sctp/user.h6
-rw-r--r--include/net/sock.h22
-rw-r--r--include/net/tcp.h53
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h5
-rw-r--r--include/net/wext.h1
-rw-r--r--include/net/wpan-phy.h63
-rw-r--r--include/net/xfrm.h2
-rw-r--r--include/pcmcia/ss.h10
-rw-r--r--include/rdma/ib_cm.h2
-rw-r--r--include/scsi/fc/fc_fc2.h3
-rw-r--r--include/scsi/fc/fc_gs.h1
-rw-r--r--include/scsi/fc_encode.h60
-rw-r--r--include/scsi/fc_frame.h7
-rw-r--r--include/scsi/iscsi_if.h1
-rw-r--r--include/scsi/libfc.h244
-rw-r--r--include/scsi/libiscsi.h6
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_cmnd.h4
-rw-r--r--include/scsi/scsi_device.h4
-rw-r--r--include/scsi/scsi_dh.h5
-rw-r--r--include/scsi/scsi_host.h24
-rw-r--r--include/sound/ac97_codec.h9
-rw-r--r--include/sound/asound.h2
-rw-r--r--include/sound/core.h51
-rw-r--r--include/sound/info.h4
-rw-r--r--include/sound/memalloc.h6
-rw-r--r--include/sound/pcm.h25
-rw-r--r--include/sound/sh_fsi.h83
-rw-r--r--include/sound/soc-dai.h40
-rw-r--r--include/sound/soc-dapm.h10
-rw-r--r--include/sound/soc.h49
-rw-r--r--include/sound/tlv.h14
-rw-r--r--include/sound/uda1380.h22
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm8993.h44
-rw-r--r--include/sound/ymfpci.h1
-rw-r--r--include/trace/define_trace.h7
-rw-r--r--include/trace/events/block.h37
-rw-r--r--include/trace/events/ext4.h320
-rw-r--r--include/trace/events/irq.h21
-rw-r--r--include/trace/events/jbd2.h80
-rw-r--r--include/trace/events/kmem.h163
-rw-r--r--include/trace/events/kvm.h151
-rw-r--r--include/trace/events/module.h126
-rw-r--r--include/trace/events/power.h81
-rw-r--r--include/trace/events/sched.h140
-rw-r--r--include/trace/events/skb.h20
-rw-r--r--include/trace/events/syscalls.h70
-rw-r--r--include/trace/events/timer.h342
-rw-r--r--include/trace/events/workqueue.h4
-rw-r--r--include/trace/ftrace.h218
-rw-r--r--include/trace/syscall.h48
-rw-r--r--include/video/da8xx-fb.h103
571 files changed, 19302 insertions, 6410 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c65e4ce6c3af..3cd9ccdcbd8f 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -30,8 +30,6 @@
30 30
31#include <acpi/acpi.h> 31#include <acpi/acpi.h>
32 32
33#define PREFIX "ACPI: "
34
35/* TBD: Make dynamic */ 33/* TBD: Make dynamic */
36#define ACPI_MAX_HANDLES 10 34#define ACPI_MAX_HANDLES 10
37struct acpi_handle_list { 35struct acpi_handle_list {
@@ -72,7 +70,6 @@ enum acpi_bus_device_type {
72 ACPI_BUS_TYPE_POWER, 70 ACPI_BUS_TYPE_POWER,
73 ACPI_BUS_TYPE_PROCESSOR, 71 ACPI_BUS_TYPE_PROCESSOR,
74 ACPI_BUS_TYPE_THERMAL, 72 ACPI_BUS_TYPE_THERMAL,
75 ACPI_BUS_TYPE_SYSTEM,
76 ACPI_BUS_TYPE_POWER_BUTTON, 73 ACPI_BUS_TYPE_POWER_BUTTON,
77 ACPI_BUS_TYPE_SLEEP_BUTTON, 74 ACPI_BUS_TYPE_SLEEP_BUTTON,
78 ACPI_BUS_DEVICE_TYPE_COUNT 75 ACPI_BUS_DEVICE_TYPE_COUNT
@@ -89,7 +86,6 @@ struct acpi_device;
89typedef int (*acpi_op_add) (struct acpi_device * device); 86typedef int (*acpi_op_add) (struct acpi_device * device);
90typedef int (*acpi_op_remove) (struct acpi_device * device, int type); 87typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
91typedef int (*acpi_op_start) (struct acpi_device * device); 88typedef int (*acpi_op_start) (struct acpi_device * device);
92typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
93typedef int (*acpi_op_suspend) (struct acpi_device * device, 89typedef int (*acpi_op_suspend) (struct acpi_device * device,
94 pm_message_t state); 90 pm_message_t state);
95typedef int (*acpi_op_resume) (struct acpi_device * device); 91typedef int (*acpi_op_resume) (struct acpi_device * device);
@@ -106,7 +102,6 @@ struct acpi_device_ops {
106 acpi_op_add add; 102 acpi_op_add add;
107 acpi_op_remove remove; 103 acpi_op_remove remove;
108 acpi_op_start start; 104 acpi_op_start start;
109 acpi_op_stop stop;
110 acpi_op_suspend suspend; 105 acpi_op_suspend suspend;
111 acpi_op_resume resume; 106 acpi_op_resume resume;
112 acpi_op_bind bind; 107 acpi_op_bind bind;
@@ -146,10 +141,7 @@ struct acpi_device_status {
146 141
147struct acpi_device_flags { 142struct acpi_device_flags {
148 u32 dynamic_status:1; 143 u32 dynamic_status:1;
149 u32 hardware_id:1;
150 u32 compatible_ids:1;
151 u32 bus_address:1; 144 u32 bus_address:1;
152 u32 unique_id:1;
153 u32 removable:1; 145 u32 removable:1;
154 u32 ejectable:1; 146 u32 ejectable:1;
155 u32 lockable:1; 147 u32 lockable:1;
@@ -158,7 +150,7 @@ struct acpi_device_flags {
158 u32 performance_manageable:1; 150 u32 performance_manageable:1;
159 u32 wake_capable:1; /* Wakeup(_PRW) supported? */ 151 u32 wake_capable:1; /* Wakeup(_PRW) supported? */
160 u32 force_power_state:1; 152 u32 force_power_state:1;
161 u32 reserved:19; 153 u32 reserved:22;
162}; 154};
163 155
164/* File System */ 156/* File System */
@@ -173,25 +165,26 @@ struct acpi_device_dir {
173 165
174typedef char acpi_bus_id[8]; 166typedef char acpi_bus_id[8];
175typedef unsigned long acpi_bus_address; 167typedef unsigned long acpi_bus_address;
176typedef char acpi_hardware_id[15];
177typedef char acpi_unique_id[9];
178typedef char acpi_device_name[40]; 168typedef char acpi_device_name[40];
179typedef char acpi_device_class[20]; 169typedef char acpi_device_class[20];
180 170
171struct acpi_hardware_id {
172 struct list_head list;
173 char *id;
174};
175
181struct acpi_device_pnp { 176struct acpi_device_pnp {
182 acpi_bus_id bus_id; /* Object name */ 177 acpi_bus_id bus_id; /* Object name */
183 acpi_bus_address bus_address; /* _ADR */ 178 acpi_bus_address bus_address; /* _ADR */
184 acpi_hardware_id hardware_id; /* _HID */ 179 char *unique_id; /* _UID */
185 struct acpi_compatible_id_list *cid_list; /* _CIDs */ 180 struct list_head ids; /* _HID and _CIDs */
186 acpi_unique_id unique_id; /* _UID */
187 acpi_device_name device_name; /* Driver-determined */ 181 acpi_device_name device_name; /* Driver-determined */
188 acpi_device_class device_class; /* " */ 182 acpi_device_class device_class; /* " */
189}; 183};
190 184
191#define acpi_device_bid(d) ((d)->pnp.bus_id) 185#define acpi_device_bid(d) ((d)->pnp.bus_id)
192#define acpi_device_adr(d) ((d)->pnp.bus_address) 186#define acpi_device_adr(d) ((d)->pnp.bus_address)
193#define acpi_device_hid(d) ((d)->pnp.hardware_id) 187char *acpi_device_hid(struct acpi_device *device);
194#define acpi_device_uid(d) ((d)->pnp.unique_id)
195#define acpi_device_name(d) ((d)->pnp.device_name) 188#define acpi_device_name(d) ((d)->pnp.device_name)
196#define acpi_device_class(d) ((d)->pnp.device_class) 189#define acpi_device_class(d) ((d)->pnp.device_class)
197 190
@@ -248,7 +241,6 @@ struct acpi_device_perf {
248/* Wakeup Management */ 241/* Wakeup Management */
249struct acpi_device_wakeup_flags { 242struct acpi_device_wakeup_flags {
250 u8 valid:1; /* Can successfully enable wakeup? */ 243 u8 valid:1; /* Can successfully enable wakeup? */
251 u8 prepared:1; /* Has the wake-up capability been enabled? */
252 u8 run_wake:1; /* Run-Wake GPE devices */ 244 u8 run_wake:1; /* Run-Wake GPE devices */
253}; 245};
254 246
@@ -263,12 +255,14 @@ struct acpi_device_wakeup {
263 struct acpi_handle_list resources; 255 struct acpi_handle_list resources;
264 struct acpi_device_wakeup_state state; 256 struct acpi_device_wakeup_state state;
265 struct acpi_device_wakeup_flags flags; 257 struct acpi_device_wakeup_flags flags;
258 int prepare_count;
266}; 259};
267 260
268/* Device */ 261/* Device */
269 262
270struct acpi_device { 263struct acpi_device {
271 acpi_handle handle; 264 int device_type;
265 acpi_handle handle; /* no handle for fixed hardware */
272 struct acpi_device *parent; 266 struct acpi_device *parent;
273 struct list_head children; 267 struct list_head children;
274 struct list_head node; 268 struct list_head node;
@@ -314,7 +308,7 @@ struct acpi_bus_event {
314 308
315extern struct kobject *acpi_kobj; 309extern struct kobject *acpi_kobj;
316extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 310extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
317void acpi_bus_private_data_handler(acpi_handle, u32, void *); 311void acpi_bus_private_data_handler(acpi_handle, void *);
318int acpi_bus_get_private_data(acpi_handle, void **); 312int acpi_bus_get_private_data(acpi_handle, void **);
319extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 313extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
320extern int register_acpi_notifier(struct notifier_block *); 314extern int register_acpi_notifier(struct notifier_block *);
@@ -327,7 +321,9 @@ extern void unregister_acpi_bus_notifier(struct notifier_block *nb);
327 */ 321 */
328 322
329int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); 323int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
330void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); 324void acpi_bus_data_handler(acpi_handle handle, void *context);
325acpi_status acpi_bus_get_status_handle(acpi_handle handle,
326 unsigned long long *sta);
331int acpi_bus_get_status(struct acpi_device *device); 327int acpi_bus_get_status(struct acpi_device *device);
332int acpi_bus_get_power(acpi_handle handle, int *state); 328int acpi_bus_get_power(acpi_handle handle, int *state);
333int acpi_bus_set_power(acpi_handle handle, int state); 329int acpi_bus_set_power(acpi_handle handle, int state);
@@ -356,7 +352,6 @@ void acpi_remove_dir(struct acpi_device *);
356/* 352/*
357 * Bind physical devices with ACPI devices 353 * Bind physical devices with ACPI devices
358 */ 354 */
359#include <linux/device.h>
360struct acpi_bus_type { 355struct acpi_bus_type {
361 struct list_head list; 356 struct list_head list;
362 struct bus_type *bus; 357 struct bus_type *bus;
@@ -369,10 +364,26 @@ int register_acpi_bus_type(struct acpi_bus_type *);
369int unregister_acpi_bus_type(struct acpi_bus_type *); 364int unregister_acpi_bus_type(struct acpi_bus_type *);
370struct device *acpi_get_physical_device(acpi_handle); 365struct device *acpi_get_physical_device(acpi_handle);
371 366
367struct acpi_pci_root {
368 struct list_head node;
369 struct acpi_device * device;
370 struct acpi_pci_id id;
371 struct pci_bus *bus;
372 u16 segment;
373 u8 bus_nr;
374
375 u32 osc_support_set; /* _OSC state of support bits */
376 u32 osc_control_set; /* _OSC state of control bits */
377 u32 osc_control_qry; /* the latest _OSC query result */
378
379 u32 osc_queried:1; /* has _OSC control been queried? */
380};
381
372/* helper */ 382/* helper */
373acpi_handle acpi_get_child(acpi_handle, acpi_integer); 383acpi_handle acpi_get_child(acpi_handle, acpi_integer);
374int acpi_is_root_bridge(acpi_handle); 384int acpi_is_root_bridge(acpi_handle);
375acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 385acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
386struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
376#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 387#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
377 388
378#ifdef CONFIG_PM_SLEEP 389#ifdef CONFIG_PM_SLEEP
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ab0b85cf21f3..eb0e7189075f 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -245,6 +245,9 @@ acpi_status acpi_osi_invalidate(char* interface);
245acpi_status 245acpi_status
246acpi_os_validate_address(u8 space_id, acpi_physical_address address, 246acpi_os_validate_address(u8 space_id, acpi_physical_address address,
247 acpi_size length, char *name); 247 acpi_size length, char *name);
248acpi_status
249acpi_os_invalidate_address(u8 space_id, acpi_physical_address address,
250 acpi_size length);
248 251
249u64 acpi_os_get_timer(void); 252u64 acpi_os_get_timer(void);
250 253
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 82ec6a3c0500..e723b0fd8e41 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -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 0x20090521 50#define ACPI_CA_VERSION 0x20090903
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -64,6 +64,7 @@ extern u8 acpi_gbl_enable_interpreter_slack;
64extern u8 acpi_gbl_all_methods_serialized; 64extern u8 acpi_gbl_all_methods_serialized;
65extern u8 acpi_gbl_create_osi_method; 65extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_leave_wake_gpes_disabled; 66extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern u8 acpi_gbl_use_default_register_widths;
67extern acpi_name acpi_gbl_trace_method_name; 68extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
69 70
@@ -199,7 +200,8 @@ acpi_evaluate_object_typed(acpi_handle object,
199 acpi_object_type return_type); 200 acpi_object_type return_type);
200 201
201acpi_status 202acpi_status
202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 203acpi_get_object_info(acpi_handle handle,
204 struct acpi_device_info **return_buffer);
203 205
204acpi_status acpi_install_method(u8 *buffer); 206acpi_status acpi_install_method(u8 *buffer);
205 207
@@ -359,9 +361,9 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
359acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); 361acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
360#endif 362#endif
361 363
362acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); 364acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
363 365
364acpi_status acpi_write(u32 value, struct acpi_generic_address *reg); 366acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
365 367
366acpi_status 368acpi_status
367acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); 369acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 222733d01f36..1b6587952604 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -44,9 +44,23 @@
44#ifndef __ACTBL_H__ 44#ifndef __ACTBL_H__
45#define __ACTBL_H__ 45#define __ACTBL_H__
46 46
47/*******************************************************************************
48 *
49 * Fundamental ACPI tables
50 *
51 * This file contains definitions for the ACPI tables that are directly consumed
52 * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related
53 * device drivers and other OS support code.
54 *
55 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
56 * tables use the header.
57 *
58 ******************************************************************************/
59
47/* 60/*
48 * Values for description table header signatures. Useful because they make 61 * Values for description table header signatures for tables defined in this
49 * it more difficult to inadvertently type in the wrong signature. 62 * file. Useful because they make it more difficult to inadvertently type in
63 * the wrong signature.
50 */ 64 */
51#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ 65#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
52#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ 66#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
@@ -65,11 +79,6 @@
65#pragma pack(1) 79#pragma pack(1)
66 80
67/* 81/*
68 * These are the ACPI tables that are directly consumed by the subsystem.
69 *
70 * The RSDP and FACS do not use the common ACPI table header. All other ACPI
71 * tables use the header.
72 *
73 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
74 * This is the only type that is even remotely portable. Anything else is not 83 * This is the only type that is even remotely portable. Anything else is not
75 * portable, so do not use any other bitfield types. 84 * portable, so do not use any other bitfield types.
@@ -77,9 +86,8 @@
77 86
78/******************************************************************************* 87/*******************************************************************************
79 * 88 *
80 * ACPI Table Header. This common header is used by all tables except the 89 * Master ACPI Table Header. This common header is used by all ACPI tables
81 * RSDP and FACS. The define is used for direct inclusion of header into 90 * except the RSDP and FACS.
82 * other ACPI tables
83 * 91 *
84 ******************************************************************************/ 92 ******************************************************************************/
85 93
@@ -95,13 +103,16 @@ struct acpi_table_header {
95 u32 asl_compiler_revision; /* ASL compiler version */ 103 u32 asl_compiler_revision; /* ASL compiler version */
96}; 104};
97 105
98/* 106/*******************************************************************************
107 *
99 * GAS - Generic Address Structure (ACPI 2.0+) 108 * GAS - Generic Address Structure (ACPI 2.0+)
100 * 109 *
101 * Note: Since this structure is used in the ACPI tables, it is byte aligned. 110 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
102 * If misalignment is not supported, access to the Address field must be 111 * If misaliged access is not supported by the hardware, accesses to the
103 * performed with care. 112 * 64-bit Address field must be performed with care.
104 */ 113 *
114 ******************************************************************************/
115
105struct acpi_generic_address { 116struct acpi_generic_address {
106 u8 space_id; /* Address space where struct or register exists */ 117 u8 space_id; /* Address space where struct or register exists */
107 u8 bit_width; /* Size in bits of given register */ 118 u8 bit_width; /* Size in bits of given register */
@@ -113,6 +124,7 @@ struct acpi_generic_address {
113/******************************************************************************* 124/*******************************************************************************
114 * 125 *
115 * RSDP - Root System Description Pointer (Signature is "RSD PTR ") 126 * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
127 * Version 2
116 * 128 *
117 ******************************************************************************/ 129 ******************************************************************************/
118 130
@@ -133,6 +145,7 @@ struct acpi_table_rsdp {
133/******************************************************************************* 145/*******************************************************************************
134 * 146 *
135 * RSDT/XSDT - Root System Description Tables 147 * RSDT/XSDT - Root System Description Tables
148 * Version 1 (both)
136 * 149 *
137 ******************************************************************************/ 150 ******************************************************************************/
138 151
@@ -161,21 +174,29 @@ struct acpi_table_facs {
161 u32 flags; 174 u32 flags;
162 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ 175 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
163 u8 version; /* Version of this table (ACPI 2.0+) */ 176 u8 version; /* Version of this table (ACPI 2.0+) */
164 u8 reserved[31]; /* Reserved, must be zero */ 177 u8 reserved[3]; /* Reserved, must be zero */
178 u32 ospm_flags; /* Flags to be set by OSPM (ACPI 4.0) */
179 u8 reserved1[24]; /* Reserved, must be zero */
165}; 180};
166 181
167/* Flag macros */ 182/* Masks for global_lock flag field above */
168 183
169#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ 184#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */
185#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */
170 186
171/* Global lock flags */ 187/* Masks for Flags field above */
172 188
173#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ 189#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
174#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ 190#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */
191
192/* Masks for ospm_flags field above */
193
194#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */
175 195
176/******************************************************************************* 196/*******************************************************************************
177 * 197 *
178 * FADT - Fixed ACPI Description Table (Signature "FACP") 198 * FADT - Fixed ACPI Description Table (Signature "FACP")
199 * Version 4
179 * 200 *
180 ******************************************************************************/ 201 ******************************************************************************/
181 202
@@ -236,7 +257,7 @@ struct acpi_table_fadt {
236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
237}; 258};
238 259
239/* FADT Boot Architecture Flags (boot_flags) */ 260/* Masks for FADT Boot Architecture Flags (boot_flags) */
240 261
241#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 262#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
242#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ 263#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -246,7 +267,7 @@ struct acpi_table_fadt {
246 267
247#define FADT2_REVISION_ID 3 268#define FADT2_REVISION_ID 3
248 269
249/* FADT flags */ 270/* Masks for FADT flags */
250 271
251#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ 272#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */
252#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ 273#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */
@@ -269,7 +290,7 @@ struct acpi_table_fadt {
269#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 290#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
270#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 291#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
271 292
272/* FADT Prefered Power Management Profiles */ 293/* Values for preferred_profile (Prefered Power Management Profiles) */
273 294
274enum acpi_prefered_pm_profiles { 295enum acpi_prefered_pm_profiles {
275 PM_UNSPECIFIED = 0, 296 PM_UNSPECIFIED = 0,
@@ -287,14 +308,16 @@ enum acpi_prefered_pm_profiles {
287 308
288#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 309#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
289 310
311/*
312 * Internal table-related structures
313 */
290union acpi_name_union { 314union acpi_name_union {
291 u32 integer; 315 u32 integer;
292 char ascii[4]; 316 char ascii[4];
293}; 317};
294 318
295/* 319/* Internal ACPI Table Descriptor. One per ACPI table. */
296 * Internal ACPI Table Descriptor. One per ACPI table 320
297 */
298struct acpi_table_desc { 321struct acpi_table_desc {
299 acpi_physical_address address; 322 acpi_physical_address address;
300 struct acpi_table_header *pointer; 323 struct acpi_table_header *pointer;
@@ -304,7 +327,7 @@ struct acpi_table_desc {
304 u8 flags; 327 u8 flags;
305}; 328};
306 329
307/* Flags for above */ 330/* Masks for Flags field above */
308 331
309#define ACPI_TABLE_ORIGIN_UNKNOWN (0) 332#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
310#define ACPI_TABLE_ORIGIN_MAPPED (1) 333#define ACPI_TABLE_ORIGIN_MAPPED (1)
@@ -318,5 +341,6 @@ struct acpi_table_desc {
318 */ 341 */
319 342
320#include <acpi/actbl1.h> 343#include <acpi/actbl1.h>
344#include <acpi/actbl2.h>
321 345
322#endif /* __ACTBL_H__ */ 346#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 59ade0752473..0b9b430b092b 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -46,41 +46,31 @@
46 46
47/******************************************************************************* 47/*******************************************************************************
48 * 48 *
49 * Additional ACPI Tables 49 * Additional ACPI Tables (1)
50 * 50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are 51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler. 52 * included here to support device drivers and the AML disassembler.
53 * 53 *
54 * The tables in this file are fully defined within the ACPI specification.
55 *
54 ******************************************************************************/ 56 ******************************************************************************/
55 57
56/* 58/*
57 * Values for description table header signatures. Useful because they make 59 * Values for description table header signatures for tables defined in this
58 * it more difficult to inadvertently type in the wrong signature. 60 * file. Useful because they make it more difficult to inadvertently type in
61 * the wrong signature.
59 */ 62 */
60#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
61#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ 63#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */
62#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
63#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ 64#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
64#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
65#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
66#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ 65#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
67#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ 66#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */
68#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ 67#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */
69#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 68#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */
70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
71#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
72#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 69#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
73#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 70#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
74#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 71#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
75#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
76#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 72#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
77#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
78#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
79#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 73#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
80#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
81#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
82#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
83#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
84 74
85/* 75/*
86 * All tables must be byte-packed to match the ACPI specification, since 76 * All tables must be byte-packed to match the ACPI specification, since
@@ -94,14 +84,20 @@
94 * portable, so do not use any other bitfield types. 84 * portable, so do not use any other bitfield types.
95 */ 85 */
96 86
97/* Common Subtable header (used in MADT, SRAT, etc.) */ 87/*******************************************************************************
88 *
89 * Common subtable headers
90 *
91 ******************************************************************************/
92
93/* Generic subtable header (used in MADT, SRAT, etc.) */
98 94
99struct acpi_subtable_header { 95struct acpi_subtable_header {
100 u8 type; 96 u8 type;
101 u8 length; 97 u8 length;
102}; 98};
103 99
104/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ 100/* Subtable header for WHEA tables (EINJ, ERST, WDAT) */
105 101
106struct acpi_whea_header { 102struct acpi_whea_header {
107 u8 action; 103 u8 action;
@@ -115,116 +111,8 @@ struct acpi_whea_header {
115 111
116/******************************************************************************* 112/*******************************************************************************
117 * 113 *
118 * ASF - Alert Standard Format table (Signature "ASF!") 114 * BERT - Boot Error Record Table (ACPI 4.0)
119 * 115 * Version 1
120 * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
121 *
122 ******************************************************************************/
123
124struct acpi_table_asf {
125 struct acpi_table_header header; /* Common ACPI table header */
126};
127
128/* ASF subtable header */
129
130struct acpi_asf_header {
131 u8 type;
132 u8 reserved;
133 u16 length;
134};
135
136/* Values for Type field above */
137
138enum acpi_asf_type {
139 ACPI_ASF_TYPE_INFO = 0,
140 ACPI_ASF_TYPE_ALERT = 1,
141 ACPI_ASF_TYPE_CONTROL = 2,
142 ACPI_ASF_TYPE_BOOT = 3,
143 ACPI_ASF_TYPE_ADDRESS = 4,
144 ACPI_ASF_TYPE_RESERVED = 5
145};
146
147/*
148 * ASF subtables
149 */
150
151/* 0: ASF Information */
152
153struct acpi_asf_info {
154 struct acpi_asf_header header;
155 u8 min_reset_value;
156 u8 min_poll_interval;
157 u16 system_id;
158 u32 mfg_id;
159 u8 flags;
160 u8 reserved2[3];
161};
162
163/* 1: ASF Alerts */
164
165struct acpi_asf_alert {
166 struct acpi_asf_header header;
167 u8 assert_mask;
168 u8 deassert_mask;
169 u8 alerts;
170 u8 data_length;
171};
172
173struct acpi_asf_alert_data {
174 u8 address;
175 u8 command;
176 u8 mask;
177 u8 value;
178 u8 sensor_type;
179 u8 type;
180 u8 offset;
181 u8 source_type;
182 u8 severity;
183 u8 sensor_number;
184 u8 entity;
185 u8 instance;
186};
187
188/* 2: ASF Remote Control */
189
190struct acpi_asf_remote {
191 struct acpi_asf_header header;
192 u8 controls;
193 u8 data_length;
194 u16 reserved2;
195};
196
197struct acpi_asf_control_data {
198 u8 function;
199 u8 address;
200 u8 command;
201 u8 value;
202};
203
204/* 3: ASF RMCP Boot Options */
205
206struct acpi_asf_rmcp {
207 struct acpi_asf_header header;
208 u8 capabilities[7];
209 u8 completion_code;
210 u32 enterprise_id;
211 u8 command;
212 u16 parameter;
213 u16 boot_options;
214 u16 oem_parameters;
215};
216
217/* 4: ASF Address */
218
219struct acpi_asf_address {
220 struct acpi_asf_header header;
221 u8 eprom_address;
222 u8 devices;
223};
224
225/*******************************************************************************
226 *
227 * BERT - Boot Error Record Table
228 * 116 *
229 ******************************************************************************/ 117 ******************************************************************************/
230 118
@@ -234,38 +122,43 @@ struct acpi_table_bert {
234 u64 address; /* Physical addresss of the error region */ 122 u64 address; /* Physical addresss of the error region */
235}; 123};
236 124
237/* Boot Error Region */ 125/* Boot Error Region (not a subtable, pointed to by Address field above) */
238 126
239struct acpi_bert_region { 127struct acpi_bert_region {
240 u32 block_status; 128 u32 block_status; /* Type of error information */
241 u32 raw_data_offset; 129 u32 raw_data_offset; /* Offset to raw error data */
242 u32 raw_data_length; 130 u32 raw_data_length; /* Length of raw error data */
243 u32 data_length; 131 u32 data_length; /* Length of generic error data */
244 u32 error_severity; 132 u32 error_severity; /* Severity code */
245}; 133};
246 134
247/* block_status Flags */ 135/* Values for block_status flags above */
248 136
249#define ACPI_BERT_UNCORRECTABLE (1) 137#define ACPI_BERT_UNCORRECTABLE (1)
250#define ACPI_BERT_CORRECTABLE (2) 138#define ACPI_BERT_CORRECTABLE (1<<1)
251#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) 139#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2)
252#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) 140#define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3)
141#define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */
253 142
254/******************************************************************************* 143/* Values for error_severity above */
255 *
256 * BOOT - Simple Boot Flag Table
257 *
258 ******************************************************************************/
259 144
260struct acpi_table_boot { 145enum acpi_bert_error_severity {
261 struct acpi_table_header header; /* Common ACPI table header */ 146 ACPI_BERT_ERROR_CORRECTABLE = 0,
262 u8 cmos_index; /* Index in CMOS RAM for the boot register */ 147 ACPI_BERT_ERROR_FATAL = 1,
263 u8 reserved[3]; 148 ACPI_BERT_ERROR_CORRECTED = 2,
149 ACPI_BERT_ERROR_NONE = 3,
150 ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */
264}; 151};
265 152
153/*
154 * Note: The generic error data that follows the error_severity field above
155 * uses the struct acpi_hest_generic_data defined under the HEST table below
156 */
157
266/******************************************************************************* 158/*******************************************************************************
267 * 159 *
268 * CPEP - Corrected Platform Error Polling table 160 * CPEP - Corrected Platform Error Polling table (ACPI 4.0)
161 * Version 1
269 * 162 *
270 ******************************************************************************/ 163 ******************************************************************************/
271 164
@@ -277,8 +170,7 @@ struct acpi_table_cpep {
277/* Subtable */ 170/* Subtable */
278 171
279struct acpi_cpep_polling { 172struct acpi_cpep_polling {
280 u8 type; 173 struct acpi_subtable_header header;
281 u8 length;
282 u8 id; /* Processor ID */ 174 u8 id; /* Processor ID */
283 u8 eid; /* Processor EID */ 175 u8 eid; /* Processor EID */
284 u32 interval; /* Polling interval (msec) */ 176 u32 interval; /* Polling interval (msec) */
@@ -286,124 +178,8 @@ struct acpi_cpep_polling {
286 178
287/******************************************************************************* 179/*******************************************************************************
288 * 180 *
289 * DBGP - Debug Port table
290 *
291 ******************************************************************************/
292
293struct acpi_table_dbgp {
294 struct acpi_table_header header; /* Common ACPI table header */
295 u8 type; /* 0=full 16550, 1=subset of 16550 */
296 u8 reserved[3];
297 struct acpi_generic_address debug_port;
298};
299
300/*******************************************************************************
301 *
302 * DMAR - DMA Remapping table
303 * From "Intel Virtualization Technology for Directed I/O", Sept. 2007
304 *
305 ******************************************************************************/
306
307struct acpi_table_dmar {
308 struct acpi_table_header header; /* Common ACPI table header */
309 u8 width; /* Host Address Width */
310 u8 flags;
311 u8 reserved[10];
312};
313
314/* Flags */
315
316#define ACPI_DMAR_INTR_REMAP (1)
317
318/* DMAR subtable header */
319
320struct acpi_dmar_header {
321 u16 type;
322 u16 length;
323};
324
325/* Values for subtable type in struct acpi_dmar_header */
326
327enum acpi_dmar_type {
328 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
329 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
330 ACPI_DMAR_TYPE_ATSR = 2,
331 ACPI_DMAR_TYPE_RESERVED = 3 /* 3 and greater are reserved */
332};
333
334struct acpi_dmar_device_scope {
335 u8 entry_type;
336 u8 length;
337 u16 reserved;
338 u8 enumeration_id;
339 u8 bus;
340};
341
342/* Values for entry_type in struct acpi_dmar_device_scope */
343
344enum acpi_dmar_scope_type {
345 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
346 ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
347 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
348 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
349 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
350 ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */
351};
352
353struct acpi_dmar_pci_path {
354 u8 dev;
355 u8 fn;
356};
357
358/*
359 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header
360 */
361
362/* 0: Hardware Unit Definition */
363
364struct acpi_dmar_hardware_unit {
365 struct acpi_dmar_header header;
366 u8 flags;
367 u8 reserved;
368 u16 segment;
369 u64 address; /* Register Base Address */
370};
371
372/* Flags */
373
374#define ACPI_DMAR_INCLUDE_ALL (1)
375
376/* 1: Reserved Memory Defininition */
377
378struct acpi_dmar_reserved_memory {
379 struct acpi_dmar_header header;
380 u16 reserved;
381 u16 segment;
382 u64 base_address; /* 4_k aligned base address */
383 u64 end_address; /* 4_k aligned limit address */
384};
385
386/* Flags */
387
388#define ACPI_DMAR_ALLOW_ALL (1)
389
390
391/* 2: Root Port ATS Capability Reporting Structure */
392
393struct acpi_dmar_atsr {
394 struct acpi_dmar_header header;
395 u8 flags;
396 u8 reserved;
397 u16 segment;
398};
399
400/* Flags */
401
402#define ACPI_DMAR_ALL_PORTS (1)
403
404/*******************************************************************************
405 *
406 * ECDT - Embedded Controller Boot Resources Table 181 * ECDT - Embedded Controller Boot Resources Table
182 * Version 1
407 * 183 *
408 ******************************************************************************/ 184 ******************************************************************************/
409 185
@@ -418,14 +194,16 @@ struct acpi_table_ecdt {
418 194
419/******************************************************************************* 195/*******************************************************************************
420 * 196 *
421 * EINJ - Error Injection Table 197 * EINJ - Error Injection Table (ACPI 4.0)
198 * Version 1
422 * 199 *
423 ******************************************************************************/ 200 ******************************************************************************/
424 201
425struct acpi_table_einj { 202struct acpi_table_einj {
426 struct acpi_table_header header; /* Common ACPI table header */ 203 struct acpi_table_header header; /* Common ACPI table header */
427 u32 header_length; 204 u32 header_length;
428 u32 reserved; 205 u8 flags;
206 u8 reserved[3];
429 u32 entries; 207 u32 entries;
430}; 208};
431 209
@@ -435,6 +213,10 @@ struct acpi_einj_entry {
435 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 213 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
436}; 214};
437 215
216/* Masks for Flags field above */
217
218#define ACPI_EINJ_PRESERVE (1)
219
438/* Values for Action field above */ 220/* Values for Action field above */
439 221
440enum acpi_einj_actions { 222enum acpi_einj_actions {
@@ -470,9 +252,34 @@ struct acpi_einj_trigger {
470 u32 entry_count; 252 u32 entry_count;
471}; 253};
472 254
255/* Command status return values */
256
257enum acpi_einj_command_status {
258 ACPI_EINJ_SUCCESS = 0,
259 ACPI_EINJ_FAILURE = 1,
260 ACPI_EINJ_INVALID_ACCESS = 2,
261 ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */
262};
263
264/* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */
265
266#define ACPI_EINJ_PROCESSOR_CORRECTABLE (1)
267#define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1)
268#define ACPI_EINJ_PROCESSOR_FATAL (1<<2)
269#define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3)
270#define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4)
271#define ACPI_EINJ_MEMORY_FATAL (1<<5)
272#define ACPI_EINJ_PCIX_CORRECTABLE (1<<6)
273#define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7)
274#define ACPI_EINJ_PCIX_FATAL (1<<8)
275#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9)
276#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10)
277#define ACPI_EINJ_PLATFORM_FATAL (1<<11)
278
473/******************************************************************************* 279/*******************************************************************************
474 * 280 *
475 * ERST - Error Record Serialization Table 281 * ERST - Error Record Serialization Table (ACPI 4.0)
282 * Version 1
476 * 283 *
477 ******************************************************************************/ 284 ******************************************************************************/
478 285
@@ -489,19 +296,23 @@ struct acpi_erst_entry {
489 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 296 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
490}; 297};
491 298
299/* Masks for Flags field above */
300
301#define ACPI_ERST_PRESERVE (1)
302
492/* Values for Action field above */ 303/* Values for Action field above */
493 304
494enum acpi_erst_actions { 305enum acpi_erst_actions {
495 ACPI_ERST_BEGIN_WRITE_OPERATION = 0, 306 ACPI_ERST_BEGIN_WRITE = 0,
496 ACPI_ERST_BEGIN_READ_OPERATION = 1, 307 ACPI_ERST_BEGIN_READ = 1,
497 ACPI_ERST_BETGIN_CLEAR_OPERATION = 2, 308 ACPI_ERST_BEGIN_CLEAR = 2,
498 ACPI_ERST_END_OPERATION = 3, 309 ACPI_ERST_END = 3,
499 ACPI_ERST_SET_RECORD_OFFSET = 4, 310 ACPI_ERST_SET_RECORD_OFFSET = 4,
500 ACPI_ERST_EXECUTE_OPERATION = 5, 311 ACPI_ERST_EXECUTE_OPERATION = 5,
501 ACPI_ERST_CHECK_BUSY_STATUS = 6, 312 ACPI_ERST_CHECK_BUSY_STATUS = 6,
502 ACPI_ERST_GET_COMMAND_STATUS = 7, 313 ACPI_ERST_GET_COMMAND_STATUS = 7,
503 ACPI_ERST_GET_RECORD_IDENTIFIER = 8, 314 ACPI_ERST_GET_RECORD_ID = 8,
504 ACPI_ERST_SET_RECORD_IDENTIFIER = 9, 315 ACPI_ERST_SET_RECORD_ID = 9,
505 ACPI_ERST_GET_RECORD_COUNT = 10, 316 ACPI_ERST_GET_RECORD_COUNT = 10,
506 ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, 317 ACPI_ERST_BEGIN_DUMMY_WRIITE = 11,
507 ACPI_ERST_NOT_USED = 12, 318 ACPI_ERST_NOT_USED = 12,
@@ -536,9 +347,29 @@ enum acpi_erst_instructions {
536 ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ 347 ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */
537}; 348};
538 349
350/* Command status return values */
351
352enum acpi_erst_command_status {
353 ACPI_ERST_SUCESS = 0,
354 ACPI_ERST_NO_SPACE = 1,
355 ACPI_ERST_NOT_AVAILABLE = 2,
356 ACPI_ERST_FAILURE = 3,
357 ACPI_ERST_RECORD_EMPTY = 4,
358 ACPI_ERST_NOT_FOUND = 5,
359 ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */
360};
361
362/* Error Record Serialization Information */
363
364struct acpi_erst_info {
365 u16 signature; /* Should be "ER" */
366 u8 data[48];
367};
368
539/******************************************************************************* 369/*******************************************************************************
540 * 370 *
541 * HEST - Hardware Error Source Table 371 * HEST - Hardware Error Source Table (ACPI 4.0)
372 * Version 1
542 * 373 *
543 ******************************************************************************/ 374 ******************************************************************************/
544 375
@@ -551,85 +382,69 @@ struct acpi_table_hest {
551 382
552struct acpi_hest_header { 383struct acpi_hest_header {
553 u16 type; 384 u16 type;
385 u16 source_id;
554}; 386};
555 387
556/* Values for Type field above for subtables */ 388/* Values for Type field above for subtables */
557 389
558enum acpi_hest_types { 390enum acpi_hest_types {
559 ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, 391 ACPI_HEST_TYPE_IA32_CHECK = 0,
560 ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, 392 ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1,
561 ACPI_HEST_TYPE_XPF_UNUSED = 2, 393 ACPI_HEST_TYPE_IA32_NMI = 2,
562 ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, 394 ACPI_HEST_TYPE_NOT_USED3 = 3,
563 ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, 395 ACPI_HEST_TYPE_NOT_USED4 = 4,
564 ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, 396 ACPI_HEST_TYPE_NOT_USED5 = 5,
565 ACPI_HEST_TYPE_AER_ROOT_PORT = 6, 397 ACPI_HEST_TYPE_AER_ROOT_PORT = 6,
566 ACPI_HEST_TYPE_AER_ENDPOINT = 7, 398 ACPI_HEST_TYPE_AER_ENDPOINT = 7,
567 ACPI_HEST_TYPE_AER_BRIDGE = 8, 399 ACPI_HEST_TYPE_AER_BRIDGE = 8,
568 ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, 400 ACPI_HEST_TYPE_GENERIC_ERROR = 9,
569 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ 401 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */
570}; 402};
571 403
572/* 404/*
573 * HEST Sub-subtables 405 * HEST substructures contained in subtables
574 */ 406 */
575 407
576/* XPF Machine Check Error Bank */ 408/*
577 409 * IA32 Error Bank(s) - Follows the struct acpi_hest_ia_machine_check and
578struct acpi_hest_xpf_error_bank { 410 * struct acpi_hest_ia_corrected structures.
411 */
412struct acpi_hest_ia_error_bank {
579 u8 bank_number; 413 u8 bank_number;
580 u8 clear_status_on_init; 414 u8 clear_status_on_init;
581 u8 status_format; 415 u8 status_format;
582 u8 config_write_enable; 416 u8 reserved;
583 u32 control_register; 417 u32 control_register;
584 u64 control_init_data; 418 u64 control_data;
585 u32 status_register; 419 u32 status_register;
586 u32 address_register; 420 u32 address_register;
587 u32 misc_register; 421 u32 misc_register;
588}; 422};
589 423
590/* Generic Error Status */ 424/* Common HEST sub-structure for PCI/AER structures below (6,7,8) */
591
592struct acpi_hest_generic_status {
593 u32 block_status;
594 u32 raw_data_offset;
595 u32 raw_data_length;
596 u32 data_length;
597 u32 error_severity;
598};
599
600/* Generic Error Data */
601
602struct acpi_hest_generic_data {
603 u8 section_type[16];
604 u32 error_severity;
605 u16 revision;
606 u8 validation_bits;
607 u8 flags;
608 u32 error_data_length;
609 u8 fru_id[16];
610 u8 fru_text[20];
611};
612
613/* Common HEST structure for PCI/AER types below (6,7,8) */
614 425
615struct acpi_hest_aer_common { 426struct acpi_hest_aer_common {
616 u16 source_id; 427 u16 reserved1;
617 u16 config_write_enable;
618 u8 flags; 428 u8 flags;
619 u8 enabled; 429 u8 enabled;
620 u32 records_to_pre_allocate; 430 u32 records_to_preallocate;
621 u32 max_sections_per_record; 431 u32 max_sections_per_record;
622 u32 bus; 432 u32 bus;
623 u16 device; 433 u16 device;
624 u16 function; 434 u16 function;
625 u16 device_control; 435 u16 device_control;
626 u16 reserved; 436 u16 reserved2;
627 u32 uncorrectable_error_mask; 437 u32 uncorrectable_mask;
628 u32 uncorrectable_error_severity; 438 u32 uncorrectable_severity;
629 u32 correctable_error_mask; 439 u32 correctable_mask;
630 u32 advanced_error_capabilities; 440 u32 advanced_capabilities;
631}; 441};
632 442
443/* Masks for HEST Flags fields */
444
445#define ACPI_HEST_FIRMWARE_FIRST (1)
446#define ACPI_HEST_GLOBAL (1<<1)
447
633/* Hardware Error Notification */ 448/* Hardware Error Notification */
634 449
635struct acpi_hest_notify { 450struct acpi_hest_notify {
@@ -655,71 +470,59 @@ enum acpi_hest_notify_types {
655 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ 470 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */
656}; 471};
657 472
473/* Values for config_write_enable bitfield above */
474
475#define ACPI_HEST_TYPE (1)
476#define ACPI_HEST_POLL_INTERVAL (1<<1)
477#define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2)
478#define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3)
479#define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4)
480#define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5)
481
658/* 482/*
659 * HEST subtables 483 * HEST subtables
660 *
661 * From WHEA Design Document, 16 May 2007.
662 * Note: There is no subtable type 2 in this version of the document,
663 * and there are two different subtable type 3s.
664 */ 484 */
665 485
666 /* 0: XPF Machine Check Exception */ 486/* 0: IA32 Machine Check Exception */
667 487
668struct acpi_hest_xpf_machine_check { 488struct acpi_hest_ia_machine_check {
669 struct acpi_hest_header header; 489 struct acpi_hest_header header;
670 u16 source_id; 490 u16 reserved1;
671 u16 config_write_enable;
672 u8 flags; 491 u8 flags;
673 u8 reserved1; 492 u8 enabled;
674 u32 records_to_pre_allocate; 493 u32 records_to_preallocate;
675 u32 max_sections_per_record; 494 u32 max_sections_per_record;
676 u64 global_capability_data; 495 u64 global_capability_data;
677 u64 global_control_data; 496 u64 global_control_data;
678 u8 num_hardware_banks; 497 u8 num_hardware_banks;
679 u8 reserved2[7]; 498 u8 reserved3[7];
680}; 499};
681 500
682/* 1: XPF Corrected Machine Check */ 501/* 1: IA32 Corrected Machine Check */
683 502
684struct acpi_table_hest_xpf_corrected { 503struct acpi_hest_ia_corrected {
685 struct acpi_hest_header header; 504 struct acpi_hest_header header;
686 u16 source_id; 505 u16 reserved1;
687 u16 config_write_enable;
688 u8 flags; 506 u8 flags;
689 u8 enabled; 507 u8 enabled;
690 u32 records_to_pre_allocate; 508 u32 records_to_preallocate;
691 u32 max_sections_per_record; 509 u32 max_sections_per_record;
692 struct acpi_hest_notify notify; 510 struct acpi_hest_notify notify;
693 u8 num_hardware_banks; 511 u8 num_hardware_banks;
694 u8 reserved[3]; 512 u8 reserved2[3];
695}; 513};
696 514
697/* 3: XPF Non-Maskable Interrupt */ 515/* 2: IA32 Non-Maskable Interrupt */
698 516
699struct acpi_hest_xpf_nmi { 517struct acpi_hest_ia_nmi {
700 struct acpi_hest_header header; 518 struct acpi_hest_header header;
701 u16 source_id;
702 u32 reserved; 519 u32 reserved;
703 u32 records_to_pre_allocate; 520 u32 records_to_preallocate;
704 u32 max_sections_per_record; 521 u32 max_sections_per_record;
705 u32 max_raw_data_length; 522 u32 max_raw_data_length;
706}; 523};
707 524
708/* 4: IPF Corrected Machine Check */ 525/* 3,4,5: Not used */
709
710struct acpi_hest_ipf_corrected {
711 struct acpi_hest_header header;
712 u8 enabled;
713 u8 reserved;
714};
715
716/* 5: IPF Corrected Platform Error */
717
718struct acpi_hest_ipf_corrected_platform {
719 struct acpi_hest_header header;
720 u8 enabled;
721 u8 reserved;
722};
723 526
724/* 6: PCI Express Root Port AER */ 527/* 6: PCI Express Root Port AER */
725 528
@@ -741,143 +544,61 @@ struct acpi_hest_aer {
741struct acpi_hest_aer_bridge { 544struct acpi_hest_aer_bridge {
742 struct acpi_hest_header header; 545 struct acpi_hest_header header;
743 struct acpi_hest_aer_common aer; 546 struct acpi_hest_aer_common aer;
744 u32 secondary_uncorrectable_error_mask; 547 u32 uncorrectable_mask2;
745 u32 secondary_uncorrectable_error_severity; 548 u32 uncorrectable_severity2;
746 u32 secondary_advanced_capabilities; 549 u32 advanced_capabilities2;
747}; 550};
748 551
749/* 9: Generic Hardware Error Source */ 552/* 9: Generic Hardware Error Source */
750 553
751struct acpi_hest_generic { 554struct acpi_hest_generic {
752 struct acpi_hest_header header; 555 struct acpi_hest_header header;
753 u16 source_id;
754 u16 related_source_id; 556 u16 related_source_id;
755 u8 config_write_enable; 557 u8 reserved;
756 u8 enabled; 558 u8 enabled;
757 u32 records_to_pre_allocate; 559 u32 records_to_preallocate;
758 u32 max_sections_per_record; 560 u32 max_sections_per_record;
759 u32 max_raw_data_length; 561 u32 max_raw_data_length;
760 struct acpi_generic_address error_status_address; 562 struct acpi_generic_address error_status_address;
761 struct acpi_hest_notify notify; 563 struct acpi_hest_notify notify;
762 u32 error_status_block_length; 564 u32 error_block_length;
763}; 565};
764 566
765/******************************************************************************* 567/* Generic Error Status block */
766 *
767 * HPET - High Precision Event Timer table
768 *
769 ******************************************************************************/
770 568
771struct acpi_table_hpet { 569struct acpi_hest_generic_status {
772 struct acpi_table_header header; /* Common ACPI table header */ 570 u32 block_status;
773 u32 id; /* Hardware ID of event timer block */ 571 u32 raw_data_offset;
774 struct acpi_generic_address address; /* Address of event timer block */ 572 u32 raw_data_length;
775 u8 sequence; /* HPET sequence number */ 573 u32 data_length;
776 u16 minimum_tick; /* Main counter min tick, periodic mode */ 574 u32 error_severity;
777 u8 flags;
778}; 575};
779 576
780/*! Flags */ 577/* Values for block_status flags above */
781 578
782#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */ 579#define ACPI_HEST_UNCORRECTABLE (1)
783#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */ 580#define ACPI_HEST_CORRECTABLE (1<<1)
784#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */ 581#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2)
582#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3)
583#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */
785 584
786/*! [End] no source code translation !*/ 585/* Generic Error Data entry */
787 586
788/******************************************************************************* 587struct acpi_hest_generic_data {
789 * 588 u8 section_type[16];
790 * IBFT - Boot Firmware Table 589 u32 error_severity;
791 * 590 u16 revision;
792 ******************************************************************************/ 591 u8 validation_bits;
793
794struct acpi_table_ibft {
795 struct acpi_table_header header; /* Common ACPI table header */
796 u8 reserved[12];
797};
798
799/* IBFT common subtable header */
800
801struct acpi_ibft_header {
802 u8 type;
803 u8 version;
804 u16 length;
805 u8 index;
806 u8 flags; 592 u8 flags;
807}; 593 u32 error_data_length;
808 594 u8 fru_id[16];
809/* Values for Type field above */ 595 u8 fru_text[20];
810
811enum acpi_ibft_type {
812 ACPI_IBFT_TYPE_NOT_USED = 0,
813 ACPI_IBFT_TYPE_CONTROL = 1,
814 ACPI_IBFT_TYPE_INITIATOR = 2,
815 ACPI_IBFT_TYPE_NIC = 3,
816 ACPI_IBFT_TYPE_TARGET = 4,
817 ACPI_IBFT_TYPE_EXTENSIONS = 5,
818 ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */
819};
820
821/* IBFT subtables */
822
823struct acpi_ibft_control {
824 struct acpi_ibft_header header;
825 u16 extensions;
826 u16 initiator_offset;
827 u16 nic0_offset;
828 u16 target0_offset;
829 u16 nic1_offset;
830 u16 target1_offset;
831};
832
833struct acpi_ibft_initiator {
834 struct acpi_ibft_header header;
835 u8 sns_server[16];
836 u8 slp_server[16];
837 u8 primary_server[16];
838 u8 secondary_server[16];
839 u16 name_length;
840 u16 name_offset;
841};
842
843struct acpi_ibft_nic {
844 struct acpi_ibft_header header;
845 u8 ip_address[16];
846 u8 subnet_mask_prefix;
847 u8 origin;
848 u8 gateway[16];
849 u8 primary_dns[16];
850 u8 secondary_dns[16];
851 u8 dhcp[16];
852 u16 vlan;
853 u8 mac_address[6];
854 u16 pci_address;
855 u16 name_length;
856 u16 name_offset;
857};
858
859struct acpi_ibft_target {
860 struct acpi_ibft_header header;
861 u8 target_ip_address[16];
862 u16 target_ip_socket;
863 u8 target_boot_lun[8];
864 u8 chap_type;
865 u8 nic_association;
866 u16 target_name_length;
867 u16 target_name_offset;
868 u16 chap_name_length;
869 u16 chap_name_offset;
870 u16 chap_secret_length;
871 u16 chap_secret_offset;
872 u16 reverse_chap_name_length;
873 u16 reverse_chap_name_offset;
874 u16 reverse_chap_secret_length;
875 u16 reverse_chap_secret_offset;
876}; 596};
877 597
878/******************************************************************************* 598/*******************************************************************************
879 * 599 *
880 * MADT - Multiple APIC Description Table 600 * MADT - Multiple APIC Description Table
601 * Version 3
881 * 602 *
882 ******************************************************************************/ 603 ******************************************************************************/
883 604
@@ -887,16 +608,16 @@ struct acpi_table_madt {
887 u32 flags; 608 u32 flags;
888}; 609};
889 610
890/* Flags */ 611/* Masks for Flags field above */
891 612
892#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ 613#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
893 614
894/* Values for PCATCompat flag */ 615/* Values for PCATCompat flag */
895 616
896#define ACPI_MADT_DUAL_PIC 0 617#define ACPI_MADT_DUAL_PIC 0
897#define ACPI_MADT_MULTIPLE_APIC 1 618#define ACPI_MADT_MULTIPLE_APIC 1
898 619
899/* Values for subtable type in struct acpi_subtable_header */ 620/* Values for MADT subtable type in struct acpi_subtable_header */
900 621
901enum acpi_madt_type { 622enum acpi_madt_type {
902 ACPI_MADT_TYPE_LOCAL_APIC = 0, 623 ACPI_MADT_TYPE_LOCAL_APIC = 0,
@@ -1007,11 +728,11 @@ struct acpi_madt_interrupt_source {
1007 u32 flags; /* Interrupt Source Flags */ 728 u32 flags; /* Interrupt Source Flags */
1008}; 729};
1009 730
1010/* Flags field above */ 731/* Masks for Flags field above */
1011 732
1012#define ACPI_MADT_CPEI_OVERRIDE (1) 733#define ACPI_MADT_CPEI_OVERRIDE (1)
1013 734
1014/* 9: Processor Local X2_APIC (07/2008) */ 735/* 9: Processor Local X2APIC (ACPI 4.0) */
1015 736
1016struct acpi_madt_local_x2apic { 737struct acpi_madt_local_x2apic {
1017 struct acpi_subtable_header header; 738 struct acpi_subtable_header header;
@@ -1021,7 +742,7 @@ struct acpi_madt_local_x2apic {
1021 u32 uid; /* ACPI processor UID */ 742 u32 uid; /* ACPI processor UID */
1022}; 743};
1023 744
1024/* 10: Local X2APIC NMI (07/2008) */ 745/* 10: Local X2APIC NMI (ACPI 4.0) */
1025 746
1026struct acpi_madt_local_x2apic_nmi { 747struct acpi_madt_local_x2apic_nmi {
1027 struct acpi_subtable_header header; 748 struct acpi_subtable_header header;
@@ -1058,28 +779,34 @@ struct acpi_madt_local_x2apic_nmi {
1058 779
1059/******************************************************************************* 780/*******************************************************************************
1060 * 781 *
1061 * MCFG - PCI Memory Mapped Configuration table and sub-table 782 * MSCT - Maximum System Characteristics Table (ACPI 4.0)
783 * Version 1
1062 * 784 *
1063 ******************************************************************************/ 785 ******************************************************************************/
1064 786
1065struct acpi_table_mcfg { 787struct acpi_table_msct {
1066 struct acpi_table_header header; /* Common ACPI table header */ 788 struct acpi_table_header header; /* Common ACPI table header */
1067 u8 reserved[8]; 789 u32 proximity_offset; /* Location of proximity info struct(s) */
790 u32 max_proximity_domains; /* Max number of proximity domains */
791 u32 max_clock_domains; /* Max number of clock domains */
792 u64 max_address; /* Max physical address in system */
1068}; 793};
1069 794
1070/* Subtable */ 795/* Subtable - Maximum Proximity Domain Information. Version 1 */
1071 796
1072struct acpi_mcfg_allocation { 797struct acpi_msct_proximity {
1073 u64 address; /* Base address, processor-relative */ 798 u8 revision;
1074 u16 pci_segment; /* PCI segment group number */ 799 u8 length;
1075 u8 start_bus_number; /* Starting PCI Bus number */ 800 u32 range_start; /* Start of domain range */
1076 u8 end_bus_number; /* Final PCI Bus number */ 801 u32 range_end; /* End of domain range */
1077 u32 reserved; 802 u32 processor_capacity;
803 u64 memory_capacity; /* In bytes */
1078}; 804};
1079 805
1080/******************************************************************************* 806/*******************************************************************************
1081 * 807 *
1082 * SBST - Smart Battery Specification Table 808 * SBST - Smart Battery Specification Table
809 * Version 1
1083 * 810 *
1084 ******************************************************************************/ 811 ******************************************************************************/
1085 812
@@ -1093,6 +820,7 @@ struct acpi_table_sbst {
1093/******************************************************************************* 820/*******************************************************************************
1094 * 821 *
1095 * SLIT - System Locality Distance Information Table 822 * SLIT - System Locality Distance Information Table
823 * Version 1
1096 * 824 *
1097 ******************************************************************************/ 825 ******************************************************************************/
1098 826
@@ -1104,60 +832,8 @@ struct acpi_table_slit {
1104 832
1105/******************************************************************************* 833/*******************************************************************************
1106 * 834 *
1107 * SPCR - Serial Port Console Redirection table
1108 *
1109 ******************************************************************************/
1110
1111struct acpi_table_spcr {
1112 struct acpi_table_header header; /* Common ACPI table header */
1113 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
1114 u8 reserved[3];
1115 struct acpi_generic_address serial_port;
1116 u8 interrupt_type;
1117 u8 pc_interrupt;
1118 u32 interrupt;
1119 u8 baud_rate;
1120 u8 parity;
1121 u8 stop_bits;
1122 u8 flow_control;
1123 u8 terminal_type;
1124 u8 reserved1;
1125 u16 pci_device_id;
1126 u16 pci_vendor_id;
1127 u8 pci_bus;
1128 u8 pci_device;
1129 u8 pci_function;
1130 u32 pci_flags;
1131 u8 pci_segment;
1132 u32 reserved2;
1133};
1134
1135/*******************************************************************************
1136 *
1137 * SPMI - Server Platform Management Interface table
1138 *
1139 ******************************************************************************/
1140
1141struct acpi_table_spmi {
1142 struct acpi_table_header header; /* Common ACPI table header */
1143 u8 reserved;
1144 u8 interface_type;
1145 u16 spec_revision; /* Version of IPMI */
1146 u8 interrupt_type;
1147 u8 gpe_number; /* GPE assigned */
1148 u8 reserved1;
1149 u8 pci_device_flag;
1150 u32 interrupt;
1151 struct acpi_generic_address ipmi_register;
1152 u8 pci_segment;
1153 u8 pci_bus;
1154 u8 pci_device;
1155 u8 pci_function;
1156};
1157
1158/*******************************************************************************
1159 *
1160 * SRAT - System Resource Affinity Table 835 * SRAT - System Resource Affinity Table
836 * Version 3
1161 * 837 *
1162 ******************************************************************************/ 838 ******************************************************************************/
1163 839
@@ -1192,6 +868,10 @@ struct acpi_srat_cpu_affinity {
1192 u32 reserved; /* Reserved, must be zero */ 868 u32 reserved; /* Reserved, must be zero */
1193}; 869};
1194 870
871/* Flags */
872
873#define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */
874
1195/* 1: Memory Affinity */ 875/* 1: Memory Affinity */
1196 876
1197struct acpi_srat_mem_affinity { 877struct acpi_srat_mem_affinity {
@@ -1211,7 +891,7 @@ struct acpi_srat_mem_affinity {
1211#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ 891#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
1212#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ 892#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
1213 893
1214/* 2: Processor Local X2_APIC Affinity (07/2008) */ 894/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */
1215 895
1216struct acpi_srat_x2apic_cpu_affinity { 896struct acpi_srat_x2apic_cpu_affinity {
1217 struct acpi_subtable_header header; 897 struct acpi_subtable_header header;
@@ -1219,122 +899,14 @@ struct acpi_srat_x2apic_cpu_affinity {
1219 u32 proximity_domain; 899 u32 proximity_domain;
1220 u32 apic_id; 900 u32 apic_id;
1221 u32 flags; 901 u32 flags;
902 u32 clock_domain;
903 u32 reserved2;
1222}; 904};
1223 905
1224/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ 906/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
1225 907
1226#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ 908#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
1227 909
1228/*******************************************************************************
1229 *
1230 * TCPA - Trusted Computing Platform Alliance table
1231 *
1232 ******************************************************************************/
1233
1234struct acpi_table_tcpa {
1235 struct acpi_table_header header; /* Common ACPI table header */
1236 u16 reserved;
1237 u32 max_log_length; /* Maximum length for the event log area */
1238 u64 log_address; /* Address of the event log area */
1239};
1240
1241/*******************************************************************************
1242 *
1243 * UEFI - UEFI Boot optimization Table
1244 *
1245 ******************************************************************************/
1246
1247struct acpi_table_uefi {
1248 struct acpi_table_header header; /* Common ACPI table header */
1249 u8 identifier[16]; /* UUID identifier */
1250 u16 data_offset; /* Offset of remaining data in table */
1251 u8 data;
1252};
1253
1254/*******************************************************************************
1255 *
1256 * WDAT - Watchdog Action Table
1257 *
1258 ******************************************************************************/
1259
1260struct acpi_table_wdat {
1261 struct acpi_table_header header; /* Common ACPI table header */
1262 u32 header_length; /* Watchdog Header Length */
1263 u16 pci_segment; /* PCI Segment number */
1264 u8 pci_bus; /* PCI Bus number */
1265 u8 pci_device; /* PCI Device number */
1266 u8 pci_function; /* PCI Function number */
1267 u8 reserved[3];
1268 u32 timer_period; /* Period of one timer count (msec) */
1269 u32 max_count; /* Maximum counter value supported */
1270 u32 min_count; /* Minimum counter value */
1271 u8 flags;
1272 u8 reserved2[3];
1273 u32 entries; /* Number of watchdog entries that follow */
1274};
1275
1276/* WDAT Instruction Entries (actions) */
1277
1278struct acpi_wdat_entry {
1279 struct acpi_whea_header whea_header; /* Common header for WHEA tables */
1280};
1281
1282/* Values for Action field above */
1283
1284enum acpi_wdat_actions {
1285 ACPI_WDAT_RESET = 1,
1286 ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4,
1287 ACPI_WDAT_GET_COUNTDOWN = 5,
1288 ACPI_WDAT_SET_COUNTDOWN = 6,
1289 ACPI_WDAT_GET_RUNNING_STATE = 8,
1290 ACPI_WDAT_SET_RUNNING_STATE = 9,
1291 ACPI_WDAT_GET_STOPPED_STATE = 10,
1292 ACPI_WDAT_SET_STOPPED_STATE = 11,
1293 ACPI_WDAT_GET_REBOOT = 16,
1294 ACPI_WDAT_SET_REBOOT = 17,
1295 ACPI_WDAT_GET_SHUTDOWN = 18,
1296 ACPI_WDAT_SET_SHUTDOWN = 19,
1297 ACPI_WDAT_GET_STATUS = 32,
1298 ACPI_WDAT_SET_STATUS = 33,
1299 ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */
1300};
1301
1302/* Values for Instruction field above */
1303
1304enum acpi_wdat_instructions {
1305 ACPI_WDAT_READ_VALUE = 0,
1306 ACPI_WDAT_READ_COUNTDOWN = 1,
1307 ACPI_WDAT_WRITE_VALUE = 2,
1308 ACPI_WDAT_WRITE_COUNTDOWN = 3,
1309 ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */
1310 ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */
1311};
1312
1313/*******************************************************************************
1314 *
1315 * WDRT - Watchdog Resource Table
1316 *
1317 ******************************************************************************/
1318
1319struct acpi_table_wdrt {
1320 struct acpi_table_header header; /* Common ACPI table header */
1321 u32 header_length; /* Watchdog Header Length */
1322 u8 pci_segment; /* PCI Segment number */
1323 u8 pci_bus; /* PCI Bus number */
1324 u8 pci_device; /* PCI Device number */
1325 u8 pci_function; /* PCI Function number */
1326 u32 timer_period; /* Period of one timer count (msec) */
1327 u32 max_count; /* Maximum counter value supported */
1328 u32 min_count; /* Minimum counter value */
1329 u8 flags;
1330 u8 reserved[3];
1331 u32 entries; /* Number of watchdog entries that follow */
1332};
1333
1334/* Flags */
1335
1336#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
1337
1338/* Reset to default packing */ 910/* Reset to default packing */
1339 911
1340#pragma pack() 912#pragma pack()
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
new file mode 100644
index 000000000000..6f3dce9991e1
--- /dev/null
+++ b/include/acpi/actbl2.h
@@ -0,0 +1,868 @@
1#ifndef __ACTBL2_H__
2#define __ACTBL2_H__
3
4/*******************************************************************************
5 *
6 * Additional ACPI Tables (2)
7 *
8 * These tables are not consumed directly by the ACPICA subsystem, but are
9 * included here to support device drivers and the AML disassembler.
10 *
11 * The tables in this file are defined by third-party specifications, and are
12 * not defined directly by the ACPI specification itself.
13 *
14 ******************************************************************************/
15
16/*
17 * Values for description table header signatures for tables defined in this
18 * file. Useful because they make it more difficult to inadvertently type in
19 * the wrong signature.
20 */
21#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
22#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
23#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
24#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
25#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
26#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
27#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
28#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
29#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
30#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
31#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
32#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
33#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
34#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
35#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
36#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
37
38/*
39 * All tables must be byte-packed to match the ACPI specification, since
40 * the tables are provided by the system BIOS.
41 */
42#pragma pack(1)
43
44/*
45 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
46 * This is the only type that is even remotely portable. Anything else is not
47 * portable, so do not use any other bitfield types.
48 */
49
50/*******************************************************************************
51 *
52 * ASF - Alert Standard Format table (Signature "ASF!")
53 * Revision 0x10
54 *
55 * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
56 *
57 ******************************************************************************/
58
59struct acpi_table_asf {
60 struct acpi_table_header header; /* Common ACPI table header */
61};
62
63/* ASF subtable header */
64
65struct acpi_asf_header {
66 u8 type;
67 u8 reserved;
68 u16 length;
69};
70
71/* Values for Type field above */
72
73enum acpi_asf_type {
74 ACPI_ASF_TYPE_INFO = 0,
75 ACPI_ASF_TYPE_ALERT = 1,
76 ACPI_ASF_TYPE_CONTROL = 2,
77 ACPI_ASF_TYPE_BOOT = 3,
78 ACPI_ASF_TYPE_ADDRESS = 4,
79 ACPI_ASF_TYPE_RESERVED = 5
80};
81
82/*
83 * ASF subtables
84 */
85
86/* 0: ASF Information */
87
88struct acpi_asf_info {
89 struct acpi_asf_header header;
90 u8 min_reset_value;
91 u8 min_poll_interval;
92 u16 system_id;
93 u32 mfg_id;
94 u8 flags;
95 u8 reserved2[3];
96};
97
98/* Masks for Flags field above */
99
100#define ACPI_ASF_SMBUS_PROTOCOLS (1)
101
102/* 1: ASF Alerts */
103
104struct acpi_asf_alert {
105 struct acpi_asf_header header;
106 u8 assert_mask;
107 u8 deassert_mask;
108 u8 alerts;
109 u8 data_length;
110};
111
112struct acpi_asf_alert_data {
113 u8 address;
114 u8 command;
115 u8 mask;
116 u8 value;
117 u8 sensor_type;
118 u8 type;
119 u8 offset;
120 u8 source_type;
121 u8 severity;
122 u8 sensor_number;
123 u8 entity;
124 u8 instance;
125};
126
127/* 2: ASF Remote Control */
128
129struct acpi_asf_remote {
130 struct acpi_asf_header header;
131 u8 controls;
132 u8 data_length;
133 u16 reserved2;
134};
135
136struct acpi_asf_control_data {
137 u8 function;
138 u8 address;
139 u8 command;
140 u8 value;
141};
142
143/* 3: ASF RMCP Boot Options */
144
145struct acpi_asf_rmcp {
146 struct acpi_asf_header header;
147 u8 capabilities[7];
148 u8 completion_code;
149 u32 enterprise_id;
150 u8 command;
151 u16 parameter;
152 u16 boot_options;
153 u16 oem_parameters;
154};
155
156/* 4: ASF Address */
157
158struct acpi_asf_address {
159 struct acpi_asf_header header;
160 u8 eprom_address;
161 u8 devices;
162};
163
164/*******************************************************************************
165 *
166 * BOOT - Simple Boot Flag Table
167 * Version 1
168 *
169 * Conforms to the "Simple Boot Flag Specification", Version 2.1
170 *
171 ******************************************************************************/
172
173struct acpi_table_boot {
174 struct acpi_table_header header; /* Common ACPI table header */
175 u8 cmos_index; /* Index in CMOS RAM for the boot register */
176 u8 reserved[3];
177};
178
179/*******************************************************************************
180 *
181 * DBGP - Debug Port table
182 * Version 1
183 *
184 * Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000
185 *
186 ******************************************************************************/
187
188struct acpi_table_dbgp {
189 struct acpi_table_header header; /* Common ACPI table header */
190 u8 type; /* 0=full 16550, 1=subset of 16550 */
191 u8 reserved[3];
192 struct acpi_generic_address debug_port;
193};
194
195/*******************************************************************************
196 *
197 * DMAR - DMA Remapping table
198 * Version 1
199 *
200 * Conforms to "Intel Virtualization Technology for Directed I/O",
201 * Version 1.2, Sept. 2008
202 *
203 ******************************************************************************/
204
205struct acpi_table_dmar {
206 struct acpi_table_header header; /* Common ACPI table header */
207 u8 width; /* Host Address Width */
208 u8 flags;
209 u8 reserved[10];
210};
211
212/* Masks for Flags field above */
213
214#define ACPI_DMAR_INTR_REMAP (1)
215
216/* DMAR subtable header */
217
218struct acpi_dmar_header {
219 u16 type;
220 u16 length;
221};
222
223/* Values for subtable type in struct acpi_dmar_header */
224
225enum acpi_dmar_type {
226 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
227 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
228 ACPI_DMAR_TYPE_ATSR = 2,
229 ACPI_DMAR_HARDWARE_AFFINITY = 3,
230 ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */
231};
232
233/* DMAR Device Scope structure */
234
235struct acpi_dmar_device_scope {
236 u8 entry_type;
237 u8 length;
238 u16 reserved;
239 u8 enumeration_id;
240 u8 bus;
241};
242
243/* Values for entry_type in struct acpi_dmar_device_scope */
244
245enum acpi_dmar_scope_type {
246 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
247 ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
248 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
249 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
250 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
251 ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */
252};
253
254struct acpi_dmar_pci_path {
255 u8 dev;
256 u8 fn;
257};
258
259/*
260 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header
261 */
262
263/* 0: Hardware Unit Definition */
264
265struct acpi_dmar_hardware_unit {
266 struct acpi_dmar_header header;
267 u8 flags;
268 u8 reserved;
269 u16 segment;
270 u64 address; /* Register Base Address */
271};
272
273/* Masks for Flags field above */
274
275#define ACPI_DMAR_INCLUDE_ALL (1)
276
277/* 1: Reserved Memory Defininition */
278
279struct acpi_dmar_reserved_memory {
280 struct acpi_dmar_header header;
281 u16 reserved;
282 u16 segment;
283 u64 base_address; /* 4_k aligned base address */
284 u64 end_address; /* 4_k aligned limit address */
285};
286
287/* Masks for Flags field above */
288
289#define ACPI_DMAR_ALLOW_ALL (1)
290
291/* 2: Root Port ATS Capability Reporting Structure */
292
293struct acpi_dmar_atsr {
294 struct acpi_dmar_header header;
295 u8 flags;
296 u8 reserved;
297 u16 segment;
298};
299
300/* Masks for Flags field above */
301
302#define ACPI_DMAR_ALL_PORTS (1)
303
304/* 3: Remapping Hardware Static Affinity Structure */
305
306struct acpi_dmar_rhsa {
307 struct acpi_dmar_header header;
308 u32 reserved;
309 u64 base_address;
310 u32 proximity_domain;
311};
312
313/*******************************************************************************
314 *
315 * HPET - High Precision Event Timer table
316 * Version 1
317 *
318 * Conforms to "IA-PC HPET (High Precision Event Timers) Specification",
319 * Version 1.0a, October 2004
320 *
321 ******************************************************************************/
322
323struct acpi_table_hpet {
324 struct acpi_table_header header; /* Common ACPI table header */
325 u32 id; /* Hardware ID of event timer block */
326 struct acpi_generic_address address; /* Address of event timer block */
327 u8 sequence; /* HPET sequence number */
328 u16 minimum_tick; /* Main counter min tick, periodic mode */
329 u8 flags;
330};
331
332/* Masks for Flags field above */
333
334#define ACPI_HPET_PAGE_PROTECT_MASK (3)
335
336/* Values for Page Protect flags */
337
338enum acpi_hpet_page_protect {
339 ACPI_HPET_NO_PAGE_PROTECT = 0,
340 ACPI_HPET_PAGE_PROTECT4 = 1,
341 ACPI_HPET_PAGE_PROTECT64 = 2
342};
343
344/*******************************************************************************
345 *
346 * IBFT - Boot Firmware Table
347 * Version 1
348 *
349 * Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b
350 * Specification", Version 1.01, March 1, 2007
351 *
352 * Note: It appears that this table is not intended to appear in the RSDT/XSDT.
353 * Therefore, it is not currently supported by the disassembler.
354 *
355 ******************************************************************************/
356
357struct acpi_table_ibft {
358 struct acpi_table_header header; /* Common ACPI table header */
359 u8 reserved[12];
360};
361
362/* IBFT common subtable header */
363
364struct acpi_ibft_header {
365 u8 type;
366 u8 version;
367 u16 length;
368 u8 index;
369 u8 flags;
370};
371
372/* Values for Type field above */
373
374enum acpi_ibft_type {
375 ACPI_IBFT_TYPE_NOT_USED = 0,
376 ACPI_IBFT_TYPE_CONTROL = 1,
377 ACPI_IBFT_TYPE_INITIATOR = 2,
378 ACPI_IBFT_TYPE_NIC = 3,
379 ACPI_IBFT_TYPE_TARGET = 4,
380 ACPI_IBFT_TYPE_EXTENSIONS = 5,
381 ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */
382};
383
384/* IBFT subtables */
385
386struct acpi_ibft_control {
387 struct acpi_ibft_header header;
388 u16 extensions;
389 u16 initiator_offset;
390 u16 nic0_offset;
391 u16 target0_offset;
392 u16 nic1_offset;
393 u16 target1_offset;
394};
395
396struct acpi_ibft_initiator {
397 struct acpi_ibft_header header;
398 u8 sns_server[16];
399 u8 slp_server[16];
400 u8 primary_server[16];
401 u8 secondary_server[16];
402 u16 name_length;
403 u16 name_offset;
404};
405
406struct acpi_ibft_nic {
407 struct acpi_ibft_header header;
408 u8 ip_address[16];
409 u8 subnet_mask_prefix;
410 u8 origin;
411 u8 gateway[16];
412 u8 primary_dns[16];
413 u8 secondary_dns[16];
414 u8 dhcp[16];
415 u16 vlan;
416 u8 mac_address[6];
417 u16 pci_address;
418 u16 name_length;
419 u16 name_offset;
420};
421
422struct acpi_ibft_target {
423 struct acpi_ibft_header header;
424 u8 target_ip_address[16];
425 u16 target_ip_socket;
426 u8 target_boot_lun[8];
427 u8 chap_type;
428 u8 nic_association;
429 u16 target_name_length;
430 u16 target_name_offset;
431 u16 chap_name_length;
432 u16 chap_name_offset;
433 u16 chap_secret_length;
434 u16 chap_secret_offset;
435 u16 reverse_chap_name_length;
436 u16 reverse_chap_name_offset;
437 u16 reverse_chap_secret_length;
438 u16 reverse_chap_secret_offset;
439};
440
441/*******************************************************************************
442 *
443 * IVRS - I/O Virtualization Reporting Structure
444 * Version 1
445 *
446 * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
447 * Revision 1.26, February 2009.
448 *
449 ******************************************************************************/
450
451struct acpi_table_ivrs {
452 struct acpi_table_header header; /* Common ACPI table header */
453 u32 info; /* Common virtualization info */
454 u64 reserved;
455};
456
457/* Values for Info field above */
458
459#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */
460#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */
461#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */
462
463/* IVRS subtable header */
464
465struct acpi_ivrs_header {
466 u8 type; /* Subtable type */
467 u8 flags;
468 u16 length; /* Subtable length */
469 u16 device_id; /* ID of IOMMU */
470};
471
472/* Values for subtable Type above */
473
474enum acpi_ivrs_type {
475 ACPI_IVRS_TYPE_HARDWARE = 0x10,
476 ACPI_IVRS_TYPE_MEMORY1 = 0x20,
477 ACPI_IVRS_TYPE_MEMORY2 = 0x21,
478 ACPI_IVRS_TYPE_MEMORY3 = 0x22
479};
480
481/* Masks for Flags field above for IVHD subtable */
482
483#define ACPI_IVHD_TT_ENABLE (1)
484#define ACPI_IVHD_PASS_PW (1<<1)
485#define ACPI_IVHD_RES_PASS_PW (1<<2)
486#define ACPI_IVHD_ISOC (1<<3)
487#define ACPI_IVHD_IOTLB (1<<4)
488
489/* Masks for Flags field above for IVMD subtable */
490
491#define ACPI_IVMD_UNITY (1)
492#define ACPI_IVMD_READ (1<<1)
493#define ACPI_IVMD_WRITE (1<<2)
494#define ACPI_IVMD_EXCLUSION_RANGE (1<<3)
495
496/*
497 * IVRS subtables, correspond to Type in struct acpi_ivrs_header
498 */
499
500/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
501
502struct acpi_ivrs_hardware {
503 struct acpi_ivrs_header header;
504 u16 capability_offset; /* Offset for IOMMU control fields */
505 u64 base_address; /* IOMMU control registers */
506 u16 pci_segment_group;
507 u16 info; /* MSI number and unit ID */
508 u32 reserved;
509};
510
511/* Masks for Info field above */
512
513#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */
514#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_iD */
515
516/*
517 * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
518 * Upper two bits of the Type field are the (encoded) length of the structure.
519 * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
520 * are reserved for future use but not defined.
521 */
522struct acpi_ivrs_de_header {
523 u8 type;
524 u16 id;
525 u8 data_setting;
526};
527
528/* Length of device entry is in the top two bits of Type field above */
529
530#define ACPI_IVHD_ENTRY_LENGTH 0xC0
531
532/* Values for device entry Type field above */
533
534enum acpi_ivrs_device_entry_type {
535 /* 4-byte device entries, all use struct acpi_ivrs_device4 */
536
537 ACPI_IVRS_TYPE_PAD4 = 0,
538 ACPI_IVRS_TYPE_ALL = 1,
539 ACPI_IVRS_TYPE_SELECT = 2,
540 ACPI_IVRS_TYPE_START = 3,
541 ACPI_IVRS_TYPE_END = 4,
542
543 /* 8-byte device entries */
544
545 ACPI_IVRS_TYPE_PAD8 = 64,
546 ACPI_IVRS_TYPE_NOT_USED = 65,
547 ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */
548 ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */
549 ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */
550 ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */
551 ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses struct acpi_ivrs_device8c */
552};
553
554/* Values for Data field above */
555
556#define ACPI_IVHD_INIT_PASS (1)
557#define ACPI_IVHD_EINT_PASS (1<<1)
558#define ACPI_IVHD_NMI_PASS (1<<2)
559#define ACPI_IVHD_SYSTEM_MGMT (3<<4)
560#define ACPI_IVHD_LINT0_PASS (1<<6)
561#define ACPI_IVHD_LINT1_PASS (1<<7)
562
563/* Types 0-4: 4-byte device entry */
564
565struct acpi_ivrs_device4 {
566 struct acpi_ivrs_de_header header;
567};
568
569/* Types 66-67: 8-byte device entry */
570
571struct acpi_ivrs_device8a {
572 struct acpi_ivrs_de_header header;
573 u8 reserved1;
574 u16 used_id;
575 u8 reserved2;
576};
577
578/* Types 70-71: 8-byte device entry */
579
580struct acpi_ivrs_device8b {
581 struct acpi_ivrs_de_header header;
582 u32 extended_data;
583};
584
585/* Values for extended_data above */
586
587#define ACPI_IVHD_ATS_DISABLED (1<<31)
588
589/* Type 72: 8-byte device entry */
590
591struct acpi_ivrs_device8c {
592 struct acpi_ivrs_de_header header;
593 u8 handle;
594 u16 used_id;
595 u8 variety;
596};
597
598/* Values for Variety field above */
599
600#define ACPI_IVHD_IOAPIC 1
601#define ACPI_IVHD_HPET 2
602
603/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
604
605struct acpi_ivrs_memory {
606 struct acpi_ivrs_header header;
607 u16 aux_data;
608 u64 reserved;
609 u64 start_address;
610 u64 memory_length;
611};
612
613/*******************************************************************************
614 *
615 * MCFG - PCI Memory Mapped Configuration table and sub-table
616 * Version 1
617 *
618 * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
619 *
620 ******************************************************************************/
621
622struct acpi_table_mcfg {
623 struct acpi_table_header header; /* Common ACPI table header */
624 u8 reserved[8];
625};
626
627/* Subtable */
628
629struct acpi_mcfg_allocation {
630 u64 address; /* Base address, processor-relative */
631 u16 pci_segment; /* PCI segment group number */
632 u8 start_bus_number; /* Starting PCI Bus number */
633 u8 end_bus_number; /* Final PCI Bus number */
634 u32 reserved;
635};
636
637/*******************************************************************************
638 *
639 * SPCR - Serial Port Console Redirection table
640 * Version 1
641 *
642 * Conforms to "Serial Port Console Redirection Table",
643 * Version 1.00, January 11, 2002
644 *
645 ******************************************************************************/
646
647struct acpi_table_spcr {
648 struct acpi_table_header header; /* Common ACPI table header */
649 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
650 u8 reserved[3];
651 struct acpi_generic_address serial_port;
652 u8 interrupt_type;
653 u8 pc_interrupt;
654 u32 interrupt;
655 u8 baud_rate;
656 u8 parity;
657 u8 stop_bits;
658 u8 flow_control;
659 u8 terminal_type;
660 u8 reserved1;
661 u16 pci_device_id;
662 u16 pci_vendor_id;
663 u8 pci_bus;
664 u8 pci_device;
665 u8 pci_function;
666 u32 pci_flags;
667 u8 pci_segment;
668 u32 reserved2;
669};
670
671/* Masks for pci_flags field above */
672
673#define ACPI_SPCR_DO_NOT_DISABLE (1)
674
675/*******************************************************************************
676 *
677 * SPMI - Server Platform Management Interface table
678 * Version 5
679 *
680 * Conforms to "Intelligent Platform Management Interface Specification
681 * Second Generation v2.0", Document Revision 1.0, February 12, 2004 with
682 * June 12, 2009 markup.
683 *
684 ******************************************************************************/
685
686struct acpi_table_spmi {
687 struct acpi_table_header header; /* Common ACPI table header */
688 u8 interface_type;
689 u8 reserved; /* Must be 1 */
690 u16 spec_revision; /* Version of IPMI */
691 u8 interrupt_type;
692 u8 gpe_number; /* GPE assigned */
693 u8 reserved1;
694 u8 pci_device_flag;
695 u32 interrupt;
696 struct acpi_generic_address ipmi_register;
697 u8 pci_segment;
698 u8 pci_bus;
699 u8 pci_device;
700 u8 pci_function;
701 u8 reserved2;
702};
703
704/* Values for interface_type above */
705
706enum acpi_spmi_interface_types {
707 ACPI_SPMI_NOT_USED = 0,
708 ACPI_SPMI_KEYBOARD = 1,
709 ACPI_SPMI_SMI = 2,
710 ACPI_SPMI_BLOCK_TRANSFER = 3,
711 ACPI_SPMI_SMBUS = 4,
712 ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */
713};
714
715/*******************************************************************************
716 *
717 * TCPA - Trusted Computing Platform Alliance table
718 * Version 1
719 *
720 * Conforms to "TCG PC Specific Implementation Specification",
721 * Version 1.1, August 18, 2003
722 *
723 ******************************************************************************/
724
725struct acpi_table_tcpa {
726 struct acpi_table_header header; /* Common ACPI table header */
727 u16 reserved;
728 u32 max_log_length; /* Maximum length for the event log area */
729 u64 log_address; /* Address of the event log area */
730};
731
732/*******************************************************************************
733 *
734 * UEFI - UEFI Boot optimization Table
735 * Version 1
736 *
737 * Conforms to "Unified Extensible Firmware Interface Specification",
738 * Version 2.3, May 8, 2009
739 *
740 ******************************************************************************/
741
742struct acpi_table_uefi {
743 struct acpi_table_header header; /* Common ACPI table header */
744 u8 identifier[16]; /* UUID identifier */
745 u16 data_offset; /* Offset of remaining data in table */
746};
747
748/*******************************************************************************
749 *
750 * WAET - Windows ACPI Emulated devices Table
751 * Version 1
752 *
753 * Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009
754 *
755 ******************************************************************************/
756
757struct acpi_table_waet {
758 struct acpi_table_header header; /* Common ACPI table header */
759 u32 flags;
760};
761
762/* Masks for Flags field above */
763
764#define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */
765#define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */
766
767/*******************************************************************************
768 *
769 * WDAT - Watchdog Action Table
770 * Version 1
771 *
772 * Conforms to "Hardware Watchdog Timers Design Specification",
773 * Copyright 2006 Microsoft Corporation.
774 *
775 ******************************************************************************/
776
777struct acpi_table_wdat {
778 struct acpi_table_header header; /* Common ACPI table header */
779 u32 header_length; /* Watchdog Header Length */
780 u16 pci_segment; /* PCI Segment number */
781 u8 pci_bus; /* PCI Bus number */
782 u8 pci_device; /* PCI Device number */
783 u8 pci_function; /* PCI Function number */
784 u8 reserved[3];
785 u32 timer_period; /* Period of one timer count (msec) */
786 u32 max_count; /* Maximum counter value supported */
787 u32 min_count; /* Minimum counter value */
788 u8 flags;
789 u8 reserved2[3];
790 u32 entries; /* Number of watchdog entries that follow */
791};
792
793/* Masks for Flags field above */
794
795#define ACPI_WDAT_ENABLED (1)
796#define ACPI_WDAT_STOPPED 0x80
797
798/* WDAT Instruction Entries (actions) */
799
800struct acpi_wdat_entry {
801 u8 action;
802 u8 instruction;
803 u16 reserved;
804 struct acpi_generic_address register_region;
805 u32 value; /* Value used with Read/Write register */
806 u32 mask; /* Bitmask required for this register instruction */
807};
808
809/* Values for Action field above */
810
811enum acpi_wdat_actions {
812 ACPI_WDAT_RESET = 1,
813 ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4,
814 ACPI_WDAT_GET_COUNTDOWN = 5,
815 ACPI_WDAT_SET_COUNTDOWN = 6,
816 ACPI_WDAT_GET_RUNNING_STATE = 8,
817 ACPI_WDAT_SET_RUNNING_STATE = 9,
818 ACPI_WDAT_GET_STOPPED_STATE = 10,
819 ACPI_WDAT_SET_STOPPED_STATE = 11,
820 ACPI_WDAT_GET_REBOOT = 16,
821 ACPI_WDAT_SET_REBOOT = 17,
822 ACPI_WDAT_GET_SHUTDOWN = 18,
823 ACPI_WDAT_SET_SHUTDOWN = 19,
824 ACPI_WDAT_GET_STATUS = 32,
825 ACPI_WDAT_SET_STATUS = 33,
826 ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */
827};
828
829/* Values for Instruction field above */
830
831enum acpi_wdat_instructions {
832 ACPI_WDAT_READ_VALUE = 0,
833 ACPI_WDAT_READ_COUNTDOWN = 1,
834 ACPI_WDAT_WRITE_VALUE = 2,
835 ACPI_WDAT_WRITE_COUNTDOWN = 3,
836 ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */
837 ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */
838};
839
840/*******************************************************************************
841 *
842 * WDRT - Watchdog Resource Table
843 * Version 1
844 *
845 * Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003",
846 * Version 1.01, August 28, 2006
847 *
848 ******************************************************************************/
849
850struct acpi_table_wdrt {
851 struct acpi_table_header header; /* Common ACPI table header */
852 struct acpi_generic_address control_register;
853 struct acpi_generic_address count_register;
854 u16 pci_device_id;
855 u16 pci_vendor_id;
856 u8 pci_bus; /* PCI Bus number */
857 u8 pci_device; /* PCI Device number */
858 u8 pci_function; /* PCI Function number */
859 u8 pci_segment; /* PCI Segment number */
860 u16 max_count; /* Maximum counter value supported */
861 u8 units;
862};
863
864/* Reset to default packing */
865
866#pragma pack()
867
868#endif /* __ACTBL2_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 37ba576d06e8..153f12dc3373 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -288,7 +288,7 @@ typedef u32 acpi_physical_address;
288/* 288/*
289 * Some compilers complain about unused variables. Sometimes we don't want to 289 * Some compilers complain about unused variables. Sometimes we don't want to
290 * use all the variables (for example, _acpi_module_name). This allows us 290 * use all the variables (for example, _acpi_module_name). This allows us
291 * to to tell the compiler in a per-variable manner that a variable 291 * to tell the compiler in a per-variable manner that a variable
292 * is unused 292 * is unused
293 */ 293 */
294#ifndef ACPI_UNUSED_VAR 294#ifndef ACPI_UNUSED_VAR
@@ -338,7 +338,7 @@ typedef u32 acpi_physical_address;
338 338
339/* PM Timer ticks per second (HZ) */ 339/* PM Timer ticks per second (HZ) */
340 340
341#define PM_TIMER_FREQUENCY 3579545 341#define PM_TIMER_FREQUENCY 3579545
342 342
343/******************************************************************************* 343/*******************************************************************************
344 * 344 *
@@ -732,7 +732,8 @@ typedef u8 acpi_adr_space_type;
732#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 732#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4
733#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 733#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
734#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 734#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
735#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 735#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
736#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 8
736#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 737#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127
737 738
738/* 739/*
@@ -921,7 +922,7 @@ typedef
921void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); 922void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
922 923
923typedef 924typedef
924void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); 925void (*acpi_object_handler) (acpi_handle object, void *data);
925 926
926typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); 927typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
927 928
@@ -969,38 +970,60 @@ acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
969#define ACPI_INTERRUPT_NOT_HANDLED 0x00 970#define ACPI_INTERRUPT_NOT_HANDLED 0x00
970#define ACPI_INTERRUPT_HANDLED 0x01 971#define ACPI_INTERRUPT_HANDLED 0x01
971 972
972/* Length of _HID, _UID, _CID, and UUID values */ 973/* Length of 32-bit EISAID values when converted back to a string */
974
975#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */
976
977/* Length of UUID (string) values */
973 978
974#define ACPI_DEVICE_ID_LENGTH 0x09
975#define ACPI_MAX_CID_LENGTH 48
976#define ACPI_UUID_LENGTH 16 979#define ACPI_UUID_LENGTH 16
977 980
978/* Common string version of device HIDs and UIDs */ 981/* Structures used for device/processor HID, UID, CID */
979 982
980struct acpica_device_id { 983struct acpica_device_id {
981 char value[ACPI_DEVICE_ID_LENGTH]; 984 u32 length; /* Length of string + null */
985 char *string;
982}; 986};
983 987
984/* Common string version of device CIDs */ 988struct acpica_device_id_list {
985 989 u32 count; /* Number of IDs in Ids array */
986struct acpi_compatible_id { 990 u32 list_size; /* Size of list, including ID strings */
987 char value[ACPI_MAX_CID_LENGTH]; 991 struct acpica_device_id ids[1]; /* ID array */
988}; 992};
989 993
990struct acpi_compatible_id_list { 994/*
991 u32 count; 995 * Structure returned from acpi_get_object_info.
992 u32 size; 996 * Optimized for both 32- and 64-bit builds
993 struct acpi_compatible_id id[1]; 997 */
998struct acpi_device_info {
999 u32 info_size; /* Size of info, including ID strings */
1000 u32 name; /* ACPI object Name */
1001 acpi_object_type type; /* ACPI object Type */
1002 u8 param_count; /* If a method, required parameter count */
1003 u8 valid; /* Indicates which optional fields are valid */
1004 u8 flags; /* Miscellaneous info */
1005 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
1006 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */
1007 u32 current_status; /* _STA value */
1008 acpi_integer address; /* _ADR value */
1009 struct acpica_device_id hardware_id; /* _HID value */
1010 struct acpica_device_id unique_id; /* _UID value */
1011 struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */
994}; 1012};
995 1013
996/* Structure and flags for acpi_get_object_info */ 1014/* Values for Flags field above (acpi_get_object_info) */
1015
1016#define ACPI_PCI_ROOT_BRIDGE 0x01
997 1017
998#define ACPI_VALID_STA 0x0001 1018/* Flags for Valid field above (acpi_get_object_info) */
999#define ACPI_VALID_ADR 0x0002 1019
1000#define ACPI_VALID_HID 0x0004 1020#define ACPI_VALID_STA 0x01
1001#define ACPI_VALID_UID 0x0008 1021#define ACPI_VALID_ADR 0x02
1002#define ACPI_VALID_CID 0x0010 1022#define ACPI_VALID_HID 0x04
1003#define ACPI_VALID_SXDS 0x0020 1023#define ACPI_VALID_UID 0x08
1024#define ACPI_VALID_CID 0x10
1025#define ACPI_VALID_SXDS 0x20
1026#define ACPI_VALID_SXWS 0x40
1004 1027
1005/* Flags for _STA method */ 1028/* Flags for _STA method */
1006 1029
@@ -1011,29 +1034,6 @@ struct acpi_compatible_id_list {
1011#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1034#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
1012#define ACPI_STA_BATTERY_PRESENT 0x10 1035#define ACPI_STA_BATTERY_PRESENT 0x10
1013 1036
1014#define ACPI_COMMON_OBJ_INFO \
1015 acpi_object_type type; /* ACPI object type */ \
1016 acpi_name name /* ACPI object Name */
1017
1018struct acpi_obj_info_header {
1019 ACPI_COMMON_OBJ_INFO;
1020};
1021
1022/* Structure returned from Get Object Info */
1023
1024struct acpi_device_info {
1025 ACPI_COMMON_OBJ_INFO;
1026
1027 u32 param_count; /* If a method, required parameter count */
1028 u32 valid; /* Indicates which fields below are valid */
1029 u32 current_status; /* _STA value */
1030 acpi_integer address; /* _ADR value if any */
1031 struct acpica_device_id hardware_id; /* _HID value if any */
1032 struct acpica_device_id unique_id; /* _UID value if any */
1033 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
1034 struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */
1035};
1036
1037/* Context structs for address space handlers */ 1037/* Context structs for address space handlers */
1038 1038
1039struct acpi_pci_id { 1039struct acpi_pci_id {
diff --git a/include/acpi/button.h b/include/acpi/button.h
new file mode 100644
index 000000000000..97eea0e4c016
--- /dev/null
+++ b/include/acpi/button.h
@@ -0,0 +1,25 @@
1#ifndef ACPI_BUTTON_H
2#define ACPI_BUTTON_H
3
4#include <linux/notifier.h>
5
6#if defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE)
7extern int acpi_lid_notifier_register(struct notifier_block *nb);
8extern int acpi_lid_notifier_unregister(struct notifier_block *nb);
9extern int acpi_lid_open(void);
10#else
11static inline int acpi_lid_notifier_register(struct notifier_block *nb)
12{
13 return 0;
14}
15static inline int acpi_lid_notifier_unregister(struct notifier_block *nb)
16{
17 return 0;
18}
19static inline int acpi_lid_open(void)
20{
21 return 1;
22}
23#endif /* defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE) */
24
25#endif /* ACPI_BUTTON_H */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 935c5d7fc86e..6aadbf84ae71 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -57,7 +57,7 @@
57/* 57/*
58 * Some compilers complain about unused variables. Sometimes we don't want to 58 * Some compilers complain about unused variables. Sometimes we don't want to
59 * use all the variables (for example, _acpi_module_name). This allows us 59 * use all the variables (for example, _acpi_module_name). This allows us
60 * to to tell the compiler warning in a per-variable manner that a variable 60 * to tell the compiler warning in a per-variable manner that a variable
61 * is unused. 61 * is unused.
62 */ 62 */
63#define ACPI_UNUSED_VAR __attribute__ ((unused)) 63#define ACPI_UNUSED_VAR __attribute__ ((unused))
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index fcb8e4b159b1..9d7febde10a1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -149,10 +149,10 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
149#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
150 150
151/* Used within ACPICA to show where it is safe to preempt execution */ 151/* Used within ACPICA to show where it is safe to preempt execution */
152 152#include <linux/hardirq.h>
153#define ACPI_PREEMPTION_POINT() \ 153#define ACPI_PREEMPTION_POINT() \
154 do { \ 154 do { \
155 if (!irqs_disabled()) \ 155 if (!in_atomic_preempt_off()) \
156 cond_resched(); \ 156 cond_resched(); \
157 } while (0) 157 } while (0)
158 158
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 290910e4ede4..96d7c9804dc1 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -3,6 +3,11 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
3header-y += kvm.h 3header-y += kvm.h
4endif 4endif
5 5
6ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
7 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
8header-y += kvm_para.h
9endif
10
6ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
7 $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
8unifdef-y += a.out.h 13unifdef-y += a.out.h
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 1c1fa422d18a..ca0f239f0e13 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -7,6 +7,7 @@
7typedef unsigned long cputime_t; 7typedef unsigned long cputime_t;
8 8
9#define cputime_zero (0UL) 9#define cputime_zero (0UL)
10#define cputime_one_jiffy jiffies_to_cputime(1)
10#define cputime_max ((~0UL >> 1) - 1) 11#define cputime_max ((~0UL >> 1) - 1)
11#define cputime_add(__a, __b) ((__a) + (__b)) 12#define cputime_add(__a, __b) ((__a) + (__b))
12#define cputime_sub(__a, __b) ((__a) - (__b)) 13#define cputime_sub(__a, __b) ((__a) - (__b))
diff --git a/include/asm-generic/device.h b/include/asm-generic/device.h
index c17c9600f220..d7c76bba640d 100644
--- a/include/asm-generic/device.h
+++ b/include/asm-generic/device.h
@@ -9,4 +9,7 @@
9struct dev_archdata { 9struct dev_archdata {
10}; 10};
11 11
12struct pdev_archdata {
13};
14
12#endif /* _ASM_GENERIC_DEVICE_H */ 15#endif /* _ASM_GENERIC_DEVICE_H */
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index 5406a601185c..e694263445f7 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -103,7 +103,6 @@ static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
103 if (ops->sync_single_for_cpu) 103 if (ops->sync_single_for_cpu)
104 ops->sync_single_for_cpu(dev, addr, size, dir); 104 ops->sync_single_for_cpu(dev, addr, size, dir);
105 debug_dma_sync_single_for_cpu(dev, addr, size, dir); 105 debug_dma_sync_single_for_cpu(dev, addr, size, dir);
106 flush_write_buffers();
107} 106}
108 107
109static inline void dma_sync_single_for_device(struct device *dev, 108static inline void dma_sync_single_for_device(struct device *dev,
@@ -116,7 +115,6 @@ static inline void dma_sync_single_for_device(struct device *dev,
116 if (ops->sync_single_for_device) 115 if (ops->sync_single_for_device)
117 ops->sync_single_for_device(dev, addr, size, dir); 116 ops->sync_single_for_device(dev, addr, size, dir);
118 debug_dma_sync_single_for_device(dev, addr, size, dir); 117 debug_dma_sync_single_for_device(dev, addr, size, dir);
119 flush_write_buffers();
120} 118}
121 119
122static inline void dma_sync_single_range_for_cpu(struct device *dev, 120static inline void dma_sync_single_range_for_cpu(struct device *dev,
@@ -132,7 +130,6 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
132 ops->sync_single_range_for_cpu(dev, addr, offset, size, dir); 130 ops->sync_single_range_for_cpu(dev, addr, offset, size, dir);
133 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); 131 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
134 132
135 flush_write_buffers();
136 } else 133 } else
137 dma_sync_single_for_cpu(dev, addr, size, dir); 134 dma_sync_single_for_cpu(dev, addr, size, dir);
138} 135}
@@ -150,7 +147,6 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
150 ops->sync_single_range_for_device(dev, addr, offset, size, dir); 147 ops->sync_single_range_for_device(dev, addr, offset, size, dir);
151 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); 148 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
152 149
153 flush_write_buffers();
154 } else 150 } else
155 dma_sync_single_for_device(dev, addr, size, dir); 151 dma_sync_single_for_device(dev, addr, size, dir);
156} 152}
@@ -165,7 +161,6 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
165 if (ops->sync_sg_for_cpu) 161 if (ops->sync_sg_for_cpu)
166 ops->sync_sg_for_cpu(dev, sg, nelems, dir); 162 ops->sync_sg_for_cpu(dev, sg, nelems, dir);
167 debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir); 163 debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
168 flush_write_buffers();
169} 164}
170 165
171static inline void 166static inline void
@@ -179,7 +174,6 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
179 ops->sync_sg_for_device(dev, sg, nelems, dir); 174 ops->sync_sg_for_device(dev, sg, nelems, dir);
180 debug_dma_sync_sg_for_device(dev, sg, nelems, dir); 175 debug_dma_sync_sg_for_device(dev, sg, nelems, dir);
181 176
182 flush_write_buffers();
183} 177}
184 178
185#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL) 179#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index 4d3e48373e74..495dc8af4044 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -74,6 +74,28 @@
74#define F_GETSIG 11 /* for sockets. */ 74#define F_GETSIG 11 /* for sockets. */
75#endif 75#endif
76 76
77#ifndef CONFIG_64BIT
78#ifndef F_GETLK64
79#define F_GETLK64 12 /* using 'struct flock64' */
80#define F_SETLK64 13
81#define F_SETLKW64 14
82#endif
83#endif
84
85#ifndef F_SETOWN_EX
86#define F_SETOWN_EX 15
87#define F_GETOWN_EX 16
88#endif
89
90#define F_OWNER_TID 0
91#define F_OWNER_PID 1
92#define F_OWNER_PGRP 2
93
94struct f_owner_ex {
95 int type;
96 pid_t pid;
97};
98
77/* for F_[GET|SET]FL */ 99/* for F_[GET|SET]FL */
78#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ 100#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
79 101
@@ -126,12 +148,6 @@ struct flock {
126 148
127#ifndef CONFIG_64BIT 149#ifndef CONFIG_64BIT
128 150
129#ifndef F_GETLK64
130#define F_GETLK64 12 /* using 'struct flock64' */
131#define F_SETLK64 13
132#define F_SETLKW64 14
133#endif
134
135#ifndef HAVE_ARCH_STRUCT_FLOCK64 151#ifndef HAVE_ARCH_STRUCT_FLOCK64
136#ifndef __ARCH_FLOCK64_PAD 152#ifndef __ARCH_FLOCK64_PAD
137#define __ARCH_FLOCK64_PAD 153#define __ARCH_FLOCK64_PAD
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d6c379dc64fa..66d6106a2067 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_GENERIC_GPIO_H 1#ifndef _ASM_GENERIC_GPIO_H
2#define _ASM_GENERIC_GPIO_H 2#define _ASM_GENERIC_GPIO_H
3 3
4#include <linux/kernel.h>
4#include <linux/types.h> 5#include <linux/types.h>
5#include <linux/errno.h> 6#include <linux/errno.h>
6 7
@@ -141,6 +142,8 @@ extern int __gpio_to_irq(unsigned gpio);
141 * but more typically is configured entirely from userspace. 142 * but more typically is configured entirely from userspace.
142 */ 143 */
143extern int gpio_export(unsigned gpio, bool direction_may_change); 144extern int gpio_export(unsigned gpio, bool direction_may_change);
145extern int gpio_export_link(struct device *dev, const char *name,
146 unsigned gpio);
144extern void gpio_unexport(unsigned gpio); 147extern void gpio_unexport(unsigned gpio);
145 148
146#endif /* CONFIG_GPIO_SYSFS */ 149#endif /* CONFIG_GPIO_SYSFS */
@@ -185,6 +188,12 @@ static inline int gpio_export(unsigned gpio, bool direction_may_change)
185 return -ENOSYS; 188 return -ENOSYS;
186} 189}
187 190
191static inline int gpio_export_link(struct device *dev, const char *name,
192 unsigned gpio)
193{
194 return -ENOSYS;
195}
196
188static inline void gpio_unexport(unsigned gpio) 197static inline void gpio_unexport(unsigned gpio)
189{ 198{
190} 199}
diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h
index 23bb4dad4962..62f59080e5cc 100644
--- a/include/asm-generic/hardirq.h
+++ b/include/asm-generic/hardirq.h
@@ -6,7 +6,7 @@
6#include <linux/irq.h> 6#include <linux/irq.h>
7 7
8typedef struct { 8typedef struct {
9 unsigned long __softirq_pending; 9 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t; 10} ____cacheline_aligned irq_cpustat_t;
11 11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index eddbce0f9fb9..e5f234a08540 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -2,34 +2,35 @@
2#define _ASM_GENERIC_KMAP_TYPES_H 2#define _ASM_GENERIC_KMAP_TYPES_H
3 3
4#ifdef __WITH_KM_FENCE 4#ifdef __WITH_KM_FENCE
5# define D(n) __KM_FENCE_##n , 5# define KMAP_D(n) __KM_FENCE_##n ,
6#else 6#else
7# define D(n) 7# define KMAP_D(n)
8#endif 8#endif
9 9
10enum km_type { 10enum km_type {
11D(0) KM_BOUNCE_READ, 11KMAP_D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA, 12KMAP_D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ, 13KMAP_D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0, 14KMAP_D(3) KM_USER0,
15D(4) KM_USER1, 15KMAP_D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ, 16KMAP_D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ, 17KMAP_D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0, 18KMAP_D(7) KM_PTE0,
19D(8) KM_PTE1, 19KMAP_D(8) KM_PTE1,
20D(9) KM_IRQ0, 20KMAP_D(9) KM_IRQ0,
21D(10) KM_IRQ1, 21KMAP_D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0, 22KMAP_D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1, 23KMAP_D(12) KM_SOFTIRQ1,
24D(13) KM_SYNC_ICACHE, 24KMAP_D(13) KM_SYNC_ICACHE,
25D(14) KM_SYNC_DCACHE, 25KMAP_D(14) KM_SYNC_DCACHE,
26D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */ 26/* UML specific, for copy_*_user - used in do_op_one_page */
27D(16) KM_IRQ_PTE, 27KMAP_D(15) KM_UML_USERCOPY,
28D(17) KM_NMI, 28KMAP_D(16) KM_IRQ_PTE,
29D(18) KM_NMI_PTE, 29KMAP_D(17) KM_NMI,
30D(19) KM_TYPE_NR 30KMAP_D(18) KM_NMI_PTE,
31KMAP_D(19) KM_TYPE_NR
31}; 32};
32 33
33#undef D 34#undef KMAP_D
34 35
35#endif 36#endif
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 3b69ad34189a..5ee13b2fd223 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -34,6 +34,10 @@
34#define MADV_REMOVE 9 /* remove these pages & resources */ 34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */ 35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */ 36#define MADV_DOFORK 11 /* do inherit across fork */
37#define MADV_HWPOISON 100 /* poison a page for testing */
38
39#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
40#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
37 41
38/* compatibility flags */ 42/* compatibility flags */
39#define MAP_FILE 0 43#define MAP_FILE 0
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
index 7cab4de2bca6..32c8bd6a196d 100644
--- a/include/asm-generic/mman.h
+++ b/include/asm-generic/mman.h
@@ -11,6 +11,7 @@
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */ 13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
14 15
15#define MCL_CURRENT 1 /* lock all current mappings */ 16#define MCL_CURRENT 1 /* lock all current mappings */
16#define MCL_FUTURE 2 /* lock all future mappings */ 17#define MCL_FUTURE 2 /* lock all future mappings */
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index b4326b5466eb..26373cff4546 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -30,7 +30,18 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
30 res->end = region->end; 30 res->end = region->end;
31} 31}
32 32
33#define pcibios_scan_all_fns(a, b) 0 33static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{
36 struct resource *root = NULL;
37
38 if (res->flags & IORESOURCE_IO)
39 root = &ioport_resource;
40 if (res->flags & IORESOURCE_MEM)
41 root = &iomem_resource;
42
43 return root;
44}
34 45
35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 46#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
36static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 47static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index aa00800adacc..90079c373f1c 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -81,14 +81,17 @@ extern void setup_per_cpu_areas(void);
81 81
82#ifdef MODULE 82#ifdef MODULE
83#define PER_CPU_SHARED_ALIGNED_SECTION "" 83#define PER_CPU_SHARED_ALIGNED_SECTION ""
84#define PER_CPU_ALIGNED_SECTION ""
84#else 85#else
85#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" 86#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
87#define PER_CPU_ALIGNED_SECTION ".shared_aligned"
86#endif 88#endif
87#define PER_CPU_FIRST_SECTION ".first" 89#define PER_CPU_FIRST_SECTION ".first"
88 90
89#else 91#else
90 92
91#define PER_CPU_SHARED_ALIGNED_SECTION "" 93#define PER_CPU_SHARED_ALIGNED_SECTION ""
94#define PER_CPU_ALIGNED_SECTION ".shared_aligned"
92#define PER_CPU_FIRST_SECTION "" 95#define PER_CPU_FIRST_SECTION ""
93 96
94#endif 97#endif
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index d083561337f2..b3bfabc258f3 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -23,4 +23,20 @@ extern char __ctors_start[], __ctors_end[];
23#define dereference_function_descriptor(p) (p) 23#define dereference_function_descriptor(p) (p)
24#endif 24#endif
25 25
26/* random extra sections (if any). Override
27 * in asm/sections.h */
28#ifndef arch_is_kernel_text
29static inline int arch_is_kernel_text(unsigned long addr)
30{
31 return 0;
32}
33#endif
34
35#ifndef arch_is_kernel_data
36static inline int arch_is_kernel_data(unsigned long addr)
37{
38 return 0;
39}
40#endif
41
26#endif /* _ASM_GENERIC_SECTIONS_H_ */ 42#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index c840719a8c59..942d30b5aab1 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -82,6 +82,7 @@ typedef struct siginfo {
82#ifdef __ARCH_SI_TRAPNO 82#ifdef __ARCH_SI_TRAPNO
83 int _trapno; /* TRAP # which caused the signal */ 83 int _trapno; /* TRAP # which caused the signal */
84#endif 84#endif
85 short _addr_lsb; /* LSB of the reported address */
85 } _sigfault; 86 } _sigfault;
86 87
87 /* SIGPOLL */ 88 /* SIGPOLL */
@@ -112,6 +113,7 @@ typedef struct siginfo {
112#ifdef __ARCH_SI_TRAPNO 113#ifdef __ARCH_SI_TRAPNO
113#define si_trapno _sifields._sigfault._trapno 114#define si_trapno _sifields._sigfault._trapno
114#endif 115#endif
116#define si_addr_lsb _sifields._sigfault._addr_lsb
115#define si_band _sifields._sigpoll._band 117#define si_band _sifields._sigpoll._band
116#define si_fd _sifields._sigpoll._fd 118#define si_fd _sifields._sigpoll._fd
117 119
@@ -192,7 +194,11 @@ typedef struct siginfo {
192#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ 194#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
193#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */ 195#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */
194#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ 196#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
195#define NSIGBUS 3 197/* hardware memory error consumed on a machine check: action required */
198#define BUS_MCEERR_AR (__SI_FAULT|4)
199/* hardware memory error detected in process but not consumed: action optional*/
200#define BUS_MCEERR_AO (__SI_FAULT|5)
201#define NSIGBUS 5
196 202
197/* 203/*
198 * SIGTRAP si_codes 204 * SIGTRAP si_codes
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 5d79e409241c..538991cef6f0 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -60,4 +60,7 @@
60#define SO_TIMESTAMPING 37 60#define SO_TIMESTAMPING 37
61#define SCM_TIMESTAMPING SO_TIMESTAMPING 61#define SCM_TIMESTAMPING SO_TIMESTAMPING
62 62
63#define SO_PROTOCOL 38
64#define SO_DOMAIN 39
65
63#endif /* __ASM_GENERIC_SOCKET_H */ 66#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index ea8087b55ffc..5c122ae6bfa6 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Access to user system call parameters and results 2 * Access to user system call parameters and results
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -32,9 +32,13 @@ struct pt_regs;
32 * If @task is not executing a system call, i.e. it's blocked 32 * If @task is not executing a system call, i.e. it's blocked
33 * inside the kernel for a fault or signal, returns -1. 33 * inside the kernel for a fault or signal, returns -1.
34 * 34 *
35 * Note this returns int even on 64-bit machines. Only 32 bits of
36 * system call number can be meaningful. If the actual arch value
37 * is 64 bits, this truncates to 32 bits so 0xffffffff means -1.
38 *
35 * It's only valid to call this when @task is known to be blocked. 39 * It's only valid to call this when @task is known to be blocked.
36 */ 40 */
37long syscall_get_nr(struct task_struct *task, struct pt_regs *regs); 41int syscall_get_nr(struct task_struct *task, struct pt_regs *regs);
38 42
39/** 43/**
40 * syscall_rollback - roll back registers after an aborted system call 44 * syscall_rollback - roll back registers after an aborted system call
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index 88bada2ebc4b..510df36dd5d4 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -37,9 +37,6 @@
37#ifndef parent_node 37#ifndef parent_node
38#define parent_node(node) ((void)(node),0) 38#define parent_node(node) ((void)(node),0)
39#endif 39#endif
40#ifndef node_to_cpumask
41#define node_to_cpumask(node) ((void)node, cpu_online_map)
42#endif
43#ifndef cpumask_of_node 40#ifndef cpumask_of_node
44#define cpumask_of_node(node) ((void)node, cpu_online_mask) 41#define cpumask_of_node(node) ((void)node, cpu_online_mask)
45#endif 42#endif
@@ -55,18 +52,4 @@
55 52
56#endif /* CONFIG_NUMA */ 53#endif /* CONFIG_NUMA */
57 54
58/*
59 * returns pointer to cpumask for specified node
60 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
61 */
62#ifndef node_to_cpumask_ptr
63
64#define node_to_cpumask_ptr(v, node) \
65 cpumask_t _##v = node_to_cpumask(node); \
66 const cpumask_t *v = &_##v
67
68#define node_to_cpumask_ptr_next(v, node) \
69 _##v = node_to_cpumask(node)
70#endif
71
72#endif /* _ASM_GENERIC_TOPOLOGY_H */ 55#endif /* _ASM_GENERIC_TOPOLOGY_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 1125e5a1ee5d..d76b66acea95 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -620,8 +620,8 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
620 620
621#define __NR_rt_tgsigqueueinfo 240 621#define __NR_rt_tgsigqueueinfo 240
622__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) 622__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
623#define __NR_perf_counter_open 241 623#define __NR_perf_event_open 241
624__SYSCALL(__NR_perf_counter_open, sys_perf_counter_open) 624__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
625 625
626#undef __NR_syscalls 626#undef __NR_syscalls
627#define __NR_syscalls 242 627#define __NR_syscalls 242
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6ad76bf5fb40..b6e818f4b247 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -33,13 +33,10 @@
33 * BSS_SECTION(0, 0, 0) 33 * BSS_SECTION(0, 0, 0)
34 * _end = .; 34 * _end = .;
35 * 35 *
36 * /DISCARD/ : {
37 * EXIT_TEXT
38 * EXIT_DATA
39 * EXIT_CALL
40 * }
41 * STABS_DEBUG 36 * STABS_DEBUG
42 * DWARF_DEBUG 37 * DWARF_DEBUG
38 *
39 * DISCARDS // must be the last
43 * } 40 * }
44 * 41 *
45 * [__init_begin, __init_end] is the init section that may be freed after init 42 * [__init_begin, __init_end] is the init section that may be freed after init
@@ -91,7 +88,8 @@
91#endif 88#endif
92 89
93#ifdef CONFIG_FTRACE_MCOUNT_RECORD 90#ifdef CONFIG_FTRACE_MCOUNT_RECORD
94#define MCOUNT_REC() VMLINUX_SYMBOL(__start_mcount_loc) = .; \ 91#define MCOUNT_REC() . = ALIGN(8); \
92 VMLINUX_SYMBOL(__start_mcount_loc) = .; \
95 *(__mcount_loc) \ 93 *(__mcount_loc) \
96 VMLINUX_SYMBOL(__stop_mcount_loc) = .; 94 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
97#else 95#else
@@ -331,7 +329,6 @@
331 /* __*init sections */ \ 329 /* __*init sections */ \
332 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ 330 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
333 *(.ref.rodata) \ 331 *(.ref.rodata) \
334 MCOUNT_REC() \
335 DEV_KEEP(init.rodata) \ 332 DEV_KEEP(init.rodata) \
336 DEV_KEEP(exit.rodata) \ 333 DEV_KEEP(exit.rodata) \
337 CPU_KEEP(init.rodata) \ 334 CPU_KEEP(init.rodata) \
@@ -455,6 +452,7 @@
455 MEM_DISCARD(init.data) \ 452 MEM_DISCARD(init.data) \
456 KERNEL_CTORS() \ 453 KERNEL_CTORS() \
457 *(.init.rodata) \ 454 *(.init.rodata) \
455 MCOUNT_REC() \
458 DEV_DISCARD(init.rodata) \ 456 DEV_DISCARD(init.rodata) \
459 CPU_DISCARD(init.rodata) \ 457 CPU_DISCARD(init.rodata) \
460 MEM_DISCARD(init.rodata) 458 MEM_DISCARD(init.rodata)
@@ -626,6 +624,23 @@
626#define INIT_RAM_FS 624#define INIT_RAM_FS
627#endif 625#endif
628 626
627/*
628 * Default discarded sections.
629 *
630 * Some archs want to discard exit text/data at runtime rather than
631 * link time due to cross-section references such as alt instructions,
632 * bug table, eh_frame, etc. DISCARDS must be the last of output
633 * section definitions so that such archs put those in earlier section
634 * definitions.
635 */
636#define DISCARDS \
637 /DISCARD/ : { \
638 EXIT_TEXT \
639 EXIT_DATA \
640 EXIT_CALL \
641 *(.discard) \
642 }
643
629/** 644/**
630 * PERCPU_VADDR - define output section for percpu area 645 * PERCPU_VADDR - define output section for percpu area
631 * @vaddr: explicit base address (optional) 646 * @vaddr: explicit base address (optional)
@@ -706,12 +721,12 @@
706 . = ALIGN(PAGE_SIZE); \ 721 . = ALIGN(PAGE_SIZE); \
707 .data : AT(ADDR(.data) - LOAD_OFFSET) { \ 722 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
708 INIT_TASK_DATA(inittask) \ 723 INIT_TASK_DATA(inittask) \
724 NOSAVE_DATA \
725 PAGE_ALIGNED_DATA(pagealigned) \
709 CACHELINE_ALIGNED_DATA(cacheline) \ 726 CACHELINE_ALIGNED_DATA(cacheline) \
710 READ_MOSTLY_DATA(cacheline) \ 727 READ_MOSTLY_DATA(cacheline) \
711 DATA_DATA \ 728 DATA_DATA \
712 CONSTRUCTORS \ 729 CONSTRUCTORS \
713 NOSAVE_DATA \
714 PAGE_ALIGNED_DATA(pagealigned) \
715 } 730 }
716 731
717#define INIT_TEXT_SECTION(inittext_align) \ 732#define INIT_TEXT_SECTION(inittext_align) \
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 5a2bd1cc9656..1ffb53f74d37 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -22,11 +22,9 @@ struct seq_file;
22 22
23struct crypto_type { 23struct crypto_type {
24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask); 24 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
25 unsigned int (*extsize)(struct crypto_alg *alg, 25 unsigned int (*extsize)(struct crypto_alg *alg);
26 const struct crypto_type *frontend);
27 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask); 26 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask);
28 int (*init_tfm)(struct crypto_tfm *tfm, 27 int (*init_tfm)(struct crypto_tfm *tfm);
29 const struct crypto_type *frontend);
30 void (*show)(struct seq_file *m, struct crypto_alg *alg); 28 void (*show)(struct seq_file *m, struct crypto_alg *alg);
31 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask); 29 struct crypto_alg *(*lookup)(const char *name, u32 type, u32 mask);
32 30
@@ -52,6 +50,7 @@ struct crypto_template {
52 50
53 struct crypto_instance *(*alloc)(struct rtattr **tb); 51 struct crypto_instance *(*alloc)(struct rtattr **tb);
54 void (*free)(struct crypto_instance *inst); 52 void (*free)(struct crypto_instance *inst);
53 int (*create)(struct crypto_template *tmpl, struct rtattr **tb);
55 54
56 char name[CRYPTO_MAX_ALG_NAME]; 55 char name[CRYPTO_MAX_ALG_NAME];
57}; 56};
@@ -60,6 +59,7 @@ struct crypto_spawn {
60 struct list_head list; 59 struct list_head list;
61 struct crypto_alg *alg; 60 struct crypto_alg *alg;
62 struct crypto_instance *inst; 61 struct crypto_instance *inst;
62 const struct crypto_type *frontend;
63 u32 mask; 63 u32 mask;
64}; 64};
65 65
@@ -114,11 +114,19 @@ int crypto_register_template(struct crypto_template *tmpl);
114void crypto_unregister_template(struct crypto_template *tmpl); 114void crypto_unregister_template(struct crypto_template *tmpl);
115struct crypto_template *crypto_lookup_template(const char *name); 115struct crypto_template *crypto_lookup_template(const char *name);
116 116
117int crypto_register_instance(struct crypto_template *tmpl,
118 struct crypto_instance *inst);
119
117int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 120int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
118 struct crypto_instance *inst, u32 mask); 121 struct crypto_instance *inst, u32 mask);
122int crypto_init_spawn2(struct crypto_spawn *spawn, struct crypto_alg *alg,
123 struct crypto_instance *inst,
124 const struct crypto_type *frontend);
125
119void crypto_drop_spawn(struct crypto_spawn *spawn); 126void crypto_drop_spawn(struct crypto_spawn *spawn);
120struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type, 127struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type,
121 u32 mask); 128 u32 mask);
129void *crypto_spawn_tfm2(struct crypto_spawn *spawn);
122 130
123static inline void crypto_set_spawn(struct crypto_spawn *spawn, 131static inline void crypto_set_spawn(struct crypto_spawn *spawn,
124 struct crypto_instance *inst) 132 struct crypto_instance *inst)
@@ -129,8 +137,19 @@ static inline void crypto_set_spawn(struct crypto_spawn *spawn,
129struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); 137struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
130int crypto_check_attr_type(struct rtattr **tb, u32 type); 138int crypto_check_attr_type(struct rtattr **tb, u32 type);
131const char *crypto_attr_alg_name(struct rtattr *rta); 139const char *crypto_attr_alg_name(struct rtattr *rta);
132struct crypto_alg *crypto_attr_alg(struct rtattr *rta, u32 type, u32 mask); 140struct crypto_alg *crypto_attr_alg2(struct rtattr *rta,
141 const struct crypto_type *frontend,
142 u32 type, u32 mask);
143
144static inline struct crypto_alg *crypto_attr_alg(struct rtattr *rta,
145 u32 type, u32 mask)
146{
147 return crypto_attr_alg2(rta, NULL, type, mask);
148}
149
133int crypto_attr_u32(struct rtattr *rta, u32 *num); 150int crypto_attr_u32(struct rtattr *rta, u32 *num);
151void *crypto_alloc_instance2(const char *name, struct crypto_alg *alg,
152 unsigned int head);
134struct crypto_instance *crypto_alloc_instance(const char *name, 153struct crypto_instance *crypto_alloc_instance(const char *name,
135 struct crypto_alg *alg); 154 struct crypto_alg *alg);
136 155
@@ -157,12 +176,8 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
157 176
158static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) 177static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
159{ 178{
160 unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm); 179 return PTR_ALIGN(crypto_tfm_ctx(tfm),
161 unsigned long align = crypto_tfm_alg_alignmask(tfm); 180 crypto_tfm_alg_alignmask(tfm) + 1);
162
163 if (align <= crypto_tfm_ctx_alignment())
164 align = 1;
165 return (void *)ALIGN(addr, align);
166} 181}
167 182
168static inline struct crypto_instance *crypto_tfm_alg_instance( 183static inline struct crypto_instance *crypto_tfm_alg_instance(
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h
index 55fa7bbdbc71..2f65a6e8ea4d 100644
--- a/include/crypto/cryptd.h
+++ b/include/crypto/cryptd.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/crypto.h> 8#include <linux/crypto.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <crypto/hash.h>
10 11
11struct cryptd_ablkcipher { 12struct cryptd_ablkcipher {
12 struct crypto_ablkcipher base; 13 struct crypto_ablkcipher base;
@@ -24,4 +25,20 @@ struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
24struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm); 25struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm);
25void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm); 26void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm);
26 27
28struct cryptd_ahash {
29 struct crypto_ahash base;
30};
31
32static inline struct cryptd_ahash *__cryptd_ahash_cast(
33 struct crypto_ahash *tfm)
34{
35 return (struct cryptd_ahash *)tfm;
36}
37
38/* alg_name should be algorithm to be cryptd-ed */
39struct cryptd_ahash *cryptd_alloc_ahash(const char *alg_name,
40 u32 type, u32 mask);
41struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm);
42void cryptd_free_ahash(struct cryptd_ahash *tfm);
43
27#endif 44#endif
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index d56bb71617c3..26cb1eb16f4c 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -15,6 +15,42 @@
15 15
16#include <linux/crypto.h> 16#include <linux/crypto.h>
17 17
18struct crypto_ahash;
19
20struct hash_alg_common {
21 unsigned int digestsize;
22 unsigned int statesize;
23
24 struct crypto_alg base;
25};
26
27struct ahash_request {
28 struct crypto_async_request base;
29
30 unsigned int nbytes;
31 struct scatterlist *src;
32 u8 *result;
33
34 /* This field may only be used by the ahash API code. */
35 void *priv;
36
37 void *__ctx[] CRYPTO_MINALIGN_ATTR;
38};
39
40struct ahash_alg {
41 int (*init)(struct ahash_request *req);
42 int (*update)(struct ahash_request *req);
43 int (*final)(struct ahash_request *req);
44 int (*finup)(struct ahash_request *req);
45 int (*digest)(struct ahash_request *req);
46 int (*export)(struct ahash_request *req, void *out);
47 int (*import)(struct ahash_request *req, const void *in);
48 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
49 unsigned int keylen);
50
51 struct hash_alg_common halg;
52};
53
18struct shash_desc { 54struct shash_desc {
19 struct crypto_shash *tfm; 55 struct crypto_shash *tfm;
20 u32 flags; 56 u32 flags;
@@ -24,7 +60,6 @@ struct shash_desc {
24 60
25struct shash_alg { 61struct shash_alg {
26 int (*init)(struct shash_desc *desc); 62 int (*init)(struct shash_desc *desc);
27 int (*reinit)(struct shash_desc *desc);
28 int (*update)(struct shash_desc *desc, const u8 *data, 63 int (*update)(struct shash_desc *desc, const u8 *data,
29 unsigned int len); 64 unsigned int len);
30 int (*final)(struct shash_desc *desc, u8 *out); 65 int (*final)(struct shash_desc *desc, u8 *out);
@@ -32,38 +67,48 @@ struct shash_alg {
32 unsigned int len, u8 *out); 67 unsigned int len, u8 *out);
33 int (*digest)(struct shash_desc *desc, const u8 *data, 68 int (*digest)(struct shash_desc *desc, const u8 *data,
34 unsigned int len, u8 *out); 69 unsigned int len, u8 *out);
70 int (*export)(struct shash_desc *desc, void *out);
71 int (*import)(struct shash_desc *desc, const void *in);
35 int (*setkey)(struct crypto_shash *tfm, const u8 *key, 72 int (*setkey)(struct crypto_shash *tfm, const u8 *key,
36 unsigned int keylen); 73 unsigned int keylen);
37 74
38 unsigned int descsize; 75 unsigned int descsize;
39 unsigned int digestsize; 76
77 /* These fields must match hash_alg_common. */
78 unsigned int digestsize
79 __attribute__ ((aligned(__alignof__(struct hash_alg_common))));
80 unsigned int statesize;
40 81
41 struct crypto_alg base; 82 struct crypto_alg base;
42}; 83};
43 84
44struct crypto_ahash { 85struct crypto_ahash {
86 int (*init)(struct ahash_request *req);
87 int (*update)(struct ahash_request *req);
88 int (*final)(struct ahash_request *req);
89 int (*finup)(struct ahash_request *req);
90 int (*digest)(struct ahash_request *req);
91 int (*export)(struct ahash_request *req, void *out);
92 int (*import)(struct ahash_request *req, const void *in);
93 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
94 unsigned int keylen);
95
96 unsigned int reqsize;
45 struct crypto_tfm base; 97 struct crypto_tfm base;
46}; 98};
47 99
48struct crypto_shash { 100struct crypto_shash {
101 unsigned int descsize;
49 struct crypto_tfm base; 102 struct crypto_tfm base;
50}; 103};
51 104
52static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm) 105static inline struct crypto_ahash *__crypto_ahash_cast(struct crypto_tfm *tfm)
53{ 106{
54 return (struct crypto_ahash *)tfm; 107 return container_of(tfm, struct crypto_ahash, base);
55} 108}
56 109
57static inline struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, 110struct crypto_ahash *crypto_alloc_ahash(const char *alg_name, u32 type,
58 u32 type, u32 mask) 111 u32 mask);
59{
60 type &= ~CRYPTO_ALG_TYPE_MASK;
61 mask &= ~CRYPTO_ALG_TYPE_MASK;
62 type |= CRYPTO_ALG_TYPE_AHASH;
63 mask |= CRYPTO_ALG_TYPE_AHASH_MASK;
64
65 return __crypto_ahash_cast(crypto_alloc_base(alg_name, type, mask));
66}
67 112
68static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm) 113static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)
69{ 114{
@@ -72,7 +117,7 @@ static inline struct crypto_tfm *crypto_ahash_tfm(struct crypto_ahash *tfm)
72 117
73static inline void crypto_free_ahash(struct crypto_ahash *tfm) 118static inline void crypto_free_ahash(struct crypto_ahash *tfm)
74{ 119{
75 crypto_free_tfm(crypto_ahash_tfm(tfm)); 120 crypto_destroy_tfm(tfm, crypto_ahash_tfm(tfm));
76} 121}
77 122
78static inline unsigned int crypto_ahash_alignmask( 123static inline unsigned int crypto_ahash_alignmask(
@@ -81,14 +126,26 @@ static inline unsigned int crypto_ahash_alignmask(
81 return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm)); 126 return crypto_tfm_alg_alignmask(crypto_ahash_tfm(tfm));
82} 127}
83 128
84static inline struct ahash_tfm *crypto_ahash_crt(struct crypto_ahash *tfm) 129static inline struct hash_alg_common *__crypto_hash_alg_common(
130 struct crypto_alg *alg)
131{
132 return container_of(alg, struct hash_alg_common, base);
133}
134
135static inline struct hash_alg_common *crypto_hash_alg_common(
136 struct crypto_ahash *tfm)
85{ 137{
86 return &crypto_ahash_tfm(tfm)->crt_ahash; 138 return __crypto_hash_alg_common(crypto_ahash_tfm(tfm)->__crt_alg);
87} 139}
88 140
89static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm) 141static inline unsigned int crypto_ahash_digestsize(struct crypto_ahash *tfm)
90{ 142{
91 return crypto_ahash_crt(tfm)->digestsize; 143 return crypto_hash_alg_common(tfm)->digestsize;
144}
145
146static inline unsigned int crypto_ahash_statesize(struct crypto_ahash *tfm)
147{
148 return crypto_hash_alg_common(tfm)->statesize;
92} 149}
93 150
94static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm) 151static inline u32 crypto_ahash_get_flags(struct crypto_ahash *tfm)
@@ -114,7 +171,7 @@ static inline struct crypto_ahash *crypto_ahash_reqtfm(
114 171
115static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm) 172static inline unsigned int crypto_ahash_reqsize(struct crypto_ahash *tfm)
116{ 173{
117 return crypto_ahash_crt(tfm)->reqsize; 174 return tfm->reqsize;
118} 175}
119 176
120static inline void *ahash_request_ctx(struct ahash_request *req) 177static inline void *ahash_request_ctx(struct ahash_request *req)
@@ -122,44 +179,30 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
122 return req->__ctx; 179 return req->__ctx;
123} 180}
124 181
125static inline int crypto_ahash_setkey(struct crypto_ahash *tfm, 182int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
126 const u8 *key, unsigned int keylen) 183 unsigned int keylen);
127{ 184int crypto_ahash_finup(struct ahash_request *req);
128 struct ahash_tfm *crt = crypto_ahash_crt(tfm); 185int crypto_ahash_final(struct ahash_request *req);
129 186int crypto_ahash_digest(struct ahash_request *req);
130 return crt->setkey(tfm, key, keylen);
131}
132 187
133static inline int crypto_ahash_digest(struct ahash_request *req) 188static inline int crypto_ahash_export(struct ahash_request *req, void *out)
134{ 189{
135 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 190 return crypto_ahash_reqtfm(req)->export(req, out);
136 return crt->digest(req);
137} 191}
138 192
139static inline void crypto_ahash_export(struct ahash_request *req, u8 *out) 193static inline int crypto_ahash_import(struct ahash_request *req, const void *in)
140{ 194{
141 memcpy(out, ahash_request_ctx(req), 195 return crypto_ahash_reqtfm(req)->import(req, in);
142 crypto_ahash_reqsize(crypto_ahash_reqtfm(req)));
143} 196}
144 197
145int crypto_ahash_import(struct ahash_request *req, const u8 *in);
146
147static inline int crypto_ahash_init(struct ahash_request *req) 198static inline int crypto_ahash_init(struct ahash_request *req)
148{ 199{
149 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 200 return crypto_ahash_reqtfm(req)->init(req);
150 return crt->init(req);
151} 201}
152 202
153static inline int crypto_ahash_update(struct ahash_request *req) 203static inline int crypto_ahash_update(struct ahash_request *req)
154{ 204{
155 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req)); 205 return crypto_ahash_reqtfm(req)->update(req);
156 return crt->update(req);
157}
158
159static inline int crypto_ahash_final(struct ahash_request *req)
160{
161 struct ahash_tfm *crt = crypto_ahash_crt(crypto_ahash_reqtfm(req));
162 return crt->final(req);
163} 206}
164 207
165static inline void ahash_request_set_tfm(struct ahash_request *req, 208static inline void ahash_request_set_tfm(struct ahash_request *req,
@@ -184,7 +227,7 @@ static inline struct ahash_request *ahash_request_alloc(
184 227
185static inline void ahash_request_free(struct ahash_request *req) 228static inline void ahash_request_free(struct ahash_request *req)
186{ 229{
187 kfree(req); 230 kzfree(req);
188} 231}
189 232
190static inline struct ahash_request *ahash_request_cast( 233static inline struct ahash_request *ahash_request_cast(
@@ -251,6 +294,11 @@ static inline unsigned int crypto_shash_digestsize(struct crypto_shash *tfm)
251 return crypto_shash_alg(tfm)->digestsize; 294 return crypto_shash_alg(tfm)->digestsize;
252} 295}
253 296
297static inline unsigned int crypto_shash_statesize(struct crypto_shash *tfm)
298{
299 return crypto_shash_alg(tfm)->statesize;
300}
301
254static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm) 302static inline u32 crypto_shash_get_flags(struct crypto_shash *tfm)
255{ 303{
256 return crypto_tfm_get_flags(crypto_shash_tfm(tfm)); 304 return crypto_tfm_get_flags(crypto_shash_tfm(tfm));
@@ -268,7 +316,7 @@ static inline void crypto_shash_clear_flags(struct crypto_shash *tfm, u32 flags)
268 316
269static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) 317static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm)
270{ 318{
271 return crypto_shash_alg(tfm)->descsize; 319 return tfm->descsize;
272} 320}
273 321
274static inline void *shash_desc_ctx(struct shash_desc *desc) 322static inline void *shash_desc_ctx(struct shash_desc *desc)
@@ -281,12 +329,15 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
281int crypto_shash_digest(struct shash_desc *desc, const u8 *data, 329int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
282 unsigned int len, u8 *out); 330 unsigned int len, u8 *out);
283 331
284static inline void crypto_shash_export(struct shash_desc *desc, u8 *out) 332static inline int crypto_shash_export(struct shash_desc *desc, void *out)
285{ 333{
286 memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm)); 334 return crypto_shash_alg(desc->tfm)->export(desc, out);
287} 335}
288 336
289int crypto_shash_import(struct shash_desc *desc, const u8 *in); 337static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
338{
339 return crypto_shash_alg(desc->tfm)->import(desc, in);
340}
290 341
291static inline int crypto_shash_init(struct shash_desc *desc) 342static inline int crypto_shash_init(struct shash_desc *desc)
292{ 343{
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 82b70564bcab..5bfad8c80595 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -34,6 +34,22 @@ struct crypto_hash_walk {
34 unsigned int flags; 34 unsigned int flags;
35}; 35};
36 36
37struct ahash_instance {
38 struct ahash_alg alg;
39};
40
41struct shash_instance {
42 struct shash_alg alg;
43};
44
45struct crypto_ahash_spawn {
46 struct crypto_spawn base;
47};
48
49struct crypto_shash_spawn {
50 struct crypto_spawn base;
51};
52
37extern const struct crypto_type crypto_ahash_type; 53extern const struct crypto_type crypto_ahash_type;
38 54
39int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); 55int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
@@ -43,18 +59,100 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
43 struct crypto_hash_walk *walk, 59 struct crypto_hash_walk *walk,
44 struct scatterlist *sg, unsigned int len); 60 struct scatterlist *sg, unsigned int len);
45 61
62static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
63{
64 return !(walk->entrylen | walk->total);
65}
66
67int crypto_register_ahash(struct ahash_alg *alg);
68int crypto_unregister_ahash(struct ahash_alg *alg);
69int ahash_register_instance(struct crypto_template *tmpl,
70 struct ahash_instance *inst);
71void ahash_free_instance(struct crypto_instance *inst);
72
73int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn,
74 struct hash_alg_common *alg,
75 struct crypto_instance *inst);
76
77static inline void crypto_drop_ahash(struct crypto_ahash_spawn *spawn)
78{
79 crypto_drop_spawn(&spawn->base);
80}
81
82struct hash_alg_common *ahash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
83
46int crypto_register_shash(struct shash_alg *alg); 84int crypto_register_shash(struct shash_alg *alg);
47int crypto_unregister_shash(struct shash_alg *alg); 85int crypto_unregister_shash(struct shash_alg *alg);
86int shash_register_instance(struct crypto_template *tmpl,
87 struct shash_instance *inst);
88void shash_free_instance(struct crypto_instance *inst);
89
90int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
91 struct shash_alg *alg,
92 struct crypto_instance *inst);
93
94static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn)
95{
96 crypto_drop_spawn(&spawn->base);
97}
98
99struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
100
101int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc);
102int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
103int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
104
105int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
48 106
49static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) 107static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
50{ 108{
51 return crypto_tfm_ctx(&tfm->base); 109 return crypto_tfm_ctx(crypto_ahash_tfm(tfm));
110}
111
112static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg)
113{
114 return container_of(__crypto_hash_alg_common(alg), struct ahash_alg,
115 halg);
116}
117
118static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
119 unsigned int reqsize)
120{
121 tfm->reqsize = reqsize;
122}
123
124static inline struct crypto_instance *ahash_crypto_instance(
125 struct ahash_instance *inst)
126{
127 return container_of(&inst->alg.halg.base, struct crypto_instance, alg);
52} 128}
53 129
54static inline struct ahash_alg *crypto_ahash_alg( 130static inline struct ahash_instance *ahash_instance(
55 struct crypto_ahash *tfm) 131 struct crypto_instance *inst)
56{ 132{
57 return &crypto_ahash_tfm(tfm)->__crt_alg->cra_ahash; 133 return container_of(&inst->alg, struct ahash_instance, alg.halg.base);
134}
135
136static inline void *ahash_instance_ctx(struct ahash_instance *inst)
137{
138 return crypto_instance_ctx(ahash_crypto_instance(inst));
139}
140
141static inline unsigned int ahash_instance_headroom(void)
142{
143 return sizeof(struct ahash_alg) - sizeof(struct crypto_alg);
144}
145
146static inline struct ahash_instance *ahash_alloc_instance(
147 const char *name, struct crypto_alg *alg)
148{
149 return crypto_alloc_instance2(name, alg, ahash_instance_headroom());
150}
151
152static inline struct crypto_ahash *crypto_spawn_ahash(
153 struct crypto_ahash_spawn *spawn)
154{
155 return crypto_spawn_tfm2(&spawn->base);
58} 156}
59 157
60static inline int ahash_enqueue_request(struct crypto_queue *queue, 158static inline int ahash_enqueue_request(struct crypto_queue *queue,
@@ -80,5 +178,46 @@ static inline void *crypto_shash_ctx(struct crypto_shash *tfm)
80 return crypto_tfm_ctx(&tfm->base); 178 return crypto_tfm_ctx(&tfm->base);
81} 179}
82 180
181static inline struct crypto_instance *shash_crypto_instance(
182 struct shash_instance *inst)
183{
184 return container_of(&inst->alg.base, struct crypto_instance, alg);
185}
186
187static inline struct shash_instance *shash_instance(
188 struct crypto_instance *inst)
189{
190 return container_of(__crypto_shash_alg(&inst->alg),
191 struct shash_instance, alg);
192}
193
194static inline void *shash_instance_ctx(struct shash_instance *inst)
195{
196 return crypto_instance_ctx(shash_crypto_instance(inst));
197}
198
199static inline struct shash_instance *shash_alloc_instance(
200 const char *name, struct crypto_alg *alg)
201{
202 return crypto_alloc_instance2(name, alg,
203 sizeof(struct shash_alg) - sizeof(*alg));
204}
205
206static inline struct crypto_shash *crypto_spawn_shash(
207 struct crypto_shash_spawn *spawn)
208{
209 return crypto_spawn_tfm2(&spawn->base);
210}
211
212static inline void *crypto_shash_ctx_aligned(struct crypto_shash *tfm)
213{
214 return crypto_tfm_ctx_aligned(&tfm->base);
215}
216
217static inline struct crypto_shash *__crypto_shash_cast(struct crypto_tfm *tfm)
218{
219 return container_of(tfm, struct crypto_shash, base);
220}
221
83#endif /* _CRYPTO_INTERNAL_HASH_H */ 222#endif /* _CRYPTO_INTERNAL_HASH_H */
84 223
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index c0ccc2b1a2d8..069e85ba97e1 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -5,6 +5,8 @@
5#ifndef _CRYPTO_SHA_H 5#ifndef _CRYPTO_SHA_H
6#define _CRYPTO_SHA_H 6#define _CRYPTO_SHA_H
7 7
8#include <linux/types.h>
9
8#define SHA1_DIGEST_SIZE 20 10#define SHA1_DIGEST_SIZE 20
9#define SHA1_BLOCK_SIZE 64 11#define SHA1_BLOCK_SIZE 64
10 12
@@ -62,4 +64,22 @@
62#define SHA512_H6 0x1f83d9abfb41bd6bULL 64#define SHA512_H6 0x1f83d9abfb41bd6bULL
63#define SHA512_H7 0x5be0cd19137e2179ULL 65#define SHA512_H7 0x5be0cd19137e2179ULL
64 66
67struct sha1_state {
68 u64 count;
69 u32 state[SHA1_DIGEST_SIZE / 4];
70 u8 buffer[SHA1_BLOCK_SIZE];
71};
72
73struct sha256_state {
74 u64 count;
75 u32 state[SHA256_DIGEST_SIZE / 4];
76 u8 buf[SHA256_BLOCK_SIZE];
77};
78
79struct sha512_state {
80 u64 count[2];
81 u64 state[SHA512_DIGEST_SIZE / 8];
82 u8 buf[SHA512_BLOCK_SIZE];
83};
84
65#endif 85#endif
diff --git a/include/crypto/vmac.h b/include/crypto/vmac.h
new file mode 100644
index 000000000000..c4467c55df1e
--- /dev/null
+++ b/include/crypto/vmac.h
@@ -0,0 +1,61 @@
1/*
2 * Modified to interface to the Linux kernel
3 * Copyright (c) 2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 */
18
19#ifndef __CRYPTO_VMAC_H
20#define __CRYPTO_VMAC_H
21
22/* --------------------------------------------------------------------------
23 * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai.
24 * This implementation is herby placed in the public domain.
25 * The authors offers no warranty. Use at your own risk.
26 * Please send bug reports to the authors.
27 * Last modified: 17 APR 08, 1700 PDT
28 * ----------------------------------------------------------------------- */
29
30/*
31 * User definable settings.
32 */
33#define VMAC_TAG_LEN 64
34#define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
35#define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
36#define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
37
38/*
39 * This implementation uses u32 and u64 as names for unsigned 32-
40 * and 64-bit integer types. These are defined in C99 stdint.h. The
41 * following may need adaptation if you are not running a C99 or
42 * Microsoft C environment.
43 */
44struct vmac_ctx {
45 u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
46 u64 polykey[2*VMAC_TAG_LEN/64];
47 u64 l3key[2*VMAC_TAG_LEN/64];
48 u64 polytmp[2*VMAC_TAG_LEN/64];
49 u64 cached_nonce[2];
50 u64 cached_aes[2];
51 int first_block_processed;
52};
53
54typedef u64 vmac_t;
55
56struct vmac_ctx_t {
57 struct crypto_cipher *child;
58 struct vmac_ctx __vmac_ctx;
59};
60
61#endif /* __CRYPTO_VMAC_H */
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 45b67d9c39c1..c8e64bbadbcf 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -88,7 +88,37 @@ struct drm_device;
88#define DRM_UT_CORE 0x01 88#define DRM_UT_CORE 0x01
89#define DRM_UT_DRIVER 0x02 89#define DRM_UT_DRIVER 0x02
90#define DRM_UT_KMS 0x04 90#define DRM_UT_KMS 0x04
91#define DRM_UT_MODE 0x08 91/*
92 * Three debug levels are defined.
93 * drm_core, drm_driver, drm_kms
94 * drm_core level can be used in the generic drm code. For example:
95 * drm_ioctl, drm_mm, drm_memory
96 * The macro definiton of DRM_DEBUG is used.
97 * DRM_DEBUG(fmt, args...)
98 * The debug info by using the DRM_DEBUG can be obtained by adding
99 * the boot option of "drm.debug=1".
100 *
101 * drm_driver level can be used in the specific drm driver. It is used
102 * to add the debug info related with the drm driver. For example:
103 * i915_drv, i915_dma, i915_gem, radeon_drv,
104 * The macro definition of DRM_DEBUG_DRIVER can be used.
105 * DRM_DEBUG_DRIVER(fmt, args...)
106 * The debug info by using the DRM_DEBUG_DRIVER can be obtained by
107 * adding the boot option of "drm.debug=0x02"
108 *
109 * drm_kms level can be used in the KMS code related with specific drm driver.
110 * It is used to add the debug info related with KMS mode. For example:
111 * the connector/crtc ,
112 * The macro definition of DRM_DEBUG_KMS can be used.
113 * DRM_DEBUG_KMS(fmt, args...)
114 * The debug info by using the DRM_DEBUG_KMS can be obtained by
115 * adding the boot option of "drm.debug=0x04"
116 *
117 * If we add the boot option of "drm.debug=0x06", we can get the debug info by
118 * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER.
119 * If we add the boot option of "drm.debug=0x05", we can get the debug info by
120 * using the DRM_DEBUG_KMS and DRM_DEBUG.
121 */
92 122
93extern void drm_ut_debug_printk(unsigned int request_level, 123extern void drm_ut_debug_printk(unsigned int request_level,
94 const char *prefix, 124 const char *prefix,
@@ -174,19 +204,14 @@ extern void drm_ut_debug_printk(unsigned int request_level,
174 __func__, fmt, ##args); \ 204 __func__, fmt, ##args); \
175 } while (0) 205 } while (0)
176 206
177#define DRM_DEBUG_DRIVER(prefix, fmt, args...) \ 207#define DRM_DEBUG_DRIVER(fmt, args...) \
178 do { \ 208 do { \
179 drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \ 209 drm_ut_debug_printk(DRM_UT_DRIVER, DRM_NAME, \
180 __func__, fmt, ##args); \ 210 __func__, fmt, ##args); \
181 } while (0) 211 } while (0)
182#define DRM_DEBUG_KMS(prefix, fmt, args...) \ 212#define DRM_DEBUG_KMS(fmt, args...) \
183 do { \ 213 do { \
184 drm_ut_debug_printk(DRM_UT_KMS, prefix, \ 214 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \
185 __func__, fmt, ##args); \
186 } while (0)
187#define DRM_DEBUG_MODE(prefix, fmt, args...) \
188 do { \
189 drm_ut_debug_printk(DRM_UT_MODE, prefix, \
190 __func__, fmt, ##args); \ 215 __func__, fmt, ##args); \
191 } while (0) 216 } while (0)
192#define DRM_LOG(fmt, args...) \ 217#define DRM_LOG(fmt, args...) \
@@ -210,9 +235,8 @@ extern void drm_ut_debug_printk(unsigned int request_level,
210 NULL, fmt, ##args); \ 235 NULL, fmt, ##args); \
211 } while (0) 236 } while (0)
212#else 237#else
213#define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0) 238#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
214#define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0) 239#define DRM_DEBUG_KMS(fmt, args...) do { } while (0)
215#define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0)
216#define DRM_DEBUG(fmt, arg...) do { } while (0) 240#define DRM_DEBUG(fmt, arg...) do { } while (0)
217#define DRM_LOG(fmt, arg...) do { } while (0) 241#define DRM_LOG(fmt, arg...) do { } while (0)
218#define DRM_LOG_KMS(fmt, args...) do { } while (0) 242#define DRM_LOG_KMS(fmt, args...) do { } while (0)
@@ -786,6 +810,9 @@ struct drm_driver {
786 int (*gem_init_object) (struct drm_gem_object *obj); 810 int (*gem_init_object) (struct drm_gem_object *obj);
787 void (*gem_free_object) (struct drm_gem_object *obj); 811 void (*gem_free_object) (struct drm_gem_object *obj);
788 812
813 /* vga arb irq handler */
814 void (*vgaarb_irq)(struct drm_device *dev, bool state);
815
789 /* Driver private ops for this object */ 816 /* Driver private ops for this object */
790 struct vm_operations_struct *gem_vm_ops; 817 struct vm_operations_struct *gem_vm_ops;
791 818
@@ -1417,7 +1444,7 @@ drm_gem_object_unreference(struct drm_gem_object *obj)
1417 1444
1418int drm_gem_handle_create(struct drm_file *file_priv, 1445int drm_gem_handle_create(struct drm_file *file_priv,
1419 struct drm_gem_object *obj, 1446 struct drm_gem_object *obj,
1420 int *handlep); 1447 u32 *handlep);
1421 1448
1422static inline void 1449static inline void
1423drm_gem_object_handle_reference(struct drm_gem_object *obj) 1450drm_gem_object_handle_reference(struct drm_gem_object *obj)
@@ -1443,7 +1470,7 @@ drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1443 1470
1444struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, 1471struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1445 struct drm_file *filp, 1472 struct drm_file *filp,
1446 int handle); 1473 u32 handle);
1447int drm_gem_close_ioctl(struct drm_device *dev, void *data, 1474int drm_gem_close_ioctl(struct drm_device *dev, void *data,
1448 struct drm_file *file_priv); 1475 struct drm_file *file_priv);
1449int drm_gem_flink_ioctl(struct drm_device *dev, void *data, 1476int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h
new file mode 100644
index 000000000000..7bfb063029d8
--- /dev/null
+++ b/include/drm/drm_cache.h
@@ -0,0 +1,38 @@
1/**************************************************************************
2 *
3 * Copyright 2009 Red Hat Inc.
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 * Authors:
30 * Dave Airlie <airlied@redhat.com>
31 */
32
33#ifndef _DRM_CACHE_H_
34#define _DRM_CACHE_H_
35
36void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
37
38#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 7300fb866767..b69347b8904f 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -259,6 +259,8 @@ struct drm_framebuffer {
259 void *fbdev; 259 void *fbdev;
260 u32 pseudo_palette[17]; 260 u32 pseudo_palette[17];
261 struct list_head filp_head; 261 struct list_head filp_head;
262 /* if you are using the helper */
263 void *helper_private;
262}; 264};
263 265
264struct drm_property_blob { 266struct drm_property_blob {
@@ -385,6 +387,7 @@ struct drm_crtc {
385 * @get_modes: get mode list for this connector 387 * @get_modes: get mode list for this connector
386 * @set_property: property for this connector may need update 388 * @set_property: property for this connector may need update
387 * @destroy: make object go away 389 * @destroy: make object go away
390 * @force: notify the driver the connector is forced on
388 * 391 *
389 * Each CRTC may have one or more connectors attached to it. The functions 392 * Each CRTC may have one or more connectors attached to it. The functions
390 * below allow the core DRM code to control connectors, enumerate available modes, 393 * below allow the core DRM code to control connectors, enumerate available modes,
@@ -399,6 +402,7 @@ struct drm_connector_funcs {
399 int (*set_property)(struct drm_connector *connector, struct drm_property *property, 402 int (*set_property)(struct drm_connector *connector, struct drm_property *property,
400 uint64_t val); 403 uint64_t val);
401 void (*destroy)(struct drm_connector *connector); 404 void (*destroy)(struct drm_connector *connector);
405 void (*force)(struct drm_connector *connector);
402}; 406};
403 407
404struct drm_encoder_funcs { 408struct drm_encoder_funcs {
@@ -427,6 +431,13 @@ struct drm_encoder {
427 void *helper_private; 431 void *helper_private;
428}; 432};
429 433
434enum drm_connector_force {
435 DRM_FORCE_UNSPECIFIED,
436 DRM_FORCE_OFF,
437 DRM_FORCE_ON, /* force on analog part normally */
438 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
439};
440
430/** 441/**
431 * drm_connector - central DRM connector control structure 442 * drm_connector - central DRM connector control structure
432 * @crtc: CRTC this connector is currently connected to, NULL if none 443 * @crtc: CRTC this connector is currently connected to, NULL if none
@@ -476,9 +487,12 @@ struct drm_connector {
476 487
477 void *helper_private; 488 void *helper_private;
478 489
490 /* forced on connector */
491 enum drm_connector_force force;
479 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 492 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
480 uint32_t force_encoder_id; 493 uint32_t force_encoder_id;
481 struct drm_encoder *encoder; /* currently active encoder */ 494 struct drm_encoder *encoder; /* currently active encoder */
495 void *fb_helper_private;
482}; 496};
483 497
484/** 498/**
@@ -572,6 +586,12 @@ struct drm_mode_config {
572 struct drm_property *tv_right_margin_property; 586 struct drm_property *tv_right_margin_property;
573 struct drm_property *tv_top_margin_property; 587 struct drm_property *tv_top_margin_property;
574 struct drm_property *tv_bottom_margin_property; 588 struct drm_property *tv_bottom_margin_property;
589 struct drm_property *tv_brightness_property;
590 struct drm_property *tv_contrast_property;
591 struct drm_property *tv_flicker_reduction_property;
592 struct drm_property *tv_overscan_property;
593 struct drm_property *tv_saturation_property;
594 struct drm_property *tv_hue_property;
575 595
576 /* Optional properties */ 596 /* Optional properties */
577 struct drm_property *scaling_mode_property; 597 struct drm_property *scaling_mode_property;
@@ -736,4 +756,12 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
736extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 756extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
737 void *data, struct drm_file *file_priv); 757 void *data, struct drm_file *file_priv);
738extern bool drm_detect_hdmi_monitor(struct edid *edid); 758extern bool drm_detect_hdmi_monitor(struct edid *edid);
759extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
760 int hdisplay, int vdisplay, int vrefresh,
761 bool reduced, bool interlaced, bool margins);
762extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
763 int hdisplay, int vdisplay, int vrefresh,
764 bool interlaced, int margins);
765extern int drm_add_modes_noedid(struct drm_connector *connector,
766 int hdisplay, int vdisplay);
739#endif /* __DRM_CRTC_H__ */ 767#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 6769ff6c1bc0..b29e20168b5f 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -39,6 +39,7 @@
39 39
40#include <linux/fb.h> 40#include <linux/fb.h>
41 41
42#include "drm_fb_helper.h"
42struct drm_crtc_helper_funcs { 43struct drm_crtc_helper_funcs {
43 /* 44 /*
44 * Control power levels on the CRTC. If the mode passed in is 45 * Control power levels on the CRTC. If the mode passed in is
@@ -60,6 +61,9 @@ struct drm_crtc_helper_funcs {
60 /* Move the crtc on the current fb to the given position *optional* */ 61 /* Move the crtc on the current fb to the given position *optional* */
61 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, 62 int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
62 struct drm_framebuffer *old_fb); 63 struct drm_framebuffer *old_fb);
64
65 /* reload the current crtc LUT */
66 void (*load_lut)(struct drm_crtc *crtc);
63}; 67};
64 68
65struct drm_encoder_helper_funcs { 69struct drm_encoder_helper_funcs {
@@ -79,6 +83,8 @@ struct drm_encoder_helper_funcs {
79 /* detect for DAC style encoders */ 83 /* detect for DAC style encoders */
80 enum drm_connector_status (*detect)(struct drm_encoder *encoder, 84 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
81 struct drm_connector *connector); 85 struct drm_connector *connector);
86 /* disable encoder when not in use - more explicit than dpms off */
87 void (*disable)(struct drm_encoder *encoder);
82}; 88};
83 89
84struct drm_connector_helper_funcs { 90struct drm_connector_helper_funcs {
@@ -98,6 +104,7 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
98 int x, int y, 104 int x, int y,
99 struct drm_framebuffer *old_fb); 105 struct drm_framebuffer *old_fb);
100extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 106extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
107extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
101 108
102extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 109extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
103 110
@@ -116,10 +123,11 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
116 encoder->helper_private = (void *)funcs; 123 encoder->helper_private = (void *)funcs;
117} 124}
118 125
119static inline void drm_connector_helper_add(struct drm_connector *connector, 126static inline int drm_connector_helper_add(struct drm_connector *connector,
120 const struct drm_connector_helper_funcs *funcs) 127 const struct drm_connector_helper_funcs *funcs)
121{ 128{
122 connector->helper_private = (void *)funcs; 129 connector->helper_private = (void *)funcs;
130 return drm_fb_helper_add_connector(connector);
123} 131}
124 132
125extern int drm_helper_resume_force_mode(struct drm_device *dev); 133extern int drm_helper_resume_force_mode(struct drm_device *dev);
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
new file mode 100644
index 000000000000..2f65633d28a7
--- /dev/null
+++ b/include/drm/drm_encoder_slave.h
@@ -0,0 +1,162 @@
1/*
2 * Copyright (C) 2009 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef __DRM_ENCODER_SLAVE_H__
28#define __DRM_ENCODER_SLAVE_H__
29
30#include "drmP.h"
31#include "drm_crtc.h"
32
33/**
34 * struct drm_encoder_slave_funcs - Entry points exposed by a slave encoder driver
35 * @set_config: Initialize any encoder-specific modesetting parameters.
36 * The meaning of the @params parameter is implementation
37 * dependent. It will usually be a structure with DVO port
38 * data format settings or timings. It's not required for
39 * the new parameters to take effect until the next mode
40 * is set.
41 *
42 * Most of its members are analogous to the function pointers in
43 * &drm_encoder_helper_funcs and they can optionally be used to
44 * initialize the latter. Connector-like methods (e.g. @get_modes and
45 * @set_property) will typically be wrapped around and only be called
46 * if the encoder is the currently selected one for the connector.
47 */
48struct drm_encoder_slave_funcs {
49 void (*set_config)(struct drm_encoder *encoder,
50 void *params);
51
52 void (*destroy)(struct drm_encoder *encoder);
53 void (*dpms)(struct drm_encoder *encoder, int mode);
54 void (*save)(struct drm_encoder *encoder);
55 void (*restore)(struct drm_encoder *encoder);
56 bool (*mode_fixup)(struct drm_encoder *encoder,
57 struct drm_display_mode *mode,
58 struct drm_display_mode *adjusted_mode);
59 int (*mode_valid)(struct drm_encoder *encoder,
60 struct drm_display_mode *mode);
61 void (*mode_set)(struct drm_encoder *encoder,
62 struct drm_display_mode *mode,
63 struct drm_display_mode *adjusted_mode);
64
65 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
66 struct drm_connector *connector);
67 int (*get_modes)(struct drm_encoder *encoder,
68 struct drm_connector *connector);
69 int (*create_resources)(struct drm_encoder *encoder,
70 struct drm_connector *connector);
71 int (*set_property)(struct drm_encoder *encoder,
72 struct drm_connector *connector,
73 struct drm_property *property,
74 uint64_t val);
75
76};
77
78/**
79 * struct drm_encoder_slave - Slave encoder struct
80 * @base: DRM encoder object.
81 * @slave_funcs: Slave encoder callbacks.
82 * @slave_priv: Slave encoder private data.
83 * @bus_priv: Bus specific data.
84 *
85 * A &drm_encoder_slave has two sets of callbacks, @slave_funcs and the
86 * ones in @base. The former are never actually called by the common
87 * CRTC code, it's just a convenience for splitting the encoder
88 * functions in an upper, GPU-specific layer and a (hopefully)
89 * GPU-agnostic lower layer: It's the GPU driver responsibility to
90 * call the slave methods when appropriate.
91 *
92 * drm_i2c_encoder_init() provides a way to get an implementation of
93 * this.
94 */
95struct drm_encoder_slave {
96 struct drm_encoder base;
97
98 struct drm_encoder_slave_funcs *slave_funcs;
99 void *slave_priv;
100 void *bus_priv;
101};
102#define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, base)
103
104int drm_i2c_encoder_init(struct drm_device *dev,
105 struct drm_encoder_slave *encoder,
106 struct i2c_adapter *adap,
107 const struct i2c_board_info *info);
108
109
110/**
111 * struct drm_i2c_encoder_driver
112 *
113 * Describes a device driver for an encoder connected to the GPU
114 * through an I2C bus. In addition to the entry points in @i2c_driver
115 * an @encoder_init function should be provided. It will be called to
116 * give the driver an opportunity to allocate any per-encoder data
117 * structures and to initialize the @slave_funcs and (optionally)
118 * @slave_priv members of @encoder.
119 */
120struct drm_i2c_encoder_driver {
121 struct i2c_driver i2c_driver;
122
123 int (*encoder_init)(struct i2c_client *client,
124 struct drm_device *dev,
125 struct drm_encoder_slave *encoder);
126
127};
128#define to_drm_i2c_encoder_driver(x) container_of((x), \
129 struct drm_i2c_encoder_driver, \
130 i2c_driver)
131
132/**
133 * drm_i2c_encoder_get_client - Get the I2C client corresponding to an encoder
134 */
135static inline struct i2c_client *drm_i2c_encoder_get_client(struct drm_encoder *encoder)
136{
137 return (struct i2c_client *)to_encoder_slave(encoder)->bus_priv;
138}
139
140/**
141 * drm_i2c_encoder_register - Register an I2C encoder driver
142 * @owner: Module containing the driver.
143 * @driver: Driver to be registered.
144 */
145static inline int drm_i2c_encoder_register(struct module *owner,
146 struct drm_i2c_encoder_driver *driver)
147{
148 return i2c_register_driver(owner, &driver->i2c_driver);
149}
150
151/**
152 * drm_i2c_encoder_unregister - Unregister an I2C encoder driver
153 * @driver: Driver to be unregistered.
154 */
155static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *driver)
156{
157 i2c_del_driver(&driver->i2c_driver);
158}
159
160void drm_i2c_encoder_destroy(struct drm_encoder *encoder);
161
162#endif
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
new file mode 100644
index 000000000000..58c892a2cbfa
--- /dev/null
+++ b/include/drm/drm_fb_helper.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (c) 2006-2009 Red Hat Inc.
3 * Copyright (c) 2006-2008 Intel Corporation
4 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
5 *
6 * DRM framebuffer helper functions
7 *
8 * Permission to use, copy, modify, distribute, and sell this software and its
9 * documentation for any purpose is hereby granted without fee, provided that
10 * the above copyright notice appear in all copies and that both that copyright
11 * notice and this permission notice appear in supporting documentation, and
12 * that the name of the copyright holders not be used in advertising or
13 * publicity pertaining to distribution of the software without specific,
14 * written prior permission. The copyright holders make no representations
15 * about the suitability of this software for any purpose. It is provided "as
16 * is" without express or implied warranty.
17 *
18 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
20 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
21 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
22 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
23 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 * OF THIS SOFTWARE.
25 *
26 * Authors:
27 * Dave Airlie <airlied@linux.ie>
28 * Jesse Barnes <jesse.barnes@intel.com>
29 */
30#ifndef DRM_FB_HELPER_H
31#define DRM_FB_HELPER_H
32
33struct drm_fb_helper_crtc {
34 uint32_t crtc_id;
35 struct drm_mode_set mode_set;
36};
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};
45
46/* mode specified on the command line */
47struct drm_fb_helper_cmdline_mode {
48 bool specified;
49 bool refresh_specified;
50 bool bpp_specified;
51 int xres, yres;
52 int bpp;
53 int refresh;
54 bool rb;
55 bool interlace;
56 bool cvt;
57 bool margins;
58};
59
60struct drm_fb_helper_connector {
61 struct drm_fb_helper_cmdline_mode cmdline_mode;
62};
63
64struct drm_fb_helper {
65 struct drm_framebuffer *fb;
66 struct drm_device *dev;
67 struct drm_display_mode *mode;
68 int crtc_count;
69 struct drm_fb_helper_crtc *crtc_info;
70 struct drm_fb_helper_funcs *funcs;
71 int conn_limit;
72 struct list_head kernel_fb_list;
73};
74
75int drm_fb_helper_single_fb_probe(struct drm_device *dev,
76 int preferred_bpp,
77 int (*fb_create)(struct drm_device *dev,
78 uint32_t fb_width,
79 uint32_t fb_height,
80 uint32_t surface_width,
81 uint32_t surface_height,
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);
89int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
90 struct fb_info *info);
91int drm_fb_helper_set_par(struct fb_info *info);
92int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
93 struct fb_info *info);
94int drm_fb_helper_setcolreg(unsigned regno,
95 unsigned red,
96 unsigned green,
97 unsigned blue,
98 unsigned transp,
99 struct fb_info *info);
100
101void drm_fb_helper_restore(void);
102void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb,
103 uint32_t fb_width, uint32_t fb_height);
104void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
105 uint32_t depth);
106
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);
110
111#endif
diff --git a/include/drm/drm_memory.h b/include/drm/drm_memory.h
index 63e425b5ea82..15af9b32ae42 100644
--- a/include/drm/drm_memory.h
+++ b/include/drm/drm_memory.h
@@ -44,8 +44,6 @@
44 44
45#if __OS_HAS_AGP 45#if __OS_HAS_AGP
46 46
47#include <linux/vmalloc.h>
48
49#ifdef HAVE_PAGE_AGP 47#ifdef HAVE_PAGE_AGP
50#include <asm/agp.h> 48#include <asm/agp.h>
51#else 49#else
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index f8332073d277..62329f9a42cb 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -37,6 +37,9 @@
37 * Generic range manager structs 37 * Generic range manager structs
38 */ 38 */
39#include <linux/list.h> 39#include <linux/list.h>
40#ifdef CONFIG_DEBUG_FS
41#include <linux/seq_file.h>
42#endif
40 43
41struct drm_mm_node { 44struct drm_mm_node {
42 struct list_head fl_entry; 45 struct list_head fl_entry;
@@ -96,4 +99,8 @@ static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
96 return block->mm; 99 return block->mm;
97} 100}
98 101
102#ifdef CONFIG_DEBUG_FS
103int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
104#endif
105
99#endif 106#endif
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index ae304cc73c90..1f908416aedb 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -68,10 +68,11 @@
68#define DRM_MODE_DPMS_OFF 3 68#define DRM_MODE_DPMS_OFF 3
69 69
70/* Scaling mode options */ 70/* Scaling mode options */
71#define DRM_MODE_SCALE_NON_GPU 0 71#define DRM_MODE_SCALE_NONE 0 /* Unmodified timing (display or
72#define DRM_MODE_SCALE_FULLSCREEN 1 72 software can still scale) */
73#define DRM_MODE_SCALE_NO_SCALE 2 73#define DRM_MODE_SCALE_FULLSCREEN 1 /* Full screen, ignore aspect */
74#define DRM_MODE_SCALE_ASPECT 3 74#define DRM_MODE_SCALE_CENTER 2 /* Centered, no scaling */
75#define DRM_MODE_SCALE_ASPECT 3 /* Full screen, preserve aspect */
75 76
76/* Dithering mode options */ 77/* Dithering mode options */
77#define DRM_MODE_DITHERING_OFF 0 78#define DRM_MODE_DITHERING_OFF 0
@@ -141,6 +142,7 @@ struct drm_mode_get_encoder {
141#define DRM_MODE_SUBCONNECTOR_Composite 5 142#define DRM_MODE_SUBCONNECTOR_Composite 5
142#define DRM_MODE_SUBCONNECTOR_SVIDEO 6 143#define DRM_MODE_SUBCONNECTOR_SVIDEO 6
143#define DRM_MODE_SUBCONNECTOR_Component 8 144#define DRM_MODE_SUBCONNECTOR_Component 8
145#define DRM_MODE_SUBCONNECTOR_SCART 9
144 146
145#define DRM_MODE_CONNECTOR_Unknown 0 147#define DRM_MODE_CONNECTOR_Unknown 0
146#define DRM_MODE_CONNECTOR_VGA 1 148#define DRM_MODE_CONNECTOR_VGA 1
@@ -155,6 +157,7 @@ struct drm_mode_get_encoder {
155#define DRM_MODE_CONNECTOR_DisplayPort 10 157#define DRM_MODE_CONNECTOR_DisplayPort 10
156#define DRM_MODE_CONNECTOR_HDMIA 11 158#define DRM_MODE_CONNECTOR_HDMIA 11
157#define DRM_MODE_CONNECTOR_HDMIB 12 159#define DRM_MODE_CONNECTOR_HDMIB 12
160#define DRM_MODE_CONNECTOR_TV 13
158 161
159struct drm_mode_get_connector { 162struct drm_mode_get_connector {
160 163
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 853508499d20..e6f3b120f51a 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -80,7 +80,7 @@
80 {0x1002, 0x5158, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200}, \ 80 {0x1002, 0x5158, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200}, \
81 {0x1002, 0x5159, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 81 {0x1002, 0x5159, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
82 {0x1002, 0x515A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 82 {0x1002, 0x515A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
83 {0x1002, 0x515E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 83 {0x1002, 0x515E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100|RADEON_SINGLE_CRTC}, \
84 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 84 {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
85 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 86 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
@@ -113,7 +113,7 @@
113 {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 113 {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
114 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 114 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
115 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 115 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
116 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 116 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100|RADEON_SINGLE_CRTC}, \
117 {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \ 117 {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 118 {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
119 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \ 119 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
@@ -552,6 +552,7 @@
552 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 552 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
553 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 553 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
554 {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 554 {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
555 {0x8086, 0x2e42, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
555 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 556 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
556 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 557 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
557 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 558 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h
new file mode 100644
index 000000000000..1d8e033fde67
--- /dev/null
+++ b/include/drm/drm_sysfs.h
@@ -0,0 +1,12 @@
1#ifndef _DRM_SYSFS_H_
2#define _DRM_SYSFS_H_
3
4/**
5 * This minimalistic include file is intended for users (read TTM) that
6 * don't want to include the full drmP.h file.
7 */
8
9extern int drm_class_device_register(struct device *dev);
10extern void drm_class_device_unregister(struct device *dev);
11
12#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8e1e92583fbc..7e0cb1da92e6 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -185,6 +185,7 @@ typedef struct _drm_i915_sarea {
185#define DRM_I915_GEM_GET_APERTURE 0x23 185#define DRM_I915_GEM_GET_APERTURE 0x23
186#define DRM_I915_GEM_MMAP_GTT 0x24 186#define DRM_I915_GEM_MMAP_GTT 0x24
187#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 187#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
188#define DRM_I915_GEM_MADVISE 0x26
188 189
189#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 190#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
190#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 191#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -221,6 +222,7 @@ typedef struct _drm_i915_sarea {
221#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 222#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
222#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 223#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
223#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id) 224#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id)
225#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
224 226
225/* Allow drivers to submit batchbuffers directly to hardware, relying 227/* Allow drivers to submit batchbuffers directly to hardware, relying
226 * on the security mechanisms provided by hardware. 228 * on the security mechanisms provided by hardware.
@@ -667,4 +669,21 @@ struct drm_i915_get_pipe_from_crtc_id {
667 __u32 pipe; 669 __u32 pipe;
668}; 670};
669 671
672#define I915_MADV_WILLNEED 0
673#define I915_MADV_DONTNEED 1
674#define __I915_MADV_PURGED 2 /* internal state */
675
676struct drm_i915_gem_madvise {
677 /** Handle of the buffer to change the backing store advice */
678 __u32 handle;
679
680 /* Advice: either the buffer will be needed again in the near future,
681 * or wont be and could be discarded under memory pressure.
682 */
683 __u32 madv;
684
685 /** Whether the backing store still exists. */
686 __u32 retained;
687};
688
670#endif /* _I915_DRM_H_ */ 689#endif /* _I915_DRM_H_ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 2ba61e18fc8b..3b9932ab1756 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -802,11 +802,12 @@ struct drm_radeon_gem_create {
802 uint32_t flags; 802 uint32_t flags;
803}; 803};
804 804
805#define RADEON_TILING_MACRO 0x1 805#define RADEON_TILING_MACRO 0x1
806#define RADEON_TILING_MICRO 0x2 806#define RADEON_TILING_MICRO 0x2
807#define RADEON_TILING_SWAP 0x4 807#define RADEON_TILING_SWAP_16BIT 0x4
808#define RADEON_TILING_SURFACE 0x8 /* this object requires a surface 808#define RADEON_TILING_SWAP_32BIT 0x8
809 * when mapped - i.e. front buffer */ 809#define RADEON_TILING_SURFACE 0x10 /* this object requires a surface
810 * when mapped - i.e. front buffer */
810 811
811struct drm_radeon_gem_set_tiling { 812struct drm_radeon_gem_set_tiling {
812 uint32_t handle; 813 uint32_t handle;
@@ -899,6 +900,7 @@ struct drm_radeon_cs {
899#define RADEON_INFO_DEVICE_ID 0x00 900#define RADEON_INFO_DEVICE_ID 0x00
900#define RADEON_INFO_NUM_GB_PIPES 0x01 901#define RADEON_INFO_NUM_GB_PIPES 0x01
901#define RADEON_INFO_NUM_Z_PIPES 0x02 902#define RADEON_INFO_NUM_Z_PIPES 0x02
903#define RADEON_INFO_ACCEL_WORKING 0x03
902 904
903struct drm_radeon_info { 905struct drm_radeon_info {
904 uint32_t request; 906 uint32_t request;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index cd22ab4b495c..491146170522 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -155,6 +155,7 @@ struct ttm_buffer_object {
155 * Members constant at init. 155 * Members constant at init.
156 */ 156 */
157 157
158 struct ttm_bo_global *glob;
158 struct ttm_bo_device *bdev; 159 struct ttm_bo_device *bdev;
159 unsigned long buffer_start; 160 unsigned long buffer_start;
160 enum ttm_bo_type type; 161 enum ttm_bo_type type;
@@ -245,14 +246,15 @@ struct ttm_buffer_object {
245 * premapped region. 246 * premapped region.
246 */ 247 */
247 248
249#define TTM_BO_MAP_IOMEM_MASK 0x80
248struct ttm_bo_kmap_obj { 250struct ttm_bo_kmap_obj {
249 void *virtual; 251 void *virtual;
250 struct page *page; 252 struct page *page;
251 enum { 253 enum {
252 ttm_bo_map_iomap, 254 ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK,
253 ttm_bo_map_vmap, 255 ttm_bo_map_vmap = 2,
254 ttm_bo_map_kmap, 256 ttm_bo_map_kmap = 3,
255 ttm_bo_map_premapped, 257 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
256 } bo_kmap_type; 258 } bo_kmap_type;
257}; 259};
258 260
@@ -522,8 +524,7 @@ extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
522static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map, 524static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
523 bool *is_iomem) 525 bool *is_iomem)
524{ 526{
525 *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap || 527 *is_iomem = !!(map->bo_kmap_type & TTM_BO_MAP_IOMEM_MASK);
526 map->bo_kmap_type == ttm_bo_map_premapped);
527 return map->virtual; 528 return map->virtual;
528} 529}
529 530
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a68829db381a..e8cd6d20aed2 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -32,6 +32,7 @@
32 32
33#include "ttm/ttm_bo_api.h" 33#include "ttm/ttm_bo_api.h"
34#include "ttm/ttm_memory.h" 34#include "ttm/ttm_memory.h"
35#include "ttm/ttm_module.h"
35#include "drm_mm.h" 36#include "drm_mm.h"
36#include "linux/workqueue.h" 37#include "linux/workqueue.h"
37#include "linux/fs.h" 38#include "linux/fs.h"
@@ -161,7 +162,7 @@ struct ttm_tt {
161 long last_lomem_page; 162 long last_lomem_page;
162 uint32_t page_flags; 163 uint32_t page_flags;
163 unsigned long num_pages; 164 unsigned long num_pages;
164 struct ttm_bo_device *bdev; 165 struct ttm_bo_global *glob;
165 struct ttm_backend *be; 166 struct ttm_backend *be;
166 struct task_struct *tsk; 167 struct task_struct *tsk;
167 unsigned long start; 168 unsigned long start;
@@ -364,24 +365,73 @@ struct ttm_bo_driver {
364 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 365 void (*fault_reserve_notify)(struct ttm_buffer_object *bo);
365}; 366};
366 367
367#define TTM_NUM_MEM_TYPES 8 368/**
369 * struct ttm_bo_global_ref - Argument to initialize a struct ttm_bo_global.
370 */
371
372struct ttm_bo_global_ref {
373 struct ttm_global_reference ref;
374 struct ttm_mem_global *mem_glob;
375};
368 376
369#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
370 idling before CPU mapping */
371#define TTM_BO_PRIV_FLAG_MAX 1
372/** 377/**
373 * struct ttm_bo_device - Buffer object driver device-specific data. 378 * struct ttm_bo_global - Buffer object driver global data.
374 * 379 *
375 * @mem_glob: Pointer to a struct ttm_mem_global object for accounting. 380 * @mem_glob: Pointer to a struct ttm_mem_global object for accounting.
376 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
377 * @count: Current number of buffer object.
378 * @pages: Current number of pinned pages.
379 * @dummy_read_page: Pointer to a dummy page used for mapping requests 381 * @dummy_read_page: Pointer to a dummy page used for mapping requests
380 * of unpopulated pages. 382 * of unpopulated pages.
381 * @shrink: A shrink callback object used for buffre object swap. 383 * @shrink: A shrink callback object used for buffer object swap.
382 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded) 384 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
383 * used by a buffer object. This is excluding page arrays and backing pages. 385 * used by a buffer object. This is excluding page arrays and backing pages.
384 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object). 386 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
387 * @device_list_mutex: Mutex protecting the device list.
388 * This mutex is held while traversing the device list for pm options.
389 * @lru_lock: Spinlock protecting the bo subsystem lru lists.
390 * @device_list: List of buffer object devices.
391 * @swap_lru: Lru list of buffer objects used for swapping.
392 */
393
394struct ttm_bo_global {
395
396 /**
397 * Constant after init.
398 */
399
400 struct kobject kobj;
401 struct ttm_mem_global *mem_glob;
402 struct page *dummy_read_page;
403 struct ttm_mem_shrink shrink;
404 size_t ttm_bo_extra_size;
405 size_t ttm_bo_size;
406 struct mutex device_list_mutex;
407 spinlock_t lru_lock;
408
409 /**
410 * Protected by device_list_mutex.
411 */
412 struct list_head device_list;
413
414 /**
415 * Protected by the lru_lock.
416 */
417 struct list_head swap_lru;
418
419 /**
420 * Internal protection.
421 */
422 atomic_t bo_count;
423};
424
425
426#define TTM_NUM_MEM_TYPES 8
427
428#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
429 idling before CPU mapping */
430#define TTM_BO_PRIV_FLAG_MAX 1
431/**
432 * struct ttm_bo_device - Buffer object driver device-specific data.
433 *
434 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
385 * @man: An array of mem_type_managers. 435 * @man: An array of mem_type_managers.
386 * @addr_space_mm: Range manager for the device address space. 436 * @addr_space_mm: Range manager for the device address space.
387 * lru_lock: Spinlock that protects the buffer+device lru lists and 437 * lru_lock: Spinlock that protects the buffer+device lru lists and
@@ -399,32 +449,21 @@ struct ttm_bo_device {
399 /* 449 /*
400 * Constant after bo device init / atomic. 450 * Constant after bo device init / atomic.
401 */ 451 */
402 452 struct list_head device_list;
403 struct ttm_mem_global *mem_glob; 453 struct ttm_bo_global *glob;
404 struct ttm_bo_driver *driver; 454 struct ttm_bo_driver *driver;
405 struct page *dummy_read_page;
406 struct ttm_mem_shrink shrink;
407
408 size_t ttm_bo_extra_size;
409 size_t ttm_bo_size;
410
411 rwlock_t vm_lock; 455 rwlock_t vm_lock;
456 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
412 /* 457 /*
413 * Protected by the vm lock. 458 * Protected by the vm lock.
414 */ 459 */
415 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
416 struct rb_root addr_space_rb; 460 struct rb_root addr_space_rb;
417 struct drm_mm addr_space_mm; 461 struct drm_mm addr_space_mm;
418 462
419 /* 463 /*
420 * Might want to change this to one lock per manager. 464 * Protected by the global:lru lock.
421 */
422 spinlock_t lru_lock;
423 /*
424 * Protected by the lru lock.
425 */ 465 */
426 struct list_head ddestroy; 466 struct list_head ddestroy;
427 struct list_head swap_lru;
428 467
429 /* 468 /*
430 * Protected by load / firstopen / lastclose /unload sync. 469 * Protected by load / firstopen / lastclose /unload sync.
@@ -640,6 +679,9 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
640 unsigned long *bus_offset, 679 unsigned long *bus_offset,
641 unsigned long *bus_size); 680 unsigned long *bus_size);
642 681
682extern void ttm_bo_global_release(struct ttm_global_reference *ref);
683extern int ttm_bo_global_init(struct ttm_global_reference *ref);
684
643extern int ttm_bo_device_release(struct ttm_bo_device *bdev); 685extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
644 686
645/** 687/**
@@ -657,7 +699,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
657 * !0: Failure. 699 * !0: Failure.
658 */ 700 */
659extern int ttm_bo_device_init(struct ttm_bo_device *bdev, 701extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
660 struct ttm_mem_global *mem_glob, 702 struct ttm_bo_global *glob,
661 struct ttm_bo_driver *driver, 703 struct ttm_bo_driver *driver,
662 uint64_t file_page_offset, bool need_dma32); 704 uint64_t file_page_offset, bool need_dma32);
663 705
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index d8b8f042c4f1..6983a7cf4da4 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -32,6 +32,7 @@
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/wait.h> 33#include <linux/wait.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/kobject.h>
35 36
36/** 37/**
37 * struct ttm_mem_shrink - callback to shrink TTM memory usage. 38 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
@@ -60,34 +61,33 @@ struct ttm_mem_shrink {
60 * @queue: Wait queue for processes suspended waiting for memory. 61 * @queue: Wait queue for processes suspended waiting for memory.
61 * @lock: Lock to protect the @shrink - and the memory accounting members, 62 * @lock: Lock to protect the @shrink - and the memory accounting members,
62 * that is, essentially the whole structure with some exceptions. 63 * that is, essentially the whole structure with some exceptions.
63 * @emer_memory: Lowmem memory limit available for root. 64 * @zones: Array of pointers to accounting zones.
64 * @max_memory: Lowmem memory limit available for non-root. 65 * @num_zones: Number of populated entries in the @zones array.
65 * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in. 66 * @zone_kernel: Pointer to the kernel zone.
66 * @used_memory: Currently used lowmem memory. 67 * @zone_highmem: Pointer to the highmem zone if there is one.
67 * @used_total_memory: Currently used total (lowmem + highmem) memory. 68 * @zone_dma32: Pointer to the dma32 zone if there is one.
68 * @total_memory_swap_limit: Total memory limit where the shrink workqueue
69 * kicks in.
70 * @max_total_memory: Total memory available to non-root processes.
71 * @emer_total_memory: Total memory available to root processes.
72 * 69 *
73 * Note that this structure is not per device. It should be global for all 70 * Note that this structure is not per device. It should be global for all
74 * graphics devices. 71 * graphics devices.
75 */ 72 */
76 73
74#define TTM_MEM_MAX_ZONES 2
75struct ttm_mem_zone;
77struct ttm_mem_global { 76struct ttm_mem_global {
77 struct kobject kobj;
78 struct ttm_mem_shrink *shrink; 78 struct ttm_mem_shrink *shrink;
79 struct workqueue_struct *swap_queue; 79 struct workqueue_struct *swap_queue;
80 struct work_struct work; 80 struct work_struct work;
81 wait_queue_head_t queue; 81 wait_queue_head_t queue;
82 spinlock_t lock; 82 spinlock_t lock;
83 uint64_t emer_memory; 83 struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES];
84 uint64_t max_memory; 84 unsigned int num_zones;
85 uint64_t swap_limit; 85 struct ttm_mem_zone *zone_kernel;
86 uint64_t used_memory; 86#ifdef CONFIG_HIGHMEM
87 uint64_t used_total_memory; 87 struct ttm_mem_zone *zone_highmem;
88 uint64_t total_memory_swap_limit; 88#else
89 uint64_t max_total_memory; 89 struct ttm_mem_zone *zone_dma32;
90 uint64_t emer_total_memory; 90#endif
91}; 91};
92 92
93/** 93/**
@@ -146,8 +146,13 @@ static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
146extern int ttm_mem_global_init(struct ttm_mem_global *glob); 146extern int ttm_mem_global_init(struct ttm_mem_global *glob);
147extern void ttm_mem_global_release(struct ttm_mem_global *glob); 147extern void ttm_mem_global_release(struct ttm_mem_global *glob);
148extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, 148extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
149 bool no_wait, bool interruptible, bool himem); 149 bool no_wait, bool interruptible);
150extern void ttm_mem_global_free(struct ttm_mem_global *glob, 150extern void ttm_mem_global_free(struct ttm_mem_global *glob,
151 uint64_t amount, bool himem); 151 uint64_t amount);
152extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
153 struct page *page,
154 bool no_wait, bool interruptible);
155extern void ttm_mem_global_free_page(struct ttm_mem_global *glob,
156 struct page *page);
152extern size_t ttm_round_pot(size_t size); 157extern size_t ttm_round_pot(size_t size);
153#endif 158#endif
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
index d1d433834e4f..cf416aee19af 100644
--- a/include/drm/ttm/ttm_module.h
+++ b/include/drm/ttm/ttm_module.h
@@ -32,6 +32,7 @@
32#define _TTM_MODULE_H_ 32#define _TTM_MODULE_H_
33 33
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35struct kobject;
35 36
36#define TTM_PFX "[TTM] " 37#define TTM_PFX "[TTM] "
37 38
@@ -54,5 +55,6 @@ extern void ttm_global_init(void);
54extern void ttm_global_release(void); 55extern void ttm_global_release(void);
55extern int ttm_global_item_ref(struct ttm_global_reference *ref); 56extern int ttm_global_item_ref(struct ttm_global_reference *ref);
56extern void ttm_global_item_unref(struct ttm_global_reference *ref); 57extern void ttm_global_item_unref(struct ttm_global_reference *ref);
58extern struct kobject *ttm_get_kobj(void);
57 59
58#endif /* _TTM_MODULE_H_ */ 60#endif /* _TTM_MODULE_H_ */
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
index 7609365577f1..5cb86c307f5d 100644
--- a/include/keys/rxrpc-type.h
+++ b/include/keys/rxrpc-type.h
@@ -21,4 +21,111 @@ extern struct key_type key_type_rxrpc;
21 21
22extern struct key *rxrpc_get_null_key(const char *); 22extern struct key *rxrpc_get_null_key(const char *);
23 23
24/*
25 * RxRPC key for Kerberos IV (type-2 security)
26 */
27struct rxkad_key {
28 u32 vice_id;
29 u32 start; /* time at which ticket starts */
30 u32 expiry; /* time at which ticket expires */
31 u32 kvno; /* key version number */
32 u8 primary_flag; /* T if key for primary cell for this user */
33 u16 ticket_len; /* length of ticket[] */
34 u8 session_key[8]; /* DES session key */
35 u8 ticket[0]; /* the encrypted ticket */
36};
37
38/*
39 * Kerberos 5 principal
40 * name/name/name@realm
41 */
42struct krb5_principal {
43 u8 n_name_parts; /* N of parts of the name part of the principal */
44 char **name_parts; /* parts of the name part of the principal */
45 char *realm; /* parts of the realm part of the principal */
46};
47
48/*
49 * Kerberos 5 tagged data
50 */
51struct krb5_tagged_data {
52 /* for tag value, see /usr/include/krb5/krb5.h
53 * - KRB5_AUTHDATA_* for auth data
54 * -
55 */
56 s32 tag;
57 u32 data_len;
58 u8 *data;
59};
60
61/*
62 * RxRPC key for Kerberos V (type-5 security)
63 */
64struct rxk5_key {
65 u64 authtime; /* time at which auth token generated */
66 u64 starttime; /* time at which auth token starts */
67 u64 endtime; /* time at which auth token expired */
68 u64 renew_till; /* time to which auth token can be renewed */
69 s32 is_skey; /* T if ticket is encrypted in another ticket's
70 * skey */
71 s32 flags; /* mask of TKT_FLG_* bits (krb5/krb5.h) */
72 struct krb5_principal client; /* client principal name */
73 struct krb5_principal server; /* server principal name */
74 u16 ticket_len; /* length of ticket */
75 u16 ticket2_len; /* length of second ticket */
76 u8 n_authdata; /* number of authorisation data elements */
77 u8 n_addresses; /* number of addresses */
78 struct krb5_tagged_data session; /* session data; tag is enctype */
79 struct krb5_tagged_data *addresses; /* addresses */
80 u8 *ticket; /* krb5 ticket */
81 u8 *ticket2; /* second krb5 ticket, if related to ticket (via
82 * DUPLICATE-SKEY or ENC-TKT-IN-SKEY) */
83 struct krb5_tagged_data *authdata; /* authorisation data */
84};
85
86/*
87 * list of tokens attached to an rxrpc key
88 */
89struct rxrpc_key_token {
90 u16 security_index; /* RxRPC header security index */
91 struct rxrpc_key_token *next; /* the next token in the list */
92 union {
93 struct rxkad_key *kad;
94 struct rxk5_key *k5;
95 };
96};
97
98/*
99 * structure of raw payloads passed to add_key() or instantiate key
100 */
101struct rxrpc_key_data_v1 {
102 u32 kif_version; /* 1 */
103 u16 security_index;
104 u16 ticket_length;
105 u32 expiry; /* time_t */
106 u32 kvno;
107 u8 session_key[8];
108 u8 ticket[0];
109};
110
111/*
112 * AF_RXRPC key payload derived from XDR format
113 * - based on openafs-1.4.10/src/auth/afs_token.xg
114 */
115#define AFSTOKEN_LENGTH_MAX 16384 /* max payload size */
116#define AFSTOKEN_STRING_MAX 256 /* max small string length */
117#define AFSTOKEN_DATA_MAX 64 /* max small data length */
118#define AFSTOKEN_CELL_MAX 64 /* max cellname length */
119#define AFSTOKEN_MAX 8 /* max tokens per payload */
120#define AFSTOKEN_BDATALN_MAX 16384 /* max big data length */
121#define AFSTOKEN_RK_TIX_MAX 12000 /* max RxKAD ticket size */
122#define AFSTOKEN_GK_KEY_MAX 64 /* max GSSAPI key size */
123#define AFSTOKEN_GK_TOKEN_MAX 16384 /* max GSSAPI token size */
124#define AFSTOKEN_K5_COMPONENTS_MAX 16 /* max K5 components */
125#define AFSTOKEN_K5_NAME_MAX 128 /* max K5 name length */
126#define AFSTOKEN_K5_REALM_MAX 64 /* max K5 realm name length */
127#define AFSTOKEN_K5_TIX_MAX 16384 /* max K5 ticket size */
128#define AFSTOKEN_K5_ADDRESSES_MAX 16 /* max K5 addresses */
129#define AFSTOKEN_K5_AUTHDATA_MAX 16 /* max K5 pieces of auth data */
130
24#endif /* _KEYS_RXRPC_TYPE_H */ 131#endif /* _KEYS_RXRPC_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 334a3593cdfd..1feed71551c9 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -126,6 +126,7 @@ header-y += nfs_mount.h
126header-y += nl80211.h 126header-y += nl80211.h
127header-y += param.h 127header-y += param.h
128header-y += pci_regs.h 128header-y += pci_regs.h
129header-y += perf_event.h
129header-y += pfkeyv2.h 130header-y += pfkeyv2.h
130header-y += pg.h 131header-y += pg.h
131header-y += phantom.h 132header-y += phantom.h
@@ -268,6 +269,10 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
268 $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 269 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
269unifdef-y += kvm.h 270unifdef-y += kvm.h
270endif 271endif
272ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
273 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
274unifdef-y += kvm_para.h
275endif
271unifdef-y += llc.h 276unifdef-y += llc.h
272unifdef-y += loop.h 277unifdef-y += loop.h
273unifdef-y += lp.h 278unifdef-y += lp.h
@@ -359,6 +364,7 @@ unifdef-y += utsname.h
359unifdef-y += videodev2.h 364unifdef-y += videodev2.h
360unifdef-y += videodev.h 365unifdef-y += videodev.h
361unifdef-y += virtio_config.h 366unifdef-y += virtio_config.h
367unifdef-y += virtio_ids.h
362unifdef-y += virtio_blk.h 368unifdef-y += virtio_blk.h
363unifdef-y += virtio_net.h 369unifdef-y += virtio_net.h
364unifdef-y += virtio_9p.h 370unifdef-y += virtio_9p.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 34321cfffeab..dfcd920c3e54 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -41,8 +41,6 @@
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42#include <acpi/acpi_numa.h> 42#include <acpi/acpi_numa.h>
43#include <asm/acpi.h> 43#include <asm/acpi.h>
44#include <linux/dmi.h>
45
46 44
47enum acpi_irq_model_id { 45enum acpi_irq_model_id {
48 ACPI_IRQ_MODEL_PIC = 0, 46 ACPI_IRQ_MODEL_PIC = 0,
@@ -219,10 +217,8 @@ static inline int acpi_video_display_switch_support(void)
219#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ 217#endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
220 218
221extern int acpi_blacklisted(void); 219extern int acpi_blacklisted(void);
222#ifdef CONFIG_DMI
223extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 220extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
224extern int acpi_osi_setup(char *str); 221extern int acpi_osi_setup(char *str);
225#endif
226 222
227#ifdef CONFIG_ACPI_NUMA 223#ifdef CONFIG_ACPI_NUMA
228int acpi_get_pxm(acpi_handle handle); 224int acpi_get_pxm(acpi_handle handle);
@@ -292,7 +288,10 @@ void __init acpi_s4_no_nvs(void);
292extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); 288extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
293extern void acpi_early_init(void); 289extern void acpi_early_init(void);
294 290
295#else /* CONFIG_ACPI */ 291#else /* !CONFIG_ACPI */
292
293#define acpi_disabled 1
294
296static inline void acpi_early_init(void) { } 295static inline void acpi_early_init(void) { }
297 296
298static inline int early_acpi_boot_init(void) 297static inline int early_acpi_boot_init(void)
@@ -331,5 +330,11 @@ static inline int acpi_check_mem_region(resource_size_t start,
331 return 0; 330 return 0;
332} 331}
333 332
333struct acpi_table_header;
334static inline int acpi_table_parse(char *id,
335 int (*handler)(struct acpi_table_header *))
336{
337 return -1;
338}
334#endif /* !CONFIG_ACPI */ 339#endif /* !CONFIG_ACPI */
335#endif /*_LINUX_ACPI_H*/ 340#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 76fa794fdac0..9101ed64f803 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -53,7 +53,7 @@ struct agp_kern_info {
53 int current_memory; 53 int current_memory;
54 bool cant_use_aperture; 54 bool cant_use_aperture;
55 unsigned long page_mask; 55 unsigned long page_mask;
56 struct vm_operations_struct *vm_ops; 56 const struct vm_operations_struct *vm_ops;
57}; 57};
58 58
59/* 59/*
@@ -79,9 +79,12 @@ 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; 82 bool vmalloc_flag;
83 /* list of agp_memory mapped to the aperture */ 83 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list; 84 struct list_head mapped_list;
85 /* DMA-mapped addresses */
86 struct scatterlist *sg_list;
87 int num_sg;
85}; 88};
86 89
87#define AGP_NORMAL_MEMORY 0 90#define AGP_NORMAL_MEMORY 0
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 47f7d932a01d..aea219d7d8d1 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -225,8 +225,6 @@ static inline void exit_aio(struct mm_struct *mm) { }
225 225
226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
227 227
228#include <linux/aio_abi.h>
229
230static inline struct kiocb *list_kiocb(struct list_head *h) 228static inline struct kiocb *list_kiocb(struct list_head *h)
231{ 229{
232 return list_entry(h, struct kiocb, ki_list); 230 return list_entry(h, struct kiocb, ki_list);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 9b93cafa82a0..ab94335b4bb9 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -36,6 +36,11 @@ struct amba_driver {
36 struct amba_id *id_table; 36 struct amba_id *id_table;
37}; 37};
38 38
39enum amba_vendor {
40 AMBA_VENDOR_ARM = 0x41,
41 AMBA_VENDOR_ST = 0x80,
42};
43
39#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) 44#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
40#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) 45#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
41 46
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
new file mode 100644
index 000000000000..6b4241748dda
--- /dev/null
+++ b/include/linux/amba/mmci.h
@@ -0,0 +1,18 @@
1/*
2 * include/linux/amba/mmci.h
3 */
4#ifndef AMBA_MMCI_H
5#define AMBA_MMCI_H
6
7#include <linux/mmc/host.h>
8
9struct mmci_platform_data {
10 unsigned int ocr_mask; /* available voltages */
11 u32 (*translate_vdd)(struct device *, unsigned int);
12 unsigned int (*status)(struct device *);
13 int gpio_wp;
14 int gpio_cd;
15 unsigned long capabilities;
16};
17
18#endif
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index dcad0ffd1755..e4836c6b3dd7 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -136,12 +136,12 @@ enum ssp_tx_level_trig {
136 136
137/** 137/**
138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only) 138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139 * @SSP_CLK_RISING_EDGE: Receive data on rising edge 139 * @SSP_CLK_FIRST_EDGE: Receive data on first edge transition (actual direction depends on polarity)
140 * @SSP_CLK_FALLING_EDGE: Receive data on falling edge 140 * @SSP_CLK_SECOND_EDGE: Receive data on second edge transition (actual direction depends on polarity)
141 */ 141 */
142enum ssp_spi_clk_phase { 142enum ssp_spi_clk_phase {
143 SSP_CLK_RISING_EDGE, 143 SSP_CLK_FIRST_EDGE,
144 SSP_CLK_FALLING_EDGE 144 SSP_CLK_SECOND_EDGE
145}; 145};
146 146
147/** 147/**
diff --git a/include/linux/amba/pl093.h b/include/linux/amba/pl093.h
new file mode 100644
index 000000000000..2983e3671adb
--- /dev/null
+++ b/include/linux/amba/pl093.h
@@ -0,0 +1,80 @@
1/* linux/amba/pl093.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * AMBA PL093 SSMC (synchronous static memory controller)
8 * See DDI0236.pdf (r0p4) for more details
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#define SMB_BANK(x) ((x) * 0x20) /* each bank control set is 0x20 apart */
16
17/* Offsets for SMBxxxxRy registers */
18
19#define SMBIDCYR (0x00)
20#define SMBWSTRDR (0x04)
21#define SMBWSTWRR (0x08)
22#define SMBWSTOENR (0x0C)
23#define SMBWSTWENR (0x10)
24#define SMBCR (0x14)
25#define SMBSR (0x18)
26#define SMBWSTBRDR (0x1C)
27
28/* Masks for SMB registers */
29#define IDCY_MASK (0xf)
30#define WSTRD_MASK (0xf)
31#define WSTWR_MASK (0xf)
32#define WSTOEN_MASK (0xf)
33#define WSTWEN_MASK (0xf)
34
35/* Notes from datasheet:
36 * WSTOEN <= WSTRD
37 * WSTWEN <= WSTWR
38 *
39 * WSTOEN is not used with nWAIT
40 */
41
42/* SMBCR bit definitions */
43#define SMBCR_BIWRITEEN (1 << 21)
44#define SMBCR_ADDRVALIDWRITEEN (1 << 20)
45#define SMBCR_SYNCWRITE (1 << 17)
46#define SMBCR_BMWRITE (1 << 16)
47#define SMBCR_WRAPREAD (1 << 14)
48#define SMBCR_BIREADEN (1 << 13)
49#define SMBCR_ADDRVALIDREADEN (1 << 12)
50#define SMBCR_SYNCREAD (1 << 9)
51#define SMBCR_BMREAD (1 << 8)
52#define SMBCR_SMBLSPOL (1 << 6)
53#define SMBCR_WP (1 << 3)
54#define SMBCR_WAITEN (1 << 2)
55#define SMBCR_WAITPOL (1 << 1)
56#define SMBCR_RBLE (1 << 0)
57
58#define SMBCR_BURSTLENWRITE_MASK (3 << 18)
59#define SMBCR_BURSTLENWRITE_4 (0 << 18)
60#define SMBCR_BURSTLENWRITE_8 (1 << 18)
61#define SMBCR_BURSTLENWRITE_RESERVED (2 << 18)
62#define SMBCR_BURSTLENWRITE_CONTINUOUS (3 << 18)
63
64#define SMBCR_BURSTLENREAD_MASK (3 << 10)
65#define SMBCR_BURSTLENREAD_4 (0 << 10)
66#define SMBCR_BURSTLENREAD_8 (1 << 10)
67#define SMBCR_BURSTLENREAD_16 (2 << 10)
68#define SMBCR_BURSTLENREAD_CONTINUOUS (3 << 10)
69
70#define SMBCR_MW_MASK (3 << 4)
71#define SMBCR_MW_8BIT (0 << 4)
72#define SMBCR_MW_16BIT (1 << 4)
73#define SMBCR_MW_M32BIT (2 << 4)
74
75/* SSMC status registers */
76#define SSMCCSR (0x200)
77#define SSMCCR (0x204)
78#define SSMCITCR (0x208)
79#define SSMCITIP (0x20C)
80#define SSMCITIOP (0x210)
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index e0a0cdc2da43..69a21e0ebd33 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11struct file *anon_inode_getfile(const char *name,
12 const struct file_operations *fops,
13 void *priv, int flags);
11int anon_inode_getfd(const char *name, const struct file_operations *fops, 14int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 void *priv, int flags); 15 void *priv, int flags);
13 16
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index cd4bcb6989ce..7d650a0e3d8f 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -337,7 +337,8 @@ struct net_device *alloc_arcdev(const char *name);
337 337
338int arcnet_open(struct net_device *dev); 338int arcnet_open(struct net_device *dev);
339int arcnet_close(struct net_device *dev); 339int arcnet_close(struct net_device *dev);
340int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); 340netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
341 struct net_device *dev);
341void arcnet_timeout(struct net_device *dev); 342void arcnet_timeout(struct net_device *dev);
342 343
343#endif /* __KERNEL__ */ 344#endif /* __KERNEL__ */
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 5fc2ef8d97fa..a1c486a88e88 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -58,25 +58,60 @@ struct dma_chan_ref {
58 * array. 58 * array.
59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a 59 * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a
60 * dependency chain 60 * dependency chain
61 * @ASYNC_TX_DEP_ACK: ack the dependency descriptor. Useful for chaining. 61 * @ASYNC_TX_FENCE: specify that the next operation in the dependency
62 * chain uses this operation's result as an input
62 */ 63 */
63enum async_tx_flags { 64enum async_tx_flags {
64 ASYNC_TX_XOR_ZERO_DST = (1 << 0), 65 ASYNC_TX_XOR_ZERO_DST = (1 << 0),
65 ASYNC_TX_XOR_DROP_DST = (1 << 1), 66 ASYNC_TX_XOR_DROP_DST = (1 << 1),
66 ASYNC_TX_ACK = (1 << 3), 67 ASYNC_TX_ACK = (1 << 2),
67 ASYNC_TX_DEP_ACK = (1 << 4), 68 ASYNC_TX_FENCE = (1 << 3),
69};
70
71/**
72 * struct async_submit_ctl - async_tx submission/completion modifiers
73 * @flags: submission modifiers
74 * @depend_tx: parent dependency of the current operation being submitted
75 * @cb_fn: callback routine to run at operation completion
76 * @cb_param: parameter for the callback routine
77 * @scribble: caller provided space for dma/page address conversions
78 */
79struct async_submit_ctl {
80 enum async_tx_flags flags;
81 struct dma_async_tx_descriptor *depend_tx;
82 dma_async_tx_callback cb_fn;
83 void *cb_param;
84 void *scribble;
68}; 85};
69 86
70#ifdef CONFIG_DMA_ENGINE 87#ifdef CONFIG_DMA_ENGINE
71#define async_tx_issue_pending_all dma_issue_pending_all 88#define async_tx_issue_pending_all dma_issue_pending_all
89
90/**
91 * async_tx_issue_pending - send pending descriptor to the hardware channel
92 * @tx: descriptor handle to retrieve hardware context
93 *
94 * Note: any dependent operations will have already been issued by
95 * async_tx_channel_switch, or (in the case of no channel switch) will
96 * be already pending on this channel.
97 */
98static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
99{
100 if (likely(tx)) {
101 struct dma_chan *chan = tx->chan;
102 struct dma_device *dma = chan->device;
103
104 dma->device_issue_pending(chan);
105 }
106}
72#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 107#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
73#include <asm/async_tx.h> 108#include <asm/async_tx.h>
74#else 109#else
75#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \ 110#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
76 __async_tx_find_channel(dep, type) 111 __async_tx_find_channel(dep, type)
77struct dma_chan * 112struct dma_chan *
78__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 113__async_tx_find_channel(struct async_submit_ctl *submit,
79 enum dma_transaction_type tx_type); 114 enum dma_transaction_type tx_type);
80#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ 115#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
81#else 116#else
82static inline void async_tx_issue_pending_all(void) 117static inline void async_tx_issue_pending_all(void)
@@ -84,10 +119,16 @@ static inline void async_tx_issue_pending_all(void)
84 do { } while (0); 119 do { } while (0);
85} 120}
86 121
122static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *tx)
123{
124 do { } while (0);
125}
126
87static inline struct dma_chan * 127static inline struct dma_chan *
88async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 128async_tx_find_channel(struct async_submit_ctl *submit,
89 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 129 enum dma_transaction_type tx_type, struct page **dst,
90 struct page **src, int src_count, size_t len) 130 int dst_count, struct page **src, int src_count,
131 size_t len)
91{ 132{
92 return NULL; 133 return NULL;
93} 134}
@@ -99,46 +140,70 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
99 * @cb_fn_param: parameter to pass to the callback routine 140 * @cb_fn_param: parameter to pass to the callback routine
100 */ 141 */
101static inline void 142static inline void
102async_tx_sync_epilog(dma_async_tx_callback cb_fn, void *cb_fn_param) 143async_tx_sync_epilog(struct async_submit_ctl *submit)
103{ 144{
104 if (cb_fn) 145 if (submit->cb_fn)
105 cb_fn(cb_fn_param); 146 submit->cb_fn(submit->cb_param);
106} 147}
107 148
108void 149typedef union {
109async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, 150 unsigned long addr;
110 enum async_tx_flags flags, struct dma_async_tx_descriptor *depend_tx, 151 struct page *page;
111 dma_async_tx_callback cb_fn, void *cb_fn_param); 152 dma_addr_t dma;
153} addr_conv_t;
154
155static inline void
156init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags,
157 struct dma_async_tx_descriptor *tx,
158 dma_async_tx_callback cb_fn, void *cb_param,
159 addr_conv_t *scribble)
160{
161 args->flags = flags;
162 args->depend_tx = tx;
163 args->cb_fn = cb_fn;
164 args->cb_param = cb_param;
165 args->scribble = scribble;
166}
167
168void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx,
169 struct async_submit_ctl *submit);
112 170
113struct dma_async_tx_descriptor * 171struct dma_async_tx_descriptor *
114async_xor(struct page *dest, struct page **src_list, unsigned int offset, 172async_xor(struct page *dest, struct page **src_list, unsigned int offset,
115 int src_cnt, size_t len, enum async_tx_flags flags, 173 int src_cnt, size_t len, struct async_submit_ctl *submit);
116 struct dma_async_tx_descriptor *depend_tx,
117 dma_async_tx_callback cb_fn, void *cb_fn_param);
118 174
119struct dma_async_tx_descriptor * 175struct dma_async_tx_descriptor *
120async_xor_zero_sum(struct page *dest, struct page **src_list, 176async_xor_val(struct page *dest, struct page **src_list, unsigned int offset,
121 unsigned int offset, int src_cnt, size_t len, 177 int src_cnt, size_t len, enum sum_check_flags *result,
122 u32 *result, enum async_tx_flags flags, 178 struct async_submit_ctl *submit);
123 struct dma_async_tx_descriptor *depend_tx,
124 dma_async_tx_callback cb_fn, void *cb_fn_param);
125 179
126struct dma_async_tx_descriptor * 180struct dma_async_tx_descriptor *
127async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, 181async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
128 unsigned int src_offset, size_t len, enum async_tx_flags flags, 182 unsigned int src_offset, size_t len,
129 struct dma_async_tx_descriptor *depend_tx, 183 struct async_submit_ctl *submit);
130 dma_async_tx_callback cb_fn, void *cb_fn_param);
131 184
132struct dma_async_tx_descriptor * 185struct dma_async_tx_descriptor *
133async_memset(struct page *dest, int val, unsigned int offset, 186async_memset(struct page *dest, int val, unsigned int offset,
134 size_t len, enum async_tx_flags flags, 187 size_t len, struct async_submit_ctl *submit);
135 struct dma_async_tx_descriptor *depend_tx, 188
136 dma_async_tx_callback cb_fn, void *cb_fn_param); 189struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit_ctl *submit);
190
191struct dma_async_tx_descriptor *
192async_gen_syndrome(struct page **blocks, unsigned int offset, int src_cnt,
193 size_t len, struct async_submit_ctl *submit);
194
195struct dma_async_tx_descriptor *
196async_syndrome_val(struct page **blocks, unsigned int offset, int src_cnt,
197 size_t len, enum sum_check_flags *pqres, struct page *spare,
198 struct async_submit_ctl *submit);
199
200struct dma_async_tx_descriptor *
201async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb,
202 struct page **ptrs, struct async_submit_ctl *submit);
137 203
138struct dma_async_tx_descriptor * 204struct dma_async_tx_descriptor *
139async_trigger_callback(enum async_tx_flags flags, 205async_raid6_datap_recov(int src_num, size_t bytes, int faila,
140 struct dma_async_tx_descriptor *depend_tx, 206 struct page **ptrs, struct async_submit_ctl *submit);
141 dma_async_tx_callback cb_fn, void *cb_fn_param);
142 207
143void async_tx_quiesce(struct dma_async_tx_descriptor **tx); 208void async_tx_quiesce(struct dma_async_tx_descriptor **tx);
144#endif /* _ASYNC_TX_H_ */ 209#endif /* _ASYNC_TX_H_ */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 9c75921f0c16..4fb357312b3b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -210,15 +210,25 @@ enum {
210 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */ 210 ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
211 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */ 211 ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
212 ATA_CMD_EDD = 0x90, /* execute device diagnostic */ 212 ATA_CMD_EDD = 0x90, /* execute device diagnostic */
213 ATA_CMD_DOWNLOAD_MICRO = 0x92,
214 ATA_CMD_NOP = 0x00,
213 ATA_CMD_FLUSH = 0xE7, 215 ATA_CMD_FLUSH = 0xE7,
214 ATA_CMD_FLUSH_EXT = 0xEA, 216 ATA_CMD_FLUSH_EXT = 0xEA,
215 ATA_CMD_ID_ATA = 0xEC, 217 ATA_CMD_ID_ATA = 0xEC,
216 ATA_CMD_ID_ATAPI = 0xA1, 218 ATA_CMD_ID_ATAPI = 0xA1,
219 ATA_CMD_SERVICE = 0xA2,
217 ATA_CMD_READ = 0xC8, 220 ATA_CMD_READ = 0xC8,
218 ATA_CMD_READ_EXT = 0x25, 221 ATA_CMD_READ_EXT = 0x25,
222 ATA_CMD_READ_QUEUED = 0x26,
223 ATA_CMD_READ_STREAM_EXT = 0x2B,
224 ATA_CMD_READ_STREAM_DMA_EXT = 0x2A,
219 ATA_CMD_WRITE = 0xCA, 225 ATA_CMD_WRITE = 0xCA,
220 ATA_CMD_WRITE_EXT = 0x35, 226 ATA_CMD_WRITE_EXT = 0x35,
227 ATA_CMD_WRITE_QUEUED = 0x36,
228 ATA_CMD_WRITE_STREAM_EXT = 0x3B,
229 ATA_CMD_WRITE_STREAM_DMA_EXT = 0x3A,
221 ATA_CMD_WRITE_FUA_EXT = 0x3D, 230 ATA_CMD_WRITE_FUA_EXT = 0x3D,
231 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
222 ATA_CMD_FPDMA_READ = 0x60, 232 ATA_CMD_FPDMA_READ = 0x60,
223 ATA_CMD_FPDMA_WRITE = 0x61, 233 ATA_CMD_FPDMA_WRITE = 0x61,
224 ATA_CMD_PIO_READ = 0x20, 234 ATA_CMD_PIO_READ = 0x20,
@@ -235,6 +245,7 @@ enum {
235 ATA_CMD_PACKET = 0xA0, 245 ATA_CMD_PACKET = 0xA0,
236 ATA_CMD_VERIFY = 0x40, 246 ATA_CMD_VERIFY = 0x40,
237 ATA_CMD_VERIFY_EXT = 0x42, 247 ATA_CMD_VERIFY_EXT = 0x42,
248 ATA_CMD_WRITE_UNCORR_EXT = 0x45,
238 ATA_CMD_STANDBYNOW1 = 0xE0, 249 ATA_CMD_STANDBYNOW1 = 0xE0,
239 ATA_CMD_IDLEIMMEDIATE = 0xE1, 250 ATA_CMD_IDLEIMMEDIATE = 0xE1,
240 ATA_CMD_SLEEP = 0xE6, 251 ATA_CMD_SLEEP = 0xE6,
@@ -243,15 +254,34 @@ enum {
243 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 254 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
244 ATA_CMD_SET_MAX = 0xF9, 255 ATA_CMD_SET_MAX = 0xF9,
245 ATA_CMD_SET_MAX_EXT = 0x37, 256 ATA_CMD_SET_MAX_EXT = 0x37,
246 ATA_CMD_READ_LOG_EXT = 0x2f, 257 ATA_CMD_READ_LOG_EXT = 0x2F,
258 ATA_CMD_WRITE_LOG_EXT = 0x3F,
259 ATA_CMD_READ_LOG_DMA_EXT = 0x47,
260 ATA_CMD_WRITE_LOG_DMA_EXT = 0x57,
261 ATA_CMD_TRUSTED_RCV = 0x5C,
262 ATA_CMD_TRUSTED_RCV_DMA = 0x5D,
263 ATA_CMD_TRUSTED_SND = 0x5E,
264 ATA_CMD_TRUSTED_SND_DMA = 0x5F,
247 ATA_CMD_PMP_READ = 0xE4, 265 ATA_CMD_PMP_READ = 0xE4,
248 ATA_CMD_PMP_WRITE = 0xE8, 266 ATA_CMD_PMP_WRITE = 0xE8,
249 ATA_CMD_CONF_OVERLAY = 0xB1, 267 ATA_CMD_CONF_OVERLAY = 0xB1,
268 ATA_CMD_SEC_SET_PASS = 0xF1,
269 ATA_CMD_SEC_UNLOCK = 0xF2,
270 ATA_CMD_SEC_ERASE_PREP = 0xF3,
271 ATA_CMD_SEC_ERASE_UNIT = 0xF4,
250 ATA_CMD_SEC_FREEZE_LOCK = 0xF5, 272 ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
273 ATA_CMD_SEC_DISABLE_PASS = 0xF6,
274 ATA_CMD_CONFIG_STREAM = 0x51,
251 ATA_CMD_SMART = 0xB0, 275 ATA_CMD_SMART = 0xB0,
252 ATA_CMD_MEDIA_LOCK = 0xDE, 276 ATA_CMD_MEDIA_LOCK = 0xDE,
253 ATA_CMD_MEDIA_UNLOCK = 0xDF, 277 ATA_CMD_MEDIA_UNLOCK = 0xDF,
254 ATA_CMD_DSM = 0x06, 278 ATA_CMD_DSM = 0x06,
279 ATA_CMD_CHK_MED_CRD_TYP = 0xD1,
280 ATA_CMD_CFA_REQ_EXT_ERR = 0x03,
281 ATA_CMD_CFA_WRITE_NE = 0x38,
282 ATA_CMD_CFA_TRANS_SECT = 0x87,
283 ATA_CMD_CFA_ERASE = 0xC0,
284 ATA_CMD_CFA_WRITE_MULT_NE = 0xCD,
255 /* marked obsolete in the ATA/ATAPI-7 spec */ 285 /* marked obsolete in the ATA/ATAPI-7 spec */
256 ATA_CMD_RESTORE = 0x10, 286 ATA_CMD_RESTORE = 0x10,
257 287
@@ -304,8 +334,12 @@ enum {
304 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */ 334 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
305 335
306 /* SETFEATURE Sector counts for SATA features */ 336 /* SETFEATURE Sector counts for SATA features */
307 SATA_AN = 0x05, /* Asynchronous Notification */ 337 SATA_FPDMA_OFFSET = 0x01, /* FPDMA non-zero buffer offsets */
308 SATA_DIPM = 0x03, /* Device Initiated Power Management */ 338 SATA_FPDMA_AA = 0x02, /* FPDMA Setup FIS Auto-Activate */
339 SATA_DIPM = 0x03, /* Device Initiated Power Management */
340 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */
341 SATA_AN = 0x05, /* Asynchronous Notification */
342 SATA_SSP = 0x06, /* Software Settings Preservation */
309 343
310 /* feature values for SET_MAX */ 344 /* feature values for SET_MAX */
311 ATA_SET_MAX_ADDR = 0x00, 345 ATA_SET_MAX_ADDR = 0x00,
@@ -525,6 +559,9 @@ static inline int ata_is_data(u8 prot)
525#define ata_id_has_atapi_AN(id) \ 559#define ata_id_has_atapi_AN(id) \
526 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 560 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
527 ((id)[78] & (1 << 5)) ) 561 ((id)[78] & (1 << 5)) )
562#define ata_id_has_fpdma_aa(id) \
563 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
564 ((id)[78] & (1 << 2)) )
528#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) 565#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
529#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) 566#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
530#define ata_id_u32(id,n) \ 567#define ata_id_u32(id,n) \
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 086e5c362d3a..817b23705c91 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -397,7 +397,7 @@ struct atmdev_ops { /* only send is required */
397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
398 void __user *optval,int optlen); 398 void __user *optval,int optlen);
399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
400 void __user *optval,int optlen); 400 void __user *optval,unsigned int optlen);
401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb); 401 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags); 402 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
403 void (*phy_put)(struct atm_dev *dev,unsigned char value, 403 void (*phy_put)(struct atm_dev *dev,unsigned char value,
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 794ad74b1d61..c3ab81428c66 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -17,7 +17,7 @@ struct attribute_container {
17 struct list_head node; 17 struct list_head node;
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp; 20 const struct attribute_group *grp;
21 struct device_attribute **attrs; 21 struct device_attribute **attrs;
22 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 1d52425a6118..b449e738533a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -13,6 +13,8 @@
13#include <linux/proportions.h> 13#include <linux/proportions.h>
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>
17#include <linux/writeback.h>
16#include <asm/atomic.h> 18#include <asm/atomic.h>
17 19
18struct page; 20struct page;
@@ -23,9 +25,11 @@ struct dentry;
23 * Bits in backing_dev_info.state 25 * Bits in backing_dev_info.state
24 */ 26 */
25enum bdi_state { 27enum bdi_state {
26 BDI_pdflush, /* A pdflush thread is working this device */ 28 BDI_pending, /* On its way to being activated */
29 BDI_wb_alloc, /* Default embedded wb allocated */
27 BDI_async_congested, /* The async (write) queue is getting full */ 30 BDI_async_congested, /* The async (write) queue is getting full */
28 BDI_sync_congested, /* The sync queue is getting full */ 31 BDI_sync_congested, /* The sync queue is getting full */
32 BDI_registered, /* bdi_register() was done */
29 BDI_unused, /* Available bits start here */ 33 BDI_unused, /* Available bits start here */
30}; 34};
31 35
@@ -39,7 +43,23 @@ enum bdi_stat_item {
39 43
40#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 44#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
41 45
46struct bdi_writeback {
47 struct list_head list; /* hangs off the bdi */
48
49 struct backing_dev_info *bdi; /* our parent bdi */
50 unsigned int nr;
51
52 unsigned long last_old_flush; /* last old data flush */
53
54 struct task_struct *task; /* writeback task */
55 struct list_head b_dirty; /* dirty inodes */
56 struct list_head b_io; /* parked for writeback */
57 struct list_head b_more_io; /* parked for more writeback */
58};
59
42struct backing_dev_info { 60struct backing_dev_info {
61 struct list_head bdi_list;
62 struct rcu_head rcu_head;
43 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 63 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
44 unsigned long state; /* Always use atomic bitops on this */ 64 unsigned long state; /* Always use atomic bitops on this */
45 unsigned int capabilities; /* Device capabilities */ 65 unsigned int capabilities; /* Device capabilities */
@@ -48,6 +68,8 @@ struct backing_dev_info {
48 void (*unplug_io_fn)(struct backing_dev_info *, struct page *); 68 void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
49 void *unplug_io_data; 69 void *unplug_io_data;
50 70
71 char *name;
72
51 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; 73 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
52 74
53 struct prop_local_percpu completions; 75 struct prop_local_percpu completions;
@@ -56,6 +78,14 @@ struct backing_dev_info {
56 unsigned int min_ratio; 78 unsigned int min_ratio;
57 unsigned int max_ratio, max_prop_frac; 79 unsigned int max_ratio, max_prop_frac;
58 80
81 struct bdi_writeback wb; /* default writeback info for this bdi */
82 spinlock_t wb_lock; /* protects update side of wb_list */
83 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
87 struct list_head work_list;
88
59 struct device *dev; 89 struct device *dev;
60 90
61#ifdef CONFIG_DEBUG_FS 91#ifdef CONFIG_DEBUG_FS
@@ -71,6 +101,20 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
71 const char *fmt, ...); 101 const char *fmt, ...);
72int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 102int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
73void bdi_unregister(struct backing_dev_info *bdi); 103void bdi_unregister(struct backing_dev_info *bdi);
104void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
105 long nr_pages);
106int bdi_writeback_task(struct bdi_writeback *wb);
107int bdi_has_dirty_io(struct backing_dev_info *bdi);
108
109extern spinlock_t bdi_lock;
110extern struct list_head bdi_list;
111
112static inline int wb_has_dirty_io(struct bdi_writeback *wb)
113{
114 return !list_empty(&wb->b_dirty) ||
115 !list_empty(&wb->b_io) ||
116 !list_empty(&wb->b_more_io);
117}
74 118
75static inline void __add_bdi_stat(struct backing_dev_info *bdi, 119static inline void __add_bdi_stat(struct backing_dev_info *bdi,
76 enum bdi_stat_item item, s64 amount) 120 enum bdi_stat_item item, s64 amount)
@@ -261,6 +305,11 @@ static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi)
261 return bdi->capabilities & BDI_CAP_SWAP_BACKED; 305 return bdi->capabilities & BDI_CAP_SWAP_BACKED;
262} 306}
263 307
308static inline bool bdi_cap_flush_forker(struct backing_dev_info *bdi)
309{
310 return bdi == &default_backing_dev_info;
311}
312
264static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) 313static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
265{ 314{
266 return bdi_cap_writeback_dirty(mapping->backing_dev_info); 315 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
@@ -276,4 +325,10 @@ static inline bool mapping_cap_swap_backed(struct address_space *mapping)
276 return bdi_cap_swap_backed(mapping->backing_dev_info); 325 return bdi_cap_swap_backed(mapping->backing_dev_info);
277} 326}
278 327
328static inline int bdi_sched_wait(void *word)
329{
330 schedule();
331 return 0;
332}
333
279#endif /* _LINUX_BACKING_DEV_H */ 334#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 79ca2da81c87..0f5f57858a23 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -27,6 +27,11 @@
27 * Any other use of the locks below is probably wrong. 27 * Any other use of the locks below is probably wrong.
28 */ 28 */
29 29
30enum backlight_update_reason {
31 BACKLIGHT_UPDATE_HOTKEY,
32 BACKLIGHT_UPDATE_SYSFS,
33};
34
30struct backlight_device; 35struct backlight_device;
31struct fb_info; 36struct fb_info;
32 37
@@ -100,6 +105,8 @@ static inline void backlight_update_status(struct backlight_device *bd)
100extern struct backlight_device *backlight_device_register(const char *name, 105extern struct backlight_device *backlight_device_register(const char *name,
101 struct device *dev, void *devdata, struct backlight_ops *ops); 106 struct device *dev, void *devdata, struct backlight_ops *ops);
102extern void backlight_device_unregister(struct backlight_device *bd); 107extern void backlight_device_unregister(struct backlight_device *bd);
108extern void backlight_force_update(struct backlight_device *bd,
109 enum backlight_update_reason reason);
103 110
104#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 111#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
105 112
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 2046b5b8af48..aece486ac734 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -120,7 +120,7 @@ extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
120extern int prepare_bprm_creds(struct linux_binprm *bprm); 120extern int prepare_bprm_creds(struct linux_binprm *bprm);
121extern void install_exec_creds(struct linux_binprm *bprm); 121extern void install_exec_creds(struct linux_binprm *bprm);
122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); 122extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
123extern int set_binfmt(struct linux_binfmt *new); 123extern void set_binfmt(struct linux_binfmt *new);
124extern void free_bprm(struct linux_binprm *); 124extern void free_bprm(struct linux_binprm *);
125 125
126#endif /* __KERNEL__ */ 126#endif /* __KERNEL__ */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 2892b710771c..5be93f18d842 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -142,56 +142,51 @@ struct bio {
142 * 142 *
143 * bit 0 -- data direction 143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device. 144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- rw-ahead when set 145 * bit 1 -- fail fast device errors
146 * bit 2 -- barrier 146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
147 * Insert a serialization point in the IO queue, forcing previously 150 * Insert a serialization point in the IO queue, forcing previously
148 * submitted IO to be completed before this one is issued. 151 * submitted IO to be completed before this one is issued.
149 * bit 3 -- synchronous I/O hint. 152 * bit 6 -- synchronous I/O hint.
150 * bit 4 -- Unplug the device immediately after submitting this bio. 153 * bit 7 -- Unplug the device immediately after submitting this bio.
151 * bit 5 -- metadata request 154 * bit 8 -- metadata request
152 * Used for tracing to differentiate metadata and data IO. May also 155 * Used for tracing to differentiate metadata and data IO. May also
153 * get some preferential treatment in the IO scheduler 156 * get some preferential treatment in the IO scheduler
154 * bit 6 -- discard sectors 157 * bit 9 -- discard sectors
155 * Informs the lower level device that this range of sectors is no longer 158 * Informs the lower level device that this range of sectors is no longer
156 * used by the file system and may thus be freed by the device. Used 159 * used by the file system and may thus be freed by the device. Used
157 * for flash based storage. 160 * for flash based storage.
158 * bit 7 -- fail fast device errors
159 * bit 8 -- fail fast transport errors
160 * bit 9 -- fail fast driver errors
161 * Don't want driver retries for any fast fail whatever the reason. 161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this 162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request. 163 one has been submitted, even if it is a SYNC request.
164 */ 164 */
165#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 165enum bio_rw_flags {
166#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 166 BIO_RW,
167#define BIO_RW_BARRIER 2 167 BIO_RW_FAILFAST_DEV,
168#define BIO_RW_SYNCIO 3 168 BIO_RW_FAILFAST_TRANSPORT,
169#define BIO_RW_UNPLUG 4 169 BIO_RW_FAILFAST_DRIVER,
170#define BIO_RW_META 5 170 /* above flags must match REQ_* */
171#define BIO_RW_DISCARD 6 171 BIO_RW_AHEAD,
172#define BIO_RW_FAILFAST_DEV 7 172 BIO_RW_BARRIER,
173#define BIO_RW_FAILFAST_TRANSPORT 8 173 BIO_RW_SYNCIO,
174#define BIO_RW_FAILFAST_DRIVER 9 174 BIO_RW_UNPLUG,
175#define BIO_RW_NOIDLE 10 175 BIO_RW_META,
176 176 BIO_RW_DISCARD,
177#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 177 BIO_RW_NOIDLE,
178};
178 179
179/* 180/*
180 * Old defines, these should eventually be replaced by direct usage of 181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
181 * bio_rw_flagged() 182 * that explicit here.
182 */ 183 */
183#define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER) 184#define BIO_RW_RQ_MASK 0xf
184#define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO) 185
185#define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG) 186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
186#define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV) 187{
187#define bio_failfast_transport(bio) \ 188 return (bio->bi_rw & (1 << flag)) != 0;
188 bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT) 189}
189#define bio_failfast_driver(bio) \
190 bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
191#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
192#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
193#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
194#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
195 190
196/* 191/*
197 * upper 16 bits of bi_rw define the io priority of this bio 192 * upper 16 bits of bi_rw define the io priority of this bio
@@ -216,7 +211,7 @@ struct bio {
216#define bio_offset(bio) bio_iovec((bio))->bv_offset 211#define bio_offset(bio) bio_iovec((bio))->bv_offset
217#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
218#define bio_sectors(bio) ((bio)->bi_size >> 9) 213#define bio_sectors(bio) ((bio)->bi_size >> 9)
219#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) 214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD))
220 215
221static inline unsigned int bio_cur_bytes(struct bio *bio) 216static inline unsigned int bio_cur_bytes(struct bio *bio)
222{ 217{
diff --git a/include/linux/blk-iopoll.h b/include/linux/blk-iopoll.h
new file mode 100644
index 000000000000..308734d3d4a2
--- /dev/null
+++ b/include/linux/blk-iopoll.h
@@ -0,0 +1,48 @@
1#ifndef BLK_IOPOLL_H
2#define BLK_IOPOLL_H
3
4struct blk_iopoll;
5typedef int (blk_iopoll_fn)(struct blk_iopoll *, int);
6
7struct blk_iopoll {
8 struct list_head list;
9 unsigned long state;
10 unsigned long data;
11 int weight;
12 int max;
13 blk_iopoll_fn *poll;
14};
15
16enum {
17 IOPOLL_F_SCHED = 0,
18 IOPOLL_F_DISABLE = 1,
19};
20
21/*
22 * Returns 0 if we successfully set the IOPOLL_F_SCHED bit, indicating
23 * that we were the first to acquire this iop for scheduling. If this iop
24 * is currently disabled, return "failure".
25 */
26static inline int blk_iopoll_sched_prep(struct blk_iopoll *iop)
27{
28 if (!test_bit(IOPOLL_F_DISABLE, &iop->state))
29 return test_and_set_bit(IOPOLL_F_SCHED, &iop->state);
30
31 return 1;
32}
33
34static inline int blk_iopoll_disable_pending(struct blk_iopoll *iop)
35{
36 return test_bit(IOPOLL_F_DISABLE, &iop->state);
37}
38
39extern void blk_iopoll_sched(struct blk_iopoll *);
40extern void blk_iopoll_init(struct blk_iopoll *, int, blk_iopoll_fn *);
41extern void blk_iopoll_complete(struct blk_iopoll *);
42extern void __blk_iopoll_complete(struct blk_iopoll *);
43extern void blk_iopoll_enable(struct blk_iopoll *);
44extern void blk_iopoll_disable(struct blk_iopoll *);
45
46extern int blk_iopoll_enabled;
47
48#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 69103e053c92..221cecd86bd3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -82,17 +82,17 @@ enum rq_cmd_type_bits {
82enum { 82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */ 83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */ 84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85 REQ_LB_OP_DISCARD = 0x42, /* discard sectors */
86}; 85};
87 86
88/* 87/*
89 * request type modified bits. first two bits match BIO_RW* bits, important 88 * request type modified bits. first four bits match BIO_RW* bits, important
90 */ 89 */
91enum rq_flag_bits { 90enum rq_flag_bits {
92 __REQ_RW, /* not set, read. set, write */ 91 __REQ_RW, /* not set, read. set, write */
93 __REQ_FAILFAST_DEV, /* no driver retries of device errors */ 92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
94 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ 93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
95 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ 94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */ 96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */ 97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
@@ -114,6 +114,7 @@ enum rq_flag_bits {
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */ 115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */ 116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
117 __REQ_NR_BITS, /* stops here */ 118 __REQ_NR_BITS, /* stops here */
118}; 119};
119 120
@@ -142,6 +143,10 @@ enum rq_flag_bits {
142#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
143#define REQ_NOIDLE (1 << __REQ_NOIDLE) 144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
144#define REQ_IO_STAT (1 << __REQ_IO_STAT) 145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
145 150
146#define BLK_MAX_CDB 16 151#define BLK_MAX_CDB 16
147 152
@@ -255,7 +260,6 @@ typedef void (request_fn_proc) (struct request_queue *q);
255typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 260typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
256typedef int (prep_rq_fn) (struct request_queue *, struct request *); 261typedef int (prep_rq_fn) (struct request_queue *, struct request *);
257typedef void (unplug_fn) (struct request_queue *); 262typedef void (unplug_fn) (struct request_queue *);
258typedef int (prepare_discard_fn) (struct request_queue *, struct request *);
259 263
260struct bio_vec; 264struct bio_vec;
261struct bvec_merge_data { 265struct bvec_merge_data {
@@ -307,6 +311,7 @@ struct queue_limits {
307 unsigned int alignment_offset; 311 unsigned int alignment_offset;
308 unsigned int io_min; 312 unsigned int io_min;
309 unsigned int io_opt; 313 unsigned int io_opt;
314 unsigned int max_discard_sectors;
310 315
311 unsigned short logical_block_size; 316 unsigned short logical_block_size;
312 unsigned short max_hw_segments; 317 unsigned short max_hw_segments;
@@ -334,7 +339,6 @@ struct request_queue
334 make_request_fn *make_request_fn; 339 make_request_fn *make_request_fn;
335 prep_rq_fn *prep_rq_fn; 340 prep_rq_fn *prep_rq_fn;
336 unplug_fn *unplug_fn; 341 unplug_fn *unplug_fn;
337 prepare_discard_fn *prepare_discard_fn;
338 merge_bvec_fn *merge_bvec_fn; 342 merge_bvec_fn *merge_bvec_fn;
339 prepare_flush_fn *prepare_flush_fn; 343 prepare_flush_fn *prepare_flush_fn;
340 softirq_done_fn *softirq_done_fn; 344 softirq_done_fn *softirq_done_fn;
@@ -453,10 +457,13 @@ struct request_queue
453#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 457#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
454#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 458#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
455#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 459#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
460#define QUEUE_FLAG_CQ 16 /* hardware does queuing */
461#define QUEUE_FLAG_DISCARD 17 /* supports DISCARD */
456 462
457#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 463#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
458 (1 << QUEUE_FLAG_CLUSTER) | \ 464 (1 << QUEUE_FLAG_CLUSTER) | \
459 (1 << QUEUE_FLAG_STACKABLE)) 465 (1 << QUEUE_FLAG_STACKABLE) | \
466 (1 << QUEUE_FLAG_SAME_COMP))
460 467
461static inline int queue_is_locked(struct request_queue *q) 468static inline int queue_is_locked(struct request_queue *q)
462{ 469{
@@ -575,6 +582,7 @@ enum {
575 582
576#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 583#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
577#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 584#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
585#define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags)
578#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 586#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
579#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 587#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
580#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 588#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
@@ -582,6 +590,7 @@ enum {
582#define blk_queue_flushing(q) ((q)->ordseq) 590#define blk_queue_flushing(q) ((q)->ordseq)
583#define blk_queue_stackable(q) \ 591#define blk_queue_stackable(q) \
584 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 592 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
593#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
585 594
586#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 595#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
587#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 596#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
@@ -828,11 +837,13 @@ static inline void blk_run_address_space(struct address_space *mapping)
828} 837}
829 838
830/* 839/*
831 * blk_rq_pos() : the current sector 840 * blk_rq_pos() : the current sector
832 * blk_rq_bytes() : bytes left in the entire request 841 * blk_rq_bytes() : bytes left in the entire request
833 * blk_rq_cur_bytes() : bytes left in the current segment 842 * blk_rq_cur_bytes() : bytes left in the current segment
834 * blk_rq_sectors() : sectors left in the entire request 843 * blk_rq_err_bytes() : bytes left till the next error boundary
835 * blk_rq_cur_sectors() : sectors left in the current segment 844 * blk_rq_sectors() : sectors left in the entire request
845 * blk_rq_cur_sectors() : sectors left in the current segment
846 * blk_rq_err_sectors() : sectors left till the next error boundary
836 */ 847 */
837static inline sector_t blk_rq_pos(const struct request *rq) 848static inline sector_t blk_rq_pos(const struct request *rq)
838{ 849{
@@ -849,6 +860,8 @@ static inline int blk_rq_cur_bytes(const struct request *rq)
849 return rq->bio ? bio_cur_bytes(rq->bio) : 0; 860 return rq->bio ? bio_cur_bytes(rq->bio) : 0;
850} 861}
851 862
863extern unsigned int blk_rq_err_bytes(const struct request *rq);
864
852static inline unsigned int blk_rq_sectors(const struct request *rq) 865static inline unsigned int blk_rq_sectors(const struct request *rq)
853{ 866{
854 return blk_rq_bytes(rq) >> 9; 867 return blk_rq_bytes(rq) >> 9;
@@ -859,6 +872,11 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
859 return blk_rq_cur_bytes(rq) >> 9; 872 return blk_rq_cur_bytes(rq) >> 9;
860} 873}
861 874
875static inline unsigned int blk_rq_err_sectors(const struct request *rq)
876{
877 return blk_rq_err_bytes(rq) >> 9;
878}
879
862/* 880/*
863 * Request issue related functions. 881 * Request issue related functions.
864 */ 882 */
@@ -885,10 +903,12 @@ extern bool blk_end_request(struct request *rq, int error,
885 unsigned int nr_bytes); 903 unsigned int nr_bytes);
886extern void blk_end_request_all(struct request *rq, int error); 904extern void blk_end_request_all(struct request *rq, int error);
887extern bool blk_end_request_cur(struct request *rq, int error); 905extern bool blk_end_request_cur(struct request *rq, int error);
906extern bool blk_end_request_err(struct request *rq, int error);
888extern bool __blk_end_request(struct request *rq, int error, 907extern bool __blk_end_request(struct request *rq, int error,
889 unsigned int nr_bytes); 908 unsigned int nr_bytes);
890extern void __blk_end_request_all(struct request *rq, int error); 909extern void __blk_end_request_all(struct request *rq, int error);
891extern bool __blk_end_request_cur(struct request *rq, int error); 910extern bool __blk_end_request_cur(struct request *rq, int error);
911extern bool __blk_end_request_err(struct request *rq, int error);
892 912
893extern void blk_complete_request(struct request *); 913extern void blk_complete_request(struct request *);
894extern void __blk_complete_request(struct request *); 914extern void __blk_complete_request(struct request *);
@@ -909,12 +929,15 @@ extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
909extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short); 929extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short);
910extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short); 930extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
911extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 931extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
932extern void blk_queue_max_discard_sectors(struct request_queue *q,
933 unsigned int max_discard_sectors);
912extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); 934extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
913extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); 935extern void blk_queue_physical_block_size(struct request_queue *, unsigned short);
914extern void blk_queue_alignment_offset(struct request_queue *q, 936extern void blk_queue_alignment_offset(struct request_queue *q,
915 unsigned int alignment); 937 unsigned int alignment);
916extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); 938extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min);
917extern void blk_queue_io_min(struct request_queue *q, unsigned int min); 939extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
940extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt);
918extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 941extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
919extern void blk_set_default_limits(struct queue_limits *lim); 942extern void blk_set_default_limits(struct queue_limits *lim);
920extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 943extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
@@ -934,7 +957,6 @@ extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
934extern void blk_queue_dma_alignment(struct request_queue *, int); 957extern void blk_queue_dma_alignment(struct request_queue *, int);
935extern void blk_queue_update_dma_alignment(struct request_queue *, int); 958extern void blk_queue_update_dma_alignment(struct request_queue *, int);
936extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 959extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
937extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *);
938extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 960extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
939extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 961extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
940extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 962extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
@@ -977,15 +999,18 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
977} 999}
978 1000
979extern int blkdev_issue_flush(struct block_device *, sector_t *); 1001extern int blkdev_issue_flush(struct block_device *, sector_t *);
980extern int blkdev_issue_discard(struct block_device *, 1002#define DISCARD_FL_WAIT 0x01 /* wait for completion */
981 sector_t sector, sector_t nr_sects, gfp_t); 1003#define DISCARD_FL_BARRIER 0x02 /* issue DISCARD_BARRIER request */
1004extern int blkdev_issue_discard(struct block_device *, sector_t sector,
1005 sector_t nr_sects, gfp_t, int flags);
982 1006
983static inline int sb_issue_discard(struct super_block *sb, 1007static inline int sb_issue_discard(struct super_block *sb,
984 sector_t block, sector_t nr_blocks) 1008 sector_t block, sector_t nr_blocks)
985{ 1009{
986 block <<= (sb->s_blocksize_bits - 9); 1010 block <<= (sb->s_blocksize_bits - 9);
987 nr_blocks <<= (sb->s_blocksize_bits - 9); 1011 nr_blocks <<= (sb->s_blocksize_bits - 9);
988 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL); 1012 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL,
1013 DISCARD_FL_BARRIER);
989} 1014}
990 1015
991extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1016extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
@@ -1056,25 +1081,37 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q)
1056 return q->limits.physical_block_size; 1081 return q->limits.physical_block_size;
1057} 1082}
1058 1083
1084static inline int bdev_physical_block_size(struct block_device *bdev)
1085{
1086 return queue_physical_block_size(bdev_get_queue(bdev));
1087}
1088
1059static inline unsigned int queue_io_min(struct request_queue *q) 1089static inline unsigned int queue_io_min(struct request_queue *q)
1060{ 1090{
1061 return q->limits.io_min; 1091 return q->limits.io_min;
1062} 1092}
1063 1093
1094static inline int bdev_io_min(struct block_device *bdev)
1095{
1096 return queue_io_min(bdev_get_queue(bdev));
1097}
1098
1064static inline unsigned int queue_io_opt(struct request_queue *q) 1099static inline unsigned int queue_io_opt(struct request_queue *q)
1065{ 1100{
1066 return q->limits.io_opt; 1101 return q->limits.io_opt;
1067} 1102}
1068 1103
1104static inline int bdev_io_opt(struct block_device *bdev)
1105{
1106 return queue_io_opt(bdev_get_queue(bdev));
1107}
1108
1069static inline int queue_alignment_offset(struct request_queue *q) 1109static inline int queue_alignment_offset(struct request_queue *q)
1070{ 1110{
1071 if (q && q->limits.misaligned) 1111 if (q->limits.misaligned)
1072 return -1; 1112 return -1;
1073 1113
1074 if (q && q->limits.alignment_offset) 1114 return q->limits.alignment_offset;
1075 return q->limits.alignment_offset;
1076
1077 return 0;
1078} 1115}
1079 1116
1080static inline int queue_sector_alignment_offset(struct request_queue *q, 1117static inline int queue_sector_alignment_offset(struct request_queue *q,
@@ -1084,6 +1121,19 @@ static inline int queue_sector_alignment_offset(struct request_queue *q,
1084 & (q->limits.io_min - 1); 1121 & (q->limits.io_min - 1);
1085} 1122}
1086 1123
1124static inline int bdev_alignment_offset(struct block_device *bdev)
1125{
1126 struct request_queue *q = bdev_get_queue(bdev);
1127
1128 if (q->limits.misaligned)
1129 return -1;
1130
1131 if (bdev != bdev->bd_contains)
1132 return bdev->bd_part->alignment_offset;
1133
1134 return q->limits.alignment_offset;
1135}
1136
1087static inline int queue_dma_alignment(struct request_queue *q) 1137static inline int queue_dma_alignment(struct request_queue *q)
1088{ 1138{
1089 return q ? q->dma_alignment : 511; 1139 return q ? q->dma_alignment : 511;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e4350ece0f8..3b73b9992b26 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -198,6 +198,7 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
198 char __user *arg); 198 char __user *arg);
199extern int blk_trace_startstop(struct request_queue *q, int start); 199extern int blk_trace_startstop(struct request_queue *q, int start);
200extern int blk_trace_remove(struct request_queue *q); 200extern int blk_trace_remove(struct request_queue *q);
201extern void blk_trace_remove_sysfs(struct device *dev);
201extern int blk_trace_init_sysfs(struct device *dev); 202extern int blk_trace_init_sysfs(struct device *dev);
202 203
203extern struct attribute_group blk_trace_attr_group; 204extern struct attribute_group blk_trace_attr_group;
@@ -211,6 +212,7 @@ extern struct attribute_group blk_trace_attr_group;
211# define blk_trace_startstop(q, start) (-ENOTTY) 212# define blk_trace_startstop(q, start) (-ENOTTY)
212# define blk_trace_remove(q) (-ENOTTY) 213# define blk_trace_remove(q) (-ENOTTY)
213# define blk_add_trace_msg(q, fmt, ...) do { } while (0) 214# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
215# define blk_trace_remove_sysfs(dev) do { } while (0)
214static inline int blk_trace_init_sysfs(struct device *dev) 216static inline int blk_trace_init_sysfs(struct device *dev)
215{ 217{
216 return 0; 218 return 0;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index bc3ab7073695..dd97fb8408a8 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -132,9 +132,6 @@ static inline void *alloc_remap(int nid, unsigned long size)
132} 132}
133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 133#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
134 134
135extern unsigned long __meminitdata nr_kernel_pages;
136extern unsigned long __meminitdata nr_all_pages;
137
138extern void *alloc_large_system_hash(const char *tablename, 135extern void *alloc_large_system_hash(const char *tablename,
139 unsigned long bucketsize, 136 unsigned long bucketsize,
140 unsigned long numentries, 137 unsigned long numentries,
@@ -145,6 +142,8 @@ extern void *alloc_large_system_hash(const char *tablename,
145 unsigned long limit); 142 unsigned long limit);
146 143
147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 144#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
145#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
146 * shift passed via *_hash_shift */
148 147
149/* Only NUMA needs hash distribution. 64bit NUMA architectures have 148/* Only NUMA needs hash distribution. 64bit NUMA architectures have
150 * sufficient vmalloc space. 149 * sufficient vmalloc space.
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 4a37a56f6cdd..5824b20b5fcb 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -66,5 +66,6 @@ void can_bus_off(struct net_device *dev);
66 66
67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); 67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
68void can_get_echo_skb(struct net_device *dev, int idx); 68void can_get_echo_skb(struct net_device *dev, int idx);
69void can_free_echo_skb(struct net_device *dev, int idx);
69 70
70#endif /* CAN_DEV_H */ 71#endif /* CAN_DEV_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index c3021105edc0..c8f2a5f70ed5 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * See here for the libcap library ("POSIX draft" compliance): 8 * See here for the libcap library ("POSIX draft" compliance):
9 * 9 *
10 * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ 10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */ 11 */
12 12
13#ifndef _LINUX_CAPABILITY_H 13#ifndef _LINUX_CAPABILITY_H
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 90bba9e62286..0008dee66514 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -37,7 +37,7 @@ extern void cgroup_exit(struct task_struct *p, int run_callbacks);
37extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
38 struct dentry *dentry); 38 struct dentry *dentry);
39 39
40extern struct file_operations proc_cgroup_operations; 40extern const struct file_operations proc_cgroup_operations;
41 41
42/* Define the enumeration of all cgroup subsystems */ 42/* Define the enumeration of all cgroup subsystems */
43#define SUBSYS(_x) _x ## _subsys_id, 43#define SUBSYS(_x) _x ## _subsys_id,
@@ -141,6 +141,38 @@ enum {
141 CGRP_WAIT_ON_RMDIR, 141 CGRP_WAIT_ON_RMDIR,
142}; 142};
143 143
144/* which pidlist file are we talking about? */
145enum cgroup_filetype {
146 CGROUP_FILE_PROCS,
147 CGROUP_FILE_TASKS,
148};
149
150/*
151 * A pidlist is a list of pids that virtually represents the contents of one
152 * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
153 * a pair (one each for procs, tasks) for each pid namespace that's relevant
154 * to the cgroup.
155 */
156struct cgroup_pidlist {
157 /*
158 * used to find which pidlist is wanted. doesn't change as long as
159 * this particular list stays in the list.
160 */
161 struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
162 /* array of xids */
163 pid_t *list;
164 /* how many elements the above list has */
165 int length;
166 /* how many files are using the current array */
167 int use_count;
168 /* each of these stored in a list by its cgroup */
169 struct list_head links;
170 /* pointer to the cgroup we belong to, for list removal purposes */
171 struct cgroup *owner;
172 /* protects the other fields */
173 struct rw_semaphore mutex;
174};
175
144struct cgroup { 176struct cgroup {
145 unsigned long flags; /* "unsigned long" so bitops work */ 177 unsigned long flags; /* "unsigned long" so bitops work */
146 178
@@ -179,11 +211,12 @@ struct cgroup {
179 */ 211 */
180 struct list_head release_list; 212 struct list_head release_list;
181 213
182 /* pids_mutex protects pids_list and cached pid arrays. */ 214 /*
183 struct rw_semaphore pids_mutex; 215 * list of pidlists, up to two for each namespace (one for procs, one
184 216 * for tasks); created on demand.
185 /* Linked list of struct cgroup_pids */ 217 */
186 struct list_head pids_list; 218 struct list_head pidlists;
219 struct mutex pidlist_mutex;
187 220
188 /* For RCU-protected deletion */ 221 /* For RCU-protected deletion */
189 struct rcu_head rcu_head; 222 struct rcu_head rcu_head;
@@ -227,6 +260,9 @@ struct css_set {
227 * during subsystem registration (at boot time). 260 * during subsystem registration (at boot time).
228 */ 261 */
229 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 262 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
263
264 /* For RCU-protected deletion */
265 struct rcu_head rcu_head;
230}; 266};
231 267
232/* 268/*
@@ -389,10 +425,11 @@ struct cgroup_subsys {
389 struct cgroup *cgrp); 425 struct cgroup *cgrp);
390 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 426 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
391 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 427 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
392 int (*can_attach)(struct cgroup_subsys *ss, 428 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
393 struct cgroup *cgrp, struct task_struct *tsk); 429 struct task_struct *tsk, bool threadgroup);
394 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 430 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
395 struct cgroup *old_cgrp, struct task_struct *tsk); 431 struct cgroup *old_cgrp, struct task_struct *tsk,
432 bool threadgroup);
396 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 433 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
397 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 434 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
398 int (*populate)(struct cgroup_subsys *ss, 435 int (*populate)(struct cgroup_subsys *ss,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 1219be4fb42e..83d2fbd81b93 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -14,6 +14,7 @@
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/cache.h> 15#include <linux/cache.h>
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/init.h>
17#include <asm/div64.h> 18#include <asm/div64.h>
18#include <asm/io.h> 19#include <asm/io.h>
19 20
@@ -148,14 +149,11 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
148 * @disable: optional function to disable the clocksource 149 * @disable: optional function to disable the clocksource
149 * @mask: bitmask for two's complement 150 * @mask: bitmask for two's complement
150 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
151 * @mult: cycle to nanosecond multiplier (adjusted by NTP) 152 * @mult: cycle to nanosecond multiplier
152 * @mult_orig: cycle to nanosecond multiplier (unadjusted by NTP)
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @flags: flags describing special properties 154 * @flags: flags describing special properties
155 * @vread: vsyscall based read 155 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 156 * @resume: resume function for the clocksource, if necessary
157 * @cycle_interval: Used internally by timekeeping core, please ignore.
158 * @xtime_interval: Used internally by timekeeping core, please ignore.
159 */ 157 */
160struct clocksource { 158struct clocksource {
161 /* 159 /*
@@ -169,7 +167,6 @@ struct clocksource {
169 void (*disable)(struct clocksource *cs); 167 void (*disable)(struct clocksource *cs);
170 cycle_t mask; 168 cycle_t mask;
171 u32 mult; 169 u32 mult;
172 u32 mult_orig;
173 u32 shift; 170 u32 shift;
174 unsigned long flags; 171 unsigned long flags;
175 cycle_t (*vread)(void); 172 cycle_t (*vread)(void);
@@ -181,19 +178,12 @@ struct clocksource {
181#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) 178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
182#endif 179#endif
183 180
184 /* timekeeping specific data, ignore */
185 cycle_t cycle_interval;
186 u64 xtime_interval;
187 u32 raw_interval;
188 /* 181 /*
189 * Second part is written at each timer interrupt 182 * Second part is written at each timer interrupt
190 * Keep it in a different cache line to dirty no 183 * Keep it in a different cache line to dirty no
191 * more than one cache line. 184 * more than one cache line.
192 */ 185 */
193 cycle_t cycle_last ____cacheline_aligned_in_smp; 186 cycle_t cycle_last ____cacheline_aligned_in_smp;
194 u64 xtime_nsec;
195 s64 error;
196 struct timespec raw_time;
197 187
198#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 188#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
199 /* Watchdog related data, used by the framework */ 189 /* Watchdog related data, used by the framework */
@@ -202,8 +192,6 @@ struct clocksource {
202#endif 192#endif
203}; 193};
204 194
205extern struct clocksource *clock; /* current clocksource */
206
207/* 195/*
208 * Clock source flags bits:: 196 * Clock source flags bits::
209 */ 197 */
@@ -212,6 +200,7 @@ extern struct clocksource *clock; /* current clocksource */
212 200
213#define CLOCK_SOURCE_WATCHDOG 0x10 201#define CLOCK_SOURCE_WATCHDOG 0x10
214#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 202#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
203#define CLOCK_SOURCE_UNSTABLE 0x40
215 204
216/* simplify initialization of mask field */ 205/* simplify initialization of mask field */
217#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 206#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -268,108 +257,15 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
268} 257}
269 258
270/** 259/**
271 * clocksource_read: - Access the clocksource's current cycle value 260 * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
272 * @cs: pointer to clocksource being read
273 *
274 * Uses the clocksource to return the current cycle_t value
275 */
276static inline cycle_t clocksource_read(struct clocksource *cs)
277{
278 return cs->read(cs);
279}
280
281/**
282 * clocksource_enable: - enable clocksource
283 * @cs: pointer to clocksource
284 *
285 * Enables the specified clocksource. The clocksource callback
286 * function should start up the hardware and setup mult and field
287 * members of struct clocksource to reflect hardware capabilities.
288 */
289static inline int clocksource_enable(struct clocksource *cs)
290{
291 int ret = 0;
292
293 if (cs->enable)
294 ret = cs->enable(cs);
295
296 /*
297 * The frequency may have changed while the clocksource
298 * was disabled. If so the code in ->enable() must update
299 * the mult value to reflect the new frequency. Make sure
300 * mult_orig follows this change.
301 */
302 cs->mult_orig = cs->mult;
303
304 return ret;
305}
306
307/**
308 * clocksource_disable: - disable clocksource
309 * @cs: pointer to clocksource
310 *
311 * Disables the specified clocksource. The clocksource callback
312 * function should power down the now unused hardware block to
313 * save power.
314 */
315static inline void clocksource_disable(struct clocksource *cs)
316{
317 /*
318 * Save mult_orig in mult so clocksource_enable() can
319 * restore the value regardless if ->enable() updates
320 * the value of mult or not.
321 */
322 cs->mult = cs->mult_orig;
323
324 if (cs->disable)
325 cs->disable(cs);
326}
327
328/**
329 * cyc2ns - converts clocksource cycles to nanoseconds
330 * @cs: Pointer to clocksource
331 * @cycles: Cycles
332 * 261 *
333 * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds. 262 * Converts cycles to nanoseconds, using the given mult and shift.
334 * 263 *
335 * XXX - This could use some mult_lxl_ll() asm optimization 264 * XXX - This could use some mult_lxl_ll() asm optimization
336 */ 265 */
337static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles) 266static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
338{
339 u64 ret = (u64)cycles;
340 ret = (ret * cs->mult) >> cs->shift;
341 return ret;
342}
343
344/**
345 * clocksource_calculate_interval - Calculates a clocksource interval struct
346 *
347 * @c: Pointer to clocksource.
348 * @length_nsec: Desired interval length in nanoseconds.
349 *
350 * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
351 * pair and interval request.
352 *
353 * Unless you're the timekeeping code, you should not be using this!
354 */
355static inline void clocksource_calculate_interval(struct clocksource *c,
356 unsigned long length_nsec)
357{ 267{
358 u64 tmp; 268 return ((u64) cycles * mult) >> shift;
359
360 /* Do the ns -> cycle conversion first, using original mult */
361 tmp = length_nsec;
362 tmp <<= c->shift;
363 tmp += c->mult_orig/2;
364 do_div(tmp, c->mult_orig);
365
366 c->cycle_interval = (cycle_t)tmp;
367 if (c->cycle_interval == 0)
368 c->cycle_interval = 1;
369
370 /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
371 c->xtime_interval = (u64)c->cycle_interval * c->mult;
372 c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift;
373} 269}
374 270
375 271
@@ -380,6 +276,8 @@ extern void clocksource_touch_watchdog(void);
380extern struct clocksource* clocksource_get_next(void); 276extern struct clocksource* clocksource_get_next(void);
381extern void clocksource_change_rating(struct clocksource *cs, int rating); 277extern void clocksource_change_rating(struct clocksource *cs, int rating);
382extern void clocksource_resume(void); 278extern void clocksource_resume(void);
279extern struct clocksource * __init __weak clocksource_default_clock(void);
280extern void clocksource_mark_unstable(struct clocksource *cs);
383 281
384#ifdef CONFIG_GENERIC_TIME_VSYSCALL 282#ifdef CONFIG_GENERIC_TIME_VSYSCALL
385extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 283extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
@@ -394,4 +292,6 @@ static inline void update_vsyscall_tz(void)
394} 292}
395#endif 293#endif
396 294
295extern void timekeeping_notify(struct clocksource *clock);
296
397#endif /* _LINUX_CLOCKSOURCE_H */ 297#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index b8125b2eb665..47dac5ea8d3a 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -52,6 +52,7 @@ struct proc_event {
52 PROC_EVENT_EXEC = 0x00000002, 52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004, 53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040, 54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
55 /* "next" should be 0x00000400 */ 56 /* "next" should be 0x00000400 */
56 /* "last" is the last process event: exit */ 57 /* "last" is the last process event: exit */
57 PROC_EVENT_EXIT = 0x80000000 58 PROC_EVENT_EXIT = 0x80000000
@@ -89,6 +90,11 @@ struct proc_event {
89 } e; 90 } e;
90 } id; 91 } id;
91 92
93 struct sid_proc_event {
94 __kernel_pid_t process_pid;
95 __kernel_pid_t process_tgid;
96 } sid;
97
92 struct exit_proc_event { 98 struct exit_proc_event {
93 __kernel_pid_t process_pid; 99 __kernel_pid_t process_pid;
94 __kernel_pid_t process_tgid; 100 __kernel_pid_t process_tgid;
@@ -102,6 +108,7 @@ struct proc_event {
102void proc_fork_connector(struct task_struct *task); 108void proc_fork_connector(struct task_struct *task);
103void proc_exec_connector(struct task_struct *task); 109void proc_exec_connector(struct task_struct *task);
104void proc_id_connector(struct task_struct *task, int which_id); 110void proc_id_connector(struct task_struct *task, int which_id);
111void proc_sid_connector(struct task_struct *task);
105void proc_exit_connector(struct task_struct *task); 112void proc_exit_connector(struct task_struct *task);
106#else 113#else
107static inline void proc_fork_connector(struct task_struct *task) 114static inline void proc_fork_connector(struct task_struct *task)
@@ -114,6 +121,9 @@ static inline void proc_id_connector(struct task_struct *task,
114 int which_id) 121 int which_id)
115{} 122{}
116 123
124static inline void proc_sid_connector(struct task_struct *task)
125{}
126
117static inline void proc_exit_connector(struct task_struct *task) 127static inline void proc_exit_connector(struct task_struct *task)
118{} 128{}
119#endif /* CONFIG_PROC_EVENTS */ 129#endif /* CONFIG_PROC_EVENTS */
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 7f627775c947..ddb7a97c78c2 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -27,8 +27,8 @@
27 * 27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved. 28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 * 29 *
30 * Please read Documentation/filesystems/configfs.txt before using the 30 * Please read Documentation/filesystems/configfs/configfs.txt before using
31 * configfs interface, ESPECIALLY the parts about reference counts and 31 * the configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors. 32 * item destructors.
33 */ 33 */
34 34
diff --git a/include/linux/connector.h b/include/linux/connector.h
index b68d27850d51..3a14615fd35c 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -132,11 +132,8 @@ struct cn_callback_id {
132}; 132};
133 133
134struct cn_callback_data { 134struct cn_callback_data {
135 void (*destruct_data) (void *); 135 struct sk_buff *skb;
136 void *ddata; 136 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
137
138 void *callback_priv;
139 void (*callback) (void *);
140 137
141 void *free; 138 void *free;
142}; 139};
@@ -167,11 +164,11 @@ struct cn_dev {
167 struct cn_queue_dev *cbdev; 164 struct cn_queue_dev *cbdev;
168}; 165};
169 166
170int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); 167int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
171void cn_del_callback(struct cb_id *); 168void cn_del_callback(struct cb_id *);
172int cn_netlink_send(struct cn_msg *, u32, gfp_t); 169int cn_netlink_send(struct cn_msg *, u32, gfp_t);
173 170
174int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 171int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
175void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 172void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
176 173
177int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); 174int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e05d458..47536197ffdd 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -48,6 +48,15 @@ struct notifier_block;
48 48
49#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
50/* Need to know about CPUs going up/down? */ 50/* Need to know about CPUs going up/down? */
51#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
52#define cpu_notifier(fn, pri) { \
53 static struct notifier_block fn##_nb __cpuinitdata = \
54 { .notifier_call = fn, .priority = pri }; \
55 register_cpu_notifier(&fn##_nb); \
56}
57#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
58#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
59#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
51#ifdef CONFIG_HOTPLUG_CPU 60#ifdef CONFIG_HOTPLUG_CPU
52extern int register_cpu_notifier(struct notifier_block *nb); 61extern int register_cpu_notifier(struct notifier_block *nb);
53extern void unregister_cpu_notifier(struct notifier_block *nb); 62extern void unregister_cpu_notifier(struct notifier_block *nb);
@@ -74,6 +83,8 @@ extern void cpu_maps_update_done(void);
74 83
75#else /* CONFIG_SMP */ 84#else /* CONFIG_SMP */
76 85
86#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
87
77static inline int register_cpu_notifier(struct notifier_block *nb) 88static inline int register_cpu_notifier(struct notifier_block *nb)
78{ 89{
79 return 0; 90 return 0;
@@ -99,11 +110,7 @@ extern struct sysdev_class cpu_sysdev_class;
99 110
100extern void get_online_cpus(void); 111extern void get_online_cpus(void);
101extern void put_online_cpus(void); 112extern void put_online_cpus(void);
102#define hotcpu_notifier(fn, pri) { \ 113#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
103 static struct notifier_block fn##_nb __cpuinitdata = \
104 { .notifier_call = fn, .priority = pri }; \
105 register_cpu_notifier(&fn##_nb); \
106}
107#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 114#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
108#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 115#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
109int cpu_down(unsigned int cpu); 116int cpu_down(unsigned int cpu);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 161042746afc..79a2340d83cd 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -65,6 +65,9 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
65 65
66struct cpufreq_governor; 66struct cpufreq_governor;
67 67
68/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
69extern struct kobject *cpufreq_global_kobject;
70
68#define CPUFREQ_ETERNAL (-1) 71#define CPUFREQ_ETERNAL (-1)
69struct cpufreq_cpuinfo { 72struct cpufreq_cpuinfo {
70 unsigned int max_freq; 73 unsigned int max_freq;
@@ -274,6 +277,13 @@ struct freq_attr {
274 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 277 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
275}; 278};
276 279
280struct global_attr {
281 struct attribute attr;
282 ssize_t (*show)(struct kobject *kobj,
283 struct attribute *attr, char *buf);
284 ssize_t (*store)(struct kobject *a, struct attribute *b,
285 const char *c, size_t count);
286};
277 287
278/********************************************************************* 288/*********************************************************************
279 * CPUFREQ 2.6. INTERFACE * 289 * CPUFREQ 2.6. INTERFACE *
@@ -281,8 +291,15 @@ struct freq_attr {
281int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 291int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
282int cpufreq_update_policy(unsigned int cpu); 292int cpufreq_update_policy(unsigned int cpu);
283 293
294#ifdef CONFIG_CPU_FREQ
284/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 295/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
285unsigned int cpufreq_get(unsigned int cpu); 296unsigned int cpufreq_get(unsigned int cpu);
297#else
298static inline unsigned int cpufreq_get(unsigned int cpu)
299{
300 return 0;
301}
302#endif
286 303
287/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 304/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
288#ifdef CONFIG_CPU_FREQ 305#ifdef CONFIG_CPU_FREQ
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 796df12091b7..789cf5f920ce 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -3,444 +3,37 @@
3 3
4/* 4/*
5 * Cpumasks provide a bitmap suitable for representing the 5 * Cpumasks provide a bitmap suitable for representing the
6 * set of CPU's in a system, one bit position per CPU number. 6 * set of CPU's in a system, one bit position per CPU number. In general,
7 * 7 * only nr_cpu_ids (<= NR_CPUS) bits are valid.
8 * The new cpumask_ ops take a "struct cpumask *"; the old ones
9 * use cpumask_t.
10 *
11 * See detailed comments in the file linux/bitmap.h describing the
12 * data type on which these cpumasks are based.
13 *
14 * For details of cpumask_scnprintf() and cpumask_parse_user(),
15 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
16 * For details of cpulist_scnprintf() and cpulist_parse(), see
17 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
18 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
19 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
20 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
21 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
22 *
23 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24 * Note: The alternate operations with the suffix "_nr" are used
25 * to limit the range of the loop to nr_cpu_ids instead of
26 * NR_CPUS when NR_CPUS > 64 for performance reasons.
27 * If NR_CPUS is <= 64 then most assembler bitmask
28 * operators execute faster with a constant range, so
29 * the operator will continue to use NR_CPUS.
30 *
31 * Another consideration is that nr_cpu_ids is initialized
32 * to NR_CPUS and isn't lowered until the possible cpus are
33 * discovered (including any disabled cpus). So early uses
34 * will span the entire range of NR_CPUS.
35 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36 *
37 * The obsolescent cpumask operations are:
38 *
39 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
40 * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask
41 * void cpus_setall(mask) set all bits
42 * void cpus_clear(mask) clear all bits
43 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
44 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
45 *
46 * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
47 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
48 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
49 * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2
50 * void cpus_complement(dst, src) dst = ~src
51 *
52 * int cpus_equal(mask1, mask2) Does mask1 == mask2?
53 * int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
54 * int cpus_subset(mask1, mask2) Is mask1 a subset of mask2?
55 * int cpus_empty(mask) Is mask empty (no bits sets)?
56 * int cpus_full(mask) Is mask full (all bits sets)?
57 * int cpus_weight(mask) Hamming weigh - number of set bits
58 * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS
59 *
60 * void cpus_shift_right(dst, src, n) Shift right
61 * void cpus_shift_left(dst, src, n) Shift left
62 *
63 * int first_cpu(mask) Number lowest set bit, or NR_CPUS
64 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
65 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
66 *
67 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
68 * (can be used as an lvalue)
69 * CPU_MASK_ALL Initializer - all bits set
70 * CPU_MASK_NONE Initializer - no bits set
71 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
72 *
73 * CPUMASK_ALLOC kmalloc's a structure that is a composite of many cpumask_t
74 * variables, and CPUMASK_PTR provides pointers to each field.
75 *
76 * The structure should be defined something like this:
77 * struct my_cpumasks {
78 * cpumask_t mask1;
79 * cpumask_t mask2;
80 * };
81 *
82 * Usage is then:
83 * CPUMASK_ALLOC(my_cpumasks);
84 * CPUMASK_PTR(mask1, my_cpumasks);
85 * CPUMASK_PTR(mask2, my_cpumasks);
86 *
87 * --- DO NOT reference cpumask_t pointers until this check ---
88 * if (my_cpumasks == NULL)
89 * "kmalloc failed"...
90 *
91 * References are now pointers to the cpumask_t variables (*mask1, ...)
92 *
93 *if NR_CPUS > BITS_PER_LONG
94 * CPUMASK_ALLOC(m) Declares and allocates struct m *m =
95 * kmalloc(sizeof(*m), GFP_KERNEL)
96 * CPUMASK_FREE(m) Macro for kfree(m)
97 *else
98 * CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m
99 * CPUMASK_FREE(m) Nop
100 *endif
101 * CPUMASK_PTR(v, m) Declares cpumask_t *v = &(m->v)
102 * ------------------------------------------------------------------------
103 *
104 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
105 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
106 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
107 * int cpulist_parse(buf, map) Parse ascii string as cpulist
108 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
109 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
110 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
111 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
112 *
113 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS
114 * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids
115 *
116 * int num_online_cpus() Number of online CPUs
117 * int num_possible_cpus() Number of all possible CPUs
118 * int num_present_cpus() Number of present CPUs
119 *
120 * int cpu_online(cpu) Is some cpu online?
121 * int cpu_possible(cpu) Is some cpu possible?
122 * int cpu_present(cpu) Is some cpu present (can schedule)?
123 *
124 * int any_online_cpu(mask) First online cpu in mask
125 *
126 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
127 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
128 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
129 *
130 * Subtlety:
131 * 1) The 'type-checked' form of cpu_isset() causes gcc (3.3.2, anyway)
132 * to generate slightly worse code. Note for example the additional
133 * 40 lines of assembly code compiling the "for each possible cpu"
134 * loops buried in the disk_stat_read() macros calls when compiling
135 * drivers/block/genhd.c (arch i386, CONFIG_SMP=y). So use a simple
136 * one-line #define for cpu_isset(), instead of wrapping an inline
137 * inside a macro, the way we do the other calls.
138 */ 8 */
139
140#include <linux/kernel.h> 9#include <linux/kernel.h>
141#include <linux/threads.h> 10#include <linux/threads.h>
142#include <linux/bitmap.h> 11#include <linux/bitmap.h>
143 12
144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 13typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
145extern cpumask_t _unused_cpumask_arg_;
146
147#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
148#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
149static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
150{
151 set_bit(cpu, dstp->bits);
152}
153
154#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
155static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
156{
157 clear_bit(cpu, dstp->bits);
158}
159
160#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
161static inline void __cpus_setall(cpumask_t *dstp, int nbits)
162{
163 bitmap_fill(dstp->bits, nbits);
164}
165
166#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
167static inline void __cpus_clear(cpumask_t *dstp, int nbits)
168{
169 bitmap_zero(dstp->bits, nbits);
170}
171
172/* No static inline type checking - see Subtlety (1) above. */
173#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
174
175#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
176static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
177{
178 return test_and_set_bit(cpu, addr->bits);
179}
180
181#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
182static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
183 const cpumask_t *src2p, int nbits)
184{
185 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
186}
187
188#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
189static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
190 const cpumask_t *src2p, int nbits)
191{
192 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
193}
194
195#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
196static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
197 const cpumask_t *src2p, int nbits)
198{
199 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
200}
201
202#define cpus_andnot(dst, src1, src2) \
203 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
204static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
205 const cpumask_t *src2p, int nbits)
206{
207 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
208}
209
210#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
211static inline void __cpus_complement(cpumask_t *dstp,
212 const cpumask_t *srcp, int nbits)
213{
214 bitmap_complement(dstp->bits, srcp->bits, nbits);
215}
216
217#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
218static inline int __cpus_equal(const cpumask_t *src1p,
219 const cpumask_t *src2p, int nbits)
220{
221 return bitmap_equal(src1p->bits, src2p->bits, nbits);
222}
223
224#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
225static inline int __cpus_intersects(const cpumask_t *src1p,
226 const cpumask_t *src2p, int nbits)
227{
228 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
229}
230
231#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
232static inline int __cpus_subset(const cpumask_t *src1p,
233 const cpumask_t *src2p, int nbits)
234{
235 return bitmap_subset(src1p->bits, src2p->bits, nbits);
236}
237
238#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
239static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
240{
241 return bitmap_empty(srcp->bits, nbits);
242}
243
244#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
245static inline int __cpus_full(const cpumask_t *srcp, int nbits)
246{
247 return bitmap_full(srcp->bits, nbits);
248}
249
250#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
251static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
252{
253 return bitmap_weight(srcp->bits, nbits);
254}
255
256#define cpus_shift_right(dst, src, n) \
257 __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
258static inline void __cpus_shift_right(cpumask_t *dstp,
259 const cpumask_t *srcp, int n, int nbits)
260{
261 bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
262}
263
264#define cpus_shift_left(dst, src, n) \
265 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
266static inline void __cpus_shift_left(cpumask_t *dstp,
267 const cpumask_t *srcp, int n, int nbits)
268{
269 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
270}
271#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
272 14
273/** 15/**
274 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * 16 * cpumask_bits - get the bits in a cpumask
275 * @bitmap: the bitmap 17 * @maskp: the struct cpumask *
276 *
277 * There are a few places where cpumask_var_t isn't appropriate and
278 * static cpumasks must be used (eg. very early boot), yet we don't
279 * expose the definition of 'struct cpumask'.
280 * 18 *
281 * This does the conversion, and can be used as a constant initializer. 19 * You should only assume nr_cpu_ids bits of this mask are valid. This is
20 * a macro so it's const-correct.
282 */ 21 */
283#define to_cpumask(bitmap) \ 22#define cpumask_bits(maskp) ((maskp)->bits)
284 ((struct cpumask *)(1 ? (bitmap) \
285 : (void *)sizeof(__check_is_bitmap(bitmap))))
286
287static inline int __check_is_bitmap(const unsigned long *bitmap)
288{
289 return 1;
290}
291
292/*
293 * Special-case data structure for "single bit set only" constant CPU masks.
294 *
295 * We pre-generate all the 64 (or 32) possible bit positions, with enough
296 * padding to the left and the right, and return the constant pointer
297 * appropriately offset.
298 */
299extern const unsigned long
300 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
301
302static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
303{
304 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
305 p -= cpu / BITS_PER_LONG;
306 return to_cpumask(p);
307}
308
309#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
310/*
311 * In cases where we take the address of the cpumask immediately,
312 * gcc optimizes it out (it's a constant) and there's no huge stack
313 * variable created:
314 */
315#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
316
317
318#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
319
320#if NR_CPUS <= BITS_PER_LONG
321
322#define CPU_MASK_ALL \
323(cpumask_t) { { \
324 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
325} }
326
327#define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)
328
329#else
330
331#define CPU_MASK_ALL \
332(cpumask_t) { { \
333 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
334 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
335} }
336
337/* cpu_mask_all is in init/main.c */
338extern cpumask_t cpu_mask_all;
339#define CPU_MASK_ALL_PTR (&cpu_mask_all)
340
341#endif
342
343#define CPU_MASK_NONE \
344(cpumask_t) { { \
345 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
346} }
347
348#define CPU_MASK_CPU0 \
349(cpumask_t) { { \
350 [0] = 1UL \
351} }
352
353#define cpus_addr(src) ((src).bits)
354
355#if NR_CPUS > BITS_PER_LONG
356#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
357#define CPUMASK_FREE(m) kfree(m)
358#else
359#define CPUMASK_ALLOC(m) struct m _m, *m = &_m
360#define CPUMASK_FREE(m)
361#endif
362#define CPUMASK_PTR(v, m) cpumask_t *v = &(m->v)
363
364#define cpu_remap(oldbit, old, new) \
365 __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
366static inline int __cpu_remap(int oldbit,
367 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
368{
369 return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits);
370}
371
372#define cpus_remap(dst, src, old, new) \
373 __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS)
374static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
375 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
376{
377 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
378}
379
380#define cpus_onto(dst, orig, relmap) \
381 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
382static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
383 const cpumask_t *relmapp, int nbits)
384{
385 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
386}
387
388#define cpus_fold(dst, orig, sz) \
389 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
390static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
391 int sz, int nbits)
392{
393 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
394}
395#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
396 23
397#if NR_CPUS == 1 24#if NR_CPUS == 1
398
399#define nr_cpu_ids 1 25#define nr_cpu_ids 1
400#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 26#else
401#define first_cpu(src) ({ (void)(src); 0; })
402#define next_cpu(n, src) ({ (void)(src); 1; })
403#define any_online_cpu(mask) 0
404#define for_each_cpu_mask(cpu, mask) \
405 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
406#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
407#else /* NR_CPUS > 1 */
408
409extern int nr_cpu_ids; 27extern int nr_cpu_ids;
410#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
411int __first_cpu(const cpumask_t *srcp);
412int __next_cpu(int n, const cpumask_t *srcp);
413int __any_online_cpu(const cpumask_t *mask);
414
415#define first_cpu(src) __first_cpu(&(src))
416#define next_cpu(n, src) __next_cpu((n), &(src))
417#define any_online_cpu(mask) __any_online_cpu(&(mask))
418#define for_each_cpu_mask(cpu, mask) \
419 for ((cpu) = -1; \
420 (cpu) = next_cpu((cpu), (mask)), \
421 (cpu) < NR_CPUS; )
422#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
423#endif 28#endif
424 29
425#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS 30#ifdef CONFIG_CPUMASK_OFFSTACK
426#if NR_CPUS <= 64 31/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
427 32 * not all bits may be allocated. */
428#define next_cpu_nr(n, src) next_cpu(n, src) 33#define nr_cpumask_bits nr_cpu_ids
429#define cpus_weight_nr(cpumask) cpus_weight(cpumask) 34#else
430#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask) 35#define nr_cpumask_bits NR_CPUS
431 36#endif
432#else /* NR_CPUS > 64 */
433
434int __next_cpu_nr(int n, const cpumask_t *srcp);
435#define next_cpu_nr(n, src) __next_cpu_nr((n), &(src))
436#define cpus_weight_nr(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
437#define for_each_cpu_mask_nr(cpu, mask) \
438 for ((cpu) = -1; \
439 (cpu) = next_cpu_nr((cpu), (mask)), \
440 (cpu) < nr_cpu_ids; )
441
442#endif /* NR_CPUS > 64 */
443#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
444 37
445/* 38/*
446 * The following particular system cpumasks and operations manage 39 * The following particular system cpumasks and operations manage
@@ -487,12 +80,6 @@ extern const struct cpumask *const cpu_online_mask;
487extern const struct cpumask *const cpu_present_mask; 80extern const struct cpumask *const cpu_present_mask;
488extern const struct cpumask *const cpu_active_mask; 81extern const struct cpumask *const cpu_active_mask;
489 82
490/* These strip const, as traditionally they weren't const. */
491#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
492#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
493#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
494#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
495
496#if NR_CPUS > 1 83#if NR_CPUS > 1
497#define num_online_cpus() cpumask_weight(cpu_online_mask) 84#define num_online_cpus() cpumask_weight(cpu_online_mask)
498#define num_possible_cpus() cpumask_weight(cpu_possible_mask) 85#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
@@ -511,35 +98,6 @@ extern const struct cpumask *const cpu_active_mask;
511#define cpu_active(cpu) ((cpu) == 0) 98#define cpu_active(cpu) ((cpu) == 0)
512#endif 99#endif
513 100
514#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
515
516/* These are the new versions of the cpumask operators: passed by pointer.
517 * The older versions will be implemented in terms of these, then deleted. */
518#define cpumask_bits(maskp) ((maskp)->bits)
519
520#if NR_CPUS <= BITS_PER_LONG
521#define CPU_BITS_ALL \
522{ \
523 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
524}
525
526#else /* NR_CPUS > BITS_PER_LONG */
527
528#define CPU_BITS_ALL \
529{ \
530 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
531 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
532}
533#endif /* NR_CPUS > BITS_PER_LONG */
534
535#ifdef CONFIG_CPUMASK_OFFSTACK
536/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
537 * not all bits may be allocated. */
538#define nr_cpumask_bits nr_cpu_ids
539#else
540#define nr_cpumask_bits NR_CPUS
541#endif
542
543/* verify cpu argument to cpumask_* operators */ 101/* verify cpu argument to cpumask_* operators */
544static inline unsigned int cpumask_check(unsigned int cpu) 102static inline unsigned int cpumask_check(unsigned int cpu)
545{ 103{
@@ -715,6 +273,18 @@ static inline int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
715} 273}
716 274
717/** 275/**
276 * cpumask_test_and_clear_cpu - atomically test and clear a cpu in a cpumask
277 * @cpu: cpu number (< nr_cpu_ids)
278 * @cpumask: the cpumask pointer
279 *
280 * test_and_clear_bit wrapper for cpumasks.
281 */
282static inline int cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
283{
284 return test_and_clear_bit(cpumask_check(cpu), cpumask_bits(cpumask));
285}
286
287/**
718 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask 288 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
719 * @dstp: the cpumask pointer 289 * @dstp: the cpumask pointer
720 */ 290 */
@@ -1088,4 +658,241 @@ void set_cpu_active(unsigned int cpu, bool active);
1088void init_cpu_present(const struct cpumask *src); 658void init_cpu_present(const struct cpumask *src);
1089void init_cpu_possible(const struct cpumask *src); 659void init_cpu_possible(const struct cpumask *src);
1090void init_cpu_online(const struct cpumask *src); 660void init_cpu_online(const struct cpumask *src);
661
662/**
663 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
664 * @bitmap: the bitmap
665 *
666 * There are a few places where cpumask_var_t isn't appropriate and
667 * static cpumasks must be used (eg. very early boot), yet we don't
668 * expose the definition of 'struct cpumask'.
669 *
670 * This does the conversion, and can be used as a constant initializer.
671 */
672#define to_cpumask(bitmap) \
673 ((struct cpumask *)(1 ? (bitmap) \
674 : (void *)sizeof(__check_is_bitmap(bitmap))))
675
676static inline int __check_is_bitmap(const unsigned long *bitmap)
677{
678 return 1;
679}
680
681/*
682 * Special-case data structure for "single bit set only" constant CPU masks.
683 *
684 * We pre-generate all the 64 (or 32) possible bit positions, with enough
685 * padding to the left and the right, and return the constant pointer
686 * appropriately offset.
687 */
688extern const unsigned long
689 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
690
691static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
692{
693 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
694 p -= cpu / BITS_PER_LONG;
695 return to_cpumask(p);
696}
697
698#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
699
700#if NR_CPUS <= BITS_PER_LONG
701#define CPU_BITS_ALL \
702{ \
703 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
704}
705
706#else /* NR_CPUS > BITS_PER_LONG */
707
708#define CPU_BITS_ALL \
709{ \
710 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
711 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
712}
713#endif /* NR_CPUS > BITS_PER_LONG */
714
715/*
716 *
717 * From here down, all obsolete. Use cpumask_ variants!
718 *
719 */
720#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
721/* These strip const, as traditionally they weren't const. */
722#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
723#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
724#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
725#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
726
727#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
728
729#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
730
731#if NR_CPUS <= BITS_PER_LONG
732
733#define CPU_MASK_ALL \
734(cpumask_t) { { \
735 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
736} }
737
738#else
739
740#define CPU_MASK_ALL \
741(cpumask_t) { { \
742 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
743 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
744} }
745
746#endif
747
748#define CPU_MASK_NONE \
749(cpumask_t) { { \
750 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
751} }
752
753#define CPU_MASK_CPU0 \
754(cpumask_t) { { \
755 [0] = 1UL \
756} }
757
758#if NR_CPUS == 1
759#define first_cpu(src) ({ (void)(src); 0; })
760#define next_cpu(n, src) ({ (void)(src); 1; })
761#define any_online_cpu(mask) 0
762#define for_each_cpu_mask(cpu, mask) \
763 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
764#else /* NR_CPUS > 1 */
765int __first_cpu(const cpumask_t *srcp);
766int __next_cpu(int n, const cpumask_t *srcp);
767int __any_online_cpu(const cpumask_t *mask);
768
769#define first_cpu(src) __first_cpu(&(src))
770#define next_cpu(n, src) __next_cpu((n), &(src))
771#define any_online_cpu(mask) __any_online_cpu(&(mask))
772#define for_each_cpu_mask(cpu, mask) \
773 for ((cpu) = -1; \
774 (cpu) = next_cpu((cpu), (mask)), \
775 (cpu) < NR_CPUS; )
776#endif /* SMP */
777
778#if NR_CPUS <= 64
779
780#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
781
782#else /* NR_CPUS > 64 */
783
784int __next_cpu_nr(int n, const cpumask_t *srcp);
785#define for_each_cpu_mask_nr(cpu, mask) \
786 for ((cpu) = -1; \
787 (cpu) = __next_cpu_nr((cpu), &(mask)), \
788 (cpu) < nr_cpu_ids; )
789
790#endif /* NR_CPUS > 64 */
791
792#define cpus_addr(src) ((src).bits)
793
794#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
795static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
796{
797 set_bit(cpu, dstp->bits);
798}
799
800#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
801static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
802{
803 clear_bit(cpu, dstp->bits);
804}
805
806#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
807static inline void __cpus_setall(cpumask_t *dstp, int nbits)
808{
809 bitmap_fill(dstp->bits, nbits);
810}
811
812#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
813static inline void __cpus_clear(cpumask_t *dstp, int nbits)
814{
815 bitmap_zero(dstp->bits, nbits);
816}
817
818/* No static inline type checking - see Subtlety (1) above. */
819#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
820
821#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
822static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
823{
824 return test_and_set_bit(cpu, addr->bits);
825}
826
827#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
828static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
829 const cpumask_t *src2p, int nbits)
830{
831 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
832}
833
834#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
835static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
836 const cpumask_t *src2p, int nbits)
837{
838 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
839}
840
841#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
842static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
843 const cpumask_t *src2p, int nbits)
844{
845 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
846}
847
848#define cpus_andnot(dst, src1, src2) \
849 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
850static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
851 const cpumask_t *src2p, int nbits)
852{
853 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
854}
855
856#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
857static inline int __cpus_equal(const cpumask_t *src1p,
858 const cpumask_t *src2p, int nbits)
859{
860 return bitmap_equal(src1p->bits, src2p->bits, nbits);
861}
862
863#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
864static inline int __cpus_intersects(const cpumask_t *src1p,
865 const cpumask_t *src2p, int nbits)
866{
867 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
868}
869
870#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
871static inline int __cpus_subset(const cpumask_t *src1p,
872 const cpumask_t *src2p, int nbits)
873{
874 return bitmap_subset(src1p->bits, src2p->bits, nbits);
875}
876
877#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
878static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
879{
880 return bitmap_empty(srcp->bits, nbits);
881}
882
883#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
884static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
885{
886 return bitmap_weight(srcp->bits, nbits);
887}
888
889#define cpus_shift_left(dst, src, n) \
890 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
891static inline void __cpus_shift_left(cpumask_t *dstp,
892 const cpumask_t *srcp, int n, int nbits)
893{
894 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
895}
896#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
897
1091#endif /* __LINUX_CPUMASK_H */ 898#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4fa999696310..4e3387a89cb9 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -15,6 +15,7 @@
15#include <linux/capability.h> 15#include <linux/capability.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/key.h> 17#include <linux/key.h>
18#include <linux/selinux.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
20struct user_struct; 21struct user_struct;
@@ -114,6 +115,13 @@ struct thread_group_cred {
114 */ 115 */
115struct cred { 116struct cred {
116 atomic_t usage; 117 atomic_t usage;
118#ifdef CONFIG_DEBUG_CREDENTIALS
119 atomic_t subscribers; /* number of processes subscribed */
120 void *put_addr;
121 unsigned magic;
122#define CRED_MAGIC 0x43736564
123#define CRED_MAGIC_DEAD 0x44656144
124#endif
117 uid_t uid; /* real UID of the task */ 125 uid_t uid; /* real UID of the task */
118 gid_t gid; /* real GID of the task */ 126 gid_t gid; /* real GID of the task */
119 uid_t suid; /* saved UID of the task */ 127 uid_t suid; /* saved UID of the task */
@@ -143,7 +151,9 @@ struct cred {
143}; 151};
144 152
145extern void __put_cred(struct cred *); 153extern void __put_cred(struct cred *);
154extern void exit_creds(struct task_struct *);
146extern int copy_creds(struct task_struct *, unsigned long); 155extern int copy_creds(struct task_struct *, unsigned long);
156extern struct cred *cred_alloc_blank(void);
147extern struct cred *prepare_creds(void); 157extern struct cred *prepare_creds(void);
148extern struct cred *prepare_exec_creds(void); 158extern struct cred *prepare_exec_creds(void);
149extern struct cred *prepare_usermodehelper_creds(void); 159extern struct cred *prepare_usermodehelper_creds(void);
@@ -158,6 +168,46 @@ extern int set_security_override_from_ctx(struct cred *, const char *);
158extern int set_create_files_as(struct cred *, struct inode *); 168extern int set_create_files_as(struct cred *, struct inode *);
159extern void __init cred_init(void); 169extern void __init cred_init(void);
160 170
171/*
172 * check for validity of credentials
173 */
174#ifdef CONFIG_DEBUG_CREDENTIALS
175extern void __invalid_creds(const struct cred *, const char *, unsigned);
176extern void __validate_process_creds(struct task_struct *,
177 const char *, unsigned);
178
179extern bool creds_are_invalid(const struct cred *cred);
180
181static inline void __validate_creds(const struct cred *cred,
182 const char *file, unsigned line)
183{
184 if (unlikely(creds_are_invalid(cred)))
185 __invalid_creds(cred, file, line);
186}
187
188#define validate_creds(cred) \
189do { \
190 __validate_creds((cred), __FILE__, __LINE__); \
191} while(0)
192
193#define validate_process_creds() \
194do { \
195 __validate_process_creds(current, __FILE__, __LINE__); \
196} while(0)
197
198extern void validate_creds_for_do_exit(struct task_struct *);
199#else
200static inline void validate_creds(const struct cred *cred)
201{
202}
203static inline void validate_creds_for_do_exit(struct task_struct *tsk)
204{
205}
206static inline void validate_process_creds(void)
207{
208}
209#endif
210
161/** 211/**
162 * get_new_cred - Get a reference on a new set of credentials 212 * get_new_cred - Get a reference on a new set of credentials
163 * @cred: The new credentials to reference 213 * @cred: The new credentials to reference
@@ -186,7 +236,9 @@ static inline struct cred *get_new_cred(struct cred *cred)
186 */ 236 */
187static inline const struct cred *get_cred(const struct cred *cred) 237static inline const struct cred *get_cred(const struct cred *cred)
188{ 238{
189 return get_new_cred((struct cred *) cred); 239 struct cred *nonconst_cred = (struct cred *) cred;
240 validate_creds(cred);
241 return get_new_cred(nonconst_cred);
190} 242}
191 243
192/** 244/**
@@ -204,7 +256,7 @@ static inline void put_cred(const struct cred *_cred)
204{ 256{
205 struct cred *cred = (struct cred *) _cred; 257 struct cred *cred = (struct cred *) _cred;
206 258
207 BUG_ON(atomic_read(&(cred)->usage) <= 0); 259 validate_creds(cred);
208 if (atomic_dec_and_test(&(cred)->usage)) 260 if (atomic_dec_and_test(&(cred)->usage))
209 __put_cred(cred); 261 __put_cred(cred);
210} 262}
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index ec29fa268b94..fd929889e8dc 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -115,7 +115,6 @@ struct crypto_async_request;
115struct crypto_aead; 115struct crypto_aead;
116struct crypto_blkcipher; 116struct crypto_blkcipher;
117struct crypto_hash; 117struct crypto_hash;
118struct crypto_ahash;
119struct crypto_rng; 118struct crypto_rng;
120struct crypto_tfm; 119struct crypto_tfm;
121struct crypto_type; 120struct crypto_type;
@@ -146,16 +145,6 @@ struct ablkcipher_request {
146 void *__ctx[] CRYPTO_MINALIGN_ATTR; 145 void *__ctx[] CRYPTO_MINALIGN_ATTR;
147}; 146};
148 147
149struct ahash_request {
150 struct crypto_async_request base;
151
152 unsigned int nbytes;
153 struct scatterlist *src;
154 u8 *result;
155
156 void *__ctx[] CRYPTO_MINALIGN_ATTR;
157};
158
159/** 148/**
160 * struct aead_request - AEAD request 149 * struct aead_request - AEAD request
161 * @base: Common attributes for async crypto requests 150 * @base: Common attributes for async crypto requests
@@ -220,18 +209,6 @@ struct ablkcipher_alg {
220 unsigned int ivsize; 209 unsigned int ivsize;
221}; 210};
222 211
223struct ahash_alg {
224 int (*init)(struct ahash_request *req);
225 int (*reinit)(struct ahash_request *req);
226 int (*update)(struct ahash_request *req);
227 int (*final)(struct ahash_request *req);
228 int (*digest)(struct ahash_request *req);
229 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
230 unsigned int keylen);
231
232 unsigned int digestsize;
233};
234
235struct aead_alg { 212struct aead_alg {
236 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 213 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
237 unsigned int keylen); 214 unsigned int keylen);
@@ -318,7 +295,6 @@ struct rng_alg {
318#define cra_cipher cra_u.cipher 295#define cra_cipher cra_u.cipher
319#define cra_digest cra_u.digest 296#define cra_digest cra_u.digest
320#define cra_hash cra_u.hash 297#define cra_hash cra_u.hash
321#define cra_ahash cra_u.ahash
322#define cra_compress cra_u.compress 298#define cra_compress cra_u.compress
323#define cra_rng cra_u.rng 299#define cra_rng cra_u.rng
324 300
@@ -346,7 +322,6 @@ struct crypto_alg {
346 struct cipher_alg cipher; 322 struct cipher_alg cipher;
347 struct digest_alg digest; 323 struct digest_alg digest;
348 struct hash_alg hash; 324 struct hash_alg hash;
349 struct ahash_alg ahash;
350 struct compress_alg compress; 325 struct compress_alg compress;
351 struct rng_alg rng; 326 struct rng_alg rng;
352 } cra_u; 327 } cra_u;
@@ -433,18 +408,6 @@ struct hash_tfm {
433 unsigned int digestsize; 408 unsigned int digestsize;
434}; 409};
435 410
436struct ahash_tfm {
437 int (*init)(struct ahash_request *req);
438 int (*update)(struct ahash_request *req);
439 int (*final)(struct ahash_request *req);
440 int (*digest)(struct ahash_request *req);
441 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
442 unsigned int keylen);
443
444 unsigned int digestsize;
445 unsigned int reqsize;
446};
447
448struct compress_tfm { 411struct compress_tfm {
449 int (*cot_compress)(struct crypto_tfm *tfm, 412 int (*cot_compress)(struct crypto_tfm *tfm,
450 const u8 *src, unsigned int slen, 413 const u8 *src, unsigned int slen,
@@ -465,7 +428,6 @@ struct rng_tfm {
465#define crt_blkcipher crt_u.blkcipher 428#define crt_blkcipher crt_u.blkcipher
466#define crt_cipher crt_u.cipher 429#define crt_cipher crt_u.cipher
467#define crt_hash crt_u.hash 430#define crt_hash crt_u.hash
468#define crt_ahash crt_u.ahash
469#define crt_compress crt_u.compress 431#define crt_compress crt_u.compress
470#define crt_rng crt_u.rng 432#define crt_rng crt_u.rng
471 433
@@ -479,7 +441,6 @@ struct crypto_tfm {
479 struct blkcipher_tfm blkcipher; 441 struct blkcipher_tfm blkcipher;
480 struct cipher_tfm cipher; 442 struct cipher_tfm cipher;
481 struct hash_tfm hash; 443 struct hash_tfm hash;
482 struct ahash_tfm ahash;
483 struct compress_tfm compress; 444 struct compress_tfm compress;
484 struct rng_tfm rng; 445 struct rng_tfm rng;
485 } crt_u; 446 } crt_u;
@@ -770,7 +731,7 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc(
770 731
771static inline void ablkcipher_request_free(struct ablkcipher_request *req) 732static inline void ablkcipher_request_free(struct ablkcipher_request *req)
772{ 733{
773 kfree(req); 734 kzfree(req);
774} 735}
775 736
776static inline void ablkcipher_request_set_callback( 737static inline void ablkcipher_request_set_callback(
@@ -901,7 +862,7 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
901 862
902static inline void aead_request_free(struct aead_request *req) 863static inline void aead_request_free(struct aead_request *req)
903{ 864{
904 kfree(req); 865 kzfree(req);
905} 866}
906 867
907static inline void aead_request_set_callback(struct aead_request *req, 868static inline void aead_request_set_callback(struct aead_request *req,
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 1fbdea4f08eb..a5049eaf782d 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -499,6 +499,7 @@ struct cyclades_card {
499 void __iomem *p9050; 499 void __iomem *p9050;
500 struct RUNTIME_9060 __iomem *p9060; 500 struct RUNTIME_9060 __iomem *p9060;
501 } ctl_addr; 501 } ctl_addr;
502 struct BOARD_CTRL __iomem *board_ctrl; /* cyz specific */
502 int irq; 503 int irq;
503 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ 504 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
504 unsigned int first_line; /* minor number of first channel on card */ 505 unsigned int first_line; /* minor number of first channel on card */
@@ -541,6 +542,15 @@ struct cyclades_port {
541 int magic; 542 int magic;
542 struct tty_port port; 543 struct tty_port port;
543 struct cyclades_card *card; 544 struct cyclades_card *card;
545 union {
546 struct {
547 void __iomem *base_addr;
548 } cyy;
549 struct {
550 struct CH_CTRL __iomem *ch_ctrl;
551 struct BUF_CTRL __iomem *buf_ctrl;
552 } cyz;
553 } u;
544 int line; 554 int line;
545 int flags; /* defined in tty.h */ 555 int flags; /* defined in tty.h */
546 int type; /* UART type */ 556 int type; /* UART type */
@@ -568,7 +578,6 @@ struct cyclades_port {
568 struct cyclades_idle_stats idle_stats; 578 struct cyclades_idle_stats idle_stats;
569 struct cyclades_icount icount; 579 struct cyclades_icount icount;
570 struct completion shutdown_wait; 580 struct completion shutdown_wait;
571 wait_queue_head_t delta_msr_wait;
572 int throttle; 581 int throttle;
573}; 582};
574 583
diff --git a/include/linux/dca.h b/include/linux/dca.h
index 9c20c7e87d0a..d27a7a05718d 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -20,6 +20,9 @@
20 */ 20 */
21#ifndef DCA_H 21#ifndef DCA_H
22#define DCA_H 22#define DCA_H
23
24#include <linux/pci.h>
25
23/* DCA Provider API */ 26/* DCA Provider API */
24 27
25/* DCA Notifier Interface */ 28/* DCA Notifier Interface */
@@ -36,6 +39,12 @@ struct dca_provider {
36 int id; 39 int id;
37}; 40};
38 41
42struct dca_domain {
43 struct list_head node;
44 struct list_head dca_providers;
45 struct pci_bus *pci_rc;
46};
47
39struct dca_ops { 48struct dca_ops {
40 int (*add_requester) (struct dca_provider *, struct device *); 49 int (*add_requester) (struct dca_provider *, struct device *);
41 int (*remove_requester) (struct dca_provider *, struct device *); 50 int (*remove_requester) (struct dca_provider *, struct device *);
@@ -47,7 +56,7 @@ struct dca_ops {
47struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size); 56struct dca_provider *alloc_dca_provider(struct dca_ops *ops, int priv_size);
48void free_dca_provider(struct dca_provider *dca); 57void free_dca_provider(struct dca_provider *dca);
49int register_dca_provider(struct dca_provider *dca, struct device *dev); 58int register_dca_provider(struct dca_provider *dca, struct device *dev);
50void unregister_dca_provider(struct dca_provider *dca); 59void unregister_dca_provider(struct dca_provider *dca, struct device *dev);
51 60
52static inline void *dca_priv(struct dca_provider *dca) 61static inline void *dca_priv(struct dca_provider *dca)
53{ 62{
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 7d2e10006188..b7cdbb4373df 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -50,6 +50,8 @@ struct dcbmsg {
50 * @DCB_CMD_SNUMTCS: set the number of traffic classes 50 * @DCB_CMD_SNUMTCS: set the number of traffic classes
51 * @DCB_CMD_GBCN: set backward congestion notification configuration 51 * @DCB_CMD_GBCN: set backward congestion notification configuration
52 * @DCB_CMD_SBCN: get backward congestion notification configration. 52 * @DCB_CMD_SBCN: get backward congestion notification configration.
53 * @DCB_CMD_GAPP: get application protocol configuration
54 * @DCB_CMD_SAPP: set application protocol configuration
53 */ 55 */
54enum dcbnl_commands { 56enum dcbnl_commands {
55 DCB_CMD_UNDEFINED, 57 DCB_CMD_UNDEFINED,
@@ -80,6 +82,9 @@ enum dcbnl_commands {
80 DCB_CMD_BCN_GCFG, 82 DCB_CMD_BCN_GCFG,
81 DCB_CMD_BCN_SCFG, 83 DCB_CMD_BCN_SCFG,
82 84
85 DCB_CMD_GAPP,
86 DCB_CMD_SAPP,
87
83 __DCB_CMD_ENUM_MAX, 88 __DCB_CMD_ENUM_MAX,
84 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 89 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
85}; 90};
@@ -114,6 +119,7 @@ enum dcbnl_attrs {
114 DCB_ATTR_CAP, 119 DCB_ATTR_CAP,
115 DCB_ATTR_NUMTCS, 120 DCB_ATTR_NUMTCS,
116 DCB_ATTR_BCN, 121 DCB_ATTR_BCN,
122 DCB_ATTR_APP,
117 123
118 __DCB_ATTR_ENUM_MAX, 124 __DCB_ATTR_ENUM_MAX,
119 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 125 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
@@ -338,5 +344,17 @@ enum dcb_general_attr_values {
338 DCB_ATTR_VALUE_UNDEFINED = 0xff 344 DCB_ATTR_VALUE_UNDEFINED = 0xff
339}; 345};
340 346
347#define DCB_APP_IDTYPE_ETHTYPE 0x00
348#define DCB_APP_IDTYPE_PORTNUM 0x01
349enum dcbnl_app_attrs {
350 DCB_APP_ATTR_UNDEFINED,
351
352 DCB_APP_ATTR_IDTYPE,
353 DCB_APP_ATTR_ID,
354 DCB_APP_ATTR_PRIORITY,
355
356 __DCB_APP_ATTR_ENUM_MAX,
357 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
358};
341 359
342#endif /* __LINUX_DCBNL_H__ */ 360#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index eb5c2ba2f81a..fc1b930f246c 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -9,7 +9,7 @@
9 * 2 as published by the Free Software Foundation. 9 * 2 as published by the Free Software Foundation.
10 * 10 *
11 * debugfs is for people to use instead of /proc or /sys. 11 * debugfs is for people to use instead of /proc or /sys.
12 * See Documentation/DocBook/kernel-api for more details. 12 * See Documentation/DocBook/filesystems for more details.
13 */ 13 */
14 14
15#ifndef _DEBUGFS_H_ 15#ifndef _DEBUGFS_H_
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index f352f06fa063..5076fe0c8a96 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -18,7 +18,6 @@
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/taskstats_kern.h>
22 21
23/* 22/*
24 * Per-task flags relevant to delay accounting 23 * Per-task flags relevant to delay accounting
diff --git a/include/linux/device.h b/include/linux/device.h
index aebb81036db2..2ea3e4921812 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -2,7 +2,8 @@
2 * device.h - generic, centralized driver model 2 * device.h - generic, centralized driver model
3 * 3 *
4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
5 * Copyright (c) 2004-2007 Greg Kroah-Hartman <gregkh@suse.de> 5 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
6 * Copyright (c) 2008-2009 Novell Inc.
6 * 7 *
7 * This file is released under the GPLv2 8 * This file is released under the GPLv2
8 * 9 *
@@ -62,7 +63,7 @@ struct bus_type {
62 int (*suspend)(struct device *dev, pm_message_t state); 63 int (*suspend)(struct device *dev, pm_message_t state);
63 int (*resume)(struct device *dev); 64 int (*resume)(struct device *dev);
64 65
65 struct dev_pm_ops *pm; 66 const struct dev_pm_ops *pm;
66 67
67 struct bus_type_private *p; 68 struct bus_type_private *p;
68}; 69};
@@ -123,16 +124,18 @@ struct device_driver {
123 struct bus_type *bus; 124 struct bus_type *bus;
124 125
125 struct module *owner; 126 struct module *owner;
126 const char *mod_name; /* used for built-in modules */ 127 const char *mod_name; /* used for built-in modules */
128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
127 130
128 int (*probe) (struct device *dev); 131 int (*probe) (struct device *dev);
129 int (*remove) (struct device *dev); 132 int (*remove) (struct device *dev);
130 void (*shutdown) (struct device *dev); 133 void (*shutdown) (struct device *dev);
131 int (*suspend) (struct device *dev, pm_message_t state); 134 int (*suspend) (struct device *dev, pm_message_t state);
132 int (*resume) (struct device *dev); 135 int (*resume) (struct device *dev);
133 struct attribute_group **groups; 136 const struct attribute_group **groups;
134 137
135 struct dev_pm_ops *pm; 138 const struct dev_pm_ops *pm;
136 139
137 struct driver_private *p; 140 struct driver_private *p;
138}; 141};
@@ -192,7 +195,7 @@ struct class {
192 struct kobject *dev_kobj; 195 struct kobject *dev_kobj;
193 196
194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
195 char *(*nodename)(struct device *dev); 198 char *(*devnode)(struct device *dev, mode_t *mode);
196 199
197 void (*class_release)(struct class *class); 200 void (*class_release)(struct class *class);
198 void (*dev_release)(struct device *dev); 201 void (*dev_release)(struct device *dev);
@@ -200,7 +203,8 @@ struct class {
200 int (*suspend)(struct device *dev, pm_message_t state); 203 int (*suspend)(struct device *dev, pm_message_t state);
201 int (*resume)(struct device *dev); 204 int (*resume)(struct device *dev);
202 205
203 struct dev_pm_ops *pm; 206 const struct dev_pm_ops *pm;
207
204 struct class_private *p; 208 struct class_private *p;
205}; 209};
206 210
@@ -223,6 +227,14 @@ extern void class_unregister(struct class *class);
223 __class_register(class, &__key); \ 227 __class_register(class, &__key); \
224}) 228})
225 229
230struct class_compat;
231struct class_compat *class_compat_register(const char *name);
232void class_compat_unregister(struct class_compat *cls);
233int class_compat_create_link(struct class_compat *cls, struct device *dev,
234 struct device *device_link);
235void class_compat_remove_link(struct class_compat *cls, struct device *dev,
236 struct device *device_link);
237
226extern void class_dev_iter_init(struct class_dev_iter *iter, 238extern void class_dev_iter_init(struct class_dev_iter *iter,
227 struct class *class, 239 struct class *class,
228 struct device *start, 240 struct device *start,
@@ -286,12 +298,12 @@ extern void class_destroy(struct class *cls);
286 */ 298 */
287struct device_type { 299struct device_type {
288 const char *name; 300 const char *name;
289 struct attribute_group **groups; 301 const struct attribute_group **groups;
290 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 302 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
291 char *(*nodename)(struct device *dev); 303 char *(*devnode)(struct device *dev, mode_t *mode);
292 void (*release)(struct device *dev); 304 void (*release)(struct device *dev);
293 305
294 struct dev_pm_ops *pm; 306 const struct dev_pm_ops *pm;
295}; 307};
296 308
297/* interface for exporting device attributes */ 309/* interface for exporting device attributes */
@@ -380,7 +392,6 @@ struct device {
380 struct bus_type *bus; /* type of bus device is on */ 392 struct bus_type *bus; /* type of bus device is on */
381 struct device_driver *driver; /* which driver has allocated this 393 struct device_driver *driver; /* which driver has allocated this
382 device */ 394 device */
383 void *driver_data; /* data private to the driver */
384 void *platform_data; /* Platform specific data, device 395 void *platform_data; /* Platform specific data, device
385 core doesn't touch it */ 396 core doesn't touch it */
386 struct dev_pm_info power; 397 struct dev_pm_info power;
@@ -411,7 +422,7 @@ struct device {
411 422
412 struct klist_node knode_class; 423 struct klist_node knode_class;
413 struct class *class; 424 struct class *class;
414 struct attribute_group **groups; /* optional groups */ 425 const struct attribute_group **groups; /* optional groups */
415 426
416 void (*release)(struct device *dev); 427 void (*release)(struct device *dev);
417}; 428};
@@ -446,16 +457,6 @@ static inline void set_dev_node(struct device *dev, int node)
446} 457}
447#endif 458#endif
448 459
449static inline void *dev_get_drvdata(const struct device *dev)
450{
451 return dev->driver_data;
452}
453
454static inline void dev_set_drvdata(struct device *dev, void *data)
455{
456 dev->driver_data = data;
457}
458
459static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 460static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
460{ 461{
461 return dev->kobj.uevent_suppress; 462 return dev->kobj.uevent_suppress;
@@ -488,7 +489,10 @@ extern struct device *device_find_child(struct device *dev, void *data,
488extern int device_rename(struct device *dev, char *new_name); 489extern int device_rename(struct device *dev, char *new_name);
489extern int device_move(struct device *dev, struct device *new_parent, 490extern int device_move(struct device *dev, struct device *new_parent,
490 enum dpm_order dpm_order); 491 enum dpm_order dpm_order);
491extern const char *device_get_nodename(struct device *dev, const char **tmp); 492extern const char *device_get_devnode(struct device *dev,
493 mode_t *mode, const char **tmp);
494extern void *dev_get_drvdata(const struct device *dev);
495extern void dev_set_drvdata(struct device *dev, void *data);
492 496
493/* 497/*
494 * Root device objects for grouping under /sys/devices 498 * Root device objects for grouping under /sys/devices
@@ -501,6 +505,11 @@ static inline struct device *root_device_register(const char *name)
501} 505}
502extern void root_device_unregister(struct device *root); 506extern void root_device_unregister(struct device *root);
503 507
508static inline void *dev_get_platdata(const struct device *dev)
509{
510 return dev->platform_data;
511}
512
504/* 513/*
505 * Manual binding of a device to driver. See drivers/base/bus.c 514 * Manual binding of a device to driver. See drivers/base/bus.c
506 * for information on use. 515 * for information on use.
@@ -546,6 +555,16 @@ extern void put_device(struct device *dev);
546 555
547extern void wait_for_device_probe(void); 556extern void wait_for_device_probe(void);
548 557
558#ifdef CONFIG_DEVTMPFS
559extern int devtmpfs_create_node(struct device *dev);
560extern int devtmpfs_delete_node(struct device *dev);
561extern int devtmpfs_mount(const char *mountpoint);
562#else
563static inline int devtmpfs_create_node(struct device *dev) { return 0; }
564static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
565static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
566#endif
567
549/* drivers/base/power/shutdown.c */ 568/* drivers/base/power/shutdown.c */
550extern void device_shutdown(void); 569extern void device_shutdown(void);
551 570
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 07dfd460d286..91b761846061 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -58,6 +58,7 @@ struct dma_map_ops {
58 enum dma_data_direction dir); 58 enum dma_data_direction dir);
59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); 59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
60 int (*dma_supported)(struct device *dev, u64 mask); 60 int (*dma_supported)(struct device *dev, u64 mask);
61 int (*set_dma_mask)(struct device *dev, u64 mask);
61 int is_phys; 62 int is_phys;
62}; 63};
63 64
@@ -98,11 +99,6 @@ static inline int is_device_dma_capable(struct device *dev)
98 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 99 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
99} 100}
100 101
101static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
102{
103 return addr + size <= mask;
104}
105
106#ifdef CONFIG_HAS_DMA 102#ifdef CONFIG_HAS_DMA
107#include <asm/dma-mapping.h> 103#include <asm/dma-mapping.h>
108#else 104#else
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index ffefba81c818..2b9f2ac7ed60 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -48,19 +48,20 @@ enum dma_status {
48 48
49/** 49/**
50 * enum dma_transaction_type - DMA transaction types/indexes 50 * enum dma_transaction_type - DMA transaction types/indexes
51 *
52 * Note: The DMA_ASYNC_TX capability is not to be set by drivers. It is
53 * automatically set as dma devices are registered.
51 */ 54 */
52enum dma_transaction_type { 55enum dma_transaction_type {
53 DMA_MEMCPY, 56 DMA_MEMCPY,
54 DMA_XOR, 57 DMA_XOR,
55 DMA_PQ_XOR, 58 DMA_PQ,
56 DMA_DUAL_XOR, 59 DMA_XOR_VAL,
57 DMA_PQ_UPDATE, 60 DMA_PQ_VAL,
58 DMA_ZERO_SUM,
59 DMA_PQ_ZERO_SUM,
60 DMA_MEMSET, 61 DMA_MEMSET,
61 DMA_MEMCPY_CRC32C,
62 DMA_INTERRUPT, 62 DMA_INTERRUPT,
63 DMA_PRIVATE, 63 DMA_PRIVATE,
64 DMA_ASYNC_TX,
64 DMA_SLAVE, 65 DMA_SLAVE,
65}; 66};
66 67
@@ -70,18 +71,25 @@ enum dma_transaction_type {
70 71
71/** 72/**
72 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 73 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
73 * control completion, and communicate status. 74 * control completion, and communicate status.
74 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of 75 * @DMA_PREP_INTERRUPT - trigger an interrupt (callback) upon completion of
75 * this transaction 76 * this transaction
76 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client 77 * @DMA_CTRL_ACK - the descriptor cannot be reused until the client
77 * acknowledges receipt, i.e. has has a chance to establish any 78 * acknowledges receipt, i.e. has has a chance to establish any dependency
78 * dependency chains 79 * chains
79 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) 80 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
80 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s) 81 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
81 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single 82 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
82 * (if not set, do the source dma-unmapping as page) 83 * (if not set, do the source dma-unmapping as page)
83 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single 84 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
84 * (if not set, do the destination dma-unmapping as page) 85 * (if not set, do the destination dma-unmapping as page)
86 * @DMA_PREP_PQ_DISABLE_P - prevent generation of P while generating Q
87 * @DMA_PREP_PQ_DISABLE_Q - prevent generation of Q while generating P
88 * @DMA_PREP_CONTINUE - indicate to a driver that it is reusing buffers as
89 * sources that were the result of a previous operation, in the case of a PQ
90 * operation it continues the calculation with new sources
91 * @DMA_PREP_FENCE - tell the driver that subsequent operations depend
92 * on the result of this operation
85 */ 93 */
86enum dma_ctrl_flags { 94enum dma_ctrl_flags {
87 DMA_PREP_INTERRUPT = (1 << 0), 95 DMA_PREP_INTERRUPT = (1 << 0),
@@ -90,9 +98,32 @@ enum dma_ctrl_flags {
90 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), 98 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
91 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4), 99 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4),
92 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5), 100 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5),
101 DMA_PREP_PQ_DISABLE_P = (1 << 6),
102 DMA_PREP_PQ_DISABLE_Q = (1 << 7),
103 DMA_PREP_CONTINUE = (1 << 8),
104 DMA_PREP_FENCE = (1 << 9),
93}; 105};
94 106
95/** 107/**
108 * enum sum_check_bits - bit position of pq_check_flags
109 */
110enum sum_check_bits {
111 SUM_CHECK_P = 0,
112 SUM_CHECK_Q = 1,
113};
114
115/**
116 * enum pq_check_flags - result of async_{xor,pq}_zero_sum operations
117 * @SUM_CHECK_P_RESULT - 1 if xor zero sum error, 0 otherwise
118 * @SUM_CHECK_Q_RESULT - 1 if reed-solomon zero sum error, 0 otherwise
119 */
120enum sum_check_flags {
121 SUM_CHECK_P_RESULT = (1 << SUM_CHECK_P),
122 SUM_CHECK_Q_RESULT = (1 << SUM_CHECK_Q),
123};
124
125
126/**
96 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t. 127 * dma_cap_mask_t - capabilities bitmap modeled after cpumask_t.
97 * See linux/cpumask.h 128 * See linux/cpumask.h
98 */ 129 */
@@ -180,8 +211,6 @@ typedef void (*dma_async_tx_callback)(void *dma_async_param);
180 * @flags: flags to augment operation preparation, control completion, and 211 * @flags: flags to augment operation preparation, control completion, and
181 * communicate status 212 * communicate status
182 * @phys: physical address of the descriptor 213 * @phys: physical address of the descriptor
183 * @tx_list: driver common field for operations that require multiple
184 * descriptors
185 * @chan: target channel for this operation 214 * @chan: target channel for this operation
186 * @tx_submit: set the prepared descriptor(s) to be executed by the engine 215 * @tx_submit: set the prepared descriptor(s) to be executed by the engine
187 * @callback: routine to call after this operation is complete 216 * @callback: routine to call after this operation is complete
@@ -195,7 +224,6 @@ struct dma_async_tx_descriptor {
195 dma_cookie_t cookie; 224 dma_cookie_t cookie;
196 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */ 225 enum dma_ctrl_flags flags; /* not a 'long' to pack with cookie */
197 dma_addr_t phys; 226 dma_addr_t phys;
198 struct list_head tx_list;
199 struct dma_chan *chan; 227 struct dma_chan *chan;
200 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 228 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
201 dma_async_tx_callback callback; 229 dma_async_tx_callback callback;
@@ -213,6 +241,11 @@ struct dma_async_tx_descriptor {
213 * @global_node: list_head for global dma_device_list 241 * @global_node: list_head for global dma_device_list
214 * @cap_mask: one or more dma_capability flags 242 * @cap_mask: one or more dma_capability flags
215 * @max_xor: maximum number of xor sources, 0 if no capability 243 * @max_xor: maximum number of xor sources, 0 if no capability
244 * @max_pq: maximum number of PQ sources and PQ-continue capability
245 * @copy_align: alignment shift for memcpy operations
246 * @xor_align: alignment shift for xor operations
247 * @pq_align: alignment shift for pq operations
248 * @fill_align: alignment shift for memset operations
216 * @dev_id: unique device ID 249 * @dev_id: unique device ID
217 * @dev: struct device reference for dma mapping api 250 * @dev: struct device reference for dma mapping api
218 * @device_alloc_chan_resources: allocate resources and return the 251 * @device_alloc_chan_resources: allocate resources and return the
@@ -220,7 +253,9 @@ struct dma_async_tx_descriptor {
220 * @device_free_chan_resources: release DMA channel's resources 253 * @device_free_chan_resources: release DMA channel's resources
221 * @device_prep_dma_memcpy: prepares a memcpy operation 254 * @device_prep_dma_memcpy: prepares a memcpy operation
222 * @device_prep_dma_xor: prepares a xor operation 255 * @device_prep_dma_xor: prepares a xor operation
223 * @device_prep_dma_zero_sum: prepares a zero_sum operation 256 * @device_prep_dma_xor_val: prepares a xor validation operation
257 * @device_prep_dma_pq: prepares a pq operation
258 * @device_prep_dma_pq_val: prepares a pqzero_sum operation
224 * @device_prep_dma_memset: prepares a memset operation 259 * @device_prep_dma_memset: prepares a memset operation
225 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 260 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
226 * @device_prep_slave_sg: prepares a slave dma operation 261 * @device_prep_slave_sg: prepares a slave dma operation
@@ -235,7 +270,13 @@ struct dma_device {
235 struct list_head channels; 270 struct list_head channels;
236 struct list_head global_node; 271 struct list_head global_node;
237 dma_cap_mask_t cap_mask; 272 dma_cap_mask_t cap_mask;
238 int max_xor; 273 unsigned short max_xor;
274 unsigned short max_pq;
275 u8 copy_align;
276 u8 xor_align;
277 u8 pq_align;
278 u8 fill_align;
279 #define DMA_HAS_PQ_CONTINUE (1 << 15)
239 280
240 int dev_id; 281 int dev_id;
241 struct device *dev; 282 struct device *dev;
@@ -249,9 +290,17 @@ struct dma_device {
249 struct dma_async_tx_descriptor *(*device_prep_dma_xor)( 290 struct dma_async_tx_descriptor *(*device_prep_dma_xor)(
250 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src, 291 struct dma_chan *chan, dma_addr_t dest, dma_addr_t *src,
251 unsigned int src_cnt, size_t len, unsigned long flags); 292 unsigned int src_cnt, size_t len, unsigned long flags);
252 struct dma_async_tx_descriptor *(*device_prep_dma_zero_sum)( 293 struct dma_async_tx_descriptor *(*device_prep_dma_xor_val)(
253 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt, 294 struct dma_chan *chan, dma_addr_t *src, unsigned int src_cnt,
254 size_t len, u32 *result, unsigned long flags); 295 size_t len, enum sum_check_flags *result, unsigned long flags);
296 struct dma_async_tx_descriptor *(*device_prep_dma_pq)(
297 struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
298 unsigned int src_cnt, const unsigned char *scf,
299 size_t len, unsigned long flags);
300 struct dma_async_tx_descriptor *(*device_prep_dma_pq_val)(
301 struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
302 unsigned int src_cnt, const unsigned char *scf, size_t len,
303 enum sum_check_flags *pqres, unsigned long flags);
255 struct dma_async_tx_descriptor *(*device_prep_dma_memset)( 304 struct dma_async_tx_descriptor *(*device_prep_dma_memset)(
256 struct dma_chan *chan, dma_addr_t dest, int value, size_t len, 305 struct dma_chan *chan, dma_addr_t dest, int value, size_t len,
257 unsigned long flags); 306 unsigned long flags);
@@ -270,6 +319,96 @@ struct dma_device {
270 void (*device_issue_pending)(struct dma_chan *chan); 319 void (*device_issue_pending)(struct dma_chan *chan);
271}; 320};
272 321
322static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len)
323{
324 size_t mask;
325
326 if (!align)
327 return true;
328 mask = (1 << align) - 1;
329 if (mask & (off1 | off2 | len))
330 return false;
331 return true;
332}
333
334static inline bool is_dma_copy_aligned(struct dma_device *dev, size_t off1,
335 size_t off2, size_t len)
336{
337 return dmaengine_check_align(dev->copy_align, off1, off2, len);
338}
339
340static inline bool is_dma_xor_aligned(struct dma_device *dev, size_t off1,
341 size_t off2, size_t len)
342{
343 return dmaengine_check_align(dev->xor_align, off1, off2, len);
344}
345
346static inline bool is_dma_pq_aligned(struct dma_device *dev, size_t off1,
347 size_t off2, size_t len)
348{
349 return dmaengine_check_align(dev->pq_align, off1, off2, len);
350}
351
352static inline bool is_dma_fill_aligned(struct dma_device *dev, size_t off1,
353 size_t off2, size_t len)
354{
355 return dmaengine_check_align(dev->fill_align, off1, off2, len);
356}
357
358static inline void
359dma_set_maxpq(struct dma_device *dma, int maxpq, int has_pq_continue)
360{
361 dma->max_pq = maxpq;
362 if (has_pq_continue)
363 dma->max_pq |= DMA_HAS_PQ_CONTINUE;
364}
365
366static inline bool dmaf_continue(enum dma_ctrl_flags flags)
367{
368 return (flags & DMA_PREP_CONTINUE) == DMA_PREP_CONTINUE;
369}
370
371static inline bool dmaf_p_disabled_continue(enum dma_ctrl_flags flags)
372{
373 enum dma_ctrl_flags mask = DMA_PREP_CONTINUE | DMA_PREP_PQ_DISABLE_P;
374
375 return (flags & mask) == mask;
376}
377
378static inline bool dma_dev_has_pq_continue(struct dma_device *dma)
379{
380 return (dma->max_pq & DMA_HAS_PQ_CONTINUE) == DMA_HAS_PQ_CONTINUE;
381}
382
383static unsigned short dma_dev_to_maxpq(struct dma_device *dma)
384{
385 return dma->max_pq & ~DMA_HAS_PQ_CONTINUE;
386}
387
388/* dma_maxpq - reduce maxpq in the face of continued operations
389 * @dma - dma device with PQ capability
390 * @flags - to check if DMA_PREP_CONTINUE and DMA_PREP_PQ_DISABLE_P are set
391 *
392 * When an engine does not support native continuation we need 3 extra
393 * source slots to reuse P and Q with the following coefficients:
394 * 1/ {00} * P : remove P from Q', but use it as a source for P'
395 * 2/ {01} * Q : use Q to continue Q' calculation
396 * 3/ {00} * Q : subtract Q from P' to cancel (2)
397 *
398 * In the case where P is disabled we only need 1 extra source:
399 * 1/ {01} * Q : use Q to continue Q' calculation
400 */
401static inline int dma_maxpq(struct dma_device *dma, enum dma_ctrl_flags flags)
402{
403 if (dma_dev_has_pq_continue(dma) || !dmaf_continue(flags))
404 return dma_dev_to_maxpq(dma);
405 else if (dmaf_p_disabled_continue(flags))
406 return dma_dev_to_maxpq(dma) - 1;
407 else if (dmaf_continue(flags))
408 return dma_dev_to_maxpq(dma) - 3;
409 BUG();
410}
411
273/* --- public DMA engine API --- */ 412/* --- public DMA engine API --- */
274 413
275#ifdef CONFIG_DMA_ENGINE 414#ifdef CONFIG_DMA_ENGINE
@@ -299,7 +438,11 @@ static inline void net_dmaengine_put(void)
299#ifdef CONFIG_ASYNC_TX_DMA 438#ifdef CONFIG_ASYNC_TX_DMA
300#define async_dmaengine_get() dmaengine_get() 439#define async_dmaengine_get() dmaengine_get()
301#define async_dmaengine_put() dmaengine_put() 440#define async_dmaengine_put() dmaengine_put()
441#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
442#define async_dma_find_channel(type) dma_find_channel(DMA_ASYNC_TX)
443#else
302#define async_dma_find_channel(type) dma_find_channel(type) 444#define async_dma_find_channel(type) dma_find_channel(type)
445#endif /* CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH */
303#else 446#else
304static inline void async_dmaengine_get(void) 447static inline void async_dmaengine_get(void)
305{ 448{
@@ -312,7 +455,7 @@ async_dma_find_channel(enum dma_transaction_type type)
312{ 455{
313 return NULL; 456 return NULL;
314} 457}
315#endif 458#endif /* CONFIG_ASYNC_TX_DMA */
316 459
317dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 460dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
318 void *dest, void *src, size_t len); 461 void *dest, void *src, size_t len);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index bb5489c82c99..a8a3e1ac281d 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -43,7 +43,7 @@ extern const char * dmi_get_system_info(int field);
43extern const struct dmi_device * dmi_find_device(int type, const char *name, 43extern const struct dmi_device * dmi_find_device(int type, const char *name,
44 const struct dmi_device *from); 44 const struct dmi_device *from);
45extern void dmi_scan_machine(void); 45extern void dmi_scan_machine(void);
46extern int dmi_get_year(int field); 46extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
47extern int dmi_name_in_vendors(const char *str); 47extern int dmi_name_in_vendors(const char *str);
48extern int dmi_name_in_serial(const char *str); 48extern int dmi_name_in_serial(const char *str);
49extern int dmi_available; 49extern int dmi_available;
@@ -58,7 +58,16 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
58static inline const struct dmi_device * dmi_find_device(int type, const char *name, 58static inline const struct dmi_device * dmi_find_device(int type, const char *name,
59 const struct dmi_device *from) { return NULL; } 59 const struct dmi_device *from) { return NULL; }
60static inline void dmi_scan_machine(void) { return; } 60static inline void dmi_scan_machine(void) { return; }
61static inline int dmi_get_year(int year) { return 0; } 61static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
62{
63 if (yearp)
64 *yearp = 0;
65 if (monthp)
66 *monthp = 0;
67 if (dayp)
68 *dayp = 0;
69 return false;
70}
62static inline int dmi_name_in_vendors(const char *s) { return 0; } 71static inline int dmi_name_in_vendors(const char *s) { return 0; }
63static inline int dmi_name_in_serial(const char *s) { return 0; } 72static inline int dmi_name_in_serial(const char *s) { return 0; }
64#define dmi_available 0 73#define dmi_available 0
diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h
index 2896d90118a9..22a7b9a5f5d1 100644
--- a/include/linux/dtlk.h
+++ b/include/linux/dtlk.h
@@ -1,22 +1,3 @@
1#if 0
2
3#define TRACE_TXT(text) \
4 { \
5 if(dtlk_trace) \
6 { \
7 console_print(text); \
8 console_print("\n"); \
9 } \
10 }
11
12#define TRACE_CHR(chr) \
13 { \
14 if(dtlk_trace) \
15 console_print(chr); \
16 } \
17
18#endif
19
20#define DTLK_MINOR 0 1#define DTLK_MINOR 0
21#define DTLK_IO_EXTENT 0x02 2#define DTLK_IO_EXTENT 0x02
22 3
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index fef943738a24..f078f3ac82d4 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -151,5 +151,7 @@ struct dmx_stc {
151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) 153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
154#define DMX_ADD_PID _IOW('o', 51, __u16)
155#define DMX_REMOVE_PID _IOW('o', 52, __u16)
154 156
155#endif /*_DVBDMX_H_*/ 157#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 51c8d2d49e42..b6cb5425cde3 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -173,7 +173,8 @@ typedef enum fe_modulation {
173typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
174 TRANSMISSION_MODE_2K, 174 TRANSMISSION_MODE_2K,
175 TRANSMISSION_MODE_8K, 175 TRANSMISSION_MODE_8K,
176 TRANSMISSION_MODE_AUTO 176 TRANSMISSION_MODE_AUTO,
177 TRANSMISSION_MODE_4K
177} fe_transmit_mode_t; 178} fe_transmit_mode_t;
178 179
179typedef enum fe_bandwidth { 180typedef enum fe_bandwidth {
@@ -268,15 +269,42 @@ struct dvb_frontend_event {
268#define DTV_FE_CAPABILITY 16 269#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17 270#define DTV_DELIVERY_SYSTEM 17
270 271
271#define DTV_API_VERSION 35 272/* ISDB-T and ISDB-Tsb */
272#define DTV_API_VERSION 35 273#define DTV_ISDBT_PARTIAL_RECEPTION 18
273#define DTV_CODE_RATE_HP 36 274#define DTV_ISDBT_SOUND_BROADCASTING 19
274#define DTV_CODE_RATE_LP 37
275#define DTV_GUARD_INTERVAL 38
276#define DTV_TRANSMISSION_MODE 39
277#define DTV_HIERARCHY 40
278 275
279#define DTV_MAX_COMMAND DTV_HIERARCHY 276#define DTV_ISDBT_SB_SUBCHANNEL_ID 20
277#define DTV_ISDBT_SB_SEGMENT_IDX 21
278#define DTV_ISDBT_SB_SEGMENT_COUNT 22
279
280#define DTV_ISDBT_LAYERA_FEC 23
281#define DTV_ISDBT_LAYERA_MODULATION 24
282#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
283#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
284
285#define DTV_ISDBT_LAYERB_FEC 27
286#define DTV_ISDBT_LAYERB_MODULATION 28
287#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
288#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
289
290#define DTV_ISDBT_LAYERC_FEC 31
291#define DTV_ISDBT_LAYERC_MODULATION 32
292#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
293#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
294
295#define DTV_API_VERSION 35
296
297#define DTV_CODE_RATE_HP 36
298#define DTV_CODE_RATE_LP 37
299#define DTV_GUARD_INTERVAL 38
300#define DTV_TRANSMISSION_MODE 39
301#define DTV_HIERARCHY 40
302
303#define DTV_ISDBT_LAYER_ENABLED 41
304
305#define DTV_ISDBS_TS_ID 42
306
307#define DTV_MAX_COMMAND DTV_ISDBS_TS_ID
280 308
281typedef enum fe_pilot { 309typedef enum fe_pilot {
282 PILOT_ON, 310 PILOT_ON,
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 25b823b81734..540b0583d9fb 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 0 27#define DVB_API_VERSION_MINOR 1
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 45a937be6d38..90a4ed0ea0e5 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -361,6 +361,7 @@ typedef struct elf64_shdr {
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
364#define NT_PRXSTATUS 0x300 /* s390 upper register halves */
364 365
365 366
366/* Note header in a PT_NOTE section */ 367/* Note header in a PT_NOTE section */
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index 4332442b1b57..90d1c2184112 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -122,8 +122,9 @@ enclosure_component_register(struct enclosure_device *, unsigned int,
122 enum enclosure_component_type, const char *); 122 enum enclosure_component_type, const char *);
123int enclosure_add_device(struct enclosure_device *enclosure, int component, 123int enclosure_add_device(struct enclosure_device *enclosure, int component,
124 struct device *dev); 124 struct device *dev);
125int enclosure_remove_device(struct enclosure_device *enclosure, int component); 125int enclosure_remove_device(struct enclosure_device *, struct device *);
126struct enclosure_device *enclosure_find(struct device *dev); 126struct enclosure_device *enclosure_find(struct device *dev,
127 struct enclosure_device *start);
127int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *), 128int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
128 void *data); 129 void *data);
129 130
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 9b660bd2e2b3..15e4eb713694 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -362,12 +362,25 @@ struct ethtool_rxnfc {
362 __u32 rule_locs[0]; 362 __u32 rule_locs[0];
363}; 363};
364 364
365#define ETHTOOL_FLASH_MAX_FILENAME 128
366enum ethtool_flash_op_type {
367 ETHTOOL_FLASH_ALL_REGIONS = 0,
368};
369
370/* for passing firmware flashing related parameters */
371struct ethtool_flash {
372 __u32 cmd;
373 __u32 region;
374 char data[ETHTOOL_FLASH_MAX_FILENAME];
375};
376
365#ifdef __KERNEL__ 377#ifdef __KERNEL__
366 378
367struct net_device; 379struct net_device;
368 380
369/* Some generic methods drivers may use in their ethtool_ops */ 381/* Some generic methods drivers may use in their ethtool_ops */
370u32 ethtool_op_get_link(struct net_device *dev); 382u32 ethtool_op_get_link(struct net_device *dev);
383u32 ethtool_op_get_rx_csum(struct net_device *dev);
371u32 ethtool_op_get_tx_csum(struct net_device *dev); 384u32 ethtool_op_get_tx_csum(struct net_device *dev);
372int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 385int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
373int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 386int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
@@ -488,6 +501,7 @@ struct ethtool_ops {
488 int (*get_stats_count)(struct net_device *);/* use get_sset_count */ 501 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
489 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 502 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
490 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 503 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
504 int (*flash_device)(struct net_device *, struct ethtool_flash *);
491}; 505};
492#endif /* __KERNEL__ */ 506#endif /* __KERNEL__ */
493 507
@@ -544,6 +558,7 @@ struct ethtool_ops {
544#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 558#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
545#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 559#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
546#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 560#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
561#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
547 562
548/* compatibility with older code */ 563/* compatibility with older code */
549#define SPARC_ETH_GSET ETHTOOL_GSET 564#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 3b85ba6479f4..94dd10366a78 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -27,6 +27,7 @@
27 27
28#ifdef CONFIG_EVENTFD 28#ifdef CONFIG_EVENTFD
29 29
30struct file *eventfd_file_create(unsigned int count, int flags);
30struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx); 31struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx);
31void eventfd_ctx_put(struct eventfd_ctx *ctx); 32void eventfd_ctx_put(struct eventfd_ctx *ctx);
32struct file *eventfd_fget(int fd); 33struct file *eventfd_fget(int fd);
@@ -40,6 +41,11 @@ int eventfd_signal(struct eventfd_ctx *ctx, int n);
40 * Ugly ugly ugly error layer to support modules that uses eventfd but 41 * Ugly ugly ugly error layer to support modules that uses eventfd but
41 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO. 42 * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
42 */ 43 */
44static inline struct file *eventfd_file_create(unsigned int count, int flags)
45{
46 return ERR_PTR(-ENOSYS);
47}
48
43static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd) 49static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
44{ 50{
45 return ERR_PTR(-ENOSYS); 51 return ERR_PTR(-ENOSYS);
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index ca1bfe90004f..93e7428156ba 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -137,6 +137,14 @@ struct ext3_inode_info {
137 * by other means, so we have truncate_mutex. 137 * by other means, so we have truncate_mutex.
138 */ 138 */
139 struct mutex truncate_mutex; 139 struct mutex truncate_mutex;
140
141 /*
142 * Transactions that contain inode's metadata needed to complete
143 * fsync and fdatasync, respectively.
144 */
145 atomic_t i_sync_tid;
146 atomic_t i_datasync_tid;
147
140 struct inode vfs_inode; 148 struct inode vfs_inode;
141}; 149};
142 150
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f847df9e99b6..de9c722e7b90 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -133,6 +133,7 @@ struct dentry;
133#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */ 133#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */
134#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */ 134#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */
135#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */ 135#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */
136#define FB_ACCEL_PXA3XX 99 /* PXA3xx */
136 137
137#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */ 138#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */
138#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */ 139#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */
@@ -668,12 +669,6 @@ struct fb_ops {
668 /* perform fb specific mmap */ 669 /* perform fb specific mmap */
669 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma); 670 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
670 671
671 /* save current hardware state */
672 void (*fb_save_state)(struct fb_info *info);
673
674 /* restore saved state */
675 void (*fb_restore_state)(struct fb_info *info);
676
677 /* get capability given var */ 672 /* get capability given var */
678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, 673 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
679 struct fb_var_screeninfo *var); 674 struct fb_var_screeninfo *var);
diff --git a/include/linux/fips.h b/include/linux/fips.h
new file mode 100644
index 000000000000..f8fb07b0b6b8
--- /dev/null
+++ b/include/linux/fips.h
@@ -0,0 +1,10 @@
1#ifndef _FIPS_H
2#define _FIPS_H
3
4#ifdef CONFIG_CRYPTO_FIPS
5extern int fips_enabled;
6#else
7#define fips_enabled 0
8#endif
9
10#endif
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 192d1e43c43c..7e1d4dec83e7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -134,20 +134,6 @@ struct fw_card {
134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 134 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
135}; 135};
136 136
137static inline struct fw_card *fw_card_get(struct fw_card *card)
138{
139 kref_get(&card->kref);
140
141 return card;
142}
143
144void fw_card_release(struct kref *kref);
145
146static inline void fw_card_put(struct fw_card *card)
147{
148 kref_put(&card->kref, fw_card_release);
149}
150
151struct fw_attribute_group { 137struct fw_attribute_group {
152 struct attribute_group *groups[2]; 138 struct attribute_group *groups[2];
153 struct attribute_group group; 139 struct attribute_group group;
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 45ff18491514..1d747f72298b 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -31,10 +31,32 @@ struct flex_array {
31 }; 31 };
32}; 32};
33 33
34#define FLEX_ARRAY_INIT(size, total) { { {\ 34/* Number of bytes left in base struct flex_array, excluding metadata */
35 .element_size = (size), \ 35#define FLEX_ARRAY_BASE_BYTES_LEFT \
36 .total_nr_elements = (total), \ 36 (FLEX_ARRAY_BASE_SIZE - offsetof(struct flex_array, parts))
37} } } 37
38/* Number of pointers in base to struct flex_array_part pages */
39#define FLEX_ARRAY_NR_BASE_PTRS \
40 (FLEX_ARRAY_BASE_BYTES_LEFT / sizeof(struct flex_array_part *))
41
42/* Number of elements of size that fit in struct flex_array_part */
43#define FLEX_ARRAY_ELEMENTS_PER_PART(size) \
44 (FLEX_ARRAY_PART_SIZE / size)
45
46/*
47 * Defines a statically allocated flex array and ensures its parameters are
48 * valid.
49 */
50#define DEFINE_FLEX_ARRAY(__arrayname, __element_size, __total) \
51 struct flex_array __arrayname = { { { \
52 .element_size = (__element_size), \
53 .total_nr_elements = (__total), \
54 } } }; \
55 static inline void __arrayname##_invalid_parameter(void) \
56 { \
57 BUILD_BUG_ON((__total) > FLEX_ARRAY_NR_BASE_PTRS * \
58 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
59 }
38 60
39struct flex_array *flex_array_alloc(int element_size, unsigned int total, 61struct flex_array *flex_array_alloc(int element_size, unsigned int total,
40 gfp_t flags); 62 gfp_t flags);
@@ -44,6 +66,8 @@ void flex_array_free(struct flex_array *fa);
44void flex_array_free_parts(struct flex_array *fa); 66void flex_array_free_parts(struct flex_array *fa);
45int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, 67int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
46 gfp_t flags); 68 gfp_t flags);
69int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
47void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa);
48 72
49#endif /* _FLEX_ARRAY_H */ 73#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 73e9b643e455..2620a8c63571 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -161,8 +161,8 @@ struct inodes_stat_t {
161 * These aren't really reads or writes, they pass down information about 161 * These aren't really reads or writes, they pass down information about
162 * parts of device that are now unused by the file system. 162 * parts of device that are now unused by the file system.
163 */ 163 */
164#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 164#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD))
165#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 165#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER))
166 166
167#define SEL_IN 1 167#define SEL_IN 1
168#define SEL_OUT 2 168#define SEL_OUT 2
@@ -300,6 +300,10 @@ struct inodes_stat_t {
300#define BLKTRACESTOP _IO(0x12,117) 300#define BLKTRACESTOP _IO(0x12,117)
301#define BLKTRACETEARDOWN _IO(0x12,118) 301#define BLKTRACETEARDOWN _IO(0x12,118)
302#define BLKDISCARD _IO(0x12,119) 302#define BLKDISCARD _IO(0x12,119)
303#define BLKIOMIN _IO(0x12,120)
304#define BLKIOOPT _IO(0x12,121)
305#define BLKALIGNOFF _IO(0x12,122)
306#define BLKPBSZGET _IO(0x12,123)
303 307
304#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 308#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
305#define FIBMAP _IO(0x00,1) /* bmap access */ 309#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -595,6 +599,7 @@ struct address_space_operations {
595 int (*launder_page) (struct page *); 599 int (*launder_page) (struct page *);
596 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 600 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
597 unsigned long); 601 unsigned long);
602 int (*error_remove_page)(struct address_space *, struct page *);
598}; 603};
599 604
600/* 605/*
@@ -640,7 +645,6 @@ struct block_device {
640 struct super_block * bd_super; 645 struct super_block * bd_super;
641 int bd_openers; 646 int bd_openers;
642 struct mutex bd_mutex; /* open/close mutex */ 647 struct mutex bd_mutex; /* open/close mutex */
643 struct semaphore bd_mount_sem;
644 struct list_head bd_inodes; 648 struct list_head bd_inodes;
645 void * bd_holder; 649 void * bd_holder;
646 int bd_holders; 650 int bd_holders;
@@ -655,7 +659,6 @@ struct block_device {
655 int bd_invalidated; 659 int bd_invalidated;
656 struct gendisk * bd_disk; 660 struct gendisk * bd_disk;
657 struct list_head bd_list; 661 struct list_head bd_list;
658 struct backing_dev_info *bd_inode_backing_dev_info;
659 /* 662 /*
660 * Private data. You must have bd_claim'ed the block_device 663 * Private data. You must have bd_claim'ed the block_device
661 * to use this. NOTE: bd_claim allows an owner to claim 664 * to use this. NOTE: bd_claim allows an owner to claim
@@ -715,7 +718,7 @@ struct posix_acl;
715 718
716struct inode { 719struct inode {
717 struct hlist_node i_hash; 720 struct hlist_node i_hash;
718 struct list_head i_list; 721 struct list_head i_list; /* backing dev IO list */
719 struct list_head i_sb_list; 722 struct list_head i_sb_list;
720 struct list_head i_dentry; 723 struct list_head i_dentry;
721 unsigned long i_ino; 724 unsigned long i_ino;
@@ -1067,8 +1070,8 @@ struct file_lock {
1067 struct fasync_struct * fl_fasync; /* for lease break notifications */ 1070 struct fasync_struct * fl_fasync; /* for lease break notifications */
1068 unsigned long fl_break_time; /* for nonblocking lease breaks */ 1071 unsigned long fl_break_time; /* for nonblocking lease breaks */
1069 1072
1070 struct file_lock_operations *fl_ops; /* Callbacks for filesystems */ 1073 const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
1071 struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 1074 const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
1072 union { 1075 union {
1073 struct nfs_lock_info nfs_fl; 1076 struct nfs_lock_info nfs_fl;
1074 struct nfs4_lock_info nfs4_fl; 1077 struct nfs4_lock_info nfs4_fl;
@@ -1316,11 +1319,11 @@ struct super_block {
1316 unsigned long s_blocksize; 1319 unsigned long s_blocksize;
1317 unsigned char s_blocksize_bits; 1320 unsigned char s_blocksize_bits;
1318 unsigned char s_dirt; 1321 unsigned char s_dirt;
1319 unsigned long long s_maxbytes; /* Max file size */ 1322 loff_t s_maxbytes; /* Max file size */
1320 struct file_system_type *s_type; 1323 struct file_system_type *s_type;
1321 const struct super_operations *s_op; 1324 const struct super_operations *s_op;
1322 struct dquot_operations *dq_op; 1325 const struct dquot_operations *dq_op;
1323 struct quotactl_ops *s_qcop; 1326 const struct quotactl_ops *s_qcop;
1324 const struct export_operations *s_export_op; 1327 const struct export_operations *s_export_op;
1325 unsigned long s_flags; 1328 unsigned long s_flags;
1326 unsigned long s_magic; 1329 unsigned long s_magic;
@@ -1336,9 +1339,6 @@ struct super_block {
1336 struct xattr_handler **s_xattr; 1339 struct xattr_handler **s_xattr;
1337 1340
1338 struct list_head s_inodes; /* all inodes */ 1341 struct list_head s_inodes; /* all inodes */
1339 struct list_head s_dirty; /* dirty inodes */
1340 struct list_head s_io; /* parked for writeback */
1341 struct list_head s_more_io; /* parked for more writeback */
1342 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1342 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1343 struct list_head s_files; 1343 struct list_head s_files;
1344 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1344 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
@@ -1346,6 +1346,7 @@ struct super_block {
1346 int s_nr_dentry_unused; /* # of dentry on lru */ 1346 int s_nr_dentry_unused; /* # of dentry on lru */
1347 1347
1348 struct block_device *s_bdev; 1348 struct block_device *s_bdev;
1349 struct backing_dev_info *s_bdi;
1349 struct mtd_info *s_mtd; 1350 struct mtd_info *s_mtd;
1350 struct list_head s_instances; 1351 struct list_head s_instances;
1351 struct quota_info s_dquot; /* Diskquota specific options */ 1352 struct quota_info s_dquot; /* Diskquota specific options */
@@ -1458,11 +1459,6 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1458#define DT_SOCK 12 1459#define DT_SOCK 12
1459#define DT_WHT 14 1460#define DT_WHT 14
1460 1461
1461#define OSYNC_METADATA (1<<0)
1462#define OSYNC_DATA (1<<1)
1463#define OSYNC_INODE (1<<2)
1464int generic_osync_inode(struct inode *, struct address_space *, int);
1465
1466/* 1462/*
1467 * This is the "filldir" function type, used by readdir() to let 1463 * This is the "filldir" function type, used by readdir() to let
1468 * the kernel specify what kind of dirent layout it wants to have. 1464 * the kernel specify what kind of dirent layout it wants to have.
@@ -1528,6 +1524,7 @@ struct inode_operations {
1528 void (*put_link) (struct dentry *, struct nameidata *, void *); 1524 void (*put_link) (struct dentry *, struct nameidata *, void *);
1529 void (*truncate) (struct inode *); 1525 void (*truncate) (struct inode *);
1530 int (*permission) (struct inode *, int); 1526 int (*permission) (struct inode *, int);
1527 int (*check_acl)(struct inode *, int);
1531 int (*setattr) (struct dentry *, struct iattr *); 1528 int (*setattr) (struct dentry *, struct iattr *);
1532 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1529 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1533 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1530 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1788,6 +1785,7 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1788 struct vfsmount *mnt); 1785 struct vfsmount *mnt);
1789extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1786extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1790int __put_super_and_need_restart(struct super_block *sb); 1787int __put_super_and_need_restart(struct super_block *sb);
1788void put_super(struct super_block *sb);
1791 1789
1792/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1790/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1793#define fops_get(fops) \ 1791#define fops_get(fops) \
@@ -1998,12 +1996,25 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1998#define CHRDEV_MAJOR_HASH_SIZE 255 1996#define CHRDEV_MAJOR_HASH_SIZE 255
1999extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); 1997extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
2000extern int register_chrdev_region(dev_t, unsigned, const char *); 1998extern int register_chrdev_region(dev_t, unsigned, const char *);
2001extern int register_chrdev(unsigned int, const char *, 1999extern int __register_chrdev(unsigned int major, unsigned int baseminor,
2002 const struct file_operations *); 2000 unsigned int count, const char *name,
2003extern void unregister_chrdev(unsigned int, const char *); 2001 const struct file_operations *fops);
2002extern void __unregister_chrdev(unsigned int major, unsigned int baseminor,
2003 unsigned int count, const char *name);
2004extern void unregister_chrdev_region(dev_t, unsigned); 2004extern void unregister_chrdev_region(dev_t, unsigned);
2005extern void chrdev_show(struct seq_file *,off_t); 2005extern void chrdev_show(struct seq_file *,off_t);
2006 2006
2007static inline int register_chrdev(unsigned int major, const char *name,
2008 const struct file_operations *fops)
2009{
2010 return __register_chrdev(major, 0, 256, name, fops);
2011}
2012
2013static inline void unregister_chrdev(unsigned int major, const char *name)
2014{
2015 __unregister_chrdev(major, 0, 256, name);
2016}
2017
2007/* fs/block_dev.c */ 2018/* fs/block_dev.c */
2008#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 2019#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
2009#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ 2020#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */
@@ -2070,12 +2081,12 @@ static inline void invalidate_remote_inode(struct inode *inode)
2070extern int invalidate_inode_pages2(struct address_space *mapping); 2081extern int invalidate_inode_pages2(struct address_space *mapping);
2071extern int invalidate_inode_pages2_range(struct address_space *mapping, 2082extern int invalidate_inode_pages2_range(struct address_space *mapping,
2072 pgoff_t start, pgoff_t end); 2083 pgoff_t start, pgoff_t end);
2073extern void generic_sync_sb_inodes(struct super_block *sb,
2074 struct writeback_control *wbc);
2075extern int write_inode_now(struct inode *, int); 2084extern int write_inode_now(struct inode *, int);
2076extern int filemap_fdatawrite(struct address_space *); 2085extern int filemap_fdatawrite(struct address_space *);
2077extern int filemap_flush(struct address_space *); 2086extern int filemap_flush(struct address_space *);
2078extern int filemap_fdatawait(struct address_space *); 2087extern int filemap_fdatawait(struct address_space *);
2088extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
2089 loff_t lend);
2079extern int filemap_write_and_wait(struct address_space *mapping); 2090extern int filemap_write_and_wait(struct address_space *mapping);
2080extern int filemap_write_and_wait_range(struct address_space *mapping, 2091extern int filemap_write_and_wait_range(struct address_space *mapping,
2081 loff_t lstart, loff_t lend); 2092 loff_t lstart, loff_t lend);
@@ -2086,7 +2097,10 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2086extern int filemap_fdatawrite_range(struct address_space *mapping, 2097extern int filemap_fdatawrite_range(struct address_space *mapping,
2087 loff_t start, loff_t end); 2098 loff_t start, loff_t end);
2088 2099
2100extern int vfs_fsync_range(struct file *file, struct dentry *dentry,
2101 loff_t start, loff_t end, int datasync);
2089extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2102extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
2103extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2090extern void sync_supers(void); 2104extern void sync_supers(void);
2091extern void emergency_sync(void); 2105extern void emergency_sync(void);
2092extern void emergency_remount(void); 2106extern void emergency_remount(void);
@@ -2146,6 +2160,7 @@ extern ino_t iunique(struct super_block *, ino_t);
2146extern int inode_needs_sync(struct inode *inode); 2160extern int inode_needs_sync(struct inode *inode);
2147extern void generic_delete_inode(struct inode *inode); 2161extern void generic_delete_inode(struct inode *inode);
2148extern void generic_drop_inode(struct inode *inode); 2162extern void generic_drop_inode(struct inode *inode);
2163extern int generic_detach_inode(struct inode *inode);
2149 2164
2150extern struct inode *ilookup5_nowait(struct super_block *sb, 2165extern struct inode *ilookup5_nowait(struct super_block *sb,
2151 unsigned long hashval, int (*test)(struct inode *, void *), 2166 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2186,16 +2201,15 @@ extern int bdev_read_only(struct block_device *);
2186extern int set_blocksize(struct block_device *, int); 2201extern int set_blocksize(struct block_device *, int);
2187extern int sb_set_blocksize(struct super_block *, int); 2202extern int sb_set_blocksize(struct super_block *, int);
2188extern int sb_min_blocksize(struct super_block *, int); 2203extern int sb_min_blocksize(struct super_block *, int);
2189extern int sb_has_dirty_inodes(struct super_block *);
2190 2204
2191extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2205extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2192extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2206extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2193extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 2207extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2194int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2208int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2195extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2209extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2210extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long,
2211 loff_t *);
2196extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2212extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2197extern ssize_t generic_file_aio_write_nolock(struct kiocb *, const struct iovec *,
2198 unsigned long, loff_t);
2199extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2213extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
2200 unsigned long *, loff_t, loff_t *, size_t, size_t); 2214 unsigned long *, loff_t, loff_t *, size_t, size_t);
2201extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, 2215extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *,
@@ -2205,6 +2219,10 @@ extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t l
2205extern int generic_segment_checks(const struct iovec *iov, 2219extern int generic_segment_checks(const struct iovec *iov,
2206 unsigned long *nr_segs, size_t *count, int access_flags); 2220 unsigned long *nr_segs, size_t *count, int access_flags);
2207 2221
2222/* fs/block_dev.c */
2223extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2224 unsigned long nr_segs, loff_t pos);
2225
2208/* fs/splice.c */ 2226/* fs/splice.c */
2209extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2227extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2210 struct pipe_inode_info *, size_t, unsigned int); 2228 struct pipe_inode_info *, size_t, unsigned int);
@@ -2321,6 +2339,7 @@ extern void get_filesystem(struct file_system_type *fs);
2321extern void put_filesystem(struct file_system_type *fs); 2339extern void put_filesystem(struct file_system_type *fs);
2322extern struct file_system_type *get_fs_type(const char *name); 2340extern struct file_system_type *get_fs_type(const char *name);
2323extern struct super_block *get_super(struct block_device *); 2341extern struct super_block *get_super(struct block_device *);
2342extern struct super_block *get_active_super(struct block_device *bdev);
2324extern struct super_block *user_get_super(dev_t); 2343extern struct super_block *user_get_super(dev_t);
2325extern void drop_super(struct super_block *sb); 2344extern void drop_super(struct super_block *sb);
2326 2345
@@ -2368,7 +2387,8 @@ extern int buffer_migrate_page(struct address_space *,
2368#define buffer_migrate_page NULL 2387#define buffer_migrate_page NULL
2369#endif 2388#endif
2370 2389
2371extern int inode_change_ok(struct inode *, struct iattr *); 2390extern int inode_change_ok(const struct inode *, struct iattr *);
2391extern int inode_newsize_ok(const struct inode *, loff_t offset);
2372extern int __must_check inode_setattr(struct inode *, struct iattr *); 2392extern int __must_check inode_setattr(struct inode *, struct iattr *);
2373 2393
2374extern void file_update_time(struct file *file); 2394extern void file_update_time(struct file *file);
@@ -2430,7 +2450,7 @@ static int __fops ## _open(struct inode *inode, struct file *file) \
2430 __simple_attr_check_format(__fmt, 0ull); \ 2450 __simple_attr_check_format(__fmt, 0ull); \
2431 return simple_attr_open(inode, file, __get, __set, __fmt); \ 2451 return simple_attr_open(inode, file, __get, __set, __fmt); \
2432} \ 2452} \
2433static struct file_operations __fops = { \ 2453static const struct file_operations __fops = { \
2434 .owner = THIS_MODULE, \ 2454 .owner = THIS_MODULE, \
2435 .open = __fops ## _open, \ 2455 .open = __fops ## _open, \
2436 .release = simple_attr_release, \ 2456 .release = simple_attr_release, \
@@ -2454,7 +2474,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2454 size_t len, loff_t *ppos); 2474 size_t len, loff_t *ppos);
2455 2475
2456struct ctl_table; 2476struct ctl_table;
2457int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2477int proc_nr_files(struct ctl_table *table, int write,
2458 void __user *buffer, size_t *lenp, loff_t *ppos); 2478 void __user *buffer, size_t *lenp, loff_t *ppos);
2459 2479
2460int __init get_filesystem_list(char *buf); 2480int __init get_filesystem_list(char *buf);
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 84d3532dd3ea..7be0c6fbe880 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -91,6 +91,8 @@ struct fscache_operation {
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */ 93#define FSCACHE_OP_DEAD 6 /* op is now dead */
94#define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */
95#define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */
94 96
95 atomic_t usage; 97 atomic_t usage;
96 unsigned debug_id; /* debugging ID */ 98 unsigned debug_id; /* debugging ID */
@@ -102,6 +104,16 @@ struct fscache_operation {
102 104
103 /* operation releaser */ 105 /* operation releaser */
104 fscache_operation_release_t release; 106 fscache_operation_release_t release;
107
108#ifdef CONFIG_SLOW_WORK_PROC
109 const char *name; /* operation name */
110 const char *state; /* operation state */
111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0)
112#define fscache_set_op_state(OP, S) do { (OP)->state = (S); } while(0)
113#else
114#define fscache_set_op_name(OP, N) do { } while(0)
115#define fscache_set_op_state(OP, S) do { } while(0)
116#endif
105}; 117};
106 118
107extern atomic_t fscache_op_debug_id; 119extern atomic_t fscache_op_debug_id;
@@ -125,6 +137,7 @@ static inline void fscache_operation_init(struct fscache_operation *op,
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 137 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->release = release; 138 op->release = release;
127 INIT_LIST_HEAD(&op->pend_link); 139 INIT_LIST_HEAD(&op->pend_link);
140 fscache_set_op_state(op, "Init");
128} 141}
129 142
130/** 143/**
@@ -221,8 +234,10 @@ struct fscache_cache_ops {
221 struct fscache_object *(*alloc_object)(struct fscache_cache *cache, 234 struct fscache_object *(*alloc_object)(struct fscache_cache *cache,
222 struct fscache_cookie *cookie); 235 struct fscache_cookie *cookie);
223 236
224 /* look up the object for a cookie */ 237 /* look up the object for a cookie
225 void (*lookup_object)(struct fscache_object *object); 238 * - return -ETIMEDOUT to be requeued
239 */
240 int (*lookup_object)(struct fscache_object *object);
226 241
227 /* finished looking up */ 242 /* finished looking up */
228 void (*lookup_complete)(struct fscache_object *object); 243 void (*lookup_complete)(struct fscache_object *object);
@@ -297,12 +312,14 @@ struct fscache_cookie {
297 atomic_t usage; /* number of users of this cookie */ 312 atomic_t usage; /* number of users of this cookie */
298 atomic_t n_children; /* number of children of this cookie */ 313 atomic_t n_children; /* number of children of this cookie */
299 spinlock_t lock; 314 spinlock_t lock;
315 spinlock_t stores_lock; /* lock on page store tree */
300 struct hlist_head backing_objects; /* object(s) backing this file/index */ 316 struct hlist_head backing_objects; /* object(s) backing this file/index */
301 const struct fscache_cookie_def *def; /* definition */ 317 const struct fscache_cookie_def *def; /* definition */
302 struct fscache_cookie *parent; /* parent of this entry */ 318 struct fscache_cookie *parent; /* parent of this entry */
303 void *netfs_data; /* back pointer to netfs */ 319 void *netfs_data; /* back pointer to netfs */
304 struct radix_tree_root stores; /* pages to be stored on this cookie */ 320 struct radix_tree_root stores; /* pages to be stored on this cookie */
305#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */ 321#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
322#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
306 323
307 unsigned long flags; 324 unsigned long flags;
308#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ 325#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
@@ -337,6 +354,7 @@ struct fscache_object {
337 FSCACHE_OBJECT_RECYCLING, /* retiring object */ 354 FSCACHE_OBJECT_RECYCLING, /* retiring object */
338 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */ 355 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
339 FSCACHE_OBJECT_DEAD, /* object is now dead */ 356 FSCACHE_OBJECT_DEAD, /* object is now dead */
357 FSCACHE_OBJECT__NSTATES
340 } state; 358 } state;
341 359
342 int debug_id; /* debugging ID */ 360 int debug_id; /* debugging ID */
@@ -345,6 +363,7 @@ struct fscache_object {
345 int n_obj_ops; /* number of object ops outstanding on object */ 363 int n_obj_ops; /* number of object ops outstanding on object */
346 int n_in_progress; /* number of ops in progress */ 364 int n_in_progress; /* number of ops in progress */
347 int n_exclusive; /* number of exclusive ops queued */ 365 int n_exclusive; /* number of exclusive ops queued */
366 atomic_t n_reads; /* number of read ops in progress */
348 spinlock_t lock; /* state and operations lock */ 367 spinlock_t lock; /* state and operations lock */
349 368
350 unsigned long lookup_jif; /* time at which lookup started */ 369 unsigned long lookup_jif; /* time at which lookup started */
@@ -358,6 +377,7 @@ struct fscache_object {
358#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */ 377#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
359#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */ 378#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
360#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */ 379#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
380#define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/
361 381
362 unsigned long flags; 382 unsigned long flags;
363#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 383#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
@@ -373,7 +393,11 @@ struct fscache_object {
373 struct list_head dependents; /* FIFO of dependent objects */ 393 struct list_head dependents; /* FIFO of dependent objects */
374 struct list_head dep_link; /* link in parent's dependents list */ 394 struct list_head dep_link; /* link in parent's dependents list */
375 struct list_head pending_ops; /* unstarted operations on this object */ 395 struct list_head pending_ops; /* unstarted operations on this object */
396#ifdef CONFIG_FSCACHE_OBJECT_LIST
397 struct rb_node objlist_link; /* link in global object list */
398#endif
376 pgoff_t store_limit; /* current storage limit */ 399 pgoff_t store_limit; /* current storage limit */
400 loff_t store_limit_l; /* current storage limit */
377}; 401};
378 402
379extern const char *fscache_object_states[]; 403extern const char *fscache_object_states[];
@@ -383,6 +407,10 @@ extern const char *fscache_object_states[];
383 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \ 407 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
384 (obj)->state < FSCACHE_OBJECT_DYING) 408 (obj)->state < FSCACHE_OBJECT_DYING)
385 409
410#define fscache_object_is_dead(obj) \
411 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
412 (obj)->state >= FSCACHE_OBJECT_DYING)
413
386extern const struct slow_work_ops fscache_object_slow_work_ops; 414extern const struct slow_work_ops fscache_object_slow_work_ops;
387 415
388/** 416/**
@@ -414,6 +442,7 @@ void fscache_object_init(struct fscache_object *object,
414 object->events = object->event_mask = 0; 442 object->events = object->event_mask = 0;
415 object->flags = 0; 443 object->flags = 0;
416 object->store_limit = 0; 444 object->store_limit = 0;
445 object->store_limit_l = 0;
417 object->cache = cache; 446 object->cache = cache;
418 object->cookie = cookie; 447 object->cookie = cookie;
419 object->parent = NULL; 448 object->parent = NULL;
@@ -422,6 +451,12 @@ void fscache_object_init(struct fscache_object *object,
422extern void fscache_object_lookup_negative(struct fscache_object *object); 451extern void fscache_object_lookup_negative(struct fscache_object *object);
423extern void fscache_obtained_object(struct fscache_object *object); 452extern void fscache_obtained_object(struct fscache_object *object);
424 453
454#ifdef CONFIG_FSCACHE_OBJECT_LIST
455extern void fscache_object_destroy(struct fscache_object *object);
456#else
457#define fscache_object_destroy(object) do {} while(0)
458#endif
459
425/** 460/**
426 * fscache_object_destroyed - Note destruction of an object in a cache 461 * fscache_object_destroyed - Note destruction of an object in a cache
427 * @cache: The cache from which the object came 462 * @cache: The cache from which the object came
@@ -460,6 +495,7 @@ static inline void fscache_object_lookup_error(struct fscache_object *object)
460static inline 495static inline
461void fscache_set_store_limit(struct fscache_object *object, loff_t i_size) 496void fscache_set_store_limit(struct fscache_object *object, loff_t i_size)
462{ 497{
498 object->store_limit_l = i_size;
463 object->store_limit = i_size >> PAGE_SHIFT; 499 object->store_limit = i_size >> PAGE_SHIFT;
464 if (i_size & ~PAGE_MASK) 500 if (i_size & ~PAGE_MASK)
465 object->store_limit++; 501 object->store_limit++;
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 6d8ee466e0a0..595ce49288b7 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -202,6 +202,8 @@ extern int __fscache_write_page(struct fscache_cookie *, struct page *, gfp_t);
202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *); 202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *);
203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *); 203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *); 204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
205extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
206 gfp_t);
205 207
206/** 208/**
207 * fscache_register_netfs - Register a filesystem as desiring caching services 209 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -615,4 +617,29 @@ void fscache_wait_on_page_write(struct fscache_cookie *cookie,
615 __fscache_wait_on_page_write(cookie, page); 617 __fscache_wait_on_page_write(cookie, page);
616} 618}
617 619
620/**
621 * fscache_maybe_release_page - Consider releasing a page, cancelling a store
622 * @cookie: The cookie representing the cache object
623 * @page: The netfs page that is being cached.
624 * @gfp: The gfp flags passed to releasepage()
625 *
626 * Consider releasing a page for the vmscan algorithm, on behalf of the netfs's
627 * releasepage() call. A storage request on the page may cancelled if it is
628 * not currently being processed.
629 *
630 * The function returns true if the page no longer has a storage request on it,
631 * and false if a storage request is left in place. If true is returned, the
632 * page will have been passed to fscache_uncache_page(). If false is returned
633 * the page cannot be freed yet.
634 */
635static inline
636bool fscache_maybe_release_page(struct fscache_cookie *cookie,
637 struct page *page,
638 gfp_t gfp)
639{
640 if (fscache_cookie_valid(cookie) && PageFsCache(page))
641 return __fscache_maybe_release_page(cookie, page, gfp);
642 return false;
643}
644
618#endif /* _LINUX_FSCACHE_H */ 645#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index dc3b1328aaeb..0b4f97d24d7f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -19,7 +19,7 @@
19extern int ftrace_enabled; 19extern int ftrace_enabled;
20extern int 20extern int
21ftrace_enable_sysctl(struct ctl_table *table, int write, 21ftrace_enable_sysctl(struct ctl_table *table, int write,
22 struct file *filp, void __user *buffer, size_t *lenp, 22 void __user *buffer, size_t *lenp,
23 loff_t *ppos); 23 loff_t *ppos);
24 24
25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 25typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
@@ -94,7 +94,7 @@ static inline void ftrace_start(void) { }
94extern int stack_tracer_enabled; 94extern int stack_tracer_enabled;
95int 95int
96stack_trace_sysctl(struct ctl_table *table, int write, 96stack_trace_sysctl(struct ctl_table *table, int write,
97 struct file *file, void __user *buffer, size_t *lenp, 97 void __user *buffer, size_t *lenp,
98 loff_t *ppos); 98 loff_t *ppos);
99#endif 99#endif
100 100
@@ -241,7 +241,7 @@ extern void ftrace_enable_daemon(void);
241# define ftrace_set_filter(buf, len, reset) do { } while (0) 241# define ftrace_set_filter(buf, len, reset) do { } while (0)
242# define ftrace_disable_daemon() do { } while (0) 242# define ftrace_disable_daemon() do { } while (0)
243# define ftrace_enable_daemon() do { } while (0) 243# define ftrace_enable_daemon() do { } while (0)
244static inline void ftrace_release(void *start, unsigned long size) { } 244static inline void ftrace_release_mod(struct module *mod) {}
245static inline int register_ftrace_command(struct ftrace_func_command *cmd) 245static inline int register_ftrace_command(struct ftrace_func_command *cmd)
246{ 246{
247 return -EINVAL; 247 return -EINVAL;
@@ -446,7 +446,6 @@ static inline void unpause_graph_tracing(void) { }
446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 446#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
447 447
448#ifdef CONFIG_TRACING 448#ifdef CONFIG_TRACING
449#include <linux/sched.h>
450 449
451/* flags for current->trace */ 450/* flags for current->trace */
452enum { 451enum {
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index a81170de7f6b..4ec5e67e18cf 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_FTRACE_EVENT_H 1#ifndef _LINUX_FTRACE_EVENT_H
2#define _LINUX_FTRACE_EVENT_H 2#define _LINUX_FTRACE_EVENT_H
3 3
4#include <linux/trace_seq.h>
5#include <linux/ring_buffer.h> 4#include <linux/ring_buffer.h>
5#include <linux/trace_seq.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/hardirq.h>
7 8
8struct trace_array; 9struct trace_array;
9struct tracer; 10struct tracer;
@@ -34,7 +35,7 @@ struct trace_entry {
34 unsigned char flags; 35 unsigned char flags;
35 unsigned char preempt_count; 36 unsigned char preempt_count;
36 int pid; 37 int pid;
37 int tgid; 38 int lock_depth;
38}; 39};
39 40
40#define FTRACE_MAX_EVENT \ 41#define FTRACE_MAX_EVENT \
@@ -93,16 +94,22 @@ void tracing_generic_entry_update(struct trace_entry *entry,
93 unsigned long flags, 94 unsigned long flags,
94 int pc); 95 int pc);
95struct ring_buffer_event * 96struct ring_buffer_event *
96trace_current_buffer_lock_reserve(int type, unsigned long len, 97trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
98 int type, unsigned long len,
97 unsigned long flags, int pc); 99 unsigned long flags, int pc);
98void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, 100void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
101 struct ring_buffer_event *event,
99 unsigned long flags, int pc); 102 unsigned long flags, int pc);
100void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event, 103void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer,
104 struct ring_buffer_event *event,
101 unsigned long flags, int pc); 105 unsigned long flags, int pc);
102void trace_current_buffer_discard_commit(struct ring_buffer_event *event); 106void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
107 struct ring_buffer_event *event);
103 108
104void tracing_record_cmdline(struct task_struct *tsk); 109void tracing_record_cmdline(struct task_struct *tsk);
105 110
111struct event_filter;
112
106struct ftrace_event_call { 113struct ftrace_event_call {
107 struct list_head list; 114 struct list_head list;
108 char *name; 115 char *name;
@@ -110,34 +117,51 @@ struct ftrace_event_call {
110 struct dentry *dir; 117 struct dentry *dir;
111 struct trace_event *event; 118 struct trace_event *event;
112 int enabled; 119 int enabled;
113 int (*regfunc)(void); 120 int (*regfunc)(void *);
114 void (*unregfunc)(void); 121 void (*unregfunc)(void *);
115 int id; 122 int id;
116 int (*raw_init)(void); 123 int (*raw_init)(void);
117 int (*show_format)(struct trace_seq *s); 124 int (*show_format)(struct ftrace_event_call *call,
118 int (*define_fields)(void); 125 struct trace_seq *s);
126 int (*define_fields)(struct ftrace_event_call *);
119 struct list_head fields; 127 struct list_head fields;
120 int filter_active; 128 int filter_active;
121 void *filter; 129 struct event_filter *filter;
122 void *mod; 130 void *mod;
131 void *data;
123 132
124 atomic_t profile_count; 133 atomic_t profile_count;
125 int (*profile_enable)(struct ftrace_event_call *); 134 int (*profile_enable)(void);
126 void (*profile_disable)(struct ftrace_event_call *); 135 void (*profile_disable)(void);
127}; 136};
128 137
138#define FTRACE_MAX_PROFILE_SIZE 2048
139
140extern char *trace_profile_buf;
141extern char *trace_profile_buf_nmi;
142
129#define MAX_FILTER_PRED 32 143#define MAX_FILTER_PRED 32
130#define MAX_FILTER_STR_VAL 128 144#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
131 145
132extern int init_preds(struct ftrace_event_call *call);
133extern void destroy_preds(struct ftrace_event_call *call); 146extern void destroy_preds(struct ftrace_event_call *call);
134extern int filter_match_preds(struct ftrace_event_call *call, void *rec); 147extern int filter_match_preds(struct ftrace_event_call *call, void *rec);
135extern int filter_current_check_discard(struct ftrace_event_call *call, 148extern int filter_current_check_discard(struct ring_buffer *buffer,
149 struct ftrace_event_call *call,
136 void *rec, 150 void *rec,
137 struct ring_buffer_event *event); 151 struct ring_buffer_event *event);
138 152
139extern int trace_define_field(struct ftrace_event_call *call, char *type, 153enum {
140 char *name, int offset, int size, int is_signed); 154 FILTER_OTHER = 0,
155 FILTER_STATIC_STRING,
156 FILTER_DYN_STRING,
157 FILTER_PTR_STRING,
158};
159
160extern int trace_define_field(struct ftrace_event_call *call,
161 const char *type, const char *name,
162 int offset, int size, int is_signed,
163 int filter_type);
164extern int trace_define_common_fields(struct ftrace_event_call *call);
141 165
142#define is_signed_type(type) (((type)(-1)) < 0) 166#define is_signed_type(type) (((type)(-1)) < 0)
143 167
@@ -162,11 +186,4 @@ do { \
162 __trace_printk(ip, fmt, ##args); \ 186 __trace_printk(ip, fmt, ##args); \
163} while (0) 187} while (0)
164 188
165#define __common_field(type, item, is_signed) \
166 ret = trace_define_field(event_call, #type, "common_" #item, \
167 offsetof(typeof(field.ent), item), \
168 sizeof(field.ent.item), is_signed); \
169 if (ret) \
170 return ret;
171
172#endif /* _LINUX_FTRACE_EVENT_H */ 189#endif /* _LINUX_FTRACE_EVENT_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index cf593bf9fd32..3e2925a34bf0 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -30,6 +30,10 @@
30 * - add umask flag to input argument of open, mknod and mkdir 30 * - add umask flag to input argument of open, mknod and mkdir
31 * - add notification messages for invalidation of inodes and 31 * - add notification messages for invalidation of inodes and
32 * directory entries 32 * directory entries
33 *
34 * 7.13
35 * - make max number of background requests and congestion threshold
36 * tunables
33 */ 37 */
34 38
35#ifndef _LINUX_FUSE_H 39#ifndef _LINUX_FUSE_H
@@ -37,11 +41,31 @@
37 41
38#include <linux/types.h> 42#include <linux/types.h>
39 43
44/*
45 * Version negotiation:
46 *
47 * Both the kernel and userspace send the version they support in the
48 * INIT request and reply respectively.
49 *
50 * If the major versions match then both shall use the smallest
51 * of the two minor versions for communication.
52 *
53 * If the kernel supports a larger major version, then userspace shall
54 * reply with the major version it supports, ignore the rest of the
55 * INIT message and expect a new INIT message from the kernel with a
56 * matching major version.
57 *
58 * If the library supports a larger major version, then it shall fall
59 * back to the major protocol version sent by the kernel for
60 * communication and reply with that major version (and an arbitrary
61 * supported minor version).
62 */
63
40/** Version number of this interface */ 64/** Version number of this interface */
41#define FUSE_KERNEL_VERSION 7 65#define FUSE_KERNEL_VERSION 7
42 66
43/** Minor version number of this interface */ 67/** Minor version number of this interface */
44#define FUSE_KERNEL_MINOR_VERSION 12 68#define FUSE_KERNEL_MINOR_VERSION 13
45 69
46/** The node ID of the root inode */ 70/** The node ID of the root inode */
47#define FUSE_ROOT_ID 1 71#define FUSE_ROOT_ID 1
@@ -427,7 +451,8 @@ struct fuse_init_out {
427 __u32 minor; 451 __u32 minor;
428 __u32 max_readahead; 452 __u32 max_readahead;
429 __u32 flags; 453 __u32 flags;
430 __u32 unused; 454 __u16 max_background;
455 __u16 congestion_threshold;
431 __u32 max_write; 456 __u32 max_write;
432}; 457};
433 458
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 34956c8fdebf..1e5a26d79232 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -4,11 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7struct inode;
8struct mm_struct;
9struct task_struct;
10union ktime;
11
12/* Second argument to futex syscall */ 7/* Second argument to futex syscall */
13 8
14 9
@@ -38,8 +33,8 @@ union ktime;
38#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) 33#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
39#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) 34#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
40#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) 35#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
41#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG) 36#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
42#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG) 37#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
43#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \ 38#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
44 FUTEX_PRIVATE_FLAG) 39 FUTEX_PRIVATE_FLAG)
45#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \ 40#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
@@ -129,6 +124,11 @@ struct robust_list_head {
129#define FUTEX_BITSET_MATCH_ANY 0xffffffff 124#define FUTEX_BITSET_MATCH_ANY 0xffffffff
130 125
131#ifdef __KERNEL__ 126#ifdef __KERNEL__
127struct inode;
128struct mm_struct;
129struct task_struct;
130union ktime;
131
132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, 132long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
133 u32 __user *uaddr2, u32 val2, u32 val3); 133 u32 __user *uaddr2, u32 val2, u32 val3);
134 134
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 45fc320a53c6..297df45ffd0a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -98,7 +98,7 @@ struct hd_struct {
98 int make_it_fail; 98 int make_it_fail;
99#endif 99#endif
100 unsigned long stamp; 100 unsigned long stamp;
101 int in_flight; 101 int in_flight[2];
102#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
103 struct disk_stats *dkstats; 103 struct disk_stats *dkstats;
104#else 104#else
@@ -142,7 +142,7 @@ struct gendisk {
142 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
143 143
144 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145 char *(*nodename)(struct gendisk *gd); 145 char *(*devnode)(struct gendisk *gd, mode_t *mode);
146 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
@@ -151,7 +151,7 @@ struct gendisk {
151 struct disk_part_tbl *part_tbl; 151 struct disk_part_tbl *part_tbl;
152 struct hd_struct part0; 152 struct hd_struct part0;
153 153
154 struct block_device_operations *fops; 154 const struct block_device_operations *fops;
155 struct request_queue *queue; 155 struct request_queue *queue;
156 void *private_data; 156 void *private_data;
157 157
@@ -322,18 +322,23 @@ static inline void free_part_stats(struct hd_struct *part)
322#define part_stat_sub(cpu, gendiskp, field, subnd) \ 322#define part_stat_sub(cpu, gendiskp, field, subnd) \
323 part_stat_add(cpu, gendiskp, field, -subnd) 323 part_stat_add(cpu, gendiskp, field, -subnd)
324 324
325static inline void part_inc_in_flight(struct hd_struct *part) 325static inline void part_inc_in_flight(struct hd_struct *part, int rw)
326{ 326{
327 part->in_flight++; 327 part->in_flight[rw]++;
328 if (part->partno) 328 if (part->partno)
329 part_to_disk(part)->part0.in_flight++; 329 part_to_disk(part)->part0.in_flight[rw]++;
330} 330}
331 331
332static inline void part_dec_in_flight(struct hd_struct *part) 332static inline void part_dec_in_flight(struct hd_struct *part, int rw)
333{ 333{
334 part->in_flight--; 334 part->in_flight[rw]--;
335 if (part->partno) 335 if (part->partno)
336 part_to_disk(part)->part0.in_flight--; 336 part_to_disk(part)->part0.in_flight[rw]--;
337}
338
339static inline int part_in_flight(struct hd_struct *part)
340{
341 return part->in_flight[0] + part->in_flight[1];
337} 342}
338 343
339/* block/blk-core.c */ 344/* block/blk-core.c */
@@ -546,6 +551,8 @@ extern ssize_t part_size_show(struct device *dev,
546 struct device_attribute *attr, char *buf); 551 struct device_attribute *attr, char *buf);
547extern ssize_t part_stat_show(struct device *dev, 552extern ssize_t part_stat_show(struct device *dev,
548 struct device_attribute *attr, char *buf); 553 struct device_attribute *attr, char *buf);
554extern ssize_t part_inflight_show(struct device *dev,
555 struct device_attribute *attr, char *buf);
549#ifdef CONFIG_FAIL_MAKE_REQUEST 556#ifdef CONFIG_FAIL_MAKE_REQUEST
550extern ssize_t part_fail_show(struct device *dev, 557extern ssize_t part_fail_show(struct device *dev,
551 struct device_attribute *attr, char *buf); 558 struct device_attribute *attr, char *buf);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 7c777a0da17a..557bdad320b6 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -220,7 +220,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
220 ((1 << ZONES_SHIFT) - 1); 220 ((1 << ZONES_SHIFT) - 1);
221 221
222 if (__builtin_constant_p(bit)) 222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 223 MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else { 224 else {
225#ifdef CONFIG_DEBUG_VM 225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
@@ -326,7 +326,6 @@ void free_pages_exact(void *virt, size_t size);
326extern void __free_pages(struct page *page, unsigned int order); 326extern void __free_pages(struct page *page, unsigned int order);
327extern void free_pages(unsigned long addr, unsigned int order); 327extern void free_pages(unsigned long addr, unsigned int order);
328extern void free_hot_page(struct page *page); 328extern void free_hot_page(struct page *page);
329extern void free_cold_page(struct page *page);
330 329
331#define __free_page(page) __free_pages((page), 0) 330#define __free_page(page) __free_pages((page), 0)
332#define free_page(addr) free_pages((addr),0) 331#define free_page(addr) free_pages((addr),0)
@@ -336,18 +335,6 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
336void drain_all_pages(void); 335void drain_all_pages(void);
337void drain_local_pages(void *dummy); 336void drain_local_pages(void *dummy);
338 337
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
351extern gfp_t gfp_allowed_mask; 338extern gfp_t gfp_allowed_mask;
352 339
353static inline void set_gfp_allowed_mask(gfp_t mask) 340static inline void set_gfp_allowed_mask(gfp_t mask)
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index c56b4bce56d0..b80c88dedbbb 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -333,6 +333,28 @@ struct gfs2_leaf {
333 333
334/* 334/*
335 * Extended attribute header format 335 * Extended attribute header format
336 *
337 * This works in a similar way to dirents. There is a fixed size header
338 * followed by a variable length section made up of the name and the
339 * associated data. In the case of a "stuffed" entry, the value is
340 * inline directly after the name, the ea_num_ptrs entry will be
341 * zero in that case. For non-"stuffed" entries, there will be
342 * a set of pointers (aligned to 8 byte boundary) to the block(s)
343 * containing the value.
344 *
345 * The blocks containing the values and the blocks containing the
346 * extended attribute headers themselves all start with the common
347 * metadata header. Each inode, if it has extended attributes, will
348 * have either a single block containing the extended attribute headers
349 * or a single indirect block pointing to blocks containing the
350 * extended attribure headers.
351 *
352 * The maximim size of the data part of an extended attribute is 64k
353 * so the number of blocks required depends upon block size. Since the
354 * block size also determines the number of pointers in an indirect
355 * block, its a fairly complicated calculation to work out the maximum
356 * number of blocks that an inode may have relating to extended attributes.
357 *
336 */ 358 */
337 359
338#define GFS2_EA_MAX_NAME_LEN 255 360#define GFS2_EA_MAX_NAME_LEN 255
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index e10c49a5b96e..059bd189d35d 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -12,6 +12,8 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15struct device;
16
15/* 17/*
16 * Some platforms don't support the GPIO programming interface. 18 * Some platforms don't support the GPIO programming interface.
17 * 19 *
@@ -89,6 +91,15 @@ static inline int gpio_export(unsigned gpio, bool direction_may_change)
89 return -EINVAL; 91 return -EINVAL;
90} 92}
91 93
94static inline int gpio_export_link(struct device *dev, const char *name,
95 unsigned gpio)
96{
97 /* GPIO can never have been exported */
98 WARN_ON(1);
99 return -EINVAL;
100}
101
102
92static inline void gpio_unexport(unsigned gpio) 103static inline void gpio_unexport(unsigned gpio)
93{ 104{
94 /* GPIO can never have been exported */ 105 /* GPIO can never have been exported */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8246c697863d..6d527ee82b2b 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -64,6 +64,12 @@
64#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) 64#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
65#define NMI_OFFSET (1UL << NMI_SHIFT) 65#define NMI_OFFSET (1UL << NMI_SHIFT)
66 66
67#ifndef PREEMPT_ACTIVE
68#define PREEMPT_ACTIVE_BITS 1
69#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
70#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
71#endif
72
67#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS)) 73#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
68#error PREEMPT_ACTIVE is too low! 74#error PREEMPT_ACTIVE is too low!
69#endif 75#endif
@@ -132,7 +138,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
132} 138}
133#endif 139#endif
134 140
135#if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) 141#if defined(CONFIG_NO_HZ)
136extern void rcu_irq_enter(void); 142extern void rcu_irq_enter(void);
137extern void rcu_irq_exit(void); 143extern void rcu_irq_exit(void);
138extern void rcu_nmi_enter(void); 144extern void rcu_nmi_enter(void);
@@ -142,7 +148,7 @@ extern void rcu_nmi_exit(void);
142# define rcu_irq_exit() do { } while (0) 148# define rcu_irq_exit() do { } while (0)
143# define rcu_nmi_enter() do { } while (0) 149# define rcu_nmi_enter() do { } while (0)
144# define rcu_nmi_exit() do { } while (0) 150# define rcu_nmi_exit() do { } while (0)
145#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */ 151#endif /* #if defined(CONFIG_NO_HZ) */
146 152
147/* 153/*
148 * It is safe to do non-atomic ops on ->hardirq_context, 154 * It is safe to do non-atomic ops on ->hardirq_context,
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 940aeb51d53f..92b08cfe4a75 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -96,7 +96,6 @@ struct esp_struct {
96 int xmit_head; 96 int xmit_head;
97 int xmit_tail; 97 int xmit_tail;
98 int xmit_cnt; 98 int xmit_cnt;
99 wait_queue_head_t delta_msr_wait;
100 wait_queue_head_t break_wait; 99 wait_queue_head_t break_wait;
101 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 100 struct async_icount icount; /* kernel counters for the 4 input interrupts */
102 struct hayes_esp_config config; /* port configuration */ 101 struct hayes_esp_config config; /* port configuration */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index 6a6e701f1631..ee275c8b3df1 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,7 +38,7 @@ struct hdlc_proto {
38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb); 40 int (*netif_rx)(struct sk_buff *skb);
41 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 41 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
42 struct module *module; 42 struct module *module;
43 struct hdlc_proto *next; /* next protocol in the list */ 43 struct hdlc_proto *next; /* next protocol in the list */
44}; 44};
@@ -51,7 +51,7 @@ typedef struct hdlc_device {
51 unsigned short encoding, unsigned short parity); 51 unsigned short encoding, unsigned short parity);
52 52
53 /* hardware driver must handle this instead of dev->hard_start_xmit */ 53 /* hardware driver must handle this instead of dev->hard_start_xmit */
54 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 54 netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
55 55
56 /* Things below are for HDLC layer internal use only */ 56 /* Things below are for HDLC layer internal use only */
57 const struct hdlc_proto *proto; 57 const struct hdlc_proto *proto;
@@ -60,7 +60,7 @@ typedef struct hdlc_device {
60 spinlock_t state_lock; 60 spinlock_t state_lock;
61 void *state; 61 void *state;
62 void *priv; 62 void *priv;
63}hdlc_device; 63} hdlc_device;
64 64
65 65
66 66
@@ -106,7 +106,7 @@ void hdlc_close(struct net_device *dev);
106/* May be used by hardware driver */ 106/* May be used by hardware driver */
107int hdlc_change_mtu(struct net_device *dev, int new_mtu); 107int hdlc_change_mtu(struct net_device *dev, int new_mtu);
108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */ 108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
109int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev); 109netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
110 110
111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
112 size_t size); 112 size_t size);
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h
index 50d568ec178a..53744fa1c8b7 100644
--- a/include/linux/hid-debug.h
+++ b/include/linux/hid-debug.h
@@ -2,7 +2,7 @@
2#define __HID_DEBUG_H 2#define __HID_DEBUG_H
3 3
4/* 4/*
5 * Copyright (c) 2007 Jiri Kosina 5 * Copyright (c) 2007-2009 Jiri Kosina
6 */ 6 */
7 7
8/* 8/*
@@ -22,24 +22,44 @@
22 * 22 *
23 */ 23 */
24 24
25#ifdef CONFIG_HID_DEBUG 25#define HID_DEBUG_BUFSIZE 512
26 26
27void hid_dump_input(struct hid_usage *, __s32); 27#ifdef CONFIG_DEBUG_FS
28void hid_dump_device(struct hid_device *); 28
29void hid_dump_field(struct hid_field *, int); 29void hid_dump_input(struct hid_device *, struct hid_usage *, __s32);
30void hid_resolv_usage(unsigned); 30void hid_dump_device(struct hid_device *, struct seq_file *);
31void hid_resolv_event(__u8, __u16); 31void hid_dump_field(struct hid_field *, int, struct seq_file *);
32char *hid_resolv_usage(unsigned, struct seq_file *);
33void hid_debug_register(struct hid_device *, const char *);
34void hid_debug_unregister(struct hid_device *);
35void hid_debug_init(void);
36void hid_debug_exit(void);
37void hid_debug_event(struct hid_device *, char *);
32 38
33#else
34 39
35#define hid_dump_input(a,b) do { } while (0) 40struct hid_debug_list {
36#define hid_dump_device(c) do { } while (0) 41 char *hid_debug_buf;
37#define hid_dump_field(a,b) do { } while (0) 42 int head;
38#define hid_resolv_usage(a) do { } while (0) 43 int tail;
39#define hid_resolv_event(a,b) do { } while (0) 44 struct fasync_struct *fasync;
45 struct hid_device *hdev;
46 struct list_head node;
47 struct mutex read_mutex;
48};
40 49
41#endif /* CONFIG_HID_DEBUG */ 50#else
42 51
52#define hid_dump_input(a,b,c) do { } while (0)
53#define hid_dump_device(a,b) do { } while (0)
54#define hid_dump_field(a,b,c) do { } while (0)
55#define hid_resolv_usage(a,b) do { } while (0)
56#define hid_debug_register(a, b) do { } while (0)
57#define hid_debug_unregister(a) do { } while (0)
58#define hid_debug_init() do { } while (0)
59#define hid_debug_exit() do { } while (0)
60#define hid_debug_event(a,b) do { } while (0)
61
62#endif
43 63
44#endif 64#endif
45 65
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 53489fd4d700..10f628416740 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -494,12 +494,21 @@ struct hid_device { /* device report descriptor */
494 494
495 /* hiddev event handler */ 495 /* hiddev event handler */
496 int (*hiddev_connect)(struct hid_device *, unsigned int); 496 int (*hiddev_connect)(struct hid_device *, unsigned int);
497 void (*hiddev_disconnect)(struct hid_device *);
497 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 498 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
498 struct hid_usage *, __s32); 499 struct hid_usage *, __s32);
499 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 500 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
500 501
501 /* handler for raw output data, used by hidraw */ 502 /* handler for raw output data, used by hidraw */
502 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 503 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
504
505 /* debugging support via debugfs */
506 unsigned short debug;
507 struct dentry *debug_dir;
508 struct dentry *debug_rdesc;
509 struct dentry *debug_events;
510 struct list_head debug_list;
511 wait_queue_head_t debug_wait;
503}; 512};
504 513
505static inline void *hid_get_drvdata(struct hid_device *hdev) 514static inline void *hid_get_drvdata(struct hid_device *hdev)
@@ -657,9 +666,7 @@ struct hid_ll_driver {
657 666
658/* HID core API */ 667/* HID core API */
659 668
660#ifdef CONFIG_HID_DEBUG
661extern int hid_debug; 669extern int hid_debug;
662#endif
663 670
664extern int hid_add_device(struct hid_device *); 671extern int hid_add_device(struct hid_device *);
665extern void hid_destroy_device(struct hid_device *); 672extern void hid_destroy_device(struct hid_device *);
@@ -685,6 +692,7 @@ struct hid_device *hid_allocate_device(void);
685int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 692int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
686int hid_check_keys_pressed(struct hid_device *hid); 693int hid_check_keys_pressed(struct hid_device *hid);
687int hid_connect(struct hid_device *hid, unsigned int connect_mask); 694int hid_connect(struct hid_device *hid, unsigned int connect_mask);
695void hid_disconnect(struct hid_device *hid);
688 696
689/** 697/**
690 * hid_map_usage - map usage input bits 698 * hid_map_usage - map usage input bits
@@ -794,6 +802,7 @@ static inline int __must_check hid_hw_start(struct hid_device *hdev,
794 */ 802 */
795static inline void hid_hw_stop(struct hid_device *hdev) 803static inline void hid_hw_stop(struct hid_device *hdev)
796{ 804{
805 hid_disconnect(hdev);
797 hdev->ll_driver->stop(hdev); 806 hdev->ll_driver->stop(hdev);
798} 807}
799 808
@@ -815,21 +824,9 @@ int hid_pidff_init(struct hid_device *hid);
815#define hid_pidff_init NULL 824#define hid_pidff_init NULL
816#endif 825#endif
817 826
818#ifdef CONFIG_HID_DEBUG
819#define dbg_hid(format, arg...) if (hid_debug) \ 827#define dbg_hid(format, arg...) if (hid_debug) \
820 printk(KERN_DEBUG "%s: " format ,\ 828 printk(KERN_DEBUG "%s: " format ,\
821 __FILE__ , ## arg) 829 __FILE__ , ## arg)
822#define dbg_hid_line(format, arg...) if (hid_debug) \
823 printk(format, ## arg)
824#else
825static inline int __attribute__((format(printf, 1, 2)))
826dbg_hid(const char *fmt, ...)
827{
828 return 0;
829}
830#define dbg_hid_line dbg_hid
831#endif /* HID_DEBUG */
832
833#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 830#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
834 __FILE__ , ## arg) 831 __FILE__ , ## arg)
835#endif /* HID_FF */ 832#endif /* HID_FF */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 4759917adc71..ff037f0b1b4e 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -91,7 +91,6 @@ enum hrtimer_restart {
91 * @function: timer expiry callback function 91 * @function: timer expiry callback function
92 * @base: pointer to the timer base (per cpu and per clock) 92 * @base: pointer to the timer base (per cpu and per clock)
93 * @state: state information (See bit values above) 93 * @state: state information (See bit values above)
94 * @cb_entry: list head to enqueue an expired timer into the callback list
95 * @start_site: timer statistics field to store the site where the timer 94 * @start_site: timer statistics field to store the site where the timer
96 * was started 95 * was started
97 * @start_comm: timer statistics field to store the name of the process which 96 * @start_comm: timer statistics field to store the name of the process which
@@ -108,7 +107,6 @@ struct hrtimer {
108 enum hrtimer_restart (*function)(struct hrtimer *); 107 enum hrtimer_restart (*function)(struct hrtimer *);
109 struct hrtimer_clock_base *base; 108 struct hrtimer_clock_base *base;
110 unsigned long state; 109 unsigned long state;
111 struct list_head cb_entry;
112#ifdef CONFIG_TIMER_STATS 110#ifdef CONFIG_TIMER_STATS
113 int start_pid; 111 int start_pid;
114 void *start_site; 112 void *start_site;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5cbc620bdfe0..41a59afc70fa 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -3,15 +3,15 @@
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5 5
6struct ctl_table;
7struct user_struct;
8
6#ifdef CONFIG_HUGETLB_PAGE 9#ifdef CONFIG_HUGETLB_PAGE
7 10
8#include <linux/mempolicy.h> 11#include <linux/mempolicy.h>
9#include <linux/shm.h> 12#include <linux/shm.h>
10#include <asm/tlbflush.h> 13#include <asm/tlbflush.h>
11 14
12struct ctl_table;
13struct user_struct;
14
15int PageHuge(struct page *page); 15int PageHuge(struct page *page);
16 16
17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
@@ -20,11 +20,13 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
20} 20}
21 21
22void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 22void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
25int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 25int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 26int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int); 27int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
28 struct page **, struct vm_area_struct **,
29 unsigned long *, int *, int, unsigned int flags);
28void unmap_hugepage_range(struct vm_area_struct *, 30void unmap_hugepage_range(struct vm_area_struct *,
29 unsigned long, unsigned long, struct page *); 31 unsigned long, unsigned long, struct page *);
30void __unmap_hugepage_range(struct vm_area_struct *, 32void __unmap_hugepage_range(struct vm_area_struct *,
@@ -110,6 +112,21 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
110 112
111#endif /* !CONFIG_HUGETLB_PAGE */ 113#endif /* !CONFIG_HUGETLB_PAGE */
112 114
115#define HUGETLB_ANON_FILE "anon_hugepage"
116
117enum {
118 /*
119 * The file will be used as an shm file so shmfs accounting rules
120 * apply
121 */
122 HUGETLB_SHMFS_INODE = 1,
123 /*
124 * The file is being created on the internal vfs mount and shmfs
125 * accounting rules do not apply
126 */
127 HUGETLB_ANONHUGE_INODE = 2,
128};
129
113#ifdef CONFIG_HUGETLBFS 130#ifdef CONFIG_HUGETLBFS
114struct hugetlbfs_config { 131struct hugetlbfs_config {
115 uid_t uid; 132 uid_t uid;
@@ -146,9 +163,9 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
146} 163}
147 164
148extern const struct file_operations hugetlbfs_file_operations; 165extern const struct file_operations hugetlbfs_file_operations;
149extern struct vm_operations_struct hugetlb_vm_ops; 166extern const struct vm_operations_struct hugetlb_vm_ops;
150struct file *hugetlb_file_setup(const char *name, size_t size, int acct, 167struct file *hugetlb_file_setup(const char *name, size_t size, int acct,
151 struct user_struct **user); 168 struct user_struct **user, int creat_flags);
152int hugetlb_get_quota(struct address_space *mapping, long delta); 169int hugetlb_get_quota(struct address_space *mapping, long delta);
153void hugetlb_put_quota(struct address_space *mapping, long delta); 170void hugetlb_put_quota(struct address_space *mapping, long delta);
154 171
@@ -170,7 +187,11 @@ static inline void set_file_hugepages(struct file *file)
170 187
171#define is_file_hugepages(file) 0 188#define is_file_hugepages(file) 0
172#define set_file_hugepages(file) BUG() 189#define set_file_hugepages(file) BUG()
173#define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS) 190static inline struct file *hugetlb_file_setup(const char *name, size_t size,
191 int acctflag, struct user_struct **user, int creat_flags)
192{
193 return ERR_PTR(-ENOSYS);
194}
174 195
175#endif /* !CONFIG_HUGETLBFS */ 196#endif /* !CONFIG_HUGETLBFS */
176 197
@@ -185,7 +206,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
185#define HSTATE_NAME_LEN 32 206#define HSTATE_NAME_LEN 32
186/* Defines one hugetlb page size */ 207/* Defines one hugetlb page size */
187struct hstate { 208struct hstate {
188 int hugetlb_next_nid; 209 int next_nid_to_alloc;
210 int next_nid_to_free;
189 unsigned int order; 211 unsigned int order;
190 unsigned long mask; 212 unsigned long mask;
191 unsigned long max_huge_pages; 213 unsigned long max_huge_pages;
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index c9087de5c6c6..e844a0b18695 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -28,17 +28,6 @@
28 identify a legacy client. If you don't need them, just don't set them. */ 28 identify a legacy client. If you don't need them, just don't set them. */
29 29
30/* 30/*
31 * ---- Driver types -----------------------------------------------------
32 */
33
34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
40
41/*
42 * ---- Adapter types ---------------------------------------------------- 31 * ---- Adapter types ----------------------------------------------------
43 */ 32 */
44 33
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index f13255e06406..9eb07bbc6522 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -21,7 +21,7 @@ struct i2c_pnx_mif {
21 int mode; /* Interface mode */ 21 int mode; /* Interface mode */
22 struct completion complete; /* I/O completion */ 22 struct completion complete; /* I/O completion */
23 struct timer_list timer; /* Timeout */ 23 struct timer_list timer; /* Timeout */
24 char * buf; /* Data buffer */ 24 u8 * buf; /* Data buffer */
25 int len; /* Length of data buffer */ 25 int len; /* Length of data buffer */
26}; 26};
27 27
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f4784c0fe975..7b40cda57a70 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -98,7 +98,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
98 98
99/** 99/**
100 * struct i2c_driver - represent an I2C device driver 100 * struct i2c_driver - represent an I2C device driver
101 * @id: Unique driver ID (optional)
102 * @class: What kind of i2c device we instantiate (for detect) 101 * @class: What kind of i2c device we instantiate (for detect)
103 * @attach_adapter: Callback for bus addition (for legacy drivers) 102 * @attach_adapter: Callback for bus addition (for legacy drivers)
104 * @detach_adapter: Callback for bus removal (for legacy drivers) 103 * @detach_adapter: Callback for bus removal (for legacy drivers)
@@ -135,7 +134,6 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
135 * not allowed. 134 * not allowed.
136 */ 135 */
137struct i2c_driver { 136struct i2c_driver {
138 int id;
139 unsigned int class; 137 unsigned int class;
140 138
141 /* Notifies the driver that a new bus has appeared or is about to be 139 /* Notifies the driver that a new bus has appeared or is about to be
@@ -363,6 +361,24 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
363 dev_set_drvdata(&dev->dev, data); 361 dev_set_drvdata(&dev->dev, data);
364} 362}
365 363
364/**
365 * i2c_lock_adapter - Prevent access to an I2C bus segment
366 * @adapter: Target I2C bus segment
367 */
368static inline void i2c_lock_adapter(struct i2c_adapter *adapter)
369{
370 mutex_lock(&adapter->bus_lock);
371}
372
373/**
374 * i2c_unlock_adapter - Reauthorize access to an I2C bus segment
375 * @adapter: Target I2C bus segment
376 */
377static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
378{
379 mutex_unlock(&adapter->bus_lock);
380}
381
366/*flags for the client struct: */ 382/*flags for the client struct: */
367#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 383#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
368#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 384#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
new file mode 100644
index 000000000000..fc5db826b48e
--- /dev/null
+++ b/include/linux/i2c/adp5588.h
@@ -0,0 +1,92 @@
1/*
2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller
3 *
4 * Copyright 2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef _ADP5588_H
10#define _ADP5588_H
11
12#define DEV_ID 0x00 /* Device ID */
13#define CFG 0x01 /* Configuration Register1 */
14#define INT_STAT 0x02 /* Interrupt Status Register */
15#define KEY_LCK_EC_STAT 0x03 /* Key Lock and Event Counter Register */
16#define Key_EVENTA 0x04 /* Key Event Register A */
17#define Key_EVENTB 0x05 /* Key Event Register B */
18#define Key_EVENTC 0x06 /* Key Event Register C */
19#define Key_EVENTD 0x07 /* Key Event Register D */
20#define Key_EVENTE 0x08 /* Key Event Register E */
21#define Key_EVENTF 0x09 /* Key Event Register F */
22#define Key_EVENTG 0x0A /* Key Event Register G */
23#define Key_EVENTH 0x0B /* Key Event Register H */
24#define Key_EVENTI 0x0C /* Key Event Register I */
25#define Key_EVENTJ 0x0D /* Key Event Register J */
26#define KP_LCK_TMR 0x0E /* Keypad Lock1 to Lock2 Timer */
27#define UNLOCK1 0x0F /* Unlock Key1 */
28#define UNLOCK2 0x10 /* Unlock Key2 */
29#define GPIO_INT_STAT1 0x11 /* GPIO Interrupt Status */
30#define GPIO_INT_STAT2 0x12 /* GPIO Interrupt Status */
31#define GPIO_INT_STAT3 0x13 /* GPIO Interrupt Status */
32#define GPIO_DAT_STAT1 0x14 /* GPIO Data Status, Read twice to clear */
33#define GPIO_DAT_STAT2 0x15 /* GPIO Data Status, Read twice to clear */
34#define GPIO_DAT_STAT3 0x16 /* GPIO Data Status, Read twice to clear */
35#define GPIO_DAT_OUT1 0x17 /* GPIO DATA OUT */
36#define GPIO_DAT_OUT2 0x18 /* GPIO DATA OUT */
37#define GPIO_DAT_OUT3 0x19 /* GPIO DATA OUT */
38#define GPIO_INT_EN1 0x1A /* GPIO Interrupt Enable */
39#define GPIO_INT_EN2 0x1B /* GPIO Interrupt Enable */
40#define GPIO_INT_EN3 0x1C /* GPIO Interrupt Enable */
41#define KP_GPIO1 0x1D /* Keypad or GPIO Selection */
42#define KP_GPIO2 0x1E /* Keypad or GPIO Selection */
43#define KP_GPIO3 0x1F /* Keypad or GPIO Selection */
44#define GPI_EM1 0x20 /* GPI Event Mode 1 */
45#define GPI_EM2 0x21 /* GPI Event Mode 2 */
46#define GPI_EM3 0x22 /* GPI Event Mode 3 */
47#define GPIO_DIR1 0x23 /* GPIO Data Direction */
48#define GPIO_DIR2 0x24 /* GPIO Data Direction */
49#define GPIO_DIR3 0x25 /* GPIO Data Direction */
50#define GPIO_INT_LVL1 0x26 /* GPIO Edge/Level Detect */
51#define GPIO_INT_LVL2 0x27 /* GPIO Edge/Level Detect */
52#define GPIO_INT_LVL3 0x28 /* GPIO Edge/Level Detect */
53#define Debounce_DIS1 0x29 /* Debounce Disable */
54#define Debounce_DIS2 0x2A /* Debounce Disable */
55#define Debounce_DIS3 0x2B /* Debounce Disable */
56#define GPIO_PULL1 0x2C /* GPIO Pull Disable */
57#define GPIO_PULL2 0x2D /* GPIO Pull Disable */
58#define GPIO_PULL3 0x2E /* GPIO Pull Disable */
59#define CMP_CFG_STAT 0x30 /* Comparator Configuration and Status Register */
60#define CMP_CONFG_SENS1 0x31 /* Sensor1 Comparator Configuration Register */
61#define CMP_CONFG_SENS2 0x32 /* L2 Light Sensor Reference Level, Output Falling for Sensor 1 */
62#define CMP1_LVL2_TRIP 0x33 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 1 */
63#define CMP1_LVL2_HYS 0x34 /* L3 Light Sensor Reference Level, Output Falling For Sensor 1 */
64#define CMP1_LVL3_TRIP 0x35 /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 1 */
65#define CMP1_LVL3_HYS 0x36 /* Sensor 2 Comparator Configuration Register */
66#define CMP2_LVL2_TRIP 0x37 /* L2 Light Sensor Reference Level, Output Falling for Sensor 2 */
67#define CMP2_LVL2_HYS 0x38 /* L2 Light Sensor Hysteresis (Active when Output Rising) for Sensor 2 */
68#define CMP2_LVL3_TRIP 0x39 /* L3 Light Sensor Reference Level, Output Falling For Sensor 2 */
69#define CMP2_LVL3_HYS 0x3A /* L3 Light Sensor Hysteresis (Active when Output Rising) For Sensor 2 */
70#define CMP1_ADC_DAT_R1 0x3B /* Comparator 1 ADC data Register1 */
71#define CMP1_ADC_DAT_R2 0x3C /* Comparator 1 ADC data Register2 */
72#define CMP2_ADC_DAT_R1 0x3D /* Comparator 2 ADC data Register1 */
73#define CMP2_ADC_DAT_R2 0x3E /* Comparator 2 ADC data Register2 */
74
75#define ADP5588_DEVICE_ID_MASK 0xF
76
77/* Put one of these structures in i2c_board_info platform_data */
78
79#define ADP5588_KEYMAPSIZE 80
80
81struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */
83 int cols; /* Number of columns */
84 const unsigned short *keymap; /* Pointer to keymap */
85 unsigned short keymapsize; /* Keymap size */
86 unsigned repeat:1; /* Enable key repeat */
87 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */
90};
91
92#endif
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
new file mode 100644
index 000000000000..5a117b5ca15e
--- /dev/null
+++ b/include/linux/i2c/mcs5000_ts.h
@@ -0,0 +1,24 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 0dc80ef24975..508824ee35e6 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -25,6 +25,9 @@
25#ifndef __TWL4030_H_ 25#ifndef __TWL4030_H_
26#define __TWL4030_H_ 26#define __TWL4030_H_
27 27
28#include <linux/types.h>
29#include <linux/input/matrix_keypad.h>
30
28/* 31/*
29 * Using the twl4030 core we address registers using a pair 32 * Using the twl4030 core we address registers using a pair
30 * { module id, relative register offset } 33 * { module id, relative register offset }
@@ -220,19 +223,28 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
220 223
221/* Power bus message definitions */ 224/* Power bus message definitions */
222 225
223#define DEV_GRP_NULL 0x0 226/* The TWL4030/5030 splits its power-management resources (the various
224#define DEV_GRP_P1 0x1 227 * regulators, clock and reset lines) into 3 processor groups - P1, P2 and
225#define DEV_GRP_P2 0x2 228 * P3. These groups can then be configured to transition between sleep, wait-on
226#define DEV_GRP_P3 0x4 229 * and active states by sending messages to the power bus. See Section 5.4.2
230 * Power Resources of TWL4030 TRM
231 */
227 232
228#define RES_GRP_RES 0x0 233/* Processor groups */
229#define RES_GRP_PP 0x1 234#define DEV_GRP_NULL 0x0
230#define RES_GRP_RC 0x2 235#define DEV_GRP_P1 0x1 /* P1: all OMAP devices */
236#define DEV_GRP_P2 0x2 /* P2: all Modem devices */
237#define DEV_GRP_P3 0x4 /* P3: all peripheral devices */
238
239/* Resource groups */
240#define RES_GRP_RES 0x0 /* Reserved */
241#define RES_GRP_PP 0x1 /* Power providers */
242#define RES_GRP_RC 0x2 /* Reset and control */
231#define RES_GRP_PP_RC 0x3 243#define RES_GRP_PP_RC 0x3
232#define RES_GRP_PR 0x4 244#define RES_GRP_PR 0x4 /* Power references */
233#define RES_GRP_PP_PR 0x5 245#define RES_GRP_PP_PR 0x5
234#define RES_GRP_RC_PR 0x6 246#define RES_GRP_RC_PR 0x6
235#define RES_GRP_ALL 0x7 247#define RES_GRP_ALL 0x7 /* All resource groups */
236 248
237#define RES_TYPE2_R0 0x0 249#define RES_TYPE2_R0 0x0
238 250
@@ -243,6 +255,41 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
243#define RES_STATE_SLEEP 0x8 255#define RES_STATE_SLEEP 0x8
244#define RES_STATE_OFF 0x0 256#define RES_STATE_OFF 0x0
245 257
258/* Power resources */
259
260/* Power providers */
261#define RES_VAUX1 1
262#define RES_VAUX2 2
263#define RES_VAUX3 3
264#define RES_VAUX4 4
265#define RES_VMMC1 5
266#define RES_VMMC2 6
267#define RES_VPLL1 7
268#define RES_VPLL2 8
269#define RES_VSIM 9
270#define RES_VDAC 10
271#define RES_VINTANA1 11
272#define RES_VINTANA2 12
273#define RES_VINTDIG 13
274#define RES_VIO 14
275#define RES_VDD1 15
276#define RES_VDD2 16
277#define RES_VUSB_1V5 17
278#define RES_VUSB_1V8 18
279#define RES_VUSB_3V1 19
280#define RES_VUSBCP 20
281#define RES_REGEN 21
282/* Reset and control */
283#define RES_NRES_PWRON 22
284#define RES_CLKEN 23
285#define RES_SYSEN 24
286#define RES_HFCLKOUT 25
287#define RES_32KCLKOUT 26
288#define RES_RESET 27
289/* Power Reference */
290#define RES_Main_Ref 28
291
292#define TOTAL_RESOURCES 28
246/* 293/*
247 * Power Bus Message Format ... these can be sent individually by Linux, 294 * Power Bus Message Format ... these can be sent individually by Linux,
248 * but are usually part of downloaded scripts that are run when various 295 * but are usually part of downloaded scripts that are run when various
@@ -302,13 +349,17 @@ struct twl4030_madc_platform_data {
302 int irq_line; 349 int irq_line;
303}; 350};
304 351
352/* Boards have uniqe mappings of {row, col} --> keycode.
353 * Column and row are 8 bits each, but range only from 0..7.
354 * a PERSISTENT_KEY is "always on" and never reported.
355 */
356#define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
357
305struct twl4030_keypad_data { 358struct twl4030_keypad_data {
306 int rows; 359 const struct matrix_keymap_data *keymap_data;
307 int cols; 360 unsigned rows;
308 int *keymap; 361 unsigned cols;
309 int irq; 362 bool rep;
310 unsigned int keymapsize;
311 unsigned int rep:1;
312}; 363};
313 364
314enum twl4030_usb_mode { 365enum twl4030_usb_mode {
@@ -320,6 +371,36 @@ struct twl4030_usb_data {
320 enum twl4030_usb_mode usb_mode; 371 enum twl4030_usb_mode usb_mode;
321}; 372};
322 373
374struct twl4030_ins {
375 u16 pmb_message;
376 u8 delay;
377};
378
379struct twl4030_script {
380 struct twl4030_ins *script;
381 unsigned size;
382 u8 flags;
383#define TWL4030_WRST_SCRIPT (1<<0)
384#define TWL4030_WAKEUP12_SCRIPT (1<<1)
385#define TWL4030_WAKEUP3_SCRIPT (1<<2)
386#define TWL4030_SLEEP_SCRIPT (1<<3)
387};
388
389struct twl4030_resconfig {
390 u8 resource;
391 u8 devgroup; /* Processor group that Power resource belongs to */
392 u8 type; /* Power resource addressed, 6 / broadcast message */
393 u8 type2; /* Power resource addressed, 3 / broadcast message */
394};
395
396struct twl4030_power_data {
397 struct twl4030_script **scripts;
398 unsigned num;
399 struct twl4030_resconfig *resource_config;
400};
401
402extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
403
323struct twl4030_platform_data { 404struct twl4030_platform_data {
324 unsigned irq_base, irq_end; 405 unsigned irq_base, irq_end;
325 struct twl4030_bci_platform_data *bci; 406 struct twl4030_bci_platform_data *bci;
@@ -327,6 +408,7 @@ struct twl4030_platform_data {
327 struct twl4030_madc_platform_data *madc; 408 struct twl4030_madc_platform_data *madc;
328 struct twl4030_keypad_data *keypad; 409 struct twl4030_keypad_data *keypad;
329 struct twl4030_usb_data *usb; 410 struct twl4030_usb_data *usb;
411 struct twl4030_power_data *power;
330 412
331 /* LDO regulators */ 413 /* LDO regulators */
332 struct regulator_init_data *vdac; 414 struct regulator_init_data *vdac;
@@ -357,7 +439,6 @@ int twl4030_sih_setup(int module);
357#define TWL4030_VAUX3_DEV_GRP 0x1F 439#define TWL4030_VAUX3_DEV_GRP 0x1F
358#define TWL4030_VAUX3_DEDICATED 0x22 440#define TWL4030_VAUX3_DEDICATED 0x22
359 441
360
361#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 442#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
362 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 443 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
363 extern int twl4030charger_usb_en(int enable); 444 extern int twl4030charger_usb_en(int enable);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 7907a72403ee..60c3360ef6ad 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -7,6 +7,7 @@
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 */ 8 */
9 9
10#include <linux/types.h>
10 11
11/* 12/*
12 * Standard commands. 13 * Standard commands.
@@ -30,6 +31,35 @@
30#define I8042_CMD_MUX_PFX 0x0090 31#define I8042_CMD_MUX_PFX 0x0090
31#define I8042_CMD_MUX_SEND 0x1090 32#define I8042_CMD_MUX_SEND 0x1090
32 33
34struct serio;
35
36#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
37
38void i8042_lock_chip(void);
39void i8042_unlock_chip(void);
33int i8042_command(unsigned char *param, int command); 40int i8042_command(unsigned char *param, int command);
41bool i8042_check_port_owner(const struct serio *);
42
43#else
44
45void i8042_lock_chip(void)
46{
47}
48
49void i8042_unlock_chip(void)
50{
51}
52
53int i8042_command(unsigned char *param, int command)
54{
55 return -ENOSYS;
56}
57
58bool i8042_check_port_owner(const struct serio *serio)
59{
60 return false;
61}
62
63#endif
34 64
35#endif 65#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index b6a85183c333..c0d8357917e2 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -171,8 +171,6 @@ struct icmp6_filter {
171#ifdef __KERNEL__ 171#ifdef __KERNEL__
172 172
173#include <linux/netdevice.h> 173#include <linux/netdevice.h>
174#include <linux/skbuff.h>
175
176 174
177extern void icmpv6_send(struct sk_buff *skb, 175extern void icmpv6_send(struct sk_buff *skb,
178 u8 type, u8 code, 176 u8 type, u8 code,
diff --git a/include/linux/ide.h b/include/linux/ide.h
index edc93a6d931d..e4135d6e0556 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -258,6 +258,7 @@ enum {
258 IDE_TFLAG_DYN = (1 << 5), 258 IDE_TFLAG_DYN = (1 << 5),
259 IDE_TFLAG_FS = (1 << 6), 259 IDE_TFLAG_FS = (1 << 6),
260 IDE_TFLAG_MULTI_PIO = (1 << 7), 260 IDE_TFLAG_MULTI_PIO = (1 << 7),
261 IDE_TFLAG_SET_XFER = (1 << 8),
261}; 262};
262 263
263enum { 264enum {
@@ -294,7 +295,7 @@ struct ide_cmd {
294 } out, in; 295 } out, in;
295 } valid; 296 } valid;
296 297
297 u8 tf_flags; 298 u16 tf_flags;
298 u8 ftf_flags; /* for TASKFILE ioctl */ 299 u8 ftf_flags; /* for TASKFILE ioctl */
299 int protocol; 300 int protocol;
300 301
@@ -918,8 +919,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
918typedef struct { 919typedef struct {
919 const char *name; 920 const char *name;
920 mode_t mode; 921 mode_t mode;
921 read_proc_t *read_proc; 922 const struct file_operations *proc_fops;
922 write_proc_t *write_proc;
923} ide_proc_entry_t; 923} ide_proc_entry_t;
924 924
925void proc_ide_create(void); 925void proc_ide_create(void);
@@ -931,24 +931,8 @@ void ide_proc_unregister_port(ide_hwif_t *);
931void ide_proc_register_driver(ide_drive_t *, struct ide_driver *); 931void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
932void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *); 932void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
933 933
934read_proc_t proc_ide_read_capacity; 934extern const struct file_operations ide_capacity_proc_fops;
935read_proc_t proc_ide_read_geometry; 935extern const struct file_operations ide_geometry_proc_fops;
936
937/*
938 * Standard exit stuff:
939 */
940#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \
941{ \
942 len -= off; \
943 if (len < count) { \
944 *eof = 1; \
945 if (len <= 0) \
946 return 0; \
947 } else \
948 len = count; \
949 *start = page + off; \
950 return len; \
951}
952#else 936#else
953static inline void proc_ide_create(void) { ; } 937static inline void proc_ide_create(void) { ; }
954static inline void proc_ide_destroy(void) { ; } 938static inline void proc_ide_destroy(void) { ; }
@@ -960,7 +944,6 @@ static inline void ide_proc_register_driver(ide_drive_t *drive,
960 struct ide_driver *driver) { ; } 944 struct ide_driver *driver) { ; }
961static inline void ide_proc_unregister_driver(ide_drive_t *drive, 945static inline void ide_proc_unregister_driver(ide_drive_t *drive,
962 struct ide_driver *driver) { ; } 946 struct ide_driver *driver) { ; }
963#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
964#endif 947#endif
965 948
966enum { 949enum {
@@ -1081,6 +1064,7 @@ extern void ide_fixstring(u8 *, const int, const int);
1081 1064
1082int ide_busy_sleep(ide_drive_t *, unsigned long, int); 1065int ide_busy_sleep(ide_drive_t *, unsigned long, int);
1083 1066
1067int __ide_wait_stat(ide_drive_t *, u8, u8, unsigned long, u8 *);
1084int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1068int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1085 1069
1086ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *); 1070ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
@@ -1169,7 +1153,7 @@ int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1169 1153
1170int ide_taskfile_ioctl(ide_drive_t *, unsigned long); 1154int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1171 1155
1172int ide_dev_read_id(ide_drive_t *, u8, u16 *); 1156int ide_dev_read_id(ide_drive_t *, u8, u16 *, int);
1173 1157
1174extern int ide_driveid_update(ide_drive_t *); 1158extern int ide_driveid_update(ide_drive_t *);
1175extern int ide_config_drive_speed(ide_drive_t *, u8); 1159extern int ide_config_drive_speed(ide_drive_t *, u8);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a9173d5434d1..52e15e079c61 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -115,7 +115,7 @@
115#define IEEE80211_MAX_SSID_LEN 32 115#define IEEE80211_MAX_SSID_LEN 32
116 116
117#define IEEE80211_MAX_MESH_ID_LEN 32 117#define IEEE80211_MAX_MESH_ID_LEN 32
118#define IEEE80211_MESH_CONFIG_LEN 19 118#define IEEE80211_MESH_CONFIG_LEN 24
119 119
120#define IEEE80211_QOS_CTL_LEN 2 120#define IEEE80211_QOS_CTL_LEN 2
121#define IEEE80211_QOS_CTL_TID_MASK 0x000F 121#define IEEE80211_QOS_CTL_TID_MASK 0x000F
@@ -802,6 +802,31 @@ struct ieee80211_ht_cap {
802#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 802#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
803#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C 803#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
804 804
805/*
806 * Maximum length of AMPDU that the STA can receive.
807 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
808 */
809enum ieee80211_max_ampdu_length_exp {
810 IEEE80211_HT_MAX_AMPDU_8K = 0,
811 IEEE80211_HT_MAX_AMPDU_16K = 1,
812 IEEE80211_HT_MAX_AMPDU_32K = 2,
813 IEEE80211_HT_MAX_AMPDU_64K = 3
814};
815
816#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
817
818/* Minimum MPDU start spacing */
819enum ieee80211_min_mpdu_spacing {
820 IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */
821 IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */
822 IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */
823 IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */
824 IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */
825 IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */
826 IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */
827 IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */
828};
829
805/** 830/**
806 * struct ieee80211_ht_info - HT information 831 * struct ieee80211_ht_info - HT information
807 * 832 *
@@ -1196,6 +1221,10 @@ enum ieee80211_sa_query_action {
1196#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1221#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1197#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 1222#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1198 1223
1224/* AKM suite selectors */
1225#define WLAN_AKM_SUITE_8021X 0x000FAC01
1226#define WLAN_AKM_SUITE_PSK 0x000FAC02
1227
1199#define WLAN_MAX_KEY_LEN 32 1228#define WLAN_MAX_KEY_LEN 32
1200 1229
1201/** 1230/**
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index a60c821be44c..fd9740466757 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -41,6 +41,7 @@ enum
41 41
42#define IFA_F_NODAD 0x02 42#define IFA_F_NODAD 0x02
43#define IFA_F_OPTIMISTIC 0x04 43#define IFA_F_OPTIMISTIC 0x04
44#define IFA_F_DADFAILED 0x08
44#define IFA_F_HOMEADDRESS 0x10 45#define IFA_F_HOMEADDRESS 0x10
45#define IFA_F_DEPRECATED 0x20 46#define IFA_F_DEPRECATED 0x20
46#define IFA_F_TENTATIVE 0x40 47#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index b554300ef8bf..282eb37e2dec 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,7 +87,6 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804 89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_PHY 805
91 90
92#define ARPHRD_PHONET 820 /* PhoNet media type */ 91#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 70fdba2bbf71..580b6004d00e 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -139,10 +139,10 @@ extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
139/* 139/*
140 * Display a 6 byte device address (MAC) in a readable format. 140 * Display a 6 byte device address (MAC) in a readable format.
141 */ 141 */
142extern char *print_mac(char *buf, const unsigned char *addr); 142extern char *print_mac(char *buf, const unsigned char *addr) __deprecated;
143#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" 143#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
144#define MAC_BUF_SIZE 18 144#define MAC_BUF_SIZE 18
145#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused 145#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE]
146 146
147#endif 147#endif
148 148
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 673f2209453d..80b3a1056a5f 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -69,11 +69,6 @@ struct dlci_conf {
69 69
70#define DLCI_VALID_FLAGS 0x000B 70#define DLCI_VALID_FLAGS 0x000B
71 71
72/* FRAD driver uses these to indicate what it did with packet */
73#define DLCI_RET_OK 0x00
74#define DLCI_RET_ERR 0x01
75#define DLCI_RET_DROP 0x02
76
77/* defines for the actual Frame Relay hardware */ 72/* defines for the actual Frame Relay hardware */
78#define FRAD_GET_CONF (SIOCDEVPRIVATE) 73#define FRAD_GET_CONF (SIOCDEVPRIVATE)
79#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) 74#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 915ba5789f0e..3f5fd523b49d 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -62,6 +62,7 @@
62#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */ 62#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */
63#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */ 63#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
64#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */ 64#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
65#define TUN_F_UFO 0x10 /* I can handle UFO packets */
65 66
66/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */ 67/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
67#define TUN_PKT_STRIP 0x0001 68#define TUN_PKT_STRIP 0x0001
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5eb9b0f857e0..5a9aae4adb44 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -44,7 +44,7 @@ struct ip_tunnel_prl {
44 __u16 flags; 44 __u16 flags;
45 __u16 __reserved; 45 __u16 __reserved;
46 __u32 datalen; 46 __u32 datalen;
47 __u32 rs_delay; 47 __u32 __reserved2;
48 /* data follows */ 48 /* data follows */
49}; 49};
50 50
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 92fbd8cbd68f..fe158e0e20e6 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -233,6 +233,8 @@ extern void ip_mc_init_dev(struct in_device *);
233extern void ip_mc_destroy_dev(struct in_device *); 233extern void ip_mc_destroy_dev(struct in_device *);
234extern void ip_mc_up(struct in_device *); 234extern void ip_mc_up(struct in_device *);
235extern void ip_mc_down(struct in_device *); 235extern void ip_mc_down(struct in_device *);
236extern void ip_mc_unmap(struct in_device *);
237extern void ip_mc_remap(struct in_device *);
236extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 238extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
237extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 239extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
238extern void ip_mc_rejoin_group(struct ip_mc_list *im); 240extern void ip_mc_rejoin_group(struct ip_mc_list *im);
diff --git a/include/linux/init.h b/include/linux/init.h
index 13b633ed695e..ff8bde520d03 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -103,8 +103,8 @@
103#define __INIT .section ".init.text","ax" 103#define __INIT .section ".init.text","ax"
104#define __FINIT .previous 104#define __FINIT .previous
105 105
106#define __INITDATA .section ".init.data","aw" 106#define __INITDATA .section ".init.data","aw",%progbits
107#define __INITRODATA .section ".init.rodata","a" 107#define __INITRODATA .section ".init.rodata","a",%progbits
108#define __FINITDATA .previous 108#define __FINITDATA .previous
109 109
110#define __DEVINIT .section ".devinit.text", "ax" 110#define __DEVINIT .section ".devinit.text", "ax"
@@ -271,6 +271,7 @@ void __init parse_early_options(char *cmdline);
271#else /* MODULE */ 271#else /* MODULE */
272 272
273/* Don't use these in modules, but some people do... */ 273/* Don't use these in modules, but some people do... */
274#define early_initcall(fn) module_init(fn)
274#define core_initcall(fn) module_init(fn) 275#define core_initcall(fn) module_init(fn)
275#define postcore_initcall(fn) module_init(fn) 276#define postcore_initcall(fn) module_init(fn)
276#define arch_initcall(fn) module_init(fn) 277#define arch_initcall(fn) module_init(fn)
@@ -305,9 +306,17 @@ void __init parse_early_options(char *cmdline);
305#ifdef CONFIG_MODULES 306#ifdef CONFIG_MODULES
306#define __init_or_module 307#define __init_or_module
307#define __initdata_or_module 308#define __initdata_or_module
309#define __initconst_or_module
310#define __INIT_OR_MODULE .text
311#define __INITDATA_OR_MODULE .data
312#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
308#else 313#else
309#define __init_or_module __init 314#define __init_or_module __init
310#define __initdata_or_module __initdata 315#define __initdata_or_module __initdata
316#define __initconst_or_module __initconst
317#define __INIT_OR_MODULE __INIT
318#define __INITDATA_OR_MODULE __INITDATA
319#define __INITRODATA_OR_MODULE __INITRODATA
311#endif /*CONFIG_MODULES*/ 320#endif /*CONFIG_MODULES*/
312 321
313/* Functions marked as __devexit may be discarded at kernel link time, depending 322/* Functions marked as __devexit may be discarded at kernel link time, depending
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 7fc01b13be43..21a6f5d9af22 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -94,15 +94,25 @@ extern struct group_info init_groups;
94# define CAP_INIT_BSET CAP_INIT_EFF_SET 94# define CAP_INIT_BSET CAP_INIT_EFF_SET
95#endif 95#endif
96 96
97#ifdef CONFIG_TREE_PREEMPT_RCU
98#define INIT_TASK_RCU_PREEMPT(tsk) \
99 .rcu_read_lock_nesting = 0, \
100 .rcu_read_unlock_special = 0, \
101 .rcu_blocked_node = NULL, \
102 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry),
103#else
104#define INIT_TASK_RCU_PREEMPT(tsk)
105#endif
106
97extern struct cred init_cred; 107extern struct cred init_cred;
98 108
99#ifdef CONFIG_PERF_COUNTERS 109#ifdef CONFIG_PERF_EVENTS
100# define INIT_PERF_COUNTERS(tsk) \ 110# define INIT_PERF_EVENTS(tsk) \
101 .perf_counter_mutex = \ 111 .perf_event_mutex = \
102 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \ 112 __MUTEX_INITIALIZER(tsk.perf_event_mutex), \
103 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list), 113 .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
104#else 114#else
105# define INIT_PERF_COUNTERS(tsk) 115# define INIT_PERF_EVENTS(tsk)
106#endif 116#endif
107 117
108/* 118/*
@@ -168,11 +178,12 @@ extern struct cred init_cred;
168 }, \ 178 }, \
169 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 179 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
170 INIT_IDS \ 180 INIT_IDS \
171 INIT_PERF_COUNTERS(tsk) \ 181 INIT_PERF_EVENTS(tsk) \
172 INIT_TRACE_IRQFLAGS \ 182 INIT_TRACE_IRQFLAGS \
173 INIT_LOCKDEP \ 183 INIT_LOCKDEP \
174 INIT_FTRACE_GRAPH \ 184 INIT_FTRACE_GRAPH \
175 INIT_TRACE_RECURSION \ 185 INIT_TRACE_RECURSION \
186 INIT_TASK_RCU_PREEMPT(tsk) \
176} 187}
177 188
178 189
diff --git a/include/linux/input.h b/include/linux/input.h
index 8b3bc3e0d146..c2b1a7d244d9 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1123,7 +1123,7 @@ struct input_dev {
1123 struct mutex mutex; 1123 struct mutex mutex;
1124 1124
1125 unsigned int users; 1125 unsigned int users;
1126 int going_away; 1126 bool going_away;
1127 1127
1128 struct device dev; 1128 struct device dev;
1129 1129
@@ -1377,6 +1377,10 @@ extern struct class input_class;
1377 * methods; erase() is optional. set_gain() and set_autocenter() need 1377 * methods; erase() is optional. set_gain() and set_autocenter() need
1378 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER 1378 * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
1379 * bits. 1379 * bits.
1380 *
1381 * Note that playback(), set_gain() and set_autocenter() are called with
1382 * dev->event_lock spinlock held and interrupts off and thus may not
1383 * sleep.
1380 */ 1384 */
1381struct ff_device { 1385struct ff_device {
1382 int (*upload)(struct input_dev *dev, struct ff_effect *effect, 1386 int (*upload)(struct input_dev *dev, struct ff_effect *effect,
diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
new file mode 100644
index 000000000000..f875b316249d
--- /dev/null
+++ b/include/linux/input/eeti_ts.h
@@ -0,0 +1,9 @@
1#ifndef LINUX_INPUT_EETI_TS_H
2#define LINUX_INPUT_EETI_TS_H
3
4struct eeti_ts_platform_data {
5 unsigned int irq_active_high;
6};
7
8#endif /* LINUX_INPUT_EETI_TS_H */
9
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 15d5903af2dd..b3cd42d50e16 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -63,4 +63,36 @@ struct matrix_keypad_platform_data {
63 bool wakeup; 63 bool wakeup;
64}; 64};
65 65
66/**
67 * matrix_keypad_build_keymap - convert platform keymap into matrix keymap
68 * @keymap_data: keymap supplied by the platform code
69 * @row_shift: number of bits to shift row value by to advance to the next
70 * line in the keymap
71 * @keymap: expanded version of keymap that is suitable for use by
72 * matrix keyboad driver
73 * @keybit: pointer to bitmap of keys supported by input device
74 *
75 * This function converts platform keymap (encoded with KEY() macro) into
76 * an array of keycodes that is suitable for using in a standard matrix
77 * keyboard driver that uses row and col as indices.
78 */
79static inline void
80matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
81 unsigned int row_shift,
82 unsigned short *keymap, unsigned long *keybit)
83{
84 int i;
85
86 for (i = 0; i < keymap_data->keymap_size; i++) {
87 unsigned int key = keymap_data->keymap[i];
88 unsigned int row = KEY_ROW(key);
89 unsigned int col = KEY_COL(key);
90 unsigned short code = KEY_VAL(key);
91
92 keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
93 __set_bit(code, keybit);
94 }
95 __clear_bit(KEY_RESERVED, keybit);
96}
97
66#endif /* _MATRIX_KEYPAD_H */ 98#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 482dc91fd53a..4f0a72a9740c 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -360,4 +360,6 @@ extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
360 360
361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
362 362
363extern int dmar_ir_support(void);
364
363#endif 365#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 35e7df1e9f30..7ca72b74eec7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -10,7 +10,6 @@
10#include <linux/irqreturn.h> 10#include <linux/irqreturn.h>
11#include <linux/irqnr.h> 11#include <linux/irqnr.h>
12#include <linux/hardirq.h> 12#include <linux/hardirq.h>
13#include <linux/sched.h>
14#include <linux/irqflags.h> 13#include <linux/irqflags.h>
15#include <linux/smp.h> 14#include <linux/smp.h>
16#include <linux/percpu.h> 15#include <linux/percpu.h>
@@ -50,6 +49,9 @@
50 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is 49 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
51 * registered first in an shared interrupt is considered for 50 * registered first in an shared interrupt is considered for
52 * performance reasons) 51 * performance reasons)
52 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
53 * Used by threaded interrupts which need to keep the
54 * irq line disabled until the threaded handler has been run.
53 */ 55 */
54#define IRQF_DISABLED 0x00000020 56#define IRQF_DISABLED 0x00000020
55#define IRQF_SAMPLE_RANDOM 0x00000040 57#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -59,6 +61,7 @@
59#define IRQF_PERCPU 0x00000400 61#define IRQF_PERCPU 0x00000400
60#define IRQF_NOBALANCING 0x00000800 62#define IRQF_NOBALANCING 0x00000800
61#define IRQF_IRQPOLL 0x00001000 63#define IRQF_IRQPOLL 0x00001000
64#define IRQF_ONESHOT 0x00002000
62 65
63/* 66/*
64 * Bits used by threaded handlers: 67 * Bits used by threaded handlers:
@@ -80,7 +83,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
80 * struct irqaction - per interrupt action descriptor 83 * struct irqaction - per interrupt action descriptor
81 * @handler: interrupt handler function 84 * @handler: interrupt handler function
82 * @flags: flags (see IRQF_* above) 85 * @flags: flags (see IRQF_* above)
83 * @mask: no comment as it is useless and about to be removed
84 * @name: name of the device 86 * @name: name of the device
85 * @dev_id: cookie to identify the device 87 * @dev_id: cookie to identify the device
86 * @next: pointer to the next irqaction for shared interrupts 88 * @next: pointer to the next irqaction for shared interrupts
@@ -93,7 +95,6 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
93struct irqaction { 95struct irqaction {
94 irq_handler_t handler; 96 irq_handler_t handler;
95 unsigned long flags; 97 unsigned long flags;
96 cpumask_t mask;
97 const char *name; 98 const char *name;
98 void *dev_id; 99 void *dev_id;
99 struct irqaction *next; 100 struct irqaction *next;
@@ -344,6 +345,7 @@ enum
344 NET_TX_SOFTIRQ, 345 NET_TX_SOFTIRQ,
345 NET_RX_SOFTIRQ, 346 NET_RX_SOFTIRQ,
346 BLOCK_SOFTIRQ, 347 BLOCK_SOFTIRQ,
348 BLOCK_IOPOLL_SOFTIRQ,
347 TASKLET_SOFTIRQ, 349 TASKLET_SOFTIRQ,
348 SCHED_SOFTIRQ, 350 SCHED_SOFTIRQ,
349 HRTIMER_SOFTIRQ, 351 HRTIMER_SOFTIRQ,
@@ -607,6 +609,7 @@ extern void debug_poll_all_shared_irqs(void);
607static inline void debug_poll_all_shared_irqs(void) { } 609static inline void debug_poll_all_shared_irqs(void) { }
608#endif 610#endif
609 611
612struct seq_file;
610int show_interrupts(struct seq_file *p, void *v); 613int show_interrupts(struct seq_file *p, void *v);
611 614
612struct irq_desc; 615struct irq_desc;
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 0adb0f91568c..97eb928b4924 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -49,23 +49,30 @@ static inline struct io_mapping *
49io_mapping_create_wc(resource_size_t base, unsigned long size) 49io_mapping_create_wc(resource_size_t base, unsigned long size)
50{ 50{
51 struct io_mapping *iomap; 51 struct io_mapping *iomap;
52 52 pgprot_t prot;
53 if (!is_io_mapping_possible(base, size))
54 return NULL;
55 53
56 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL); 54 iomap = kmalloc(sizeof(*iomap), GFP_KERNEL);
57 if (!iomap) 55 if (!iomap)
58 return NULL; 56 goto out_err;
57
58 if (iomap_create_wc(base, size, &prot))
59 goto out_free;
59 60
60 iomap->base = base; 61 iomap->base = base;
61 iomap->size = size; 62 iomap->size = size;
62 iomap->prot = pgprot_writecombine(__pgprot(__PAGE_KERNEL)); 63 iomap->prot = prot;
63 return iomap; 64 return iomap;
65
66out_free:
67 kfree(iomap);
68out_err:
69 return NULL;
64} 70}
65 71
66static inline void 72static inline void
67io_mapping_free(struct io_mapping *mapping) 73io_mapping_free(struct io_mapping *mapping)
68{ 74{
75 iomap_free(mapping->base, mapping->size);
69 kfree(mapping); 76 kfree(mapping);
70} 77}
71 78
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 786e7b8cece9..83aa81297ea3 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -184,5 +184,9 @@ extern void __devm_release_region(struct device *dev, struct resource *parent,
184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 184extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
185extern int iomem_is_exclusive(u64 addr); 185extern int iomem_is_exclusive(u64 addr);
186 186
187extern int
188walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
189 void *arg, int (*func)(unsigned long, unsigned long, void *));
190
187#endif /* __ASSEMBLY__ */ 191#endif /* __ASSEMBLY__ */
188#endif /* _LINUX_IOPORT_H */ 192#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 228f6c94b69c..76a0759e88ec 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -28,7 +28,6 @@ struct iova {
28 28
29/* holds all the iova translations for a domain */ 29/* holds all the iova translations for a domain */
30struct iova_domain { 30struct iova_domain {
31 spinlock_t iova_alloc_lock;/* Lock to protect iova allocation */
32 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */ 31 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */
33 struct rb_root rbroot; /* iova domain rbtree root */ 32 struct rb_root rbroot; /* iova domain rbtree root */
34 struct rb_node *cached32_node; /* Save last alloced node */ 33 struct rb_node *cached32_node; /* Save last alloced node */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index b8826107b518..3b1594d662b0 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -78,8 +78,6 @@ struct ipc_kludge {
78#define IPCCALL(version,op) ((version)<<16 | (op)) 78#define IPCCALL(version,op) ((version)<<16 | (op))
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81
82#include <linux/kref.h>
83#include <linux/spinlock.h> 81#include <linux/spinlock.h>
84 82
85#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 83#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index cb2e77a3f7f7..ae9653dbcd78 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -69,6 +69,8 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */ 71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */
72#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */
73#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */
72 74
73#ifdef CONFIG_IRQ_PER_CPU 75#ifdef CONFIG_IRQ_PER_CPU
74# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 76# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -100,6 +102,9 @@ struct msi_desc;
100 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ 102 * @set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
101 * @set_wake: enable/disable power-management wake-on of an IRQ 103 * @set_wake: enable/disable power-management wake-on of an IRQ
102 * 104 *
105 * @bus_lock: function to lock access to slow bus (i2c) chips
106 * @bus_sync_unlock: function to sync and unlock slow bus (i2c) chips
107 *
103 * @release: release function solely used by UML 108 * @release: release function solely used by UML
104 * @typename: obsoleted by name, kept as migration helper 109 * @typename: obsoleted by name, kept as migration helper
105 */ 110 */
@@ -123,6 +128,9 @@ struct irq_chip {
123 int (*set_type)(unsigned int irq, unsigned int flow_type); 128 int (*set_type)(unsigned int irq, unsigned int flow_type);
124 int (*set_wake)(unsigned int irq, unsigned int on); 129 int (*set_wake)(unsigned int irq, unsigned int on);
125 130
131 void (*bus_lock)(unsigned int irq);
132 void (*bus_sync_unlock)(unsigned int irq);
133
126 /* Currently used only by UML, might disappear one day.*/ 134 /* Currently used only by UML, might disappear one day.*/
127#ifdef CONFIG_IRQ_RELEASE_METHOD 135#ifdef CONFIG_IRQ_RELEASE_METHOD
128 void (*release)(unsigned int irq, void *dev_id); 136 void (*release)(unsigned int irq, void *dev_id);
@@ -220,13 +228,6 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
220extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); 228extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
221 229
222/* 230/*
223 * Migration helpers for obsolete names, they will go away:
224 */
225#define hw_interrupt_type irq_chip
226#define no_irq_type no_irq_chip
227typedef struct irq_desc irq_desc_t;
228
229/*
230 * Pick up the arch-dependent methods: 231 * Pick up the arch-dependent methods:
231 */ 232 */
232#include <asm/hw_irq.h> 233#include <asm/hw_irq.h>
@@ -289,6 +290,7 @@ extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
289extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); 290extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
290extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); 291extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
291extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 292extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
293extern void handle_nested_irq(unsigned int irq);
292 294
293/* 295/*
294 * Monolithic do_IRQ implementation. 296 * Monolithic do_IRQ implementation.
@@ -379,6 +381,8 @@ set_irq_chained_handler(unsigned int irq,
379 __set_irq_handler(irq, handle, 1, NULL); 381 __set_irq_handler(irq, handle, 1, NULL);
380} 382}
381 383
384extern void set_irq_nested_thread(unsigned int irq, int nest);
385
382extern void set_irq_noprobe(unsigned int irq); 386extern void set_irq_noprobe(unsigned int irq);
383extern void set_irq_probe(unsigned int irq); 387extern void set_irq_probe(unsigned int irq);
384 388
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index ec87b212ff7d..7bf89bc8cbca 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -41,6 +41,12 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
41 ; \ 41 ; \
42 else 42 else
43 43
44#ifdef CONFIG_SMP
45#define irq_node(irq) (irq_to_desc(irq)->node)
46#else
47#define irq_node(irq) 0
48#endif
49
44#endif /* CONFIG_GENERIC_HARDIRQS */ 50#endif /* CONFIG_GENERIC_HARDIRQS */
45 51
46#define for_each_irq_nr(irq) \ 52#define for_each_irq_nr(irq) \
diff --git a/include/linux/isdn/hdlc.h b/include/linux/isdn/hdlc.h
new file mode 100644
index 000000000000..4b3ecc40889a
--- /dev/null
+++ b/include/linux/isdn/hdlc.h
@@ -0,0 +1,82 @@
1/*
2 * hdlc.h -- General purpose ISDN HDLC decoder.
3 *
4 * Implementation of a HDLC decoder/encoder in software.
5 * Neccessary because some ISDN devices don't have HDLC
6 * controllers.
7 *
8 * Copyright (C)
9 * 2009 Karsten Keil <keil@b1-systems.de>
10 * 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
11 * 2001 Frode Isaksen <fisaksen@bewan.com>
12 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29#ifndef __ISDNHDLC_H__
30#define __ISDNHDLC_H__
31
32struct isdnhdlc_vars {
33 int bit_shift;
34 int hdlc_bits1;
35 int data_bits;
36 int ffbit_shift; /* encoding only */
37 int state;
38 int dstpos;
39
40 u16 crc;
41
42 u8 cbin;
43 u8 shift_reg;
44 u8 ffvalue;
45
46 /* set if transferring data */
47 u32 data_received:1;
48 /* set if D channel (send idle instead of flags) */
49 u32 dchannel:1;
50 /* set if 56K adaptation */
51 u32 do_adapt56:1;
52 /* set if in closing phase (need to send CRC + flag) */
53 u32 do_closing:1;
54 /* set if data is bitreverse */
55 u32 do_bitreverse:1;
56};
57
58/* Feature Flags */
59#define HDLC_56KBIT 0x01
60#define HDLC_DCHANNEL 0x02
61#define HDLC_BITREVERSE 0x04
62
63/*
64 The return value from isdnhdlc_decode is
65 the frame length, 0 if no complete frame was decoded,
66 or a negative error number
67*/
68#define HDLC_FRAMING_ERROR 1
69#define HDLC_CRC_ERROR 2
70#define HDLC_LENGTH_ERROR 3
71
72extern void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features);
73
74extern int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src,
75 int slen, int *count, u8 *dst, int dsize);
76
77extern void isdnhdlc_out_init(struct isdnhdlc_vars *hdlc, u32 features);
78
79extern int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src,
80 u16 slen, int *count, u8 *dst, int dsize);
81
82#endif /* __ISDNHDLC_H__ */
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 4c218ee7587a..8687a7dc0632 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -157,7 +157,7 @@ typedef struct {
157 157
158typedef struct { 158typedef struct {
159 int mp_mrru; /* unused */ 159 int mp_mrru; /* unused */
160 struct sk_buff_head frags; /* fragments sl list */ 160 struct sk_buff * frags; /* fragments sl list -- use skb->next */
161 long frames; /* number of frames in the frame list */ 161 long frames; /* number of frames in the frame list */
162 unsigned int seq; /* last processed packet seq #: any packets 162 unsigned int seq; /* last processed packet seq #: any packets
163 * with smaller seq # will be dropped 163 * with smaller seq # will be dropped
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c2049a04fa0b..331530cd3cc6 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -446,7 +446,7 @@ struct transaction_s
446 /* 446 /*
447 * Where in the log does this transaction's commit start? [no locking] 447 * Where in the log does this transaction's commit start? [no locking]
448 */ 448 */
449 unsigned long t_log_start; 449 unsigned int t_log_start;
450 450
451 /* Number of buffers on the t_buffers list [j_list_lock] */ 451 /* Number of buffers on the t_buffers list [j_list_lock] */
452 int t_nr_buffers; 452 int t_nr_buffers;
@@ -556,7 +556,7 @@ struct transaction_s
556 * This transaction is being forced and some process is 556 * This transaction is being forced and some process is
557 * waiting for it to finish. 557 * waiting for it to finish.
558 */ 558 */
559 int t_synchronous_commit:1; 559 unsigned int t_synchronous_commit:1;
560}; 560};
561 561
562/** 562/**
@@ -701,26 +701,26 @@ struct journal_s
701 * Journal head: identifies the first unused block in the journal. 701 * Journal head: identifies the first unused block in the journal.
702 * [j_state_lock] 702 * [j_state_lock]
703 */ 703 */
704 unsigned long j_head; 704 unsigned int j_head;
705 705
706 /* 706 /*
707 * Journal tail: identifies the oldest still-used block in the journal. 707 * Journal tail: identifies the oldest still-used block in the journal.
708 * [j_state_lock] 708 * [j_state_lock]
709 */ 709 */
710 unsigned long j_tail; 710 unsigned int j_tail;
711 711
712 /* 712 /*
713 * Journal free: how many free blocks are there in the journal? 713 * Journal free: how many free blocks are there in the journal?
714 * [j_state_lock] 714 * [j_state_lock]
715 */ 715 */
716 unsigned long j_free; 716 unsigned int j_free;
717 717
718 /* 718 /*
719 * Journal start and end: the block numbers of the first usable block 719 * Journal start and end: the block numbers of the first usable block
720 * and one beyond the last usable block in the journal. [j_state_lock] 720 * and one beyond the last usable block in the journal. [j_state_lock]
721 */ 721 */
722 unsigned long j_first; 722 unsigned int j_first;
723 unsigned long j_last; 723 unsigned int j_last;
724 724
725 /* 725 /*
726 * Device, blocksize and starting block offset for the location where we 726 * Device, blocksize and starting block offset for the location where we
@@ -728,7 +728,7 @@ struct journal_s
728 */ 728 */
729 struct block_device *j_dev; 729 struct block_device *j_dev;
730 int j_blocksize; 730 int j_blocksize;
731 unsigned long j_blk_offset; 731 unsigned int j_blk_offset;
732 732
733 /* 733 /*
734 * Device which holds the client fs. For internal journal this will be 734 * Device which holds the client fs. For internal journal this will be
@@ -859,7 +859,7 @@ extern void __journal_clean_data_list(transaction_t *transaction);
859 859
860/* Log buffer allocation */ 860/* Log buffer allocation */
861extern struct journal_head * journal_get_descriptor_buffer(journal_t *); 861extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
862int journal_next_log_block(journal_t *, unsigned long *); 862int journal_next_log_block(journal_t *, unsigned int *);
863 863
864/* Commit management */ 864/* Commit management */
865extern void journal_commit_transaction(journal_t *); 865extern void journal_commit_transaction(journal_t *);
@@ -874,7 +874,7 @@ extern int
874journal_write_metadata_buffer(transaction_t *transaction, 874journal_write_metadata_buffer(transaction_t *transaction,
875 struct journal_head *jh_in, 875 struct journal_head *jh_in,
876 struct journal_head **jh_out, 876 struct journal_head **jh_out,
877 unsigned long blocknr); 877 unsigned int blocknr);
878 878
879/* Transaction locking */ 879/* Transaction locking */
880extern void __wait_on_journal (journal_t *); 880extern void __wait_on_journal (journal_t *);
@@ -942,7 +942,7 @@ extern void journal_abort (journal_t *, int);
942extern int journal_errno (journal_t *); 942extern int journal_errno (journal_t *);
943extern void journal_ack_err (journal_t *); 943extern void journal_ack_err (journal_t *);
944extern int journal_clear_err (journal_t *); 944extern int journal_clear_err (journal_t *);
945extern int journal_bmap(journal_t *, unsigned long, unsigned long *); 945extern int journal_bmap(journal_t *, unsigned int, unsigned int *);
946extern int journal_force_commit(journal_t *); 946extern int journal_force_commit(journal_t *);
947 947
948/* 948/*
@@ -976,14 +976,14 @@ extern int journal_init_revoke_caches(void);
976 976
977extern void journal_destroy_revoke(journal_t *); 977extern void journal_destroy_revoke(journal_t *);
978extern int journal_revoke (handle_t *, 978extern int journal_revoke (handle_t *,
979 unsigned long, struct buffer_head *); 979 unsigned int, struct buffer_head *);
980extern int journal_cancel_revoke(handle_t *, struct journal_head *); 980extern int journal_cancel_revoke(handle_t *, struct journal_head *);
981extern void journal_write_revoke_records(journal_t *, 981extern void journal_write_revoke_records(journal_t *,
982 transaction_t *, int); 982 transaction_t *, int);
983 983
984/* Recovery revoke support */ 984/* Recovery revoke support */
985extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 985extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
986extern int journal_test_revoke(journal_t *, unsigned long, tid_t); 986extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
987extern void journal_clear_revoke(journal_t *); 987extern void journal_clear_revoke(journal_t *);
988extern void journal_switch_revoke_table(journal_t *journal); 988extern void journal_switch_revoke_table(journal_t *journal);
989 989
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d97eb652d6ca..f1011f7f3d41 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -464,9 +464,9 @@ struct handle_s
464 */ 464 */
465struct transaction_chp_stats_s { 465struct transaction_chp_stats_s {
466 unsigned long cs_chp_time; 466 unsigned long cs_chp_time;
467 unsigned long cs_forced_to_close; 467 __u32 cs_forced_to_close;
468 unsigned long cs_written; 468 __u32 cs_written;
469 unsigned long cs_dropped; 469 __u32 cs_dropped;
470}; 470};
471 471
472/* The transaction_t type is the guts of the journaling mechanism. It 472/* The transaction_t type is the guts of the journaling mechanism. It
@@ -652,7 +652,7 @@ struct transaction_s
652 * This transaction is being forced and some process is 652 * This transaction is being forced and some process is
653 * waiting for it to finish. 653 * waiting for it to finish.
654 */ 654 */
655 int t_synchronous_commit:1; 655 unsigned int t_synchronous_commit:1;
656 656
657 /* 657 /*
658 * For use by the filesystem to store fs-specific data 658 * For use by the filesystem to store fs-specific data
@@ -668,23 +668,16 @@ struct transaction_run_stats_s {
668 unsigned long rs_flushing; 668 unsigned long rs_flushing;
669 unsigned long rs_logging; 669 unsigned long rs_logging;
670 670
671 unsigned long rs_handle_count; 671 __u32 rs_handle_count;
672 unsigned long rs_blocks; 672 __u32 rs_blocks;
673 unsigned long rs_blocks_logged; 673 __u32 rs_blocks_logged;
674}; 674};
675 675
676struct transaction_stats_s { 676struct transaction_stats_s {
677 int ts_type;
678 unsigned long ts_tid; 677 unsigned long ts_tid;
679 union { 678 struct transaction_run_stats_s run;
680 struct transaction_run_stats_s run;
681 struct transaction_chp_stats_s chp;
682 } u;
683}; 679};
684 680
685#define JBD2_STATS_RUN 1
686#define JBD2_STATS_CHECKPOINT 2
687
688static inline unsigned long 681static inline unsigned long
689jbd2_time_diff(unsigned long start, unsigned long end) 682jbd2_time_diff(unsigned long start, unsigned long end)
690{ 683{
@@ -988,12 +981,6 @@ struct journal_s
988 /* 981 /*
989 * Journal statistics 982 * Journal statistics
990 */ 983 */
991 struct transaction_stats_s *j_history;
992 int j_history_max;
993 int j_history_cur;
994 /*
995 * Protect the transactions statistics history
996 */
997 spinlock_t j_history_lock; 984 spinlock_t j_history_lock;
998 struct proc_dir_entry *j_proc_entry; 985 struct proc_dir_entry *j_proc_entry;
999 struct transaction_stats_s j_stats; 986 struct transaction_stats_s j_stats;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d6320a3e8def..f4e3184fa054 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -125,7 +125,7 @@ extern int _cond_resched(void);
125#endif 125#endif
126 126
127#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 127#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
128 void __might_sleep(char *file, int line); 128 void __might_sleep(char *file, int line, int preempt_offset);
129/** 129/**
130 * might_sleep - annotation for functions that can sleep 130 * might_sleep - annotation for functions that can sleep
131 * 131 *
@@ -137,15 +137,16 @@ extern int _cond_resched(void);
137 * supposed to. 137 * supposed to.
138 */ 138 */
139# define might_sleep() \ 139# define might_sleep() \
140 do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0) 140 do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
141#else 141#else
142 static inline void __might_sleep(char *file, int line, int preempt_offset) { }
142# define might_sleep() do { might_resched(); } while (0) 143# define might_sleep() do { might_resched(); } while (0)
143#endif 144#endif
144 145
145#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 146#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
146 147
147#define abs(x) ({ \ 148#define abs(x) ({ \
148 int __x = (x); \ 149 long __x = (x); \
149 (__x < 0) ? -__x : __x; \ 150 (__x < 0) ? -__x : __x; \
150 }) 151 })
151 152
@@ -245,14 +246,16 @@ extern int printk_ratelimit(void);
245extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 246extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
246 unsigned int interval_msec); 247 unsigned int interval_msec);
247 248
249extern int printk_delay_msec;
250
248/* 251/*
249 * Print a one-time message (analogous to WARN_ONCE() et al): 252 * Print a one-time message (analogous to WARN_ONCE() et al):
250 */ 253 */
251#define printk_once(x...) ({ \ 254#define printk_once(x...) ({ \
252 static int __print_once = 1; \ 255 static bool __print_once = true; \
253 \ 256 \
254 if (__print_once) { \ 257 if (__print_once) { \
255 __print_once = 0; \ 258 __print_once = false; \
256 printk(x); \ 259 printk(x); \
257 } \ 260 } \
258}) 261})
@@ -656,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);
656 659
657#endif /* __KERNEL__ */ 660#endif /* __KERNEL__ */
658 661
662#ifndef __EXPORTED_HEADERS__
663#ifndef __KERNEL__
664#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
665#endif /* __KERNEL__ */
666#endif /* __EXPORTED_HEADERS__ */
667
659#define SI_LOAD_SHIFT 16 668#define SI_LOAD_SHIFT 16
660struct sysinfo { 669struct sysinfo {
661 long uptime; /* Seconds since boot */ 670 long uptime; /* Seconds since boot */
@@ -675,13 +684,17 @@ struct sysinfo {
675}; 684};
676 685
677/* Force a compilation error if condition is true */ 686/* Force a compilation error if condition is true */
678#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 687#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
688
689/* Force a compilation error if condition is constant and true */
690#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
679 691
680/* Force a compilation error if condition is true, but also produce a 692/* Force a compilation error if condition is true, but also produce a
681 result (of value 0 and type size_t), so the expression can be used 693 result (of value 0 and type size_t), so the expression can be used
682 e.g. in a structure initializer (or where-ever else comma expressions 694 e.g. in a structure initializer (or where-ever else comma expressions
683 aren't permitted). */ 695 aren't permitted). */
684#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) 696#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
697#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
685 698
686/* Trap pasters of __FUNCTION__ at compile-time */ 699/* Trap pasters of __FUNCTION__ at compile-time */
687#define __FUNCTION__ (__func__) 700#define __FUNCTION__ (__func__)
diff --git a/include/linux/key.h b/include/linux/key.h
index e544f466d69a..cd50dfa1d4c2 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -129,7 +129,10 @@ struct key {
129 struct rw_semaphore sem; /* change vs change sem */ 129 struct rw_semaphore sem; /* change vs change sem */
130 struct key_user *user; /* owner of this key */ 130 struct key_user *user; /* owner of this key */
131 void *security; /* security data for this key */ 131 void *security; /* security data for this key */
132 time_t expiry; /* time at which key expires (or 0) */ 132 union {
133 time_t expiry; /* time at which key expires (or 0) */
134 time_t revoked_at; /* time at which key was revoked */
135 };
133 uid_t uid; 136 uid_t uid;
134 gid_t gid; 137 gid_t gid;
135 key_perm_t perm; /* access permissions */ 138 key_perm_t perm; /* access permissions */
@@ -275,6 +278,8 @@ static inline key_serial_t key_serial(struct key *key)
275extern ctl_table key_sysctls[]; 278extern ctl_table key_sysctls[];
276#endif 279#endif
277 280
281extern void key_replace_session_keyring(void);
282
278/* 283/*
279 * the userspace interface 284 * the userspace interface
280 */ 285 */
@@ -297,6 +302,7 @@ extern void key_init(void);
297#define key_fsuid_changed(t) do { } while(0) 302#define key_fsuid_changed(t) do { } while(0)
298#define key_fsgid_changed(t) do { } while(0) 303#define key_fsgid_changed(t) do { } while(0)
299#define key_init() do { } while(0) 304#define key_init() do { } while(0)
305#define key_replace_session_keyring() do { } while(0)
300 306
301#endif /* CONFIG_KEYS */ 307#endif /* CONFIG_KEYS */
302#endif /* __KERNEL__ */ 308#endif /* __KERNEL__ */
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index c0688eb72093..bd383f1944fb 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -52,5 +52,6 @@
52#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */ 52#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
54#define KEYCTL_GET_SECURITY 17 /* get key security label */ 54#define KEYCTL_GET_SECURITY 17 /* get key security label */
55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
55 56
56#endif /* _LINUX_KEYCTL_H */ 57#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 29f62e1733ff..ad6bdf5a5970 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -38,7 +38,7 @@ extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
38 spinlock_t *lock); 38 spinlock_t *lock);
39extern void kfifo_free(struct kfifo *fifo); 39extern void kfifo_free(struct kfifo *fifo);
40extern unsigned int __kfifo_put(struct kfifo *fifo, 40extern unsigned int __kfifo_put(struct kfifo *fifo,
41 unsigned char *buffer, unsigned int len); 41 const unsigned char *buffer, unsigned int len);
42extern unsigned int __kfifo_get(struct kfifo *fifo, 42extern unsigned int __kfifo_get(struct kfifo *fifo,
43 unsigned char *buffer, unsigned int len); 43 unsigned char *buffer, unsigned int len);
44 44
@@ -77,7 +77,7 @@ static inline void kfifo_reset(struct kfifo *fifo)
77 * bytes copied. 77 * bytes copied.
78 */ 78 */
79static inline unsigned int kfifo_put(struct kfifo *fifo, 79static inline unsigned int kfifo_put(struct kfifo *fifo,
80 unsigned char *buffer, unsigned int len) 80 const unsigned char *buffer, unsigned int len)
81{ 81{
82 unsigned long flags; 82 unsigned long flags;
83 unsigned int ret; 83 unsigned int ret;
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 47b39b7c7e84..e880d4cf9e22 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -34,6 +34,8 @@ void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
34int kmemcheck_show_addr(unsigned long address); 34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address); 35int kmemcheck_hide_addr(unsigned long address);
36 36
37bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
38
37#else 39#else
38#define kmemcheck_enabled 0 40#define kmemcheck_enabled 0
39 41
@@ -99,6 +101,11 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
99{ 101{
100} 102}
101 103
104static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
105{
106 return true;
107}
108
102#endif /* CONFIG_KMEMCHECK */ 109#endif /* CONFIG_KMEMCHECK */
103 110
104/* 111/*
@@ -137,10 +144,15 @@ static inline void kmemcheck_mark_initialized_pages(struct page *p,
137 int name##_end[0]; 144 int name##_end[0];
138 145
139#define kmemcheck_annotate_bitfield(ptr, name) \ 146#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \ 147 do { \
141 int _n = (long) &((ptr)->name##_end) \ 148 int _n; \
149 \
150 if (!ptr) \
151 break; \
152 \
153 _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \ 154 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \ 155 MAYBE_BUILD_BUG_ON(_n < 0); \
144 \ 156 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 157 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0) 158 } while (0)
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 6a63807f714e..3c7497d46ee9 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -23,18 +23,18 @@
23 23
24#ifdef CONFIG_DEBUG_KMEMLEAK 24#ifdef CONFIG_DEBUG_KMEMLEAK
25 25
26extern void kmemleak_init(void); 26extern void kmemleak_init(void) __ref;
27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, 27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
28 gfp_t gfp); 28 gfp_t gfp) __ref;
29extern void kmemleak_free(const void *ptr); 29extern void kmemleak_free(const void *ptr) __ref;
30extern void kmemleak_free_part(const void *ptr, size_t size); 30extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
31extern void kmemleak_padding(const void *ptr, unsigned long offset, 31extern void kmemleak_padding(const void *ptr, unsigned long offset,
32 size_t size); 32 size_t size) __ref;
33extern void kmemleak_not_leak(const void *ptr); 33extern void kmemleak_not_leak(const void *ptr) __ref;
34extern void kmemleak_ignore(const void *ptr); 34extern void kmemleak_ignore(const void *ptr) __ref;
35extern void kmemleak_scan_area(const void *ptr, unsigned long offset, 35extern void kmemleak_scan_area(const void *ptr, unsigned long offset,
36 size_t length, gfp_t gfp); 36 size_t length, gfp_t gfp) __ref;
37extern void kmemleak_no_scan(const void *ptr); 37extern void kmemleak_no_scan(const void *ptr) __ref;
38 38
39static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, 39static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
40 int min_count, unsigned long flags, 40 int min_count, unsigned long flags,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index bcd9c07848be..3a46b7b7abb2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -48,13 +48,13 @@
48#define KPROBE_HIT_SSDONE 0x00000008 48#define KPROBE_HIT_SSDONE 0x00000008
49 49
50/* Attach to insert probes on any functions which should be ignored*/ 50/* Attach to insert probes on any functions which should be ignored*/
51#define __kprobes __attribute__((__section__(".kprobes.text"))) notrace 51#define __kprobes __attribute__((__section__(".kprobes.text")))
52#else /* CONFIG_KPROBES */ 52#else /* CONFIG_KPROBES */
53typedef int kprobe_opcode_t; 53typedef int kprobe_opcode_t;
54struct arch_specific_insn { 54struct arch_specific_insn {
55 int dummy; 55 int dummy;
56}; 56};
57#define __kprobes notrace 57#define __kprobes
58#endif /* CONFIG_KPROBES */ 58#endif /* CONFIG_KPROBES */
59 59
60struct kprobe; 60struct kprobe;
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 0cef6badd6fb..b0cb0ebad9e6 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -16,7 +16,6 @@
16#define _KREF_H_ 16#define _KREF_H_
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/atomic.h>
20 19
21struct kref { 20struct kref {
22 atomic_t refcount; 21 atomic_t refcount;
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
new file mode 100644
index 000000000000..a485c14ecd5d
--- /dev/null
+++ b/include/linux/ksm.h
@@ -0,0 +1,79 @@
1#ifndef __LINUX_KSM_H
2#define __LINUX_KSM_H
3/*
4 * Memory merging support.
5 *
6 * This code enables dynamic sharing of identical pages found in different
7 * memory areas, even if they are not shared by fork().
8 */
9
10#include <linux/bitops.h>
11#include <linux/mm.h>
12#include <linux/sched.h>
13#include <linux/vmstat.h>
14
15#ifdef CONFIG_KSM
16int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
17 unsigned long end, int advice, unsigned long *vm_flags);
18int __ksm_enter(struct mm_struct *mm);
19void __ksm_exit(struct mm_struct *mm);
20
21static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
22{
23 if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
24 return __ksm_enter(mm);
25 return 0;
26}
27
28static inline void ksm_exit(struct mm_struct *mm)
29{
30 if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
31 __ksm_exit(mm);
32}
33
34/*
35 * A KSM page is one of those write-protected "shared pages" or "merged pages"
36 * which KSM maps into multiple mms, wherever identical anonymous page content
37 * is found in VM_MERGEABLE vmas. It's a PageAnon page, with NULL anon_vma.
38 */
39static inline int PageKsm(struct page *page)
40{
41 return ((unsigned long)page->mapping == PAGE_MAPPING_ANON);
42}
43
44/*
45 * But we have to avoid the checking which page_add_anon_rmap() performs.
46 */
47static inline void page_add_ksm_rmap(struct page *page)
48{
49 if (atomic_inc_and_test(&page->_mapcount)) {
50 page->mapping = (void *) PAGE_MAPPING_ANON;
51 __inc_zone_page_state(page, NR_ANON_PAGES);
52 }
53}
54#else /* !CONFIG_KSM */
55
56static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
57 unsigned long end, int advice, unsigned long *vm_flags)
58{
59 return 0;
60}
61
62static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
63{
64 return 0;
65}
66
67static inline void ksm_exit(struct mm_struct *mm)
68{
69}
70
71static inline int PageKsm(struct page *page)
72{
73 return 0;
74}
75
76/* No stub required for page_add_ksm_rmap(page) */
77#endif /* !CONFIG_KSM */
78
79#endif
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 3db5d8d37485..f8f8900fc5ec 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -14,7 +14,7 @@
14 14
15#define KVM_API_VERSION 12 15#define KVM_API_VERSION 12
16 16
17/* for KVM_TRACE_ENABLE */ 17/* for KVM_TRACE_ENABLE, deprecated */
18struct kvm_user_trace_setup { 18struct kvm_user_trace_setup {
19 __u32 buf_size; /* sub_buffer size of each per-cpu */ 19 __u32 buf_size; /* sub_buffer size of each per-cpu */
20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ 20 __u32 buf_nr; /* the number of sub_buffers of each per-cpu */
@@ -70,6 +70,14 @@ struct kvm_irqchip {
70 } chip; 70 } chip;
71}; 71};
72 72
73/* for KVM_CREATE_PIT2 */
74struct kvm_pit_config {
75 __u32 flags;
76 __u32 pad[15];
77};
78
79#define KVM_PIT_SPEAKER_DUMMY 1
80
73#define KVM_EXIT_UNKNOWN 0 81#define KVM_EXIT_UNKNOWN 0
74#define KVM_EXIT_EXCEPTION 1 82#define KVM_EXIT_EXCEPTION 1
75#define KVM_EXIT_IO 2 83#define KVM_EXIT_IO 2
@@ -87,6 +95,10 @@ struct kvm_irqchip {
87#define KVM_EXIT_S390_RESET 14 95#define KVM_EXIT_S390_RESET 14
88#define KVM_EXIT_DCR 15 96#define KVM_EXIT_DCR 15
89#define KVM_EXIT_NMI 16 97#define KVM_EXIT_NMI 16
98#define KVM_EXIT_INTERNAL_ERROR 17
99
100/* For KVM_EXIT_INTERNAL_ERROR */
101#define KVM_INTERNAL_ERROR_EMULATION 1
90 102
91/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 103/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
92struct kvm_run { 104struct kvm_run {
@@ -173,6 +185,9 @@ struct kvm_run {
173 __u32 data; 185 __u32 data;
174 __u8 is_write; 186 __u8 is_write;
175 } dcr; 187 } dcr;
188 struct {
189 __u32 suberror;
190 } internal;
176 /* Fix the size of the union. */ 191 /* Fix the size of the union. */
177 char padding[256]; 192 char padding[256];
178 }; 193 };
@@ -292,6 +307,28 @@ struct kvm_guest_debug {
292 struct kvm_guest_debug_arch arch; 307 struct kvm_guest_debug_arch arch;
293}; 308};
294 309
310enum {
311 kvm_ioeventfd_flag_nr_datamatch,
312 kvm_ioeventfd_flag_nr_pio,
313 kvm_ioeventfd_flag_nr_deassign,
314 kvm_ioeventfd_flag_nr_max,
315};
316
317#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
318#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
319#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
320
321#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1)
322
323struct kvm_ioeventfd {
324 __u64 datamatch;
325 __u64 addr; /* legal pio/mmio address */
326 __u32 len; /* 1, 2, 4, or 8 bytes */
327 __s32 fd;
328 __u32 flags;
329 __u8 pad[36];
330};
331
295#define KVM_TRC_SHIFT 16 332#define KVM_TRC_SHIFT 16
296/* 333/*
297 * kvm trace categories 334 * kvm trace categories
@@ -310,35 +347,6 @@ struct kvm_guest_debug {
310#define KVM_TRC_CYCLE_SIZE 8 347#define KVM_TRC_CYCLE_SIZE 8
311#define KVM_TRC_EXTRA_MAX 7 348#define KVM_TRC_EXTRA_MAX 7
312 349
313/* This structure represents a single trace buffer record. */
314struct kvm_trace_rec {
315 /* variable rec_val
316 * is split into:
317 * bits 0 - 27 -> event id
318 * bits 28 -30 -> number of extra data args of size u32
319 * bits 31 -> binary indicator for if tsc is in record
320 */
321 __u32 rec_val;
322 __u32 pid;
323 __u32 vcpu_id;
324 union {
325 struct {
326 __u64 timestamp;
327 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
328 } __attribute__((packed)) timestamp;
329 struct {
330 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
331 } notimestamp;
332 } u;
333};
334
335#define TRACE_REC_EVENT_ID(val) \
336 (0x0fffffff & (val))
337#define TRACE_REC_NUM_DATA_ARGS(val) \
338 (0x70000000 & ((val) << 28))
339#define TRACE_REC_TCS(val) \
340 (0x80000000 & ((val) << 31))
341
342#define KVMIO 0xAE 350#define KVMIO 0xAE
343 351
344/* 352/*
@@ -415,6 +423,19 @@ struct kvm_trace_rec {
415#define KVM_CAP_ASSIGN_DEV_IRQ 29 423#define KVM_CAP_ASSIGN_DEV_IRQ 29
416/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ 424/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
417#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 425#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
426#ifdef __KVM_HAVE_MCE
427#define KVM_CAP_MCE 31
428#endif
429#define KVM_CAP_IRQFD 32
430#ifdef __KVM_HAVE_PIT
431#define KVM_CAP_PIT2 33
432#endif
433#define KVM_CAP_SET_BOOT_CPU_ID 34
434#ifdef __KVM_HAVE_PIT_STATE2
435#define KVM_CAP_PIT_STATE2 35
436#endif
437#define KVM_CAP_IOEVENTFD 36
438#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
418 439
419#ifdef KVM_CAP_IRQ_ROUTING 440#ifdef KVM_CAP_IRQ_ROUTING
420 441
@@ -454,15 +475,32 @@ struct kvm_irq_routing {
454 475
455#endif 476#endif
456 477
478#ifdef KVM_CAP_MCE
479/* x86 MCE */
480struct kvm_x86_mce {
481 __u64 status;
482 __u64 addr;
483 __u64 misc;
484 __u64 mcg_status;
485 __u8 bank;
486 __u8 pad1[7];
487 __u64 pad2[3];
488};
489#endif
490
491#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
492
493struct kvm_irqfd {
494 __u32 fd;
495 __u32 gsi;
496 __u32 flags;
497 __u8 pad[20];
498};
499
457/* 500/*
458 * ioctls for VM fds 501 * ioctls for VM fds
459 */ 502 */
460#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 503#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
461#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
462#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
463#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
464 struct kvm_userspace_memory_region)
465#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
466/* 504/*
467 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns 505 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
468 * a vcpu fd. 506 * a vcpu fd.
@@ -470,6 +508,12 @@ struct kvm_irq_routing {
470#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 508#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
471#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 509#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
472#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 510#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
511#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
512#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
513#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
514 struct kvm_userspace_memory_region)
515#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
516#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
473/* Device model IOC */ 517/* Device model IOC */
474#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 518#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
475#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 519#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -498,6 +542,10 @@ struct kvm_irq_routing {
498#define KVM_ASSIGN_SET_MSIX_ENTRY \ 542#define KVM_ASSIGN_SET_MSIX_ENTRY \
499 _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) 543 _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
500#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) 544#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
545#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
546#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
547#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
548#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
501 549
502/* 550/*
503 * ioctls for vcpu fds 551 * ioctls for vcpu fds
@@ -541,6 +589,10 @@ struct kvm_irq_routing {
541#define KVM_NMI _IO(KVMIO, 0x9a) 589#define KVM_NMI _IO(KVMIO, 0x9a)
542/* Available with KVM_CAP_SET_GUEST_DEBUG */ 590/* Available with KVM_CAP_SET_GUEST_DEBUG */
543#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) 591#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
592/* MCE for x86 */
593#define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64)
594#define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64)
595#define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce)
544 596
545/* 597/*
546 * Deprecated interfaces 598 * Deprecated interfaces
@@ -563,6 +615,9 @@ struct kvm_debug_guest {
563#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) 615#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *)
564#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) 616#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *)
565 617
618#define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2)
619#define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
620
566#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 621#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
567#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 622#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
568#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) 623#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
@@ -633,7 +688,7 @@ struct kvm_assigned_msix_nr {
633 __u16 padding; 688 __u16 padding;
634}; 689};
635 690
636#define KVM_MAX_MSIX_PER_DEV 512 691#define KVM_MAX_MSIX_PER_DEV 256
637struct kvm_assigned_msix_entry { 692struct kvm_assigned_msix_entry {
638 __u32 assigned_dev_id; 693 __u32 assigned_dev_id;
639 __u32 gsi; 694 __u32 gsi;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3060bdc35ffe..b7bbb5ddd7ae 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -15,7 +15,6 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/marker.h>
19#include <linux/msi.h> 18#include <linux/msi.h>
20#include <asm/signal.h> 19#include <asm/signal.h>
21 20
@@ -42,6 +41,7 @@
42 41
43#define KVM_USERSPACE_IRQ_SOURCE_ID 0 42#define KVM_USERSPACE_IRQ_SOURCE_ID 0
44 43
44struct kvm;
45struct kvm_vcpu; 45struct kvm_vcpu;
46extern struct kmem_cache *kvm_vcpu_cache; 46extern struct kmem_cache *kvm_vcpu_cache;
47 47
@@ -59,10 +59,18 @@ struct kvm_io_bus {
59 59
60void kvm_io_bus_init(struct kvm_io_bus *bus); 60void kvm_io_bus_init(struct kvm_io_bus *bus);
61void kvm_io_bus_destroy(struct kvm_io_bus *bus); 61void kvm_io_bus_destroy(struct kvm_io_bus *bus);
62struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, 62int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len,
63 gpa_t addr, int len, int is_write); 63 const void *val);
64void kvm_io_bus_register_dev(struct kvm_io_bus *bus, 64int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len,
65 struct kvm_io_device *dev); 65 void *val);
66int __kvm_io_bus_register_dev(struct kvm_io_bus *bus,
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);
70void __kvm_io_bus_unregister_dev(struct kvm_io_bus *bus,
71 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);
66 74
67struct kvm_vcpu { 75struct kvm_vcpu {
68 struct kvm *kvm; 76 struct kvm *kvm;
@@ -103,7 +111,7 @@ struct kvm_memory_slot {
103 struct { 111 struct {
104 unsigned long rmap_pde; 112 unsigned long rmap_pde;
105 int write_count; 113 int write_count;
106 } *lpage_info; 114 } *lpage_info[KVM_NR_PAGE_SIZES - 1];
107 unsigned long userspace_addr; 115 unsigned long userspace_addr;
108 int user_alloc; 116 int user_alloc;
109}; 117};
@@ -124,7 +132,6 @@ struct kvm_kernel_irq_routing_entry {
124}; 132};
125 133
126struct kvm { 134struct kvm {
127 struct mutex lock; /* protects the vcpus array and APIC accesses */
128 spinlock_t mmu_lock; 135 spinlock_t mmu_lock;
129 spinlock_t requests_lock; 136 spinlock_t requests_lock;
130 struct rw_semaphore slots_lock; 137 struct rw_semaphore slots_lock;
@@ -132,10 +139,23 @@ struct kvm {
132 int nmemslots; 139 int nmemslots;
133 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 140 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
134 KVM_PRIVATE_MEM_SLOTS]; 141 KVM_PRIVATE_MEM_SLOTS];
142#ifdef CONFIG_KVM_APIC_ARCHITECTURE
143 u32 bsp_vcpu_id;
144 struct kvm_vcpu *bsp_vcpu;
145#endif
135 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 146 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
147 atomic_t online_vcpus;
136 struct list_head vm_list; 148 struct list_head vm_list;
149 struct mutex lock;
137 struct kvm_io_bus mmio_bus; 150 struct kvm_io_bus mmio_bus;
138 struct kvm_io_bus pio_bus; 151 struct kvm_io_bus pio_bus;
152#ifdef CONFIG_HAVE_KVM_EVENTFD
153 struct {
154 spinlock_t lock;
155 struct list_head items;
156 } irqfds;
157 struct list_head ioeventfds;
158#endif
139 struct kvm_vm_stat stat; 159 struct kvm_vm_stat stat;
140 struct kvm_arch arch; 160 struct kvm_arch arch;
141 atomic_t users_count; 161 atomic_t users_count;
@@ -144,6 +164,7 @@ struct kvm {
144 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 164 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
145#endif 165#endif
146 166
167 struct mutex irq_lock;
147#ifdef CONFIG_HAVE_KVM_IRQCHIP 168#ifdef CONFIG_HAVE_KVM_IRQCHIP
148 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */ 169 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
149 struct hlist_head mask_notifier_list; 170 struct hlist_head mask_notifier_list;
@@ -167,6 +188,17 @@ struct kvm {
167#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) 188#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
168#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) 189#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
169 190
191static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
192{
193 smp_rmb();
194 return kvm->vcpus[i];
195}
196
197#define kvm_for_each_vcpu(idx, vcpup, kvm) \
198 for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \
199 idx < atomic_read(&kvm->online_vcpus) && vcpup; \
200 vcpup = kvm_get_vcpu(kvm, ++idx))
201
170int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 202int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
171void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 203void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
172 204
@@ -201,6 +233,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
201 struct kvm_userspace_memory_region *mem, 233 struct kvm_userspace_memory_region *mem,
202 struct kvm_memory_slot old, 234 struct kvm_memory_slot old,
203 int user_alloc); 235 int user_alloc);
236void kvm_disable_largepages(void);
204void kvm_arch_flush_shadow(struct kvm *kvm); 237void kvm_arch_flush_shadow(struct kvm *kvm);
205gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); 238gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
206struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 239struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
@@ -243,8 +276,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
243 unsigned int ioctl, unsigned long arg); 276 unsigned int ioctl, unsigned long arg);
244long kvm_arch_vcpu_ioctl(struct file *filp, 277long kvm_arch_vcpu_ioctl(struct file *filp,
245 unsigned int ioctl, unsigned long arg); 278 unsigned int ioctl, unsigned long arg);
246void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
247void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
248 279
249int kvm_dev_ioctl_check_extension(long ext); 280int kvm_dev_ioctl_check_extension(long ext);
250 281
@@ -300,7 +331,6 @@ int kvm_arch_hardware_setup(void);
300void kvm_arch_hardware_unsetup(void); 331void kvm_arch_hardware_unsetup(void);
301void kvm_arch_check_processor_compat(void *rtn); 332void kvm_arch_check_processor_compat(void *rtn);
302int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 333int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
303int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
304 334
305void kvm_free_physmem(struct kvm *kvm); 335void kvm_free_physmem(struct kvm *kvm);
306 336
@@ -309,8 +339,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm);
309void kvm_free_all_assigned_devices(struct kvm *kvm); 339void kvm_free_all_assigned_devices(struct kvm *kvm);
310void kvm_arch_sync_events(struct kvm *kvm); 340void kvm_arch_sync_events(struct kvm *kvm);
311 341
312int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
313int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
314int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 342int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
315void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 343void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
316 344
@@ -366,7 +394,8 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
366void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 394void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
367void kvm_register_irq_ack_notifier(struct kvm *kvm, 395void kvm_register_irq_ack_notifier(struct kvm *kvm,
368 struct kvm_irq_ack_notifier *kian); 396 struct kvm_irq_ack_notifier *kian);
369void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); 397void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
398 struct kvm_irq_ack_notifier *kian);
370int kvm_request_irq_source_id(struct kvm *kvm); 399int kvm_request_irq_source_id(struct kvm *kvm);
371void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 400void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
372 401
@@ -459,37 +488,6 @@ struct kvm_stats_debugfs_item {
459extern struct kvm_stats_debugfs_item debugfs_entries[]; 488extern struct kvm_stats_debugfs_item debugfs_entries[];
460extern struct dentry *kvm_debugfs_dir; 489extern struct dentry *kvm_debugfs_dir;
461 490
462#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
463 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
464 vcpu, 5, d1, d2, d3, d4, d5)
465#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
466 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
467 vcpu, 4, d1, d2, d3, d4, 0)
468#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
469 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
470 vcpu, 3, d1, d2, d3, 0, 0)
471#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
472 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
473 vcpu, 2, d1, d2, 0, 0, 0)
474#define KVMTRACE_1D(evt, vcpu, d1, name) \
475 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
476 vcpu, 1, d1, 0, 0, 0, 0)
477#define KVMTRACE_0D(evt, vcpu, name) \
478 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
479 vcpu, 0, 0, 0, 0, 0, 0)
480
481#ifdef CONFIG_KVM_TRACE
482int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg);
483void kvm_trace_cleanup(void);
484#else
485static inline
486int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
487{
488 return -EINVAL;
489}
490#define kvm_trace_cleanup() ((void)0)
491#endif
492
493#ifdef KVM_ARCH_WANT_MMU_NOTIFIER 491#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
494static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) 492static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
495{ 493{
@@ -525,4 +523,33 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
525 523
526#endif 524#endif
527 525
526#ifdef CONFIG_HAVE_KVM_EVENTFD
527
528void kvm_eventfd_init(struct kvm *kvm);
529int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
530void kvm_irqfd_release(struct kvm *kvm);
531int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
532
533#else
534
535static inline void kvm_eventfd_init(struct kvm *kvm) {}
536static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
537{
538 return -EINVAL;
539}
540
541static inline void kvm_irqfd_release(struct kvm *kvm) {}
542static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
543{
544 return -ENOSYS;
545}
546
547#endif /* CONFIG_HAVE_KVM_EVENTFD */
548
549#ifdef CONFIG_KVM_APIC_ARCHITECTURE
550static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
551{
552 return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
553}
554#endif
528#endif 555#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 3ddce03766ca..d73109243fda 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -13,6 +13,7 @@
13#define KVM_ENOSYS 1000 13#define KVM_ENOSYS 1000
14#define KVM_EFAULT EFAULT 14#define KVM_EFAULT EFAULT
15#define KVM_E2BIG E2BIG 15#define KVM_E2BIG E2BIG
16#define KVM_EPERM EPERM
16 17
17#define KVM_HC_VAPIC_POLL_IRQ 1 18#define KVM_HC_VAPIC_POLL_IRQ 1
18#define KVM_HC_MMU_OP 2 19#define KVM_HC_MMU_OP 2
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e5b6e33c6571..87698640c091 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -143,7 +143,6 @@ enum {
143 143
144 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ 144 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
145 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ 145 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
149 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 148 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
@@ -190,6 +189,7 @@ enum {
190 ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */ 189 ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */
191 ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */ 190 ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */
192 ATA_FLAG_DEBUGMSG = (1 << 13), 191 ATA_FLAG_DEBUGMSG = (1 << 13),
192 ATA_FLAG_FPDMA_AA = (1 << 14), /* driver supports Auto-Activate */
193 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 193 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
194 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 194 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
195 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 195 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
@@ -386,6 +386,7 @@ enum {
386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */ 386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */
387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
388 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ 388 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */
389 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
389 390
390 /* DMA mask for user DMA control: User visible values; DO NOT 391 /* DMA mask for user DMA control: User visible values; DO NOT
391 renumber */ 392 renumber */
@@ -417,6 +418,17 @@ enum {
417 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 418 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
418 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE | 419 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
419 ATA_TIMING_UDMA, 420 ATA_TIMING_UDMA,
421
422 /* ACPI constants */
423 ATA_ACPI_FILTER_SETXFER = 1 << 0,
424 ATA_ACPI_FILTER_LOCK = 1 << 1,
425 ATA_ACPI_FILTER_DIPM = 1 << 2,
426 ATA_ACPI_FILTER_FPDMA_OFFSET = 1 << 3, /* FPDMA non-zero offset */
427 ATA_ACPI_FILTER_FPDMA_AA = 1 << 4, /* FPDMA auto activate */
428
429 ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER |
430 ATA_ACPI_FILTER_LOCK |
431 ATA_ACPI_FILTER_DIPM,
420}; 432};
421 433
422enum ata_xfer_mask { 434enum ata_xfer_mask {
@@ -586,6 +598,7 @@ struct ata_device {
586#ifdef CONFIG_ATA_ACPI 598#ifdef CONFIG_ATA_ACPI
587 acpi_handle acpi_handle; 599 acpi_handle acpi_handle;
588 union acpi_object *gtf_cache; 600 union acpi_object *gtf_cache;
601 unsigned int gtf_filter;
589#endif 602#endif
590 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ 603 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
591 u64 n_sectors; /* size of device, if ATA */ 604 u64 n_sectors; /* size of device, if ATA */
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index b94534b7e266..79603a6c356f 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -44,6 +44,9 @@ struct ps2dev {
44void ps2_init(struct ps2dev *ps2dev, struct serio *serio); 44void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout); 45int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout); 46void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
47void ps2_begin_command(struct ps2dev *ps2dev);
48void ps2_end_command(struct ps2dev *ps2dev);
49int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
47int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command); 50int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
48int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data); 51int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
49int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data); 52int ps2_handle_response(struct ps2dev *ps2dev, unsigned char data);
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 691f59171c6c..5126cceb6ae9 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -57,6 +57,7 @@
57 57
58#ifdef __ASSEMBLY__ 58#ifdef __ASSEMBLY__
59 59
60#ifndef LINKER_SCRIPT
60#define ALIGN __ALIGN 61#define ALIGN __ALIGN
61#define ALIGN_STR __ALIGN_STR 62#define ALIGN_STR __ALIGN_STR
62 63
@@ -66,6 +67,7 @@
66 ALIGN; \ 67 ALIGN; \
67 name: 68 name:
68#endif 69#endif
70#endif /* LINKER_SCRIPT */
69 71
70#ifndef WEAK 72#ifndef WEAK
71#define WEAK(name) \ 73#define WEAK(name) \
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index ad651f4e45ac..3cc2f2c53e4c 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -32,8 +32,17 @@ struct lis3lv02d_platform_data {
32#define LIS3_IRQ2_DATA_READY (4 << 3) 32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3) 33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6) 34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7) 35#define LIS3_IRQ_ACTIVE_LOW (1 << 7)
36 unsigned char irq_cfg; 36 unsigned char irq_cfg;
37
38#define LIS3_WAKEUP_X_LO (1 << 0)
39#define LIS3_WAKEUP_X_HI (1 << 1)
40#define LIS3_WAKEUP_Y_LO (1 << 2)
41#define LIS3_WAKEUP_Y_HI (1 << 3)
42#define LIS3_WAKEUP_Z_LO (1 << 4)
43#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh;
37}; 46};
38 47
39#endif /* __LIS3LV02D_H_ */ 48#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index c325b187966b..a34dea46b629 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -338,49 +338,6 @@ static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
338 } 338 }
339} 339}
340 340
341static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
342 const struct sockaddr *sap2)
343{
344 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
345 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347}
348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
351 const struct sockaddr *sap2)
352{
353 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
364
365/*
366 * Compare two host addresses
367 *
368 * Return TRUE if the addresses are the same; otherwise FALSE.
369 */
370static inline int nlm_cmp_addr(const struct sockaddr *sap1,
371 const struct sockaddr *sap2)
372{
373 if (sap1->sa_family == sap2->sa_family) {
374 switch (sap1->sa_family) {
375 case AF_INET:
376 return __nlm_cmp_addr4(sap1, sap2);
377 case AF_INET6:
378 return __nlm_cmp_addr6(sap1, sap2);
379 }
380 }
381 return 0;
382}
383
384/* 341/*
385 * Compare two NLM locks. 342 * Compare two NLM locks.
386 * When the second lock is of type F_UNLCK, this acts like a wildcard. 343 * When the second lock is of type F_UNLCK, this acts like a wildcard.
@@ -395,7 +352,7 @@ static inline int nlm_compare_locks(const struct file_lock *fl1,
395 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK); 352 &&(fl1->fl_type == fl2->fl_type || fl2->fl_type == F_UNLCK);
396} 353}
397 354
398extern struct lock_manager_operations nlmsvc_lock_operations; 355extern const struct lock_manager_operations nlmsvc_lock_operations;
399 356
400#endif /* __KERNEL__ */ 357#endif /* __KERNEL__ */
401 358
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index b25d1b53df0d..9ccf0e286b2a 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -149,6 +149,12 @@ struct lock_list {
149 struct lock_class *class; 149 struct lock_class *class;
150 struct stack_trace trace; 150 struct stack_trace trace;
151 int distance; 151 int distance;
152
153 /*
154 * The parent field is used to implement breadth-first search, and the
155 * bit 0 is reused to indicate if the lock has been accessed in BFS.
156 */
157 struct lock_list *parent;
152}; 158};
153 159
154/* 160/*
@@ -208,10 +214,12 @@ struct held_lock {
208 * interrupt context: 214 * interrupt context:
209 */ 215 */
210 unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ 216 unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */
211 unsigned int trylock:1; 217 unsigned int trylock:1; /* 16 bits */
218
212 unsigned int read:2; /* see lock_acquire() comment */ 219 unsigned int read:2; /* see lock_acquire() comment */
213 unsigned int check:2; /* see lock_acquire() comment */ 220 unsigned int check:2; /* see lock_acquire() comment */
214 unsigned int hardirqs_off:1; 221 unsigned int hardirqs_off:1;
222 unsigned int references:11; /* 32 bits */
215}; 223};
216 224
217/* 225/*
@@ -291,6 +299,10 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
291extern void lock_release(struct lockdep_map *lock, int nested, 299extern void lock_release(struct lockdep_map *lock, int nested,
292 unsigned long ip); 300 unsigned long ip);
293 301
302#define lockdep_is_held(lock) lock_is_held(&(lock)->dep_map)
303
304extern int lock_is_held(struct lockdep_map *lock);
305
294extern void lock_set_class(struct lockdep_map *lock, const char *name, 306extern void lock_set_class(struct lockdep_map *lock, const char *name,
295 struct lock_class_key *key, unsigned int subclass, 307 struct lock_class_key *key, unsigned int subclass,
296 unsigned long ip); 308 unsigned long ip);
@@ -309,6 +321,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
309 321
310#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 322#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
311 323
324#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))
325
312#else /* !LOCKDEP */ 326#else /* !LOCKDEP */
313 327
314static inline void lockdep_off(void) 328static inline void lockdep_off(void)
@@ -353,6 +367,8 @@ struct lock_class_key { };
353 367
354#define lockdep_depth(tsk) (0) 368#define lockdep_depth(tsk) (0)
355 369
370#define lockdep_assert_held(l) do { } while (0)
371
356#endif /* !LOCKDEP */ 372#endif /* !LOCKDEP */
357 373
358#ifdef CONFIG_LOCK_STAT 374#ifdef CONFIG_LOCK_STAT
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index e461b2c3d711..190c37854870 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -33,6 +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 struct task_struct *tsk; 37 struct task_struct *tsk;
37 union { 38 union {
38 struct { 39 struct {
@@ -66,16 +67,19 @@ struct common_audit_data {
66 } key_struct; 67 } key_struct;
67#endif 68#endif
68 } u; 69 } u;
69 const char *function;
70 /* this union contains LSM specific data */ 70 /* this union contains LSM specific data */
71 union { 71 union {
72#ifdef CONFIG_SECURITY_SMACK
72 /* SMACK data */ 73 /* SMACK data */
73 struct smack_audit_data { 74 struct smack_audit_data {
75 const char *function;
74 char *subject; 76 char *subject;
75 char *object; 77 char *object;
76 char *request; 78 char *request;
77 int result; 79 int result;
78 } smack_audit_data; 80 } smack_audit_data;
81#endif
82#ifdef CONFIG_SECURITY_SELINUX
79 /* SELinux data */ 83 /* SELinux data */
80 struct { 84 struct {
81 u32 ssid; 85 u32 ssid;
@@ -83,10 +87,12 @@ struct common_audit_data {
83 u16 tclass; 87 u16 tclass;
84 u32 requested; 88 u32 requested;
85 u32 audited; 89 u32 audited;
90 u32 denied;
86 struct av_decision *avd; 91 struct av_decision *avd;
87 int result; 92 int result;
88 } selinux_audit_data; 93 } selinux_audit_data;
89 } lsm_priv; 94#endif
95 };
90 /* these callback will be implemented by a specific LSM */ 96 /* these callback will be implemented by a specific LSM */
91 void (*lsm_pre_audit)(struct audit_buffer *, void *); 97 void (*lsm_pre_audit)(struct audit_buffer *, void *);
92 void (*lsm_post_audit)(struct audit_buffer *, void *); 98 void (*lsm_post_audit)(struct audit_buffer *, void *);
@@ -104,7 +110,7 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb,
104/* Initialize an LSM audit data structure. */ 110/* Initialize an LSM audit data structure. */
105#define COMMON_AUDIT_DATA_INIT(_d, _t) \ 111#define COMMON_AUDIT_DATA_INIT(_d, _t) \
106 { memset((_d), 0, sizeof(struct common_audit_data)); \ 112 { memset((_d), 0, sizeof(struct common_audit_data)); \
107 (_d)->type = LSM_AUDIT_DATA_##_t; (_d)->function = __func__; } 113 (_d)->type = LSM_AUDIT_DATA_##_t; }
108 114
109void common_lsm_audit(struct common_audit_data *a); 115void common_lsm_audit(struct common_audit_data *a);
110 116
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 7f9831da847f..4af841408fb5 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -168,6 +168,7 @@ struct bchannel {
168extern int mISDN_initdchannel(struct dchannel *, int, void *); 168extern int mISDN_initdchannel(struct dchannel *, int, void *);
169extern int mISDN_initbchannel(struct bchannel *, int); 169extern int mISDN_initbchannel(struct bchannel *, int);
170extern int mISDN_freedchannel(struct dchannel *); 170extern int mISDN_freedchannel(struct dchannel *);
171extern void mISDN_clear_bchannel(struct bchannel *);
171extern int mISDN_freebchannel(struct bchannel *); 172extern int mISDN_freebchannel(struct bchannel *);
172extern void queue_ch_frame(struct mISDNchannel *, u_int, 173extern void queue_ch_frame(struct mISDNchannel *, u_int,
173 int, struct sk_buff *); 174 int, struct sk_buff *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 45100b39a7cf..78c3bed1c3f5 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 20 40#define MISDN_RELEASE 21
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -104,7 +104,7 @@
104#define DL_UNITDATA_IND 0x3108 104#define DL_UNITDATA_IND 0x3108
105#define DL_INFORMATION_IND 0x0008 105#define DL_INFORMATION_IND 0x0008
106 106
107/* intern layer 2 managment */ 107/* intern layer 2 management */
108#define MDL_ASSIGN_REQ 0x1804 108#define MDL_ASSIGN_REQ 0x1804
109#define MDL_ASSIGN_IND 0x1904 109#define MDL_ASSIGN_IND 0x1904
110#define MDL_REMOVE_REQ 0x1A04 110#define MDL_REMOVE_REQ 0x1A04
@@ -153,6 +153,18 @@
153#define HFC_VOL_CHANGE_RX 0x2602 153#define HFC_VOL_CHANGE_RX 0x2602
154#define HFC_SPL_LOOP_ON 0x2603 154#define HFC_SPL_LOOP_ON 0x2603
155#define HFC_SPL_LOOP_OFF 0x2604 155#define HFC_SPL_LOOP_OFF 0x2604
156/* for T30 FAX and analog modem */
157#define HW_MOD_FRM 0x4000
158#define HW_MOD_FRH 0x4001
159#define HW_MOD_FTM 0x4002
160#define HW_MOD_FTH 0x4003
161#define HW_MOD_FTS 0x4004
162#define HW_MOD_CONNECT 0x4010
163#define HW_MOD_OK 0x4011
164#define HW_MOD_NOCARR 0x4012
165#define HW_MOD_FCERROR 0x4013
166#define HW_MOD_READY 0x4014
167#define HW_MOD_LASTDATA 0x4015
156 168
157/* DSP_TONE_PATT_ON parameter */ 169/* DSP_TONE_PATT_ON parameter */
158#define TONE_OFF 0x0000 170#define TONE_OFF 0x0000
@@ -224,6 +236,8 @@
224#define ISDN_P_B_L2DTMF 0x24 236#define ISDN_P_B_L2DTMF 0x24
225#define ISDN_P_B_L2DSP 0x25 237#define ISDN_P_B_L2DSP 0x25
226#define ISDN_P_B_L2DSPHDLC 0x26 238#define ISDN_P_B_L2DSPHDLC 0x26
239#define ISDN_P_B_T30_FAX 0x27
240#define ISDN_P_B_MODEM_ASYNC 0x28
227 241
228#define OPTION_L2_PMX 1 242#define OPTION_L2_PMX 1
229#define OPTION_L2_PTP 2 243#define OPTION_L2_PTP 2
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 1923327b9869..76285e01b39e 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -12,7 +12,9 @@
12#define SYSFS_MAGIC 0x62656572 12#define SYSFS_MAGIC 0x62656572
13#define SECURITYFS_MAGIC 0x73636673 13#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c 14#define SELINUX_MAGIC 0xf97cff8c
15#define RAMFS_MAGIC 0x858458f6 /* some random number */
15#define TMPFS_MAGIC 0x01021994 16#define TMPFS_MAGIC 0x01021994
17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
16#define SQUASHFS_MAGIC 0x73717368 18#define SQUASHFS_MAGIC 0x73717368
17#define EFS_SUPER_MAGIC 0x414A53 19#define EFS_SUPER_MAGIC 0x414A53
18#define EXT2_SUPER_MAGIC 0xEF53 20#define EXT2_SUPER_MAGIC 0xEF53
@@ -53,4 +55,8 @@
53#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 55#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
54 56
55#define STACK_END_MAGIC 0x57AC6E9D 57#define STACK_END_MAGIC 0x57AC6E9D
58
59#define DEVPTS_SUPER_MAGIC 0x1cd1
60#define SOCKFS_MAGIC 0x534F434B
61
56#endif /* __LINUX_MAGIC_H__ */ 62#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/marker.h b/include/linux/marker.h
deleted file mode 100644
index b85e74ca782f..000000000000
--- a/include/linux/marker.h
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifndef _LINUX_MARKER_H
2#define _LINUX_MARKER_H
3
4/*
5 * Code markup for dynamic and static tracing.
6 *
7 * See Documentation/marker.txt.
8 *
9 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 *
11 * This file is released under the GPLv2.
12 * See the file COPYING for more details.
13 */
14
15#include <stdarg.h>
16#include <linux/types.h>
17
18struct module;
19struct marker;
20
21/**
22 * marker_probe_func - Type of a marker probe function
23 * @probe_private: probe private data
24 * @call_private: call site private data
25 * @fmt: format string
26 * @args: variable argument list pointer. Use a pointer to overcome C's
27 * inability to pass this around as a pointer in a portable manner in
28 * the callee otherwise.
29 *
30 * Type of marker probe functions. They receive the mdata and need to parse the
31 * format string to recover the variable argument list.
32 */
33typedef void marker_probe_func(void *probe_private, void *call_private,
34 const char *fmt, va_list *args);
35
36struct marker_probe_closure {
37 marker_probe_func *func; /* Callback */
38 void *probe_private; /* Private probe data */
39};
40
41struct marker {
42 const char *name; /* Marker name */
43 const char *format; /* Marker format string, describing the
44 * variable argument list.
45 */
46 char state; /* Marker state. */
47 char ptype; /* probe type : 0 : single, 1 : multi */
48 /* Probe wrapper */
49 void (*call)(const struct marker *mdata, void *call_private, ...);
50 struct marker_probe_closure single;
51 struct marker_probe_closure *multi;
52 const char *tp_name; /* Optional tracepoint name */
53 void *tp_cb; /* Optional tracepoint callback */
54} __attribute__((aligned(8)));
55
56#ifdef CONFIG_MARKERS
57
58#define _DEFINE_MARKER(name, tp_name_str, tp_cb, format) \
59 static const char __mstrtab_##name[] \
60 __attribute__((section("__markers_strings"))) \
61 = #name "\0" format; \
62 static struct marker __mark_##name \
63 __attribute__((section("__markers"), aligned(8))) = \
64 { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \
65 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\
66 NULL, tp_name_str, tp_cb }
67
68#define DEFINE_MARKER(name, format) \
69 _DEFINE_MARKER(name, NULL, NULL, format)
70
71#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
72 _DEFINE_MARKER(name, #tp_name, tp_cb, format)
73
74/*
75 * Note : the empty asm volatile with read constraint is used here instead of a
76 * "used" attribute to fix a gcc 4.1.x bug.
77 * Make sure the alignment of the structure in the __markers section will
78 * not add unwanted padding between the beginning of the section and the
79 * structure. Force alignment to the same alignment as the section start.
80 *
81 * The "generic" argument controls which marker enabling mechanism must be used.
82 * If generic is true, a variable read is used.
83 * If generic is false, immediate values are used.
84 */
85#define __trace_mark(generic, name, call_private, format, args...) \
86 do { \
87 DEFINE_MARKER(name, format); \
88 __mark_check_format(format, ## args); \
89 if (unlikely(__mark_##name.state)) { \
90 (*__mark_##name.call) \
91 (&__mark_##name, call_private, ## args);\
92 } \
93 } while (0)
94
95#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
96 do { \
97 void __check_tp_type(void) \
98 { \
99 register_trace_##tp_name(tp_cb); \
100 } \
101 DEFINE_MARKER_TP(name, tp_name, tp_cb, format); \
102 __mark_check_format(format, ## args); \
103 (*__mark_##name.call)(&__mark_##name, call_private, \
104 ## args); \
105 } while (0)
106
107extern void marker_update_probe_range(struct marker *begin,
108 struct marker *end);
109
110#define GET_MARKER(name) (__mark_##name)
111
112#else /* !CONFIG_MARKERS */
113#define DEFINE_MARKER(name, tp_name, tp_cb, format)
114#define __trace_mark(generic, name, call_private, format, args...) \
115 __mark_check_format(format, ## args)
116#define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
117 do { \
118 void __check_tp_type(void) \
119 { \
120 register_trace_##tp_name(tp_cb); \
121 } \
122 __mark_check_format(format, ## args); \
123 } while (0)
124static inline void marker_update_probe_range(struct marker *begin,
125 struct marker *end)
126{ }
127#define GET_MARKER(name)
128#endif /* CONFIG_MARKERS */
129
130/**
131 * trace_mark - Marker using code patching
132 * @name: marker name, not quoted.
133 * @format: format string
134 * @args...: variable argument list
135 *
136 * Places a marker using optimized code patching technique (imv_read())
137 * to be enabled when immediate values are present.
138 */
139#define trace_mark(name, format, args...) \
140 __trace_mark(0, name, NULL, format, ## args)
141
142/**
143 * _trace_mark - Marker using variable read
144 * @name: marker name, not quoted.
145 * @format: format string
146 * @args...: variable argument list
147 *
148 * Places a marker using a standard memory read (_imv_read()) to be
149 * enabled. Should be used for markers in code paths where instruction
150 * modification based enabling is not welcome. (__init and __exit functions,
151 * lockdep, some traps, printk).
152 */
153#define _trace_mark(name, format, args...) \
154 __trace_mark(1, name, NULL, format, ## args)
155
156/**
157 * trace_mark_tp - Marker in a tracepoint callback
158 * @name: marker name, not quoted.
159 * @tp_name: tracepoint name, not quoted.
160 * @tp_cb: tracepoint callback. Should have an associated global symbol so it
161 * is not optimized away by the compiler (should not be static).
162 * @format: format string
163 * @args...: variable argument list
164 *
165 * Places a marker in a tracepoint callback.
166 */
167#define trace_mark_tp(name, tp_name, tp_cb, format, args...) \
168 __trace_mark_tp(name, NULL, tp_name, tp_cb, format, ## args)
169
170/**
171 * MARK_NOARGS - Format string for a marker with no argument.
172 */
173#define MARK_NOARGS " "
174
175/* To be used for string format validity checking with gcc */
176static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
177{
178}
179
180#define __mark_check_format(format, args...) \
181 do { \
182 if (0) \
183 ___mark_check_format(format, ## args); \
184 } while (0)
185
186extern marker_probe_func __mark_empty_function;
187
188extern void marker_probe_cb(const struct marker *mdata,
189 void *call_private, ...);
190
191/*
192 * Connect a probe to a marker.
193 * private data pointer must be a valid allocated memory address, or NULL.
194 */
195extern int marker_probe_register(const char *name, const char *format,
196 marker_probe_func *probe, void *probe_private);
197
198/*
199 * Returns the private data given to marker_probe_register.
200 */
201extern int marker_probe_unregister(const char *name,
202 marker_probe_func *probe, void *probe_private);
203/*
204 * Unregister a marker by providing the registered private data.
205 */
206extern int marker_probe_unregister_private_data(marker_probe_func *probe,
207 void *probe_private);
208
209extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
210 int num);
211
212/*
213 * marker_synchronize_unregister must be called between the last marker probe
214 * unregistration and the first one of
215 * - the end of module exit function
216 * - the free of any resource used by the probes
217 * to ensure the code and data are valid for any possibly running probes.
218 */
219#define marker_synchronize_unregister() synchronize_sched()
220
221#endif
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index cfdf1df2875e..c779b49a1fda 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -304,7 +304,7 @@ static inline __u16 mdio_phy_id_devad(int phy_id)
304 */ 304 */
305struct mdio_if_info { 305struct mdio_if_info {
306 int prtad; 306 int prtad;
307 u32 __bitwise mmds; 307 u32 mmds;
308 unsigned mode_support; 308 unsigned mode_support;
309 309
310 struct net_device *dev; 310 struct net_device *dev;
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index e46a0734ab6e..bf9213b2db8f 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -118,6 +118,9 @@ static inline bool mem_cgroup_disabled(void)
118 118
119extern bool mem_cgroup_oom_called(struct task_struct *task); 119extern bool mem_cgroup_oom_called(struct task_struct *task);
120void mem_cgroup_update_mapped_file_stat(struct page *page, int val); 120void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
121unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
122 gfp_t gfp_mask, int nid,
123 int zid);
121#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 124#else /* CONFIG_CGROUP_MEM_RES_CTLR */
122struct mem_cgroup; 125struct mem_cgroup;
123 126
@@ -276,6 +279,13 @@ static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
276{ 279{
277} 280}
278 281
282static inline
283unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
284 gfp_t gfp_mask, int nid, int zid)
285{
286 return 0;
287}
288
279#endif /* CONFIG_CGROUP_MEM_CONT */ 289#endif /* CONFIG_CGROUP_MEM_CONT */
280 290
281#endif /* _LINUX_MEMCONTROL_H */ 291#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d95f72e79b82..fed969281a41 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -191,14 +191,6 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
191 191
192#endif /* ! CONFIG_MEMORY_HOTPLUG */ 192#endif /* ! CONFIG_MEMORY_HOTPLUG */
193 193
194/*
195 * Walk through all memory which is registered as resource.
196 * arg is (start_pfn, nr_pages, private_arg_pointer)
197 */
198extern int walk_memory_resource(unsigned long start_pfn,
199 unsigned long nr_pages, void *arg,
200 int (*func)(unsigned long, unsigned long, void *));
201
202#ifdef CONFIG_MEMORY_HOTREMOVE 194#ifdef CONFIG_MEMORY_HOTREMOVE
203 195
204extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 196extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 9be484d11283..7c08052e3321 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -47,22 +47,16 @@ mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
47} 47}
48 48
49/* 49/*
50 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree 50 * a mempool_alloc_t and a mempool_free_t to kmalloc and kfree the
51 * the amount of memory specified by pool_data 51 * amount of memory specified by pool_data
52 */ 52 */
53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data); 53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data);
54void *mempool_kzalloc(gfp_t gfp_mask, void *pool_data);
55void mempool_kfree(void *element, void *pool_data); 54void mempool_kfree(void *element, void *pool_data);
56static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size) 55static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size)
57{ 56{
58 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree, 57 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree,
59 (void *) size); 58 (void *) size);
60} 59}
61static inline mempool_t *mempool_create_kzalloc_pool(int min_nr, size_t size)
62{
63 return mempool_create(min_nr, mempool_kzalloc, mempool_kfree,
64 (void *) size);
65}
66 60
67/* 61/*
68 * A mempool_alloc_t and mempool_free_t for a simple page allocator that 62 * A mempool_alloc_t and mempool_free_t for a simple page allocator that
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
index 7a3f316e3848..e9aa4c9d749d 100644
--- a/include/linux/mfd/ab3100.h
+++ b/include/linux/mfd/ab3100.h
@@ -6,6 +6,8 @@
6 */ 6 */
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/workqueue.h>
10#include <linux/regulator/machine.h>
9 11
10#ifndef MFD_AB3100_H 12#ifndef MFD_AB3100_H
11#define MFD_AB3100_H 13#define MFD_AB3100_H
@@ -56,6 +58,14 @@
56#define AB3100_STR_BATT_REMOVAL (0x40) 58#define AB3100_STR_BATT_REMOVAL (0x40)
57#define AB3100_STR_VBUS (0x80) 59#define AB3100_STR_VBUS (0x80)
58 60
61/*
62 * AB3100 contains 8 regulators, one external regulator controller
63 * and a buck converter, further the LDO E and buck converter can
64 * have separate settings if they are in sleep mode, this is
65 * modeled as a separate regulator.
66 */
67#define AB3100_NUM_REGULATORS 10
68
59/** 69/**
60 * struct ab3100 70 * struct ab3100
61 * @access_mutex: lock out concurrent accesses to the AB3100 registers 71 * @access_mutex: lock out concurrent accesses to the AB3100 registers
@@ -86,11 +96,30 @@ struct ab3100 {
86 bool startup_events_read; 96 bool startup_events_read;
87}; 97};
88 98
89int ab3100_set_register(struct ab3100 *ab3100, u8 reg, u8 regval); 99/**
90int ab3100_get_register(struct ab3100 *ab3100, u8 reg, u8 *regval); 100 * struct ab3100_platform_data
91int ab3100_get_register_page(struct ab3100 *ab3100, 101 * Data supplied to initialize board connections to the AB3100
102 * @reg_constraints: regulator constraints for target board
103 * the order of these constraints are: LDO A, C, D, E,
104 * F, G, H, K, EXT and BUCK.
105 * @reg_initvals: initial values for the regulator registers
106 * plus two sleep settings for LDO E and the BUCK converter.
107 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
108 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
109 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
110 * @external_voltage: voltage level of the external regulator.
111 */
112struct ab3100_platform_data {
113 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
114 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
115 int external_voltage;
116};
117
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,
92 u8 first_reg, u8 *regvals, u8 numregs); 121 u8 first_reg, u8 *regvals, u8 numregs);
93int ab3100_mask_and_set_register(struct ab3100 *ab3100, 122int ab3100_mask_and_set_register_interruptible(struct ab3100 *ab3100,
94 u8 reg, u8 andmask, u8 ormask); 123 u8 reg, u8 andmask, u8 ormask);
95u8 ab3100_get_chip_type(struct ab3100 *ab3100); 124u8 ab3100_get_chip_type(struct ab3100 *ab3100);
96int ab3100_event_register(struct ab3100 *ab3100, 125int ab3100_event_register(struct ab3100 *ab3100,
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 49ef857cdb2d..11d740b8831d 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -23,6 +23,7 @@
23 */ 23 */
24struct mfd_cell { 24struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id;
26 27
27 int (*enable)(struct platform_device *dev); 28 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev); 29 int (*disable)(struct platform_device *dev);
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index 115dbe965082..c63b65c94429 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_PMIC_DA903X_H 1#ifndef __LINUX_PMIC_DA903X_H
2#define __LINUX_PMIC_DA903X_H 2#define __LINUX_PMIC_DA903X_H
3 3
4/* Unified sub device IDs for DA9030/DA9034 */ 4/* Unified sub device IDs for DA9030/DA9034/DA9035 */
5enum { 5enum {
6 DA9030_ID_LED_1, 6 DA9030_ID_LED_1,
7 DA9030_ID_LED_2, 7 DA9030_ID_LED_2,
@@ -57,6 +57,8 @@ enum {
57 DA9034_ID_LDO13, 57 DA9034_ID_LDO13,
58 DA9034_ID_LDO14, 58 DA9034_ID_LDO14,
59 DA9034_ID_LDO15, 59 DA9034_ID_LDO15,
60
61 DA9035_ID_BUCK3,
60}; 62};
61 63
62/* 64/*
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index c12c3c0932bf..e5124ceea769 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -25,9 +25,12 @@ struct pcap_chip;
25 25
26int ezx_pcap_write(struct pcap_chip *, u8, u32); 26int ezx_pcap_write(struct pcap_chip *, u8, u32);
27int ezx_pcap_read(struct pcap_chip *, u8, u32 *); 27int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
28int ezx_pcap_set_bits(struct pcap_chip *, u8, u32, u32);
28int pcap_to_irq(struct pcap_chip *, int); 29int pcap_to_irq(struct pcap_chip *, int);
30int irq_to_pcap(struct pcap_chip *, int);
29int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *); 31int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
30int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]); 32int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
33void pcap_set_ts_bits(struct pcap_chip *, u32);
31 34
32#define PCAP_SECOND_PORT 1 35#define PCAP_SECOND_PORT 1
33#define PCAP_CS_AH 2 36#define PCAP_CS_AH 2
@@ -224,7 +227,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
224#define PCAP_LED1 1 227#define PCAP_LED1 1
225#define PCAP_BL0 2 228#define PCAP_BL0 2
226#define PCAP_BL1 3 229#define PCAP_BL1 3
227#define PCAP_VIB 4
228#define PCAP_LED_3MA 0 230#define PCAP_LED_3MA 0
229#define PCAP_LED_4MA 1 231#define PCAP_LED_4MA 1
230#define PCAP_LED_5MA 2 232#define PCAP_LED_5MA 2
@@ -243,9 +245,6 @@ int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
243#define PCAP_LED0_C_SHIFT 15 245#define PCAP_LED0_C_SHIFT 15
244#define PCAP_LED1_C_SHIFT 17 246#define PCAP_LED1_C_SHIFT 17
245#define PCAP_BL1_SHIFT 20 247#define PCAP_BL1_SHIFT 20
246#define PCAP_VIB_MASK 0x3
247#define PCAP_VIB_SHIFT 20
248#define PCAP_VIB_EN (1 << 19)
249 248
250/* RTC */ 249/* RTC */
251#define PCAP_RTC_DAY_MASK 0x3fff 250#define PCAP_RTC_DAY_MASK 0x3fff
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h
new file mode 100644
index 000000000000..47e698cb0f16
--- /dev/null
+++ b/include/linux/mfd/mc13783-private.h
@@ -0,0 +1,396 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __LINUX_MFD_MC13783_PRIV_H
23#define __LINUX_MFD_MC13783_PRIV_H
24
25#include <linux/platform_device.h>
26#include <linux/mfd/mc13783.h>
27#include <linux/workqueue.h>
28#include <linux/mutex.h>
29
30struct mc13783_irq {
31 void (*handler)(int, void *);
32 void *data;
33};
34
35#define MC13783_NUM_IRQ 2
36#define MC13783_IRQ_TS 0
37#define MC13783_IRQ_REGULATOR 1
38
39#define MC13783_ADC_MODE_TS 1
40#define MC13783_ADC_MODE_SINGLE_CHAN 2
41#define MC13783_ADC_MODE_MULT_CHAN 3
42
43struct mc13783 {
44 int revision;
45 struct device *dev;
46 struct spi_device *spi_device;
47
48 int (*read_dev)(void *data, char reg, int count, u32 *dst);
49 int (*write_dev)(void *data, char reg, int count, const u32 *src);
50
51 struct mutex io_lock;
52 void *io_data;
53 int irq;
54 unsigned int flags;
55
56 struct mc13783_irq irq_handler[MC13783_NUM_IRQ];
57 struct work_struct work;
58 struct completion adc_done;
59 unsigned int ts_active;
60 struct mutex adc_conv_lock;
61
62 struct mc13783_regulator_init_data *regulators;
63 int num_regulators;
64};
65
66int mc13783_reg_read(struct mc13783 *, int reg_num, u32 *);
67int mc13783_reg_write(struct mc13783 *, int, u32);
68int mc13783_set_bits(struct mc13783 *, int, u32, u32);
69int mc13783_free_irq(struct mc13783 *mc13783, int irq);
70int mc13783_register_irq(struct mc13783 *mc13783, int irq,
71 void (*handler) (int, void *), void *data);
72
73#define MC13783_REG_INTERRUPT_STATUS_0 0
74#define MC13783_REG_INTERRUPT_MASK_0 1
75#define MC13783_REG_INTERRUPT_SENSE_0 2
76#define MC13783_REG_INTERRUPT_STATUS_1 3
77#define MC13783_REG_INTERRUPT_MASK_1 4
78#define MC13783_REG_INTERRUPT_SENSE_1 5
79#define MC13783_REG_POWER_UP_MODE_SENSE 6
80#define MC13783_REG_REVISION 7
81#define MC13783_REG_SEMAPHORE 8
82#define MC13783_REG_ARBITRATION_PERIPHERAL_AUDIO 9
83#define MC13783_REG_ARBITRATION_SWITCHERS 10
84#define MC13783_REG_ARBITRATION_REGULATORS_0 11
85#define MC13783_REG_ARBITRATION_REGULATORS_1 12
86#define MC13783_REG_POWER_CONTROL_0 13
87#define MC13783_REG_POWER_CONTROL_1 14
88#define MC13783_REG_POWER_CONTROL_2 15
89#define MC13783_REG_REGEN_ASSIGNMENT 16
90#define MC13783_REG_CONTROL_SPARE 17
91#define MC13783_REG_MEMORY_A 18
92#define MC13783_REG_MEMORY_B 19
93#define MC13783_REG_RTC_TIME 20
94#define MC13783_REG_RTC_ALARM 21
95#define MC13783_REG_RTC_DAY 22
96#define MC13783_REG_RTC_DAY_ALARM 23
97#define MC13783_REG_SWITCHERS_0 24
98#define MC13783_REG_SWITCHERS_1 25
99#define MC13783_REG_SWITCHERS_2 26
100#define MC13783_REG_SWITCHERS_3 27
101#define MC13783_REG_SWITCHERS_4 28
102#define MC13783_REG_SWITCHERS_5 29
103#define MC13783_REG_REGULATOR_SETTING_0 30
104#define MC13783_REG_REGULATOR_SETTING_1 31
105#define MC13783_REG_REGULATOR_MODE_0 32
106#define MC13783_REG_REGULATOR_MODE_1 33
107#define MC13783_REG_POWER_MISCELLANEOUS 34
108#define MC13783_REG_POWER_SPARE 35
109#define MC13783_REG_AUDIO_RX_0 36
110#define MC13783_REG_AUDIO_RX_1 37
111#define MC13783_REG_AUDIO_TX 38
112#define MC13783_REG_AUDIO_SSI_NETWORK 39
113#define MC13783_REG_AUDIO_CODEC 40
114#define MC13783_REG_AUDIO_STEREO_DAC 41
115#define MC13783_REG_AUDIO_SPARE 42
116#define MC13783_REG_ADC_0 43
117#define MC13783_REG_ADC_1 44
118#define MC13783_REG_ADC_2 45
119#define MC13783_REG_ADC_3 46
120#define MC13783_REG_ADC_4 47
121#define MC13783_REG_CHARGER 48
122#define MC13783_REG_USB 49
123#define MC13783_REG_CHARGE_USB_SPARE 50
124#define MC13783_REG_LED_CONTROL_0 51
125#define MC13783_REG_LED_CONTROL_1 52
126#define MC13783_REG_LED_CONTROL_2 53
127#define MC13783_REG_LED_CONTROL_3 54
128#define MC13783_REG_LED_CONTROL_4 55
129#define MC13783_REG_LED_CONTROL_5 56
130#define MC13783_REG_SPARE 57
131#define MC13783_REG_TRIM_0 58
132#define MC13783_REG_TRIM_1 59
133#define MC13783_REG_TEST_0 60
134#define MC13783_REG_TEST_1 61
135#define MC13783_REG_TEST_2 62
136#define MC13783_REG_TEST_3 63
137#define MC13783_REG_NB 64
138
139
140/*
141 * Interrupt Status
142 */
143#define MC13783_INT_STAT_ADCDONEI (1 << 0)
144#define MC13783_INT_STAT_ADCBISDONEI (1 << 1)
145#define MC13783_INT_STAT_TSI (1 << 2)
146#define MC13783_INT_STAT_WHIGHI (1 << 3)
147#define MC13783_INT_STAT_WLOWI (1 << 4)
148#define MC13783_INT_STAT_CHGDETI (1 << 6)
149#define MC13783_INT_STAT_CHGOVI (1 << 7)
150#define MC13783_INT_STAT_CHGREVI (1 << 8)
151#define MC13783_INT_STAT_CHGSHORTI (1 << 9)
152#define MC13783_INT_STAT_CCCVI (1 << 10)
153#define MC13783_INT_STAT_CHGCURRI (1 << 11)
154#define MC13783_INT_STAT_BPONI (1 << 12)
155#define MC13783_INT_STAT_LOBATLI (1 << 13)
156#define MC13783_INT_STAT_LOBATHI (1 << 14)
157#define MC13783_INT_STAT_UDPI (1 << 15)
158#define MC13783_INT_STAT_USBI (1 << 16)
159#define MC13783_INT_STAT_IDI (1 << 19)
160#define MC13783_INT_STAT_Unused (1 << 20)
161#define MC13783_INT_STAT_SE1I (1 << 21)
162#define MC13783_INT_STAT_CKDETI (1 << 22)
163#define MC13783_INT_STAT_UDMI (1 << 23)
164
165/*
166 * Interrupt Mask
167 */
168#define MC13783_INT_MASK_ADCDONEM (1 << 0)
169#define MC13783_INT_MASK_ADCBISDONEM (1 << 1)
170#define MC13783_INT_MASK_TSM (1 << 2)
171#define MC13783_INT_MASK_WHIGHM (1 << 3)
172#define MC13783_INT_MASK_WLOWM (1 << 4)
173#define MC13783_INT_MASK_CHGDETM (1 << 6)
174#define MC13783_INT_MASK_CHGOVM (1 << 7)
175#define MC13783_INT_MASK_CHGREVM (1 << 8)
176#define MC13783_INT_MASK_CHGSHORTM (1 << 9)
177#define MC13783_INT_MASK_CCCVM (1 << 10)
178#define MC13783_INT_MASK_CHGCURRM (1 << 11)
179#define MC13783_INT_MASK_BPONM (1 << 12)
180#define MC13783_INT_MASK_LOBATLM (1 << 13)
181#define MC13783_INT_MASK_LOBATHM (1 << 14)
182#define MC13783_INT_MASK_UDPM (1 << 15)
183#define MC13783_INT_MASK_USBM (1 << 16)
184#define MC13783_INT_MASK_IDM (1 << 19)
185#define MC13783_INT_MASK_SE1M (1 << 21)
186#define MC13783_INT_MASK_CKDETM (1 << 22)
187
188/*
189 * Reg Regulator Mode 0
190 */
191#define MC13783_REGCTRL_VAUDIO_EN (1 << 0)
192#define MC13783_REGCTRL_VAUDIO_STBY (1 << 1)
193#define MC13783_REGCTRL_VAUDIO_MODE (1 << 2)
194#define MC13783_REGCTRL_VIOHI_EN (1 << 3)
195#define MC13783_REGCTRL_VIOHI_STBY (1 << 4)
196#define MC13783_REGCTRL_VIOHI_MODE (1 << 5)
197#define MC13783_REGCTRL_VIOLO_EN (1 << 6)
198#define MC13783_REGCTRL_VIOLO_STBY (1 << 7)
199#define MC13783_REGCTRL_VIOLO_MODE (1 << 8)
200#define MC13783_REGCTRL_VDIG_EN (1 << 9)
201#define MC13783_REGCTRL_VDIG_STBY (1 << 10)
202#define MC13783_REGCTRL_VDIG_MODE (1 << 11)
203#define MC13783_REGCTRL_VGEN_EN (1 << 12)
204#define MC13783_REGCTRL_VGEN_STBY (1 << 13)
205#define MC13783_REGCTRL_VGEN_MODE (1 << 14)
206#define MC13783_REGCTRL_VRFDIG_EN (1 << 15)
207#define MC13783_REGCTRL_VRFDIG_STBY (1 << 16)
208#define MC13783_REGCTRL_VRFDIG_MODE (1 << 17)
209#define MC13783_REGCTRL_VRFREF_EN (1 << 18)
210#define MC13783_REGCTRL_VRFREF_STBY (1 << 19)
211#define MC13783_REGCTRL_VRFREF_MODE (1 << 20)
212#define MC13783_REGCTRL_VRFCP_EN (1 << 21)
213#define MC13783_REGCTRL_VRFCP_STBY (1 << 22)
214#define MC13783_REGCTRL_VRFCP_MODE (1 << 23)
215
216/*
217 * Reg Regulator Mode 1
218 */
219#define MC13783_REGCTRL_VSIM_EN (1 << 0)
220#define MC13783_REGCTRL_VSIM_STBY (1 << 1)
221#define MC13783_REGCTRL_VSIM_MODE (1 << 2)
222#define MC13783_REGCTRL_VESIM_EN (1 << 3)
223#define MC13783_REGCTRL_VESIM_STBY (1 << 4)
224#define MC13783_REGCTRL_VESIM_MODE (1 << 5)
225#define MC13783_REGCTRL_VCAM_EN (1 << 6)
226#define MC13783_REGCTRL_VCAM_STBY (1 << 7)
227#define MC13783_REGCTRL_VCAM_MODE (1 << 8)
228#define MC13783_REGCTRL_VRFBG_EN (1 << 9)
229#define MC13783_REGCTRL_VRFBG_STBY (1 << 10)
230#define MC13783_REGCTRL_VVIB_EN (1 << 11)
231#define MC13783_REGCTRL_VRF1_EN (1 << 12)
232#define MC13783_REGCTRL_VRF1_STBY (1 << 13)
233#define MC13783_REGCTRL_VRF1_MODE (1 << 14)
234#define MC13783_REGCTRL_VRF2_EN (1 << 15)
235#define MC13783_REGCTRL_VRF2_STBY (1 << 16)
236#define MC13783_REGCTRL_VRF2_MODE (1 << 17)
237#define MC13783_REGCTRL_VMMC1_EN (1 << 18)
238#define MC13783_REGCTRL_VMMC1_STBY (1 << 19)
239#define MC13783_REGCTRL_VMMC1_MODE (1 << 20)
240#define MC13783_REGCTRL_VMMC2_EN (1 << 21)
241#define MC13783_REGCTRL_VMMC2_STBY (1 << 22)
242#define MC13783_REGCTRL_VMMC2_MODE (1 << 23)
243
244/*
245 * Reg Regulator Misc.
246 */
247#define MC13783_REGCTRL_GPO1_EN (1 << 6)
248#define MC13783_REGCTRL_GPO2_EN (1 << 8)
249#define MC13783_REGCTRL_GPO3_EN (1 << 10)
250#define MC13783_REGCTRL_GPO4_EN (1 << 12)
251#define MC13783_REGCTRL_VIBPINCTRL (1 << 14)
252
253/*
254 * Reg Switcher 4
255 */
256#define MC13783_SWCTRL_SW1A_MODE (1 << 0)
257#define MC13783_SWCTRL_SW1A_STBY_MODE (1 << 2)
258#define MC13783_SWCTRL_SW1A_DVS_SPEED (1 << 6)
259#define MC13783_SWCTRL_SW1A_PANIC_MODE (1 << 8)
260#define MC13783_SWCTRL_SW1A_SOFTSTART (1 << 9)
261#define MC13783_SWCTRL_SW1B_MODE (1 << 10)
262#define MC13783_SWCTRL_SW1B_STBY_MODE (1 << 12)
263#define MC13783_SWCTRL_SW1B_DVS_SPEED (1 << 14)
264#define MC13783_SWCTRL_SW1B_PANIC_MODE (1 << 16)
265#define MC13783_SWCTRL_SW1B_SOFTSTART (1 << 17)
266#define MC13783_SWCTRL_PLL_EN (1 << 18)
267#define MC13783_SWCTRL_PLL_FACTOR (1 << 19)
268
269/*
270 * Reg Switcher 5
271 */
272#define MC13783_SWCTRL_SW2A_MODE (1 << 0)
273#define MC13783_SWCTRL_SW2A_STBY_MODE (1 << 2)
274#define MC13783_SWCTRL_SW2A_DVS_SPEED (1 << 6)
275#define MC13783_SWCTRL_SW2A_PANIC_MODE (1 << 8)
276#define MC13783_SWCTRL_SW2A_SOFTSTART (1 << 9)
277#define MC13783_SWCTRL_SW2B_MODE (1 << 10)
278#define MC13783_SWCTRL_SW2B_STBY_MODE (1 << 12)
279#define MC13783_SWCTRL_SW2B_DVS_SPEED (1 << 14)
280#define MC13783_SWCTRL_SW2B_PANIC_MODE (1 << 16)
281#define MC13783_SWCTRL_SW2B_SOFTSTART (1 << 17)
282#define MC13783_SWSET_SW3 (1 << 18)
283#define MC13783_SWCTRL_SW3_EN (1 << 20)
284#define MC13783_SWCTRL_SW3_STBY (1 << 21)
285#define MC13783_SWCTRL_SW3_MODE (1 << 22)
286
287/*
288 * ADC/Touch
289 */
290#define MC13783_ADC0_LICELLCON (1 << 0)
291#define MC13783_ADC0_CHRGICON (1 << 1)
292#define MC13783_ADC0_BATICON (1 << 2)
293#define MC13783_ADC0_RTHEN (1 << 3)
294#define MC13783_ADC0_DTHEN (1 << 4)
295#define MC13783_ADC0_UIDEN (1 << 5)
296#define MC13783_ADC0_ADOUTEN (1 << 6)
297#define MC13783_ADC0_ADOUTPER (1 << 7)
298#define MC13783_ADC0_ADREFEN (1 << 10)
299#define MC13783_ADC0_ADREFMODE (1 << 11)
300#define MC13783_ADC0_TSMOD0 (1 << 12)
301#define MC13783_ADC0_TSMOD1 (1 << 13)
302#define MC13783_ADC0_TSMOD2 (1 << 14)
303#define MC13783_ADC0_CHRGRAWDIV (1 << 15)
304#define MC13783_ADC0_ADINC1 (1 << 16)
305#define MC13783_ADC0_ADINC2 (1 << 17)
306#define MC13783_ADC0_WCOMP (1 << 18)
307#define MC13783_ADC0_ADCBIS0 (1 << 23)
308
309#define MC13783_ADC1_ADEN (1 << 0)
310#define MC13783_ADC1_RAND (1 << 1)
311#define MC13783_ADC1_ADSEL (1 << 3)
312#define MC13783_ADC1_TRIGMASK (1 << 4)
313#define MC13783_ADC1_ADA10 (1 << 5)
314#define MC13783_ADC1_ADA11 (1 << 6)
315#define MC13783_ADC1_ADA12 (1 << 7)
316#define MC13783_ADC1_ADA20 (1 << 8)
317#define MC13783_ADC1_ADA21 (1 << 9)
318#define MC13783_ADC1_ADA22 (1 << 10)
319#define MC13783_ADC1_ATO0 (1 << 11)
320#define MC13783_ADC1_ATO1 (1 << 12)
321#define MC13783_ADC1_ATO2 (1 << 13)
322#define MC13783_ADC1_ATO3 (1 << 14)
323#define MC13783_ADC1_ATO4 (1 << 15)
324#define MC13783_ADC1_ATO5 (1 << 16)
325#define MC13783_ADC1_ATO6 (1 << 17)
326#define MC13783_ADC1_ATO7 (1 << 18)
327#define MC13783_ADC1_ATOX (1 << 19)
328#define MC13783_ADC1_ASC (1 << 20)
329#define MC13783_ADC1_ADTRIGIGN (1 << 21)
330#define MC13783_ADC1_ADONESHOT (1 << 22)
331#define MC13783_ADC1_ADCBIS1 (1 << 23)
332
333#define MC13783_ADC1_CHAN0_SHIFT 5
334#define MC13783_ADC1_CHAN1_SHIFT 8
335
336#define MC13783_ADC2_ADD10 (1 << 2)
337#define MC13783_ADC2_ADD11 (1 << 3)
338#define MC13783_ADC2_ADD12 (1 << 4)
339#define MC13783_ADC2_ADD13 (1 << 5)
340#define MC13783_ADC2_ADD14 (1 << 6)
341#define MC13783_ADC2_ADD15 (1 << 7)
342#define MC13783_ADC2_ADD16 (1 << 8)
343#define MC13783_ADC2_ADD17 (1 << 9)
344#define MC13783_ADC2_ADD18 (1 << 10)
345#define MC13783_ADC2_ADD19 (1 << 11)
346#define MC13783_ADC2_ADD20 (1 << 14)
347#define MC13783_ADC2_ADD21 (1 << 15)
348#define MC13783_ADC2_ADD22 (1 << 16)
349#define MC13783_ADC2_ADD23 (1 << 17)
350#define MC13783_ADC2_ADD24 (1 << 18)
351#define MC13783_ADC2_ADD25 (1 << 19)
352#define MC13783_ADC2_ADD26 (1 << 20)
353#define MC13783_ADC2_ADD27 (1 << 21)
354#define MC13783_ADC2_ADD28 (1 << 22)
355#define MC13783_ADC2_ADD29 (1 << 23)
356
357#define MC13783_ADC3_WHIGH0 (1 << 0)
358#define MC13783_ADC3_WHIGH1 (1 << 1)
359#define MC13783_ADC3_WHIGH2 (1 << 2)
360#define MC13783_ADC3_WHIGH3 (1 << 3)
361#define MC13783_ADC3_WHIGH4 (1 << 4)
362#define MC13783_ADC3_WHIGH5 (1 << 5)
363#define MC13783_ADC3_ICID0 (1 << 6)
364#define MC13783_ADC3_ICID1 (1 << 7)
365#define MC13783_ADC3_ICID2 (1 << 8)
366#define MC13783_ADC3_WLOW0 (1 << 9)
367#define MC13783_ADC3_WLOW1 (1 << 10)
368#define MC13783_ADC3_WLOW2 (1 << 11)
369#define MC13783_ADC3_WLOW3 (1 << 12)
370#define MC13783_ADC3_WLOW4 (1 << 13)
371#define MC13783_ADC3_WLOW5 (1 << 14)
372#define MC13783_ADC3_ADCBIS2 (1 << 23)
373
374#define MC13783_ADC4_ADDBIS10 (1 << 2)
375#define MC13783_ADC4_ADDBIS11 (1 << 3)
376#define MC13783_ADC4_ADDBIS12 (1 << 4)
377#define MC13783_ADC4_ADDBIS13 (1 << 5)
378#define MC13783_ADC4_ADDBIS14 (1 << 6)
379#define MC13783_ADC4_ADDBIS15 (1 << 7)
380#define MC13783_ADC4_ADDBIS16 (1 << 8)
381#define MC13783_ADC4_ADDBIS17 (1 << 9)
382#define MC13783_ADC4_ADDBIS18 (1 << 10)
383#define MC13783_ADC4_ADDBIS19 (1 << 11)
384#define MC13783_ADC4_ADDBIS20 (1 << 14)
385#define MC13783_ADC4_ADDBIS21 (1 << 15)
386#define MC13783_ADC4_ADDBIS22 (1 << 16)
387#define MC13783_ADC4_ADDBIS23 (1 << 17)
388#define MC13783_ADC4_ADDBIS24 (1 << 18)
389#define MC13783_ADC4_ADDBIS25 (1 << 19)
390#define MC13783_ADC4_ADDBIS26 (1 << 20)
391#define MC13783_ADC4_ADDBIS27 (1 << 21)
392#define MC13783_ADC4_ADDBIS28 (1 << 22)
393#define MC13783_ADC4_ADDBIS29 (1 << 23)
394
395#endif /* __LINUX_MFD_MC13783_PRIV_H */
396
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
new file mode 100644
index 000000000000..b3a2a7243573
--- /dev/null
+++ b/include/linux/mfd/mc13783.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __INCLUDE_LINUX_MFD_MC13783_H
23#define __INCLUDE_LINUX_MFD_MC13783_H
24
25struct mc13783;
26struct regulator_init_data;
27
28struct mc13783_regulator_init_data {
29 int id;
30 struct regulator_init_data *init_data;
31};
32
33struct mc13783_platform_data {
34 struct mc13783_regulator_init_data *regulators;
35 int num_regulators;
36 unsigned int flags;
37};
38
39/* mc13783_platform_data flags */
40#define MC13783_USE_TOUCHSCREEN (1 << 0)
41#define MC13783_USE_CODEC (1 << 1)
42#define MC13783_USE_ADC (1 << 2)
43#define MC13783_USE_RTC (1 << 3)
44#define MC13783_USE_REGULATOR (1 << 4)
45
46int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
47 unsigned int channel, unsigned int *sample);
48
49void mc13783_adc_set_ts_status(struct mc13783 *mc13783, unsigned int status);
50
51#define MC13783_SW_SW1A 0
52#define MC13783_SW_SW1B 1
53#define MC13783_SW_SW2A 2
54#define MC13783_SW_SW2B 3
55#define MC13783_SW_SW3 4
56#define MC13783_SW_PLL 5
57#define MC13783_REGU_VAUDIO 6
58#define MC13783_REGU_VIOHI 7
59#define MC13783_REGU_VIOLO 8
60#define MC13783_REGU_VDIG 9
61#define MC13783_REGU_VGEN 10
62#define MC13783_REGU_VRFDIG 11
63#define MC13783_REGU_VRFREF 12
64#define MC13783_REGU_VRFCP 13
65#define MC13783_REGU_VSIM 14
66#define MC13783_REGU_VESIM 15
67#define MC13783_REGU_VCAM 16
68#define MC13783_REGU_VRFBG 17
69#define MC13783_REGU_VVIB 18
70#define MC13783_REGU_VRF1 19
71#define MC13783_REGU_VRF2 20
72#define MC13783_REGU_VMMC1 21
73#define MC13783_REGU_VMMC2 22
74#define MC13783_REGU_GPO1 23
75#define MC13783_REGU_GPO2 24
76#define MC13783_REGU_GPO3 25
77#define MC13783_REGU_GPO4 26
78#define MC13783_REGU_V1 27
79#define MC13783_REGU_V2 28
80#define MC13783_REGU_V3 29
81#define MC13783_REGU_V4 30
82
83#endif /* __INCLUDE_LINUX_MFD_MC13783_H */
84
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h
index 56669b4183ad..b35e62801ffa 100644
--- a/include/linux/mfd/pcf50633/adc.h
+++ b/include/linux/mfd/pcf50633/adc.h
@@ -25,7 +25,8 @@
25#define PCF50633_REG_ADCS3 0x57 25#define PCF50633_REG_ADCS3 0x57
26 26
27#define PCF50633_ADCC1_ADCSTART 0x01 27#define PCF50633_ADCC1_ADCSTART 0x01
28#define PCF50633_ADCC1_RES_10BIT 0x02 28#define PCF50633_ADCC1_RES_8BIT 0x02
29#define PCF50633_ADCC1_RES_10BIT 0x00
29#define PCF50633_ADCC1_AVERAGE_NO 0x00 30#define PCF50633_ADCC1_AVERAGE_NO 0x00
30#define PCF50633_ADCC1_AVERAGE_4 0x04 31#define PCF50633_ADCC1_AVERAGE_4 0x04
31#define PCF50633_ADCC1_AVERAGE_8 0x08 32#define PCF50633_ADCC1_AVERAGE_8 0x08
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index c8f51c3c0a72..9aba7b779fbc 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -136,6 +136,7 @@ struct pcf50633 {
136 int irq; 136 int irq;
137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ]; 137 struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ];
138 struct work_struct irq_work; 138 struct work_struct irq_work;
139 struct workqueue_struct *work_queue;
139 struct mutex lock; 140 struct mutex lock;
140 141
141 u8 mask_regs[5]; 142 u8 mask_regs[5];
diff --git a/include/linux/mfd/wm831x/auxadc.h b/include/linux/mfd/wm831x/auxadc.h
new file mode 100644
index 000000000000..b132067e9e99
--- /dev/null
+++ b/include/linux/mfd/wm831x/auxadc.h
@@ -0,0 +1,216 @@
1/*
2 * include/linux/mfd/wm831x/auxadc.h -- Auxiliary ADC interface for WM831x
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_WM831X_AUXADC_H__
16#define __MFD_WM831X_AUXADC_H__
17
18/*
19 * R16429 (0x402D) - AuxADC Data
20 */
21#define WM831X_AUX_DATA_SRC_MASK 0xF000 /* AUX_DATA_SRC - [15:12] */
22#define WM831X_AUX_DATA_SRC_SHIFT 12 /* AUX_DATA_SRC - [15:12] */
23#define WM831X_AUX_DATA_SRC_WIDTH 4 /* AUX_DATA_SRC - [15:12] */
24#define WM831X_AUX_DATA_MASK 0x0FFF /* AUX_DATA - [11:0] */
25#define WM831X_AUX_DATA_SHIFT 0 /* AUX_DATA - [11:0] */
26#define WM831X_AUX_DATA_WIDTH 12 /* AUX_DATA - [11:0] */
27
28/*
29 * R16430 (0x402E) - AuxADC Control
30 */
31#define WM831X_AUX_ENA 0x8000 /* AUX_ENA */
32#define WM831X_AUX_ENA_MASK 0x8000 /* AUX_ENA */
33#define WM831X_AUX_ENA_SHIFT 15 /* AUX_ENA */
34#define WM831X_AUX_ENA_WIDTH 1 /* AUX_ENA */
35#define WM831X_AUX_CVT_ENA 0x4000 /* AUX_CVT_ENA */
36#define WM831X_AUX_CVT_ENA_MASK 0x4000 /* AUX_CVT_ENA */
37#define WM831X_AUX_CVT_ENA_SHIFT 14 /* AUX_CVT_ENA */
38#define WM831X_AUX_CVT_ENA_WIDTH 1 /* AUX_CVT_ENA */
39#define WM831X_AUX_SLPENA 0x1000 /* AUX_SLPENA */
40#define WM831X_AUX_SLPENA_MASK 0x1000 /* AUX_SLPENA */
41#define WM831X_AUX_SLPENA_SHIFT 12 /* AUX_SLPENA */
42#define WM831X_AUX_SLPENA_WIDTH 1 /* AUX_SLPENA */
43#define WM831X_AUX_FRC_ENA 0x0800 /* AUX_FRC_ENA */
44#define WM831X_AUX_FRC_ENA_MASK 0x0800 /* AUX_FRC_ENA */
45#define WM831X_AUX_FRC_ENA_SHIFT 11 /* AUX_FRC_ENA */
46#define WM831X_AUX_FRC_ENA_WIDTH 1 /* AUX_FRC_ENA */
47#define WM831X_AUX_RATE_MASK 0x003F /* AUX_RATE - [5:0] */
48#define WM831X_AUX_RATE_SHIFT 0 /* AUX_RATE - [5:0] */
49#define WM831X_AUX_RATE_WIDTH 6 /* AUX_RATE - [5:0] */
50
51/*
52 * R16431 (0x402F) - AuxADC Source
53 */
54#define WM831X_AUX_CAL_SEL 0x8000 /* AUX_CAL_SEL */
55#define WM831X_AUX_CAL_SEL_MASK 0x8000 /* AUX_CAL_SEL */
56#define WM831X_AUX_CAL_SEL_SHIFT 15 /* AUX_CAL_SEL */
57#define WM831X_AUX_CAL_SEL_WIDTH 1 /* AUX_CAL_SEL */
58#define WM831X_AUX_BKUP_BATT_SEL 0x0400 /* AUX_BKUP_BATT_SEL */
59#define WM831X_AUX_BKUP_BATT_SEL_MASK 0x0400 /* AUX_BKUP_BATT_SEL */
60#define WM831X_AUX_BKUP_BATT_SEL_SHIFT 10 /* AUX_BKUP_BATT_SEL */
61#define WM831X_AUX_BKUP_BATT_SEL_WIDTH 1 /* AUX_BKUP_BATT_SEL */
62#define WM831X_AUX_WALL_SEL 0x0200 /* AUX_WALL_SEL */
63#define WM831X_AUX_WALL_SEL_MASK 0x0200 /* AUX_WALL_SEL */
64#define WM831X_AUX_WALL_SEL_SHIFT 9 /* AUX_WALL_SEL */
65#define WM831X_AUX_WALL_SEL_WIDTH 1 /* AUX_WALL_SEL */
66#define WM831X_AUX_BATT_SEL 0x0100 /* AUX_BATT_SEL */
67#define WM831X_AUX_BATT_SEL_MASK 0x0100 /* AUX_BATT_SEL */
68#define WM831X_AUX_BATT_SEL_SHIFT 8 /* AUX_BATT_SEL */
69#define WM831X_AUX_BATT_SEL_WIDTH 1 /* AUX_BATT_SEL */
70#define WM831X_AUX_USB_SEL 0x0080 /* AUX_USB_SEL */
71#define WM831X_AUX_USB_SEL_MASK 0x0080 /* AUX_USB_SEL */
72#define WM831X_AUX_USB_SEL_SHIFT 7 /* AUX_USB_SEL */
73#define WM831X_AUX_USB_SEL_WIDTH 1 /* AUX_USB_SEL */
74#define WM831X_AUX_SYSVDD_SEL 0x0040 /* AUX_SYSVDD_SEL */
75#define WM831X_AUX_SYSVDD_SEL_MASK 0x0040 /* AUX_SYSVDD_SEL */
76#define WM831X_AUX_SYSVDD_SEL_SHIFT 6 /* AUX_SYSVDD_SEL */
77#define WM831X_AUX_SYSVDD_SEL_WIDTH 1 /* AUX_SYSVDD_SEL */
78#define WM831X_AUX_BATT_TEMP_SEL 0x0020 /* AUX_BATT_TEMP_SEL */
79#define WM831X_AUX_BATT_TEMP_SEL_MASK 0x0020 /* AUX_BATT_TEMP_SEL */
80#define WM831X_AUX_BATT_TEMP_SEL_SHIFT 5 /* AUX_BATT_TEMP_SEL */
81#define WM831X_AUX_BATT_TEMP_SEL_WIDTH 1 /* AUX_BATT_TEMP_SEL */
82#define WM831X_AUX_CHIP_TEMP_SEL 0x0010 /* AUX_CHIP_TEMP_SEL */
83#define WM831X_AUX_CHIP_TEMP_SEL_MASK 0x0010 /* AUX_CHIP_TEMP_SEL */
84#define WM831X_AUX_CHIP_TEMP_SEL_SHIFT 4 /* AUX_CHIP_TEMP_SEL */
85#define WM831X_AUX_CHIP_TEMP_SEL_WIDTH 1 /* AUX_CHIP_TEMP_SEL */
86#define WM831X_AUX_AUX4_SEL 0x0008 /* AUX_AUX4_SEL */
87#define WM831X_AUX_AUX4_SEL_MASK 0x0008 /* AUX_AUX4_SEL */
88#define WM831X_AUX_AUX4_SEL_SHIFT 3 /* AUX_AUX4_SEL */
89#define WM831X_AUX_AUX4_SEL_WIDTH 1 /* AUX_AUX4_SEL */
90#define WM831X_AUX_AUX3_SEL 0x0004 /* AUX_AUX3_SEL */
91#define WM831X_AUX_AUX3_SEL_MASK 0x0004 /* AUX_AUX3_SEL */
92#define WM831X_AUX_AUX3_SEL_SHIFT 2 /* AUX_AUX3_SEL */
93#define WM831X_AUX_AUX3_SEL_WIDTH 1 /* AUX_AUX3_SEL */
94#define WM831X_AUX_AUX2_SEL 0x0002 /* AUX_AUX2_SEL */
95#define WM831X_AUX_AUX2_SEL_MASK 0x0002 /* AUX_AUX2_SEL */
96#define WM831X_AUX_AUX2_SEL_SHIFT 1 /* AUX_AUX2_SEL */
97#define WM831X_AUX_AUX2_SEL_WIDTH 1 /* AUX_AUX2_SEL */
98#define WM831X_AUX_AUX1_SEL 0x0001 /* AUX_AUX1_SEL */
99#define WM831X_AUX_AUX1_SEL_MASK 0x0001 /* AUX_AUX1_SEL */
100#define WM831X_AUX_AUX1_SEL_SHIFT 0 /* AUX_AUX1_SEL */
101#define WM831X_AUX_AUX1_SEL_WIDTH 1 /* AUX_AUX1_SEL */
102
103/*
104 * R16432 (0x4030) - Comparator Control
105 */
106#define WM831X_DCOMP4_STS 0x0800 /* DCOMP4_STS */
107#define WM831X_DCOMP4_STS_MASK 0x0800 /* DCOMP4_STS */
108#define WM831X_DCOMP4_STS_SHIFT 11 /* DCOMP4_STS */
109#define WM831X_DCOMP4_STS_WIDTH 1 /* DCOMP4_STS */
110#define WM831X_DCOMP3_STS 0x0400 /* DCOMP3_STS */
111#define WM831X_DCOMP3_STS_MASK 0x0400 /* DCOMP3_STS */
112#define WM831X_DCOMP3_STS_SHIFT 10 /* DCOMP3_STS */
113#define WM831X_DCOMP3_STS_WIDTH 1 /* DCOMP3_STS */
114#define WM831X_DCOMP2_STS 0x0200 /* DCOMP2_STS */
115#define WM831X_DCOMP2_STS_MASK 0x0200 /* DCOMP2_STS */
116#define WM831X_DCOMP2_STS_SHIFT 9 /* DCOMP2_STS */
117#define WM831X_DCOMP2_STS_WIDTH 1 /* DCOMP2_STS */
118#define WM831X_DCOMP1_STS 0x0100 /* DCOMP1_STS */
119#define WM831X_DCOMP1_STS_MASK 0x0100 /* DCOMP1_STS */
120#define WM831X_DCOMP1_STS_SHIFT 8 /* DCOMP1_STS */
121#define WM831X_DCOMP1_STS_WIDTH 1 /* DCOMP1_STS */
122#define WM831X_DCMP4_ENA 0x0008 /* DCMP4_ENA */
123#define WM831X_DCMP4_ENA_MASK 0x0008 /* DCMP4_ENA */
124#define WM831X_DCMP4_ENA_SHIFT 3 /* DCMP4_ENA */
125#define WM831X_DCMP4_ENA_WIDTH 1 /* DCMP4_ENA */
126#define WM831X_DCMP3_ENA 0x0004 /* DCMP3_ENA */
127#define WM831X_DCMP3_ENA_MASK 0x0004 /* DCMP3_ENA */
128#define WM831X_DCMP3_ENA_SHIFT 2 /* DCMP3_ENA */
129#define WM831X_DCMP3_ENA_WIDTH 1 /* DCMP3_ENA */
130#define WM831X_DCMP2_ENA 0x0002 /* DCMP2_ENA */
131#define WM831X_DCMP2_ENA_MASK 0x0002 /* DCMP2_ENA */
132#define WM831X_DCMP2_ENA_SHIFT 1 /* DCMP2_ENA */
133#define WM831X_DCMP2_ENA_WIDTH 1 /* DCMP2_ENA */
134#define WM831X_DCMP1_ENA 0x0001 /* DCMP1_ENA */
135#define WM831X_DCMP1_ENA_MASK 0x0001 /* DCMP1_ENA */
136#define WM831X_DCMP1_ENA_SHIFT 0 /* DCMP1_ENA */
137#define WM831X_DCMP1_ENA_WIDTH 1 /* DCMP1_ENA */
138
139/*
140 * R16433 (0x4031) - Comparator 1
141 */
142#define WM831X_DCMP1_SRC_MASK 0xE000 /* DCMP1_SRC - [15:13] */
143#define WM831X_DCMP1_SRC_SHIFT 13 /* DCMP1_SRC - [15:13] */
144#define WM831X_DCMP1_SRC_WIDTH 3 /* DCMP1_SRC - [15:13] */
145#define WM831X_DCMP1_GT 0x1000 /* DCMP1_GT */
146#define WM831X_DCMP1_GT_MASK 0x1000 /* DCMP1_GT */
147#define WM831X_DCMP1_GT_SHIFT 12 /* DCMP1_GT */
148#define WM831X_DCMP1_GT_WIDTH 1 /* DCMP1_GT */
149#define WM831X_DCMP1_THR_MASK 0x0FFF /* DCMP1_THR - [11:0] */
150#define WM831X_DCMP1_THR_SHIFT 0 /* DCMP1_THR - [11:0] */
151#define WM831X_DCMP1_THR_WIDTH 12 /* DCMP1_THR - [11:0] */
152
153/*
154 * R16434 (0x4032) - Comparator 2
155 */
156#define WM831X_DCMP2_SRC_MASK 0xE000 /* DCMP2_SRC - [15:13] */
157#define WM831X_DCMP2_SRC_SHIFT 13 /* DCMP2_SRC - [15:13] */
158#define WM831X_DCMP2_SRC_WIDTH 3 /* DCMP2_SRC - [15:13] */
159#define WM831X_DCMP2_GT 0x1000 /* DCMP2_GT */
160#define WM831X_DCMP2_GT_MASK 0x1000 /* DCMP2_GT */
161#define WM831X_DCMP2_GT_SHIFT 12 /* DCMP2_GT */
162#define WM831X_DCMP2_GT_WIDTH 1 /* DCMP2_GT */
163#define WM831X_DCMP2_THR_MASK 0x0FFF /* DCMP2_THR - [11:0] */
164#define WM831X_DCMP2_THR_SHIFT 0 /* DCMP2_THR - [11:0] */
165#define WM831X_DCMP2_THR_WIDTH 12 /* DCMP2_THR - [11:0] */
166
167/*
168 * R16435 (0x4033) - Comparator 3
169 */
170#define WM831X_DCMP3_SRC_MASK 0xE000 /* DCMP3_SRC - [15:13] */
171#define WM831X_DCMP3_SRC_SHIFT 13 /* DCMP3_SRC - [15:13] */
172#define WM831X_DCMP3_SRC_WIDTH 3 /* DCMP3_SRC - [15:13] */
173#define WM831X_DCMP3_GT 0x1000 /* DCMP3_GT */
174#define WM831X_DCMP3_GT_MASK 0x1000 /* DCMP3_GT */
175#define WM831X_DCMP3_GT_SHIFT 12 /* DCMP3_GT */
176#define WM831X_DCMP3_GT_WIDTH 1 /* DCMP3_GT */
177#define WM831X_DCMP3_THR_MASK 0x0FFF /* DCMP3_THR - [11:0] */
178#define WM831X_DCMP3_THR_SHIFT 0 /* DCMP3_THR - [11:0] */
179#define WM831X_DCMP3_THR_WIDTH 12 /* DCMP3_THR - [11:0] */
180
181/*
182 * R16436 (0x4034) - Comparator 4
183 */
184#define WM831X_DCMP4_SRC_MASK 0xE000 /* DCMP4_SRC - [15:13] */
185#define WM831X_DCMP4_SRC_SHIFT 13 /* DCMP4_SRC - [15:13] */
186#define WM831X_DCMP4_SRC_WIDTH 3 /* DCMP4_SRC - [15:13] */
187#define WM831X_DCMP4_GT 0x1000 /* DCMP4_GT */
188#define WM831X_DCMP4_GT_MASK 0x1000 /* DCMP4_GT */
189#define WM831X_DCMP4_GT_SHIFT 12 /* DCMP4_GT */
190#define WM831X_DCMP4_GT_WIDTH 1 /* DCMP4_GT */
191#define WM831X_DCMP4_THR_MASK 0x0FFF /* DCMP4_THR - [11:0] */
192#define WM831X_DCMP4_THR_SHIFT 0 /* DCMP4_THR - [11:0] */
193#define WM831X_DCMP4_THR_WIDTH 12 /* DCMP4_THR - [11:0] */
194
195#define WM831X_AUX_CAL_FACTOR 0xfff
196#define WM831X_AUX_CAL_NOMINAL 0x222
197
198enum wm831x_auxadc {
199 WM831X_AUX_CAL = 15,
200 WM831X_AUX_BKUP_BATT = 10,
201 WM831X_AUX_WALL = 9,
202 WM831X_AUX_BATT = 8,
203 WM831X_AUX_USB = 7,
204 WM831X_AUX_SYSVDD = 6,
205 WM831X_AUX_BATT_TEMP = 5,
206 WM831X_AUX_CHIP_TEMP = 4,
207 WM831X_AUX_AUX4 = 3,
208 WM831X_AUX_AUX3 = 2,
209 WM831X_AUX_AUX2 = 1,
210 WM831X_AUX_AUX1 = 0,
211};
212
213int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input);
214int wm831x_auxadc_read_uv(struct wm831x *wm831x, enum wm831x_auxadc input);
215
216#endif
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
new file mode 100644
index 000000000000..91eb493bf14c
--- /dev/null
+++ b/include/linux/mfd/wm831x/core.h
@@ -0,0 +1,289 @@
1/*
2 * include/linux/mfd/wm831x/core.h -- Core interface for WM831x
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_WM831X_CORE_H__
16#define __MFD_WM831X_CORE_H__
17
18#include <linux/interrupt.h>
19#include <linux/workqueue.h>
20
21/*
22 * Register values.
23 */
24#define WM831X_RESET_ID 0x00
25#define WM831X_REVISION 0x01
26#define WM831X_PARENT_ID 0x4000
27#define WM831X_SYSVDD_CONTROL 0x4001
28#define WM831X_THERMAL_MONITORING 0x4002
29#define WM831X_POWER_STATE 0x4003
30#define WM831X_WATCHDOG 0x4004
31#define WM831X_ON_PIN_CONTROL 0x4005
32#define WM831X_RESET_CONTROL 0x4006
33#define WM831X_CONTROL_INTERFACE 0x4007
34#define WM831X_SECURITY_KEY 0x4008
35#define WM831X_SOFTWARE_SCRATCH 0x4009
36#define WM831X_OTP_CONTROL 0x400A
37#define WM831X_GPIO_LEVEL 0x400C
38#define WM831X_SYSTEM_STATUS 0x400D
39#define WM831X_ON_SOURCE 0x400E
40#define WM831X_OFF_SOURCE 0x400F
41#define WM831X_SYSTEM_INTERRUPTS 0x4010
42#define WM831X_INTERRUPT_STATUS_1 0x4011
43#define WM831X_INTERRUPT_STATUS_2 0x4012
44#define WM831X_INTERRUPT_STATUS_3 0x4013
45#define WM831X_INTERRUPT_STATUS_4 0x4014
46#define WM831X_INTERRUPT_STATUS_5 0x4015
47#define WM831X_IRQ_CONFIG 0x4017
48#define WM831X_SYSTEM_INTERRUPTS_MASK 0x4018
49#define WM831X_INTERRUPT_STATUS_1_MASK 0x4019
50#define WM831X_INTERRUPT_STATUS_2_MASK 0x401A
51#define WM831X_INTERRUPT_STATUS_3_MASK 0x401B
52#define WM831X_INTERRUPT_STATUS_4_MASK 0x401C
53#define WM831X_INTERRUPT_STATUS_5_MASK 0x401D
54#define WM831X_RTC_WRITE_COUNTER 0x4020
55#define WM831X_RTC_TIME_1 0x4021
56#define WM831X_RTC_TIME_2 0x4022
57#define WM831X_RTC_ALARM_1 0x4023
58#define WM831X_RTC_ALARM_2 0x4024
59#define WM831X_RTC_CONTROL 0x4025
60#define WM831X_RTC_TRIM 0x4026
61#define WM831X_TOUCH_CONTROL_1 0x4028
62#define WM831X_TOUCH_CONTROL_2 0x4029
63#define WM831X_TOUCH_DATA_X 0x402A
64#define WM831X_TOUCH_DATA_Y 0x402B
65#define WM831X_TOUCH_DATA_Z 0x402C
66#define WM831X_AUXADC_DATA 0x402D
67#define WM831X_AUXADC_CONTROL 0x402E
68#define WM831X_AUXADC_SOURCE 0x402F
69#define WM831X_COMPARATOR_CONTROL 0x4030
70#define WM831X_COMPARATOR_1 0x4031
71#define WM831X_COMPARATOR_2 0x4032
72#define WM831X_COMPARATOR_3 0x4033
73#define WM831X_COMPARATOR_4 0x4034
74#define WM831X_GPIO1_CONTROL 0x4038
75#define WM831X_GPIO2_CONTROL 0x4039
76#define WM831X_GPIO3_CONTROL 0x403A
77#define WM831X_GPIO4_CONTROL 0x403B
78#define WM831X_GPIO5_CONTROL 0x403C
79#define WM831X_GPIO6_CONTROL 0x403D
80#define WM831X_GPIO7_CONTROL 0x403E
81#define WM831X_GPIO8_CONTROL 0x403F
82#define WM831X_GPIO9_CONTROL 0x4040
83#define WM831X_GPIO10_CONTROL 0x4041
84#define WM831X_GPIO11_CONTROL 0x4042
85#define WM831X_GPIO12_CONTROL 0x4043
86#define WM831X_GPIO13_CONTROL 0x4044
87#define WM831X_GPIO14_CONTROL 0x4045
88#define WM831X_GPIO15_CONTROL 0x4046
89#define WM831X_GPIO16_CONTROL 0x4047
90#define WM831X_CHARGER_CONTROL_1 0x4048
91#define WM831X_CHARGER_CONTROL_2 0x4049
92#define WM831X_CHARGER_STATUS 0x404A
93#define WM831X_BACKUP_CHARGER_CONTROL 0x404B
94#define WM831X_STATUS_LED_1 0x404C
95#define WM831X_STATUS_LED_2 0x404D
96#define WM831X_CURRENT_SINK_1 0x404E
97#define WM831X_CURRENT_SINK_2 0x404F
98#define WM831X_DCDC_ENABLE 0x4050
99#define WM831X_LDO_ENABLE 0x4051
100#define WM831X_DCDC_STATUS 0x4052
101#define WM831X_LDO_STATUS 0x4053
102#define WM831X_DCDC_UV_STATUS 0x4054
103#define WM831X_LDO_UV_STATUS 0x4055
104#define WM831X_DC1_CONTROL_1 0x4056
105#define WM831X_DC1_CONTROL_2 0x4057
106#define WM831X_DC1_ON_CONFIG 0x4058
107#define WM831X_DC1_SLEEP_CONTROL 0x4059
108#define WM831X_DC1_DVS_CONTROL 0x405A
109#define WM831X_DC2_CONTROL_1 0x405B
110#define WM831X_DC2_CONTROL_2 0x405C
111#define WM831X_DC2_ON_CONFIG 0x405D
112#define WM831X_DC2_SLEEP_CONTROL 0x405E
113#define WM831X_DC2_DVS_CONTROL 0x405F
114#define WM831X_DC3_CONTROL_1 0x4060
115#define WM831X_DC3_CONTROL_2 0x4061
116#define WM831X_DC3_ON_CONFIG 0x4062
117#define WM831X_DC3_SLEEP_CONTROL 0x4063
118#define WM831X_DC4_CONTROL 0x4064
119#define WM831X_DC4_SLEEP_CONTROL 0x4065
120#define WM831X_EPE1_CONTROL 0x4066
121#define WM831X_EPE2_CONTROL 0x4067
122#define WM831X_LDO1_CONTROL 0x4068
123#define WM831X_LDO1_ON_CONTROL 0x4069
124#define WM831X_LDO1_SLEEP_CONTROL 0x406A
125#define WM831X_LDO2_CONTROL 0x406B
126#define WM831X_LDO2_ON_CONTROL 0x406C
127#define WM831X_LDO2_SLEEP_CONTROL 0x406D
128#define WM831X_LDO3_CONTROL 0x406E
129#define WM831X_LDO3_ON_CONTROL 0x406F
130#define WM831X_LDO3_SLEEP_CONTROL 0x4070
131#define WM831X_LDO4_CONTROL 0x4071
132#define WM831X_LDO4_ON_CONTROL 0x4072
133#define WM831X_LDO4_SLEEP_CONTROL 0x4073
134#define WM831X_LDO5_CONTROL 0x4074
135#define WM831X_LDO5_ON_CONTROL 0x4075
136#define WM831X_LDO5_SLEEP_CONTROL 0x4076
137#define WM831X_LDO6_CONTROL 0x4077
138#define WM831X_LDO6_ON_CONTROL 0x4078
139#define WM831X_LDO6_SLEEP_CONTROL 0x4079
140#define WM831X_LDO7_CONTROL 0x407A
141#define WM831X_LDO7_ON_CONTROL 0x407B
142#define WM831X_LDO7_SLEEP_CONTROL 0x407C
143#define WM831X_LDO8_CONTROL 0x407D
144#define WM831X_LDO8_ON_CONTROL 0x407E
145#define WM831X_LDO8_SLEEP_CONTROL 0x407F
146#define WM831X_LDO9_CONTROL 0x4080
147#define WM831X_LDO9_ON_CONTROL 0x4081
148#define WM831X_LDO9_SLEEP_CONTROL 0x4082
149#define WM831X_LDO10_CONTROL 0x4083
150#define WM831X_LDO10_ON_CONTROL 0x4084
151#define WM831X_LDO10_SLEEP_CONTROL 0x4085
152#define WM831X_LDO11_ON_CONTROL 0x4087
153#define WM831X_LDO11_SLEEP_CONTROL 0x4088
154#define WM831X_POWER_GOOD_SOURCE_1 0x408E
155#define WM831X_POWER_GOOD_SOURCE_2 0x408F
156#define WM831X_CLOCK_CONTROL_1 0x4090
157#define WM831X_CLOCK_CONTROL_2 0x4091
158#define WM831X_FLL_CONTROL_1 0x4092
159#define WM831X_FLL_CONTROL_2 0x4093
160#define WM831X_FLL_CONTROL_3 0x4094
161#define WM831X_FLL_CONTROL_4 0x4095
162#define WM831X_FLL_CONTROL_5 0x4096
163#define WM831X_UNIQUE_ID_1 0x7800
164#define WM831X_UNIQUE_ID_2 0x7801
165#define WM831X_UNIQUE_ID_3 0x7802
166#define WM831X_UNIQUE_ID_4 0x7803
167#define WM831X_UNIQUE_ID_5 0x7804
168#define WM831X_UNIQUE_ID_6 0x7805
169#define WM831X_UNIQUE_ID_7 0x7806
170#define WM831X_UNIQUE_ID_8 0x7807
171#define WM831X_FACTORY_OTP_ID 0x7808
172#define WM831X_FACTORY_OTP_1 0x7809
173#define WM831X_FACTORY_OTP_2 0x780A
174#define WM831X_FACTORY_OTP_3 0x780B
175#define WM831X_FACTORY_OTP_4 0x780C
176#define WM831X_FACTORY_OTP_5 0x780D
177#define WM831X_CUSTOMER_OTP_ID 0x7810
178#define WM831X_DC1_OTP_CONTROL 0x7811
179#define WM831X_DC2_OTP_CONTROL 0x7812
180#define WM831X_DC3_OTP_CONTROL 0x7813
181#define WM831X_LDO1_2_OTP_CONTROL 0x7814
182#define WM831X_LDO3_4_OTP_CONTROL 0x7815
183#define WM831X_LDO5_6_OTP_CONTROL 0x7816
184#define WM831X_LDO7_8_OTP_CONTROL 0x7817
185#define WM831X_LDO9_10_OTP_CONTROL 0x7818
186#define WM831X_LDO11_EPE_CONTROL 0x7819
187#define WM831X_GPIO1_OTP_CONTROL 0x781A
188#define WM831X_GPIO2_OTP_CONTROL 0x781B
189#define WM831X_GPIO3_OTP_CONTROL 0x781C
190#define WM831X_GPIO4_OTP_CONTROL 0x781D
191#define WM831X_GPIO5_OTP_CONTROL 0x781E
192#define WM831X_GPIO6_OTP_CONTROL 0x781F
193#define WM831X_DBE_CHECK_DATA 0x7827
194
195/*
196 * R0 (0x00) - Reset ID
197 */
198#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
199#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
200#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
201
202/*
203 * R1 (0x01) - Revision
204 */
205#define WM831X_PARENT_REV_MASK 0xFF00 /* PARENT_REV - [15:8] */
206#define WM831X_PARENT_REV_SHIFT 8 /* PARENT_REV - [15:8] */
207#define WM831X_PARENT_REV_WIDTH 8 /* PARENT_REV - [15:8] */
208#define WM831X_CHILD_REV_MASK 0x00FF /* CHILD_REV - [7:0] */
209#define WM831X_CHILD_REV_SHIFT 0 /* CHILD_REV - [7:0] */
210#define WM831X_CHILD_REV_WIDTH 8 /* CHILD_REV - [7:0] */
211
212/*
213 * R16384 (0x4000) - Parent ID
214 */
215#define WM831X_PARENT_ID_MASK 0xFFFF /* PARENT_ID - [15:0] */
216#define WM831X_PARENT_ID_SHIFT 0 /* PARENT_ID - [15:0] */
217#define WM831X_PARENT_ID_WIDTH 16 /* PARENT_ID - [15:0] */
218
219/*
220 * R16389 (0x4005) - ON Pin Control
221 */
222#define WM831X_ON_PIN_SECACT_MASK 0x0300 /* ON_PIN_SECACT - [9:8] */
223#define WM831X_ON_PIN_SECACT_SHIFT 8 /* ON_PIN_SECACT - [9:8] */
224#define WM831X_ON_PIN_SECACT_WIDTH 2 /* ON_PIN_SECACT - [9:8] */
225#define WM831X_ON_PIN_PRIMACT_MASK 0x0030 /* ON_PIN_PRIMACT - [5:4] */
226#define WM831X_ON_PIN_PRIMACT_SHIFT 4 /* ON_PIN_PRIMACT - [5:4] */
227#define WM831X_ON_PIN_PRIMACT_WIDTH 2 /* ON_PIN_PRIMACT - [5:4] */
228#define WM831X_ON_PIN_STS 0x0008 /* ON_PIN_STS */
229#define WM831X_ON_PIN_STS_MASK 0x0008 /* ON_PIN_STS */
230#define WM831X_ON_PIN_STS_SHIFT 3 /* ON_PIN_STS */
231#define WM831X_ON_PIN_STS_WIDTH 1 /* ON_PIN_STS */
232#define WM831X_ON_PIN_TO_MASK 0x0003 /* ON_PIN_TO - [1:0] */
233#define WM831X_ON_PIN_TO_SHIFT 0 /* ON_PIN_TO - [1:0] */
234#define WM831X_ON_PIN_TO_WIDTH 2 /* ON_PIN_TO - [1:0] */
235
236struct regulator_dev;
237
238struct wm831x {
239 struct mutex io_lock;
240
241 struct device *dev;
242 int (*read_dev)(struct wm831x *wm831x, unsigned short reg,
243 int bytes, void *dest);
244 int (*write_dev)(struct wm831x *wm831x, unsigned short reg,
245 int bytes, void *src);
246
247 void *control_data;
248
249 int irq; /* Our chip IRQ */
250 struct mutex irq_lock;
251 struct workqueue_struct *irq_wq;
252 struct work_struct irq_work;
253 unsigned int irq_base;
254 int irq_masks[5];
255
256 struct mutex auxadc_lock;
257
258 /* The WM831x has a security key blocking access to certain
259 * registers. The mutex is taken by the accessors for locking
260 * and unlocking the security key, locked is used to fail
261 * writes if the lock is held.
262 */
263 struct mutex key_lock;
264 unsigned int locked:1;
265};
266
267/* Device I/O API */
268int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg);
269int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg,
270 unsigned short val);
271void wm831x_reg_lock(struct wm831x *wm831x);
272int wm831x_reg_unlock(struct wm831x *wm831x);
273int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
274 unsigned short mask, unsigned short val);
275int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
276 int count, u16 *buf);
277
278int wm831x_irq_init(struct wm831x *wm831x, int irq);
279void wm831x_irq_exit(struct wm831x *wm831x);
280
281int __must_check wm831x_request_irq(struct wm831x *wm831x,
282 unsigned int irq, irq_handler_t handler,
283 unsigned long flags, const char *name,
284 void *dev);
285void wm831x_free_irq(struct wm831x *wm831x, unsigned int, void *);
286void wm831x_disable_irq(struct wm831x *wm831x, int irq);
287void wm831x_enable_irq(struct wm831x *wm831x, int irq);
288
289#endif
diff --git a/include/linux/mfd/wm831x/gpio.h b/include/linux/mfd/wm831x/gpio.h
new file mode 100644
index 000000000000..2835614af0e3
--- /dev/null
+++ b/include/linux/mfd/wm831x/gpio.h
@@ -0,0 +1,55 @@
1/*
2 * include/linux/mfd/wm831x/gpio.h -- GPIO for WM831x
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_WM831X_GPIO_H__
16#define __MFD_WM831X_GPIO_H__
17
18/*
19 * R16440-16455 (0x4038-0x4047) - GPIOx Control
20 */
21#define WM831X_GPN_DIR 0x8000 /* GPN_DIR */
22#define WM831X_GPN_DIR_MASK 0x8000 /* GPN_DIR */
23#define WM831X_GPN_DIR_SHIFT 15 /* GPN_DIR */
24#define WM831X_GPN_DIR_WIDTH 1 /* GPN_DIR */
25#define WM831X_GPN_PULL_MASK 0x6000 /* GPN_PULL - [14:13] */
26#define WM831X_GPN_PULL_SHIFT 13 /* GPN_PULL - [14:13] */
27#define WM831X_GPN_PULL_WIDTH 2 /* GPN_PULL - [14:13] */
28#define WM831X_GPN_INT_MODE 0x1000 /* GPN_INT_MODE */
29#define WM831X_GPN_INT_MODE_MASK 0x1000 /* GPN_INT_MODE */
30#define WM831X_GPN_INT_MODE_SHIFT 12 /* GPN_INT_MODE */
31#define WM831X_GPN_INT_MODE_WIDTH 1 /* GPN_INT_MODE */
32#define WM831X_GPN_PWR_DOM 0x0800 /* GPN_PWR_DOM */
33#define WM831X_GPN_PWR_DOM_MASK 0x0800 /* GPN_PWR_DOM */
34#define WM831X_GPN_PWR_DOM_SHIFT 11 /* GPN_PWR_DOM */
35#define WM831X_GPN_PWR_DOM_WIDTH 1 /* GPN_PWR_DOM */
36#define WM831X_GPN_POL 0x0400 /* GPN_POL */
37#define WM831X_GPN_POL_MASK 0x0400 /* GPN_POL */
38#define WM831X_GPN_POL_SHIFT 10 /* GPN_POL */
39#define WM831X_GPN_POL_WIDTH 1 /* GPN_POL */
40#define WM831X_GPN_OD 0x0200 /* GPN_OD */
41#define WM831X_GPN_OD_MASK 0x0200 /* GPN_OD */
42#define WM831X_GPN_OD_SHIFT 9 /* GPN_OD */
43#define WM831X_GPN_OD_WIDTH 1 /* GPN_OD */
44#define WM831X_GPN_TRI 0x0080 /* GPN_TRI */
45#define WM831X_GPN_TRI_MASK 0x0080 /* GPN_TRI */
46#define WM831X_GPN_TRI_SHIFT 7 /* GPN_TRI */
47#define WM831X_GPN_TRI_WIDTH 1 /* GPN_TRI */
48#define WM831X_GPN_FN_MASK 0x000F /* GPN_FN - [3:0] */
49#define WM831X_GPN_FN_SHIFT 0 /* GPN_FN - [3:0] */
50#define WM831X_GPN_FN_WIDTH 4 /* GPN_FN - [3:0] */
51
52#define WM831X_GPIO_PULL_NONE (0 << WM831X_GPN_PULL_SHIFT)
53#define WM831X_GPIO_PULL_DOWN (1 << WM831X_GPN_PULL_SHIFT)
54#define WM831X_GPIO_PULL_UP (2 << WM831X_GPN_PULL_SHIFT)
55#endif
diff --git a/include/linux/mfd/wm831x/irq.h b/include/linux/mfd/wm831x/irq.h
new file mode 100644
index 000000000000..3a8c97656fda
--- /dev/null
+++ b/include/linux/mfd/wm831x/irq.h
@@ -0,0 +1,764 @@
1/*
2 * include/linux/mfd/wm831x/irq.h -- Interrupt controller for WM831x
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_WM831X_IRQ_H__
16#define __MFD_WM831X_IRQ_H__
17
18/* Interrupt number assignments within Linux */
19#define WM831X_IRQ_TEMP_THW 0
20#define WM831X_IRQ_GPIO_1 1
21#define WM831X_IRQ_GPIO_2 2
22#define WM831X_IRQ_GPIO_3 3
23#define WM831X_IRQ_GPIO_4 4
24#define WM831X_IRQ_GPIO_5 5
25#define WM831X_IRQ_GPIO_6 6
26#define WM831X_IRQ_GPIO_7 7
27#define WM831X_IRQ_GPIO_8 8
28#define WM831X_IRQ_GPIO_9 9
29#define WM831X_IRQ_GPIO_10 10
30#define WM831X_IRQ_GPIO_11 11
31#define WM831X_IRQ_GPIO_12 12
32#define WM831X_IRQ_GPIO_13 13
33#define WM831X_IRQ_GPIO_14 14
34#define WM831X_IRQ_GPIO_15 15
35#define WM831X_IRQ_GPIO_16 16
36#define WM831X_IRQ_ON 17
37#define WM831X_IRQ_PPM_SYSLO 18
38#define WM831X_IRQ_PPM_PWR_SRC 19
39#define WM831X_IRQ_PPM_USB_CURR 20
40#define WM831X_IRQ_WDOG_TO 21
41#define WM831X_IRQ_RTC_PER 22
42#define WM831X_IRQ_RTC_ALM 23
43#define WM831X_IRQ_CHG_BATT_HOT 24
44#define WM831X_IRQ_CHG_BATT_COLD 25
45#define WM831X_IRQ_CHG_BATT_FAIL 26
46#define WM831X_IRQ_CHG_OV 27
47#define WM831X_IRQ_CHG_END 29
48#define WM831X_IRQ_CHG_TO 30
49#define WM831X_IRQ_CHG_MODE 31
50#define WM831X_IRQ_CHG_START 32
51#define WM831X_IRQ_TCHDATA 33
52#define WM831X_IRQ_TCHPD 34
53#define WM831X_IRQ_AUXADC_DATA 35
54#define WM831X_IRQ_AUXADC_DCOMP1 36
55#define WM831X_IRQ_AUXADC_DCOMP2 37
56#define WM831X_IRQ_AUXADC_DCOMP3 38
57#define WM831X_IRQ_AUXADC_DCOMP4 39
58#define WM831X_IRQ_CS1 40
59#define WM831X_IRQ_CS2 41
60#define WM831X_IRQ_HC_DC1 42
61#define WM831X_IRQ_HC_DC2 43
62#define WM831X_IRQ_UV_LDO1 44
63#define WM831X_IRQ_UV_LDO2 45
64#define WM831X_IRQ_UV_LDO3 46
65#define WM831X_IRQ_UV_LDO4 47
66#define WM831X_IRQ_UV_LDO5 48
67#define WM831X_IRQ_UV_LDO6 49
68#define WM831X_IRQ_UV_LDO7 50
69#define WM831X_IRQ_UV_LDO8 51
70#define WM831X_IRQ_UV_LDO9 52
71#define WM831X_IRQ_UV_LDO10 53
72#define WM831X_IRQ_UV_DC1 54
73#define WM831X_IRQ_UV_DC2 55
74#define WM831X_IRQ_UV_DC3 56
75#define WM831X_IRQ_UV_DC4 57
76
77#define WM831X_NUM_IRQS 58
78
79/*
80 * R16400 (0x4010) - System Interrupts
81 */
82#define WM831X_PS_INT 0x8000 /* PS_INT */
83#define WM831X_PS_INT_MASK 0x8000 /* PS_INT */
84#define WM831X_PS_INT_SHIFT 15 /* PS_INT */
85#define WM831X_PS_INT_WIDTH 1 /* PS_INT */
86#define WM831X_TEMP_INT 0x4000 /* TEMP_INT */
87#define WM831X_TEMP_INT_MASK 0x4000 /* TEMP_INT */
88#define WM831X_TEMP_INT_SHIFT 14 /* TEMP_INT */
89#define WM831X_TEMP_INT_WIDTH 1 /* TEMP_INT */
90#define WM831X_GP_INT 0x2000 /* GP_INT */
91#define WM831X_GP_INT_MASK 0x2000 /* GP_INT */
92#define WM831X_GP_INT_SHIFT 13 /* GP_INT */
93#define WM831X_GP_INT_WIDTH 1 /* GP_INT */
94#define WM831X_ON_PIN_INT 0x1000 /* ON_PIN_INT */
95#define WM831X_ON_PIN_INT_MASK 0x1000 /* ON_PIN_INT */
96#define WM831X_ON_PIN_INT_SHIFT 12 /* ON_PIN_INT */
97#define WM831X_ON_PIN_INT_WIDTH 1 /* ON_PIN_INT */
98#define WM831X_WDOG_INT 0x0800 /* WDOG_INT */
99#define WM831X_WDOG_INT_MASK 0x0800 /* WDOG_INT */
100#define WM831X_WDOG_INT_SHIFT 11 /* WDOG_INT */
101#define WM831X_WDOG_INT_WIDTH 1 /* WDOG_INT */
102#define WM831X_TCHDATA_INT 0x0400 /* TCHDATA_INT */
103#define WM831X_TCHDATA_INT_MASK 0x0400 /* TCHDATA_INT */
104#define WM831X_TCHDATA_INT_SHIFT 10 /* TCHDATA_INT */
105#define WM831X_TCHDATA_INT_WIDTH 1 /* TCHDATA_INT */
106#define WM831X_TCHPD_INT 0x0200 /* TCHPD_INT */
107#define WM831X_TCHPD_INT_MASK 0x0200 /* TCHPD_INT */
108#define WM831X_TCHPD_INT_SHIFT 9 /* TCHPD_INT */
109#define WM831X_TCHPD_INT_WIDTH 1 /* TCHPD_INT */
110#define WM831X_AUXADC_INT 0x0100 /* AUXADC_INT */
111#define WM831X_AUXADC_INT_MASK 0x0100 /* AUXADC_INT */
112#define WM831X_AUXADC_INT_SHIFT 8 /* AUXADC_INT */
113#define WM831X_AUXADC_INT_WIDTH 1 /* AUXADC_INT */
114#define WM831X_PPM_INT 0x0080 /* PPM_INT */
115#define WM831X_PPM_INT_MASK 0x0080 /* PPM_INT */
116#define WM831X_PPM_INT_SHIFT 7 /* PPM_INT */
117#define WM831X_PPM_INT_WIDTH 1 /* PPM_INT */
118#define WM831X_CS_INT 0x0040 /* CS_INT */
119#define WM831X_CS_INT_MASK 0x0040 /* CS_INT */
120#define WM831X_CS_INT_SHIFT 6 /* CS_INT */
121#define WM831X_CS_INT_WIDTH 1 /* CS_INT */
122#define WM831X_RTC_INT 0x0020 /* RTC_INT */
123#define WM831X_RTC_INT_MASK 0x0020 /* RTC_INT */
124#define WM831X_RTC_INT_SHIFT 5 /* RTC_INT */
125#define WM831X_RTC_INT_WIDTH 1 /* RTC_INT */
126#define WM831X_OTP_INT 0x0010 /* OTP_INT */
127#define WM831X_OTP_INT_MASK 0x0010 /* OTP_INT */
128#define WM831X_OTP_INT_SHIFT 4 /* OTP_INT */
129#define WM831X_OTP_INT_WIDTH 1 /* OTP_INT */
130#define WM831X_CHILD_INT 0x0008 /* CHILD_INT */
131#define WM831X_CHILD_INT_MASK 0x0008 /* CHILD_INT */
132#define WM831X_CHILD_INT_SHIFT 3 /* CHILD_INT */
133#define WM831X_CHILD_INT_WIDTH 1 /* CHILD_INT */
134#define WM831X_CHG_INT 0x0004 /* CHG_INT */
135#define WM831X_CHG_INT_MASK 0x0004 /* CHG_INT */
136#define WM831X_CHG_INT_SHIFT 2 /* CHG_INT */
137#define WM831X_CHG_INT_WIDTH 1 /* CHG_INT */
138#define WM831X_HC_INT 0x0002 /* HC_INT */
139#define WM831X_HC_INT_MASK 0x0002 /* HC_INT */
140#define WM831X_HC_INT_SHIFT 1 /* HC_INT */
141#define WM831X_HC_INT_WIDTH 1 /* HC_INT */
142#define WM831X_UV_INT 0x0001 /* UV_INT */
143#define WM831X_UV_INT_MASK 0x0001 /* UV_INT */
144#define WM831X_UV_INT_SHIFT 0 /* UV_INT */
145#define WM831X_UV_INT_WIDTH 1 /* UV_INT */
146
147/*
148 * R16401 (0x4011) - Interrupt Status 1
149 */
150#define WM831X_PPM_SYSLO_EINT 0x8000 /* PPM_SYSLO_EINT */
151#define WM831X_PPM_SYSLO_EINT_MASK 0x8000 /* PPM_SYSLO_EINT */
152#define WM831X_PPM_SYSLO_EINT_SHIFT 15 /* PPM_SYSLO_EINT */
153#define WM831X_PPM_SYSLO_EINT_WIDTH 1 /* PPM_SYSLO_EINT */
154#define WM831X_PPM_PWR_SRC_EINT 0x4000 /* PPM_PWR_SRC_EINT */
155#define WM831X_PPM_PWR_SRC_EINT_MASK 0x4000 /* PPM_PWR_SRC_EINT */
156#define WM831X_PPM_PWR_SRC_EINT_SHIFT 14 /* PPM_PWR_SRC_EINT */
157#define WM831X_PPM_PWR_SRC_EINT_WIDTH 1 /* PPM_PWR_SRC_EINT */
158#define WM831X_PPM_USB_CURR_EINT 0x2000 /* PPM_USB_CURR_EINT */
159#define WM831X_PPM_USB_CURR_EINT_MASK 0x2000 /* PPM_USB_CURR_EINT */
160#define WM831X_PPM_USB_CURR_EINT_SHIFT 13 /* PPM_USB_CURR_EINT */
161#define WM831X_PPM_USB_CURR_EINT_WIDTH 1 /* PPM_USB_CURR_EINT */
162#define WM831X_ON_PIN_EINT 0x1000 /* ON_PIN_EINT */
163#define WM831X_ON_PIN_EINT_MASK 0x1000 /* ON_PIN_EINT */
164#define WM831X_ON_PIN_EINT_SHIFT 12 /* ON_PIN_EINT */
165#define WM831X_ON_PIN_EINT_WIDTH 1 /* ON_PIN_EINT */
166#define WM831X_WDOG_TO_EINT 0x0800 /* WDOG_TO_EINT */
167#define WM831X_WDOG_TO_EINT_MASK 0x0800 /* WDOG_TO_EINT */
168#define WM831X_WDOG_TO_EINT_SHIFT 11 /* WDOG_TO_EINT */
169#define WM831X_WDOG_TO_EINT_WIDTH 1 /* WDOG_TO_EINT */
170#define WM831X_TCHDATA_EINT 0x0400 /* TCHDATA_EINT */
171#define WM831X_TCHDATA_EINT_MASK 0x0400 /* TCHDATA_EINT */
172#define WM831X_TCHDATA_EINT_SHIFT 10 /* TCHDATA_EINT */
173#define WM831X_TCHDATA_EINT_WIDTH 1 /* TCHDATA_EINT */
174#define WM831X_TCHPD_EINT 0x0200 /* TCHPD_EINT */
175#define WM831X_TCHPD_EINT_MASK 0x0200 /* TCHPD_EINT */
176#define WM831X_TCHPD_EINT_SHIFT 9 /* TCHPD_EINT */
177#define WM831X_TCHPD_EINT_WIDTH 1 /* TCHPD_EINT */
178#define WM831X_AUXADC_DATA_EINT 0x0100 /* AUXADC_DATA_EINT */
179#define WM831X_AUXADC_DATA_EINT_MASK 0x0100 /* AUXADC_DATA_EINT */
180#define WM831X_AUXADC_DATA_EINT_SHIFT 8 /* AUXADC_DATA_EINT */
181#define WM831X_AUXADC_DATA_EINT_WIDTH 1 /* AUXADC_DATA_EINT */
182#define WM831X_AUXADC_DCOMP4_EINT 0x0080 /* AUXADC_DCOMP4_EINT */
183#define WM831X_AUXADC_DCOMP4_EINT_MASK 0x0080 /* AUXADC_DCOMP4_EINT */
184#define WM831X_AUXADC_DCOMP4_EINT_SHIFT 7 /* AUXADC_DCOMP4_EINT */
185#define WM831X_AUXADC_DCOMP4_EINT_WIDTH 1 /* AUXADC_DCOMP4_EINT */
186#define WM831X_AUXADC_DCOMP3_EINT 0x0040 /* AUXADC_DCOMP3_EINT */
187#define WM831X_AUXADC_DCOMP3_EINT_MASK 0x0040 /* AUXADC_DCOMP3_EINT */
188#define WM831X_AUXADC_DCOMP3_EINT_SHIFT 6 /* AUXADC_DCOMP3_EINT */
189#define WM831X_AUXADC_DCOMP3_EINT_WIDTH 1 /* AUXADC_DCOMP3_EINT */
190#define WM831X_AUXADC_DCOMP2_EINT 0x0020 /* AUXADC_DCOMP2_EINT */
191#define WM831X_AUXADC_DCOMP2_EINT_MASK 0x0020 /* AUXADC_DCOMP2_EINT */
192#define WM831X_AUXADC_DCOMP2_EINT_SHIFT 5 /* AUXADC_DCOMP2_EINT */
193#define WM831X_AUXADC_DCOMP2_EINT_WIDTH 1 /* AUXADC_DCOMP2_EINT */
194#define WM831X_AUXADC_DCOMP1_EINT 0x0010 /* AUXADC_DCOMP1_EINT */
195#define WM831X_AUXADC_DCOMP1_EINT_MASK 0x0010 /* AUXADC_DCOMP1_EINT */
196#define WM831X_AUXADC_DCOMP1_EINT_SHIFT 4 /* AUXADC_DCOMP1_EINT */
197#define WM831X_AUXADC_DCOMP1_EINT_WIDTH 1 /* AUXADC_DCOMP1_EINT */
198#define WM831X_RTC_PER_EINT 0x0008 /* RTC_PER_EINT */
199#define WM831X_RTC_PER_EINT_MASK 0x0008 /* RTC_PER_EINT */
200#define WM831X_RTC_PER_EINT_SHIFT 3 /* RTC_PER_EINT */
201#define WM831X_RTC_PER_EINT_WIDTH 1 /* RTC_PER_EINT */
202#define WM831X_RTC_ALM_EINT 0x0004 /* RTC_ALM_EINT */
203#define WM831X_RTC_ALM_EINT_MASK 0x0004 /* RTC_ALM_EINT */
204#define WM831X_RTC_ALM_EINT_SHIFT 2 /* RTC_ALM_EINT */
205#define WM831X_RTC_ALM_EINT_WIDTH 1 /* RTC_ALM_EINT */
206#define WM831X_TEMP_THW_EINT 0x0002 /* TEMP_THW_EINT */
207#define WM831X_TEMP_THW_EINT_MASK 0x0002 /* TEMP_THW_EINT */
208#define WM831X_TEMP_THW_EINT_SHIFT 1 /* TEMP_THW_EINT */
209#define WM831X_TEMP_THW_EINT_WIDTH 1 /* TEMP_THW_EINT */
210
211/*
212 * R16402 (0x4012) - Interrupt Status 2
213 */
214#define WM831X_CHG_BATT_HOT_EINT 0x8000 /* CHG_BATT_HOT_EINT */
215#define WM831X_CHG_BATT_HOT_EINT_MASK 0x8000 /* CHG_BATT_HOT_EINT */
216#define WM831X_CHG_BATT_HOT_EINT_SHIFT 15 /* CHG_BATT_HOT_EINT */
217#define WM831X_CHG_BATT_HOT_EINT_WIDTH 1 /* CHG_BATT_HOT_EINT */
218#define WM831X_CHG_BATT_COLD_EINT 0x4000 /* CHG_BATT_COLD_EINT */
219#define WM831X_CHG_BATT_COLD_EINT_MASK 0x4000 /* CHG_BATT_COLD_EINT */
220#define WM831X_CHG_BATT_COLD_EINT_SHIFT 14 /* CHG_BATT_COLD_EINT */
221#define WM831X_CHG_BATT_COLD_EINT_WIDTH 1 /* CHG_BATT_COLD_EINT */
222#define WM831X_CHG_BATT_FAIL_EINT 0x2000 /* CHG_BATT_FAIL_EINT */
223#define WM831X_CHG_BATT_FAIL_EINT_MASK 0x2000 /* CHG_BATT_FAIL_EINT */
224#define WM831X_CHG_BATT_FAIL_EINT_SHIFT 13 /* CHG_BATT_FAIL_EINT */
225#define WM831X_CHG_BATT_FAIL_EINT_WIDTH 1 /* CHG_BATT_FAIL_EINT */
226#define WM831X_CHG_OV_EINT 0x1000 /* CHG_OV_EINT */
227#define WM831X_CHG_OV_EINT_MASK 0x1000 /* CHG_OV_EINT */
228#define WM831X_CHG_OV_EINT_SHIFT 12 /* CHG_OV_EINT */
229#define WM831X_CHG_OV_EINT_WIDTH 1 /* CHG_OV_EINT */
230#define WM831X_CHG_END_EINT 0x0800 /* CHG_END_EINT */
231#define WM831X_CHG_END_EINT_MASK 0x0800 /* CHG_END_EINT */
232#define WM831X_CHG_END_EINT_SHIFT 11 /* CHG_END_EINT */
233#define WM831X_CHG_END_EINT_WIDTH 1 /* CHG_END_EINT */
234#define WM831X_CHG_TO_EINT 0x0400 /* CHG_TO_EINT */
235#define WM831X_CHG_TO_EINT_MASK 0x0400 /* CHG_TO_EINT */
236#define WM831X_CHG_TO_EINT_SHIFT 10 /* CHG_TO_EINT */
237#define WM831X_CHG_TO_EINT_WIDTH 1 /* CHG_TO_EINT */
238#define WM831X_CHG_MODE_EINT 0x0200 /* CHG_MODE_EINT */
239#define WM831X_CHG_MODE_EINT_MASK 0x0200 /* CHG_MODE_EINT */
240#define WM831X_CHG_MODE_EINT_SHIFT 9 /* CHG_MODE_EINT */
241#define WM831X_CHG_MODE_EINT_WIDTH 1 /* CHG_MODE_EINT */
242#define WM831X_CHG_START_EINT 0x0100 /* CHG_START_EINT */
243#define WM831X_CHG_START_EINT_MASK 0x0100 /* CHG_START_EINT */
244#define WM831X_CHG_START_EINT_SHIFT 8 /* CHG_START_EINT */
245#define WM831X_CHG_START_EINT_WIDTH 1 /* CHG_START_EINT */
246#define WM831X_CS2_EINT 0x0080 /* CS2_EINT */
247#define WM831X_CS2_EINT_MASK 0x0080 /* CS2_EINT */
248#define WM831X_CS2_EINT_SHIFT 7 /* CS2_EINT */
249#define WM831X_CS2_EINT_WIDTH 1 /* CS2_EINT */
250#define WM831X_CS1_EINT 0x0040 /* CS1_EINT */
251#define WM831X_CS1_EINT_MASK 0x0040 /* CS1_EINT */
252#define WM831X_CS1_EINT_SHIFT 6 /* CS1_EINT */
253#define WM831X_CS1_EINT_WIDTH 1 /* CS1_EINT */
254#define WM831X_OTP_CMD_END_EINT 0x0020 /* OTP_CMD_END_EINT */
255#define WM831X_OTP_CMD_END_EINT_MASK 0x0020 /* OTP_CMD_END_EINT */
256#define WM831X_OTP_CMD_END_EINT_SHIFT 5 /* OTP_CMD_END_EINT */
257#define WM831X_OTP_CMD_END_EINT_WIDTH 1 /* OTP_CMD_END_EINT */
258#define WM831X_OTP_ERR_EINT 0x0010 /* OTP_ERR_EINT */
259#define WM831X_OTP_ERR_EINT_MASK 0x0010 /* OTP_ERR_EINT */
260#define WM831X_OTP_ERR_EINT_SHIFT 4 /* OTP_ERR_EINT */
261#define WM831X_OTP_ERR_EINT_WIDTH 1 /* OTP_ERR_EINT */
262#define WM831X_PS_POR_EINT 0x0004 /* PS_POR_EINT */
263#define WM831X_PS_POR_EINT_MASK 0x0004 /* PS_POR_EINT */
264#define WM831X_PS_POR_EINT_SHIFT 2 /* PS_POR_EINT */
265#define WM831X_PS_POR_EINT_WIDTH 1 /* PS_POR_EINT */
266#define WM831X_PS_SLEEP_OFF_EINT 0x0002 /* PS_SLEEP_OFF_EINT */
267#define WM831X_PS_SLEEP_OFF_EINT_MASK 0x0002 /* PS_SLEEP_OFF_EINT */
268#define WM831X_PS_SLEEP_OFF_EINT_SHIFT 1 /* PS_SLEEP_OFF_EINT */
269#define WM831X_PS_SLEEP_OFF_EINT_WIDTH 1 /* PS_SLEEP_OFF_EINT */
270#define WM831X_PS_ON_WAKE_EINT 0x0001 /* PS_ON_WAKE_EINT */
271#define WM831X_PS_ON_WAKE_EINT_MASK 0x0001 /* PS_ON_WAKE_EINT */
272#define WM831X_PS_ON_WAKE_EINT_SHIFT 0 /* PS_ON_WAKE_EINT */
273#define WM831X_PS_ON_WAKE_EINT_WIDTH 1 /* PS_ON_WAKE_EINT */
274
275/*
276 * R16403 (0x4013) - Interrupt Status 3
277 */
278#define WM831X_UV_LDO10_EINT 0x0200 /* UV_LDO10_EINT */
279#define WM831X_UV_LDO10_EINT_MASK 0x0200 /* UV_LDO10_EINT */
280#define WM831X_UV_LDO10_EINT_SHIFT 9 /* UV_LDO10_EINT */
281#define WM831X_UV_LDO10_EINT_WIDTH 1 /* UV_LDO10_EINT */
282#define WM831X_UV_LDO9_EINT 0x0100 /* UV_LDO9_EINT */
283#define WM831X_UV_LDO9_EINT_MASK 0x0100 /* UV_LDO9_EINT */
284#define WM831X_UV_LDO9_EINT_SHIFT 8 /* UV_LDO9_EINT */
285#define WM831X_UV_LDO9_EINT_WIDTH 1 /* UV_LDO9_EINT */
286#define WM831X_UV_LDO8_EINT 0x0080 /* UV_LDO8_EINT */
287#define WM831X_UV_LDO8_EINT_MASK 0x0080 /* UV_LDO8_EINT */
288#define WM831X_UV_LDO8_EINT_SHIFT 7 /* UV_LDO8_EINT */
289#define WM831X_UV_LDO8_EINT_WIDTH 1 /* UV_LDO8_EINT */
290#define WM831X_UV_LDO7_EINT 0x0040 /* UV_LDO7_EINT */
291#define WM831X_UV_LDO7_EINT_MASK 0x0040 /* UV_LDO7_EINT */
292#define WM831X_UV_LDO7_EINT_SHIFT 6 /* UV_LDO7_EINT */
293#define WM831X_UV_LDO7_EINT_WIDTH 1 /* UV_LDO7_EINT */
294#define WM831X_UV_LDO6_EINT 0x0020 /* UV_LDO6_EINT */
295#define WM831X_UV_LDO6_EINT_MASK 0x0020 /* UV_LDO6_EINT */
296#define WM831X_UV_LDO6_EINT_SHIFT 5 /* UV_LDO6_EINT */
297#define WM831X_UV_LDO6_EINT_WIDTH 1 /* UV_LDO6_EINT */
298#define WM831X_UV_LDO5_EINT 0x0010 /* UV_LDO5_EINT */
299#define WM831X_UV_LDO5_EINT_MASK 0x0010 /* UV_LDO5_EINT */
300#define WM831X_UV_LDO5_EINT_SHIFT 4 /* UV_LDO5_EINT */
301#define WM831X_UV_LDO5_EINT_WIDTH 1 /* UV_LDO5_EINT */
302#define WM831X_UV_LDO4_EINT 0x0008 /* UV_LDO4_EINT */
303#define WM831X_UV_LDO4_EINT_MASK 0x0008 /* UV_LDO4_EINT */
304#define WM831X_UV_LDO4_EINT_SHIFT 3 /* UV_LDO4_EINT */
305#define WM831X_UV_LDO4_EINT_WIDTH 1 /* UV_LDO4_EINT */
306#define WM831X_UV_LDO3_EINT 0x0004 /* UV_LDO3_EINT */
307#define WM831X_UV_LDO3_EINT_MASK 0x0004 /* UV_LDO3_EINT */
308#define WM831X_UV_LDO3_EINT_SHIFT 2 /* UV_LDO3_EINT */
309#define WM831X_UV_LDO3_EINT_WIDTH 1 /* UV_LDO3_EINT */
310#define WM831X_UV_LDO2_EINT 0x0002 /* UV_LDO2_EINT */
311#define WM831X_UV_LDO2_EINT_MASK 0x0002 /* UV_LDO2_EINT */
312#define WM831X_UV_LDO2_EINT_SHIFT 1 /* UV_LDO2_EINT */
313#define WM831X_UV_LDO2_EINT_WIDTH 1 /* UV_LDO2_EINT */
314#define WM831X_UV_LDO1_EINT 0x0001 /* UV_LDO1_EINT */
315#define WM831X_UV_LDO1_EINT_MASK 0x0001 /* UV_LDO1_EINT */
316#define WM831X_UV_LDO1_EINT_SHIFT 0 /* UV_LDO1_EINT */
317#define WM831X_UV_LDO1_EINT_WIDTH 1 /* UV_LDO1_EINT */
318
319/*
320 * R16404 (0x4014) - Interrupt Status 4
321 */
322#define WM831X_HC_DC2_EINT 0x0200 /* HC_DC2_EINT */
323#define WM831X_HC_DC2_EINT_MASK 0x0200 /* HC_DC2_EINT */
324#define WM831X_HC_DC2_EINT_SHIFT 9 /* HC_DC2_EINT */
325#define WM831X_HC_DC2_EINT_WIDTH 1 /* HC_DC2_EINT */
326#define WM831X_HC_DC1_EINT 0x0100 /* HC_DC1_EINT */
327#define WM831X_HC_DC1_EINT_MASK 0x0100 /* HC_DC1_EINT */
328#define WM831X_HC_DC1_EINT_SHIFT 8 /* HC_DC1_EINT */
329#define WM831X_HC_DC1_EINT_WIDTH 1 /* HC_DC1_EINT */
330#define WM831X_UV_DC4_EINT 0x0008 /* UV_DC4_EINT */
331#define WM831X_UV_DC4_EINT_MASK 0x0008 /* UV_DC4_EINT */
332#define WM831X_UV_DC4_EINT_SHIFT 3 /* UV_DC4_EINT */
333#define WM831X_UV_DC4_EINT_WIDTH 1 /* UV_DC4_EINT */
334#define WM831X_UV_DC3_EINT 0x0004 /* UV_DC3_EINT */
335#define WM831X_UV_DC3_EINT_MASK 0x0004 /* UV_DC3_EINT */
336#define WM831X_UV_DC3_EINT_SHIFT 2 /* UV_DC3_EINT */
337#define WM831X_UV_DC3_EINT_WIDTH 1 /* UV_DC3_EINT */
338#define WM831X_UV_DC2_EINT 0x0002 /* UV_DC2_EINT */
339#define WM831X_UV_DC2_EINT_MASK 0x0002 /* UV_DC2_EINT */
340#define WM831X_UV_DC2_EINT_SHIFT 1 /* UV_DC2_EINT */
341#define WM831X_UV_DC2_EINT_WIDTH 1 /* UV_DC2_EINT */
342#define WM831X_UV_DC1_EINT 0x0001 /* UV_DC1_EINT */
343#define WM831X_UV_DC1_EINT_MASK 0x0001 /* UV_DC1_EINT */
344#define WM831X_UV_DC1_EINT_SHIFT 0 /* UV_DC1_EINT */
345#define WM831X_UV_DC1_EINT_WIDTH 1 /* UV_DC1_EINT */
346
347/*
348 * R16405 (0x4015) - Interrupt Status 5
349 */
350#define WM831X_GP16_EINT 0x8000 /* GP16_EINT */
351#define WM831X_GP16_EINT_MASK 0x8000 /* GP16_EINT */
352#define WM831X_GP16_EINT_SHIFT 15 /* GP16_EINT */
353#define WM831X_GP16_EINT_WIDTH 1 /* GP16_EINT */
354#define WM831X_GP15_EINT 0x4000 /* GP15_EINT */
355#define WM831X_GP15_EINT_MASK 0x4000 /* GP15_EINT */
356#define WM831X_GP15_EINT_SHIFT 14 /* GP15_EINT */
357#define WM831X_GP15_EINT_WIDTH 1 /* GP15_EINT */
358#define WM831X_GP14_EINT 0x2000 /* GP14_EINT */
359#define WM831X_GP14_EINT_MASK 0x2000 /* GP14_EINT */
360#define WM831X_GP14_EINT_SHIFT 13 /* GP14_EINT */
361#define WM831X_GP14_EINT_WIDTH 1 /* GP14_EINT */
362#define WM831X_GP13_EINT 0x1000 /* GP13_EINT */
363#define WM831X_GP13_EINT_MASK 0x1000 /* GP13_EINT */
364#define WM831X_GP13_EINT_SHIFT 12 /* GP13_EINT */
365#define WM831X_GP13_EINT_WIDTH 1 /* GP13_EINT */
366#define WM831X_GP12_EINT 0x0800 /* GP12_EINT */
367#define WM831X_GP12_EINT_MASK 0x0800 /* GP12_EINT */
368#define WM831X_GP12_EINT_SHIFT 11 /* GP12_EINT */
369#define WM831X_GP12_EINT_WIDTH 1 /* GP12_EINT */
370#define WM831X_GP11_EINT 0x0400 /* GP11_EINT */
371#define WM831X_GP11_EINT_MASK 0x0400 /* GP11_EINT */
372#define WM831X_GP11_EINT_SHIFT 10 /* GP11_EINT */
373#define WM831X_GP11_EINT_WIDTH 1 /* GP11_EINT */
374#define WM831X_GP10_EINT 0x0200 /* GP10_EINT */
375#define WM831X_GP10_EINT_MASK 0x0200 /* GP10_EINT */
376#define WM831X_GP10_EINT_SHIFT 9 /* GP10_EINT */
377#define WM831X_GP10_EINT_WIDTH 1 /* GP10_EINT */
378#define WM831X_GP9_EINT 0x0100 /* GP9_EINT */
379#define WM831X_GP9_EINT_MASK 0x0100 /* GP9_EINT */
380#define WM831X_GP9_EINT_SHIFT 8 /* GP9_EINT */
381#define WM831X_GP9_EINT_WIDTH 1 /* GP9_EINT */
382#define WM831X_GP8_EINT 0x0080 /* GP8_EINT */
383#define WM831X_GP8_EINT_MASK 0x0080 /* GP8_EINT */
384#define WM831X_GP8_EINT_SHIFT 7 /* GP8_EINT */
385#define WM831X_GP8_EINT_WIDTH 1 /* GP8_EINT */
386#define WM831X_GP7_EINT 0x0040 /* GP7_EINT */
387#define WM831X_GP7_EINT_MASK 0x0040 /* GP7_EINT */
388#define WM831X_GP7_EINT_SHIFT 6 /* GP7_EINT */
389#define WM831X_GP7_EINT_WIDTH 1 /* GP7_EINT */
390#define WM831X_GP6_EINT 0x0020 /* GP6_EINT */
391#define WM831X_GP6_EINT_MASK 0x0020 /* GP6_EINT */
392#define WM831X_GP6_EINT_SHIFT 5 /* GP6_EINT */
393#define WM831X_GP6_EINT_WIDTH 1 /* GP6_EINT */
394#define WM831X_GP5_EINT 0x0010 /* GP5_EINT */
395#define WM831X_GP5_EINT_MASK 0x0010 /* GP5_EINT */
396#define WM831X_GP5_EINT_SHIFT 4 /* GP5_EINT */
397#define WM831X_GP5_EINT_WIDTH 1 /* GP5_EINT */
398#define WM831X_GP4_EINT 0x0008 /* GP4_EINT */
399#define WM831X_GP4_EINT_MASK 0x0008 /* GP4_EINT */
400#define WM831X_GP4_EINT_SHIFT 3 /* GP4_EINT */
401#define WM831X_GP4_EINT_WIDTH 1 /* GP4_EINT */
402#define WM831X_GP3_EINT 0x0004 /* GP3_EINT */
403#define WM831X_GP3_EINT_MASK 0x0004 /* GP3_EINT */
404#define WM831X_GP3_EINT_SHIFT 2 /* GP3_EINT */
405#define WM831X_GP3_EINT_WIDTH 1 /* GP3_EINT */
406#define WM831X_GP2_EINT 0x0002 /* GP2_EINT */
407#define WM831X_GP2_EINT_MASK 0x0002 /* GP2_EINT */
408#define WM831X_GP2_EINT_SHIFT 1 /* GP2_EINT */
409#define WM831X_GP2_EINT_WIDTH 1 /* GP2_EINT */
410#define WM831X_GP1_EINT 0x0001 /* GP1_EINT */
411#define WM831X_GP1_EINT_MASK 0x0001 /* GP1_EINT */
412#define WM831X_GP1_EINT_SHIFT 0 /* GP1_EINT */
413#define WM831X_GP1_EINT_WIDTH 1 /* GP1_EINT */
414
415/*
416 * R16407 (0x4017) - IRQ Config
417 */
418#define WM831X_IRQ_OD 0x0002 /* IRQ_OD */
419#define WM831X_IRQ_OD_MASK 0x0002 /* IRQ_OD */
420#define WM831X_IRQ_OD_SHIFT 1 /* IRQ_OD */
421#define WM831X_IRQ_OD_WIDTH 1 /* IRQ_OD */
422#define WM831X_IM_IRQ 0x0001 /* IM_IRQ */
423#define WM831X_IM_IRQ_MASK 0x0001 /* IM_IRQ */
424#define WM831X_IM_IRQ_SHIFT 0 /* IM_IRQ */
425#define WM831X_IM_IRQ_WIDTH 1 /* IM_IRQ */
426
427/*
428 * R16408 (0x4018) - System Interrupts Mask
429 */
430#define WM831X_IM_PS_INT 0x8000 /* IM_PS_INT */
431#define WM831X_IM_PS_INT_MASK 0x8000 /* IM_PS_INT */
432#define WM831X_IM_PS_INT_SHIFT 15 /* IM_PS_INT */
433#define WM831X_IM_PS_INT_WIDTH 1 /* IM_PS_INT */
434#define WM831X_IM_TEMP_INT 0x4000 /* IM_TEMP_INT */
435#define WM831X_IM_TEMP_INT_MASK 0x4000 /* IM_TEMP_INT */
436#define WM831X_IM_TEMP_INT_SHIFT 14 /* IM_TEMP_INT */
437#define WM831X_IM_TEMP_INT_WIDTH 1 /* IM_TEMP_INT */
438#define WM831X_IM_GP_INT 0x2000 /* IM_GP_INT */
439#define WM831X_IM_GP_INT_MASK 0x2000 /* IM_GP_INT */
440#define WM831X_IM_GP_INT_SHIFT 13 /* IM_GP_INT */
441#define WM831X_IM_GP_INT_WIDTH 1 /* IM_GP_INT */
442#define WM831X_IM_ON_PIN_INT 0x1000 /* IM_ON_PIN_INT */
443#define WM831X_IM_ON_PIN_INT_MASK 0x1000 /* IM_ON_PIN_INT */
444#define WM831X_IM_ON_PIN_INT_SHIFT 12 /* IM_ON_PIN_INT */
445#define WM831X_IM_ON_PIN_INT_WIDTH 1 /* IM_ON_PIN_INT */
446#define WM831X_IM_WDOG_INT 0x0800 /* IM_WDOG_INT */
447#define WM831X_IM_WDOG_INT_MASK 0x0800 /* IM_WDOG_INT */
448#define WM831X_IM_WDOG_INT_SHIFT 11 /* IM_WDOG_INT */
449#define WM831X_IM_WDOG_INT_WIDTH 1 /* IM_WDOG_INT */
450#define WM831X_IM_TCHDATA_INT 0x0400 /* IM_TCHDATA_INT */
451#define WM831X_IM_TCHDATA_INT_MASK 0x0400 /* IM_TCHDATA_INT */
452#define WM831X_IM_TCHDATA_INT_SHIFT 10 /* IM_TCHDATA_INT */
453#define WM831X_IM_TCHDATA_INT_WIDTH 1 /* IM_TCHDATA_INT */
454#define WM831X_IM_TCHPD_INT 0x0200 /* IM_TCHPD_INT */
455#define WM831X_IM_TCHPD_INT_MASK 0x0200 /* IM_TCHPD_INT */
456#define WM831X_IM_TCHPD_INT_SHIFT 9 /* IM_TCHPD_INT */
457#define WM831X_IM_TCHPD_INT_WIDTH 1 /* IM_TCHPD_INT */
458#define WM831X_IM_AUXADC_INT 0x0100 /* IM_AUXADC_INT */
459#define WM831X_IM_AUXADC_INT_MASK 0x0100 /* IM_AUXADC_INT */
460#define WM831X_IM_AUXADC_INT_SHIFT 8 /* IM_AUXADC_INT */
461#define WM831X_IM_AUXADC_INT_WIDTH 1 /* IM_AUXADC_INT */
462#define WM831X_IM_PPM_INT 0x0080 /* IM_PPM_INT */
463#define WM831X_IM_PPM_INT_MASK 0x0080 /* IM_PPM_INT */
464#define WM831X_IM_PPM_INT_SHIFT 7 /* IM_PPM_INT */
465#define WM831X_IM_PPM_INT_WIDTH 1 /* IM_PPM_INT */
466#define WM831X_IM_CS_INT 0x0040 /* IM_CS_INT */
467#define WM831X_IM_CS_INT_MASK 0x0040 /* IM_CS_INT */
468#define WM831X_IM_CS_INT_SHIFT 6 /* IM_CS_INT */
469#define WM831X_IM_CS_INT_WIDTH 1 /* IM_CS_INT */
470#define WM831X_IM_RTC_INT 0x0020 /* IM_RTC_INT */
471#define WM831X_IM_RTC_INT_MASK 0x0020 /* IM_RTC_INT */
472#define WM831X_IM_RTC_INT_SHIFT 5 /* IM_RTC_INT */
473#define WM831X_IM_RTC_INT_WIDTH 1 /* IM_RTC_INT */
474#define WM831X_IM_OTP_INT 0x0010 /* IM_OTP_INT */
475#define WM831X_IM_OTP_INT_MASK 0x0010 /* IM_OTP_INT */
476#define WM831X_IM_OTP_INT_SHIFT 4 /* IM_OTP_INT */
477#define WM831X_IM_OTP_INT_WIDTH 1 /* IM_OTP_INT */
478#define WM831X_IM_CHILD_INT 0x0008 /* IM_CHILD_INT */
479#define WM831X_IM_CHILD_INT_MASK 0x0008 /* IM_CHILD_INT */
480#define WM831X_IM_CHILD_INT_SHIFT 3 /* IM_CHILD_INT */
481#define WM831X_IM_CHILD_INT_WIDTH 1 /* IM_CHILD_INT */
482#define WM831X_IM_CHG_INT 0x0004 /* IM_CHG_INT */
483#define WM831X_IM_CHG_INT_MASK 0x0004 /* IM_CHG_INT */
484#define WM831X_IM_CHG_INT_SHIFT 2 /* IM_CHG_INT */
485#define WM831X_IM_CHG_INT_WIDTH 1 /* IM_CHG_INT */
486#define WM831X_IM_HC_INT 0x0002 /* IM_HC_INT */
487#define WM831X_IM_HC_INT_MASK 0x0002 /* IM_HC_INT */
488#define WM831X_IM_HC_INT_SHIFT 1 /* IM_HC_INT */
489#define WM831X_IM_HC_INT_WIDTH 1 /* IM_HC_INT */
490#define WM831X_IM_UV_INT 0x0001 /* IM_UV_INT */
491#define WM831X_IM_UV_INT_MASK 0x0001 /* IM_UV_INT */
492#define WM831X_IM_UV_INT_SHIFT 0 /* IM_UV_INT */
493#define WM831X_IM_UV_INT_WIDTH 1 /* IM_UV_INT */
494
495/*
496 * R16409 (0x4019) - Interrupt Status 1 Mask
497 */
498#define WM831X_IM_PPM_SYSLO_EINT 0x8000 /* IM_PPM_SYSLO_EINT */
499#define WM831X_IM_PPM_SYSLO_EINT_MASK 0x8000 /* IM_PPM_SYSLO_EINT */
500#define WM831X_IM_PPM_SYSLO_EINT_SHIFT 15 /* IM_PPM_SYSLO_EINT */
501#define WM831X_IM_PPM_SYSLO_EINT_WIDTH 1 /* IM_PPM_SYSLO_EINT */
502#define WM831X_IM_PPM_PWR_SRC_EINT 0x4000 /* IM_PPM_PWR_SRC_EINT */
503#define WM831X_IM_PPM_PWR_SRC_EINT_MASK 0x4000 /* IM_PPM_PWR_SRC_EINT */
504#define WM831X_IM_PPM_PWR_SRC_EINT_SHIFT 14 /* IM_PPM_PWR_SRC_EINT */
505#define WM831X_IM_PPM_PWR_SRC_EINT_WIDTH 1 /* IM_PPM_PWR_SRC_EINT */
506#define WM831X_IM_PPM_USB_CURR_EINT 0x2000 /* IM_PPM_USB_CURR_EINT */
507#define WM831X_IM_PPM_USB_CURR_EINT_MASK 0x2000 /* IM_PPM_USB_CURR_EINT */
508#define WM831X_IM_PPM_USB_CURR_EINT_SHIFT 13 /* IM_PPM_USB_CURR_EINT */
509#define WM831X_IM_PPM_USB_CURR_EINT_WIDTH 1 /* IM_PPM_USB_CURR_EINT */
510#define WM831X_IM_ON_PIN_EINT 0x1000 /* IM_ON_PIN_EINT */
511#define WM831X_IM_ON_PIN_EINT_MASK 0x1000 /* IM_ON_PIN_EINT */
512#define WM831X_IM_ON_PIN_EINT_SHIFT 12 /* IM_ON_PIN_EINT */
513#define WM831X_IM_ON_PIN_EINT_WIDTH 1 /* IM_ON_PIN_EINT */
514#define WM831X_IM_WDOG_TO_EINT 0x0800 /* IM_WDOG_TO_EINT */
515#define WM831X_IM_WDOG_TO_EINT_MASK 0x0800 /* IM_WDOG_TO_EINT */
516#define WM831X_IM_WDOG_TO_EINT_SHIFT 11 /* IM_WDOG_TO_EINT */
517#define WM831X_IM_WDOG_TO_EINT_WIDTH 1 /* IM_WDOG_TO_EINT */
518#define WM831X_IM_TCHDATA_EINT 0x0400 /* IM_TCHDATA_EINT */
519#define WM831X_IM_TCHDATA_EINT_MASK 0x0400 /* IM_TCHDATA_EINT */
520#define WM831X_IM_TCHDATA_EINT_SHIFT 10 /* IM_TCHDATA_EINT */
521#define WM831X_IM_TCHDATA_EINT_WIDTH 1 /* IM_TCHDATA_EINT */
522#define WM831X_IM_TCHPD_EINT 0x0200 /* IM_TCHPD_EINT */
523#define WM831X_IM_TCHPD_EINT_MASK 0x0200 /* IM_TCHPD_EINT */
524#define WM831X_IM_TCHPD_EINT_SHIFT 9 /* IM_TCHPD_EINT */
525#define WM831X_IM_TCHPD_EINT_WIDTH 1 /* IM_TCHPD_EINT */
526#define WM831X_IM_AUXADC_DATA_EINT 0x0100 /* IM_AUXADC_DATA_EINT */
527#define WM831X_IM_AUXADC_DATA_EINT_MASK 0x0100 /* IM_AUXADC_DATA_EINT */
528#define WM831X_IM_AUXADC_DATA_EINT_SHIFT 8 /* IM_AUXADC_DATA_EINT */
529#define WM831X_IM_AUXADC_DATA_EINT_WIDTH 1 /* IM_AUXADC_DATA_EINT */
530#define WM831X_IM_AUXADC_DCOMP4_EINT 0x0080 /* IM_AUXADC_DCOMP4_EINT */
531#define WM831X_IM_AUXADC_DCOMP4_EINT_MASK 0x0080 /* IM_AUXADC_DCOMP4_EINT */
532#define WM831X_IM_AUXADC_DCOMP4_EINT_SHIFT 7 /* IM_AUXADC_DCOMP4_EINT */
533#define WM831X_IM_AUXADC_DCOMP4_EINT_WIDTH 1 /* IM_AUXADC_DCOMP4_EINT */
534#define WM831X_IM_AUXADC_DCOMP3_EINT 0x0040 /* IM_AUXADC_DCOMP3_EINT */
535#define WM831X_IM_AUXADC_DCOMP3_EINT_MASK 0x0040 /* IM_AUXADC_DCOMP3_EINT */
536#define WM831X_IM_AUXADC_DCOMP3_EINT_SHIFT 6 /* IM_AUXADC_DCOMP3_EINT */
537#define WM831X_IM_AUXADC_DCOMP3_EINT_WIDTH 1 /* IM_AUXADC_DCOMP3_EINT */
538#define WM831X_IM_AUXADC_DCOMP2_EINT 0x0020 /* IM_AUXADC_DCOMP2_EINT */
539#define WM831X_IM_AUXADC_DCOMP2_EINT_MASK 0x0020 /* IM_AUXADC_DCOMP2_EINT */
540#define WM831X_IM_AUXADC_DCOMP2_EINT_SHIFT 5 /* IM_AUXADC_DCOMP2_EINT */
541#define WM831X_IM_AUXADC_DCOMP2_EINT_WIDTH 1 /* IM_AUXADC_DCOMP2_EINT */
542#define WM831X_IM_AUXADC_DCOMP1_EINT 0x0010 /* IM_AUXADC_DCOMP1_EINT */
543#define WM831X_IM_AUXADC_DCOMP1_EINT_MASK 0x0010 /* IM_AUXADC_DCOMP1_EINT */
544#define WM831X_IM_AUXADC_DCOMP1_EINT_SHIFT 4 /* IM_AUXADC_DCOMP1_EINT */
545#define WM831X_IM_AUXADC_DCOMP1_EINT_WIDTH 1 /* IM_AUXADC_DCOMP1_EINT */
546#define WM831X_IM_RTC_PER_EINT 0x0008 /* IM_RTC_PER_EINT */
547#define WM831X_IM_RTC_PER_EINT_MASK 0x0008 /* IM_RTC_PER_EINT */
548#define WM831X_IM_RTC_PER_EINT_SHIFT 3 /* IM_RTC_PER_EINT */
549#define WM831X_IM_RTC_PER_EINT_WIDTH 1 /* IM_RTC_PER_EINT */
550#define WM831X_IM_RTC_ALM_EINT 0x0004 /* IM_RTC_ALM_EINT */
551#define WM831X_IM_RTC_ALM_EINT_MASK 0x0004 /* IM_RTC_ALM_EINT */
552#define WM831X_IM_RTC_ALM_EINT_SHIFT 2 /* IM_RTC_ALM_EINT */
553#define WM831X_IM_RTC_ALM_EINT_WIDTH 1 /* IM_RTC_ALM_EINT */
554#define WM831X_IM_TEMP_THW_EINT 0x0002 /* IM_TEMP_THW_EINT */
555#define WM831X_IM_TEMP_THW_EINT_MASK 0x0002 /* IM_TEMP_THW_EINT */
556#define WM831X_IM_TEMP_THW_EINT_SHIFT 1 /* IM_TEMP_THW_EINT */
557#define WM831X_IM_TEMP_THW_EINT_WIDTH 1 /* IM_TEMP_THW_EINT */
558
559/*
560 * R16410 (0x401A) - Interrupt Status 2 Mask
561 */
562#define WM831X_IM_CHG_BATT_HOT_EINT 0x8000 /* IM_CHG_BATT_HOT_EINT */
563#define WM831X_IM_CHG_BATT_HOT_EINT_MASK 0x8000 /* IM_CHG_BATT_HOT_EINT */
564#define WM831X_IM_CHG_BATT_HOT_EINT_SHIFT 15 /* IM_CHG_BATT_HOT_EINT */
565#define WM831X_IM_CHG_BATT_HOT_EINT_WIDTH 1 /* IM_CHG_BATT_HOT_EINT */
566#define WM831X_IM_CHG_BATT_COLD_EINT 0x4000 /* IM_CHG_BATT_COLD_EINT */
567#define WM831X_IM_CHG_BATT_COLD_EINT_MASK 0x4000 /* IM_CHG_BATT_COLD_EINT */
568#define WM831X_IM_CHG_BATT_COLD_EINT_SHIFT 14 /* IM_CHG_BATT_COLD_EINT */
569#define WM831X_IM_CHG_BATT_COLD_EINT_WIDTH 1 /* IM_CHG_BATT_COLD_EINT */
570#define WM831X_IM_CHG_BATT_FAIL_EINT 0x2000 /* IM_CHG_BATT_FAIL_EINT */
571#define WM831X_IM_CHG_BATT_FAIL_EINT_MASK 0x2000 /* IM_CHG_BATT_FAIL_EINT */
572#define WM831X_IM_CHG_BATT_FAIL_EINT_SHIFT 13 /* IM_CHG_BATT_FAIL_EINT */
573#define WM831X_IM_CHG_BATT_FAIL_EINT_WIDTH 1 /* IM_CHG_BATT_FAIL_EINT */
574#define WM831X_IM_CHG_OV_EINT 0x1000 /* IM_CHG_OV_EINT */
575#define WM831X_IM_CHG_OV_EINT_MASK 0x1000 /* IM_CHG_OV_EINT */
576#define WM831X_IM_CHG_OV_EINT_SHIFT 12 /* IM_CHG_OV_EINT */
577#define WM831X_IM_CHG_OV_EINT_WIDTH 1 /* IM_CHG_OV_EINT */
578#define WM831X_IM_CHG_END_EINT 0x0800 /* IM_CHG_END_EINT */
579#define WM831X_IM_CHG_END_EINT_MASK 0x0800 /* IM_CHG_END_EINT */
580#define WM831X_IM_CHG_END_EINT_SHIFT 11 /* IM_CHG_END_EINT */
581#define WM831X_IM_CHG_END_EINT_WIDTH 1 /* IM_CHG_END_EINT */
582#define WM831X_IM_CHG_TO_EINT 0x0400 /* IM_CHG_TO_EINT */
583#define WM831X_IM_CHG_TO_EINT_MASK 0x0400 /* IM_CHG_TO_EINT */
584#define WM831X_IM_CHG_TO_EINT_SHIFT 10 /* IM_CHG_TO_EINT */
585#define WM831X_IM_CHG_TO_EINT_WIDTH 1 /* IM_CHG_TO_EINT */
586#define WM831X_IM_CHG_MODE_EINT 0x0200 /* IM_CHG_MODE_EINT */
587#define WM831X_IM_CHG_MODE_EINT_MASK 0x0200 /* IM_CHG_MODE_EINT */
588#define WM831X_IM_CHG_MODE_EINT_SHIFT 9 /* IM_CHG_MODE_EINT */
589#define WM831X_IM_CHG_MODE_EINT_WIDTH 1 /* IM_CHG_MODE_EINT */
590#define WM831X_IM_CHG_START_EINT 0x0100 /* IM_CHG_START_EINT */
591#define WM831X_IM_CHG_START_EINT_MASK 0x0100 /* IM_CHG_START_EINT */
592#define WM831X_IM_CHG_START_EINT_SHIFT 8 /* IM_CHG_START_EINT */
593#define WM831X_IM_CHG_START_EINT_WIDTH 1 /* IM_CHG_START_EINT */
594#define WM831X_IM_CS2_EINT 0x0080 /* IM_CS2_EINT */
595#define WM831X_IM_CS2_EINT_MASK 0x0080 /* IM_CS2_EINT */
596#define WM831X_IM_CS2_EINT_SHIFT 7 /* IM_CS2_EINT */
597#define WM831X_IM_CS2_EINT_WIDTH 1 /* IM_CS2_EINT */
598#define WM831X_IM_CS1_EINT 0x0040 /* IM_CS1_EINT */
599#define WM831X_IM_CS1_EINT_MASK 0x0040 /* IM_CS1_EINT */
600#define WM831X_IM_CS1_EINT_SHIFT 6 /* IM_CS1_EINT */
601#define WM831X_IM_CS1_EINT_WIDTH 1 /* IM_CS1_EINT */
602#define WM831X_IM_OTP_CMD_END_EINT 0x0020 /* IM_OTP_CMD_END_EINT */
603#define WM831X_IM_OTP_CMD_END_EINT_MASK 0x0020 /* IM_OTP_CMD_END_EINT */
604#define WM831X_IM_OTP_CMD_END_EINT_SHIFT 5 /* IM_OTP_CMD_END_EINT */
605#define WM831X_IM_OTP_CMD_END_EINT_WIDTH 1 /* IM_OTP_CMD_END_EINT */
606#define WM831X_IM_OTP_ERR_EINT 0x0010 /* IM_OTP_ERR_EINT */
607#define WM831X_IM_OTP_ERR_EINT_MASK 0x0010 /* IM_OTP_ERR_EINT */
608#define WM831X_IM_OTP_ERR_EINT_SHIFT 4 /* IM_OTP_ERR_EINT */
609#define WM831X_IM_OTP_ERR_EINT_WIDTH 1 /* IM_OTP_ERR_EINT */
610#define WM831X_IM_PS_POR_EINT 0x0004 /* IM_PS_POR_EINT */
611#define WM831X_IM_PS_POR_EINT_MASK 0x0004 /* IM_PS_POR_EINT */
612#define WM831X_IM_PS_POR_EINT_SHIFT 2 /* IM_PS_POR_EINT */
613#define WM831X_IM_PS_POR_EINT_WIDTH 1 /* IM_PS_POR_EINT */
614#define WM831X_IM_PS_SLEEP_OFF_EINT 0x0002 /* IM_PS_SLEEP_OFF_EINT */
615#define WM831X_IM_PS_SLEEP_OFF_EINT_MASK 0x0002 /* IM_PS_SLEEP_OFF_EINT */
616#define WM831X_IM_PS_SLEEP_OFF_EINT_SHIFT 1 /* IM_PS_SLEEP_OFF_EINT */
617#define WM831X_IM_PS_SLEEP_OFF_EINT_WIDTH 1 /* IM_PS_SLEEP_OFF_EINT */
618#define WM831X_IM_PS_ON_WAKE_EINT 0x0001 /* IM_PS_ON_WAKE_EINT */
619#define WM831X_IM_PS_ON_WAKE_EINT_MASK 0x0001 /* IM_PS_ON_WAKE_EINT */
620#define WM831X_IM_PS_ON_WAKE_EINT_SHIFT 0 /* IM_PS_ON_WAKE_EINT */
621#define WM831X_IM_PS_ON_WAKE_EINT_WIDTH 1 /* IM_PS_ON_WAKE_EINT */
622
623/*
624 * R16411 (0x401B) - Interrupt Status 3 Mask
625 */
626#define WM831X_IM_UV_LDO10_EINT 0x0200 /* IM_UV_LDO10_EINT */
627#define WM831X_IM_UV_LDO10_EINT_MASK 0x0200 /* IM_UV_LDO10_EINT */
628#define WM831X_IM_UV_LDO10_EINT_SHIFT 9 /* IM_UV_LDO10_EINT */
629#define WM831X_IM_UV_LDO10_EINT_WIDTH 1 /* IM_UV_LDO10_EINT */
630#define WM831X_IM_UV_LDO9_EINT 0x0100 /* IM_UV_LDO9_EINT */
631#define WM831X_IM_UV_LDO9_EINT_MASK 0x0100 /* IM_UV_LDO9_EINT */
632#define WM831X_IM_UV_LDO9_EINT_SHIFT 8 /* IM_UV_LDO9_EINT */
633#define WM831X_IM_UV_LDO9_EINT_WIDTH 1 /* IM_UV_LDO9_EINT */
634#define WM831X_IM_UV_LDO8_EINT 0x0080 /* IM_UV_LDO8_EINT */
635#define WM831X_IM_UV_LDO8_EINT_MASK 0x0080 /* IM_UV_LDO8_EINT */
636#define WM831X_IM_UV_LDO8_EINT_SHIFT 7 /* IM_UV_LDO8_EINT */
637#define WM831X_IM_UV_LDO8_EINT_WIDTH 1 /* IM_UV_LDO8_EINT */
638#define WM831X_IM_UV_LDO7_EINT 0x0040 /* IM_UV_LDO7_EINT */
639#define WM831X_IM_UV_LDO7_EINT_MASK 0x0040 /* IM_UV_LDO7_EINT */
640#define WM831X_IM_UV_LDO7_EINT_SHIFT 6 /* IM_UV_LDO7_EINT */
641#define WM831X_IM_UV_LDO7_EINT_WIDTH 1 /* IM_UV_LDO7_EINT */
642#define WM831X_IM_UV_LDO6_EINT 0x0020 /* IM_UV_LDO6_EINT */
643#define WM831X_IM_UV_LDO6_EINT_MASK 0x0020 /* IM_UV_LDO6_EINT */
644#define WM831X_IM_UV_LDO6_EINT_SHIFT 5 /* IM_UV_LDO6_EINT */
645#define WM831X_IM_UV_LDO6_EINT_WIDTH 1 /* IM_UV_LDO6_EINT */
646#define WM831X_IM_UV_LDO5_EINT 0x0010 /* IM_UV_LDO5_EINT */
647#define WM831X_IM_UV_LDO5_EINT_MASK 0x0010 /* IM_UV_LDO5_EINT */
648#define WM831X_IM_UV_LDO5_EINT_SHIFT 4 /* IM_UV_LDO5_EINT */
649#define WM831X_IM_UV_LDO5_EINT_WIDTH 1 /* IM_UV_LDO5_EINT */
650#define WM831X_IM_UV_LDO4_EINT 0x0008 /* IM_UV_LDO4_EINT */
651#define WM831X_IM_UV_LDO4_EINT_MASK 0x0008 /* IM_UV_LDO4_EINT */
652#define WM831X_IM_UV_LDO4_EINT_SHIFT 3 /* IM_UV_LDO4_EINT */
653#define WM831X_IM_UV_LDO4_EINT_WIDTH 1 /* IM_UV_LDO4_EINT */
654#define WM831X_IM_UV_LDO3_EINT 0x0004 /* IM_UV_LDO3_EINT */
655#define WM831X_IM_UV_LDO3_EINT_MASK 0x0004 /* IM_UV_LDO3_EINT */
656#define WM831X_IM_UV_LDO3_EINT_SHIFT 2 /* IM_UV_LDO3_EINT */
657#define WM831X_IM_UV_LDO3_EINT_WIDTH 1 /* IM_UV_LDO3_EINT */
658#define WM831X_IM_UV_LDO2_EINT 0x0002 /* IM_UV_LDO2_EINT */
659#define WM831X_IM_UV_LDO2_EINT_MASK 0x0002 /* IM_UV_LDO2_EINT */
660#define WM831X_IM_UV_LDO2_EINT_SHIFT 1 /* IM_UV_LDO2_EINT */
661#define WM831X_IM_UV_LDO2_EINT_WIDTH 1 /* IM_UV_LDO2_EINT */
662#define WM831X_IM_UV_LDO1_EINT 0x0001 /* IM_UV_LDO1_EINT */
663#define WM831X_IM_UV_LDO1_EINT_MASK 0x0001 /* IM_UV_LDO1_EINT */
664#define WM831X_IM_UV_LDO1_EINT_SHIFT 0 /* IM_UV_LDO1_EINT */
665#define WM831X_IM_UV_LDO1_EINT_WIDTH 1 /* IM_UV_LDO1_EINT */
666
667/*
668 * R16412 (0x401C) - Interrupt Status 4 Mask
669 */
670#define WM831X_IM_HC_DC2_EINT 0x0200 /* IM_HC_DC2_EINT */
671#define WM831X_IM_HC_DC2_EINT_MASK 0x0200 /* IM_HC_DC2_EINT */
672#define WM831X_IM_HC_DC2_EINT_SHIFT 9 /* IM_HC_DC2_EINT */
673#define WM831X_IM_HC_DC2_EINT_WIDTH 1 /* IM_HC_DC2_EINT */
674#define WM831X_IM_HC_DC1_EINT 0x0100 /* IM_HC_DC1_EINT */
675#define WM831X_IM_HC_DC1_EINT_MASK 0x0100 /* IM_HC_DC1_EINT */
676#define WM831X_IM_HC_DC1_EINT_SHIFT 8 /* IM_HC_DC1_EINT */
677#define WM831X_IM_HC_DC1_EINT_WIDTH 1 /* IM_HC_DC1_EINT */
678#define WM831X_IM_UV_DC4_EINT 0x0008 /* IM_UV_DC4_EINT */
679#define WM831X_IM_UV_DC4_EINT_MASK 0x0008 /* IM_UV_DC4_EINT */
680#define WM831X_IM_UV_DC4_EINT_SHIFT 3 /* IM_UV_DC4_EINT */
681#define WM831X_IM_UV_DC4_EINT_WIDTH 1 /* IM_UV_DC4_EINT */
682#define WM831X_IM_UV_DC3_EINT 0x0004 /* IM_UV_DC3_EINT */
683#define WM831X_IM_UV_DC3_EINT_MASK 0x0004 /* IM_UV_DC3_EINT */
684#define WM831X_IM_UV_DC3_EINT_SHIFT 2 /* IM_UV_DC3_EINT */
685#define WM831X_IM_UV_DC3_EINT_WIDTH 1 /* IM_UV_DC3_EINT */
686#define WM831X_IM_UV_DC2_EINT 0x0002 /* IM_UV_DC2_EINT */
687#define WM831X_IM_UV_DC2_EINT_MASK 0x0002 /* IM_UV_DC2_EINT */
688#define WM831X_IM_UV_DC2_EINT_SHIFT 1 /* IM_UV_DC2_EINT */
689#define WM831X_IM_UV_DC2_EINT_WIDTH 1 /* IM_UV_DC2_EINT */
690#define WM831X_IM_UV_DC1_EINT 0x0001 /* IM_UV_DC1_EINT */
691#define WM831X_IM_UV_DC1_EINT_MASK 0x0001 /* IM_UV_DC1_EINT */
692#define WM831X_IM_UV_DC1_EINT_SHIFT 0 /* IM_UV_DC1_EINT */
693#define WM831X_IM_UV_DC1_EINT_WIDTH 1 /* IM_UV_DC1_EINT */
694
695/*
696 * R16413 (0x401D) - Interrupt Status 5 Mask
697 */
698#define WM831X_IM_GP16_EINT 0x8000 /* IM_GP16_EINT */
699#define WM831X_IM_GP16_EINT_MASK 0x8000 /* IM_GP16_EINT */
700#define WM831X_IM_GP16_EINT_SHIFT 15 /* IM_GP16_EINT */
701#define WM831X_IM_GP16_EINT_WIDTH 1 /* IM_GP16_EINT */
702#define WM831X_IM_GP15_EINT 0x4000 /* IM_GP15_EINT */
703#define WM831X_IM_GP15_EINT_MASK 0x4000 /* IM_GP15_EINT */
704#define WM831X_IM_GP15_EINT_SHIFT 14 /* IM_GP15_EINT */
705#define WM831X_IM_GP15_EINT_WIDTH 1 /* IM_GP15_EINT */
706#define WM831X_IM_GP14_EINT 0x2000 /* IM_GP14_EINT */
707#define WM831X_IM_GP14_EINT_MASK 0x2000 /* IM_GP14_EINT */
708#define WM831X_IM_GP14_EINT_SHIFT 13 /* IM_GP14_EINT */
709#define WM831X_IM_GP14_EINT_WIDTH 1 /* IM_GP14_EINT */
710#define WM831X_IM_GP13_EINT 0x1000 /* IM_GP13_EINT */
711#define WM831X_IM_GP13_EINT_MASK 0x1000 /* IM_GP13_EINT */
712#define WM831X_IM_GP13_EINT_SHIFT 12 /* IM_GP13_EINT */
713#define WM831X_IM_GP13_EINT_WIDTH 1 /* IM_GP13_EINT */
714#define WM831X_IM_GP12_EINT 0x0800 /* IM_GP12_EINT */
715#define WM831X_IM_GP12_EINT_MASK 0x0800 /* IM_GP12_EINT */
716#define WM831X_IM_GP12_EINT_SHIFT 11 /* IM_GP12_EINT */
717#define WM831X_IM_GP12_EINT_WIDTH 1 /* IM_GP12_EINT */
718#define WM831X_IM_GP11_EINT 0x0400 /* IM_GP11_EINT */
719#define WM831X_IM_GP11_EINT_MASK 0x0400 /* IM_GP11_EINT */
720#define WM831X_IM_GP11_EINT_SHIFT 10 /* IM_GP11_EINT */
721#define WM831X_IM_GP11_EINT_WIDTH 1 /* IM_GP11_EINT */
722#define WM831X_IM_GP10_EINT 0x0200 /* IM_GP10_EINT */
723#define WM831X_IM_GP10_EINT_MASK 0x0200 /* IM_GP10_EINT */
724#define WM831X_IM_GP10_EINT_SHIFT 9 /* IM_GP10_EINT */
725#define WM831X_IM_GP10_EINT_WIDTH 1 /* IM_GP10_EINT */
726#define WM831X_IM_GP9_EINT 0x0100 /* IM_GP9_EINT */
727#define WM831X_IM_GP9_EINT_MASK 0x0100 /* IM_GP9_EINT */
728#define WM831X_IM_GP9_EINT_SHIFT 8 /* IM_GP9_EINT */
729#define WM831X_IM_GP9_EINT_WIDTH 1 /* IM_GP9_EINT */
730#define WM831X_IM_GP8_EINT 0x0080 /* IM_GP8_EINT */
731#define WM831X_IM_GP8_EINT_MASK 0x0080 /* IM_GP8_EINT */
732#define WM831X_IM_GP8_EINT_SHIFT 7 /* IM_GP8_EINT */
733#define WM831X_IM_GP8_EINT_WIDTH 1 /* IM_GP8_EINT */
734#define WM831X_IM_GP7_EINT 0x0040 /* IM_GP7_EINT */
735#define WM831X_IM_GP7_EINT_MASK 0x0040 /* IM_GP7_EINT */
736#define WM831X_IM_GP7_EINT_SHIFT 6 /* IM_GP7_EINT */
737#define WM831X_IM_GP7_EINT_WIDTH 1 /* IM_GP7_EINT */
738#define WM831X_IM_GP6_EINT 0x0020 /* IM_GP6_EINT */
739#define WM831X_IM_GP6_EINT_MASK 0x0020 /* IM_GP6_EINT */
740#define WM831X_IM_GP6_EINT_SHIFT 5 /* IM_GP6_EINT */
741#define WM831X_IM_GP6_EINT_WIDTH 1 /* IM_GP6_EINT */
742#define WM831X_IM_GP5_EINT 0x0010 /* IM_GP5_EINT */
743#define WM831X_IM_GP5_EINT_MASK 0x0010 /* IM_GP5_EINT */
744#define WM831X_IM_GP5_EINT_SHIFT 4 /* IM_GP5_EINT */
745#define WM831X_IM_GP5_EINT_WIDTH 1 /* IM_GP5_EINT */
746#define WM831X_IM_GP4_EINT 0x0008 /* IM_GP4_EINT */
747#define WM831X_IM_GP4_EINT_MASK 0x0008 /* IM_GP4_EINT */
748#define WM831X_IM_GP4_EINT_SHIFT 3 /* IM_GP4_EINT */
749#define WM831X_IM_GP4_EINT_WIDTH 1 /* IM_GP4_EINT */
750#define WM831X_IM_GP3_EINT 0x0004 /* IM_GP3_EINT */
751#define WM831X_IM_GP3_EINT_MASK 0x0004 /* IM_GP3_EINT */
752#define WM831X_IM_GP3_EINT_SHIFT 2 /* IM_GP3_EINT */
753#define WM831X_IM_GP3_EINT_WIDTH 1 /* IM_GP3_EINT */
754#define WM831X_IM_GP2_EINT 0x0002 /* IM_GP2_EINT */
755#define WM831X_IM_GP2_EINT_MASK 0x0002 /* IM_GP2_EINT */
756#define WM831X_IM_GP2_EINT_SHIFT 1 /* IM_GP2_EINT */
757#define WM831X_IM_GP2_EINT_WIDTH 1 /* IM_GP2_EINT */
758#define WM831X_IM_GP1_EINT 0x0001 /* IM_GP1_EINT */
759#define WM831X_IM_GP1_EINT_MASK 0x0001 /* IM_GP1_EINT */
760#define WM831X_IM_GP1_EINT_SHIFT 0 /* IM_GP1_EINT */
761#define WM831X_IM_GP1_EINT_WIDTH 1 /* IM_GP1_EINT */
762
763
764#endif
diff --git a/include/linux/mfd/wm831x/otp.h b/include/linux/mfd/wm831x/otp.h
new file mode 100644
index 000000000000..ce1f81a39bfc
--- /dev/null
+++ b/include/linux/mfd/wm831x/otp.h
@@ -0,0 +1,162 @@
1/*
2 * include/linux/mfd/wm831x/otp.h -- OTP interface for WM831x
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_WM831X_OTP_H__
16#define __MFD_WM831X_OTP_H__
17
18int wm831x_otp_init(struct wm831x *wm831x);
19void wm831x_otp_exit(struct wm831x *wm831x);
20
21/*
22 * R30720 (0x7800) - Unique ID 1
23 */
24#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
25#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
26#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
27
28/*
29 * R30721 (0x7801) - Unique ID 2
30 */
31#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
32#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
33#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
34
35/*
36 * R30722 (0x7802) - Unique ID 3
37 */
38#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
39#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
40#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
41
42/*
43 * R30723 (0x7803) - Unique ID 4
44 */
45#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
46#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
47#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
48
49/*
50 * R30724 (0x7804) - Unique ID 5
51 */
52#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
53#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
54#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
55
56/*
57 * R30725 (0x7805) - Unique ID 6
58 */
59#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
60#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
61#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
62
63/*
64 * R30726 (0x7806) - Unique ID 7
65 */
66#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
67#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
68#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
69
70/*
71 * R30727 (0x7807) - Unique ID 8
72 */
73#define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
74#define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
75#define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
76
77/*
78 * R30728 (0x7808) - Factory OTP ID
79 */
80#define WM831X_OTP_FACT_ID_MASK 0xFFFE /* OTP_FACT_ID - [15:1] */
81#define WM831X_OTP_FACT_ID_SHIFT 1 /* OTP_FACT_ID - [15:1] */
82#define WM831X_OTP_FACT_ID_WIDTH 15 /* OTP_FACT_ID - [15:1] */
83#define WM831X_OTP_FACT_FINAL 0x0001 /* OTP_FACT_FINAL */
84#define WM831X_OTP_FACT_FINAL_MASK 0x0001 /* OTP_FACT_FINAL */
85#define WM831X_OTP_FACT_FINAL_SHIFT 0 /* OTP_FACT_FINAL */
86#define WM831X_OTP_FACT_FINAL_WIDTH 1 /* OTP_FACT_FINAL */
87
88/*
89 * R30729 (0x7809) - Factory OTP 1
90 */
91#define WM831X_DC3_TRIM_MASK 0xF000 /* DC3_TRIM - [15:12] */
92#define WM831X_DC3_TRIM_SHIFT 12 /* DC3_TRIM - [15:12] */
93#define WM831X_DC3_TRIM_WIDTH 4 /* DC3_TRIM - [15:12] */
94#define WM831X_DC2_TRIM_MASK 0x0FC0 /* DC2_TRIM - [11:6] */
95#define WM831X_DC2_TRIM_SHIFT 6 /* DC2_TRIM - [11:6] */
96#define WM831X_DC2_TRIM_WIDTH 6 /* DC2_TRIM - [11:6] */
97#define WM831X_DC1_TRIM_MASK 0x003F /* DC1_TRIM - [5:0] */
98#define WM831X_DC1_TRIM_SHIFT 0 /* DC1_TRIM - [5:0] */
99#define WM831X_DC1_TRIM_WIDTH 6 /* DC1_TRIM - [5:0] */
100
101/*
102 * R30730 (0x780A) - Factory OTP 2
103 */
104#define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
105#define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
106#define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
107
108/*
109 * R30731 (0x780B) - Factory OTP 3
110 */
111#define WM831X_OSC_TRIM_MASK 0x0780 /* OSC_TRIM - [10:7] */
112#define WM831X_OSC_TRIM_SHIFT 7 /* OSC_TRIM - [10:7] */
113#define WM831X_OSC_TRIM_WIDTH 4 /* OSC_TRIM - [10:7] */
114#define WM831X_BG_TRIM_MASK 0x0078 /* BG_TRIM - [6:3] */
115#define WM831X_BG_TRIM_SHIFT 3 /* BG_TRIM - [6:3] */
116#define WM831X_BG_TRIM_WIDTH 4 /* BG_TRIM - [6:3] */
117#define WM831X_LPBG_TRIM_MASK 0x0007 /* LPBG_TRIM - [2:0] */
118#define WM831X_LPBG_TRIM_SHIFT 0 /* LPBG_TRIM - [2:0] */
119#define WM831X_LPBG_TRIM_WIDTH 3 /* LPBG_TRIM - [2:0] */
120
121/*
122 * R30732 (0x780C) - Factory OTP 4
123 */
124#define WM831X_CHILD_I2C_ADDR_MASK 0x00FE /* CHILD_I2C_ADDR - [7:1] */
125#define WM831X_CHILD_I2C_ADDR_SHIFT 1 /* CHILD_I2C_ADDR - [7:1] */
126#define WM831X_CHILD_I2C_ADDR_WIDTH 7 /* CHILD_I2C_ADDR - [7:1] */
127#define WM831X_CH_AW 0x0001 /* CH_AW */
128#define WM831X_CH_AW_MASK 0x0001 /* CH_AW */
129#define WM831X_CH_AW_SHIFT 0 /* CH_AW */
130#define WM831X_CH_AW_WIDTH 1 /* CH_AW */
131
132/*
133 * R30733 (0x780D) - Factory OTP 5
134 */
135#define WM831X_CHARGE_TRIM_MASK 0x003F /* CHARGE_TRIM - [5:0] */
136#define WM831X_CHARGE_TRIM_SHIFT 0 /* CHARGE_TRIM - [5:0] */
137#define WM831X_CHARGE_TRIM_WIDTH 6 /* CHARGE_TRIM - [5:0] */
138
139/*
140 * R30736 (0x7810) - Customer OTP ID
141 */
142#define WM831X_OTP_AUTO_PROG 0x8000 /* OTP_AUTO_PROG */
143#define WM831X_OTP_AUTO_PROG_MASK 0x8000 /* OTP_AUTO_PROG */
144#define WM831X_OTP_AUTO_PROG_SHIFT 15 /* OTP_AUTO_PROG */
145#define WM831X_OTP_AUTO_PROG_WIDTH 1 /* OTP_AUTO_PROG */
146#define WM831X_OTP_CUST_ID_MASK 0x7FFE /* OTP_CUST_ID - [14:1] */
147#define WM831X_OTP_CUST_ID_SHIFT 1 /* OTP_CUST_ID - [14:1] */
148#define WM831X_OTP_CUST_ID_WIDTH 14 /* OTP_CUST_ID - [14:1] */
149#define WM831X_OTP_CUST_FINAL 0x0001 /* OTP_CUST_FINAL */
150#define WM831X_OTP_CUST_FINAL_MASK 0x0001 /* OTP_CUST_FINAL */
151#define WM831X_OTP_CUST_FINAL_SHIFT 0 /* OTP_CUST_FINAL */
152#define WM831X_OTP_CUST_FINAL_WIDTH 1 /* OTP_CUST_FINAL */
153
154/*
155 * R30759 (0x7827) - DBE CHECK DATA
156 */
157#define WM831X_DBE_VALID_DATA_MASK 0xFFFF /* DBE_VALID_DATA - [15:0] */
158#define WM831X_DBE_VALID_DATA_SHIFT 0 /* DBE_VALID_DATA - [15:0] */
159#define WM831X_DBE_VALID_DATA_WIDTH 16 /* DBE_VALID_DATA - [15:0] */
160
161
162#endif
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
new file mode 100644
index 000000000000..90d820260aad
--- /dev/null
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -0,0 +1,113 @@
1/*
2 * include/linux/mfd/wm831x/pdata.h -- Platform data for WM831x
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_WM831X_PDATA_H__
16#define __MFD_WM831X_PDATA_H__
17
18struct wm831x;
19struct regulator_init_data;
20
21struct wm831x_backlight_pdata {
22 int isink; /** ISINK to use, 1 or 2 */
23 int max_uA; /** Maximum current to allow */
24};
25
26struct wm831x_backup_pdata {
27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */
30 int ilim; /** Current limit in microamps */
31};
32
33struct wm831x_battery_pdata {
34 int enable; /** Enable charging */
35 int fast_enable; /** Enable fast charging */
36 int off_mask; /** Mask OFF while charging */
37 int trickle_ilim; /** Trickle charge current limit, in mA */
38 int vsel; /** Target voltage, in mV */
39 int eoc_iterm; /** End of trickle charge current, in mA */
40 int fast_ilim; /** Fast charge current limit, in mA */
41 int timeout; /** Charge cycle timeout, in minutes */
42};
43
44/* Sources for status LED configuration. Values are register values
45 * plus 1 to allow for a zero default for preserve.
46 */
47enum wm831x_status_src {
48 WM831X_STATUS_PRESERVE = 0, /* Keep the current hardware setting */
49 WM831X_STATUS_OTP = 1,
50 WM831X_STATUS_POWER = 2,
51 WM831X_STATUS_CHARGER = 3,
52 WM831X_STATUS_MANUAL = 4,
53};
54
55struct wm831x_status_pdata {
56 enum wm831x_status_src default_src;
57 const char *name;
58 const char *default_trigger;
59};
60
61struct wm831x_touch_pdata {
62 int fivewire; /** 1 for five wire mode, 0 for 4 wire */
63 int isel; /** Current for pen down (uA) */
64 int rpu; /** Pen down sensitivity resistor divider */
65 int pressure; /** Report pressure (boolean) */
66 int data_irq; /** Touch data ready IRQ */
67};
68
69enum wm831x_watchdog_action {
70 WM831X_WDOG_NONE = 0,
71 WM831X_WDOG_INTERRUPT = 1,
72 WM831X_WDOG_RESET = 2,
73 WM831X_WDOG_WAKE = 3,
74};
75
76struct wm831x_watchdog_pdata {
77 enum wm831x_watchdog_action primary, secondary;
78 int update_gpio;
79 unsigned int software:1;
80};
81
82#define WM831X_MAX_STATUS 2
83#define WM831X_MAX_DCDC 4
84#define WM831X_MAX_EPE 2
85#define WM831X_MAX_LDO 11
86#define WM831X_MAX_ISINK 2
87
88struct wm831x_pdata {
89 /** Called before subdevices are set up */
90 int (*pre_init)(struct wm831x *wm831x);
91 /** Called after subdevices are set up */
92 int (*post_init)(struct wm831x *wm831x);
93
94 int gpio_base;
95 struct wm831x_backlight_pdata *backlight;
96 struct wm831x_backup_pdata *backup;
97 struct wm831x_battery_pdata *battery;
98 struct wm831x_touch_pdata *touch;
99 struct wm831x_watchdog_pdata *watchdog;
100
101 /** LED1 = 0 and so on */
102 struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
103 /** DCDC1 = 0 and so on */
104 struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
105 /** EPE1 = 0 and so on */
106 struct regulator_init_data *epe[WM831X_MAX_EPE];
107 /** LDO1 = 0 and so on */
108 struct regulator_init_data *ldo[WM831X_MAX_LDO];
109 /** ISINK1 = 0 and so on*/
110 struct regulator_init_data *isink[WM831X_MAX_ISINK];
111};
112
113#endif
diff --git a/include/linux/mfd/wm831x/pmu.h b/include/linux/mfd/wm831x/pmu.h
new file mode 100644
index 000000000000..b18cbb027bc3
--- /dev/null
+++ b/include/linux/mfd/wm831x/pmu.h
@@ -0,0 +1,189 @@
1/*
2 * include/linux/mfd/wm831x/pmu.h -- PMU for WM831x
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_WM831X_PMU_H__
16#define __MFD_WM831X_PMU_H__
17
18/*
19 * R16387 (0x4003) - Power State
20 */
21#define WM831X_CHIP_ON 0x8000 /* CHIP_ON */
22#define WM831X_CHIP_ON_MASK 0x8000 /* CHIP_ON */
23#define WM831X_CHIP_ON_SHIFT 15 /* CHIP_ON */
24#define WM831X_CHIP_ON_WIDTH 1 /* CHIP_ON */
25#define WM831X_CHIP_SLP 0x4000 /* CHIP_SLP */
26#define WM831X_CHIP_SLP_MASK 0x4000 /* CHIP_SLP */
27#define WM831X_CHIP_SLP_SHIFT 14 /* CHIP_SLP */
28#define WM831X_CHIP_SLP_WIDTH 1 /* CHIP_SLP */
29#define WM831X_REF_LP 0x1000 /* REF_LP */
30#define WM831X_REF_LP_MASK 0x1000 /* REF_LP */
31#define WM831X_REF_LP_SHIFT 12 /* REF_LP */
32#define WM831X_REF_LP_WIDTH 1 /* REF_LP */
33#define WM831X_PWRSTATE_DLY_MASK 0x0C00 /* PWRSTATE_DLY - [11:10] */
34#define WM831X_PWRSTATE_DLY_SHIFT 10 /* PWRSTATE_DLY - [11:10] */
35#define WM831X_PWRSTATE_DLY_WIDTH 2 /* PWRSTATE_DLY - [11:10] */
36#define WM831X_SWRST_DLY 0x0200 /* SWRST_DLY */
37#define WM831X_SWRST_DLY_MASK 0x0200 /* SWRST_DLY */
38#define WM831X_SWRST_DLY_SHIFT 9 /* SWRST_DLY */
39#define WM831X_SWRST_DLY_WIDTH 1 /* SWRST_DLY */
40#define WM831X_USB100MA_STARTUP_MASK 0x0030 /* USB100MA_STARTUP - [5:4] */
41#define WM831X_USB100MA_STARTUP_SHIFT 4 /* USB100MA_STARTUP - [5:4] */
42#define WM831X_USB100MA_STARTUP_WIDTH 2 /* USB100MA_STARTUP - [5:4] */
43#define WM831X_USB_CURR_STS 0x0008 /* USB_CURR_STS */
44#define WM831X_USB_CURR_STS_MASK 0x0008 /* USB_CURR_STS */
45#define WM831X_USB_CURR_STS_SHIFT 3 /* USB_CURR_STS */
46#define WM831X_USB_CURR_STS_WIDTH 1 /* USB_CURR_STS */
47#define WM831X_USB_ILIM_MASK 0x0007 /* USB_ILIM - [2:0] */
48#define WM831X_USB_ILIM_SHIFT 0 /* USB_ILIM - [2:0] */
49#define WM831X_USB_ILIM_WIDTH 3 /* USB_ILIM - [2:0] */
50
51/*
52 * R16397 (0x400D) - System Status
53 */
54#define WM831X_THW_STS 0x8000 /* THW_STS */
55#define WM831X_THW_STS_MASK 0x8000 /* THW_STS */
56#define WM831X_THW_STS_SHIFT 15 /* THW_STS */
57#define WM831X_THW_STS_WIDTH 1 /* THW_STS */
58#define WM831X_PWR_SRC_BATT 0x0400 /* PWR_SRC_BATT */
59#define WM831X_PWR_SRC_BATT_MASK 0x0400 /* PWR_SRC_BATT */
60#define WM831X_PWR_SRC_BATT_SHIFT 10 /* PWR_SRC_BATT */
61#define WM831X_PWR_SRC_BATT_WIDTH 1 /* PWR_SRC_BATT */
62#define WM831X_PWR_WALL 0x0200 /* PWR_WALL */
63#define WM831X_PWR_WALL_MASK 0x0200 /* PWR_WALL */
64#define WM831X_PWR_WALL_SHIFT 9 /* PWR_WALL */
65#define WM831X_PWR_WALL_WIDTH 1 /* PWR_WALL */
66#define WM831X_PWR_USB 0x0100 /* PWR_USB */
67#define WM831X_PWR_USB_MASK 0x0100 /* PWR_USB */
68#define WM831X_PWR_USB_SHIFT 8 /* PWR_USB */
69#define WM831X_PWR_USB_WIDTH 1 /* PWR_USB */
70#define WM831X_MAIN_STATE_MASK 0x001F /* MAIN_STATE - [4:0] */
71#define WM831X_MAIN_STATE_SHIFT 0 /* MAIN_STATE - [4:0] */
72#define WM831X_MAIN_STATE_WIDTH 5 /* MAIN_STATE - [4:0] */
73
74/*
75 * R16456 (0x4048) - Charger Control 1
76 */
77#define WM831X_CHG_ENA 0x8000 /* CHG_ENA */
78#define WM831X_CHG_ENA_MASK 0x8000 /* CHG_ENA */
79#define WM831X_CHG_ENA_SHIFT 15 /* CHG_ENA */
80#define WM831X_CHG_ENA_WIDTH 1 /* CHG_ENA */
81#define WM831X_CHG_FRC 0x4000 /* CHG_FRC */
82#define WM831X_CHG_FRC_MASK 0x4000 /* CHG_FRC */
83#define WM831X_CHG_FRC_SHIFT 14 /* CHG_FRC */
84#define WM831X_CHG_FRC_WIDTH 1 /* CHG_FRC */
85#define WM831X_CHG_ITERM_MASK 0x1C00 /* CHG_ITERM - [12:10] */
86#define WM831X_CHG_ITERM_SHIFT 10 /* CHG_ITERM - [12:10] */
87#define WM831X_CHG_ITERM_WIDTH 3 /* CHG_ITERM - [12:10] */
88#define WM831X_CHG_FAST 0x0020 /* CHG_FAST */
89#define WM831X_CHG_FAST_MASK 0x0020 /* CHG_FAST */
90#define WM831X_CHG_FAST_SHIFT 5 /* CHG_FAST */
91#define WM831X_CHG_FAST_WIDTH 1 /* CHG_FAST */
92#define WM831X_CHG_IMON_ENA 0x0002 /* CHG_IMON_ENA */
93#define WM831X_CHG_IMON_ENA_MASK 0x0002 /* CHG_IMON_ENA */
94#define WM831X_CHG_IMON_ENA_SHIFT 1 /* CHG_IMON_ENA */
95#define WM831X_CHG_IMON_ENA_WIDTH 1 /* CHG_IMON_ENA */
96#define WM831X_CHG_CHIP_TEMP_MON 0x0001 /* CHG_CHIP_TEMP_MON */
97#define WM831X_CHG_CHIP_TEMP_MON_MASK 0x0001 /* CHG_CHIP_TEMP_MON */
98#define WM831X_CHG_CHIP_TEMP_MON_SHIFT 0 /* CHG_CHIP_TEMP_MON */
99#define WM831X_CHG_CHIP_TEMP_MON_WIDTH 1 /* CHG_CHIP_TEMP_MON */
100
101/*
102 * R16457 (0x4049) - Charger Control 2
103 */
104#define WM831X_CHG_OFF_MSK 0x4000 /* CHG_OFF_MSK */
105#define WM831X_CHG_OFF_MSK_MASK 0x4000 /* CHG_OFF_MSK */
106#define WM831X_CHG_OFF_MSK_SHIFT 14 /* CHG_OFF_MSK */
107#define WM831X_CHG_OFF_MSK_WIDTH 1 /* CHG_OFF_MSK */
108#define WM831X_CHG_TIME_MASK 0x0F00 /* CHG_TIME - [11:8] */
109#define WM831X_CHG_TIME_SHIFT 8 /* CHG_TIME - [11:8] */
110#define WM831X_CHG_TIME_WIDTH 4 /* CHG_TIME - [11:8] */
111#define WM831X_CHG_TRKL_ILIM_MASK 0x00C0 /* CHG_TRKL_ILIM - [7:6] */
112#define WM831X_CHG_TRKL_ILIM_SHIFT 6 /* CHG_TRKL_ILIM - [7:6] */
113#define WM831X_CHG_TRKL_ILIM_WIDTH 2 /* CHG_TRKL_ILIM - [7:6] */
114#define WM831X_CHG_VSEL_MASK 0x0030 /* CHG_VSEL - [5:4] */
115#define WM831X_CHG_VSEL_SHIFT 4 /* CHG_VSEL - [5:4] */
116#define WM831X_CHG_VSEL_WIDTH 2 /* CHG_VSEL - [5:4] */
117#define WM831X_CHG_FAST_ILIM_MASK 0x000F /* CHG_FAST_ILIM - [3:0] */
118#define WM831X_CHG_FAST_ILIM_SHIFT 0 /* CHG_FAST_ILIM - [3:0] */
119#define WM831X_CHG_FAST_ILIM_WIDTH 4 /* CHG_FAST_ILIM - [3:0] */
120
121/*
122 * R16458 (0x404A) - Charger Status
123 */
124#define WM831X_BATT_OV_STS 0x8000 /* BATT_OV_STS */
125#define WM831X_BATT_OV_STS_MASK 0x8000 /* BATT_OV_STS */
126#define WM831X_BATT_OV_STS_SHIFT 15 /* BATT_OV_STS */
127#define WM831X_BATT_OV_STS_WIDTH 1 /* BATT_OV_STS */
128#define WM831X_CHG_STATE_MASK 0x7000 /* CHG_STATE - [14:12] */
129#define WM831X_CHG_STATE_SHIFT 12 /* CHG_STATE - [14:12] */
130#define WM831X_CHG_STATE_WIDTH 3 /* CHG_STATE - [14:12] */
131#define WM831X_BATT_HOT_STS 0x0800 /* BATT_HOT_STS */
132#define WM831X_BATT_HOT_STS_MASK 0x0800 /* BATT_HOT_STS */
133#define WM831X_BATT_HOT_STS_SHIFT 11 /* BATT_HOT_STS */
134#define WM831X_BATT_HOT_STS_WIDTH 1 /* BATT_HOT_STS */
135#define WM831X_BATT_COLD_STS 0x0400 /* BATT_COLD_STS */
136#define WM831X_BATT_COLD_STS_MASK 0x0400 /* BATT_COLD_STS */
137#define WM831X_BATT_COLD_STS_SHIFT 10 /* BATT_COLD_STS */
138#define WM831X_BATT_COLD_STS_WIDTH 1 /* BATT_COLD_STS */
139#define WM831X_CHG_TOPOFF 0x0200 /* CHG_TOPOFF */
140#define WM831X_CHG_TOPOFF_MASK 0x0200 /* CHG_TOPOFF */
141#define WM831X_CHG_TOPOFF_SHIFT 9 /* CHG_TOPOFF */
142#define WM831X_CHG_TOPOFF_WIDTH 1 /* CHG_TOPOFF */
143#define WM831X_CHG_ACTIVE 0x0100 /* CHG_ACTIVE */
144#define WM831X_CHG_ACTIVE_MASK 0x0100 /* CHG_ACTIVE */
145#define WM831X_CHG_ACTIVE_SHIFT 8 /* CHG_ACTIVE */
146#define WM831X_CHG_ACTIVE_WIDTH 1 /* CHG_ACTIVE */
147#define WM831X_CHG_TIME_ELAPSED_MASK 0x00FF /* CHG_TIME_ELAPSED - [7:0] */
148#define WM831X_CHG_TIME_ELAPSED_SHIFT 0 /* CHG_TIME_ELAPSED - [7:0] */
149#define WM831X_CHG_TIME_ELAPSED_WIDTH 8 /* CHG_TIME_ELAPSED - [7:0] */
150
151#define WM831X_CHG_STATE_OFF (0 << WM831X_CHG_STATE_SHIFT)
152#define WM831X_CHG_STATE_TRICKLE (1 << WM831X_CHG_STATE_SHIFT)
153#define WM831X_CHG_STATE_FAST (2 << WM831X_CHG_STATE_SHIFT)
154#define WM831X_CHG_STATE_TRICKLE_OT (3 << WM831X_CHG_STATE_SHIFT)
155#define WM831X_CHG_STATE_FAST_OT (4 << WM831X_CHG_STATE_SHIFT)
156#define WM831X_CHG_STATE_DEFECTIVE (5 << WM831X_CHG_STATE_SHIFT)
157
158/*
159 * R16459 (0x404B) - Backup Charger Control
160 */
161#define WM831X_BKUP_CHG_ENA 0x8000 /* BKUP_CHG_ENA */
162#define WM831X_BKUP_CHG_ENA_MASK 0x8000 /* BKUP_CHG_ENA */
163#define WM831X_BKUP_CHG_ENA_SHIFT 15 /* BKUP_CHG_ENA */
164#define WM831X_BKUP_CHG_ENA_WIDTH 1 /* BKUP_CHG_ENA */
165#define WM831X_BKUP_CHG_STS 0x4000 /* BKUP_CHG_STS */
166#define WM831X_BKUP_CHG_STS_MASK 0x4000 /* BKUP_CHG_STS */
167#define WM831X_BKUP_CHG_STS_SHIFT 14 /* BKUP_CHG_STS */
168#define WM831X_BKUP_CHG_STS_WIDTH 1 /* BKUP_CHG_STS */
169#define WM831X_BKUP_CHG_MODE 0x1000 /* BKUP_CHG_MODE */
170#define WM831X_BKUP_CHG_MODE_MASK 0x1000 /* BKUP_CHG_MODE */
171#define WM831X_BKUP_CHG_MODE_SHIFT 12 /* BKUP_CHG_MODE */
172#define WM831X_BKUP_CHG_MODE_WIDTH 1 /* BKUP_CHG_MODE */
173#define WM831X_BKUP_BATT_DET_ENA 0x0800 /* BKUP_BATT_DET_ENA */
174#define WM831X_BKUP_BATT_DET_ENA_MASK 0x0800 /* BKUP_BATT_DET_ENA */
175#define WM831X_BKUP_BATT_DET_ENA_SHIFT 11 /* BKUP_BATT_DET_ENA */
176#define WM831X_BKUP_BATT_DET_ENA_WIDTH 1 /* BKUP_BATT_DET_ENA */
177#define WM831X_BKUP_BATT_STS 0x0400 /* BKUP_BATT_STS */
178#define WM831X_BKUP_BATT_STS_MASK 0x0400 /* BKUP_BATT_STS */
179#define WM831X_BKUP_BATT_STS_SHIFT 10 /* BKUP_BATT_STS */
180#define WM831X_BKUP_BATT_STS_WIDTH 1 /* BKUP_BATT_STS */
181#define WM831X_BKUP_CHG_VLIM 0x0010 /* BKUP_CHG_VLIM */
182#define WM831X_BKUP_CHG_VLIM_MASK 0x0010 /* BKUP_CHG_VLIM */
183#define WM831X_BKUP_CHG_VLIM_SHIFT 4 /* BKUP_CHG_VLIM */
184#define WM831X_BKUP_CHG_VLIM_WIDTH 1 /* BKUP_CHG_VLIM */
185#define WM831X_BKUP_CHG_ILIM_MASK 0x0003 /* BKUP_CHG_ILIM - [1:0] */
186#define WM831X_BKUP_CHG_ILIM_SHIFT 0 /* BKUP_CHG_ILIM - [1:0] */
187#define WM831X_BKUP_CHG_ILIM_WIDTH 2 /* BKUP_CHG_ILIM - [1:0] */
188
189#endif
diff --git a/include/linux/mfd/wm831x/regulator.h b/include/linux/mfd/wm831x/regulator.h
new file mode 100644
index 000000000000..955d30fc6a27
--- /dev/null
+++ b/include/linux/mfd/wm831x/regulator.h
@@ -0,0 +1,1218 @@
1/*
2 * linux/mfd/wm831x/regulator.h -- Regulator definitons for wm831x
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_WM831X_REGULATOR_H__
16#define __MFD_WM831X_REGULATOR_H__
17
18/*
19 * R16462 (0x404E) - Current Sink 1
20 */
21#define WM831X_CS1_ENA 0x8000 /* CS1_ENA */
22#define WM831X_CS1_ENA_MASK 0x8000 /* CS1_ENA */
23#define WM831X_CS1_ENA_SHIFT 15 /* CS1_ENA */
24#define WM831X_CS1_ENA_WIDTH 1 /* CS1_ENA */
25#define WM831X_CS1_DRIVE 0x4000 /* CS1_DRIVE */
26#define WM831X_CS1_DRIVE_MASK 0x4000 /* CS1_DRIVE */
27#define WM831X_CS1_DRIVE_SHIFT 14 /* CS1_DRIVE */
28#define WM831X_CS1_DRIVE_WIDTH 1 /* CS1_DRIVE */
29#define WM831X_CS1_SLPENA 0x1000 /* CS1_SLPENA */
30#define WM831X_CS1_SLPENA_MASK 0x1000 /* CS1_SLPENA */
31#define WM831X_CS1_SLPENA_SHIFT 12 /* CS1_SLPENA */
32#define WM831X_CS1_SLPENA_WIDTH 1 /* CS1_SLPENA */
33#define WM831X_CS1_OFF_RAMP_MASK 0x0C00 /* CS1_OFF_RAMP - [11:10] */
34#define WM831X_CS1_OFF_RAMP_SHIFT 10 /* CS1_OFF_RAMP - [11:10] */
35#define WM831X_CS1_OFF_RAMP_WIDTH 2 /* CS1_OFF_RAMP - [11:10] */
36#define WM831X_CS1_ON_RAMP_MASK 0x0300 /* CS1_ON_RAMP - [9:8] */
37#define WM831X_CS1_ON_RAMP_SHIFT 8 /* CS1_ON_RAMP - [9:8] */
38#define WM831X_CS1_ON_RAMP_WIDTH 2 /* CS1_ON_RAMP - [9:8] */
39#define WM831X_CS1_ISEL_MASK 0x003F /* CS1_ISEL - [5:0] */
40#define WM831X_CS1_ISEL_SHIFT 0 /* CS1_ISEL - [5:0] */
41#define WM831X_CS1_ISEL_WIDTH 6 /* CS1_ISEL - [5:0] */
42
43/*
44 * R16463 (0x404F) - Current Sink 2
45 */
46#define WM831X_CS2_ENA 0x8000 /* CS2_ENA */
47#define WM831X_CS2_ENA_MASK 0x8000 /* CS2_ENA */
48#define WM831X_CS2_ENA_SHIFT 15 /* CS2_ENA */
49#define WM831X_CS2_ENA_WIDTH 1 /* CS2_ENA */
50#define WM831X_CS2_DRIVE 0x4000 /* CS2_DRIVE */
51#define WM831X_CS2_DRIVE_MASK 0x4000 /* CS2_DRIVE */
52#define WM831X_CS2_DRIVE_SHIFT 14 /* CS2_DRIVE */
53#define WM831X_CS2_DRIVE_WIDTH 1 /* CS2_DRIVE */
54#define WM831X_CS2_SLPENA 0x1000 /* CS2_SLPENA */
55#define WM831X_CS2_SLPENA_MASK 0x1000 /* CS2_SLPENA */
56#define WM831X_CS2_SLPENA_SHIFT 12 /* CS2_SLPENA */
57#define WM831X_CS2_SLPENA_WIDTH 1 /* CS2_SLPENA */
58#define WM831X_CS2_OFF_RAMP_MASK 0x0C00 /* CS2_OFF_RAMP - [11:10] */
59#define WM831X_CS2_OFF_RAMP_SHIFT 10 /* CS2_OFF_RAMP - [11:10] */
60#define WM831X_CS2_OFF_RAMP_WIDTH 2 /* CS2_OFF_RAMP - [11:10] */
61#define WM831X_CS2_ON_RAMP_MASK 0x0300 /* CS2_ON_RAMP - [9:8] */
62#define WM831X_CS2_ON_RAMP_SHIFT 8 /* CS2_ON_RAMP - [9:8] */
63#define WM831X_CS2_ON_RAMP_WIDTH 2 /* CS2_ON_RAMP - [9:8] */
64#define WM831X_CS2_ISEL_MASK 0x003F /* CS2_ISEL - [5:0] */
65#define WM831X_CS2_ISEL_SHIFT 0 /* CS2_ISEL - [5:0] */
66#define WM831X_CS2_ISEL_WIDTH 6 /* CS2_ISEL - [5:0] */
67
68/*
69 * R16464 (0x4050) - DCDC Enable
70 */
71#define WM831X_EPE2_ENA 0x0080 /* EPE2_ENA */
72#define WM831X_EPE2_ENA_MASK 0x0080 /* EPE2_ENA */
73#define WM831X_EPE2_ENA_SHIFT 7 /* EPE2_ENA */
74#define WM831X_EPE2_ENA_WIDTH 1 /* EPE2_ENA */
75#define WM831X_EPE1_ENA 0x0040 /* EPE1_ENA */
76#define WM831X_EPE1_ENA_MASK 0x0040 /* EPE1_ENA */
77#define WM831X_EPE1_ENA_SHIFT 6 /* EPE1_ENA */
78#define WM831X_EPE1_ENA_WIDTH 1 /* EPE1_ENA */
79#define WM831X_DC4_ENA 0x0008 /* DC4_ENA */
80#define WM831X_DC4_ENA_MASK 0x0008 /* DC4_ENA */
81#define WM831X_DC4_ENA_SHIFT 3 /* DC4_ENA */
82#define WM831X_DC4_ENA_WIDTH 1 /* DC4_ENA */
83#define WM831X_DC3_ENA 0x0004 /* DC3_ENA */
84#define WM831X_DC3_ENA_MASK 0x0004 /* DC3_ENA */
85#define WM831X_DC3_ENA_SHIFT 2 /* DC3_ENA */
86#define WM831X_DC3_ENA_WIDTH 1 /* DC3_ENA */
87#define WM831X_DC2_ENA 0x0002 /* DC2_ENA */
88#define WM831X_DC2_ENA_MASK 0x0002 /* DC2_ENA */
89#define WM831X_DC2_ENA_SHIFT 1 /* DC2_ENA */
90#define WM831X_DC2_ENA_WIDTH 1 /* DC2_ENA */
91#define WM831X_DC1_ENA 0x0001 /* DC1_ENA */
92#define WM831X_DC1_ENA_MASK 0x0001 /* DC1_ENA */
93#define WM831X_DC1_ENA_SHIFT 0 /* DC1_ENA */
94#define WM831X_DC1_ENA_WIDTH 1 /* DC1_ENA */
95
96/*
97 * R16465 (0x4051) - LDO Enable
98 */
99#define WM831X_LDO11_ENA 0x0400 /* LDO11_ENA */
100#define WM831X_LDO11_ENA_MASK 0x0400 /* LDO11_ENA */
101#define WM831X_LDO11_ENA_SHIFT 10 /* LDO11_ENA */
102#define WM831X_LDO11_ENA_WIDTH 1 /* LDO11_ENA */
103#define WM831X_LDO10_ENA 0x0200 /* LDO10_ENA */
104#define WM831X_LDO10_ENA_MASK 0x0200 /* LDO10_ENA */
105#define WM831X_LDO10_ENA_SHIFT 9 /* LDO10_ENA */
106#define WM831X_LDO10_ENA_WIDTH 1 /* LDO10_ENA */
107#define WM831X_LDO9_ENA 0x0100 /* LDO9_ENA */
108#define WM831X_LDO9_ENA_MASK 0x0100 /* LDO9_ENA */
109#define WM831X_LDO9_ENA_SHIFT 8 /* LDO9_ENA */
110#define WM831X_LDO9_ENA_WIDTH 1 /* LDO9_ENA */
111#define WM831X_LDO8_ENA 0x0080 /* LDO8_ENA */
112#define WM831X_LDO8_ENA_MASK 0x0080 /* LDO8_ENA */
113#define WM831X_LDO8_ENA_SHIFT 7 /* LDO8_ENA */
114#define WM831X_LDO8_ENA_WIDTH 1 /* LDO8_ENA */
115#define WM831X_LDO7_ENA 0x0040 /* LDO7_ENA */
116#define WM831X_LDO7_ENA_MASK 0x0040 /* LDO7_ENA */
117#define WM831X_LDO7_ENA_SHIFT 6 /* LDO7_ENA */
118#define WM831X_LDO7_ENA_WIDTH 1 /* LDO7_ENA */
119#define WM831X_LDO6_ENA 0x0020 /* LDO6_ENA */
120#define WM831X_LDO6_ENA_MASK 0x0020 /* LDO6_ENA */
121#define WM831X_LDO6_ENA_SHIFT 5 /* LDO6_ENA */
122#define WM831X_LDO6_ENA_WIDTH 1 /* LDO6_ENA */
123#define WM831X_LDO5_ENA 0x0010 /* LDO5_ENA */
124#define WM831X_LDO5_ENA_MASK 0x0010 /* LDO5_ENA */
125#define WM831X_LDO5_ENA_SHIFT 4 /* LDO5_ENA */
126#define WM831X_LDO5_ENA_WIDTH 1 /* LDO5_ENA */
127#define WM831X_LDO4_ENA 0x0008 /* LDO4_ENA */
128#define WM831X_LDO4_ENA_MASK 0x0008 /* LDO4_ENA */
129#define WM831X_LDO4_ENA_SHIFT 3 /* LDO4_ENA */
130#define WM831X_LDO4_ENA_WIDTH 1 /* LDO4_ENA */
131#define WM831X_LDO3_ENA 0x0004 /* LDO3_ENA */
132#define WM831X_LDO3_ENA_MASK 0x0004 /* LDO3_ENA */
133#define WM831X_LDO3_ENA_SHIFT 2 /* LDO3_ENA */
134#define WM831X_LDO3_ENA_WIDTH 1 /* LDO3_ENA */
135#define WM831X_LDO2_ENA 0x0002 /* LDO2_ENA */
136#define WM831X_LDO2_ENA_MASK 0x0002 /* LDO2_ENA */
137#define WM831X_LDO2_ENA_SHIFT 1 /* LDO2_ENA */
138#define WM831X_LDO2_ENA_WIDTH 1 /* LDO2_ENA */
139#define WM831X_LDO1_ENA 0x0001 /* LDO1_ENA */
140#define WM831X_LDO1_ENA_MASK 0x0001 /* LDO1_ENA */
141#define WM831X_LDO1_ENA_SHIFT 0 /* LDO1_ENA */
142#define WM831X_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
143
144/*
145 * R16466 (0x4052) - DCDC Status
146 */
147#define WM831X_EPE2_STS 0x0080 /* EPE2_STS */
148#define WM831X_EPE2_STS_MASK 0x0080 /* EPE2_STS */
149#define WM831X_EPE2_STS_SHIFT 7 /* EPE2_STS */
150#define WM831X_EPE2_STS_WIDTH 1 /* EPE2_STS */
151#define WM831X_EPE1_STS 0x0040 /* EPE1_STS */
152#define WM831X_EPE1_STS_MASK 0x0040 /* EPE1_STS */
153#define WM831X_EPE1_STS_SHIFT 6 /* EPE1_STS */
154#define WM831X_EPE1_STS_WIDTH 1 /* EPE1_STS */
155#define WM831X_DC4_STS 0x0008 /* DC4_STS */
156#define WM831X_DC4_STS_MASK 0x0008 /* DC4_STS */
157#define WM831X_DC4_STS_SHIFT 3 /* DC4_STS */
158#define WM831X_DC4_STS_WIDTH 1 /* DC4_STS */
159#define WM831X_DC3_STS 0x0004 /* DC3_STS */
160#define WM831X_DC3_STS_MASK 0x0004 /* DC3_STS */
161#define WM831X_DC3_STS_SHIFT 2 /* DC3_STS */
162#define WM831X_DC3_STS_WIDTH 1 /* DC3_STS */
163#define WM831X_DC2_STS 0x0002 /* DC2_STS */
164#define WM831X_DC2_STS_MASK 0x0002 /* DC2_STS */
165#define WM831X_DC2_STS_SHIFT 1 /* DC2_STS */
166#define WM831X_DC2_STS_WIDTH 1 /* DC2_STS */
167#define WM831X_DC1_STS 0x0001 /* DC1_STS */
168#define WM831X_DC1_STS_MASK 0x0001 /* DC1_STS */
169#define WM831X_DC1_STS_SHIFT 0 /* DC1_STS */
170#define WM831X_DC1_STS_WIDTH 1 /* DC1_STS */
171
172/*
173 * R16467 (0x4053) - LDO Status
174 */
175#define WM831X_LDO11_STS 0x0400 /* LDO11_STS */
176#define WM831X_LDO11_STS_MASK 0x0400 /* LDO11_STS */
177#define WM831X_LDO11_STS_SHIFT 10 /* LDO11_STS */
178#define WM831X_LDO11_STS_WIDTH 1 /* LDO11_STS */
179#define WM831X_LDO10_STS 0x0200 /* LDO10_STS */
180#define WM831X_LDO10_STS_MASK 0x0200 /* LDO10_STS */
181#define WM831X_LDO10_STS_SHIFT 9 /* LDO10_STS */
182#define WM831X_LDO10_STS_WIDTH 1 /* LDO10_STS */
183#define WM831X_LDO9_STS 0x0100 /* LDO9_STS */
184#define WM831X_LDO9_STS_MASK 0x0100 /* LDO9_STS */
185#define WM831X_LDO9_STS_SHIFT 8 /* LDO9_STS */
186#define WM831X_LDO9_STS_WIDTH 1 /* LDO9_STS */
187#define WM831X_LDO8_STS 0x0080 /* LDO8_STS */
188#define WM831X_LDO8_STS_MASK 0x0080 /* LDO8_STS */
189#define WM831X_LDO8_STS_SHIFT 7 /* LDO8_STS */
190#define WM831X_LDO8_STS_WIDTH 1 /* LDO8_STS */
191#define WM831X_LDO7_STS 0x0040 /* LDO7_STS */
192#define WM831X_LDO7_STS_MASK 0x0040 /* LDO7_STS */
193#define WM831X_LDO7_STS_SHIFT 6 /* LDO7_STS */
194#define WM831X_LDO7_STS_WIDTH 1 /* LDO7_STS */
195#define WM831X_LDO6_STS 0x0020 /* LDO6_STS */
196#define WM831X_LDO6_STS_MASK 0x0020 /* LDO6_STS */
197#define WM831X_LDO6_STS_SHIFT 5 /* LDO6_STS */
198#define WM831X_LDO6_STS_WIDTH 1 /* LDO6_STS */
199#define WM831X_LDO5_STS 0x0010 /* LDO5_STS */
200#define WM831X_LDO5_STS_MASK 0x0010 /* LDO5_STS */
201#define WM831X_LDO5_STS_SHIFT 4 /* LDO5_STS */
202#define WM831X_LDO5_STS_WIDTH 1 /* LDO5_STS */
203#define WM831X_LDO4_STS 0x0008 /* LDO4_STS */
204#define WM831X_LDO4_STS_MASK 0x0008 /* LDO4_STS */
205#define WM831X_LDO4_STS_SHIFT 3 /* LDO4_STS */
206#define WM831X_LDO4_STS_WIDTH 1 /* LDO4_STS */
207#define WM831X_LDO3_STS 0x0004 /* LDO3_STS */
208#define WM831X_LDO3_STS_MASK 0x0004 /* LDO3_STS */
209#define WM831X_LDO3_STS_SHIFT 2 /* LDO3_STS */
210#define WM831X_LDO3_STS_WIDTH 1 /* LDO3_STS */
211#define WM831X_LDO2_STS 0x0002 /* LDO2_STS */
212#define WM831X_LDO2_STS_MASK 0x0002 /* LDO2_STS */
213#define WM831X_LDO2_STS_SHIFT 1 /* LDO2_STS */
214#define WM831X_LDO2_STS_WIDTH 1 /* LDO2_STS */
215#define WM831X_LDO1_STS 0x0001 /* LDO1_STS */
216#define WM831X_LDO1_STS_MASK 0x0001 /* LDO1_STS */
217#define WM831X_LDO1_STS_SHIFT 0 /* LDO1_STS */
218#define WM831X_LDO1_STS_WIDTH 1 /* LDO1_STS */
219
220/*
221 * R16468 (0x4054) - DCDC UV Status
222 */
223#define WM831X_DC2_OV_STS 0x2000 /* DC2_OV_STS */
224#define WM831X_DC2_OV_STS_MASK 0x2000 /* DC2_OV_STS */
225#define WM831X_DC2_OV_STS_SHIFT 13 /* DC2_OV_STS */
226#define WM831X_DC2_OV_STS_WIDTH 1 /* DC2_OV_STS */
227#define WM831X_DC1_OV_STS 0x1000 /* DC1_OV_STS */
228#define WM831X_DC1_OV_STS_MASK 0x1000 /* DC1_OV_STS */
229#define WM831X_DC1_OV_STS_SHIFT 12 /* DC1_OV_STS */
230#define WM831X_DC1_OV_STS_WIDTH 1 /* DC1_OV_STS */
231#define WM831X_DC2_HC_STS 0x0200 /* DC2_HC_STS */
232#define WM831X_DC2_HC_STS_MASK 0x0200 /* DC2_HC_STS */
233#define WM831X_DC2_HC_STS_SHIFT 9 /* DC2_HC_STS */
234#define WM831X_DC2_HC_STS_WIDTH 1 /* DC2_HC_STS */
235#define WM831X_DC1_HC_STS 0x0100 /* DC1_HC_STS */
236#define WM831X_DC1_HC_STS_MASK 0x0100 /* DC1_HC_STS */
237#define WM831X_DC1_HC_STS_SHIFT 8 /* DC1_HC_STS */
238#define WM831X_DC1_HC_STS_WIDTH 1 /* DC1_HC_STS */
239#define WM831X_DC4_UV_STS 0x0008 /* DC4_UV_STS */
240#define WM831X_DC4_UV_STS_MASK 0x0008 /* DC4_UV_STS */
241#define WM831X_DC4_UV_STS_SHIFT 3 /* DC4_UV_STS */
242#define WM831X_DC4_UV_STS_WIDTH 1 /* DC4_UV_STS */
243#define WM831X_DC3_UV_STS 0x0004 /* DC3_UV_STS */
244#define WM831X_DC3_UV_STS_MASK 0x0004 /* DC3_UV_STS */
245#define WM831X_DC3_UV_STS_SHIFT 2 /* DC3_UV_STS */
246#define WM831X_DC3_UV_STS_WIDTH 1 /* DC3_UV_STS */
247#define WM831X_DC2_UV_STS 0x0002 /* DC2_UV_STS */
248#define WM831X_DC2_UV_STS_MASK 0x0002 /* DC2_UV_STS */
249#define WM831X_DC2_UV_STS_SHIFT 1 /* DC2_UV_STS */
250#define WM831X_DC2_UV_STS_WIDTH 1 /* DC2_UV_STS */
251#define WM831X_DC1_UV_STS 0x0001 /* DC1_UV_STS */
252#define WM831X_DC1_UV_STS_MASK 0x0001 /* DC1_UV_STS */
253#define WM831X_DC1_UV_STS_SHIFT 0 /* DC1_UV_STS */
254#define WM831X_DC1_UV_STS_WIDTH 1 /* DC1_UV_STS */
255
256/*
257 * R16469 (0x4055) - LDO UV Status
258 */
259#define WM831X_INTLDO_UV_STS 0x8000 /* INTLDO_UV_STS */
260#define WM831X_INTLDO_UV_STS_MASK 0x8000 /* INTLDO_UV_STS */
261#define WM831X_INTLDO_UV_STS_SHIFT 15 /* INTLDO_UV_STS */
262#define WM831X_INTLDO_UV_STS_WIDTH 1 /* INTLDO_UV_STS */
263#define WM831X_LDO10_UV_STS 0x0200 /* LDO10_UV_STS */
264#define WM831X_LDO10_UV_STS_MASK 0x0200 /* LDO10_UV_STS */
265#define WM831X_LDO10_UV_STS_SHIFT 9 /* LDO10_UV_STS */
266#define WM831X_LDO10_UV_STS_WIDTH 1 /* LDO10_UV_STS */
267#define WM831X_LDO9_UV_STS 0x0100 /* LDO9_UV_STS */
268#define WM831X_LDO9_UV_STS_MASK 0x0100 /* LDO9_UV_STS */
269#define WM831X_LDO9_UV_STS_SHIFT 8 /* LDO9_UV_STS */
270#define WM831X_LDO9_UV_STS_WIDTH 1 /* LDO9_UV_STS */
271#define WM831X_LDO8_UV_STS 0x0080 /* LDO8_UV_STS */
272#define WM831X_LDO8_UV_STS_MASK 0x0080 /* LDO8_UV_STS */
273#define WM831X_LDO8_UV_STS_SHIFT 7 /* LDO8_UV_STS */
274#define WM831X_LDO8_UV_STS_WIDTH 1 /* LDO8_UV_STS */
275#define WM831X_LDO7_UV_STS 0x0040 /* LDO7_UV_STS */
276#define WM831X_LDO7_UV_STS_MASK 0x0040 /* LDO7_UV_STS */
277#define WM831X_LDO7_UV_STS_SHIFT 6 /* LDO7_UV_STS */
278#define WM831X_LDO7_UV_STS_WIDTH 1 /* LDO7_UV_STS */
279#define WM831X_LDO6_UV_STS 0x0020 /* LDO6_UV_STS */
280#define WM831X_LDO6_UV_STS_MASK 0x0020 /* LDO6_UV_STS */
281#define WM831X_LDO6_UV_STS_SHIFT 5 /* LDO6_UV_STS */
282#define WM831X_LDO6_UV_STS_WIDTH 1 /* LDO6_UV_STS */
283#define WM831X_LDO5_UV_STS 0x0010 /* LDO5_UV_STS */
284#define WM831X_LDO5_UV_STS_MASK 0x0010 /* LDO5_UV_STS */
285#define WM831X_LDO5_UV_STS_SHIFT 4 /* LDO5_UV_STS */
286#define WM831X_LDO5_UV_STS_WIDTH 1 /* LDO5_UV_STS */
287#define WM831X_LDO4_UV_STS 0x0008 /* LDO4_UV_STS */
288#define WM831X_LDO4_UV_STS_MASK 0x0008 /* LDO4_UV_STS */
289#define WM831X_LDO4_UV_STS_SHIFT 3 /* LDO4_UV_STS */
290#define WM831X_LDO4_UV_STS_WIDTH 1 /* LDO4_UV_STS */
291#define WM831X_LDO3_UV_STS 0x0004 /* LDO3_UV_STS */
292#define WM831X_LDO3_UV_STS_MASK 0x0004 /* LDO3_UV_STS */
293#define WM831X_LDO3_UV_STS_SHIFT 2 /* LDO3_UV_STS */
294#define WM831X_LDO3_UV_STS_WIDTH 1 /* LDO3_UV_STS */
295#define WM831X_LDO2_UV_STS 0x0002 /* LDO2_UV_STS */
296#define WM831X_LDO2_UV_STS_MASK 0x0002 /* LDO2_UV_STS */
297#define WM831X_LDO2_UV_STS_SHIFT 1 /* LDO2_UV_STS */
298#define WM831X_LDO2_UV_STS_WIDTH 1 /* LDO2_UV_STS */
299#define WM831X_LDO1_UV_STS 0x0001 /* LDO1_UV_STS */
300#define WM831X_LDO1_UV_STS_MASK 0x0001 /* LDO1_UV_STS */
301#define WM831X_LDO1_UV_STS_SHIFT 0 /* LDO1_UV_STS */
302#define WM831X_LDO1_UV_STS_WIDTH 1 /* LDO1_UV_STS */
303
304/*
305 * R16470 (0x4056) - DC1 Control 1
306 */
307#define WM831X_DC1_RATE_MASK 0xC000 /* DC1_RATE - [15:14] */
308#define WM831X_DC1_RATE_SHIFT 14 /* DC1_RATE - [15:14] */
309#define WM831X_DC1_RATE_WIDTH 2 /* DC1_RATE - [15:14] */
310#define WM831X_DC1_PHASE 0x1000 /* DC1_PHASE */
311#define WM831X_DC1_PHASE_MASK 0x1000 /* DC1_PHASE */
312#define WM831X_DC1_PHASE_SHIFT 12 /* DC1_PHASE */
313#define WM831X_DC1_PHASE_WIDTH 1 /* DC1_PHASE */
314#define WM831X_DC1_FREQ_MASK 0x0300 /* DC1_FREQ - [9:8] */
315#define WM831X_DC1_FREQ_SHIFT 8 /* DC1_FREQ - [9:8] */
316#define WM831X_DC1_FREQ_WIDTH 2 /* DC1_FREQ - [9:8] */
317#define WM831X_DC1_FLT 0x0080 /* DC1_FLT */
318#define WM831X_DC1_FLT_MASK 0x0080 /* DC1_FLT */
319#define WM831X_DC1_FLT_SHIFT 7 /* DC1_FLT */
320#define WM831X_DC1_FLT_WIDTH 1 /* DC1_FLT */
321#define WM831X_DC1_SOFT_START_MASK 0x0030 /* DC1_SOFT_START - [5:4] */
322#define WM831X_DC1_SOFT_START_SHIFT 4 /* DC1_SOFT_START - [5:4] */
323#define WM831X_DC1_SOFT_START_WIDTH 2 /* DC1_SOFT_START - [5:4] */
324#define WM831X_DC1_CAP_MASK 0x0003 /* DC1_CAP - [1:0] */
325#define WM831X_DC1_CAP_SHIFT 0 /* DC1_CAP - [1:0] */
326#define WM831X_DC1_CAP_WIDTH 2 /* DC1_CAP - [1:0] */
327
328/*
329 * R16471 (0x4057) - DC1 Control 2
330 */
331#define WM831X_DC1_ERR_ACT_MASK 0xC000 /* DC1_ERR_ACT - [15:14] */
332#define WM831X_DC1_ERR_ACT_SHIFT 14 /* DC1_ERR_ACT - [15:14] */
333#define WM831X_DC1_ERR_ACT_WIDTH 2 /* DC1_ERR_ACT - [15:14] */
334#define WM831X_DC1_HWC_SRC_MASK 0x1800 /* DC1_HWC_SRC - [12:11] */
335#define WM831X_DC1_HWC_SRC_SHIFT 11 /* DC1_HWC_SRC - [12:11] */
336#define WM831X_DC1_HWC_SRC_WIDTH 2 /* DC1_HWC_SRC - [12:11] */
337#define WM831X_DC1_HWC_VSEL 0x0400 /* DC1_HWC_VSEL */
338#define WM831X_DC1_HWC_VSEL_MASK 0x0400 /* DC1_HWC_VSEL */
339#define WM831X_DC1_HWC_VSEL_SHIFT 10 /* DC1_HWC_VSEL */
340#define WM831X_DC1_HWC_VSEL_WIDTH 1 /* DC1_HWC_VSEL */
341#define WM831X_DC1_HWC_MODE_MASK 0x0300 /* DC1_HWC_MODE - [9:8] */
342#define WM831X_DC1_HWC_MODE_SHIFT 8 /* DC1_HWC_MODE - [9:8] */
343#define WM831X_DC1_HWC_MODE_WIDTH 2 /* DC1_HWC_MODE - [9:8] */
344#define WM831X_DC1_HC_THR_MASK 0x0070 /* DC1_HC_THR - [6:4] */
345#define WM831X_DC1_HC_THR_SHIFT 4 /* DC1_HC_THR - [6:4] */
346#define WM831X_DC1_HC_THR_WIDTH 3 /* DC1_HC_THR - [6:4] */
347#define WM831X_DC1_HC_IND_ENA 0x0001 /* DC1_HC_IND_ENA */
348#define WM831X_DC1_HC_IND_ENA_MASK 0x0001 /* DC1_HC_IND_ENA */
349#define WM831X_DC1_HC_IND_ENA_SHIFT 0 /* DC1_HC_IND_ENA */
350#define WM831X_DC1_HC_IND_ENA_WIDTH 1 /* DC1_HC_IND_ENA */
351
352/*
353 * R16472 (0x4058) - DC1 ON Config
354 */
355#define WM831X_DC1_ON_SLOT_MASK 0xE000 /* DC1_ON_SLOT - [15:13] */
356#define WM831X_DC1_ON_SLOT_SHIFT 13 /* DC1_ON_SLOT - [15:13] */
357#define WM831X_DC1_ON_SLOT_WIDTH 3 /* DC1_ON_SLOT - [15:13] */
358#define WM831X_DC1_ON_MODE_MASK 0x0300 /* DC1_ON_MODE - [9:8] */
359#define WM831X_DC1_ON_MODE_SHIFT 8 /* DC1_ON_MODE - [9:8] */
360#define WM831X_DC1_ON_MODE_WIDTH 2 /* DC1_ON_MODE - [9:8] */
361#define WM831X_DC1_ON_VSEL_MASK 0x007F /* DC1_ON_VSEL - [6:0] */
362#define WM831X_DC1_ON_VSEL_SHIFT 0 /* DC1_ON_VSEL - [6:0] */
363#define WM831X_DC1_ON_VSEL_WIDTH 7 /* DC1_ON_VSEL - [6:0] */
364
365/*
366 * R16473 (0x4059) - DC1 SLEEP Control
367 */
368#define WM831X_DC1_SLP_SLOT_MASK 0xE000 /* DC1_SLP_SLOT - [15:13] */
369#define WM831X_DC1_SLP_SLOT_SHIFT 13 /* DC1_SLP_SLOT - [15:13] */
370#define WM831X_DC1_SLP_SLOT_WIDTH 3 /* DC1_SLP_SLOT - [15:13] */
371#define WM831X_DC1_SLP_MODE_MASK 0x0300 /* DC1_SLP_MODE - [9:8] */
372#define WM831X_DC1_SLP_MODE_SHIFT 8 /* DC1_SLP_MODE - [9:8] */
373#define WM831X_DC1_SLP_MODE_WIDTH 2 /* DC1_SLP_MODE - [9:8] */
374#define WM831X_DC1_SLP_VSEL_MASK 0x007F /* DC1_SLP_VSEL - [6:0] */
375#define WM831X_DC1_SLP_VSEL_SHIFT 0 /* DC1_SLP_VSEL - [6:0] */
376#define WM831X_DC1_SLP_VSEL_WIDTH 7 /* DC1_SLP_VSEL - [6:0] */
377
378/*
379 * R16474 (0x405A) - DC1 DVS Control
380 */
381#define WM831X_DC1_DVS_SRC_MASK 0x1800 /* DC1_DVS_SRC - [12:11] */
382#define WM831X_DC1_DVS_SRC_SHIFT 11 /* DC1_DVS_SRC - [12:11] */
383#define WM831X_DC1_DVS_SRC_WIDTH 2 /* DC1_DVS_SRC - [12:11] */
384#define WM831X_DC1_DVS_VSEL_MASK 0x007F /* DC1_DVS_VSEL - [6:0] */
385#define WM831X_DC1_DVS_VSEL_SHIFT 0 /* DC1_DVS_VSEL - [6:0] */
386#define WM831X_DC1_DVS_VSEL_WIDTH 7 /* DC1_DVS_VSEL - [6:0] */
387
388/*
389 * R16475 (0x405B) - DC2 Control 1
390 */
391#define WM831X_DC2_RATE_MASK 0xC000 /* DC2_RATE - [15:14] */
392#define WM831X_DC2_RATE_SHIFT 14 /* DC2_RATE - [15:14] */
393#define WM831X_DC2_RATE_WIDTH 2 /* DC2_RATE - [15:14] */
394#define WM831X_DC2_PHASE 0x1000 /* DC2_PHASE */
395#define WM831X_DC2_PHASE_MASK 0x1000 /* DC2_PHASE */
396#define WM831X_DC2_PHASE_SHIFT 12 /* DC2_PHASE */
397#define WM831X_DC2_PHASE_WIDTH 1 /* DC2_PHASE */
398#define WM831X_DC2_FREQ_MASK 0x0300 /* DC2_FREQ - [9:8] */
399#define WM831X_DC2_FREQ_SHIFT 8 /* DC2_FREQ - [9:8] */
400#define WM831X_DC2_FREQ_WIDTH 2 /* DC2_FREQ - [9:8] */
401#define WM831X_DC2_FLT 0x0080 /* DC2_FLT */
402#define WM831X_DC2_FLT_MASK 0x0080 /* DC2_FLT */
403#define WM831X_DC2_FLT_SHIFT 7 /* DC2_FLT */
404#define WM831X_DC2_FLT_WIDTH 1 /* DC2_FLT */
405#define WM831X_DC2_SOFT_START_MASK 0x0030 /* DC2_SOFT_START - [5:4] */
406#define WM831X_DC2_SOFT_START_SHIFT 4 /* DC2_SOFT_START - [5:4] */
407#define WM831X_DC2_SOFT_START_WIDTH 2 /* DC2_SOFT_START - [5:4] */
408#define WM831X_DC2_CAP_MASK 0x0003 /* DC2_CAP - [1:0] */
409#define WM831X_DC2_CAP_SHIFT 0 /* DC2_CAP - [1:0] */
410#define WM831X_DC2_CAP_WIDTH 2 /* DC2_CAP - [1:0] */
411
412/*
413 * R16476 (0x405C) - DC2 Control 2
414 */
415#define WM831X_DC2_ERR_ACT_MASK 0xC000 /* DC2_ERR_ACT - [15:14] */
416#define WM831X_DC2_ERR_ACT_SHIFT 14 /* DC2_ERR_ACT - [15:14] */
417#define WM831X_DC2_ERR_ACT_WIDTH 2 /* DC2_ERR_ACT - [15:14] */
418#define WM831X_DC2_HWC_SRC_MASK 0x1800 /* DC2_HWC_SRC - [12:11] */
419#define WM831X_DC2_HWC_SRC_SHIFT 11 /* DC2_HWC_SRC - [12:11] */
420#define WM831X_DC2_HWC_SRC_WIDTH 2 /* DC2_HWC_SRC - [12:11] */
421#define WM831X_DC2_HWC_VSEL 0x0400 /* DC2_HWC_VSEL */
422#define WM831X_DC2_HWC_VSEL_MASK 0x0400 /* DC2_HWC_VSEL */
423#define WM831X_DC2_HWC_VSEL_SHIFT 10 /* DC2_HWC_VSEL */
424#define WM831X_DC2_HWC_VSEL_WIDTH 1 /* DC2_HWC_VSEL */
425#define WM831X_DC2_HWC_MODE_MASK 0x0300 /* DC2_HWC_MODE - [9:8] */
426#define WM831X_DC2_HWC_MODE_SHIFT 8 /* DC2_HWC_MODE - [9:8] */
427#define WM831X_DC2_HWC_MODE_WIDTH 2 /* DC2_HWC_MODE - [9:8] */
428#define WM831X_DC2_HC_THR_MASK 0x0070 /* DC2_HC_THR - [6:4] */
429#define WM831X_DC2_HC_THR_SHIFT 4 /* DC2_HC_THR - [6:4] */
430#define WM831X_DC2_HC_THR_WIDTH 3 /* DC2_HC_THR - [6:4] */
431#define WM831X_DC2_HC_IND_ENA 0x0001 /* DC2_HC_IND_ENA */
432#define WM831X_DC2_HC_IND_ENA_MASK 0x0001 /* DC2_HC_IND_ENA */
433#define WM831X_DC2_HC_IND_ENA_SHIFT 0 /* DC2_HC_IND_ENA */
434#define WM831X_DC2_HC_IND_ENA_WIDTH 1 /* DC2_HC_IND_ENA */
435
436/*
437 * R16477 (0x405D) - DC2 ON Config
438 */
439#define WM831X_DC2_ON_SLOT_MASK 0xE000 /* DC2_ON_SLOT - [15:13] */
440#define WM831X_DC2_ON_SLOT_SHIFT 13 /* DC2_ON_SLOT - [15:13] */
441#define WM831X_DC2_ON_SLOT_WIDTH 3 /* DC2_ON_SLOT - [15:13] */
442#define WM831X_DC2_ON_MODE_MASK 0x0300 /* DC2_ON_MODE - [9:8] */
443#define WM831X_DC2_ON_MODE_SHIFT 8 /* DC2_ON_MODE - [9:8] */
444#define WM831X_DC2_ON_MODE_WIDTH 2 /* DC2_ON_MODE - [9:8] */
445#define WM831X_DC2_ON_VSEL_MASK 0x007F /* DC2_ON_VSEL - [6:0] */
446#define WM831X_DC2_ON_VSEL_SHIFT 0 /* DC2_ON_VSEL - [6:0] */
447#define WM831X_DC2_ON_VSEL_WIDTH 7 /* DC2_ON_VSEL - [6:0] */
448
449/*
450 * R16478 (0x405E) - DC2 SLEEP Control
451 */
452#define WM831X_DC2_SLP_SLOT_MASK 0xE000 /* DC2_SLP_SLOT - [15:13] */
453#define WM831X_DC2_SLP_SLOT_SHIFT 13 /* DC2_SLP_SLOT - [15:13] */
454#define WM831X_DC2_SLP_SLOT_WIDTH 3 /* DC2_SLP_SLOT - [15:13] */
455#define WM831X_DC2_SLP_MODE_MASK 0x0300 /* DC2_SLP_MODE - [9:8] */
456#define WM831X_DC2_SLP_MODE_SHIFT 8 /* DC2_SLP_MODE - [9:8] */
457#define WM831X_DC2_SLP_MODE_WIDTH 2 /* DC2_SLP_MODE - [9:8] */
458#define WM831X_DC2_SLP_VSEL_MASK 0x007F /* DC2_SLP_VSEL - [6:0] */
459#define WM831X_DC2_SLP_VSEL_SHIFT 0 /* DC2_SLP_VSEL - [6:0] */
460#define WM831X_DC2_SLP_VSEL_WIDTH 7 /* DC2_SLP_VSEL - [6:0] */
461
462/*
463 * R16479 (0x405F) - DC2 DVS Control
464 */
465#define WM831X_DC2_DVS_SRC_MASK 0x1800 /* DC2_DVS_SRC - [12:11] */
466#define WM831X_DC2_DVS_SRC_SHIFT 11 /* DC2_DVS_SRC - [12:11] */
467#define WM831X_DC2_DVS_SRC_WIDTH 2 /* DC2_DVS_SRC - [12:11] */
468#define WM831X_DC2_DVS_VSEL_MASK 0x007F /* DC2_DVS_VSEL - [6:0] */
469#define WM831X_DC2_DVS_VSEL_SHIFT 0 /* DC2_DVS_VSEL - [6:0] */
470#define WM831X_DC2_DVS_VSEL_WIDTH 7 /* DC2_DVS_VSEL - [6:0] */
471
472/*
473 * R16480 (0x4060) - DC3 Control 1
474 */
475#define WM831X_DC3_PHASE 0x1000 /* DC3_PHASE */
476#define WM831X_DC3_PHASE_MASK 0x1000 /* DC3_PHASE */
477#define WM831X_DC3_PHASE_SHIFT 12 /* DC3_PHASE */
478#define WM831X_DC3_PHASE_WIDTH 1 /* DC3_PHASE */
479#define WM831X_DC3_FLT 0x0080 /* DC3_FLT */
480#define WM831X_DC3_FLT_MASK 0x0080 /* DC3_FLT */
481#define WM831X_DC3_FLT_SHIFT 7 /* DC3_FLT */
482#define WM831X_DC3_FLT_WIDTH 1 /* DC3_FLT */
483#define WM831X_DC3_SOFT_START_MASK 0x0030 /* DC3_SOFT_START - [5:4] */
484#define WM831X_DC3_SOFT_START_SHIFT 4 /* DC3_SOFT_START - [5:4] */
485#define WM831X_DC3_SOFT_START_WIDTH 2 /* DC3_SOFT_START - [5:4] */
486#define WM831X_DC3_STNBY_LIM_MASK 0x000C /* DC3_STNBY_LIM - [3:2] */
487#define WM831X_DC3_STNBY_LIM_SHIFT 2 /* DC3_STNBY_LIM - [3:2] */
488#define WM831X_DC3_STNBY_LIM_WIDTH 2 /* DC3_STNBY_LIM - [3:2] */
489#define WM831X_DC3_CAP_MASK 0x0003 /* DC3_CAP - [1:0] */
490#define WM831X_DC3_CAP_SHIFT 0 /* DC3_CAP - [1:0] */
491#define WM831X_DC3_CAP_WIDTH 2 /* DC3_CAP - [1:0] */
492
493/*
494 * R16481 (0x4061) - DC3 Control 2
495 */
496#define WM831X_DC3_ERR_ACT_MASK 0xC000 /* DC3_ERR_ACT - [15:14] */
497#define WM831X_DC3_ERR_ACT_SHIFT 14 /* DC3_ERR_ACT - [15:14] */
498#define WM831X_DC3_ERR_ACT_WIDTH 2 /* DC3_ERR_ACT - [15:14] */
499#define WM831X_DC3_HWC_SRC_MASK 0x1800 /* DC3_HWC_SRC - [12:11] */
500#define WM831X_DC3_HWC_SRC_SHIFT 11 /* DC3_HWC_SRC - [12:11] */
501#define WM831X_DC3_HWC_SRC_WIDTH 2 /* DC3_HWC_SRC - [12:11] */
502#define WM831X_DC3_HWC_VSEL 0x0400 /* DC3_HWC_VSEL */
503#define WM831X_DC3_HWC_VSEL_MASK 0x0400 /* DC3_HWC_VSEL */
504#define WM831X_DC3_HWC_VSEL_SHIFT 10 /* DC3_HWC_VSEL */
505#define WM831X_DC3_HWC_VSEL_WIDTH 1 /* DC3_HWC_VSEL */
506#define WM831X_DC3_HWC_MODE_MASK 0x0300 /* DC3_HWC_MODE - [9:8] */
507#define WM831X_DC3_HWC_MODE_SHIFT 8 /* DC3_HWC_MODE - [9:8] */
508#define WM831X_DC3_HWC_MODE_WIDTH 2 /* DC3_HWC_MODE - [9:8] */
509#define WM831X_DC3_OVP 0x0080 /* DC3_OVP */
510#define WM831X_DC3_OVP_MASK 0x0080 /* DC3_OVP */
511#define WM831X_DC3_OVP_SHIFT 7 /* DC3_OVP */
512#define WM831X_DC3_OVP_WIDTH 1 /* DC3_OVP */
513
514/*
515 * R16482 (0x4062) - DC3 ON Config
516 */
517#define WM831X_DC3_ON_SLOT_MASK 0xE000 /* DC3_ON_SLOT - [15:13] */
518#define WM831X_DC3_ON_SLOT_SHIFT 13 /* DC3_ON_SLOT - [15:13] */
519#define WM831X_DC3_ON_SLOT_WIDTH 3 /* DC3_ON_SLOT - [15:13] */
520#define WM831X_DC3_ON_MODE_MASK 0x0300 /* DC3_ON_MODE - [9:8] */
521#define WM831X_DC3_ON_MODE_SHIFT 8 /* DC3_ON_MODE - [9:8] */
522#define WM831X_DC3_ON_MODE_WIDTH 2 /* DC3_ON_MODE - [9:8] */
523#define WM831X_DC3_ON_VSEL_MASK 0x007F /* DC3_ON_VSEL - [6:0] */
524#define WM831X_DC3_ON_VSEL_SHIFT 0 /* DC3_ON_VSEL - [6:0] */
525#define WM831X_DC3_ON_VSEL_WIDTH 7 /* DC3_ON_VSEL - [6:0] */
526
527/*
528 * R16483 (0x4063) - DC3 SLEEP Control
529 */
530#define WM831X_DC3_SLP_SLOT_MASK 0xE000 /* DC3_SLP_SLOT - [15:13] */
531#define WM831X_DC3_SLP_SLOT_SHIFT 13 /* DC3_SLP_SLOT - [15:13] */
532#define WM831X_DC3_SLP_SLOT_WIDTH 3 /* DC3_SLP_SLOT - [15:13] */
533#define WM831X_DC3_SLP_MODE_MASK 0x0300 /* DC3_SLP_MODE - [9:8] */
534#define WM831X_DC3_SLP_MODE_SHIFT 8 /* DC3_SLP_MODE - [9:8] */
535#define WM831X_DC3_SLP_MODE_WIDTH 2 /* DC3_SLP_MODE - [9:8] */
536#define WM831X_DC3_SLP_VSEL_MASK 0x007F /* DC3_SLP_VSEL - [6:0] */
537#define WM831X_DC3_SLP_VSEL_SHIFT 0 /* DC3_SLP_VSEL - [6:0] */
538#define WM831X_DC3_SLP_VSEL_WIDTH 7 /* DC3_SLP_VSEL - [6:0] */
539
540/*
541 * R16484 (0x4064) - DC4 Control
542 */
543#define WM831X_DC4_ERR_ACT_MASK 0xC000 /* DC4_ERR_ACT - [15:14] */
544#define WM831X_DC4_ERR_ACT_SHIFT 14 /* DC4_ERR_ACT - [15:14] */
545#define WM831X_DC4_ERR_ACT_WIDTH 2 /* DC4_ERR_ACT - [15:14] */
546#define WM831X_DC4_HWC_SRC_MASK 0x1800 /* DC4_HWC_SRC - [12:11] */
547#define WM831X_DC4_HWC_SRC_SHIFT 11 /* DC4_HWC_SRC - [12:11] */
548#define WM831X_DC4_HWC_SRC_WIDTH 2 /* DC4_HWC_SRC - [12:11] */
549#define WM831X_DC4_HWC_MODE 0x0100 /* DC4_HWC_MODE */
550#define WM831X_DC4_HWC_MODE_MASK 0x0100 /* DC4_HWC_MODE */
551#define WM831X_DC4_HWC_MODE_SHIFT 8 /* DC4_HWC_MODE */
552#define WM831X_DC4_HWC_MODE_WIDTH 1 /* DC4_HWC_MODE */
553#define WM831X_DC4_RANGE_MASK 0x000C /* DC4_RANGE - [3:2] */
554#define WM831X_DC4_RANGE_SHIFT 2 /* DC4_RANGE - [3:2] */
555#define WM831X_DC4_RANGE_WIDTH 2 /* DC4_RANGE - [3:2] */
556#define WM831X_DC4_FBSRC 0x0001 /* DC4_FBSRC */
557#define WM831X_DC4_FBSRC_MASK 0x0001 /* DC4_FBSRC */
558#define WM831X_DC4_FBSRC_SHIFT 0 /* DC4_FBSRC */
559#define WM831X_DC4_FBSRC_WIDTH 1 /* DC4_FBSRC */
560
561/*
562 * R16485 (0x4065) - DC4 SLEEP Control
563 */
564#define WM831X_DC4_SLPENA 0x0100 /* DC4_SLPENA */
565#define WM831X_DC4_SLPENA_MASK 0x0100 /* DC4_SLPENA */
566#define WM831X_DC4_SLPENA_SHIFT 8 /* DC4_SLPENA */
567#define WM831X_DC4_SLPENA_WIDTH 1 /* DC4_SLPENA */
568
569/*
570 * R16488 (0x4068) - LDO1 Control
571 */
572#define WM831X_LDO1_ERR_ACT_MASK 0xC000 /* LDO1_ERR_ACT - [15:14] */
573#define WM831X_LDO1_ERR_ACT_SHIFT 14 /* LDO1_ERR_ACT - [15:14] */
574#define WM831X_LDO1_ERR_ACT_WIDTH 2 /* LDO1_ERR_ACT - [15:14] */
575#define WM831X_LDO1_HWC_SRC_MASK 0x1800 /* LDO1_HWC_SRC - [12:11] */
576#define WM831X_LDO1_HWC_SRC_SHIFT 11 /* LDO1_HWC_SRC - [12:11] */
577#define WM831X_LDO1_HWC_SRC_WIDTH 2 /* LDO1_HWC_SRC - [12:11] */
578#define WM831X_LDO1_HWC_VSEL 0x0400 /* LDO1_HWC_VSEL */
579#define WM831X_LDO1_HWC_VSEL_MASK 0x0400 /* LDO1_HWC_VSEL */
580#define WM831X_LDO1_HWC_VSEL_SHIFT 10 /* LDO1_HWC_VSEL */
581#define WM831X_LDO1_HWC_VSEL_WIDTH 1 /* LDO1_HWC_VSEL */
582#define WM831X_LDO1_HWC_MODE_MASK 0x0300 /* LDO1_HWC_MODE - [9:8] */
583#define WM831X_LDO1_HWC_MODE_SHIFT 8 /* LDO1_HWC_MODE - [9:8] */
584#define WM831X_LDO1_HWC_MODE_WIDTH 2 /* LDO1_HWC_MODE - [9:8] */
585#define WM831X_LDO1_FLT 0x0080 /* LDO1_FLT */
586#define WM831X_LDO1_FLT_MASK 0x0080 /* LDO1_FLT */
587#define WM831X_LDO1_FLT_SHIFT 7 /* LDO1_FLT */
588#define WM831X_LDO1_FLT_WIDTH 1 /* LDO1_FLT */
589#define WM831X_LDO1_SWI 0x0040 /* LDO1_SWI */
590#define WM831X_LDO1_SWI_MASK 0x0040 /* LDO1_SWI */
591#define WM831X_LDO1_SWI_SHIFT 6 /* LDO1_SWI */
592#define WM831X_LDO1_SWI_WIDTH 1 /* LDO1_SWI */
593#define WM831X_LDO1_LP_MODE 0x0001 /* LDO1_LP_MODE */
594#define WM831X_LDO1_LP_MODE_MASK 0x0001 /* LDO1_LP_MODE */
595#define WM831X_LDO1_LP_MODE_SHIFT 0 /* LDO1_LP_MODE */
596#define WM831X_LDO1_LP_MODE_WIDTH 1 /* LDO1_LP_MODE */
597
598/*
599 * R16489 (0x4069) - LDO1 ON Control
600 */
601#define WM831X_LDO1_ON_SLOT_MASK 0xE000 /* LDO1_ON_SLOT - [15:13] */
602#define WM831X_LDO1_ON_SLOT_SHIFT 13 /* LDO1_ON_SLOT - [15:13] */
603#define WM831X_LDO1_ON_SLOT_WIDTH 3 /* LDO1_ON_SLOT - [15:13] */
604#define WM831X_LDO1_ON_MODE 0x0100 /* LDO1_ON_MODE */
605#define WM831X_LDO1_ON_MODE_MASK 0x0100 /* LDO1_ON_MODE */
606#define WM831X_LDO1_ON_MODE_SHIFT 8 /* LDO1_ON_MODE */
607#define WM831X_LDO1_ON_MODE_WIDTH 1 /* LDO1_ON_MODE */
608#define WM831X_LDO1_ON_VSEL_MASK 0x001F /* LDO1_ON_VSEL - [4:0] */
609#define WM831X_LDO1_ON_VSEL_SHIFT 0 /* LDO1_ON_VSEL - [4:0] */
610#define WM831X_LDO1_ON_VSEL_WIDTH 5 /* LDO1_ON_VSEL - [4:0] */
611
612/*
613 * R16490 (0x406A) - LDO1 SLEEP Control
614 */
615#define WM831X_LDO1_SLP_SLOT_MASK 0xE000 /* LDO1_SLP_SLOT - [15:13] */
616#define WM831X_LDO1_SLP_SLOT_SHIFT 13 /* LDO1_SLP_SLOT - [15:13] */
617#define WM831X_LDO1_SLP_SLOT_WIDTH 3 /* LDO1_SLP_SLOT - [15:13] */
618#define WM831X_LDO1_SLP_MODE 0x0100 /* LDO1_SLP_MODE */
619#define WM831X_LDO1_SLP_MODE_MASK 0x0100 /* LDO1_SLP_MODE */
620#define WM831X_LDO1_SLP_MODE_SHIFT 8 /* LDO1_SLP_MODE */
621#define WM831X_LDO1_SLP_MODE_WIDTH 1 /* LDO1_SLP_MODE */
622#define WM831X_LDO1_SLP_VSEL_MASK 0x001F /* LDO1_SLP_VSEL - [4:0] */
623#define WM831X_LDO1_SLP_VSEL_SHIFT 0 /* LDO1_SLP_VSEL - [4:0] */
624#define WM831X_LDO1_SLP_VSEL_WIDTH 5 /* LDO1_SLP_VSEL - [4:0] */
625
626/*
627 * R16491 (0x406B) - LDO2 Control
628 */
629#define WM831X_LDO2_ERR_ACT_MASK 0xC000 /* LDO2_ERR_ACT - [15:14] */
630#define WM831X_LDO2_ERR_ACT_SHIFT 14 /* LDO2_ERR_ACT - [15:14] */
631#define WM831X_LDO2_ERR_ACT_WIDTH 2 /* LDO2_ERR_ACT - [15:14] */
632#define WM831X_LDO2_HWC_SRC_MASK 0x1800 /* LDO2_HWC_SRC - [12:11] */
633#define WM831X_LDO2_HWC_SRC_SHIFT 11 /* LDO2_HWC_SRC - [12:11] */
634#define WM831X_LDO2_HWC_SRC_WIDTH 2 /* LDO2_HWC_SRC - [12:11] */
635#define WM831X_LDO2_HWC_VSEL 0x0400 /* LDO2_HWC_VSEL */
636#define WM831X_LDO2_HWC_VSEL_MASK 0x0400 /* LDO2_HWC_VSEL */
637#define WM831X_LDO2_HWC_VSEL_SHIFT 10 /* LDO2_HWC_VSEL */
638#define WM831X_LDO2_HWC_VSEL_WIDTH 1 /* LDO2_HWC_VSEL */
639#define WM831X_LDO2_HWC_MODE_MASK 0x0300 /* LDO2_HWC_MODE - [9:8] */
640#define WM831X_LDO2_HWC_MODE_SHIFT 8 /* LDO2_HWC_MODE - [9:8] */
641#define WM831X_LDO2_HWC_MODE_WIDTH 2 /* LDO2_HWC_MODE - [9:8] */
642#define WM831X_LDO2_FLT 0x0080 /* LDO2_FLT */
643#define WM831X_LDO2_FLT_MASK 0x0080 /* LDO2_FLT */
644#define WM831X_LDO2_FLT_SHIFT 7 /* LDO2_FLT */
645#define WM831X_LDO2_FLT_WIDTH 1 /* LDO2_FLT */
646#define WM831X_LDO2_SWI 0x0040 /* LDO2_SWI */
647#define WM831X_LDO2_SWI_MASK 0x0040 /* LDO2_SWI */
648#define WM831X_LDO2_SWI_SHIFT 6 /* LDO2_SWI */
649#define WM831X_LDO2_SWI_WIDTH 1 /* LDO2_SWI */
650#define WM831X_LDO2_LP_MODE 0x0001 /* LDO2_LP_MODE */
651#define WM831X_LDO2_LP_MODE_MASK 0x0001 /* LDO2_LP_MODE */
652#define WM831X_LDO2_LP_MODE_SHIFT 0 /* LDO2_LP_MODE */
653#define WM831X_LDO2_LP_MODE_WIDTH 1 /* LDO2_LP_MODE */
654
655/*
656 * R16492 (0x406C) - LDO2 ON Control
657 */
658#define WM831X_LDO2_ON_SLOT_MASK 0xE000 /* LDO2_ON_SLOT - [15:13] */
659#define WM831X_LDO2_ON_SLOT_SHIFT 13 /* LDO2_ON_SLOT - [15:13] */
660#define WM831X_LDO2_ON_SLOT_WIDTH 3 /* LDO2_ON_SLOT - [15:13] */
661#define WM831X_LDO2_ON_MODE 0x0100 /* LDO2_ON_MODE */
662#define WM831X_LDO2_ON_MODE_MASK 0x0100 /* LDO2_ON_MODE */
663#define WM831X_LDO2_ON_MODE_SHIFT 8 /* LDO2_ON_MODE */
664#define WM831X_LDO2_ON_MODE_WIDTH 1 /* LDO2_ON_MODE */
665#define WM831X_LDO2_ON_VSEL_MASK 0x001F /* LDO2_ON_VSEL - [4:0] */
666#define WM831X_LDO2_ON_VSEL_SHIFT 0 /* LDO2_ON_VSEL - [4:0] */
667#define WM831X_LDO2_ON_VSEL_WIDTH 5 /* LDO2_ON_VSEL - [4:0] */
668
669/*
670 * R16493 (0x406D) - LDO2 SLEEP Control
671 */
672#define WM831X_LDO2_SLP_SLOT_MASK 0xE000 /* LDO2_SLP_SLOT - [15:13] */
673#define WM831X_LDO2_SLP_SLOT_SHIFT 13 /* LDO2_SLP_SLOT - [15:13] */
674#define WM831X_LDO2_SLP_SLOT_WIDTH 3 /* LDO2_SLP_SLOT - [15:13] */
675#define WM831X_LDO2_SLP_MODE 0x0100 /* LDO2_SLP_MODE */
676#define WM831X_LDO2_SLP_MODE_MASK 0x0100 /* LDO2_SLP_MODE */
677#define WM831X_LDO2_SLP_MODE_SHIFT 8 /* LDO2_SLP_MODE */
678#define WM831X_LDO2_SLP_MODE_WIDTH 1 /* LDO2_SLP_MODE */
679#define WM831X_LDO2_SLP_VSEL_MASK 0x001F /* LDO2_SLP_VSEL - [4:0] */
680#define WM831X_LDO2_SLP_VSEL_SHIFT 0 /* LDO2_SLP_VSEL - [4:0] */
681#define WM831X_LDO2_SLP_VSEL_WIDTH 5 /* LDO2_SLP_VSEL - [4:0] */
682
683/*
684 * R16494 (0x406E) - LDO3 Control
685 */
686#define WM831X_LDO3_ERR_ACT_MASK 0xC000 /* LDO3_ERR_ACT - [15:14] */
687#define WM831X_LDO3_ERR_ACT_SHIFT 14 /* LDO3_ERR_ACT - [15:14] */
688#define WM831X_LDO3_ERR_ACT_WIDTH 2 /* LDO3_ERR_ACT - [15:14] */
689#define WM831X_LDO3_HWC_SRC_MASK 0x1800 /* LDO3_HWC_SRC - [12:11] */
690#define WM831X_LDO3_HWC_SRC_SHIFT 11 /* LDO3_HWC_SRC - [12:11] */
691#define WM831X_LDO3_HWC_SRC_WIDTH 2 /* LDO3_HWC_SRC - [12:11] */
692#define WM831X_LDO3_HWC_VSEL 0x0400 /* LDO3_HWC_VSEL */
693#define WM831X_LDO3_HWC_VSEL_MASK 0x0400 /* LDO3_HWC_VSEL */
694#define WM831X_LDO3_HWC_VSEL_SHIFT 10 /* LDO3_HWC_VSEL */
695#define WM831X_LDO3_HWC_VSEL_WIDTH 1 /* LDO3_HWC_VSEL */
696#define WM831X_LDO3_HWC_MODE_MASK 0x0300 /* LDO3_HWC_MODE - [9:8] */
697#define WM831X_LDO3_HWC_MODE_SHIFT 8 /* LDO3_HWC_MODE - [9:8] */
698#define WM831X_LDO3_HWC_MODE_WIDTH 2 /* LDO3_HWC_MODE - [9:8] */
699#define WM831X_LDO3_FLT 0x0080 /* LDO3_FLT */
700#define WM831X_LDO3_FLT_MASK 0x0080 /* LDO3_FLT */
701#define WM831X_LDO3_FLT_SHIFT 7 /* LDO3_FLT */
702#define WM831X_LDO3_FLT_WIDTH 1 /* LDO3_FLT */
703#define WM831X_LDO3_SWI 0x0040 /* LDO3_SWI */
704#define WM831X_LDO3_SWI_MASK 0x0040 /* LDO3_SWI */
705#define WM831X_LDO3_SWI_SHIFT 6 /* LDO3_SWI */
706#define WM831X_LDO3_SWI_WIDTH 1 /* LDO3_SWI */
707#define WM831X_LDO3_LP_MODE 0x0001 /* LDO3_LP_MODE */
708#define WM831X_LDO3_LP_MODE_MASK 0x0001 /* LDO3_LP_MODE */
709#define WM831X_LDO3_LP_MODE_SHIFT 0 /* LDO3_LP_MODE */
710#define WM831X_LDO3_LP_MODE_WIDTH 1 /* LDO3_LP_MODE */
711
712/*
713 * R16495 (0x406F) - LDO3 ON Control
714 */
715#define WM831X_LDO3_ON_SLOT_MASK 0xE000 /* LDO3_ON_SLOT - [15:13] */
716#define WM831X_LDO3_ON_SLOT_SHIFT 13 /* LDO3_ON_SLOT - [15:13] */
717#define WM831X_LDO3_ON_SLOT_WIDTH 3 /* LDO3_ON_SLOT - [15:13] */
718#define WM831X_LDO3_ON_MODE 0x0100 /* LDO3_ON_MODE */
719#define WM831X_LDO3_ON_MODE_MASK 0x0100 /* LDO3_ON_MODE */
720#define WM831X_LDO3_ON_MODE_SHIFT 8 /* LDO3_ON_MODE */
721#define WM831X_LDO3_ON_MODE_WIDTH 1 /* LDO3_ON_MODE */
722#define WM831X_LDO3_ON_VSEL_MASK 0x001F /* LDO3_ON_VSEL - [4:0] */
723#define WM831X_LDO3_ON_VSEL_SHIFT 0 /* LDO3_ON_VSEL - [4:0] */
724#define WM831X_LDO3_ON_VSEL_WIDTH 5 /* LDO3_ON_VSEL - [4:0] */
725
726/*
727 * R16496 (0x4070) - LDO3 SLEEP Control
728 */
729#define WM831X_LDO3_SLP_SLOT_MASK 0xE000 /* LDO3_SLP_SLOT - [15:13] */
730#define WM831X_LDO3_SLP_SLOT_SHIFT 13 /* LDO3_SLP_SLOT - [15:13] */
731#define WM831X_LDO3_SLP_SLOT_WIDTH 3 /* LDO3_SLP_SLOT - [15:13] */
732#define WM831X_LDO3_SLP_MODE 0x0100 /* LDO3_SLP_MODE */
733#define WM831X_LDO3_SLP_MODE_MASK 0x0100 /* LDO3_SLP_MODE */
734#define WM831X_LDO3_SLP_MODE_SHIFT 8 /* LDO3_SLP_MODE */
735#define WM831X_LDO3_SLP_MODE_WIDTH 1 /* LDO3_SLP_MODE */
736#define WM831X_LDO3_SLP_VSEL_MASK 0x001F /* LDO3_SLP_VSEL - [4:0] */
737#define WM831X_LDO3_SLP_VSEL_SHIFT 0 /* LDO3_SLP_VSEL - [4:0] */
738#define WM831X_LDO3_SLP_VSEL_WIDTH 5 /* LDO3_SLP_VSEL - [4:0] */
739
740/*
741 * R16497 (0x4071) - LDO4 Control
742 */
743#define WM831X_LDO4_ERR_ACT_MASK 0xC000 /* LDO4_ERR_ACT - [15:14] */
744#define WM831X_LDO4_ERR_ACT_SHIFT 14 /* LDO4_ERR_ACT - [15:14] */
745#define WM831X_LDO4_ERR_ACT_WIDTH 2 /* LDO4_ERR_ACT - [15:14] */
746#define WM831X_LDO4_HWC_SRC_MASK 0x1800 /* LDO4_HWC_SRC - [12:11] */
747#define WM831X_LDO4_HWC_SRC_SHIFT 11 /* LDO4_HWC_SRC - [12:11] */
748#define WM831X_LDO4_HWC_SRC_WIDTH 2 /* LDO4_HWC_SRC - [12:11] */
749#define WM831X_LDO4_HWC_VSEL 0x0400 /* LDO4_HWC_VSEL */
750#define WM831X_LDO4_HWC_VSEL_MASK 0x0400 /* LDO4_HWC_VSEL */
751#define WM831X_LDO4_HWC_VSEL_SHIFT 10 /* LDO4_HWC_VSEL */
752#define WM831X_LDO4_HWC_VSEL_WIDTH 1 /* LDO4_HWC_VSEL */
753#define WM831X_LDO4_HWC_MODE_MASK 0x0300 /* LDO4_HWC_MODE - [9:8] */
754#define WM831X_LDO4_HWC_MODE_SHIFT 8 /* LDO4_HWC_MODE - [9:8] */
755#define WM831X_LDO4_HWC_MODE_WIDTH 2 /* LDO4_HWC_MODE - [9:8] */
756#define WM831X_LDO4_FLT 0x0080 /* LDO4_FLT */
757#define WM831X_LDO4_FLT_MASK 0x0080 /* LDO4_FLT */
758#define WM831X_LDO4_FLT_SHIFT 7 /* LDO4_FLT */
759#define WM831X_LDO4_FLT_WIDTH 1 /* LDO4_FLT */
760#define WM831X_LDO4_SWI 0x0040 /* LDO4_SWI */
761#define WM831X_LDO4_SWI_MASK 0x0040 /* LDO4_SWI */
762#define WM831X_LDO4_SWI_SHIFT 6 /* LDO4_SWI */
763#define WM831X_LDO4_SWI_WIDTH 1 /* LDO4_SWI */
764#define WM831X_LDO4_LP_MODE 0x0001 /* LDO4_LP_MODE */
765#define WM831X_LDO4_LP_MODE_MASK 0x0001 /* LDO4_LP_MODE */
766#define WM831X_LDO4_LP_MODE_SHIFT 0 /* LDO4_LP_MODE */
767#define WM831X_LDO4_LP_MODE_WIDTH 1 /* LDO4_LP_MODE */
768
769/*
770 * R16498 (0x4072) - LDO4 ON Control
771 */
772#define WM831X_LDO4_ON_SLOT_MASK 0xE000 /* LDO4_ON_SLOT - [15:13] */
773#define WM831X_LDO4_ON_SLOT_SHIFT 13 /* LDO4_ON_SLOT - [15:13] */
774#define WM831X_LDO4_ON_SLOT_WIDTH 3 /* LDO4_ON_SLOT - [15:13] */
775#define WM831X_LDO4_ON_MODE 0x0100 /* LDO4_ON_MODE */
776#define WM831X_LDO4_ON_MODE_MASK 0x0100 /* LDO4_ON_MODE */
777#define WM831X_LDO4_ON_MODE_SHIFT 8 /* LDO4_ON_MODE */
778#define WM831X_LDO4_ON_MODE_WIDTH 1 /* LDO4_ON_MODE */
779#define WM831X_LDO4_ON_VSEL_MASK 0x001F /* LDO4_ON_VSEL - [4:0] */
780#define WM831X_LDO4_ON_VSEL_SHIFT 0 /* LDO4_ON_VSEL - [4:0] */
781#define WM831X_LDO4_ON_VSEL_WIDTH 5 /* LDO4_ON_VSEL - [4:0] */
782
783/*
784 * R16499 (0x4073) - LDO4 SLEEP Control
785 */
786#define WM831X_LDO4_SLP_SLOT_MASK 0xE000 /* LDO4_SLP_SLOT - [15:13] */
787#define WM831X_LDO4_SLP_SLOT_SHIFT 13 /* LDO4_SLP_SLOT - [15:13] */
788#define WM831X_LDO4_SLP_SLOT_WIDTH 3 /* LDO4_SLP_SLOT - [15:13] */
789#define WM831X_LDO4_SLP_MODE 0x0100 /* LDO4_SLP_MODE */
790#define WM831X_LDO4_SLP_MODE_MASK 0x0100 /* LDO4_SLP_MODE */
791#define WM831X_LDO4_SLP_MODE_SHIFT 8 /* LDO4_SLP_MODE */
792#define WM831X_LDO4_SLP_MODE_WIDTH 1 /* LDO4_SLP_MODE */
793#define WM831X_LDO4_SLP_VSEL_MASK 0x001F /* LDO4_SLP_VSEL - [4:0] */
794#define WM831X_LDO4_SLP_VSEL_SHIFT 0 /* LDO4_SLP_VSEL - [4:0] */
795#define WM831X_LDO4_SLP_VSEL_WIDTH 5 /* LDO4_SLP_VSEL - [4:0] */
796
797/*
798 * R16500 (0x4074) - LDO5 Control
799 */
800#define WM831X_LDO5_ERR_ACT_MASK 0xC000 /* LDO5_ERR_ACT - [15:14] */
801#define WM831X_LDO5_ERR_ACT_SHIFT 14 /* LDO5_ERR_ACT - [15:14] */
802#define WM831X_LDO5_ERR_ACT_WIDTH 2 /* LDO5_ERR_ACT - [15:14] */
803#define WM831X_LDO5_HWC_SRC_MASK 0x1800 /* LDO5_HWC_SRC - [12:11] */
804#define WM831X_LDO5_HWC_SRC_SHIFT 11 /* LDO5_HWC_SRC - [12:11] */
805#define WM831X_LDO5_HWC_SRC_WIDTH 2 /* LDO5_HWC_SRC - [12:11] */
806#define WM831X_LDO5_HWC_VSEL 0x0400 /* LDO5_HWC_VSEL */
807#define WM831X_LDO5_HWC_VSEL_MASK 0x0400 /* LDO5_HWC_VSEL */
808#define WM831X_LDO5_HWC_VSEL_SHIFT 10 /* LDO5_HWC_VSEL */
809#define WM831X_LDO5_HWC_VSEL_WIDTH 1 /* LDO5_HWC_VSEL */
810#define WM831X_LDO5_HWC_MODE_MASK 0x0300 /* LDO5_HWC_MODE - [9:8] */
811#define WM831X_LDO5_HWC_MODE_SHIFT 8 /* LDO5_HWC_MODE - [9:8] */
812#define WM831X_LDO5_HWC_MODE_WIDTH 2 /* LDO5_HWC_MODE - [9:8] */
813#define WM831X_LDO5_FLT 0x0080 /* LDO5_FLT */
814#define WM831X_LDO5_FLT_MASK 0x0080 /* LDO5_FLT */
815#define WM831X_LDO5_FLT_SHIFT 7 /* LDO5_FLT */
816#define WM831X_LDO5_FLT_WIDTH 1 /* LDO5_FLT */
817#define WM831X_LDO5_SWI 0x0040 /* LDO5_SWI */
818#define WM831X_LDO5_SWI_MASK 0x0040 /* LDO5_SWI */
819#define WM831X_LDO5_SWI_SHIFT 6 /* LDO5_SWI */
820#define WM831X_LDO5_SWI_WIDTH 1 /* LDO5_SWI */
821#define WM831X_LDO5_LP_MODE 0x0001 /* LDO5_LP_MODE */
822#define WM831X_LDO5_LP_MODE_MASK 0x0001 /* LDO5_LP_MODE */
823#define WM831X_LDO5_LP_MODE_SHIFT 0 /* LDO5_LP_MODE */
824#define WM831X_LDO5_LP_MODE_WIDTH 1 /* LDO5_LP_MODE */
825
826/*
827 * R16501 (0x4075) - LDO5 ON Control
828 */
829#define WM831X_LDO5_ON_SLOT_MASK 0xE000 /* LDO5_ON_SLOT - [15:13] */
830#define WM831X_LDO5_ON_SLOT_SHIFT 13 /* LDO5_ON_SLOT - [15:13] */
831#define WM831X_LDO5_ON_SLOT_WIDTH 3 /* LDO5_ON_SLOT - [15:13] */
832#define WM831X_LDO5_ON_MODE 0x0100 /* LDO5_ON_MODE */
833#define WM831X_LDO5_ON_MODE_MASK 0x0100 /* LDO5_ON_MODE */
834#define WM831X_LDO5_ON_MODE_SHIFT 8 /* LDO5_ON_MODE */
835#define WM831X_LDO5_ON_MODE_WIDTH 1 /* LDO5_ON_MODE */
836#define WM831X_LDO5_ON_VSEL_MASK 0x001F /* LDO5_ON_VSEL - [4:0] */
837#define WM831X_LDO5_ON_VSEL_SHIFT 0 /* LDO5_ON_VSEL - [4:0] */
838#define WM831X_LDO5_ON_VSEL_WIDTH 5 /* LDO5_ON_VSEL - [4:0] */
839
840/*
841 * R16502 (0x4076) - LDO5 SLEEP Control
842 */
843#define WM831X_LDO5_SLP_SLOT_MASK 0xE000 /* LDO5_SLP_SLOT - [15:13] */
844#define WM831X_LDO5_SLP_SLOT_SHIFT 13 /* LDO5_SLP_SLOT - [15:13] */
845#define WM831X_LDO5_SLP_SLOT_WIDTH 3 /* LDO5_SLP_SLOT - [15:13] */
846#define WM831X_LDO5_SLP_MODE 0x0100 /* LDO5_SLP_MODE */
847#define WM831X_LDO5_SLP_MODE_MASK 0x0100 /* LDO5_SLP_MODE */
848#define WM831X_LDO5_SLP_MODE_SHIFT 8 /* LDO5_SLP_MODE */
849#define WM831X_LDO5_SLP_MODE_WIDTH 1 /* LDO5_SLP_MODE */
850#define WM831X_LDO5_SLP_VSEL_MASK 0x001F /* LDO5_SLP_VSEL - [4:0] */
851#define WM831X_LDO5_SLP_VSEL_SHIFT 0 /* LDO5_SLP_VSEL - [4:0] */
852#define WM831X_LDO5_SLP_VSEL_WIDTH 5 /* LDO5_SLP_VSEL - [4:0] */
853
854/*
855 * R16503 (0x4077) - LDO6 Control
856 */
857#define WM831X_LDO6_ERR_ACT_MASK 0xC000 /* LDO6_ERR_ACT - [15:14] */
858#define WM831X_LDO6_ERR_ACT_SHIFT 14 /* LDO6_ERR_ACT - [15:14] */
859#define WM831X_LDO6_ERR_ACT_WIDTH 2 /* LDO6_ERR_ACT - [15:14] */
860#define WM831X_LDO6_HWC_SRC_MASK 0x1800 /* LDO6_HWC_SRC - [12:11] */
861#define WM831X_LDO6_HWC_SRC_SHIFT 11 /* LDO6_HWC_SRC - [12:11] */
862#define WM831X_LDO6_HWC_SRC_WIDTH 2 /* LDO6_HWC_SRC - [12:11] */
863#define WM831X_LDO6_HWC_VSEL 0x0400 /* LDO6_HWC_VSEL */
864#define WM831X_LDO6_HWC_VSEL_MASK 0x0400 /* LDO6_HWC_VSEL */
865#define WM831X_LDO6_HWC_VSEL_SHIFT 10 /* LDO6_HWC_VSEL */
866#define WM831X_LDO6_HWC_VSEL_WIDTH 1 /* LDO6_HWC_VSEL */
867#define WM831X_LDO6_HWC_MODE_MASK 0x0300 /* LDO6_HWC_MODE - [9:8] */
868#define WM831X_LDO6_HWC_MODE_SHIFT 8 /* LDO6_HWC_MODE - [9:8] */
869#define WM831X_LDO6_HWC_MODE_WIDTH 2 /* LDO6_HWC_MODE - [9:8] */
870#define WM831X_LDO6_FLT 0x0080 /* LDO6_FLT */
871#define WM831X_LDO6_FLT_MASK 0x0080 /* LDO6_FLT */
872#define WM831X_LDO6_FLT_SHIFT 7 /* LDO6_FLT */
873#define WM831X_LDO6_FLT_WIDTH 1 /* LDO6_FLT */
874#define WM831X_LDO6_SWI 0x0040 /* LDO6_SWI */
875#define WM831X_LDO6_SWI_MASK 0x0040 /* LDO6_SWI */
876#define WM831X_LDO6_SWI_SHIFT 6 /* LDO6_SWI */
877#define WM831X_LDO6_SWI_WIDTH 1 /* LDO6_SWI */
878#define WM831X_LDO6_LP_MODE 0x0001 /* LDO6_LP_MODE */
879#define WM831X_LDO6_LP_MODE_MASK 0x0001 /* LDO6_LP_MODE */
880#define WM831X_LDO6_LP_MODE_SHIFT 0 /* LDO6_LP_MODE */
881#define WM831X_LDO6_LP_MODE_WIDTH 1 /* LDO6_LP_MODE */
882
883/*
884 * R16504 (0x4078) - LDO6 ON Control
885 */
886#define WM831X_LDO6_ON_SLOT_MASK 0xE000 /* LDO6_ON_SLOT - [15:13] */
887#define WM831X_LDO6_ON_SLOT_SHIFT 13 /* LDO6_ON_SLOT - [15:13] */
888#define WM831X_LDO6_ON_SLOT_WIDTH 3 /* LDO6_ON_SLOT - [15:13] */
889#define WM831X_LDO6_ON_MODE 0x0100 /* LDO6_ON_MODE */
890#define WM831X_LDO6_ON_MODE_MASK 0x0100 /* LDO6_ON_MODE */
891#define WM831X_LDO6_ON_MODE_SHIFT 8 /* LDO6_ON_MODE */
892#define WM831X_LDO6_ON_MODE_WIDTH 1 /* LDO6_ON_MODE */
893#define WM831X_LDO6_ON_VSEL_MASK 0x001F /* LDO6_ON_VSEL - [4:0] */
894#define WM831X_LDO6_ON_VSEL_SHIFT 0 /* LDO6_ON_VSEL - [4:0] */
895#define WM831X_LDO6_ON_VSEL_WIDTH 5 /* LDO6_ON_VSEL - [4:0] */
896
897/*
898 * R16505 (0x4079) - LDO6 SLEEP Control
899 */
900#define WM831X_LDO6_SLP_SLOT_MASK 0xE000 /* LDO6_SLP_SLOT - [15:13] */
901#define WM831X_LDO6_SLP_SLOT_SHIFT 13 /* LDO6_SLP_SLOT - [15:13] */
902#define WM831X_LDO6_SLP_SLOT_WIDTH 3 /* LDO6_SLP_SLOT - [15:13] */
903#define WM831X_LDO6_SLP_MODE 0x0100 /* LDO6_SLP_MODE */
904#define WM831X_LDO6_SLP_MODE_MASK 0x0100 /* LDO6_SLP_MODE */
905#define WM831X_LDO6_SLP_MODE_SHIFT 8 /* LDO6_SLP_MODE */
906#define WM831X_LDO6_SLP_MODE_WIDTH 1 /* LDO6_SLP_MODE */
907#define WM831X_LDO6_SLP_VSEL_MASK 0x001F /* LDO6_SLP_VSEL - [4:0] */
908#define WM831X_LDO6_SLP_VSEL_SHIFT 0 /* LDO6_SLP_VSEL - [4:0] */
909#define WM831X_LDO6_SLP_VSEL_WIDTH 5 /* LDO6_SLP_VSEL - [4:0] */
910
911/*
912 * R16506 (0x407A) - LDO7 Control
913 */
914#define WM831X_LDO7_ERR_ACT_MASK 0xC000 /* LDO7_ERR_ACT - [15:14] */
915#define WM831X_LDO7_ERR_ACT_SHIFT 14 /* LDO7_ERR_ACT - [15:14] */
916#define WM831X_LDO7_ERR_ACT_WIDTH 2 /* LDO7_ERR_ACT - [15:14] */
917#define WM831X_LDO7_HWC_SRC_MASK 0x1800 /* LDO7_HWC_SRC - [12:11] */
918#define WM831X_LDO7_HWC_SRC_SHIFT 11 /* LDO7_HWC_SRC - [12:11] */
919#define WM831X_LDO7_HWC_SRC_WIDTH 2 /* LDO7_HWC_SRC - [12:11] */
920#define WM831X_LDO7_HWC_VSEL 0x0400 /* LDO7_HWC_VSEL */
921#define WM831X_LDO7_HWC_VSEL_MASK 0x0400 /* LDO7_HWC_VSEL */
922#define WM831X_LDO7_HWC_VSEL_SHIFT 10 /* LDO7_HWC_VSEL */
923#define WM831X_LDO7_HWC_VSEL_WIDTH 1 /* LDO7_HWC_VSEL */
924#define WM831X_LDO7_HWC_MODE_MASK 0x0300 /* LDO7_HWC_MODE - [9:8] */
925#define WM831X_LDO7_HWC_MODE_SHIFT 8 /* LDO7_HWC_MODE - [9:8] */
926#define WM831X_LDO7_HWC_MODE_WIDTH 2 /* LDO7_HWC_MODE - [9:8] */
927#define WM831X_LDO7_FLT 0x0080 /* LDO7_FLT */
928#define WM831X_LDO7_FLT_MASK 0x0080 /* LDO7_FLT */
929#define WM831X_LDO7_FLT_SHIFT 7 /* LDO7_FLT */
930#define WM831X_LDO7_FLT_WIDTH 1 /* LDO7_FLT */
931#define WM831X_LDO7_SWI 0x0040 /* LDO7_SWI */
932#define WM831X_LDO7_SWI_MASK 0x0040 /* LDO7_SWI */
933#define WM831X_LDO7_SWI_SHIFT 6 /* LDO7_SWI */
934#define WM831X_LDO7_SWI_WIDTH 1 /* LDO7_SWI */
935
936/*
937 * R16507 (0x407B) - LDO7 ON Control
938 */
939#define WM831X_LDO7_ON_SLOT_MASK 0xE000 /* LDO7_ON_SLOT - [15:13] */
940#define WM831X_LDO7_ON_SLOT_SHIFT 13 /* LDO7_ON_SLOT - [15:13] */
941#define WM831X_LDO7_ON_SLOT_WIDTH 3 /* LDO7_ON_SLOT - [15:13] */
942#define WM831X_LDO7_ON_MODE 0x0100 /* LDO7_ON_MODE */
943#define WM831X_LDO7_ON_MODE_MASK 0x0100 /* LDO7_ON_MODE */
944#define WM831X_LDO7_ON_MODE_SHIFT 8 /* LDO7_ON_MODE */
945#define WM831X_LDO7_ON_MODE_WIDTH 1 /* LDO7_ON_MODE */
946#define WM831X_LDO7_ON_VSEL_MASK 0x001F /* LDO7_ON_VSEL - [4:0] */
947#define WM831X_LDO7_ON_VSEL_SHIFT 0 /* LDO7_ON_VSEL - [4:0] */
948#define WM831X_LDO7_ON_VSEL_WIDTH 5 /* LDO7_ON_VSEL - [4:0] */
949
950/*
951 * R16508 (0x407C) - LDO7 SLEEP Control
952 */
953#define WM831X_LDO7_SLP_SLOT_MASK 0xE000 /* LDO7_SLP_SLOT - [15:13] */
954#define WM831X_LDO7_SLP_SLOT_SHIFT 13 /* LDO7_SLP_SLOT - [15:13] */
955#define WM831X_LDO7_SLP_SLOT_WIDTH 3 /* LDO7_SLP_SLOT - [15:13] */
956#define WM831X_LDO7_SLP_MODE 0x0100 /* LDO7_SLP_MODE */
957#define WM831X_LDO7_SLP_MODE_MASK 0x0100 /* LDO7_SLP_MODE */
958#define WM831X_LDO7_SLP_MODE_SHIFT 8 /* LDO7_SLP_MODE */
959#define WM831X_LDO7_SLP_MODE_WIDTH 1 /* LDO7_SLP_MODE */
960#define WM831X_LDO7_SLP_VSEL_MASK 0x001F /* LDO7_SLP_VSEL - [4:0] */
961#define WM831X_LDO7_SLP_VSEL_SHIFT 0 /* LDO7_SLP_VSEL - [4:0] */
962#define WM831X_LDO7_SLP_VSEL_WIDTH 5 /* LDO7_SLP_VSEL - [4:0] */
963
964/*
965 * R16509 (0x407D) - LDO8 Control
966 */
967#define WM831X_LDO8_ERR_ACT_MASK 0xC000 /* LDO8_ERR_ACT - [15:14] */
968#define WM831X_LDO8_ERR_ACT_SHIFT 14 /* LDO8_ERR_ACT - [15:14] */
969#define WM831X_LDO8_ERR_ACT_WIDTH 2 /* LDO8_ERR_ACT - [15:14] */
970#define WM831X_LDO8_HWC_SRC_MASK 0x1800 /* LDO8_HWC_SRC - [12:11] */
971#define WM831X_LDO8_HWC_SRC_SHIFT 11 /* LDO8_HWC_SRC - [12:11] */
972#define WM831X_LDO8_HWC_SRC_WIDTH 2 /* LDO8_HWC_SRC - [12:11] */
973#define WM831X_LDO8_HWC_VSEL 0x0400 /* LDO8_HWC_VSEL */
974#define WM831X_LDO8_HWC_VSEL_MASK 0x0400 /* LDO8_HWC_VSEL */
975#define WM831X_LDO8_HWC_VSEL_SHIFT 10 /* LDO8_HWC_VSEL */
976#define WM831X_LDO8_HWC_VSEL_WIDTH 1 /* LDO8_HWC_VSEL */
977#define WM831X_LDO8_HWC_MODE_MASK 0x0300 /* LDO8_HWC_MODE - [9:8] */
978#define WM831X_LDO8_HWC_MODE_SHIFT 8 /* LDO8_HWC_MODE - [9:8] */
979#define WM831X_LDO8_HWC_MODE_WIDTH 2 /* LDO8_HWC_MODE - [9:8] */
980#define WM831X_LDO8_FLT 0x0080 /* LDO8_FLT */
981#define WM831X_LDO8_FLT_MASK 0x0080 /* LDO8_FLT */
982#define WM831X_LDO8_FLT_SHIFT 7 /* LDO8_FLT */
983#define WM831X_LDO8_FLT_WIDTH 1 /* LDO8_FLT */
984#define WM831X_LDO8_SWI 0x0040 /* LDO8_SWI */
985#define WM831X_LDO8_SWI_MASK 0x0040 /* LDO8_SWI */
986#define WM831X_LDO8_SWI_SHIFT 6 /* LDO8_SWI */
987#define WM831X_LDO8_SWI_WIDTH 1 /* LDO8_SWI */
988
989/*
990 * R16510 (0x407E) - LDO8 ON Control
991 */
992#define WM831X_LDO8_ON_SLOT_MASK 0xE000 /* LDO8_ON_SLOT - [15:13] */
993#define WM831X_LDO8_ON_SLOT_SHIFT 13 /* LDO8_ON_SLOT - [15:13] */
994#define WM831X_LDO8_ON_SLOT_WIDTH 3 /* LDO8_ON_SLOT - [15:13] */
995#define WM831X_LDO8_ON_MODE 0x0100 /* LDO8_ON_MODE */
996#define WM831X_LDO8_ON_MODE_MASK 0x0100 /* LDO8_ON_MODE */
997#define WM831X_LDO8_ON_MODE_SHIFT 8 /* LDO8_ON_MODE */
998#define WM831X_LDO8_ON_MODE_WIDTH 1 /* LDO8_ON_MODE */
999#define WM831X_LDO8_ON_VSEL_MASK 0x001F /* LDO8_ON_VSEL - [4:0] */
1000#define WM831X_LDO8_ON_VSEL_SHIFT 0 /* LDO8_ON_VSEL - [4:0] */
1001#define WM831X_LDO8_ON_VSEL_WIDTH 5 /* LDO8_ON_VSEL - [4:0] */
1002
1003/*
1004 * R16511 (0x407F) - LDO8 SLEEP Control
1005 */
1006#define WM831X_LDO8_SLP_SLOT_MASK 0xE000 /* LDO8_SLP_SLOT - [15:13] */
1007#define WM831X_LDO8_SLP_SLOT_SHIFT 13 /* LDO8_SLP_SLOT - [15:13] */
1008#define WM831X_LDO8_SLP_SLOT_WIDTH 3 /* LDO8_SLP_SLOT - [15:13] */
1009#define WM831X_LDO8_SLP_MODE 0x0100 /* LDO8_SLP_MODE */
1010#define WM831X_LDO8_SLP_MODE_MASK 0x0100 /* LDO8_SLP_MODE */
1011#define WM831X_LDO8_SLP_MODE_SHIFT 8 /* LDO8_SLP_MODE */
1012#define WM831X_LDO8_SLP_MODE_WIDTH 1 /* LDO8_SLP_MODE */
1013#define WM831X_LDO8_SLP_VSEL_MASK 0x001F /* LDO8_SLP_VSEL - [4:0] */
1014#define WM831X_LDO8_SLP_VSEL_SHIFT 0 /* LDO8_SLP_VSEL - [4:0] */
1015#define WM831X_LDO8_SLP_VSEL_WIDTH 5 /* LDO8_SLP_VSEL - [4:0] */
1016
1017/*
1018 * R16512 (0x4080) - LDO9 Control
1019 */
1020#define WM831X_LDO9_ERR_ACT_MASK 0xC000 /* LDO9_ERR_ACT - [15:14] */
1021#define WM831X_LDO9_ERR_ACT_SHIFT 14 /* LDO9_ERR_ACT - [15:14] */
1022#define WM831X_LDO9_ERR_ACT_WIDTH 2 /* LDO9_ERR_ACT - [15:14] */
1023#define WM831X_LDO9_HWC_SRC_MASK 0x1800 /* LDO9_HWC_SRC - [12:11] */
1024#define WM831X_LDO9_HWC_SRC_SHIFT 11 /* LDO9_HWC_SRC - [12:11] */
1025#define WM831X_LDO9_HWC_SRC_WIDTH 2 /* LDO9_HWC_SRC - [12:11] */
1026#define WM831X_LDO9_HWC_VSEL 0x0400 /* LDO9_HWC_VSEL */
1027#define WM831X_LDO9_HWC_VSEL_MASK 0x0400 /* LDO9_HWC_VSEL */
1028#define WM831X_LDO9_HWC_VSEL_SHIFT 10 /* LDO9_HWC_VSEL */
1029#define WM831X_LDO9_HWC_VSEL_WIDTH 1 /* LDO9_HWC_VSEL */
1030#define WM831X_LDO9_HWC_MODE_MASK 0x0300 /* LDO9_HWC_MODE - [9:8] */
1031#define WM831X_LDO9_HWC_MODE_SHIFT 8 /* LDO9_HWC_MODE - [9:8] */
1032#define WM831X_LDO9_HWC_MODE_WIDTH 2 /* LDO9_HWC_MODE - [9:8] */
1033#define WM831X_LDO9_FLT 0x0080 /* LDO9_FLT */
1034#define WM831X_LDO9_FLT_MASK 0x0080 /* LDO9_FLT */
1035#define WM831X_LDO9_FLT_SHIFT 7 /* LDO9_FLT */
1036#define WM831X_LDO9_FLT_WIDTH 1 /* LDO9_FLT */
1037#define WM831X_LDO9_SWI 0x0040 /* LDO9_SWI */
1038#define WM831X_LDO9_SWI_MASK 0x0040 /* LDO9_SWI */
1039#define WM831X_LDO9_SWI_SHIFT 6 /* LDO9_SWI */
1040#define WM831X_LDO9_SWI_WIDTH 1 /* LDO9_SWI */
1041
1042/*
1043 * R16513 (0x4081) - LDO9 ON Control
1044 */
1045#define WM831X_LDO9_ON_SLOT_MASK 0xE000 /* LDO9_ON_SLOT - [15:13] */
1046#define WM831X_LDO9_ON_SLOT_SHIFT 13 /* LDO9_ON_SLOT - [15:13] */
1047#define WM831X_LDO9_ON_SLOT_WIDTH 3 /* LDO9_ON_SLOT - [15:13] */
1048#define WM831X_LDO9_ON_MODE 0x0100 /* LDO9_ON_MODE */
1049#define WM831X_LDO9_ON_MODE_MASK 0x0100 /* LDO9_ON_MODE */
1050#define WM831X_LDO9_ON_MODE_SHIFT 8 /* LDO9_ON_MODE */
1051#define WM831X_LDO9_ON_MODE_WIDTH 1 /* LDO9_ON_MODE */
1052#define WM831X_LDO9_ON_VSEL_MASK 0x001F /* LDO9_ON_VSEL - [4:0] */
1053#define WM831X_LDO9_ON_VSEL_SHIFT 0 /* LDO9_ON_VSEL - [4:0] */
1054#define WM831X_LDO9_ON_VSEL_WIDTH 5 /* LDO9_ON_VSEL - [4:0] */
1055
1056/*
1057 * R16514 (0x4082) - LDO9 SLEEP Control
1058 */
1059#define WM831X_LDO9_SLP_SLOT_MASK 0xE000 /* LDO9_SLP_SLOT - [15:13] */
1060#define WM831X_LDO9_SLP_SLOT_SHIFT 13 /* LDO9_SLP_SLOT - [15:13] */
1061#define WM831X_LDO9_SLP_SLOT_WIDTH 3 /* LDO9_SLP_SLOT - [15:13] */
1062#define WM831X_LDO9_SLP_MODE 0x0100 /* LDO9_SLP_MODE */
1063#define WM831X_LDO9_SLP_MODE_MASK 0x0100 /* LDO9_SLP_MODE */
1064#define WM831X_LDO9_SLP_MODE_SHIFT 8 /* LDO9_SLP_MODE */
1065#define WM831X_LDO9_SLP_MODE_WIDTH 1 /* LDO9_SLP_MODE */
1066#define WM831X_LDO9_SLP_VSEL_MASK 0x001F /* LDO9_SLP_VSEL - [4:0] */
1067#define WM831X_LDO9_SLP_VSEL_SHIFT 0 /* LDO9_SLP_VSEL - [4:0] */
1068#define WM831X_LDO9_SLP_VSEL_WIDTH 5 /* LDO9_SLP_VSEL - [4:0] */
1069
1070/*
1071 * R16515 (0x4083) - LDO10 Control
1072 */
1073#define WM831X_LDO10_ERR_ACT_MASK 0xC000 /* LDO10_ERR_ACT - [15:14] */
1074#define WM831X_LDO10_ERR_ACT_SHIFT 14 /* LDO10_ERR_ACT - [15:14] */
1075#define WM831X_LDO10_ERR_ACT_WIDTH 2 /* LDO10_ERR_ACT - [15:14] */
1076#define WM831X_LDO10_HWC_SRC_MASK 0x1800 /* LDO10_HWC_SRC - [12:11] */
1077#define WM831X_LDO10_HWC_SRC_SHIFT 11 /* LDO10_HWC_SRC - [12:11] */
1078#define WM831X_LDO10_HWC_SRC_WIDTH 2 /* LDO10_HWC_SRC - [12:11] */
1079#define WM831X_LDO10_HWC_VSEL 0x0400 /* LDO10_HWC_VSEL */
1080#define WM831X_LDO10_HWC_VSEL_MASK 0x0400 /* LDO10_HWC_VSEL */
1081#define WM831X_LDO10_HWC_VSEL_SHIFT 10 /* LDO10_HWC_VSEL */
1082#define WM831X_LDO10_HWC_VSEL_WIDTH 1 /* LDO10_HWC_VSEL */
1083#define WM831X_LDO10_HWC_MODE_MASK 0x0300 /* LDO10_HWC_MODE - [9:8] */
1084#define WM831X_LDO10_HWC_MODE_SHIFT 8 /* LDO10_HWC_MODE - [9:8] */
1085#define WM831X_LDO10_HWC_MODE_WIDTH 2 /* LDO10_HWC_MODE - [9:8] */
1086#define WM831X_LDO10_FLT 0x0080 /* LDO10_FLT */
1087#define WM831X_LDO10_FLT_MASK 0x0080 /* LDO10_FLT */
1088#define WM831X_LDO10_FLT_SHIFT 7 /* LDO10_FLT */
1089#define WM831X_LDO10_FLT_WIDTH 1 /* LDO10_FLT */
1090#define WM831X_LDO10_SWI 0x0040 /* LDO10_SWI */
1091#define WM831X_LDO10_SWI_MASK 0x0040 /* LDO10_SWI */
1092#define WM831X_LDO10_SWI_SHIFT 6 /* LDO10_SWI */
1093#define WM831X_LDO10_SWI_WIDTH 1 /* LDO10_SWI */
1094
1095/*
1096 * R16516 (0x4084) - LDO10 ON Control
1097 */
1098#define WM831X_LDO10_ON_SLOT_MASK 0xE000 /* LDO10_ON_SLOT - [15:13] */
1099#define WM831X_LDO10_ON_SLOT_SHIFT 13 /* LDO10_ON_SLOT - [15:13] */
1100#define WM831X_LDO10_ON_SLOT_WIDTH 3 /* LDO10_ON_SLOT - [15:13] */
1101#define WM831X_LDO10_ON_MODE 0x0100 /* LDO10_ON_MODE */
1102#define WM831X_LDO10_ON_MODE_MASK 0x0100 /* LDO10_ON_MODE */
1103#define WM831X_LDO10_ON_MODE_SHIFT 8 /* LDO10_ON_MODE */
1104#define WM831X_LDO10_ON_MODE_WIDTH 1 /* LDO10_ON_MODE */
1105#define WM831X_LDO10_ON_VSEL_MASK 0x001F /* LDO10_ON_VSEL - [4:0] */
1106#define WM831X_LDO10_ON_VSEL_SHIFT 0 /* LDO10_ON_VSEL - [4:0] */
1107#define WM831X_LDO10_ON_VSEL_WIDTH 5 /* LDO10_ON_VSEL - [4:0] */
1108
1109/*
1110 * R16517 (0x4085) - LDO10 SLEEP Control
1111 */
1112#define WM831X_LDO10_SLP_SLOT_MASK 0xE000 /* LDO10_SLP_SLOT - [15:13] */
1113#define WM831X_LDO10_SLP_SLOT_SHIFT 13 /* LDO10_SLP_SLOT - [15:13] */
1114#define WM831X_LDO10_SLP_SLOT_WIDTH 3 /* LDO10_SLP_SLOT - [15:13] */
1115#define WM831X_LDO10_SLP_MODE 0x0100 /* LDO10_SLP_MODE */
1116#define WM831X_LDO10_SLP_MODE_MASK 0x0100 /* LDO10_SLP_MODE */
1117#define WM831X_LDO10_SLP_MODE_SHIFT 8 /* LDO10_SLP_MODE */
1118#define WM831X_LDO10_SLP_MODE_WIDTH 1 /* LDO10_SLP_MODE */
1119#define WM831X_LDO10_SLP_VSEL_MASK 0x001F /* LDO10_SLP_VSEL - [4:0] */
1120#define WM831X_LDO10_SLP_VSEL_SHIFT 0 /* LDO10_SLP_VSEL - [4:0] */
1121#define WM831X_LDO10_SLP_VSEL_WIDTH 5 /* LDO10_SLP_VSEL - [4:0] */
1122
1123/*
1124 * R16519 (0x4087) - LDO11 ON Control
1125 */
1126#define WM831X_LDO11_ON_SLOT_MASK 0xE000 /* LDO11_ON_SLOT - [15:13] */
1127#define WM831X_LDO11_ON_SLOT_SHIFT 13 /* LDO11_ON_SLOT - [15:13] */
1128#define WM831X_LDO11_ON_SLOT_WIDTH 3 /* LDO11_ON_SLOT - [15:13] */
1129#define WM831X_LDO11_OFFENA 0x1000 /* LDO11_OFFENA */
1130#define WM831X_LDO11_OFFENA_MASK 0x1000 /* LDO11_OFFENA */
1131#define WM831X_LDO11_OFFENA_SHIFT 12 /* LDO11_OFFENA */
1132#define WM831X_LDO11_OFFENA_WIDTH 1 /* LDO11_OFFENA */
1133#define WM831X_LDO11_VSEL_SRC 0x0080 /* LDO11_VSEL_SRC */
1134#define WM831X_LDO11_VSEL_SRC_MASK 0x0080 /* LDO11_VSEL_SRC */
1135#define WM831X_LDO11_VSEL_SRC_SHIFT 7 /* LDO11_VSEL_SRC */
1136#define WM831X_LDO11_VSEL_SRC_WIDTH 1 /* LDO11_VSEL_SRC */
1137#define WM831X_LDO11_ON_VSEL_MASK 0x000F /* LDO11_ON_VSEL - [3:0] */
1138#define WM831X_LDO11_ON_VSEL_SHIFT 0 /* LDO11_ON_VSEL - [3:0] */
1139#define WM831X_LDO11_ON_VSEL_WIDTH 4 /* LDO11_ON_VSEL - [3:0] */
1140
1141/*
1142 * R16520 (0x4088) - LDO11 SLEEP Control
1143 */
1144#define WM831X_LDO11_SLP_SLOT_MASK 0xE000 /* LDO11_SLP_SLOT - [15:13] */
1145#define WM831X_LDO11_SLP_SLOT_SHIFT 13 /* LDO11_SLP_SLOT - [15:13] */
1146#define WM831X_LDO11_SLP_SLOT_WIDTH 3 /* LDO11_SLP_SLOT - [15:13] */
1147#define WM831X_LDO11_SLP_VSEL_MASK 0x000F /* LDO11_SLP_VSEL - [3:0] */
1148#define WM831X_LDO11_SLP_VSEL_SHIFT 0 /* LDO11_SLP_VSEL - [3:0] */
1149#define WM831X_LDO11_SLP_VSEL_WIDTH 4 /* LDO11_SLP_VSEL - [3:0] */
1150
1151/*
1152 * R16526 (0x408E) - Power Good Source 1
1153 */
1154#define WM831X_DC4_OK 0x0008 /* DC4_OK */
1155#define WM831X_DC4_OK_MASK 0x0008 /* DC4_OK */
1156#define WM831X_DC4_OK_SHIFT 3 /* DC4_OK */
1157#define WM831X_DC4_OK_WIDTH 1 /* DC4_OK */
1158#define WM831X_DC3_OK 0x0004 /* DC3_OK */
1159#define WM831X_DC3_OK_MASK 0x0004 /* DC3_OK */
1160#define WM831X_DC3_OK_SHIFT 2 /* DC3_OK */
1161#define WM831X_DC3_OK_WIDTH 1 /* DC3_OK */
1162#define WM831X_DC2_OK 0x0002 /* DC2_OK */
1163#define WM831X_DC2_OK_MASK 0x0002 /* DC2_OK */
1164#define WM831X_DC2_OK_SHIFT 1 /* DC2_OK */
1165#define WM831X_DC2_OK_WIDTH 1 /* DC2_OK */
1166#define WM831X_DC1_OK 0x0001 /* DC1_OK */
1167#define WM831X_DC1_OK_MASK 0x0001 /* DC1_OK */
1168#define WM831X_DC1_OK_SHIFT 0 /* DC1_OK */
1169#define WM831X_DC1_OK_WIDTH 1 /* DC1_OK */
1170
1171/*
1172 * R16527 (0x408F) - Power Good Source 2
1173 */
1174#define WM831X_LDO10_OK 0x0200 /* LDO10_OK */
1175#define WM831X_LDO10_OK_MASK 0x0200 /* LDO10_OK */
1176#define WM831X_LDO10_OK_SHIFT 9 /* LDO10_OK */
1177#define WM831X_LDO10_OK_WIDTH 1 /* LDO10_OK */
1178#define WM831X_LDO9_OK 0x0100 /* LDO9_OK */
1179#define WM831X_LDO9_OK_MASK 0x0100 /* LDO9_OK */
1180#define WM831X_LDO9_OK_SHIFT 8 /* LDO9_OK */
1181#define WM831X_LDO9_OK_WIDTH 1 /* LDO9_OK */
1182#define WM831X_LDO8_OK 0x0080 /* LDO8_OK */
1183#define WM831X_LDO8_OK_MASK 0x0080 /* LDO8_OK */
1184#define WM831X_LDO8_OK_SHIFT 7 /* LDO8_OK */
1185#define WM831X_LDO8_OK_WIDTH 1 /* LDO8_OK */
1186#define WM831X_LDO7_OK 0x0040 /* LDO7_OK */
1187#define WM831X_LDO7_OK_MASK 0x0040 /* LDO7_OK */
1188#define WM831X_LDO7_OK_SHIFT 6 /* LDO7_OK */
1189#define WM831X_LDO7_OK_WIDTH 1 /* LDO7_OK */
1190#define WM831X_LDO6_OK 0x0020 /* LDO6_OK */
1191#define WM831X_LDO6_OK_MASK 0x0020 /* LDO6_OK */
1192#define WM831X_LDO6_OK_SHIFT 5 /* LDO6_OK */
1193#define WM831X_LDO6_OK_WIDTH 1 /* LDO6_OK */
1194#define WM831X_LDO5_OK 0x0010 /* LDO5_OK */
1195#define WM831X_LDO5_OK_MASK 0x0010 /* LDO5_OK */
1196#define WM831X_LDO5_OK_SHIFT 4 /* LDO5_OK */
1197#define WM831X_LDO5_OK_WIDTH 1 /* LDO5_OK */
1198#define WM831X_LDO4_OK 0x0008 /* LDO4_OK */
1199#define WM831X_LDO4_OK_MASK 0x0008 /* LDO4_OK */
1200#define WM831X_LDO4_OK_SHIFT 3 /* LDO4_OK */
1201#define WM831X_LDO4_OK_WIDTH 1 /* LDO4_OK */
1202#define WM831X_LDO3_OK 0x0004 /* LDO3_OK */
1203#define WM831X_LDO3_OK_MASK 0x0004 /* LDO3_OK */
1204#define WM831X_LDO3_OK_SHIFT 2 /* LDO3_OK */
1205#define WM831X_LDO3_OK_WIDTH 1 /* LDO3_OK */
1206#define WM831X_LDO2_OK 0x0002 /* LDO2_OK */
1207#define WM831X_LDO2_OK_MASK 0x0002 /* LDO2_OK */
1208#define WM831X_LDO2_OK_SHIFT 1 /* LDO2_OK */
1209#define WM831X_LDO2_OK_WIDTH 1 /* LDO2_OK */
1210#define WM831X_LDO1_OK 0x0001 /* LDO1_OK */
1211#define WM831X_LDO1_OK_MASK 0x0001 /* LDO1_OK */
1212#define WM831X_LDO1_OK_SHIFT 0 /* LDO1_OK */
1213#define WM831X_LDO1_OK_WIDTH 1 /* LDO1_OK */
1214
1215#define WM831X_ISINK_MAX_ISEL 55
1216extern int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1];
1217
1218#endif
diff --git a/include/linux/mfd/wm831x/status.h b/include/linux/mfd/wm831x/status.h
new file mode 100644
index 000000000000..6bc090d0e3ac
--- /dev/null
+++ b/include/linux/mfd/wm831x/status.h
@@ -0,0 +1,34 @@
1/*
2 * include/linux/mfd/wm831x/status.h -- Status LEDs for WM831x
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_WM831X_STATUS_H__
16#define __MFD_WM831X_STATUS_H__
17
18#define WM831X_LED_SRC_MASK 0xC000 /* LED_SRC - [15:14] */
19#define WM831X_LED_SRC_SHIFT 14 /* LED_SRC - [15:14] */
20#define WM831X_LED_SRC_WIDTH 2 /* LED_SRC - [15:14] */
21#define WM831X_LED_MODE_MASK 0x0300 /* LED_MODE - [9:8] */
22#define WM831X_LED_MODE_SHIFT 8 /* LED_MODE - [9:8] */
23#define WM831X_LED_MODE_WIDTH 2 /* LED_MODE - [9:8] */
24#define WM831X_LED_SEQ_LEN_MASK 0x0030 /* LED_SEQ_LEN - [5:4] */
25#define WM831X_LED_SEQ_LEN_SHIFT 4 /* LED_SEQ_LEN - [5:4] */
26#define WM831X_LED_SEQ_LEN_WIDTH 2 /* LED_SEQ_LEN - [5:4] */
27#define WM831X_LED_DUR_MASK 0x000C /* LED_DUR - [3:2] */
28#define WM831X_LED_DUR_SHIFT 2 /* LED_DUR - [3:2] */
29#define WM831X_LED_DUR_WIDTH 2 /* LED_DUR - [3:2] */
30#define WM831X_LED_DUTY_CYC_MASK 0x0003 /* LED_DUTY_CYC - [1:0] */
31#define WM831X_LED_DUTY_CYC_SHIFT 0 /* LED_DUTY_CYC - [1:0] */
32#define WM831X_LED_DUTY_CYC_WIDTH 2 /* LED_DUTY_CYC - [1:0] */
33
34#endif
diff --git a/include/linux/mfd/wm831x/watchdog.h b/include/linux/mfd/wm831x/watchdog.h
new file mode 100644
index 000000000000..97a99b52956f
--- /dev/null
+++ b/include/linux/mfd/wm831x/watchdog.h
@@ -0,0 +1,52 @@
1/*
2 * include/linux/mfd/wm831x/watchdog.h -- Watchdog for WM831x
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_WM831X_WATCHDOG_H__
16#define __MFD_WM831X_WATCHDOG_H__
17
18
19/*
20 * R16388 (0x4004) - Watchdog
21 */
22#define WM831X_WDOG_ENA 0x8000 /* WDOG_ENA */
23#define WM831X_WDOG_ENA_MASK 0x8000 /* WDOG_ENA */
24#define WM831X_WDOG_ENA_SHIFT 15 /* WDOG_ENA */
25#define WM831X_WDOG_ENA_WIDTH 1 /* WDOG_ENA */
26#define WM831X_WDOG_DEBUG 0x4000 /* WDOG_DEBUG */
27#define WM831X_WDOG_DEBUG_MASK 0x4000 /* WDOG_DEBUG */
28#define WM831X_WDOG_DEBUG_SHIFT 14 /* WDOG_DEBUG */
29#define WM831X_WDOG_DEBUG_WIDTH 1 /* WDOG_DEBUG */
30#define WM831X_WDOG_RST_SRC 0x2000 /* WDOG_RST_SRC */
31#define WM831X_WDOG_RST_SRC_MASK 0x2000 /* WDOG_RST_SRC */
32#define WM831X_WDOG_RST_SRC_SHIFT 13 /* WDOG_RST_SRC */
33#define WM831X_WDOG_RST_SRC_WIDTH 1 /* WDOG_RST_SRC */
34#define WM831X_WDOG_SLPENA 0x1000 /* WDOG_SLPENA */
35#define WM831X_WDOG_SLPENA_MASK 0x1000 /* WDOG_SLPENA */
36#define WM831X_WDOG_SLPENA_SHIFT 12 /* WDOG_SLPENA */
37#define WM831X_WDOG_SLPENA_WIDTH 1 /* WDOG_SLPENA */
38#define WM831X_WDOG_RESET 0x0800 /* WDOG_RESET */
39#define WM831X_WDOG_RESET_MASK 0x0800 /* WDOG_RESET */
40#define WM831X_WDOG_RESET_SHIFT 11 /* WDOG_RESET */
41#define WM831X_WDOG_RESET_WIDTH 1 /* WDOG_RESET */
42#define WM831X_WDOG_SECACT_MASK 0x0300 /* WDOG_SECACT - [9:8] */
43#define WM831X_WDOG_SECACT_SHIFT 8 /* WDOG_SECACT - [9:8] */
44#define WM831X_WDOG_SECACT_WIDTH 2 /* WDOG_SECACT - [9:8] */
45#define WM831X_WDOG_PRIMACT_MASK 0x0030 /* WDOG_PRIMACT - [5:4] */
46#define WM831X_WDOG_PRIMACT_SHIFT 4 /* WDOG_PRIMACT - [5:4] */
47#define WM831X_WDOG_PRIMACT_WIDTH 2 /* WDOG_PRIMACT - [5:4] */
48#define WM831X_WDOG_TO_MASK 0x0007 /* WDOG_TO - [2:0] */
49#define WM831X_WDOG_TO_SHIFT 0 /* WDOG_TO - [2:0] */
50#define WM831X_WDOG_TO_WIDTH 3 /* WDOG_TO - [2:0] */
51
52#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca672f340..1d595de6a055 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -605,6 +605,11 @@ struct wm8350_irq {
605 void *data; 605 void *data;
606}; 606};
607 607
608struct wm8350_hwmon {
609 struct platform_device *pdev;
610 struct device *classdev;
611};
612
608struct wm8350 { 613struct wm8350 {
609 struct device *dev; 614 struct device *dev;
610 615
@@ -621,7 +626,6 @@ struct wm8350 {
621 struct mutex auxadc_mutex; 626 struct mutex auxadc_mutex;
622 627
623 /* Interrupt handling */ 628 /* Interrupt handling */
624 struct work_struct irq_work;
625 struct mutex irq_mutex; /* IRQ table mutex */ 629 struct mutex irq_mutex; /* IRQ table mutex */
626 struct wm8350_irq irq[WM8350_NUM_IRQ]; 630 struct wm8350_irq irq[WM8350_NUM_IRQ];
627 int chip_irq; 631 int chip_irq;
@@ -629,6 +633,7 @@ struct wm8350 {
629 /* Client devices */ 633 /* Client devices */
630 struct wm8350_codec codec; 634 struct wm8350_codec codec;
631 struct wm8350_gpio gpio; 635 struct wm8350_gpio gpio;
636 struct wm8350_hwmon hwmon;
632 struct wm8350_pmic pmic; 637 struct wm8350_pmic pmic;
633 struct wm8350_power power; 638 struct wm8350_power power;
634 struct wm8350_rtc rtc; 639 struct wm8350_rtc rtc;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 052117744629..adaf3c15e449 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,7 +41,8 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode; 44 const char *nodename;
45 mode_t mode;
45}; 46};
46 47
47extern int misc_register(struct miscdevice * misc); 48extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9a72cc78e6b8..24c395694f4d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,6 +25,7 @@ extern unsigned long max_mapnr;
25#endif 25#endif
26 26
27extern unsigned long num_physpages; 27extern unsigned long num_physpages;
28extern unsigned long totalram_pages;
28extern void * high_memory; 29extern void * high_memory;
29extern int page_cluster; 30extern int page_cluster;
30 31
@@ -103,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
103#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 104#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
104#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 105#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
105#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 106#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 */
106 108
107#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
108#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -283,6 +285,14 @@ static inline int is_vmalloc_addr(const void *x)
283 return 0; 285 return 0;
284#endif 286#endif
285} 287}
288#ifdef CONFIG_MMU
289extern int is_vmalloc_or_module_addr(const void *x);
290#else
291static inline int is_vmalloc_or_module_addr(const void *x)
292{
293 return 0;
294}
295#endif
286 296
287static inline struct page *compound_head(struct page *page) 297static inline struct page *compound_head(struct page *page)
288{ 298{
@@ -685,11 +695,12 @@ static inline int page_mapped(struct page *page)
685#define VM_FAULT_SIGBUS 0x0002 695#define VM_FAULT_SIGBUS 0x0002
686#define VM_FAULT_MAJOR 0x0004 696#define VM_FAULT_MAJOR 0x0004
687#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ 697#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
698#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */
688 699
689#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 700#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
690#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 701#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
691 702
692#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) 703#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON)
693 704
694/* 705/*
695 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. 706 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
@@ -700,17 +711,8 @@ extern void pagefault_out_of_memory(void);
700 711
701extern void show_free_areas(void); 712extern void show_free_areas(void);
702 713
703#ifdef CONFIG_SHMEM 714int shmem_lock(struct file *file, int lock, struct user_struct *user);
704extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
705#else
706static inline int shmem_lock(struct file *file, int lock,
707 struct user_struct *user)
708{
709 return 0;
710}
711#endif
712struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 715struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
713
714int shmem_zero_setup(struct vm_area_struct *); 716int shmem_zero_setup(struct vm_area_struct *);
715 717
716#ifndef CONFIG_MMU 718#ifndef CONFIG_MMU
@@ -790,8 +792,14 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
790 unmap_mapping_range(mapping, holebegin, holelen, 0); 792 unmap_mapping_range(mapping, holebegin, holelen, 0);
791} 793}
792 794
793extern int vmtruncate(struct inode * inode, loff_t offset); 795extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
794extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end); 796extern int vmtruncate(struct inode *inode, loff_t offset);
797extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
798
799int truncate_inode_page(struct address_space *mapping, struct page *page);
800int generic_error_remove_page(struct address_space *mapping, struct page *page);
801
802int invalidate_inode_page(struct page *page);
795 803
796#ifdef CONFIG_MMU 804#ifdef CONFIG_MMU
797extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 805extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -815,6 +823,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
815 struct page **pages, struct vm_area_struct **vmas); 823 struct page **pages, struct vm_area_struct **vmas);
816int get_user_pages_fast(unsigned long start, int nr_pages, int write, 824int get_user_pages_fast(unsigned long start, int nr_pages, int write,
817 struct page **pages); 825 struct page **pages);
826struct page *get_dump_page(unsigned long addr);
818 827
819extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 828extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
820extern void do_invalidatepage(struct page *page, unsigned long offset); 829extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -1058,6 +1067,8 @@ extern void setup_per_cpu_pageset(void);
1058static inline void setup_per_cpu_pageset(void) {} 1067static inline void setup_per_cpu_pageset(void) {}
1059#endif 1068#endif
1060 1069
1070extern void zone_pcp_update(struct zone *zone);
1071
1061/* nommu.c */ 1072/* nommu.c */
1062extern atomic_long_t mmap_pages_allocated; 1073extern atomic_long_t mmap_pages_allocated;
1063 1074
@@ -1226,7 +1237,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1226#define FOLL_WRITE 0x01 /* check pte is writable */ 1237#define FOLL_WRITE 0x01 /* check pte is writable */
1227#define FOLL_TOUCH 0x02 /* mark page accessed */ 1238#define FOLL_TOUCH 0x02 /* mark page accessed */
1228#define FOLL_GET 0x04 /* do get_page on page */ 1239#define FOLL_GET 0x04 /* do get_page on page */
1229#define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ 1240#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1241#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1230 1242
1231typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1243typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1232 void *data); 1244 void *data);
@@ -1274,7 +1286,7 @@ int in_gate_area_no_task(unsigned long addr);
1274#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1286#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
1275#endif /* __HAVE_ARCH_GATE_AREA */ 1287#endif /* __HAVE_ARCH_GATE_AREA */
1276 1288
1277int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1289int drop_caches_sysctl_handler(struct ctl_table *, int,
1278 void __user *, size_t *, loff_t *); 1290 void __user *, size_t *, loff_t *);
1279unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1291unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1280 unsigned long lru_pages); 1292 unsigned long lru_pages);
@@ -1303,5 +1315,12 @@ void vmemmap_populate_print_last(void);
1303extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, 1315extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1304 size_t size); 1316 size_t size);
1305extern void refund_locked_memory(struct mm_struct *mm, size_t size); 1317extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1318
1319extern void memory_failure(unsigned long pfn, int trapno);
1320extern int __memory_failure(unsigned long pfn, int trapno, int ref);
1321extern int sysctl_memory_failure_early_kill;
1322extern int sysctl_memory_failure_recovery;
1323extern atomic_long_t mce_bad_pages;
1324
1306#endif /* __KERNEL__ */ 1325#endif /* __KERNEL__ */
1307#endif /* _LINUX_MM_H */ 1326#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 7fbb97267556..8835b877b8db 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -5,7 +5,7 @@
5 * page_is_file_cache - should the page be on a file LRU or anon LRU? 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test 6 * @page: the page to test
7 * 7 *
8 * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, 8 * Returns 1 if @page is page cache page backed by a regular filesystem,
9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. 9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
10 * Used by functions that manipulate the LRU lists, to sort a page 10 * Used by functions that manipulate the LRU lists, to sort a page
11 * onto the right LRU list. 11 * onto the right LRU list.
@@ -16,11 +16,7 @@
16 */ 16 */
17static inline int page_is_file_cache(struct page *page) 17static inline int page_is_file_cache(struct page *page)
18{ 18{
19 if (PageSwapBacked(page)) 19 return !PageSwapBacked(page);
20 return 0;
21
22 /* The page is page cache backed by a normal filesystem. */
23 return LRU_FILE;
24} 20}
25 21
26static inline void 22static inline void
@@ -39,21 +35,36 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
39 mem_cgroup_del_lru_list(page, l); 35 mem_cgroup_del_lru_list(page, l);
40} 36}
41 37
38/**
39 * page_lru_base_type - which LRU list type should a page be on?
40 * @page: the page to test
41 *
42 * Used for LRU list index arithmetic.
43 *
44 * Returns the base LRU type - file or anon - @page should be on.
45 */
46static inline enum lru_list page_lru_base_type(struct page *page)
47{
48 if (page_is_file_cache(page))
49 return LRU_INACTIVE_FILE;
50 return LRU_INACTIVE_ANON;
51}
52
42static inline void 53static inline void
43del_page_from_lru(struct zone *zone, struct page *page) 54del_page_from_lru(struct zone *zone, struct page *page)
44{ 55{
45 enum lru_list l = LRU_BASE; 56 enum lru_list l;
46 57
47 list_del(&page->lru); 58 list_del(&page->lru);
48 if (PageUnevictable(page)) { 59 if (PageUnevictable(page)) {
49 __ClearPageUnevictable(page); 60 __ClearPageUnevictable(page);
50 l = LRU_UNEVICTABLE; 61 l = LRU_UNEVICTABLE;
51 } else { 62 } else {
63 l = page_lru_base_type(page);
52 if (PageActive(page)) { 64 if (PageActive(page)) {
53 __ClearPageActive(page); 65 __ClearPageActive(page);
54 l += LRU_ACTIVE; 66 l += LRU_ACTIVE;
55 } 67 }
56 l += page_is_file_cache(page);
57 } 68 }
58 __dec_zone_state(zone, NR_LRU_BASE + l); 69 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l); 70 mem_cgroup_del_lru_list(page, l);
@@ -68,14 +79,14 @@ del_page_from_lru(struct zone *zone, struct page *page)
68 */ 79 */
69static inline enum lru_list page_lru(struct page *page) 80static inline enum lru_list page_lru(struct page *page)
70{ 81{
71 enum lru_list lru = LRU_BASE; 82 enum lru_list lru;
72 83
73 if (PageUnevictable(page)) 84 if (PageUnevictable(page))
74 lru = LRU_UNEVICTABLE; 85 lru = LRU_UNEVICTABLE;
75 else { 86 else {
87 lru = page_lru_base_type(page);
76 if (PageActive(page)) 88 if (PageActive(page))
77 lru += LRU_ACTIVE; 89 lru += LRU_ACTIVE;
78 lru += page_is_file_cache(page);
79 } 90 }
80 91
81 return lru; 92 return lru;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0042090a4d70..84a524afb3dc 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -171,7 +171,7 @@ struct vm_area_struct {
171 struct anon_vma *anon_vma; /* Serialized by page_table_lock */ 171 struct anon_vma *anon_vma; /* Serialized by page_table_lock */
172 172
173 /* Function pointers to deal with this struct. */ 173 /* Function pointers to deal with this struct. */
174 struct vm_operations_struct * vm_ops; 174 const struct vm_operations_struct *vm_ops;
175 175
176 /* Information about our backing store: */ 176 /* Information about our backing store: */
177 unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE 177 unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE
@@ -240,6 +240,8 @@ struct mm_struct {
240 240
241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
242 242
243 struct linux_binfmt *binfmt;
244
243 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
244 246
245 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
@@ -259,11 +261,10 @@ struct mm_struct {
259 unsigned long flags; /* Must use atomic bitops to access the bits */ 261 unsigned long flags; /* Must use atomic bitops to access the bits */
260 262
261 struct core_state *core_state; /* coredumping support */ 263 struct core_state *core_state; /* coredumping support */
262 264#ifdef CONFIG_AIO
263 /* aio bits */
264 spinlock_t ioctx_lock; 265 spinlock_t ioctx_lock;
265 struct hlist_head ioctx_list; 266 struct hlist_head ioctx_list;
266 267#endif
267#ifdef CONFIG_MM_OWNER 268#ifdef CONFIG_MM_OWNER
268 /* 269 /*
269 * "owner" points to a task that is regarded as the canonical 270 * "owner" points to a task that is regarded as the canonical
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 403aa505f27e..2ee22e8af110 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -40,6 +40,8 @@ struct mmc_csd {
40}; 40};
41 41
42struct mmc_ext_csd { 42struct mmc_ext_csd {
43 u8 rev;
44 unsigned int sa_timeout; /* Units: 100ns */
43 unsigned int hs_max_dtr; 45 unsigned int hs_max_dtr;
44 unsigned int sectors; 46 unsigned int sectors;
45}; 47};
@@ -62,7 +64,8 @@ struct sdio_cccr {
62 low_speed:1, 64 low_speed:1,
63 wide_bus:1, 65 wide_bus:1,
64 high_power:1, 66 high_power:1,
65 high_speed:1; 67 high_speed:1,
68 disable_cd:1;
66}; 69};
67 70
68struct sdio_cis { 71struct sdio_cis {
@@ -94,6 +97,8 @@ struct mmc_card {
94#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 97#define MMC_STATE_READONLY (1<<1) /* card is read-only */
95#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 98#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
96#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 */
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
97 102
98 u32 raw_cid[4]; /* raw card CID */ 103 u32 raw_cid[4]; /* raw card CID */
99 u32 raw_csd[4]; /* raw card CSD */ 104 u32 raw_csd[4]; /* raw card CSD */
@@ -129,6 +134,11 @@ struct mmc_card {
129#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 134#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
130#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 135#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
131 136
137static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
138{
139 return c->quirks & MMC_QUIRK_LENIENT_FN0;
140}
141
132#define mmc_card_name(c) ((c)->cid.prod_name) 142#define mmc_card_name(c) ((c)->cid.prod_name)
133#define mmc_card_id(c) (dev_name(&(c)->dev)) 143#define mmc_card_id(c) (dev_name(&(c)->dev))
134 144
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7ac8b500d55c..e4898e9eeb59 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -139,6 +139,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
139 139
140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 140extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
141extern void mmc_release_host(struct mmc_host *host); 141extern void mmc_release_host(struct mmc_host *host);
142extern int mmc_try_claim_host(struct mmc_host *host);
142 143
143/** 144/**
144 * mmc_claim_host - exclusively claim a host 145 * mmc_claim_host - exclusively claim a host
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 3e7615e9087e..eaf36364b7d4 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -11,6 +11,7 @@
11#define LINUX_MMC_HOST_H 11#define LINUX_MMC_HOST_H
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h>
14 15
15#include <linux/mmc/core.h> 16#include <linux/mmc/core.h>
16 17
@@ -51,6 +52,35 @@ struct mmc_ios {
51}; 52};
52 53
53struct mmc_host_ops { 54struct mmc_host_ops {
55 /*
56 * Hosts that support power saving can use the 'enable' and 'disable'
57 * methods to exit and enter power saving states. 'enable' is called
58 * when the host is claimed and 'disable' is called (or scheduled with
59 * a delay) when the host is released. The 'disable' is scheduled if
60 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
61 * otherwise 'disable' is called immediately. 'disable' may be
62 * scheduled repeatedly, to permit ever greater power saving at the
63 * expense of ever greater latency to re-enable. Rescheduling is
64 * determined by the return value of the 'disable' method. A positive
65 * value gives the delay in milliseconds.
66 *
67 * In the case where a host function (like set_ios) may be called
68 * with or without the host claimed, enabling and disabling can be
69 * done directly and will nest correctly. Call 'mmc_host_enable()' and
70 * 'mmc_host_lazy_disable()' for this purpose, but note that these
71 * functions must be paired.
72 *
73 * Alternatively, 'mmc_host_enable()' may be paired with
74 * 'mmc_host_disable()' which calls 'disable' immediately. In this
75 * case the 'disable' method will be called with 'lazy' set to 0.
76 * This is mainly useful for error paths.
77 *
78 * Because lazy disable may be called from a work queue, the 'disable'
79 * method must claim the host when 'lazy' != 0, which will work
80 * correctly because recursion is detected and handled.
81 */
82 int (*enable)(struct mmc_host *host);
83 int (*disable)(struct mmc_host *host, int lazy);
54 void (*request)(struct mmc_host *host, struct mmc_request *req); 84 void (*request)(struct mmc_host *host, struct mmc_request *req);
55 /* 85 /*
56 * Avoid calling these three functions too often or in a "fast path", 86 * Avoid calling these three functions too often or in a "fast path",
@@ -118,6 +148,9 @@ struct mmc_host {
118#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 148#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
119#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 149#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
120#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 150#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
151#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
152#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
153#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
121 154
122 /* host specific block data */ 155 /* host specific block data */
123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 156 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
@@ -142,9 +175,18 @@ struct mmc_host {
142 unsigned int removed:1; /* host is being removed */ 175 unsigned int removed:1; /* host is being removed */
143#endif 176#endif
144 177
178 /* Only used with MMC_CAP_DISABLE */
179 int enabled; /* host is enabled */
180 int nesting_cnt; /* "enable" nesting count */
181 int en_dis_recurs; /* detect recursion */
182 unsigned int disable_delay; /* disable delay in msecs */
183 struct delayed_work disable; /* disabling work */
184
145 struct mmc_card *card; /* device attached to this host */ 185 struct mmc_card *card; /* device attached to this host */
146 186
147 wait_queue_head_t wq; 187 wait_queue_head_t wq;
188 struct task_struct *claimer; /* task that has host claimed */
189 int claim_cnt; /* "claim" nesting count */
148 190
149 struct delayed_work detect; 191 struct delayed_work detect;
150 192
@@ -183,6 +225,9 @@ static inline void *mmc_priv(struct mmc_host *host)
183extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 225extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
184extern int mmc_resume_host(struct mmc_host *); 226extern int mmc_resume_host(struct mmc_host *);
185 227
228extern void mmc_power_save_host(struct mmc_host *host);
229extern void mmc_power_restore_host(struct mmc_host *host);
230
186extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 231extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
187extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 232extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
188 233
@@ -197,5 +242,19 @@ struct regulator;
197int mmc_regulator_get_ocrmask(struct regulator *supply); 242int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 243int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199 244
245int mmc_card_awake(struct mmc_host *host);
246int mmc_card_sleep(struct mmc_host *host);
247int mmc_card_can_sleep(struct mmc_host *host);
248
249int mmc_host_enable(struct mmc_host *host);
250int mmc_host_disable(struct mmc_host *host);
251int mmc_host_lazy_disable(struct mmc_host *host);
252
253static inline void mmc_set_disable_delay(struct mmc_host *host,
254 unsigned int disable_delay)
255{
256 host->disable_delay = disable_delay;
257}
258
200#endif 259#endif
201 260
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 14b81f3e5232..c02c8db73701 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -31,6 +31,7 @@
31#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 31#define MMC_ALL_SEND_CID 2 /* bcr R2 */
32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 32#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
33#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 33#define MMC_SET_DSR 4 /* bc [31:16] RCA */
34#define MMC_SLEEP_AWAKE 5 /* ac [31:16] RCA 15:flg R1b */
34#define MMC_SWITCH 6 /* ac [31:0] See below R1b */ 35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
35#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
36#define MMC_SEND_EXT_CSD 8 /* adtc R1 */ 37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
@@ -127,6 +128,7 @@
127#define R1_STATUS(x) (x & 0xFFFFE000) 128#define R1_STATUS(x) (x & 0xFFFFE000)
128#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 129#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
129#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 130#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
131#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
130#define R1_APP_CMD (1 << 5) /* sr, c */ 132#define R1_APP_CMD (1 << 5) /* sr, c */
131 133
132/* 134/*
@@ -254,6 +256,7 @@ struct _mmc_csd {
254#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_CARD_TYPE 196 /* RO */
255#define EXT_CSD_REV 192 /* RO */ 257#define EXT_CSD_REV 192 /* RO */
256#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
259#define EXT_CSD_S_A_TIMEOUT 217
257 260
258/* 261/*
259 * EXT_CSD field definitions 262 * EXT_CSD field definitions
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 451bdfc85830..ac3ab683fec6 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -67,6 +67,7 @@ struct sdio_func {
67 67
68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) 68#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) 69#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
70#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
70 71
71/* 72/*
72 * SDIO function device driver 73 * SDIO function device driver
@@ -81,6 +82,8 @@ struct sdio_driver {
81 struct device_driver drv; 82 struct device_driver drv;
82}; 83};
83 84
85#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv)
86
84/** 87/**
85 * SDIO_DEVICE - macro used to describe a specific SDIO device 88 * SDIO_DEVICE - macro used to describe a specific SDIO device
86 * @vend: the 16 bit manufacturer code 89 * @vend: the 16 bit manufacturer code
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 39751c8cde9c..2dbfb5a05994 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -22,6 +22,12 @@
22/* 22/*
23 * Vendors and devices. Sort key: vendor first, device next. 23 * Vendors and devices. Sort key: vendor first, device next.
24 */ 24 */
25#define SDIO_VENDOR_ID_INTEL 0x0089
26#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
27#define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403
28#define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404
29#define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405
30#define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406
25 31
26#define SDIO_VENDOR_ID_MARVELL 0x02df 32#define SDIO_VENDOR_ID_MARVELL 0x02df
27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 33#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h
new file mode 100644
index 000000000000..70fffeba7495
--- /dev/null
+++ b/include/linux/mmu_context.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_MMU_CONTEXT_H
2#define _LINUX_MMU_CONTEXT_H
3
4struct mm_struct;
5
6void use_mm(struct mm_struct *mm);
7void unuse_mm(struct mm_struct *mm);
8
9#endif
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index b77486d152cd..4e02ee2b071e 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -62,6 +62,15 @@ struct mmu_notifier_ops {
62 unsigned long address); 62 unsigned long address);
63 63
64 /* 64 /*
65 * change_pte is called in cases that pte mapping to page is changed:
66 * for example, when ksm remaps pte to point to a new shared page.
67 */
68 void (*change_pte)(struct mmu_notifier *mn,
69 struct mm_struct *mm,
70 unsigned long address,
71 pte_t pte);
72
73 /*
65 * Before this is invoked any secondary MMU is still ok to 74 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux 75 * read/write to the page previously pointed to by the Linux
67 * pte because the page hasn't been freed yet and it won't be 76 * pte because the page hasn't been freed yet and it won't be
@@ -154,6 +163,8 @@ extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm); 163extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 164extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address); 165 unsigned long address);
166extern void __mmu_notifier_change_pte(struct mm_struct *mm,
167 unsigned long address, pte_t pte);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm, 168extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address); 169 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm, 170extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
@@ -175,6 +186,13 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
175 return 0; 186 return 0;
176} 187}
177 188
189static inline void mmu_notifier_change_pte(struct mm_struct *mm,
190 unsigned long address, pte_t pte)
191{
192 if (mm_has_notifiers(mm))
193 __mmu_notifier_change_pte(mm, address, pte);
194}
195
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 196static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address) 197 unsigned long address)
180{ 198{
@@ -236,6 +254,16 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
236 __young; \ 254 __young; \
237}) 255})
238 256
257#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
258({ \
259 struct mm_struct *___mm = __mm; \
260 unsigned long ___address = __address; \
261 pte_t ___pte = __pte; \
262 \
263 set_pte_at(___mm, ___address, __ptep, ___pte); \
264 mmu_notifier_change_pte(___mm, ___address, ___pte); \
265})
266
239#else /* CONFIG_MMU_NOTIFIER */ 267#else /* CONFIG_MMU_NOTIFIER */
240 268
241static inline void mmu_notifier_release(struct mm_struct *mm) 269static inline void mmu_notifier_release(struct mm_struct *mm)
@@ -248,6 +276,11 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
248 return 0; 276 return 0;
249} 277}
250 278
279static inline void mmu_notifier_change_pte(struct mm_struct *mm,
280 unsigned long address, pte_t pte)
281{
282}
283
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm, 284static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address) 285 unsigned long address)
253{ 286{
@@ -273,6 +306,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
273 306
274#define ptep_clear_flush_young_notify ptep_clear_flush_young 307#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush 308#define ptep_clear_flush_notify ptep_clear_flush
309#define set_pte_at_notify set_pte_at
276 310
277#endif /* CONFIG_MMU_NOTIFIER */ 311#endif /* CONFIG_MMU_NOTIFIER */
278 312
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 889598537370..6f7561730d88 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,6 +38,7 @@
38#define MIGRATE_UNMOVABLE 0 38#define MIGRATE_UNMOVABLE 0
39#define MIGRATE_RECLAIMABLE 1 39#define MIGRATE_RECLAIMABLE 1
40#define MIGRATE_MOVABLE 2 40#define MIGRATE_MOVABLE 2
41#define MIGRATE_PCPTYPES 3 /* the number of types on the pcp lists */
41#define MIGRATE_RESERVE 3 42#define MIGRATE_RESERVE 3
42#define MIGRATE_ISOLATE 4 /* can't allocate from here */ 43#define MIGRATE_ISOLATE 4 /* can't allocate from here */
43#define MIGRATE_TYPES 5 44#define MIGRATE_TYPES 5
@@ -94,11 +95,15 @@ enum zone_stat_item {
94 NR_SLAB_RECLAIMABLE, 95 NR_SLAB_RECLAIMABLE,
95 NR_SLAB_UNRECLAIMABLE, 96 NR_SLAB_UNRECLAIMABLE,
96 NR_PAGETABLE, /* used for pagetables */ 97 NR_PAGETABLE, /* used for pagetables */
98 NR_KERNEL_STACK,
99 /* Second 128 byte cacheline */
97 NR_UNSTABLE_NFS, /* NFS unstable pages */ 100 NR_UNSTABLE_NFS, /* NFS unstable pages */
98 NR_BOUNCE, 101 NR_BOUNCE,
99 NR_VMSCAN_WRITE, 102 NR_VMSCAN_WRITE,
100 /* Second 128 byte cacheline */
101 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ 103 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
102#ifdef CONFIG_NUMA 107#ifdef CONFIG_NUMA
103 NUMA_HIT, /* allocated in intended node */ 108 NUMA_HIT, /* allocated in intended node */
104 NUMA_MISS, /* allocated in non intended node */ 109 NUMA_MISS, /* allocated in non intended node */
@@ -165,7 +170,9 @@ struct per_cpu_pages {
165 int count; /* number of pages in the list */ 170 int count; /* number of pages in the list */
166 int high; /* high watermark, emptying needed */ 171 int high; /* high watermark, emptying needed */
167 int batch; /* chunk size for buddy add/remove */ 172 int batch; /* chunk size for buddy add/remove */
168 struct list_head list; /* the list of pages */ 173
174 /* Lists of pages, one per migrate type stored on the pcp-lists */
175 struct list_head lists[MIGRATE_PCPTYPES];
169}; 176};
170 177
171struct per_cpu_pageset { 178struct per_cpu_pageset {
@@ -269,6 +276,11 @@ struct zone_reclaim_stat {
269 */ 276 */
270 unsigned long recent_rotated[2]; 277 unsigned long recent_rotated[2];
271 unsigned long recent_scanned[2]; 278 unsigned long recent_scanned[2];
279
280 /*
281 * accumulated for batching
282 */
283 unsigned long nr_saved_scan[NR_LRU_LISTS];
272}; 284};
273 285
274struct zone { 286struct zone {
@@ -323,7 +335,6 @@ struct zone {
323 spinlock_t lru_lock; 335 spinlock_t lru_lock;
324 struct zone_lru { 336 struct zone_lru {
325 struct list_head list; 337 struct list_head list;
326 unsigned long nr_saved_scan; /* accumulated for batching */
327 } lru[NR_LRU_LISTS]; 338 } lru[NR_LRU_LISTS];
328 339
329 struct zone_reclaim_stat reclaim_stat; 340 struct zone_reclaim_stat reclaim_stat;
@@ -744,21 +755,20 @@ static inline int is_dma(struct zone *zone)
744 755
745/* These two functions are used to setup the per zone pages min values */ 756/* These two functions are used to setup the per zone pages min values */
746struct ctl_table; 757struct ctl_table;
747struct file; 758int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
748int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
749 void __user *, size_t *, loff_t *); 759 void __user *, size_t *, loff_t *);
750extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 760extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
751int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 761int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
752 void __user *, size_t *, loff_t *); 762 void __user *, size_t *, loff_t *);
753int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *, 763int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
754 void __user *, size_t *, loff_t *); 764 void __user *, size_t *, loff_t *);
755int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, 765int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
756 struct file *, void __user *, size_t *, loff_t *); 766 void __user *, size_t *, loff_t *);
757int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, 767int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
758 struct file *, void __user *, size_t *, loff_t *); 768 void __user *, size_t *, loff_t *);
759 769
760extern int numa_zonelist_order_handler(struct ctl_table *, int, 770extern int numa_zonelist_order_handler(struct ctl_table *, int,
761 struct file *, void __user *, size_t *, loff_t *); 771 void __user *, size_t *, loff_t *);
762extern char numa_zonelist_order[]; 772extern char numa_zonelist_order[];
763#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ 773#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
764 774
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900ffe43..f58e9d836f32 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,17 @@ struct i2c_device_id {
399 __attribute__((aligned(sizeof(kernel_ulong_t)))); 399 __attribute__((aligned(sizeof(kernel_ulong_t))));
400}; 400};
401 401
402/* spi */
403
404#define SPI_NAME_SIZE 32
405#define SPI_MODULE_PREFIX "spi:"
406
407struct spi_device_id {
408 char name[SPI_NAME_SIZE];
409 kernel_ulong_t driver_data /* Data private to the driver */
410 __attribute__((aligned(sizeof(kernel_ulong_t))));
411};
412
402/* dmi */ 413/* dmi */
403enum dmi_field { 414enum dmi_field {
404 DMI_NONE, 415 DMI_NONE,
diff --git a/include/linux/module.h b/include/linux/module.h
index 098bdb7bfacf..482efc865acf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,12 +15,13 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/marker.h>
19#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
20#include <asm/local.h>
21 19
20#include <asm/local.h>
22#include <asm/module.h> 21#include <asm/module.h>
23 22
23#include <trace/events/module.h>
24
24/* Not Yet Implemented */ 25/* Not Yet Implemented */
25#define MODULE_SUPPORTED_DEVICE(name) 26#define MODULE_SUPPORTED_DEVICE(name)
26 27
@@ -127,7 +128,10 @@ extern struct module __this_module;
127 */ 128 */
128#define MODULE_LICENSE(_license) MODULE_INFO(license, _license) 129#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
129 130
130/* Author, ideally of form NAME[, NAME]*[ and NAME] */ 131/*
132 * Author(s), use "Name <email>" or just "Name", for multiple
133 * authors use multiple MODULE_AUTHOR() statements/lines.
134 */
131#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) 135#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
132 136
133/* What your module does. */ 137/* What your module does. */
@@ -307,10 +311,14 @@ struct module
307#endif 311#endif
308 312
309#ifdef CONFIG_KALLSYMS 313#ifdef CONFIG_KALLSYMS
310 /* We keep the symbol and string tables for kallsyms. */ 314 /*
311 Elf_Sym *symtab; 315 * We keep the symbol and string tables for kallsyms.
312 unsigned int num_symtab; 316 * The core_* fields below are temporary, loader-only (they
313 char *strtab; 317 * could really be discarded after module init).
318 */
319 Elf_Sym *symtab, *core_symtab;
320 unsigned int num_symtab, core_num_syms;
321 char *strtab, *core_strtab;
314 322
315 /* Section attributes */ 323 /* Section attributes */
316 struct module_sect_attrs *sect_attrs; 324 struct module_sect_attrs *sect_attrs;
@@ -325,10 +333,6 @@ struct module
325 /* The command line arguments (may be mangled). People like 333 /* The command line arguments (may be mangled). People like
326 keeping pointers to this stuff */ 334 keeping pointers to this stuff */
327 char *args; 335 char *args;
328#ifdef CONFIG_MARKERS
329 struct marker *markers;
330 unsigned int num_markers;
331#endif
332#ifdef CONFIG_TRACEPOINTS 336#ifdef CONFIG_TRACEPOINTS
333 struct tracepoint *tracepoints; 337 struct tracepoint *tracepoints;
334 unsigned int num_tracepoints; 338 unsigned int num_tracepoints;
@@ -462,7 +466,10 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu)
462static inline void __module_get(struct module *module) 466static inline void __module_get(struct module *module)
463{ 467{
464 if (module) { 468 if (module) {
465 local_inc(__module_ref_addr(module, get_cpu())); 469 unsigned int cpu = get_cpu();
470 local_inc(__module_ref_addr(module, cpu));
471 trace_module_get(module, _THIS_IP_,
472 local_read(__module_ref_addr(module, cpu)));
466 put_cpu(); 473 put_cpu();
467 } 474 }
468} 475}
@@ -473,8 +480,11 @@ static inline int try_module_get(struct module *module)
473 480
474 if (module) { 481 if (module) {
475 unsigned int cpu = get_cpu(); 482 unsigned int cpu = get_cpu();
476 if (likely(module_is_live(module))) 483 if (likely(module_is_live(module))) {
477 local_inc(__module_ref_addr(module, cpu)); 484 local_inc(__module_ref_addr(module, cpu));
485 trace_module_get(module, _THIS_IP_,
486 local_read(__module_ref_addr(module, cpu)));
487 }
478 else 488 else
479 ret = 0; 489 ret = 0;
480 put_cpu(); 490 put_cpu();
@@ -527,8 +537,6 @@ int unregister_module_notifier(struct notifier_block * nb);
527 537
528extern void print_modules(void); 538extern void print_modules(void);
529 539
530extern void module_update_markers(void);
531
532extern void module_update_tracepoints(void); 540extern void module_update_tracepoints(void);
533extern int module_get_iter_tracepoints(struct tracepoint_iter *iter); 541extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
534 542
@@ -643,10 +651,6 @@ static inline void print_modules(void)
643{ 651{
644} 652}
645 653
646static inline void module_update_markers(void)
647{
648}
649
650static inline void module_update_tracepoints(void) 654static inline void module_update_tracepoints(void)
651{ 655{
652} 656}
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 6547c3cdbc4c..82a9124f7d75 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -37,7 +37,6 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
38 38
39/* Flag bits for kernel_param.flags */ 39/* Flag bits for kernel_param.flags */
40#define KPARAM_KMALLOCED 1
41#define KPARAM_ISBOOL 2 40#define KPARAM_ISBOOL 2
42 41
43struct kernel_param { 42struct kernel_param {
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0d45b4e8d367..08bc776d05e2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -145,14 +145,14 @@ static inline int ip_mroute_opt(int opt)
145#endif 145#endif
146 146
147#ifdef CONFIG_IP_MROUTE 147#ifdef CONFIG_IP_MROUTE
148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 148extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 149extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 150extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
151extern int ip_mr_init(void); 151extern int ip_mr_init(void);
152#else 152#else
153static inline 153static inline
154int ip_mroute_setsockopt(struct sock *sock, 154int ip_mroute_setsockopt(struct sock *sock,
155 int optname, char __user *optval, int optlen) 155 int optname, char __user *optval, unsigned int optlen)
156{ 156{
157 return -ENOPROTOOPT; 157 return -ENOPROTOOPT;
158} 158}
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 43dc97e32183..b191865a6ca3 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -134,7 +134,7 @@ static inline int ip6_mroute_opt(int opt)
134struct sock; 134struct sock;
135 135
136#ifdef CONFIG_IPV6_MROUTE 136#ifdef CONFIG_IPV6_MROUTE
137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); 137extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 138extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
139extern int ip6_mr_input(struct sk_buff *skb); 139extern int ip6_mr_input(struct sk_buff *skb);
140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 140extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
@@ -143,7 +143,7 @@ extern void ip6_mr_cleanup(void);
143#else 143#else
144static inline 144static inline
145int ip6_mroute_setsockopt(struct sock *sock, 145int ip6_mroute_setsockopt(struct sock *sock,
146 int optname, char __user *optval, int optlen) 146 int optname, char __user *optval, unsigned int optlen)
147{ 147{
148 return -ENOPROTOOPT; 148 return -ENOPROTOOPT;
149} 149}
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 4030ebada49e..7a232a9bdd62 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -121,6 +121,7 @@ typedef enum {
121 NAND_ECC_SOFT, 121 NAND_ECC_SOFT,
122 NAND_ECC_HW, 122 NAND_ECC_HW,
123 NAND_ECC_HW_SYNDROME, 123 NAND_ECC_HW_SYNDROME,
124 NAND_ECC_HW_OOB_FIRST,
124} nand_ecc_modes_t; 125} nand_ecc_modes_t;
125 126
126/* 127/*
@@ -271,13 +272,13 @@ struct nand_ecc_ctrl {
271 uint8_t *calc_ecc); 272 uint8_t *calc_ecc);
272 int (*read_page_raw)(struct mtd_info *mtd, 273 int (*read_page_raw)(struct mtd_info *mtd,
273 struct nand_chip *chip, 274 struct nand_chip *chip,
274 uint8_t *buf); 275 uint8_t *buf, int page);
275 void (*write_page_raw)(struct mtd_info *mtd, 276 void (*write_page_raw)(struct mtd_info *mtd,
276 struct nand_chip *chip, 277 struct nand_chip *chip,
277 const uint8_t *buf); 278 const uint8_t *buf);
278 int (*read_page)(struct mtd_info *mtd, 279 int (*read_page)(struct mtd_info *mtd,
279 struct nand_chip *chip, 280 struct nand_chip *chip,
280 uint8_t *buf); 281 uint8_t *buf, int page);
281 int (*read_subpage)(struct mtd_info *mtd, 282 int (*read_subpage)(struct mtd_info *mtd,
282 struct nand_chip *chip, 283 struct nand_chip *chip,
283 uint32_t offs, uint32_t len, 284 uint32_t offs, uint32_t len,
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 090da505425d..052ea8ca2434 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -21,6 +21,12 @@ struct mtd_info;
21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); 21int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code);
22 22
23/* 23/*
24 * Detect and correct a 1 bit error for eccsize byte block
25 */
26int __nand_correct_data(u_char *dat, u_char *read_ecc, u_char *calc_ecc,
27 unsigned int eccsize);
28
29/*
24 * Detect and correct a 1 bit error for 256 byte block 30 * Detect and correct a 1 bit error for 256 byte block
25 */ 31 */
26int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); 32int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc);
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 8ed873374381..4e49f3350678 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -214,4 +214,12 @@ unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block); 214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr); 215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
216 216
217struct mtd_partition;
218
219struct onenand_platform_data {
220 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
221 struct mtd_partition *parts;
222 unsigned int nr_parts;
223};
224
217#endif /* __LINUX_MTD_ONENAND_H */ 225#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 86a6bbef6465..acadbf53a69f 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -207,6 +207,9 @@
207#define ONENAND_ECC_2BIT (1 << 1) 207#define ONENAND_ECC_2BIT (1 << 1)
208#define ONENAND_ECC_2BIT_ALL (0xAAAA) 208#define ONENAND_ECC_2BIT_ALL (0xAAAA)
209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010) 209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
210#define ONENAND_ECC_3BIT (1 << 2)
211#define ONENAND_ECC_4BIT (1 << 3)
212#define ONENAND_ECC_4BIT_UNCORRECTABLE (0x1010)
210 213
211/* 214/*
212 * One-Time Programmable (OTP) 215 * One-Time Programmable (OTP)
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index b70313d33ff8..274b6196091d 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * MTD partitioning layer definitions 2 * MTD partitioning layer definitions
3 * 3 *
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@fluxnic.net>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 */ 7 */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d870ae2faedc..ec0f607b364a 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -40,7 +40,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
40 * - follow links at the end 40 * - follow links at the end
41 * - require a directory 41 * - require a directory
42 * - ending slashes ok even for nonexistent files 42 * - ending slashes ok even for nonexistent files
43 * - internal "there are more path compnents" flag 43 * - internal "there are more path components" flag
44 * - locked when lookup done with dcache_lock held 44 * - locked when lookup done with dcache_lock held
45 * - dentry cache is untrusted; force a real lookup 45 * - dentry cache is untrusted; force a real lookup
46 */ 46 */
diff --git a/include/linux/net.h b/include/linux/net.h
index 4fc2ffd527f9..529a0931711d 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -57,6 +57,7 @@ typedef enum {
57#include <linux/random.h> 57#include <linux/random.h>
58#include <linux/wait.h> 58#include <linux/wait.h>
59#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 59#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
60#include <linux/kmemcheck.h>
60 61
61struct poll_table_struct; 62struct poll_table_struct;
62struct pipe_inode_info; 63struct pipe_inode_info;
@@ -127,7 +128,11 @@ enum sock_shutdown_cmd {
127 */ 128 */
128struct socket { 129struct socket {
129 socket_state state; 130 socket_state state;
131
132 kmemcheck_bitfield_begin(type);
130 short type; 133 short type;
134 kmemcheck_bitfield_end(type);
135
131 unsigned long flags; 136 unsigned long flags;
132 /* 137 /*
133 * Please keep fasync_list & wait fields in the same cache line 138 * Please keep fasync_list & wait fields in the same cache line
@@ -173,11 +178,11 @@ struct proto_ops {
173 int (*listen) (struct socket *sock, int len); 178 int (*listen) (struct socket *sock, int len);
174 int (*shutdown) (struct socket *sock, int flags); 179 int (*shutdown) (struct socket *sock, int flags);
175 int (*setsockopt)(struct socket *sock, int level, 180 int (*setsockopt)(struct socket *sock, int level,
176 int optname, char __user *optval, int optlen); 181 int optname, char __user *optval, unsigned int optlen);
177 int (*getsockopt)(struct socket *sock, int level, 182 int (*getsockopt)(struct socket *sock, int level,
178 int optname, char __user *optval, int __user *optlen); 183 int optname, char __user *optval, int __user *optlen);
179 int (*compat_setsockopt)(struct socket *sock, int level, 184 int (*compat_setsockopt)(struct socket *sock, int level,
180 int optname, char __user *optval, int optlen); 185 int optname, char __user *optval, unsigned int optlen);
181 int (*compat_getsockopt)(struct socket *sock, int level, 186 int (*compat_getsockopt)(struct socket *sock, int level,
182 int optname, char __user *optval, int __user *optlen); 187 int optname, char __user *optval, int __user *optlen);
183 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 188 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
@@ -251,7 +256,7 @@ extern int kernel_getpeername(struct socket *sock, struct sockaddr *addr,
251extern int kernel_getsockopt(struct socket *sock, int level, int optname, 256extern int kernel_getsockopt(struct socket *sock, int level, int optname,
252 char *optval, int *optlen); 257 char *optval, int *optlen);
253extern int kernel_setsockopt(struct socket *sock, int level, int optname, 258extern int kernel_setsockopt(struct socket *sock, int level, int optname,
254 char *optval, int optlen); 259 char *optval, unsigned int optlen);
255extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 260extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
256 size_t size, int flags); 261 size_t size, int flags);
257extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 262extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
@@ -308,7 +313,7 @@ SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
308SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 313SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
309SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 314SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
310SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 315SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
311 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \ 316 char __user *optval, unsigned int optlen), (sock, level, optname, optval, optlen)) \
312SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \ 317SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
313 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \ 318 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
314SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \ 319SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
index 3ceb0cc1bc78..2a739462caeb 100644
--- a/include/linux/net_dropmon.h
+++ b/include/linux/net_dropmon.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/types.h>
7 6
8struct net_dm_drop_point { 7struct net_dm_drop_point {
9 __u8 pc[8]; 8 __u8 pc[8];
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d4a4d9867794..812a5f3c2abe 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -72,10 +72,6 @@ struct wireless_dev;
72/* Backlog congestion levels */ 72/* Backlog congestion levels */
73#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 73#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
74#define NET_RX_DROP 1 /* packet dropped */ 74#define NET_RX_DROP 1 /* packet dropped */
75#define NET_RX_CN_LOW 2 /* storm alert, just in case */
76#define NET_RX_CN_MOD 3 /* Storm on its way! */
77#define NET_RX_CN_HIGH 4 /* The storm is here */
78#define NET_RX_BAD 5 /* packet dropped due to kernel error */
79 75
80/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It 76/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
81 * indicates that the device will soon be dropping packets, or already drops 77 * indicates that the device will soon be dropping packets, or already drops
@@ -83,17 +79,19 @@ struct wireless_dev;
83#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) 79#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e))
84#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 80#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
85 81
82/* Driver transmit return codes */
83enum netdev_tx {
84 NETDEV_TX_OK = 0, /* driver took care of packet */
85 NETDEV_TX_BUSY, /* driver tx path was busy*/
86 NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */
87};
88typedef enum netdev_tx netdev_tx_t;
89
86#endif 90#endif
87 91
88#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 92#define MAX_ADDR_LEN 32 /* Largest hardware address length */
89 93
90/* Driver transmit return codes */
91#define NETDEV_TX_OK 0 /* driver took care of packet */
92#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
93#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
94
95#ifdef __KERNEL__ 94#ifdef __KERNEL__
96
97/* 95/*
98 * Compute the worst case header length according to the protocols 96 * Compute the worst case header length according to the protocols
99 * used. 97 * used.
@@ -511,9 +509,11 @@ struct netdev_queue {
511 * This function is called when network device transistions to the down 509 * This function is called when network device transistions to the down
512 * state. 510 * state.
513 * 511 *
514 * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); 512 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
513 * struct net_device *dev);
515 * Called when a packet needs to be transmitted. 514 * Called when a packet needs to be transmitted.
516 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, 515 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY.
516 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
517 * Required can not be NULL. 517 * Required can not be NULL.
518 * 518 *
519 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); 519 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
@@ -557,7 +557,7 @@ struct netdev_queue {
557 * Callback uses when the transmitter has not made any progress 557 * Callback uses when the transmitter has not made any progress
558 * for dev->watchdog ticks. 558 * for dev->watchdog ticks.
559 * 559 *
560 * struct net_device_stats* (*get_stats)(struct net_device *dev); 560 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
561 * Called when a user wants to get the network device usage 561 * Called when a user wants to get the network device usage
562 * statistics. If not defined, the counters in dev->stats will 562 * statistics. If not defined, the counters in dev->stats will
563 * be used. 563 * be used.
@@ -584,7 +584,7 @@ struct net_device_ops {
584 void (*ndo_uninit)(struct net_device *dev); 584 void (*ndo_uninit)(struct net_device *dev);
585 int (*ndo_open)(struct net_device *dev); 585 int (*ndo_open)(struct net_device *dev);
586 int (*ndo_stop)(struct net_device *dev); 586 int (*ndo_stop)(struct net_device *dev);
587 int (*ndo_start_xmit) (struct sk_buff *skb, 587 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,
588 struct net_device *dev); 588 struct net_device *dev);
589 u16 (*ndo_select_queue)(struct net_device *dev, 589 u16 (*ndo_select_queue)(struct net_device *dev,
590 struct sk_buff *skb); 590 struct sk_buff *skb);
@@ -627,6 +627,8 @@ struct net_device_ops {
627 void (*ndo_poll_controller)(struct net_device *dev); 627 void (*ndo_poll_controller)(struct net_device *dev);
628#endif 628#endif
629#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 629#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
630 int (*ndo_fcoe_enable)(struct net_device *dev);
631 int (*ndo_fcoe_disable)(struct net_device *dev);
630 int (*ndo_fcoe_ddp_setup)(struct net_device *dev, 632 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
631 u16 xid, 633 u16 xid,
632 struct scatterlist *sgl, 634 struct scatterlist *sgl,
@@ -705,6 +707,7 @@ struct net_device
705/* the GSO_MASK reserves bits 16 through 23 */ 707/* the GSO_MASK reserves bits 16 through 23 */
706#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 708#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
707#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ 709#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
710#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
708 711
709 /* Segmentation offload features */ 712 /* Segmentation offload features */
710#define NETIF_F_GSO_SHIFT 16 713#define NETIF_F_GSO_SHIFT 16
@@ -829,6 +832,9 @@ struct net_device
829 /* Number of TX queues currently active in device */ 832 /* Number of TX queues currently active in device */
830 unsigned int real_num_tx_queues; 833 unsigned int real_num_tx_queues;
831 834
835 /* root qdisc from userspace point of view */
836 struct Qdisc *qdisc;
837
832 unsigned long tx_queue_len; /* Max frames per queue allowed */ 838 unsigned long tx_queue_len; /* Max frames per queue allowed */
833 spinlock_t tx_global_lock; 839 spinlock_t tx_global_lock;
834/* 840/*
@@ -889,7 +895,7 @@ struct net_device
889 /* class/net/name entry */ 895 /* class/net/name entry */
890 struct device dev; 896 struct device dev;
891 /* space for optional statistics and wireless sysfs groups */ 897 /* space for optional statistics and wireless sysfs groups */
892 struct attribute_group *sysfs_groups[3]; 898 const struct attribute_group *sysfs_groups[3];
893 899
894 /* rtnetlink link ops */ 900 /* rtnetlink link ops */
895 const struct rtnl_link_ops *rtnl_link_ops; 901 const struct rtnl_link_ops *rtnl_link_ops;
@@ -992,6 +998,12 @@ static inline void *netdev_priv(const struct net_device *dev)
992 */ 998 */
993#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 999#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
994 1000
1001/* Set the sysfs device type for the network logical device to allow
1002 * fin grained indentification of different network device types. For
1003 * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
1004 */
1005#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
1006
995/** 1007/**
996 * netif_napi_add - initialize a napi context 1008 * netif_napi_add - initialize a napi context
997 * @dev: network device 1009 * @dev: network device
@@ -1260,7 +1272,7 @@ static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
1260{ 1272{
1261#ifdef CONFIG_NETPOLL_TRAP 1273#ifdef CONFIG_NETPOLL_TRAP
1262 if (netpoll_trap()) { 1274 if (netpoll_trap()) {
1263 clear_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1275 netif_tx_start_queue(dev_queue);
1264 return; 1276 return;
1265 } 1277 }
1266#endif 1278#endif
@@ -1366,7 +1378,8 @@ static inline int netif_running(const struct net_device *dev)
1366static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) 1378static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
1367{ 1379{
1368 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 1380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1369 clear_bit(__QUEUE_STATE_XOFF, &txq->state); 1381
1382 netif_tx_start_queue(txq);
1370} 1383}
1371 1384
1372/** 1385/**
@@ -1383,7 +1396,7 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
1383 if (netpoll_trap()) 1396 if (netpoll_trap())
1384 return; 1397 return;
1385#endif 1398#endif
1386 set_bit(__QUEUE_STATE_XOFF, &txq->state); 1399 netif_tx_stop_queue(txq);
1387} 1400}
1388 1401
1389/** 1402/**
@@ -1397,7 +1410,8 @@ static inline int __netif_subqueue_stopped(const struct net_device *dev,
1397 u16 queue_index) 1410 u16 queue_index)
1398{ 1411{
1399 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 1412 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
1400 return test_bit(__QUEUE_STATE_XOFF, &txq->state); 1413
1414 return netif_tx_queue_stopped(txq);
1401} 1415}
1402 1416
1403static inline int netif_subqueue_stopped(const struct net_device *dev, 1417static inline int netif_subqueue_stopped(const struct net_device *dev,
@@ -1749,8 +1763,7 @@ static inline void netif_tx_unlock(struct net_device *dev)
1749 * force a schedule. 1763 * force a schedule.
1750 */ 1764 */
1751 clear_bit(__QUEUE_STATE_FROZEN, &txq->state); 1765 clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
1752 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state)) 1766 netif_schedule_queue(txq);
1753 __netif_schedule(txq->qdisc);
1754 } 1767 }
1755 spin_unlock(&dev->tx_global_lock); 1768 spin_unlock(&dev->tx_global_lock);
1756} 1769}
@@ -1860,7 +1873,8 @@ extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
1860extern int dev_set_promiscuity(struct net_device *dev, int inc); 1873extern int dev_set_promiscuity(struct net_device *dev, int inc);
1861extern int dev_set_allmulti(struct net_device *dev, int inc); 1874extern int dev_set_allmulti(struct net_device *dev, int inc);
1862extern void netdev_state_change(struct net_device *dev); 1875extern void netdev_state_change(struct net_device *dev);
1863extern void netdev_bonding_change(struct net_device *dev); 1876extern void netdev_bonding_change(struct net_device *dev,
1877 unsigned long event);
1864extern void netdev_features_change(struct net_device *dev); 1878extern void netdev_features_change(struct net_device *dev);
1865/* Load a device via the kmod */ 1879/* Load a device via the kmod */
1866extern void dev_load(struct net *net, const char *name); 1880extern void dev_load(struct net *net, const char *name);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 48cfe51bfddc..6132b5e6d9d3 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -221,12 +221,12 @@ __ret;})
221 221
222/* Call setsockopt() */ 222/* Call setsockopt() */
223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
224 int len); 224 unsigned int len);
225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt, 225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
226 int *len); 226 int *len);
227 227
228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, 228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
229 char __user *opt, int len); 229 char __user *opt, unsigned int len);
230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, 230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
231 char __user *opt, int *len); 231 char __user *opt, int *len);
232 232
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index bff4d5741d98..9f00da287f2c 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -58,7 +58,8 @@ struct nfgenmsg {
58struct nfnl_callback 58struct nfnl_callback
59{ 59{
60 int (*call)(struct sock *nl, struct sk_buff *skb, 60 int (*call)(struct sock *nl, struct sk_buff *skb,
61 struct nlmsghdr *nlh, struct nlattr *cda[]); 61 const struct nlmsghdr *nlh,
62 const struct nlattr * const cda[]);
62 const struct nla_policy *policy; /* netlink attribute policy */ 63 const struct nla_policy *policy; /* netlink attribute policy */
63 const u_int16_t attr_count; /* number of nlattr's */ 64 const u_int16_t attr_count; /* number of nlattr's */
64}; 65};
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 1030b7593898..812cb153cabb 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -238,9 +238,9 @@ struct xt_mtdtor_param {
238 */ 238 */
239struct xt_target_param { 239struct xt_target_param {
240 const struct net_device *in, *out; 240 const struct net_device *in, *out;
241 unsigned int hooknum;
242 const struct xt_target *target; 241 const struct xt_target *target;
243 const void *targinfo; 242 const void *targinfo;
243 unsigned int hooknum;
244 u_int8_t family; 244 u_int8_t family;
245}; 245};
246 246
@@ -407,7 +407,7 @@ extern int xt_check_target(struct xt_tgchk_param *,
407 unsigned int size, u_int8_t proto, bool inv_proto); 407 unsigned int size, u_int8_t proto, bool inv_proto);
408 408
409extern struct xt_table *xt_register_table(struct net *net, 409extern struct xt_table *xt_register_table(struct net *net,
410 struct xt_table *table, 410 const struct xt_table *table,
411 struct xt_table_info *bootstrap, 411 struct xt_table_info *bootstrap,
412 struct xt_table_info *newinfo); 412 struct xt_table_info *newinfo);
413extern void *xt_unregister_table(struct xt_table *table); 413extern void *xt_unregister_table(struct xt_table *table);
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 7635c8ffdadb..0a8545866752 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -18,12 +18,6 @@ enum {
18 XT_CONNMARK_RESTORE 18 XT_CONNMARK_RESTORE
19}; 19};
20 20
21struct xt_connmark_target_info {
22 unsigned long mark;
23 unsigned long mask;
24 __u8 mode;
25};
26
27struct xt_connmark_tginfo1 { 21struct xt_connmark_tginfo1 {
28 __u32 ctmark, ctmask, nfmask; 22 __u32 ctmark, ctmask, nfmask;
29 __u8 mode; 23 __u8 mode;
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index 028304bcc0b1..bc9561bdef79 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -3,23 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/* Version 0 */
7struct xt_mark_target_info {
8 unsigned long mark;
9};
10
11/* Version 1 */
12enum {
13 XT_MARK_SET=0,
14 XT_MARK_AND,
15 XT_MARK_OR,
16};
17
18struct xt_mark_target_info_v1 {
19 unsigned long mark;
20 __u8 mode;
21};
22
23struct xt_mark_tginfo2 { 6struct xt_mark_tginfo2 {
24 __u32 mark, mask; 7 __u32 mark, mask;
25}; 8};
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 571e266d004c..619e47cde01a 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -12,11 +12,6 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15struct xt_connmark_info {
16 unsigned long mark, mask;
17 __u8 invert;
18};
19
20struct xt_connmark_mtinfo1 { 15struct xt_connmark_mtinfo1 {
21 __u32 mark, mask; 16 __u32 mark, mask;
22 __u8 invert; 17 __u8 invert;
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 7ae05338e94c..54f47a2f6152 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -32,42 +32,6 @@ enum {
32 XT_CONNTRACK_DIRECTION = 1 << 12, 32 XT_CONNTRACK_DIRECTION = 1 << 12,
33}; 33};
34 34
35/* This is exposed to userspace, so remains frozen in time. */
36struct ip_conntrack_old_tuple
37{
38 struct {
39 __be32 ip;
40 union {
41 __u16 all;
42 } u;
43 } src;
44
45 struct {
46 __be32 ip;
47 union {
48 __u16 all;
49 } u;
50
51 /* The protocol. */
52 __u16 protonum;
53 } dst;
54};
55
56struct xt_conntrack_info
57{
58 unsigned int statemask, statusmask;
59
60 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
61 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
62
63 unsigned long expires_min, expires_max;
64
65 /* Flags word */
66 __u8 flags;
67 /* Inverse flags */
68 __u8 invflags;
69};
70
71struct xt_conntrack_mtinfo1 { 35struct xt_conntrack_mtinfo1 {
72 union nf_inet_addr origsrc_addr, origsrc_mask; 36 union nf_inet_addr origsrc_addr, origsrc_mask;
73 union nf_inet_addr origdst_addr, origdst_mask; 37 union nf_inet_addr origdst_addr, origdst_mask;
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 6fa460a3cc29..6607c8f38ea5 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -3,11 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct xt_mark_info {
7 unsigned long mark, mask;
8 __u8 invert;
9};
10
11struct xt_mark_mtinfo1 { 6struct xt_mark_mtinfo1 {
12 __u32 mark, mask; 7 __u32 mark, mask;
13 __u8 invert; 8 __u8 invert;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 590ac3d6d5d6..6fe3e6aa10db 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -265,7 +265,7 @@ struct arpt_error
265} 265}
266 266
267extern struct xt_table *arpt_register_table(struct net *net, 267extern struct xt_table *arpt_register_table(struct net *net,
268 struct xt_table *table, 268 const struct xt_table *table,
269 const struct arpt_replace *repl); 269 const struct arpt_replace *repl);
270extern void arpt_unregister_table(struct xt_table *table); 270extern void arpt_unregister_table(struct xt_table *table);
271extern unsigned int arpt_do_table(struct sk_buff *skb, 271extern unsigned int arpt_do_table(struct sk_buff *skb,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index e40ddb94b1af..ea281e6a2048 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -301,7 +301,7 @@ struct ebt_table
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern struct ebt_table *ebt_register_table(struct net *net, 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table); 304 const struct ebt_table *table);
305extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
307 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 3a7105bb8f33..431b40761920 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,46 +1,14 @@
1header-y += ipt_CLASSIFY.h
2header-y += ipt_CLUSTERIP.h 1header-y += ipt_CLUSTERIP.h
3header-y += ipt_CONNMARK.h
4header-y += ipt_DSCP.h
5header-y += ipt_ECN.h 2header-y += ipt_ECN.h
6header-y += ipt_LOG.h 3header-y += ipt_LOG.h
7header-y += ipt_MARK.h
8header-y += ipt_NFQUEUE.h
9header-y += ipt_REJECT.h 4header-y += ipt_REJECT.h
10header-y += ipt_SAME.h 5header-y += ipt_SAME.h
11header-y += ipt_TCPMSS.h
12header-y += ipt_TOS.h
13header-y += ipt_TTL.h 6header-y += ipt_TTL.h
14header-y += ipt_ULOG.h 7header-y += ipt_ULOG.h
15header-y += ipt_addrtype.h 8header-y += ipt_addrtype.h
16header-y += ipt_ah.h 9header-y += ipt_ah.h
17header-y += ipt_comment.h
18header-y += ipt_connbytes.h
19header-y += ipt_connmark.h
20header-y += ipt_conntrack.h
21header-y += ipt_dccp.h
22header-y += ipt_dscp.h
23header-y += ipt_ecn.h 10header-y += ipt_ecn.h
24header-y += ipt_esp.h
25header-y += ipt_hashlimit.h
26header-y += ipt_helper.h
27header-y += ipt_iprange.h
28header-y += ipt_length.h
29header-y += ipt_limit.h
30header-y += ipt_mac.h
31header-y += ipt_mark.h
32header-y += ipt_multiport.h
33header-y += ipt_owner.h
34header-y += ipt_physdev.h
35header-y += ipt_pkttype.h
36header-y += ipt_policy.h
37header-y += ipt_realm.h 11header-y += ipt_realm.h
38header-y += ipt_recent.h
39header-y += ipt_sctp.h
40header-y += ipt_state.h
41header-y += ipt_string.h
42header-y += ipt_tcpmss.h
43header-y += ipt_tos.h
44header-y += ipt_ttl.h 12header-y += ipt_ttl.h
45 13
46unifdef-y += ip_queue.h 14unifdef-y += ip_queue.h
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 092bd50581a9..61fafc868a7b 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -245,7 +245,7 @@ ipt_get_target(struct ipt_entry *e)
245extern void ipt_init(void) __init; 245extern void ipt_init(void) __init;
246 246
247extern struct xt_table *ipt_register_table(struct net *net, 247extern struct xt_table *ipt_register_table(struct net *net,
248 struct xt_table *table, 248 const struct xt_table *table,
249 const struct ipt_replace *repl); 249 const struct ipt_replace *repl);
250extern void ipt_unregister_table(struct xt_table *table); 250extern void ipt_unregister_table(struct xt_table *table);
251 251
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 100644
index a46d511b5c36..000000000000
--- a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_CLASSIFY_H
2#define _IPT_CLASSIFY_H
3
4#include <linux/netfilter/xt_CLASSIFY.h>
5#define ipt_classify_target_info xt_classify_target_info
6
7#endif /*_IPT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
deleted file mode 100644
index 9ecfee0a9e33..000000000000
--- a/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _IPT_CONNMARK_H_target
2#define _IPT_CONNMARK_H_target
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12#include <linux/netfilter/xt_CONNMARK.h>
13#define IPT_CONNMARK_SET XT_CONNMARK_SET
14#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE
15#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE
16
17#define ipt_connmark_target_info xt_connmark_target_info
18
19#endif /*_IPT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_DSCP.h b/include/linux/netfilter_ipv4/ipt_DSCP.h
deleted file mode 100644
index 3491e524d5ea..000000000000
--- a/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* iptables module for setting the IPv4 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
5 * This software is distributed under GNU GPL v2, 1991
6 *
7 * See RFC2474 for a description of the DSCP field within the IP Header.
8 *
9 * ipt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
10*/
11#ifndef _IPT_DSCP_TARGET_H
12#define _IPT_DSCP_TARGET_H
13#include <linux/netfilter_ipv4/ipt_dscp.h>
14#include <linux/netfilter/xt_DSCP.h>
15
16#define ipt_DSCP_info xt_DSCP_info
17
18#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h
index 94e0d9866469..7ca45918ab8e 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,9 +8,9 @@
8*/ 8*/
9#ifndef _IPT_ECN_TARGET_H 9#ifndef _IPT_ECN_TARGET_H
10#define _IPT_ECN_TARGET_H 10#define _IPT_ECN_TARGET_H
11#include <linux/netfilter_ipv4/ipt_DSCP.h> 11#include <linux/netfilter/xt_DSCP.h>
12 12
13#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) 13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
14 14
15#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */ 15#define IPT_ECN_OP_SET_IP 0x01 /* set ECN bits of IPv4 header */
16#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */ 16#define IPT_ECN_OP_SET_ECE 0x10 /* set ECE bit of TCP header */
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
deleted file mode 100644
index 697a486a96d3..000000000000
--- a/include/linux/netfilter_ipv4/ipt_MARK.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IPT_MARK_H_target
2#define _IPT_MARK_H_target
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_MARK.h>
7
8/* Version 0 */
9#define ipt_mark_target_info xt_mark_target_info
10
11/* Version 1 */
12#define IPT_MARK_SET XT_MARK_SET
13#define IPT_MARK_AND XT_MARK_AND
14#define IPT_MARK_OR XT_MARK_OR
15
16#define ipt_mark_target_info_v1 xt_mark_target_info_v1
17
18#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
deleted file mode 100644
index 97a2a7557cb9..000000000000
--- a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H
10
11/* Backwards compatibility for old userspace */
12#include <linux/netfilter/xt_NFQUEUE.h>
13
14#define ipt_NFQ_info xt_NFQ_info
15
16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/include/linux/netfilter_ipv4/ipt_TCPMSS.h
deleted file mode 100644
index 7a850f945824..000000000000
--- a/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IPT_TCPMSS_H
2#define _IPT_TCPMSS_H
3
4#include <linux/netfilter/xt_TCPMSS.h>
5
6#define ipt_tcpmss_info xt_tcpmss_info
7#define IPT_TCPMSS_CLAMP_PMTU XT_TCPMSS_CLAMP_PMTU
8
9#endif /*_IPT_TCPMSS_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_TOS.h b/include/linux/netfilter_ipv4/ipt_TOS.h
deleted file mode 100644
index 6bf9e1fdfd88..000000000000
--- a/include/linux/netfilter_ipv4/ipt_TOS.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _IPT_TOS_H_target
2#define _IPT_TOS_H_target
3
4#ifndef IPTOS_NORMALSVC
5#define IPTOS_NORMALSVC 0
6#endif
7
8struct ipt_tos_target_info {
9 u_int8_t tos;
10};
11
12#endif /*_IPT_TOS_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h
deleted file mode 100644
index ae2afc2f7481..000000000000
--- a/include/linux/netfilter_ipv4/ipt_comment.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_COMMENT_H
2#define _IPT_COMMENT_H
3
4#include <linux/netfilter/xt_comment.h>
5
6#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
7
8#define ipt_comment_info xt_comment_info
9
10#endif /* _IPT_COMMENT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
deleted file mode 100644
index f63e6ee91113..000000000000
--- a/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H
3
4#include <linux/netfilter/xt_connbytes.h>
5#define ipt_connbytes_what xt_connbytes_what
6
7#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PKTS
8#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES
9#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT
10
11#define ipt_connbytes_direction xt_connbytes_direction
12#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL
13#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY
14#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH
15
16#define ipt_connbytes_info xt_connbytes_info
17
18#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connmark.h b/include/linux/netfilter_ipv4/ipt_connmark.h
deleted file mode 100644
index c7ba6560d44c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_connmark.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_CONNMARK_H
2#define _IPT_CONNMARK_H
3
4#include <linux/netfilter/xt_connmark.h>
5#define ipt_connmark_info xt_connmark_info
6
7#endif /*_IPT_CONNMARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_conntrack.h b/include/linux/netfilter_ipv4/ipt_conntrack.h
deleted file mode 100644
index cde6762949c5..000000000000
--- a/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/* Header file for kernel module to match connection tracking information.
2 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca).
3 */
4
5#ifndef _IPT_CONNTRACK_H
6#define _IPT_CONNTRACK_H
7
8#include <linux/netfilter/xt_conntrack.h>
9
10#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
11#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID
12
13#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT
14#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT
15#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED
16
17/* flags, invflags: */
18#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE
19#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO
20#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC
21#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST
22#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC
23#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST
24#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS
25#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES
26
27#define ipt_conntrack_info xt_conntrack_info
28#endif /*_IPT_CONNTRACK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
deleted file mode 100644
index e70d11e1f53c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_dccp.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_
3
4#include <linux/netfilter/xt_dccp.h>
5#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS
6#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS
7#define IPT_DCCP_TYPE XT_DCCP_TYPE
8#define IPT_DCCP_OPTION XT_DCCP_OPTION
9
10#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS
11
12#define ipt_dccp_info xt_dccp_info
13
14#endif /* _IPT_DCCP_H_ */
15
diff --git a/include/linux/netfilter_ipv4/ipt_dscp.h b/include/linux/netfilter_ipv4/ipt_dscp.h
deleted file mode 100644
index 4b82ca912b0e..000000000000
--- a/include/linux/netfilter_ipv4/ipt_dscp.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* iptables module for matching the IPv4 DSCP field
2 *
3 * (C) 2002 Harald Welte <laforge@gnumonks.org>
4 * This software is distributed under GNU GPL v2, 1991
5 *
6 * See RFC2474 for a description of the DSCP field within the IP Header.
7 *
8 * ipt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
9*/
10#ifndef _IPT_DSCP_H
11#define _IPT_DSCP_H
12
13#include <linux/netfilter/xt_dscp.h>
14
15#define IPT_DSCP_MASK XT_DSCP_MASK
16#define IPT_DSCP_SHIFT XT_DSCP_SHIFT
17#define IPT_DSCP_MAX XT_DSCP_MAX
18
19#define ipt_dscp_info xt_dscp_info
20
21#endif /* _IPT_DSCP_H */
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index 1f0d9a4d3378..9945baa4ccd7 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -8,9 +8,9 @@
8*/ 8*/
9#ifndef _IPT_ECN_H 9#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 10#define _IPT_ECN_H
11#include <linux/netfilter_ipv4/ipt_dscp.h> 11#include <linux/netfilter/xt_dscp.h>
12 12
13#define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) 13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
14 14
15#define IPT_ECN_OP_MATCH_IP 0x01 15#define IPT_ECN_OP_MATCH_IP 0x01
16#define IPT_ECN_OP_MATCH_ECE 0x10 16#define IPT_ECN_OP_MATCH_ECE 0x10
diff --git a/include/linux/netfilter_ipv4/ipt_esp.h b/include/linux/netfilter_ipv4/ipt_esp.h
deleted file mode 100644
index 78296e7eeff9..000000000000
--- a/include/linux/netfilter_ipv4/ipt_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_ESP_H
2#define _IPT_ESP_H
3
4#include <linux/netfilter/xt_esp.h>
5
6#define ipt_esp xt_esp
7#define IPT_ESP_INV_SPI XT_ESP_INV_SPI
8#define IPT_ESP_INV_MASK XT_ESP_INV_MASK
9
10#endif /*_IPT_ESP_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_hashlimit.h b/include/linux/netfilter_ipv4/ipt_hashlimit.h
deleted file mode 100644
index 5662120a3d7b..000000000000
--- a/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _IPT_HASHLIMIT_H
2#define _IPT_HASHLIMIT_H
3
4#include <linux/netfilter/xt_hashlimit.h>
5
6#define IPT_HASHLIMIT_SCALE XT_HASHLIMIT_SCALE
7#define IPT_HASHLIMIT_HASH_DIP XT_HASHLIMIT_HASH_DIP
8#define IPT_HASHLIMIT_HASH_DPT XT_HASHLIMIT_HASH_DPT
9#define IPT_HASHLIMIT_HASH_SIP XT_HASHLIMIT_HASH_SIP
10#define IPT_HASHLIMIT_HASH_SPT XT_HASHLIMIT_HASH_SPT
11
12#define ipt_hashlimit_info xt_hashlimit_info
13
14#endif /* _IPT_HASHLIMIT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_helper.h b/include/linux/netfilter_ipv4/ipt_helper.h
deleted file mode 100644
index 80452c218551..000000000000
--- a/include/linux/netfilter_ipv4/ipt_helper.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_HELPER_H
2#define _IPT_HELPER_H
3
4#include <linux/netfilter/xt_helper.h>
5#define ipt_helper_info xt_helper_info
6
7#endif /* _IPT_HELPER_H */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
deleted file mode 100644
index 5f1aebde4d2f..000000000000
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _IPT_IPRANGE_H
2#define _IPT_IPRANGE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/xt_iprange.h>
6
7struct ipt_iprange {
8 /* Inclusive: network order. */
9 __be32 min_ip, max_ip;
10};
11
12struct ipt_iprange_info
13{
14 struct ipt_iprange src;
15 struct ipt_iprange dst;
16
17 /* Flags from above */
18 u_int8_t flags;
19};
20
21#endif /* _IPT_IPRANGE_H */
diff --git a/include/linux/netfilter_ipv4/ipt_length.h b/include/linux/netfilter_ipv4/ipt_length.h
deleted file mode 100644
index 9b45206ffcef..000000000000
--- a/include/linux/netfilter_ipv4/ipt_length.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_LENGTH_H
2#define _IPT_LENGTH_H
3
4#include <linux/netfilter/xt_length.h>
5#define ipt_length_info xt_length_info
6
7#endif /*_IPT_LENGTH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
deleted file mode 100644
index 92f5cd07bbc4..000000000000
--- a/include/linux/netfilter_ipv4/ipt_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IPT_RATE_H
2#define _IPT_RATE_H
3
4#include <linux/netfilter/xt_limit.h>
5#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
6#define ipt_rateinfo xt_rateinfo
7
8#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
deleted file mode 100644
index b186008a3c47..000000000000
--- a/include/linux/netfilter_ipv4/ipt_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_MAC_H
2#define _IPT_MAC_H
3
4#include <linux/netfilter/xt_mac.h>
5#define ipt_mac_info xt_mac_info
6
7#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
deleted file mode 100644
index bfde67c61224..000000000000
--- a/include/linux/netfilter_ipv4/ipt_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IPT_MARK_H
2#define _IPT_MARK_H
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_mark.h>
6
7#define ipt_mark_info xt_mark_info
8
9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_multiport.h b/include/linux/netfilter_ipv4/ipt_multiport.h
deleted file mode 100644
index 55fe85eca88c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_multiport.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_MULTIPORT_H
2#define _IPT_MULTIPORT_H
3
4#include <linux/netfilter/xt_multiport.h>
5
6#define IPT_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE
7#define IPT_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION
8#define IPT_MULTIPORT_EITHER XT_MULTIPORT_EITHER
9
10#define IPT_MULTI_PORTS XT_MULTI_PORTS
11
12#define ipt_multiport xt_multiport
13#define ipt_multiport_v1 xt_multiport_v1
14
15#endif /*_IPT_MULTIPORT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_owner.h b/include/linux/netfilter_ipv4/ipt_owner.h
deleted file mode 100644
index a78445be9992..000000000000
--- a/include/linux/netfilter_ipv4/ipt_owner.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IPT_OWNER_H
2#define _IPT_OWNER_H
3
4/* match and invert flags */
5#define IPT_OWNER_UID 0x01
6#define IPT_OWNER_GID 0x02
7#define IPT_OWNER_PID 0x04
8#define IPT_OWNER_SID 0x08
9#define IPT_OWNER_COMM 0x10
10
11struct ipt_owner_info {
12 __kernel_uid32_t uid;
13 __kernel_gid32_t gid;
14 __kernel_pid_t pid;
15 __kernel_pid_t sid;
16 char comm[16];
17 u_int8_t match, invert; /* flags */
18};
19
20#endif /*_IPT_OWNER_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_physdev.h b/include/linux/netfilter_ipv4/ipt_physdev.h
deleted file mode 100644
index 2400e7140f26..000000000000
--- a/include/linux/netfilter_ipv4/ipt_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _IPT_PHYSDEV_H
2#define _IPT_PHYSDEV_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_physdev.h>
7
8#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
9#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
10#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
11#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
12#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
13#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
14
15#define ipt_physdev_info xt_physdev_info
16
17#endif /*_IPT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_pkttype.h b/include/linux/netfilter_ipv4/ipt_pkttype.h
deleted file mode 100644
index ff1fbc949a0c..000000000000
--- a/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_PKTTYPE_H
2#define _IPT_PKTTYPE_H
3
4#include <linux/netfilter/xt_pkttype.h>
5#define ipt_pkttype_info xt_pkttype_info
6
7#endif /*_IPT_PKTTYPE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
deleted file mode 100644
index 1037fb2cd206..000000000000
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H
3
4#include <linux/netfilter/xt_policy.h>
5
6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
7
8/* ipt_policy_flags */
9#define IPT_POLICY_MATCH_IN XT_POLICY_MATCH_IN
10#define IPT_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
11#define IPT_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
12#define IPT_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
13
14/* ipt_policy_modes */
15#define IPT_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
16#define IPT_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
17
18#define ipt_policy_spec xt_policy_spec
19#define ipt_policy_addr xt_policy_addr
20#define ipt_policy_elem xt_policy_elem
21#define ipt_policy_info xt_policy_info
22
23#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h
deleted file mode 100644
index d636cca133c2..000000000000
--- a/include/linux/netfilter_ipv4/ipt_recent.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _IPT_RECENT_H
2#define _IPT_RECENT_H
3
4#include <linux/netfilter/xt_recent.h>
5
6#define ipt_recent_info xt_recent_mtinfo
7
8enum {
9 IPT_RECENT_CHECK = XT_RECENT_CHECK,
10 IPT_RECENT_SET = XT_RECENT_SET,
11 IPT_RECENT_UPDATE = XT_RECENT_UPDATE,
12 IPT_RECENT_REMOVE = XT_RECENT_REMOVE,
13 IPT_RECENT_TTL = XT_RECENT_TTL,
14
15 IPT_RECENT_SOURCE = XT_RECENT_SOURCE,
16 IPT_RECENT_DEST = XT_RECENT_DEST,
17
18 IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN,
19};
20
21#endif /*_IPT_RECENT_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_sctp.h b/include/linux/netfilter_ipv4/ipt_sctp.h
deleted file mode 100644
index 80b3dbacd193..000000000000
--- a/include/linux/netfilter_ipv4/ipt_sctp.h
+++ /dev/null
@@ -1,105 +0,0 @@
1#ifndef _IPT_SCTP_H_
2#define _IPT_SCTP_H_
3
4#define IPT_SCTP_SRC_PORTS 0x01
5#define IPT_SCTP_DEST_PORTS 0x02
6#define IPT_SCTP_CHUNK_TYPES 0x04
7
8#define IPT_SCTP_VALID_FLAGS 0x07
9
10
11struct ipt_sctp_flag_info {
12 u_int8_t chunktype;
13 u_int8_t flag;
14 u_int8_t flag_mask;
15};
16
17#define IPT_NUM_SCTP_FLAGS 4
18
19struct ipt_sctp_info {
20 u_int16_t dpts[2]; /* Min, Max */
21 u_int16_t spts[2]; /* Min, Max */
22
23 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
24
25#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
26#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
27#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
28
29 u_int32_t chunk_match_type;
30 struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS];
31 int flag_count;
32
33 u_int32_t flags;
34 u_int32_t invflags;
35};
36
37#define bytes(type) (sizeof(type) * 8)
38
39#define SCTP_CHUNKMAP_SET(chunkmap, type) \
40 do { \
41 chunkmap[type / bytes(u_int32_t)] |= \
42 1 << (type % bytes(u_int32_t)); \
43 } while (0)
44
45#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
46 do { \
47 chunkmap[type / bytes(u_int32_t)] &= \
48 ~(1 << (type % bytes(u_int32_t))); \
49 } while (0)
50
51#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
52({ \
53 (chunkmap[type / bytes (u_int32_t)] & \
54 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
55})
56
57#define SCTP_CHUNKMAP_RESET(chunkmap) \
58 do { \
59 int i; \
60 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
61 chunkmap[i] = 0; \
62 } while (0)
63
64#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
65 do { \
66 int i; \
67 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
68 chunkmap[i] = ~0; \
69 } while (0)
70
71#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
72 do { \
73 int i; \
74 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
75 destmap[i] = srcmap[i]; \
76 } while (0)
77
78#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
79({ \
80 int i; \
81 int flag = 1; \
82 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
83 if (chunkmap[i]) { \
84 flag = 0; \
85 break; \
86 } \
87 } \
88 flag; \
89})
90
91#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
92({ \
93 int i; \
94 int flag = 1; \
95 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
96 if (chunkmap[i] != ~0) { \
97 flag = 0; \
98 break; \
99 } \
100 } \
101 flag; \
102})
103
104#endif /* _IPT_SCTP_H_ */
105
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
deleted file mode 100644
index a44a99cc28cc..000000000000
--- a/include/linux/netfilter_ipv4/ipt_state.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _IPT_STATE_H
2#define _IPT_STATE_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_state.h>
7
8#define IPT_STATE_BIT XT_STATE_BIT
9#define IPT_STATE_INVALID XT_STATE_INVALID
10
11#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED
12
13#define ipt_state_info xt_state_info
14
15#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
deleted file mode 100644
index c26de3059903..000000000000
--- a/include/linux/netfilter_ipv4/ipt_string.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H
3
4#include <linux/netfilter/xt_string.h>
5
6#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
7#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
8#define ipt_string_info xt_string_info
9
10#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tcpmss.h b/include/linux/netfilter_ipv4/ipt_tcpmss.h
deleted file mode 100644
index 18bbc8e8e009..000000000000
--- a/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_TCPMSS_MATCH_H
2#define _IPT_TCPMSS_MATCH_H
3
4#include <linux/netfilter/xt_tcpmss.h>
5#define ipt_tcpmss_match_info xt_tcpmss_match_info
6
7#endif /*_IPT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tos.h b/include/linux/netfilter_ipv4/ipt_tos.h
deleted file mode 100644
index a21f5df23c50..000000000000
--- a/include/linux/netfilter_ipv4/ipt_tos.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _IPT_TOS_H
2#define _IPT_TOS_H
3
4struct ipt_tos_info {
5 u_int8_t tos;
6 u_int8_t invert;
7};
8
9#ifndef IPTOS_NORMALSVC
10#define IPTOS_NORMALSVC 0
11#endif
12
13#endif /*_IPT_TOS_H*/
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index aca4bd1f6d7c..e864eaee9e5e 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,22 +1,12 @@
1header-y += ip6t_HL.h 1header-y += ip6t_HL.h
2header-y += ip6t_LOG.h 2header-y += ip6t_LOG.h
3header-y += ip6t_MARK.h
4header-y += ip6t_REJECT.h 3header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h 4header-y += ip6t_ah.h
6header-y += ip6t_esp.h
7header-y += ip6t_frag.h 5header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h 6header-y += ip6t_ipv6header.h
10header-y += ip6t_length.h 7header-y += ip6t_hl.h
11header-y += ip6t_limit.h
12header-y += ip6t_mac.h
13header-y += ip6t_mark.h
14header-y += ip6t_mh.h 8header-y += ip6t_mh.h
15header-y += ip6t_multiport.h
16header-y += ip6t_opts.h 9header-y += ip6t_opts.h
17header-y += ip6t_owner.h
18header-y += ip6t_physdev.h
19header-y += ip6t_policy.h
20header-y += ip6t_rt.h 10header-y += ip6t_rt.h
21 11
22unifdef-y += ip6_tables.h 12unifdef-y += ip6_tables.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 1089e33cf633..a64e1451ac38 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -306,7 +306,7 @@ ip6t_get_target(struct ip6t_entry *e)
306extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
307 307
308extern struct xt_table *ip6t_register_table(struct net *net, 308extern struct xt_table *ip6t_register_table(struct net *net,
309 struct xt_table *table, 309 const struct xt_table *table,
310 const struct ip6t_replace *repl); 310 const struct ip6t_replace *repl);
311extern void ip6t_unregister_table(struct xt_table *table); 311extern void ip6t_unregister_table(struct xt_table *table);
312extern unsigned int ip6t_do_table(struct sk_buff *skb, 312extern unsigned int ip6t_do_table(struct sk_buff *skb,
diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h
deleted file mode 100644
index 7cf629a8ab92..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IP6T_MARK_H_target
2#define _IP6T_MARK_H_target
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_MARK.h>
6
7#define ip6t_mark_target_info xt_mark_target_info
8
9#endif /*_IP6T_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv6/ip6t_esp.h b/include/linux/netfilter_ipv6/ip6t_esp.h
deleted file mode 100644
index f62eaf53c16c..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _IP6T_ESP_H
2#define _IP6T_ESP_H
3
4#include <linux/netfilter/xt_esp.h>
5
6#define ip6t_esp xt_esp
7#define IP6T_ESP_INV_SPI XT_ESP_INV_SPI
8#define IP6T_ESP_INV_MASK XT_ESP_INV_MASK
9
10#endif /*_IP6T_ESP_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_length.h b/include/linux/netfilter_ipv6/ip6t_length.h
deleted file mode 100644
index 9e9689d03ed7..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_length.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IP6T_LENGTH_H
2#define _IP6T_LENGTH_H
3
4#include <linux/netfilter/xt_length.h>
5#define ip6t_length_info xt_length_info
6
7#endif /*_IP6T_LENGTH_H*/
8
diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h
deleted file mode 100644
index 487e5ea342c6..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _IP6T_RATE_H
2#define _IP6T_RATE_H
3
4#include <linux/netfilter/xt_limit.h>
5#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
6#define ip6t_rateinfo xt_rateinfo
7
8#endif /*_IP6T_RATE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h
deleted file mode 100644
index ac58e83e9423..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IP6T_MAC_H
2#define _IP6T_MAC_H
3
4#include <linux/netfilter/xt_mac.h>
5#define ip6t_mac_info xt_mac_info
6
7#endif /*_IP6T_MAC_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h
deleted file mode 100644
index ff204951ddc3..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _IP6T_MARK_H
2#define _IP6T_MARK_H
3
4/* Backwards compatibility for old userspace */
5#include <linux/netfilter/xt_mark.h>
6
7#define ip6t_mark_info xt_mark_info
8
9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_multiport.h b/include/linux/netfilter_ipv6/ip6t_multiport.h
deleted file mode 100644
index 042c92661cee..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_multiport.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _IP6T_MULTIPORT_H
2#define _IP6T_MULTIPORT_H
3
4#include <linux/netfilter/xt_multiport.h>
5
6#define IP6T_MULTIPORT_SOURCE XT_MULTIPORT_SOURCE
7#define IP6T_MULTIPORT_DESTINATION XT_MULTIPORT_DESTINATION
8#define IP6T_MULTIPORT_EITHER XT_MULTIPORT_EITHER
9
10#define IP6T_MULTI_PORTS XT_MULTI_PORTS
11
12#define ip6t_multiport xt_multiport
13
14#endif /*_IP6T_MULTIPORT_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_owner.h b/include/linux/netfilter_ipv6/ip6t_owner.h
deleted file mode 100644
index ec5cc7a38c42..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_owner.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP6T_OWNER_H
2#define _IP6T_OWNER_H
3
4/* match and invert flags */
5#define IP6T_OWNER_UID 0x01
6#define IP6T_OWNER_GID 0x02
7#define IP6T_OWNER_PID 0x04
8#define IP6T_OWNER_SID 0x08
9
10struct ip6t_owner_info {
11 __kernel_uid32_t uid;
12 __kernel_gid32_t gid;
13 __kernel_pid_t pid;
14 __kernel_pid_t sid;
15 u_int8_t match, invert; /* flags */
16};
17
18#endif /*_IPT_OWNER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h
deleted file mode 100644
index c161c0a81b55..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _IP6T_PHYSDEV_H
2#define _IP6T_PHYSDEV_H
3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_physdev.h>
7
8#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
9#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
10#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
11#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
12#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
13#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
14
15#define ip6t_physdev_info xt_physdev_info
16
17#endif /*_IP6T_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
deleted file mode 100644
index b1c449d7ec89..000000000000
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H
3
4#include <linux/netfilter/xt_policy.h>
5
6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
7
8/* ip6t_policy_flags */
9#define IP6T_POLICY_MATCH_IN XT_POLICY_MATCH_IN
10#define IP6T_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
11#define IP6T_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
12#define IP6T_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
13
14/* ip6t_policy_modes */
15#define IP6T_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
16#define IP6T_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
17
18#define ip6t_policy_spec xt_policy_spec
19#define ip6t_policy_addr xt_policy_addr
20#define ip6t_policy_elem xt_policy_elem
21#define ip6t_policy_info xt_policy_info
22
23#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 5ba398e90304..ab5d3126831f 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -176,13 +176,18 @@ struct netlink_skb_parms
176#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 176#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
177 177
178 178
179extern void netlink_table_grab(void);
180extern void netlink_table_ungrab(void);
181
179extern struct sock *netlink_kernel_create(struct net *net, 182extern struct sock *netlink_kernel_create(struct net *net,
180 int unit,unsigned int groups, 183 int unit,unsigned int groups,
181 void (*input)(struct sk_buff *skb), 184 void (*input)(struct sk_buff *skb),
182 struct mutex *cb_mutex, 185 struct mutex *cb_mutex,
183 struct module *module); 186 struct module *module);
184extern void netlink_kernel_release(struct sock *sk); 187extern void netlink_kernel_release(struct sock *sk);
188extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
185extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 189extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
190extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
186extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 191extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
187extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 192extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
188extern int netlink_has_listeners(struct sock *sk, unsigned int group); 193extern int netlink_has_listeners(struct sock *sk, unsigned int group);
@@ -217,12 +222,13 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
217 222
218struct netlink_callback 223struct netlink_callback
219{ 224{
220 struct sk_buff *skb; 225 struct sk_buff *skb;
221 struct nlmsghdr *nlh; 226 const struct nlmsghdr *nlh;
222 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 227 int (*dump)(struct sk_buff * skb,
223 int (*done)(struct netlink_callback *cb); 228 struct netlink_callback *cb);
224 int family; 229 int (*done)(struct netlink_callback *cb);
225 long args[6]; 230 int family;
231 long args[6];
226}; 232};
227 233
228struct netlink_notify 234struct netlink_notify
@@ -258,7 +264,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
258 NLMSG_NEW(skb, pid, seq, type, len, 0) 264 NLMSG_NEW(skb, pid, seq, type, len, 0)
259 265
260extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 266extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
261 struct nlmsghdr *nlh, 267 const struct nlmsghdr *nlh,
262 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 268 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
263 int (*done)(struct netlink_callback*)); 269 int (*done)(struct netlink_callback*));
264 270
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index bd2eba530667..c4c060208109 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -234,7 +234,7 @@ enum nfs_opnum4 {
234Needs to be updated if more operations are defined in future.*/ 234Needs to be updated if more operations are defined in future.*/
235 235
236#define FIRST_NFS4_OP OP_ACCESS 236#define FIRST_NFS4_OP OP_ACCESS
237#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER 237#define LAST_NFS4_OP OP_RECLAIM_COMPLETE
238 238
239enum nfsstat4 { 239enum nfsstat4 {
240 NFS4_OK = 0, 240 NFS4_OK = 0,
@@ -472,6 +472,7 @@ enum lock_type4 {
472 472
473#define NFSPROC4_NULL 0 473#define NFSPROC4_NULL 0
474#define NFSPROC4_COMPOUND 1 474#define NFSPROC4_COMPOUND 1
475#define NFS4_VERSION 4
475#define NFS4_MINOR_VERSION 0 476#define NFS4_MINOR_VERSION 0
476 477
477#if defined(CONFIG_NFS_V4_1) 478#if defined(CONFIG_NFS_V4_1)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index f6b90240dd41..d09db1bc9083 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -40,7 +40,6 @@
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
41 41
42#include <linux/in.h> 42#include <linux/in.h>
43#include <linux/kref.h>
44#include <linux/mm.h> 43#include <linux/mm.h>
45#include <linux/pagemap.h> 44#include <linux/pagemap.h>
46#include <linux/rbtree.h> 45#include <linux/rbtree.h>
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 19fe15d12042..320569eabe3b 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -167,6 +167,15 @@ struct nfs_server {
167#define NFS_CAP_SYMLINKS (1U << 2) 167#define NFS_CAP_SYMLINKS (1U << 2)
168#define NFS_CAP_ACLS (1U << 3) 168#define NFS_CAP_ACLS (1U << 3)
169#define NFS_CAP_ATOMIC_OPEN (1U << 4) 169#define NFS_CAP_ATOMIC_OPEN (1U << 4)
170#define NFS_CAP_CHANGE_ATTR (1U << 5)
171#define NFS_CAP_FILEID (1U << 6)
172#define NFS_CAP_MODE (1U << 7)
173#define NFS_CAP_NLINK (1U << 8)
174#define NFS_CAP_OWNER (1U << 9)
175#define NFS_CAP_OWNER_GROUP (1U << 10)
176#define NFS_CAP_ATIME (1U << 11)
177#define NFS_CAP_CTIME (1U << 12)
178#define NFS_CAP_MTIME (1U << 13)
170 179
171 180
172/* maximum number of slots to use */ 181/* maximum number of slots to use */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2b49d676d0c9..510ffdd5020e 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,8 +56,11 @@ extern struct svc_version nfsd_version2, nfsd_version3,
56extern u32 nfsd_supported_minorversion; 56extern u32 nfsd_supported_minorversion;
57extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
58extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
59extern spinlock_t nfsd_drc_lock;
60extern unsigned int nfsd_drc_max_mem;
61extern unsigned int nfsd_drc_mem_used;
59 62
60extern struct seq_operations nfs_exports_op; 63extern const struct seq_operations nfs_exports_op;
61 64
62/* 65/*
63 * Function prototypes. 66 * Function prototypes.
@@ -163,7 +166,7 @@ extern int nfsd_max_blksize;
163extern unsigned int max_delegations; 166extern unsigned int max_delegations;
164int nfs4_state_init(void); 167int nfs4_state_init(void);
165void nfsd4_free_slabs(void); 168void nfsd4_free_slabs(void);
166void nfs4_state_start(void); 169int nfs4_state_start(void);
167void nfs4_state_shutdown(void); 170void nfs4_state_shutdown(void);
168time_t nfs4_lease_time(void); 171time_t nfs4_lease_time(void);
169void nfs4_reset_lease(time_t leasetime); 172void nfs4_reset_lease(time_t leasetime);
@@ -171,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir);
171#else 174#else
172static inline int nfs4_state_init(void) { return 0; } 175static inline int nfs4_state_init(void) { return 0; }
173static inline void nfsd4_free_slabs(void) { } 176static inline void nfsd4_free_slabs(void) { }
174static inline void nfs4_state_start(void) { } 177static inline int nfs4_state_start(void) { return 0; }
175static inline void nfs4_state_shutdown(void) { } 178static inline void nfs4_state_shutdown(void) { }
176static inline time_t nfs4_lease_time(void) { return 0; } 179static inline time_t nfs4_lease_time(void) { return 0; }
177static inline void nfs4_reset_lease(time_t leasetime) { } 180static inline void nfs4_reset_lease(time_t leasetime) { }
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 57ab2ed08459..b38d11324189 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -60,6 +60,12 @@ typedef struct {
60#define si_stateownerid si_opaque.so_stateownerid 60#define si_stateownerid si_opaque.so_stateownerid
61#define si_fileid si_opaque.so_fileid 61#define si_fileid si_opaque.so_fileid
62 62
63struct nfsd4_cb_sequence {
64 /* args/res */
65 u32 cbs_minorversion;
66 struct nfs4_client *cbs_clp;
67};
68
63struct nfs4_delegation { 69struct nfs4_delegation {
64 struct list_head dl_perfile; 70 struct list_head dl_perfile;
65 struct list_head dl_perclnt; 71 struct list_head dl_perclnt;
@@ -81,38 +87,35 @@ struct nfs4_delegation {
81/* client delegation callback info */ 87/* client delegation callback info */
82struct nfs4_cb_conn { 88struct nfs4_cb_conn {
83 /* SETCLIENTID info */ 89 /* SETCLIENTID info */
84 u32 cb_addr; 90 struct sockaddr_storage cb_addr;
85 unsigned short cb_port; 91 size_t cb_addrlen;
86 u32 cb_prog; 92 u32 cb_prog;
87 u32 cb_minorversion; 93 u32 cb_minorversion;
88 u32 cb_ident; /* minorversion 0 only */ 94 u32 cb_ident; /* minorversion 0 only */
89 /* RPC client info */ 95 /* RPC client info */
90 atomic_t cb_set; /* successful CB_NULL call */ 96 atomic_t cb_set; /* successful CB_NULL call */
91 struct rpc_clnt * cb_client; 97 struct rpc_clnt * cb_client;
92 struct rpc_cred * cb_cred;
93}; 98};
94 99
95/* Maximum number of slots per session. 128 is useful for long haul TCP */ 100/* Maximum number of slots per session. 160 is useful for long haul TCP */
96#define NFSD_MAX_SLOTS_PER_SESSION 128 101#define NFSD_MAX_SLOTS_PER_SESSION 160
97/* Maximum number of pages per slot cache entry */
98#define NFSD_PAGES_PER_SLOT 1
99/* Maximum number of operations per session compound */ 102/* Maximum number of operations per session compound */
100#define NFSD_MAX_OPS_PER_COMPOUND 16 103#define NFSD_MAX_OPS_PER_COMPOUND 16
101 104/* Maximum session per slot cache size */
102struct nfsd4_cache_entry { 105#define NFSD_SLOT_CACHE_SIZE 1024
103 __be32 ce_status; 106/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
104 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ 107#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
105 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; 108#define NFSD_MAX_MEM_PER_SESSION \
106 int ce_cachethis; 109 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
107 short ce_resused;
108 int ce_opcnt;
109 int ce_rpchdrlen;
110};
111 110
112struct nfsd4_slot { 111struct nfsd4_slot {
113 bool sl_inuse; 112 bool sl_inuse;
114 u32 sl_seqid; 113 bool sl_cachethis;
115 struct nfsd4_cache_entry sl_cache_entry; 114 u16 sl_opcnt;
115 u32 sl_seqid;
116 __be32 sl_status;
117 u32 sl_datalen;
118 char sl_data[];
116}; 119};
117 120
118struct nfsd4_channel_attrs { 121struct nfsd4_channel_attrs {
@@ -126,6 +129,25 @@ struct nfsd4_channel_attrs {
126 u32 rdma_attrs; 129 u32 rdma_attrs;
127}; 130};
128 131
132struct nfsd4_create_session {
133 clientid_t clientid;
134 struct nfs4_sessionid sessionid;
135 u32 seqid;
136 u32 flags;
137 struct nfsd4_channel_attrs fore_channel;
138 struct nfsd4_channel_attrs back_channel;
139 u32 callback_prog;
140 u32 uid;
141 u32 gid;
142};
143
144/* The single slot clientid cache structure */
145struct nfsd4_clid_slot {
146 u32 sl_seqid;
147 __be32 sl_status;
148 struct nfsd4_create_session sl_cr_ses;
149};
150
129struct nfsd4_session { 151struct nfsd4_session {
130 struct kref se_ref; 152 struct kref se_ref;
131 struct list_head se_hash; /* hash by sessionid */ 153 struct list_head se_hash; /* hash by sessionid */
@@ -135,7 +157,7 @@ struct nfsd4_session {
135 struct nfs4_sessionid se_sessionid; 157 struct nfs4_sessionid se_sessionid;
136 struct nfsd4_channel_attrs se_fchannel; 158 struct nfsd4_channel_attrs se_fchannel;
137 struct nfsd4_channel_attrs se_bchannel; 159 struct nfsd4_channel_attrs se_bchannel;
138 struct nfsd4_slot se_slots[]; /* forward channel slots */ 160 struct nfsd4_slot *se_slots[]; /* forward channel slots */
139}; 161};
140 162
141static inline void 163static inline void
@@ -180,7 +202,7 @@ struct nfs4_client {
180 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 202 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
181 nfs4_verifier cl_verifier; /* generated by client */ 203 nfs4_verifier cl_verifier; /* generated by client */
182 time_t cl_time; /* time of last lease renewal */ 204 time_t cl_time; /* time of last lease renewal */
183 __be32 cl_addr; /* client ipaddress */ 205 struct sockaddr_storage cl_addr; /* client ipaddress */
184 u32 cl_flavor; /* setclientid pseudoflavor */ 206 u32 cl_flavor; /* setclientid pseudoflavor */
185 char *cl_principal; /* setclientid principal name */ 207 char *cl_principal; /* setclientid principal name */
186 struct svc_cred cl_cred; /* setclientid principal */ 208 struct svc_cred cl_cred; /* setclientid principal */
@@ -192,9 +214,17 @@ struct nfs4_client {
192 214
193 /* for nfs41 */ 215 /* for nfs41 */
194 struct list_head cl_sessions; 216 struct list_head cl_sessions;
195 struct nfsd4_slot cl_slot; /* create_session slot */ 217 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
196 u32 cl_exchange_flags; 218 u32 cl_exchange_flags;
197 struct nfs4_sessionid cl_sessionid; 219 struct nfs4_sessionid cl_sessionid;
220
221 /* for nfs41 callbacks */
222 /* We currently support a single back channel with a single slot */
223 unsigned long cl_cb_slot_busy;
224 u32 cl_cb_seq_nr;
225 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
226 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
227 /* wait here for slots */
198}; 228};
199 229
200/* struct nfs4_client_reset 230/* struct nfs4_client_reset
@@ -345,6 +375,7 @@ extern int nfs4_in_grace(void);
345extern __be32 nfs4_check_open_reclaim(clientid_t *clid); 375extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
346extern void put_nfs4_client(struct nfs4_client *clp); 376extern void put_nfs4_client(struct nfs4_client *clp);
347extern void nfs4_free_stateowner(struct kref *kref); 377extern void nfs4_free_stateowner(struct kref *kref);
378extern int set_callback_cred(void);
348extern void nfsd4_probe_callback(struct nfs4_client *clp); 379extern void nfsd4_probe_callback(struct nfs4_client *clp);
349extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 380extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
350extern void nfs4_put_delegation(struct nfs4_delegation *dp); 381extern void nfs4_put_delegation(struct nfs4_delegation *dp);
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 2bacf7535069..73164c2b3d29 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -51,7 +51,7 @@ struct nfsd4_compound_state {
51 /* For sessions DRC */ 51 /* For sessions DRC */
52 struct nfsd4_session *session; 52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot; 53 struct nfsd4_slot *slot;
54 __be32 *statp; 54 __be32 *datap;
55 size_t iovlen; 55 size_t iovlen;
56 u32 minorversion; 56 u32 minorversion;
57 u32 status; 57 u32 status;
@@ -366,18 +366,6 @@ struct nfsd4_exchange_id {
366 int spa_how; 366 int spa_how;
367}; 367};
368 368
369struct nfsd4_create_session {
370 clientid_t clientid;
371 struct nfs4_sessionid sessionid;
372 u32 seqid;
373 u32 flags;
374 struct nfsd4_channel_attrs fore_channel;
375 struct nfsd4_channel_attrs back_channel;
376 u32 callback_prog;
377 u32 uid;
378 u32 gid;
379};
380
381struct nfsd4_sequence { 369struct nfsd4_sequence {
382 struct nfs4_sessionid sessionid; /* request/response */ 370 struct nfs4_sessionid sessionid; /* request/response */
383 u32 seqid; /* request/response */ 371 u32 seqid; /* request/response */
@@ -479,13 +467,12 @@ struct nfsd4_compoundres {
479static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) 467static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
480{ 468{
481 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; 469 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
482 return args->opcnt == 1; 470 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
483} 471}
484 472
485static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) 473static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
486{ 474{
487 return !resp->cstate.slot->sl_cache_entry.ce_cachethis || 475 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
488 nfsd4_is_solo_sequence(resp);
489} 476}
490 477
491#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 478#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 79fec6af3f9f..ce520402e840 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -425,15 +425,6 @@ struct nilfs_dat_entry {
425}; 425};
426 426
427/** 427/**
428 * struct nilfs_dat_group_desc - block group descriptor
429 * @dg_nfrees: number of free virtual block numbers in block group
430 */
431struct nilfs_dat_group_desc {
432 __le32 dg_nfrees;
433};
434
435
436/**
437 * struct nilfs_snapshot_list - snapshot list 428 * struct nilfs_snapshot_list - snapshot list
438 * @ssl_next: next checkpoint number on snapshot list 429 * @ssl_next: next checkpoint number on snapshot list
439 * @ssl_prev: previous checkpoint number on snapshot list 430 * @ssl_prev: previous checkpoint number on snapshot list
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index dbea93b694e5..a8d71ed43a0e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -242,6 +242,29 @@
242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is 242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
243 * determined by the network interface. 243 * determined by the network interface.
244 * 244 *
245 * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute
246 * to identify the device, and the TESTDATA blob attribute to pass through
247 * to the driver.
248 *
249 * @NL80211_CMD_CONNECT: connection request and notification; this command
250 * requests to connect to a specified network but without separating
251 * auth and assoc steps. For this, you need to specify the SSID in a
252 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
253 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
254 * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_CONTROL_PORT.
255 * It is also sent as an event, with the BSSID and response IEs when the
256 * connection is established or failed to be established. This can be
257 * determined by the STATUS_CODE attribute.
258 * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
259 * sent as an event when the card/driver roamed by itself.
260 * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
261 * userspace that a connection was dropped by the AP or due to other
262 * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
263 * %NL80211_ATTR_REASON_CODE attributes are used.
264 *
265 * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
266 * associated with this wiphy must be down and will follow.
267 *
245 * @NL80211_CMD_MAX: highest used command number 268 * @NL80211_CMD_MAX: highest used command number
246 * @__NL80211_CMD_AFTER_LAST: internal use 269 * @__NL80211_CMD_AFTER_LAST: internal use
247 */ 270 */
@@ -310,6 +333,14 @@ enum nl80211_commands {
310 NL80211_CMD_JOIN_IBSS, 333 NL80211_CMD_JOIN_IBSS,
311 NL80211_CMD_LEAVE_IBSS, 334 NL80211_CMD_LEAVE_IBSS,
312 335
336 NL80211_CMD_TESTMODE,
337
338 NL80211_CMD_CONNECT,
339 NL80211_CMD_ROAM,
340 NL80211_CMD_DISCONNECT,
341
342 NL80211_CMD_SET_WIPHY_NETNS,
343
313 /* add new commands above here */ 344 /* add new commands above here */
314 345
315 /* used to define NL80211_CMD_MAX below */ 346 /* used to define NL80211_CMD_MAX below */
@@ -449,10 +480,6 @@ enum nl80211_commands {
449 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 480 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
450 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 481 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
451 * scanning and include a zero-length SSID (wildcard) for wildcard scan 482 * scanning and include a zero-length SSID (wildcard) for wildcard scan
452 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
453 * scan result list changes (BSS expired or added) so that applications
454 * can verify that they got a single, consistent snapshot (when all dump
455 * messages carried the same generation number)
456 * @NL80211_ATTR_BSS: scan result BSS 483 * @NL80211_ATTR_BSS: scan result BSS
457 * 484 *
458 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain 485 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
@@ -511,6 +538,52 @@ enum nl80211_commands {
511 * authorized by user space. Otherwise, port is marked authorized by 538 * authorized by user space. Otherwise, port is marked authorized by
512 * default in station mode. 539 * default in station mode.
513 * 540 *
541 * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
542 * We recommend using nested, driver-specific attributes within this.
543 *
544 * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
545 * event was due to the AP disconnecting the station, and not due to
546 * a local disconnect request.
547 * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
548 * event (u16)
549 * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
550 * that protected APs should be used.
551 *
552 * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to
553 * indicate which unicast key ciphers will be used with the connection
554 * (an array of u32).
555 * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate
556 * which group key cipher will be used with the connection (a u32).
557 * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate
558 * which WPA version(s) the AP we want to associate with is using
559 * (a u32 with flags from &enum nl80211_wpa_versions).
560 * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate
561 * which key management algorithm(s) to use (an array of u32).
562 *
563 * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
564 * sent out by the card, for ROAM and successful CONNECT events.
565 * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
566 * sent by peer, for ROAM and successful CONNECT events.
567 *
568 * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
569 * commands to specify using a reassociate frame
570 *
571 * @NL80211_ATTR_KEY: key information in a nested attribute with
572 * %NL80211_KEY_* sub-attributes
573 * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect()
574 * and join_ibss(), key information is in a nested attribute each
575 * with %NL80211_KEY_* sub-attributes
576 *
577 * @NL80211_ATTR_PID: Process ID of a network namespace.
578 *
579 * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
580 * dumps. This number increases whenever the object list being
581 * dumped changes, and as such userspace can verify that it has
582 * obtained a complete and consistent snapshot by verifying that
583 * all dump messages contain the same generation number. If it
584 * changed then the list changed and the dump should be repeated
585 * completely from scratch.
586 *
514 * @NL80211_ATTR_MAX: highest attribute number currently defined 587 * @NL80211_ATTR_MAX: highest attribute number currently defined
515 * @__NL80211_ATTR_AFTER_LAST: internal use 588 * @__NL80211_ATTR_AFTER_LAST: internal use
516 */ 589 */
@@ -582,7 +655,7 @@ enum nl80211_attrs {
582 655
583 NL80211_ATTR_SCAN_FREQUENCIES, 656 NL80211_ATTR_SCAN_FREQUENCIES,
584 NL80211_ATTR_SCAN_SSIDS, 657 NL80211_ATTR_SCAN_SSIDS,
585 NL80211_ATTR_SCAN_GENERATION, 658 NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
586 NL80211_ATTR_BSS, 659 NL80211_ATTR_BSS,
587 660
588 NL80211_ATTR_REG_INITIATOR, 661 NL80211_ATTR_REG_INITIATOR,
@@ -619,16 +692,42 @@ enum nl80211_attrs {
619 692
620 NL80211_ATTR_CONTROL_PORT, 693 NL80211_ATTR_CONTROL_PORT,
621 694
695 NL80211_ATTR_TESTDATA,
696
697 NL80211_ATTR_PRIVACY,
698
699 NL80211_ATTR_DISCONNECTED_BY_AP,
700 NL80211_ATTR_STATUS_CODE,
701
702 NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
703 NL80211_ATTR_CIPHER_SUITE_GROUP,
704 NL80211_ATTR_WPA_VERSIONS,
705 NL80211_ATTR_AKM_SUITES,
706
707 NL80211_ATTR_REQ_IE,
708 NL80211_ATTR_RESP_IE,
709
710 NL80211_ATTR_PREV_BSSID,
711
712 NL80211_ATTR_KEY,
713 NL80211_ATTR_KEYS,
714
715 NL80211_ATTR_PID,
716
622 /* add attributes here, update the policy in nl80211.c */ 717 /* add attributes here, update the policy in nl80211.c */
623 718
624 __NL80211_ATTR_AFTER_LAST, 719 __NL80211_ATTR_AFTER_LAST,
625 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 720 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
626}; 721};
627 722
723/* source-level API compatibility */
724#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
725
628/* 726/*
629 * Allow user space programs to use #ifdef on new attributes by defining them 727 * Allow user space programs to use #ifdef on new attributes by defining them
630 * here 728 * here
631 */ 729 */
730#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
632#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 731#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
633#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES 732#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
634#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS 733#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
@@ -642,6 +741,12 @@ enum nl80211_attrs {
642#define NL80211_ATTR_SSID NL80211_ATTR_SSID 741#define NL80211_ATTR_SSID NL80211_ATTR_SSID
643#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE 742#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
644#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE 743#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
744#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE
745#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP
746#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS
747#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
748#define NL80211_ATTR_KEY NL80211_ATTR_KEY
749#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
645 750
646#define NL80211_MAX_SUPP_RATES 32 751#define NL80211_MAX_SUPP_RATES 32
647#define NL80211_MAX_SUPP_REG_RULES 32 752#define NL80211_MAX_SUPP_REG_RULES 32
@@ -650,6 +755,9 @@ enum nl80211_attrs {
650#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 755#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
651#define NL80211_HT_CAPABILITY_LEN 26 756#define NL80211_HT_CAPABILITY_LEN 26
652 757
758#define NL80211_MAX_NR_CIPHER_SUITES 5
759#define NL80211_MAX_NR_AKM_SUITES 2
760
653/** 761/**
654 * enum nl80211_iftype - (virtual) interface types 762 * enum nl80211_iftype - (virtual) interface types
655 * 763 *
@@ -1168,6 +1276,7 @@ enum nl80211_channel_type {
1168 * in mBm (100 * dBm) (s32) 1276 * in mBm (100 * dBm) (s32)
1169 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon 1277 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
1170 * in unspecified units, scaled to 0..100 (u8) 1278 * in unspecified units, scaled to 0..100 (u8)
1279 * @NL80211_BSS_STATUS: status, if this BSS is "used"
1171 * @__NL80211_BSS_AFTER_LAST: internal 1280 * @__NL80211_BSS_AFTER_LAST: internal
1172 * @NL80211_BSS_MAX: highest BSS attribute 1281 * @NL80211_BSS_MAX: highest BSS attribute
1173 */ 1282 */
@@ -1181,6 +1290,7 @@ enum nl80211_bss {
1181 NL80211_BSS_INFORMATION_ELEMENTS, 1290 NL80211_BSS_INFORMATION_ELEMENTS,
1182 NL80211_BSS_SIGNAL_MBM, 1291 NL80211_BSS_SIGNAL_MBM,
1183 NL80211_BSS_SIGNAL_UNSPEC, 1292 NL80211_BSS_SIGNAL_UNSPEC,
1293 NL80211_BSS_STATUS,
1184 1294
1185 /* keep last */ 1295 /* keep last */
1186 __NL80211_BSS_AFTER_LAST, 1296 __NL80211_BSS_AFTER_LAST,
@@ -1188,18 +1298,37 @@ enum nl80211_bss {
1188}; 1298};
1189 1299
1190/** 1300/**
1301 * enum nl80211_bss_status - BSS "status"
1302 */
1303enum nl80211_bss_status {
1304 NL80211_BSS_STATUS_AUTHENTICATED,
1305 NL80211_BSS_STATUS_ASSOCIATED,
1306 NL80211_BSS_STATUS_IBSS_JOINED,
1307};
1308
1309/**
1191 * enum nl80211_auth_type - AuthenticationType 1310 * enum nl80211_auth_type - AuthenticationType
1192 * 1311 *
1193 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication 1312 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
1194 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) 1313 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
1195 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) 1314 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
1196 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) 1315 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
1316 * @__NL80211_AUTHTYPE_NUM: internal
1317 * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
1318 * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
1319 * trying multiple times); this is invalid in netlink -- leave out
1320 * the attribute for this on CONNECT commands.
1197 */ 1321 */
1198enum nl80211_auth_type { 1322enum nl80211_auth_type {
1199 NL80211_AUTHTYPE_OPEN_SYSTEM, 1323 NL80211_AUTHTYPE_OPEN_SYSTEM,
1200 NL80211_AUTHTYPE_SHARED_KEY, 1324 NL80211_AUTHTYPE_SHARED_KEY,
1201 NL80211_AUTHTYPE_FT, 1325 NL80211_AUTHTYPE_FT,
1202 NL80211_AUTHTYPE_NETWORK_EAP, 1326 NL80211_AUTHTYPE_NETWORK_EAP,
1327
1328 /* keep last */
1329 __NL80211_AUTHTYPE_NUM,
1330 NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1,
1331 NL80211_AUTHTYPE_AUTOMATIC
1203}; 1332};
1204 1333
1205/** 1334/**
@@ -1224,4 +1353,39 @@ enum nl80211_mfp {
1224 NL80211_MFP_REQUIRED, 1353 NL80211_MFP_REQUIRED,
1225}; 1354};
1226 1355
1356enum nl80211_wpa_versions {
1357 NL80211_WPA_VERSION_1 = 1 << 0,
1358 NL80211_WPA_VERSION_2 = 1 << 1,
1359};
1360
1361/**
1362 * enum nl80211_key_attributes - key attributes
1363 * @__NL80211_KEY_INVALID: invalid
1364 * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of
1365 * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC
1366 * keys
1367 * @NL80211_KEY_IDX: key ID (u8, 0-3)
1368 * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
1369 * section 7.3.2.25.1, e.g. 0x000FAC04)
1370 * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
1371 * CCMP keys, each six bytes in little endian
1372 * @NL80211_KEY_DEFAULT: flag indicating default key
1373 * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key
1374 * @__NL80211_KEY_AFTER_LAST: internal
1375 * @NL80211_KEY_MAX: highest key attribute
1376 */
1377enum nl80211_key_attributes {
1378 __NL80211_KEY_INVALID,
1379 NL80211_KEY_DATA,
1380 NL80211_KEY_IDX,
1381 NL80211_KEY_CIPHER,
1382 NL80211_KEY_SEQ,
1383 NL80211_KEY_DEFAULT,
1384 NL80211_KEY_DEFAULT_MGMT,
1385
1386 /* keep last */
1387 __NL80211_KEY_AFTER_LAST,
1388 NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
1389};
1390
1227#endif /* __LINUX_NL80211_H */ 1391#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 2cda00ccfcca..b7d9435d5a9f 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -64,12 +64,14 @@ enum {
64 IEEE802154_ATTR_COORD_REALIGN, 64 IEEE802154_ATTR_COORD_REALIGN,
65 IEEE802154_ATTR_SEC, 65 IEEE802154_ATTR_SEC,
66 66
67 IEEE802154_ATTR_PAGE,
68
67 __IEEE802154_ATTR_MAX, 69 __IEEE802154_ATTR_MAX,
68}; 70};
69 71
70#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1) 72#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
71 73
72extern struct nla_policy ieee802154_policy[]; 74extern const struct nla_policy ieee802154_policy[];
73 75
74/* commands */ 76/* commands */
75/* REQ should be responded with CONF 77/* REQ should be responded with CONF
@@ -111,6 +113,8 @@ enum {
111 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */ 113 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
112 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */ 114 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
113 115
116 IEEE802154_LIST_IFACE,
117
114 __IEEE802154_CMD_MAX, 118 __IEEE802154_CMD_MAX,
115}; 119};
116 120
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 29af2d5df097..b752e807adde 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -28,8 +28,23 @@ static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { } 28static inline void acpi_nmi_enable(void) { }
29#endif 29#endif
30 30
31#ifndef trigger_all_cpu_backtrace 31/*
32#define trigger_all_cpu_backtrace() do { } while (0) 32 * Create trigger_all_cpu_backtrace() out of the arch-provided
33 * base function. Return whether such support was available,
34 * to allow calling code to fall back to some other mechanism:
35 */
36#ifdef arch_trigger_all_cpu_backtrace
37static inline bool trigger_all_cpu_backtrace(void)
38{
39 arch_trigger_all_cpu_backtrace();
40
41 return true;
42}
43#else
44static inline bool trigger_all_cpu_backtrace(void)
45{
46 return false;
47}
33#endif 48#endif
34 49
35#endif 50#endif
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 81bc252dc8ac..44428d247dbe 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -199,6 +199,8 @@ static inline int notifier_to_errno(int ret)
199#define NETDEV_FEAT_CHANGE 0x000B 199#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 200#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D 201#define NETDEV_PRE_UP 0x000D
202#define NETDEV_BONDING_OLDTYPE 0x000E
203#define NETDEV_BONDING_NEWTYPE 0x000F
202 204
203#define SYS_DOWN 0x0001 /* Notify of system down */ 205#define SYS_DOWN 0x0001 /* Notify of system down */
204#define SYS_RESTART SYS_DOWN 206#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/oom.h b/include/linux/oom.h
index a7979baf1e39..6aac5fe4f6f1 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -30,5 +30,16 @@ extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb); 31extern int unregister_oom_notifier(struct notifier_block *nb);
32 32
33extern bool oom_killer_disabled;
34
35static inline void oom_killer_disable(void)
36{
37 oom_killer_disabled = true;
38}
39
40static inline void oom_killer_enable(void)
41{
42 oom_killer_disabled = false;
43}
33#endif /* __KERNEL__*/ 44#endif /* __KERNEL__*/
34#endif /* _INCLUDE_LINUX_OOM_H */ 45#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 1d9518bc4c58..5171639ecf0f 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -67,6 +67,9 @@ struct oprofile_operations {
67 67
68 /* Initiate a stack backtrace. Optional. */ 68 /* Initiate a stack backtrace. Optional. */
69 void (*backtrace)(struct pt_regs * const regs, unsigned int depth); 69 void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
70
71 /* Multiplex between different events. Optional. */
72 int (*switch_events)(void);
70 /* CPU identification string. */ 73 /* CPU identification string. */
71 char * cpu_type; 74 char * cpu_type;
72}; 75};
@@ -171,7 +174,6 @@ struct op_sample;
171struct op_entry { 174struct op_entry {
172 struct ring_buffer_event *event; 175 struct ring_buffer_event *event;
173 struct op_sample *sample; 176 struct op_sample *sample;
174 unsigned long irq_flags;
175 unsigned long size; 177 unsigned long size;
176 unsigned long *data; 178 unsigned long *data;
177}; 179};
@@ -180,6 +182,7 @@ void oprofile_write_reserve(struct op_entry *entry,
180 struct pt_regs * const regs, 182 struct pt_regs * const regs,
181 unsigned long pc, int code, int size); 183 unsigned long pc, int code, int size);
182int oprofile_add_data(struct op_entry *entry, unsigned long val); 184int oprofile_add_data(struct op_entry *entry, unsigned long val);
185int oprofile_add_data64(struct op_entry *entry, u64 val);
183int oprofile_write_commit(struct op_entry *entry); 186int oprofile_write_commit(struct op_entry *entry);
184 187
185#endif /* OPROFILE_H */ 188#endif /* OPROFILE_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e2e5ce543595..6b202b173955 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -51,6 +51,9 @@
51 * PG_buddy is set to indicate that the page is free and in the buddy system 51 * PG_buddy is set to indicate that the page is free and in the buddy system
52 * (see mm/page_alloc.c). 52 * (see mm/page_alloc.c).
53 * 53 *
54 * PG_hwpoison indicates that a page got corrupted in hardware and contains
55 * data with incorrect ECC bits that triggered a machine check. Accessing is
56 * not safe since it may cause another machine check. Don't touch!
54 */ 57 */
55 58
56/* 59/*
@@ -99,9 +102,12 @@ enum pageflags {
99#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 102#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
100 PG_mlocked, /* Page is vma mlocked */ 103 PG_mlocked, /* Page is vma mlocked */
101#endif 104#endif
102#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 105#ifdef CONFIG_ARCH_USES_PG_UNCACHED
103 PG_uncached, /* Page has been mapped as uncached */ 106 PG_uncached, /* Page has been mapped as uncached */
104#endif 107#endif
108#ifdef CONFIG_MEMORY_FAILURE
109 PG_hwpoison, /* hardware poisoned page. Don't touch */
110#endif
105 __NR_PAGEFLAGS, 111 __NR_PAGEFLAGS,
106 112
107 /* Filesystems */ 113 /* Filesystems */
@@ -158,6 +164,9 @@ static inline int TestSetPage##uname(struct page *page) \
158static inline int TestClearPage##uname(struct page *page) \ 164static inline int TestClearPage##uname(struct page *page) \
159 { return test_and_clear_bit(PG_##lname, &page->flags); } 165 { return test_and_clear_bit(PG_##lname, &page->flags); }
160 166
167#define __TESTCLEARFLAG(uname, lname) \
168static inline int __TestClearPage##uname(struct page *page) \
169 { return __test_and_clear_bit(PG_##lname, &page->flags); }
161 170
162#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \ 171#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
163 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname) 172 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
@@ -184,6 +193,9 @@ static inline void __ClearPage##uname(struct page *page) { }
184#define TESTCLEARFLAG_FALSE(uname) \ 193#define TESTCLEARFLAG_FALSE(uname) \
185static inline int TestClearPage##uname(struct page *page) { return 0; } 194static inline int TestClearPage##uname(struct page *page) { return 0; }
186 195
196#define __TESTCLEARFLAG_FALSE(uname) \
197static inline int __TestClearPage##uname(struct page *page) { return 0; }
198
187struct page; /* forward declaration */ 199struct page; /* forward declaration */
188 200
189TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 201TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
@@ -250,19 +262,28 @@ PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
250#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 262#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
251#define MLOCK_PAGES 1 263#define MLOCK_PAGES 1
252PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 264PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
253 TESTSCFLAG(Mlocked, mlocked) 265 TESTSCFLAG(Mlocked, mlocked) __TESTCLEARFLAG(Mlocked, mlocked)
254#else 266#else
255#define MLOCK_PAGES 0 267#define MLOCK_PAGES 0
256PAGEFLAG_FALSE(Mlocked) 268PAGEFLAG_FALSE(Mlocked) SETPAGEFLAG_NOOP(Mlocked)
257 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) 269 TESTCLEARFLAG_FALSE(Mlocked) __TESTCLEARFLAG_FALSE(Mlocked)
258#endif 270#endif
259 271
260#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 272#ifdef CONFIG_ARCH_USES_PG_UNCACHED
261PAGEFLAG(Uncached, uncached) 273PAGEFLAG(Uncached, uncached)
262#else 274#else
263PAGEFLAG_FALSE(Uncached) 275PAGEFLAG_FALSE(Uncached)
264#endif 276#endif
265 277
278#ifdef CONFIG_MEMORY_FAILURE
279PAGEFLAG(HWPoison, hwpoison)
280TESTSETFLAG(HWPoison, hwpoison)
281#define __PG_HWPOISON (1UL << PG_hwpoison)
282#else
283PAGEFLAG_FALSE(HWPoison)
284#define __PG_HWPOISON 0
285#endif
286
266static inline int PageUptodate(struct page *page) 287static inline int PageUptodate(struct page *page)
267{ 288{
268 int ret = test_bit(PG_uptodate, &(page)->flags); 289 int ret = test_bit(PG_uptodate, &(page)->flags);
@@ -387,7 +408,7 @@ static inline void __ClearPageTail(struct page *page)
387 1 << PG_private | 1 << PG_private_2 | \ 408 1 << PG_private | 1 << PG_private_2 | \
388 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 409 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
389 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 410 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
390 1 << PG_unevictable | __PG_MLOCKED) 411 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON)
391 412
392/* 413/*
393 * Flags checked when a page is prepped for return by the page allocator. 414 * Flags checked when a page is prepped for return by the page allocator.
@@ -396,8 +417,8 @@ static inline void __ClearPageTail(struct page *page)
396 */ 417 */
397#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 418#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
398 419
399#endif /* !__GENERATING_BOUNDS_H */ 420#define PAGE_FLAGS_PRIVATE \
400 421 (1 << PG_private | 1 << PG_private_2)
401/** 422/**
402 * page_has_private - Determine if page has private stuff 423 * page_has_private - Determine if page has private stuff
403 * @page: The page to be checked 424 * @page: The page to be checked
@@ -405,8 +426,11 @@ static inline void __ClearPageTail(struct page *page)
405 * Determine if a page has private stuff, indicating that release routines 426 * Determine if a page has private stuff, indicating that release routines
406 * should be invoked upon it. 427 * should be invoked upon it.
407 */ 428 */
408#define page_has_private(page) \ 429static inline int page_has_private(struct page *page)
409 ((page)->flags & ((1 << PG_private) | \ 430{
410 (1 << PG_private_2))) 431 return !!(page->flags & PAGE_FLAGS_PRIVATE);
432}
433
434#endif /* !__GENERATING_BOUNDS_H */
411 435
412#endif /* PAGE_FLAGS_H */ 436#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 13f126c89ae8..4b938d4f3ac2 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -38,6 +38,7 @@ enum {
38 PCG_LOCK, /* page cgroup is locked */ 38 PCG_LOCK, /* page cgroup is locked */
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}; 42};
42 43
43#define TESTPCGFLAG(uname, lname) \ 44#define TESTPCGFLAG(uname, lname) \
@@ -52,11 +53,23 @@ static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
52static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ 53static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
53 { clear_bit(PCG_##lname, &pc->flags); } 54 { clear_bit(PCG_##lname, &pc->flags); }
54 55
56#define TESTCLEARPCGFLAG(uname, lname) \
57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
58 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
59
55/* Cache flag is set only once (at allocation) */ 60/* Cache flag is set only once (at allocation) */
56TESTPCGFLAG(Cache, CACHE) 61TESTPCGFLAG(Cache, CACHE)
62CLEARPCGFLAG(Cache, CACHE)
63SETPCGFLAG(Cache, CACHE)
57 64
58TESTPCGFLAG(Used, USED) 65TESTPCGFLAG(Used, USED)
59CLEARPCGFLAG(Used, USED) 66CLEARPCGFLAG(Used, USED)
67SETPCGFLAG(Used, USED)
68
69SETPCGFLAG(AcctLRU, ACCT_LRU)
70CLEARPCGFLAG(AcctLRU, ACCT_LRU)
71TESTPCGFLAG(AcctLRU, ACCT_LRU)
72TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
60 73
61static inline int page_cgroup_nid(struct page_cgroup *pc) 74static inline int page_cgroup_nid(struct page_cgroup *pc)
62{ 75{
@@ -105,14 +118,14 @@ static inline void __init page_cgroup_init_flatmem(void)
105 118
106#endif 119#endif
107 120
108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
109#include <linux/swap.h> 121#include <linux/swap.h>
122
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
110extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 124extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
111extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 125extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
112extern int swap_cgroup_swapon(int type, unsigned long max_pages); 126extern int swap_cgroup_swapon(int type, unsigned long max_pages);
113extern void swap_cgroup_swapoff(int type); 127extern void swap_cgroup_swapoff(int type);
114#else 128#else
115#include <linux/swap.h>
116 129
117static inline 130static inline
118unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) 131unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index aec3252afcf5..ed5d7501e181 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -132,7 +132,7 @@ static inline int page_cache_get_speculative(struct page *page)
132{ 132{
133 VM_BUG_ON(in_interrupt()); 133 VM_BUG_ON(in_interrupt());
134 134
135#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) 135#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
136# ifdef CONFIG_PREEMPT 136# ifdef CONFIG_PREEMPT
137 VM_BUG_ON(!in_atomic()); 137 VM_BUG_ON(!in_atomic());
138# endif 138# endif
@@ -170,7 +170,7 @@ static inline int page_cache_add_speculative(struct page *page, int count)
170{ 170{
171 VM_BUG_ON(in_interrupt()); 171 VM_BUG_ON(in_interrupt());
172 172
173#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU) 173#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
174# ifdef CONFIG_PREEMPT 174# ifdef CONFIG_PREEMPT
175 VM_BUG_ON(!in_atomic()); 175 VM_BUG_ON(!in_atomic());
176# endif 176# endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 115fb7ba5089..f5c7cd343e56 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -241,6 +241,7 @@ struct pci_dev {
241 unsigned int d1_support:1; /* Low power state D1 is supported */ 241 unsigned int d1_support:1; /* Low power state D1 is supported */
242 unsigned int d2_support:1; /* Low power state D2 is supported */ 242 unsigned int d2_support:1; /* Low power state D2 is supported */
243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
244 unsigned int wakeup_prepared:1;
244 245
245#ifdef CONFIG_PCIEASPM 246#ifdef CONFIG_PCIEASPM
246 struct pcie_link_state *link_state; /* ASPM link state. */ 247 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -273,9 +274,12 @@ struct pci_dev {
273 unsigned int ari_enabled:1; /* ARI forwarding */ 274 unsigned int ari_enabled:1; /* ARI forwarding */
274 unsigned int is_managed:1; 275 unsigned int is_managed:1;
275 unsigned int is_pcie:1; 276 unsigned int is_pcie:1;
277 unsigned int needs_freset:1; /* Dev requires fundamental reset */
276 unsigned int state_saved:1; 278 unsigned int state_saved:1;
277 unsigned int is_physfn:1; 279 unsigned int is_physfn:1;
278 unsigned int is_virtfn:1; 280 unsigned int is_virtfn:1;
281 unsigned int reset_fn:1;
282 unsigned int is_hotplug_bridge:1;
279 pci_dev_flags_t dev_flags; 283 pci_dev_flags_t dev_flags;
280 atomic_t enable_cnt; /* pci_enable_device has been called */ 284 atomic_t enable_cnt; /* pci_enable_device has been called */
281 285
@@ -794,6 +798,11 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *,
794void pci_unregister_driver(struct pci_driver *dev); 798void pci_unregister_driver(struct pci_driver *dev);
795void pci_remove_behind_bridge(struct pci_dev *dev); 799void pci_remove_behind_bridge(struct pci_dev *dev);
796struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 800struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
801int pci_add_dynid(struct pci_driver *drv,
802 unsigned int vendor, unsigned int device,
803 unsigned int subvendor, unsigned int subdevice,
804 unsigned int class, unsigned int class_mask,
805 unsigned long driver_data);
797const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, 806const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
798 struct pci_dev *dev); 807 struct pci_dev *dev);
799int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, 808int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
@@ -805,6 +814,8 @@ int pci_cfg_space_size_ext(struct pci_dev *dev);
805int pci_cfg_space_size(struct pci_dev *dev); 814int pci_cfg_space_size(struct pci_dev *dev);
806unsigned char pci_bus_max_busnr(struct pci_bus *bus); 815unsigned char pci_bus_max_busnr(struct pci_bus *bus);
807 816
817int pci_set_vga_state(struct pci_dev *pdev, bool decode,
818 unsigned int command_bits, bool change_bridge);
808/* kmem_cache style wrapper around pci_alloc_consistent() */ 819/* kmem_cache style wrapper around pci_alloc_consistent() */
809 820
810#include <linux/dmapool.h> 821#include <linux/dmapool.h>
@@ -1236,6 +1247,9 @@ extern int pci_pci_problems;
1236extern unsigned long pci_cardbus_io_size; 1247extern unsigned long pci_cardbus_io_size;
1237extern unsigned long pci_cardbus_mem_size; 1248extern unsigned long pci_cardbus_mem_size;
1238 1249
1250extern unsigned long pci_hotplug_io_size;
1251extern unsigned long pci_hotplug_mem_size;
1252
1239int pcibios_add_platform_entries(struct pci_dev *dev); 1253int pcibios_add_platform_entries(struct pci_dev *dev);
1240void pcibios_disable_device(struct pci_dev *dev); 1254void pcibios_disable_device(struct pci_dev *dev);
1241int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1255int pcibios_set_pcie_reset_state(struct pci_dev *dev,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 4391741b99dc..652ba797696d 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -62,7 +62,8 @@ enum pcie_link_width {
62}; 62};
63 63
64enum pcie_link_speed { 64enum pcie_link_speed {
65 PCIE_2PT5GB = 0x14, 65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
66 PCIE_LNK_SPEED_UNKNOWN = 0xFF, 67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
67}; 68};
68 69
@@ -226,11 +227,18 @@ struct hotplug_params {
226#ifdef CONFIG_ACPI 227#ifdef CONFIG_ACPI
227#include <acpi/acpi.h> 228#include <acpi/acpi.h>
228#include <acpi/acpi_bus.h> 229#include <acpi/acpi_bus.h>
229extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 230int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp);
230 struct hotplug_params *hpp);
231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
233int acpi_pci_detect_ejectable(struct pci_bus *pbus); 233int acpi_pci_detect_ejectable(acpi_handle handle);
234#else
235static inline int pci_get_hp_params(struct pci_dev *dev,
236 struct hotplug_params *hpp)
237{
238 return -ENODEV;
239}
234#endif 240#endif
241
242void pci_configure_slot(struct pci_dev *dev);
235#endif 243#endif
236 244
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 73b46b6b904f..84cf1f3b7838 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2,6 +2,9 @@
2 * PCI Class, Vendor and Device IDs 2 * PCI Class, Vendor and Device IDs
3 * 3 *
4 * Please keep sorted. 4 * Please keep sorted.
5 *
6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers.
5 */ 8 */
6 9
7/* Device classes and subclasses */ 10/* Device classes and subclasses */
@@ -479,6 +482,9 @@
479#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 482#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361
480#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 483#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252
481 484
485#define PCI_SUBVENDOR_ID_IBM 0x1014
486#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4
487
482#define PCI_VENDOR_ID_UNISYS 0x1018 488#define PCI_VENDOR_ID_UNISYS 0x1018
483#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C 489#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C
484 490
@@ -537,6 +543,8 @@
537#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 543#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450
538#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 544#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451
539#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 545#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458
546#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b
547#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F
540#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 548#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
541#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 549#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
542#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 550#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
@@ -545,9 +553,10 @@
545#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 553#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
546#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 554#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
547#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 555#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
548
549#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 556#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
550#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 557#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
558#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c
559#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800
551 560
552#define PCI_VENDOR_ID_TRIDENT 0x1023 561#define PCI_VENDOR_ID_TRIDENT 0x1023
553#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 562#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
@@ -768,6 +777,7 @@
768#define PCI_DEVICE_ID_TI_X515 0x8036 777#define PCI_DEVICE_ID_TI_X515 0x8036
769#define PCI_DEVICE_ID_TI_XX12 0x8039 778#define PCI_DEVICE_ID_TI_XX12 0x8039
770#define PCI_DEVICE_ID_TI_XX12_FM 0x803b 779#define PCI_DEVICE_ID_TI_XX12_FM 0x803b
780#define PCI_DEVICE_ID_TI_XIO2000A 0x8231
771#define PCI_DEVICE_ID_TI_1130 0xac12 781#define PCI_DEVICE_ID_TI_1130 0xac12
772#define PCI_DEVICE_ID_TI_1031 0xac13 782#define PCI_DEVICE_ID_TI_1031 0xac13
773#define PCI_DEVICE_ID_TI_1131 0xac15 783#define PCI_DEVICE_ID_TI_1131 0xac15
@@ -877,6 +887,7 @@
877#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 887#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051
878#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 888#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058
879#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 889#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059
890#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b
880#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 891#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066
881#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 892#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069
882#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a 893#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a
@@ -1521,6 +1532,8 @@
1521#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 1532#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007
1522#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008 1533#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008
1523#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009 1534#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009
1535#define PCI_DEVICE_ID_ARTOP_ATP867A 0x000A
1536#define PCI_DEVICE_ID_ARTOP_ATP867B 0x000B
1524#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 1537#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002
1525#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 1538#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010
1526#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 1539#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020
@@ -1943,6 +1956,8 @@
1943#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ 1956#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
1944#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ 1957#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
1945#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ 1958#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
1959#define PCI_DEVICE_ID_LAVA_QUATTRO_A 0x0120 /* 2x 16550A, half of 4 port */
1960#define PCI_DEVICE_ID_LAVA_QUATTRO_B 0x0121 /* 2x 16550A, half of 4 port */
1946#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */ 1961#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */
1947#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */ 1962#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */
1948#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ 1963#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
@@ -1984,6 +1999,8 @@
1984 1999
1985#define PCI_VENDOR_ID_SAMSUNG 0x144d 2000#define PCI_VENDOR_ID_SAMSUNG 0x144d
1986 2001
2002#define PCI_VENDOR_ID_GIGABYTE 0x1458
2003
1987#define PCI_VENDOR_ID_AMBIT 0x1468 2004#define PCI_VENDOR_ID_AMBIT 0x1468
1988 2005
1989#define PCI_VENDOR_ID_MYRICOM 0x14c1 2006#define PCI_VENDOR_ID_MYRICOM 0x14c1
@@ -2062,7 +2079,6 @@
2062#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 2079#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
2063#define PCI_DEVICE_ID_TIGON3_5782 0x1696 2080#define PCI_DEVICE_ID_TIGON3_5782 0x1696
2064#define PCI_DEVICE_ID_TIGON3_5784 0x1698 2081#define PCI_DEVICE_ID_TIGON3_5784 0x1698
2065#define PCI_DEVICE_ID_TIGON3_5785 0x1699
2066#define PCI_DEVICE_ID_TIGON3_5786 0x169a 2082#define PCI_DEVICE_ID_TIGON3_5786 0x169a
2067#define PCI_DEVICE_ID_TIGON3_5787 0x169b 2083#define PCI_DEVICE_ID_TIGON3_5787 0x169b
2068#define PCI_DEVICE_ID_TIGON3_5788 0x169c 2084#define PCI_DEVICE_ID_TIGON3_5788 0x169c
@@ -2149,6 +2165,10 @@
2149#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D 2165#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D
2150#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E 2166#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E
2151#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F 2167#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F
2168#define PCI_DEVICE_ID_ADDIDATA_APCIe7300 0x7010
2169#define PCI_DEVICE_ID_ADDIDATA_APCIe7420 0x7011
2170#define PCI_DEVICE_ID_ADDIDATA_APCIe7500 0x7012
2171#define PCI_DEVICE_ID_ADDIDATA_APCIe7800 0x7013
2152 2172
2153#define PCI_VENDOR_ID_PDC 0x15e9 2173#define PCI_VENDOR_ID_PDC 0x15e9
2154 2174
@@ -2515,6 +2535,16 @@
2515#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2535#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2516#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2536#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2517#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c 2537#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c
2538#define PCI_DEVICE_ID_INTEL_IOAT_JSF0 0x3710
2539#define PCI_DEVICE_ID_INTEL_IOAT_JSF1 0x3711
2540#define PCI_DEVICE_ID_INTEL_IOAT_JSF2 0x3712
2541#define PCI_DEVICE_ID_INTEL_IOAT_JSF3 0x3713
2542#define PCI_DEVICE_ID_INTEL_IOAT_JSF4 0x3714
2543#define PCI_DEVICE_ID_INTEL_IOAT_JSF5 0x3715
2544#define PCI_DEVICE_ID_INTEL_IOAT_JSF6 0x3716
2545#define PCI_DEVICE_ID_INTEL_IOAT_JSF7 0x3717
2546#define PCI_DEVICE_ID_INTEL_IOAT_JSF8 0x3718
2547#define PCI_DEVICE_ID_INTEL_IOAT_JSF9 0x3719
2518#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 2548#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14
2519#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 2549#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
2520#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 2550#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index fcaee42c7ac2..dd0bed4f1cf0 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -42,6 +42,7 @@
42#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ 42#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
43 43
44#define PCI_STATUS 0x06 /* 16 bits */ 44#define PCI_STATUS 0x06 /* 16 bits */
45#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
45#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ 46#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
46#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ 47#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
47#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ 48#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 68438e18fff4..9bd03193ecd4 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -10,22 +10,70 @@
10/* 10/*
11 * Base implementations of per-CPU variable declarations and definitions, where 11 * 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 12 * the section in which the variable is to be placed is provided by the
13 * 'section' argument. This may be used to affect the parameters governing the 13 * 'sec' argument. This may be used to affect the parameters governing the
14 * variable's storage. 14 * variable's storage.
15 * 15 *
16 * NOTE! The sections for the DECLARE and for the DEFINE must match, lest 16 * NOTE! The sections for the DECLARE and for the DEFINE must match, lest
17 * linkage errors occur due the compiler generating the wrong code to access 17 * linkage errors occur due the compiler generating the wrong code to access
18 * that section. 18 * that section.
19 */ 19 */
20#define DECLARE_PER_CPU_SECTION(type, name, section) \ 20#define __PCPU_ATTRS(sec) \
21 extern \ 21 __attribute__((section(PER_CPU_BASE_SECTION sec))) \
22 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ 22 PER_CPU_ATTRIBUTES
23 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 23
24 24#define __PCPU_DUMMY_ATTRS \
25#define DEFINE_PER_CPU_SECTION(type, name, section) \ 25 __attribute__((section(".discard"), unused))
26 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ 26
27 PER_CPU_ATTRIBUTES PER_CPU_DEF_ATTRIBUTES \ 27/*
28 * s390 and alpha modules require percpu variables to be defined as
29 * weak to force the compiler to generate GOT based external
30 * references for them. This is necessary because percpu sections
31 * will be located outside of the usually addressable area.
32 *
33 * This definition puts the following two extra restrictions when
34 * defining percpu variables.
35 *
36 * 1. The symbol must be globally unique, even the static ones.
37 * 2. Static percpu variables cannot be defined inside a function.
38 *
39 * Archs which need weak percpu definitions should define
40 * ARCH_NEEDS_WEAK_PER_CPU in asm/percpu.h when necessary.
41 *
42 * To ensure that the generic code observes the above two
43 * restrictions, if CONFIG_DEBUG_FORCE_WEAK_PER_CPU is set weak
44 * definition is used for all cases.
45 */
46#if defined(ARCH_NEEDS_WEAK_PER_CPU) || defined(CONFIG_DEBUG_FORCE_WEAK_PER_CPU)
47/*
48 * __pcpu_scope_* dummy variable is used to enforce scope. It
49 * receives the static modifier when it's used in front of
50 * DEFINE_PER_CPU() and will trigger build failure if
51 * DECLARE_PER_CPU() is used for the same variable.
52 *
53 * __pcpu_unique_* dummy variable is used to enforce symbol uniqueness
54 * such that hidden weak symbol collision, which will cause unrelated
55 * variables to share the same address, can be detected during build.
56 */
57#define DECLARE_PER_CPU_SECTION(type, name, sec) \
58 extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
59 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name
60
61#define DEFINE_PER_CPU_SECTION(type, name, sec) \
62 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
63 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
64 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \
28 __typeof__(type) per_cpu__##name 65 __typeof__(type) per_cpu__##name
66#else
67/*
68 * Normal declaration and definition macros.
69 */
70#define DECLARE_PER_CPU_SECTION(type, name, sec) \
71 extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name
72
73#define DEFINE_PER_CPU_SECTION(type, name, sec) \
74 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \
75 __typeof__(type) per_cpu__##name
76#endif
29 77
30/* 78/*
31 * Variant on the per-CPU variable declaration/definition theme used for 79 * Variant on the per-CPU variable declaration/definition theme used for
@@ -66,14 +114,24 @@
66 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ 114 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
67 ____cacheline_aligned_in_smp 115 ____cacheline_aligned_in_smp
68 116
117#define DECLARE_PER_CPU_ALIGNED(type, name) \
118 DECLARE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
119 ____cacheline_aligned
120
121#define DEFINE_PER_CPU_ALIGNED(type, name) \
122 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_ALIGNED_SECTION) \
123 ____cacheline_aligned
124
69/* 125/*
70 * Declaration/definition used for per-CPU variables that must be page aligned. 126 * Declaration/definition used for per-CPU variables that must be page aligned.
71 */ 127 */
72#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ 128#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \
73 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") 129 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") \
130 __aligned(PAGE_SIZE)
74 131
75#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ 132#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
76 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") 133 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") \
134 __aligned(PAGE_SIZE)
77 135
78/* 136/*
79 * Intermodule exports for per-CPU variables. 137 * Intermodule exports for per-CPU variables.
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 26fd9d12f050..878836ca999c 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -34,7 +34,7 @@
34 34
35#ifdef CONFIG_SMP 35#ifdef CONFIG_SMP
36 36
37#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA 37#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
38 38
39/* minimum unit size, also is the maximum supported allocation size */ 39/* minimum unit size, also is the maximum supported allocation size */
40#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 40#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
@@ -57,19 +57,70 @@
57#endif 57#endif
58 58
59extern void *pcpu_base_addr; 59extern void *pcpu_base_addr;
60extern const unsigned long *pcpu_unit_offsets;
60 61
61typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); 62struct pcpu_group_info {
62typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); 63 int nr_units; /* aligned # of units */
64 unsigned long base_offset; /* base address offset */
65 unsigned int *cpu_map; /* unit->cpu map, empty
66 * entries contain NR_CPUS */
67};
68
69struct pcpu_alloc_info {
70 size_t static_size;
71 size_t reserved_size;
72 size_t dyn_size;
73 size_t unit_size;
74 size_t atom_size;
75 size_t alloc_size;
76 size_t __ai_size; /* internal, don't use */
77 int nr_groups; /* 0 if grouping unnecessary */
78 struct pcpu_group_info groups[];
79};
63 80
64extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, 81enum pcpu_fc {
65 size_t static_size, size_t reserved_size, 82 PCPU_FC_AUTO,
66 ssize_t dyn_size, ssize_t unit_size, 83 PCPU_FC_EMBED,
67 void *base_addr, 84 PCPU_FC_PAGE,
68 pcpu_populate_pte_fn_t populate_pte_fn);
69 85
70extern ssize_t __init pcpu_embed_first_chunk( 86 PCPU_FC_NR,
71 size_t static_size, size_t reserved_size, 87};
72 ssize_t dyn_size, ssize_t unit_size); 88extern const char *pcpu_fc_names[PCPU_FC_NR];
89
90extern enum pcpu_fc pcpu_chosen_fc;
91
92typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size,
93 size_t align);
94typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size);
95typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr);
96typedef int (pcpu_fc_cpu_distance_fn_t)(unsigned int from, unsigned int to);
97
98extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
99 int nr_units);
100extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
101
102extern struct pcpu_alloc_info * __init pcpu_build_alloc_info(
103 size_t reserved_size, ssize_t dyn_size,
104 size_t atom_size,
105 pcpu_fc_cpu_distance_fn_t cpu_distance_fn);
106
107extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
108 void *base_addr);
109
110#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
111extern int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size,
112 size_t atom_size,
113 pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
114 pcpu_fc_alloc_fn_t alloc_fn,
115 pcpu_fc_free_fn_t free_fn);
116#endif
117
118#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
119extern int __init pcpu_page_first_chunk(size_t reserved_size,
120 pcpu_fc_alloc_fn_t alloc_fn,
121 pcpu_fc_free_fn_t free_fn,
122 pcpu_fc_populate_pte_fn_t populate_pte_fn);
123#endif
73 124
74/* 125/*
75 * Use this to get to a cpu's version of the per-cpu object 126 * Use this to get to a cpu's version of the per-cpu object
@@ -80,7 +131,7 @@ extern ssize_t __init pcpu_embed_first_chunk(
80 131
81extern void *__alloc_reserved_percpu(size_t size, size_t align); 132extern void *__alloc_reserved_percpu(size_t size, size_t align);
82 133
83#else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ 134#else /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */
84 135
85struct percpu_data { 136struct percpu_data {
86 void *ptrs[1]; 137 void *ptrs[1];
@@ -99,11 +150,15 @@ struct percpu_data {
99 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 150 (__typeof__(ptr))__p->ptrs[(cpu)]; \
100}) 151})
101 152
102#endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ 153#endif /* CONFIG_HAVE_LEGACY_PER_CPU_AREA */
103 154
104extern void *__alloc_percpu(size_t size, size_t align); 155extern void *__alloc_percpu(size_t size, size_t align);
105extern void free_percpu(void *__pdata); 156extern void free_percpu(void *__pdata);
106 157
158#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
159extern void __init setup_per_cpu_areas(void);
160#endif
161
107#else /* CONFIG_SMP */ 162#else /* CONFIG_SMP */
108 163
109#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 164#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
@@ -124,6 +179,13 @@ static inline void free_percpu(void *p)
124 kfree(p); 179 kfree(p);
125} 180}
126 181
182static inline void __init setup_per_cpu_areas(void) { }
183
184static inline void *pcpu_lpage_remapped(void *kaddr)
185{
186 return NULL;
187}
188
127#endif /* CONFIG_SMP */ 189#endif /* CONFIG_SMP */
128 190
129#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \ 191#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index b53f7006cc4e..7b7fbf433cff 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * Performance counters: 2 * NOTE: this file will be removed in a future kernel release, it is
3 * provided as a courtesy copy of user-space code that relies on the
4 * old (pre-rename) symbols and constants.
5 *
6 * Performance events:
3 * 7 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> 8 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar 9 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
@@ -131,19 +135,19 @@ enum perf_counter_sample_format {
131 * as specified by attr.read_format: 135 * as specified by attr.read_format:
132 * 136 *
133 * struct read_format { 137 * struct read_format {
134 * { u64 value; 138 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 139 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING 140 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID 141 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP 142 * } && !PERF_FORMAT_GROUP
139 * 143 *
140 * { u64 nr; 144 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 145 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING 146 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value; 147 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID 148 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr]; 149 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP 150 * } && PERF_FORMAT_GROUP
147 * }; 151 * };
148 */ 152 */
149enum perf_counter_read_format { 153enum perf_counter_read_format {
@@ -199,10 +203,14 @@ struct perf_counter_attr {
199 inherit_stat : 1, /* per task counts */ 203 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */ 204 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */ 205 task : 1, /* trace fork/exit */
206 watermark : 1, /* wakeup_watermark */
202 207
203 __reserved_1 : 50; 208 __reserved_1 : 49;
204 209
205 __u32 wakeup_events; /* wakeup every n events */ 210 union {
211 __u32 wakeup_events; /* wakeup every n events */
212 __u32 wakeup_watermark; /* bytes before wakeup */
213 };
206 __u32 __reserved_2; 214 __u32 __reserved_2;
207 215
208 __u64 __reserved_3; 216 __u64 __reserved_3;
@@ -216,6 +224,7 @@ struct perf_counter_attr {
216#define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) 224#define PERF_COUNTER_IOC_REFRESH _IO ('$', 2)
217#define PERF_COUNTER_IOC_RESET _IO ('$', 3) 225#define PERF_COUNTER_IOC_RESET _IO ('$', 3)
218#define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) 226#define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64)
227#define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5)
219 228
220enum perf_counter_ioc_flags { 229enum perf_counter_ioc_flags {
221 PERF_IOC_FLAG_GROUP = 1U << 0, 230 PERF_IOC_FLAG_GROUP = 1U << 0,
@@ -309,9 +318,9 @@ enum perf_event_type {
309 318
310 /* 319 /*
311 * struct { 320 * struct {
312 * struct perf_event_header header; 321 * struct perf_event_header header;
313 * u64 id; 322 * u64 id;
314 * u64 lost; 323 * u64 lost;
315 * }; 324 * };
316 */ 325 */
317 PERF_EVENT_LOST = 2, 326 PERF_EVENT_LOST = 2,
@@ -331,6 +340,7 @@ enum perf_event_type {
331 * struct perf_event_header header; 340 * struct perf_event_header header;
332 * u32 pid, ppid; 341 * u32 pid, ppid;
333 * u32 tid, ptid; 342 * u32 tid, ptid;
343 * u64 time;
334 * }; 344 * };
335 */ 345 */
336 PERF_EVENT_EXIT = 4, 346 PERF_EVENT_EXIT = 4,
@@ -351,16 +361,17 @@ enum perf_event_type {
351 * struct perf_event_header header; 361 * struct perf_event_header header;
352 * u32 pid, ppid; 362 * u32 pid, ppid;
353 * u32 tid, ptid; 363 * u32 tid, ptid;
364 * u64 time;
354 * }; 365 * };
355 */ 366 */
356 PERF_EVENT_FORK = 7, 367 PERF_EVENT_FORK = 7,
357 368
358 /* 369 /*
359 * struct { 370 * struct {
360 * struct perf_event_header header; 371 * struct perf_event_header header;
361 * u32 pid, tid; 372 * u32 pid, tid;
362 * 373 *
363 * struct read_format values; 374 * struct read_format values;
364 * }; 375 * };
365 */ 376 */
366 PERF_EVENT_READ = 8, 377 PERF_EVENT_READ = 8,
@@ -376,23 +387,23 @@ enum perf_event_type {
376 * { u64 id; } && PERF_SAMPLE_ID 387 * { u64 id; } && PERF_SAMPLE_ID
377 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID 388 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
378 * { u32 cpu, res; } && PERF_SAMPLE_CPU 389 * { u32 cpu, res; } && PERF_SAMPLE_CPU
379 * { u64 period; } && PERF_SAMPLE_PERIOD 390 * { u64 period; } && PERF_SAMPLE_PERIOD
380 * 391 *
381 * { struct read_format values; } && PERF_SAMPLE_READ 392 * { struct read_format values; } && PERF_SAMPLE_READ
382 * 393 *
383 * { u64 nr, 394 * { u64 nr,
384 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN 395 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
385 * 396 *
386 * # 397 * #
387 * # The RAW record below is opaque data wrt the ABI 398 * # The RAW record below is opaque data wrt the ABI
388 * # 399 * #
389 * # That is, the ABI doesn't make any promises wrt to 400 * # That is, the ABI doesn't make any promises wrt to
390 * # the stability of its content, it may vary depending 401 * # the stability of its content, it may vary depending
391 * # on event, hardware, kernel version and phase of 402 * # on event, hardware, kernel version and phase of
392 * # the moon. 403 * # the moon.
393 * # 404 * #
394 * # In other words, PERF_SAMPLE_RAW contents are not an ABI. 405 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
395 * # 406 * #
396 * 407 *
397 * { u32 size; 408 * { u32 size;
398 * char data[size];}&& PERF_SAMPLE_RAW 409 * char data[size];}&& PERF_SAMPLE_RAW
@@ -415,386 +426,16 @@ enum perf_callchain_context {
415 PERF_CONTEXT_MAX = (__u64)-4095, 426 PERF_CONTEXT_MAX = (__u64)-4095,
416}; 427};
417 428
418#ifdef __KERNEL__ 429#define PERF_FLAG_FD_NO_GROUP (1U << 0)
419/* 430#define PERF_FLAG_FD_OUTPUT (1U << 1)
420 * Kernel-internal data types and definitions:
421 */
422
423#ifdef CONFIG_PERF_COUNTERS
424# include <asm/perf_counter.h>
425#endif
426
427#include <linux/list.h>
428#include <linux/mutex.h>
429#include <linux/rculist.h>
430#include <linux/rcupdate.h>
431#include <linux/spinlock.h>
432#include <linux/hrtimer.h>
433#include <linux/fs.h>
434#include <linux/pid_namespace.h>
435#include <asm/atomic.h>
436
437#define PERF_MAX_STACK_DEPTH 255
438
439struct perf_callchain_entry {
440 __u64 nr;
441 __u64 ip[PERF_MAX_STACK_DEPTH];
442};
443
444struct perf_raw_record {
445 u32 size;
446 void *data;
447};
448
449struct task_struct;
450
451/**
452 * struct hw_perf_counter - performance counter hardware details:
453 */
454struct hw_perf_counter {
455#ifdef CONFIG_PERF_COUNTERS
456 union {
457 struct { /* hardware */
458 u64 config;
459 unsigned long config_base;
460 unsigned long counter_base;
461 int idx;
462 };
463 union { /* software */
464 atomic64_t count;
465 struct hrtimer hrtimer;
466 };
467 };
468 atomic64_t prev_count;
469 u64 sample_period;
470 u64 last_period;
471 atomic64_t period_left;
472 u64 interrupts;
473
474 u64 freq_count;
475 u64 freq_interrupts;
476 u64 freq_stamp;
477#endif
478};
479
480struct perf_counter;
481
482/**
483 * struct pmu - generic performance monitoring unit
484 */
485struct pmu {
486 int (*enable) (struct perf_counter *counter);
487 void (*disable) (struct perf_counter *counter);
488 void (*read) (struct perf_counter *counter);
489 void (*unthrottle) (struct perf_counter *counter);
490};
491
492/**
493 * enum perf_counter_active_state - the states of a counter
494 */
495enum perf_counter_active_state {
496 PERF_COUNTER_STATE_ERROR = -2,
497 PERF_COUNTER_STATE_OFF = -1,
498 PERF_COUNTER_STATE_INACTIVE = 0,
499 PERF_COUNTER_STATE_ACTIVE = 1,
500};
501
502struct file;
503
504struct perf_mmap_data {
505 struct rcu_head rcu_head;
506 int nr_pages; /* nr of data pages */
507 int writable; /* are we writable */
508 int nr_locked; /* nr pages mlocked */
509
510 atomic_t poll; /* POLL_ for wakeups */
511 atomic_t events; /* event limit */
512
513 atomic_long_t head; /* write position */
514 atomic_long_t done_head; /* completed head */
515
516 atomic_t lock; /* concurrent writes */
517 atomic_t wakeup; /* needs a wakeup */
518 atomic_t lost; /* nr records lost */
519
520 struct perf_counter_mmap_page *user_page;
521 void *data_pages[0];
522};
523
524struct perf_pending_entry {
525 struct perf_pending_entry *next;
526 void (*func)(struct perf_pending_entry *);
527};
528
529/**
530 * struct perf_counter - performance counter kernel representation:
531 */
532struct perf_counter {
533#ifdef CONFIG_PERF_COUNTERS
534 struct list_head list_entry;
535 struct list_head event_entry;
536 struct list_head sibling_list;
537 int nr_siblings;
538 struct perf_counter *group_leader;
539 const struct pmu *pmu;
540
541 enum perf_counter_active_state state;
542 atomic64_t count;
543
544 /*
545 * These are the total time in nanoseconds that the counter
546 * has been enabled (i.e. eligible to run, and the task has
547 * been scheduled in, if this is a per-task counter)
548 * and running (scheduled onto the CPU), respectively.
549 *
550 * They are computed from tstamp_enabled, tstamp_running and
551 * tstamp_stopped when the counter is in INACTIVE or ACTIVE state.
552 */
553 u64 total_time_enabled;
554 u64 total_time_running;
555
556 /*
557 * These are timestamps used for computing total_time_enabled
558 * and total_time_running when the counter is in INACTIVE or
559 * ACTIVE state, measured in nanoseconds from an arbitrary point
560 * in time.
561 * tstamp_enabled: the notional time when the counter was enabled
562 * tstamp_running: the notional time when the counter was scheduled on
563 * tstamp_stopped: in INACTIVE state, the notional time when the
564 * counter was scheduled off.
565 */
566 u64 tstamp_enabled;
567 u64 tstamp_running;
568 u64 tstamp_stopped;
569
570 struct perf_counter_attr attr;
571 struct hw_perf_counter hw;
572
573 struct perf_counter_context *ctx;
574 struct file *filp;
575
576 /*
577 * These accumulate total time (in nanoseconds) that children
578 * counters have been enabled and running, respectively.
579 */
580 atomic64_t child_total_time_enabled;
581 atomic64_t child_total_time_running;
582
583 /*
584 * Protect attach/detach and child_list:
585 */
586 struct mutex child_mutex;
587 struct list_head child_list;
588 struct perf_counter *parent;
589
590 int oncpu;
591 int cpu;
592
593 struct list_head owner_entry;
594 struct task_struct *owner;
595
596 /* mmap bits */
597 struct mutex mmap_mutex;
598 atomic_t mmap_count;
599 struct perf_mmap_data *data;
600
601 /* poll related */
602 wait_queue_head_t waitq;
603 struct fasync_struct *fasync;
604
605 /* delayed work for NMIs and such */
606 int pending_wakeup;
607 int pending_kill;
608 int pending_disable;
609 struct perf_pending_entry pending;
610
611 atomic_t event_limit;
612
613 void (*destroy)(struct perf_counter *);
614 struct rcu_head rcu_head;
615
616 struct pid_namespace *ns;
617 u64 id;
618#endif
619};
620
621/**
622 * struct perf_counter_context - counter context structure
623 *
624 * Used as a container for task counters and CPU counters as well:
625 */
626struct perf_counter_context {
627 /*
628 * Protect the states of the counters in the list,
629 * nr_active, and the list:
630 */
631 spinlock_t lock;
632 /*
633 * Protect the list of counters. Locking either mutex or lock
634 * is sufficient to ensure the list doesn't change; to change
635 * the list you need to lock both the mutex and the spinlock.
636 */
637 struct mutex mutex;
638
639 struct list_head counter_list;
640 struct list_head event_list;
641 int nr_counters;
642 int nr_active;
643 int is_active;
644 int nr_stat;
645 atomic_t refcount;
646 struct task_struct *task;
647
648 /*
649 * Context clock, runs when context enabled.
650 */
651 u64 time;
652 u64 timestamp;
653
654 /*
655 * These fields let us detect when two contexts have both
656 * been cloned (inherited) from a common ancestor.
657 */
658 struct perf_counter_context *parent_ctx;
659 u64 parent_gen;
660 u64 generation;
661 int pin_count;
662 struct rcu_head rcu_head;
663};
664
665/**
666 * struct perf_counter_cpu_context - per cpu counter context structure
667 */
668struct perf_cpu_context {
669 struct perf_counter_context ctx;
670 struct perf_counter_context *task_ctx;
671 int active_oncpu;
672 int max_pertask;
673 int exclusive;
674
675 /*
676 * Recursion avoidance:
677 *
678 * task, softirq, irq, nmi context
679 */
680 int recursion[4];
681};
682
683#ifdef CONFIG_PERF_COUNTERS
684 431
685/* 432/*
686 * Set by architecture code: 433 * In case some app still references the old symbols:
687 */ 434 */
688extern int perf_max_counters;
689
690extern const struct pmu *hw_perf_counter_init(struct perf_counter *counter);
691
692extern void perf_counter_task_sched_in(struct task_struct *task, int cpu);
693extern void perf_counter_task_sched_out(struct task_struct *task,
694 struct task_struct *next, int cpu);
695extern void perf_counter_task_tick(struct task_struct *task, int cpu);
696extern int perf_counter_init_task(struct task_struct *child);
697extern void perf_counter_exit_task(struct task_struct *child);
698extern void perf_counter_free_task(struct task_struct *task);
699extern void set_perf_counter_pending(void);
700extern void perf_counter_do_pending(void);
701extern void perf_counter_print_debug(void);
702extern void __perf_disable(void);
703extern bool __perf_enable(void);
704extern void perf_disable(void);
705extern void perf_enable(void);
706extern int perf_counter_task_disable(void);
707extern int perf_counter_task_enable(void);
708extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
709 struct perf_cpu_context *cpuctx,
710 struct perf_counter_context *ctx, int cpu);
711extern void perf_counter_update_userpage(struct perf_counter *counter);
712
713struct perf_sample_data {
714 struct pt_regs *regs;
715 u64 addr;
716 u64 period;
717 struct perf_raw_record *raw;
718};
719 435
720extern int perf_counter_overflow(struct perf_counter *counter, int nmi, 436#define __NR_perf_counter_open __NR_perf_event_open
721 struct perf_sample_data *data); 437
722extern void perf_counter_output(struct perf_counter *counter, int nmi, 438#define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE
723 struct perf_sample_data *data); 439#define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE
724 440
725/*
726 * Return 1 for a software counter, 0 for a hardware counter
727 */
728static inline int is_software_counter(struct perf_counter *counter)
729{
730 return (counter->attr.type != PERF_TYPE_RAW) &&
731 (counter->attr.type != PERF_TYPE_HARDWARE) &&
732 (counter->attr.type != PERF_TYPE_HW_CACHE);
733}
734
735extern atomic_t perf_swcounter_enabled[PERF_COUNT_SW_MAX];
736
737extern void __perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
738
739static inline void
740perf_swcounter_event(u32 event, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
741{
742 if (atomic_read(&perf_swcounter_enabled[event]))
743 __perf_swcounter_event(event, nr, nmi, regs, addr);
744}
745
746extern void __perf_counter_mmap(struct vm_area_struct *vma);
747
748static inline void perf_counter_mmap(struct vm_area_struct *vma)
749{
750 if (vma->vm_flags & VM_EXEC)
751 __perf_counter_mmap(vma);
752}
753
754extern void perf_counter_comm(struct task_struct *tsk);
755extern void perf_counter_fork(struct task_struct *tsk);
756
757extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
758
759extern int sysctl_perf_counter_paranoid;
760extern int sysctl_perf_counter_mlock;
761extern int sysctl_perf_counter_sample_rate;
762
763extern void perf_counter_init(void);
764
765#ifndef perf_misc_flags
766#define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
767 PERF_EVENT_MISC_KERNEL)
768#define perf_instruction_pointer(regs) instruction_pointer(regs)
769#endif
770
771#else
772static inline void
773perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
774static inline void
775perf_counter_task_sched_out(struct task_struct *task,
776 struct task_struct *next, int cpu) { }
777static inline void
778perf_counter_task_tick(struct task_struct *task, int cpu) { }
779static inline int perf_counter_init_task(struct task_struct *child) { return 0; }
780static inline void perf_counter_exit_task(struct task_struct *child) { }
781static inline void perf_counter_free_task(struct task_struct *task) { }
782static inline void perf_counter_do_pending(void) { }
783static inline void perf_counter_print_debug(void) { }
784static inline void perf_disable(void) { }
785static inline void perf_enable(void) { }
786static inline int perf_counter_task_disable(void) { return -EINVAL; }
787static inline int perf_counter_task_enable(void) { return -EINVAL; }
788
789static inline void
790perf_swcounter_event(u32 event, u64 nr, int nmi,
791 struct pt_regs *regs, u64 addr) { }
792
793static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
794static inline void perf_counter_comm(struct task_struct *tsk) { }
795static inline void perf_counter_fork(struct task_struct *tsk) { }
796static inline void perf_counter_init(void) { }
797#endif
798
799#endif /* __KERNEL__ */
800#endif /* _LINUX_PERF_COUNTER_H */ 441#endif /* _LINUX_PERF_COUNTER_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
new file mode 100644
index 000000000000..9e7012689a84
--- /dev/null
+++ b/include/linux/perf_event.h
@@ -0,0 +1,863 @@
1/*
2 * Performance events:
3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
7 *
8 * Data type definitions, declarations, prototypes.
9 *
10 * Started by: Thomas Gleixner and Ingo Molnar
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14#ifndef _LINUX_PERF_EVENT_H
15#define _LINUX_PERF_EVENT_H
16
17#include <linux/types.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20
21/*
22 * User-space ABI bits:
23 */
24
25/*
26 * attr.type
27 */
28enum perf_type_id {
29 PERF_TYPE_HARDWARE = 0,
30 PERF_TYPE_SOFTWARE = 1,
31 PERF_TYPE_TRACEPOINT = 2,
32 PERF_TYPE_HW_CACHE = 3,
33 PERF_TYPE_RAW = 4,
34
35 PERF_TYPE_MAX, /* non-ABI */
36};
37
38/*
39 * Generalized performance event event_id types, used by the
40 * attr.event_id parameter of the sys_perf_event_open()
41 * syscall:
42 */
43enum perf_hw_id {
44 /*
45 * Common hardware events, generalized by the kernel:
46 */
47 PERF_COUNT_HW_CPU_CYCLES = 0,
48 PERF_COUNT_HW_INSTRUCTIONS = 1,
49 PERF_COUNT_HW_CACHE_REFERENCES = 2,
50 PERF_COUNT_HW_CACHE_MISSES = 3,
51 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
52 PERF_COUNT_HW_BRANCH_MISSES = 5,
53 PERF_COUNT_HW_BUS_CYCLES = 6,
54
55 PERF_COUNT_HW_MAX, /* non-ABI */
56};
57
58/*
59 * Generalized hardware cache events:
60 *
61 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
62 * { read, write, prefetch } x
63 * { accesses, misses }
64 */
65enum perf_hw_cache_id {
66 PERF_COUNT_HW_CACHE_L1D = 0,
67 PERF_COUNT_HW_CACHE_L1I = 1,
68 PERF_COUNT_HW_CACHE_LL = 2,
69 PERF_COUNT_HW_CACHE_DTLB = 3,
70 PERF_COUNT_HW_CACHE_ITLB = 4,
71 PERF_COUNT_HW_CACHE_BPU = 5,
72
73 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
74};
75
76enum perf_hw_cache_op_id {
77 PERF_COUNT_HW_CACHE_OP_READ = 0,
78 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
79 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
80
81 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
82};
83
84enum perf_hw_cache_op_result_id {
85 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
86 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
87
88 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
89};
90
91/*
92 * Special "software" events provided by the kernel, even if the hardware
93 * does not support performance events. These events measure various
94 * physical and sw events of the kernel (and allow the profiling of them as
95 * well):
96 */
97enum perf_sw_ids {
98 PERF_COUNT_SW_CPU_CLOCK = 0,
99 PERF_COUNT_SW_TASK_CLOCK = 1,
100 PERF_COUNT_SW_PAGE_FAULTS = 2,
101 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
102 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
105
106 PERF_COUNT_SW_MAX, /* non-ABI */
107};
108
109/*
110 * Bits that can be set in attr.sample_type to request information
111 * in the overflow packets.
112 */
113enum perf_event_sample_format {
114 PERF_SAMPLE_IP = 1U << 0,
115 PERF_SAMPLE_TID = 1U << 1,
116 PERF_SAMPLE_TIME = 1U << 2,
117 PERF_SAMPLE_ADDR = 1U << 3,
118 PERF_SAMPLE_READ = 1U << 4,
119 PERF_SAMPLE_CALLCHAIN = 1U << 5,
120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8,
123 PERF_SAMPLE_STREAM_ID = 1U << 9,
124 PERF_SAMPLE_RAW = 1U << 10,
125
126 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */
127};
128
129/*
130 * The format of the data returned by read() on a perf event fd,
131 * as specified by attr.read_format:
132 *
133 * struct read_format {
134 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP
139 *
140 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP
147 * };
148 */
149enum perf_event_read_format {
150 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
151 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
152 PERF_FORMAT_ID = 1U << 2,
153 PERF_FORMAT_GROUP = 1U << 3,
154
155 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
156};
157
158#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
159
160/*
161 * Hardware event_id to monitor via a performance monitoring event:
162 */
163struct perf_event_attr {
164
165 /*
166 * Major type: hardware/software/tracepoint/etc.
167 */
168 __u32 type;
169
170 /*
171 * Size of the attr structure, for fwd/bwd compat.
172 */
173 __u32 size;
174
175 /*
176 * Type specific configuration information.
177 */
178 __u64 config;
179
180 union {
181 __u64 sample_period;
182 __u64 sample_freq;
183 };
184
185 __u64 sample_type;
186 __u64 read_format;
187
188 __u64 disabled : 1, /* off by default */
189 inherit : 1, /* children inherit it */
190 pinned : 1, /* must always be on PMU */
191 exclusive : 1, /* only group on PMU */
192 exclude_user : 1, /* don't count user */
193 exclude_kernel : 1, /* ditto kernel */
194 exclude_hv : 1, /* ditto hypervisor */
195 exclude_idle : 1, /* don't count when idle */
196 mmap : 1, /* include mmap data */
197 comm : 1, /* include comm data */
198 freq : 1, /* use freq, not period */
199 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */
202 watermark : 1, /* wakeup_watermark */
203
204 __reserved_1 : 49;
205
206 union {
207 __u32 wakeup_events; /* wakeup every n events */
208 __u32 wakeup_watermark; /* bytes before wakeup */
209 };
210 __u32 __reserved_2;
211
212 __u64 __reserved_3;
213};
214
215/*
216 * Ioctls that can be done on a perf event fd:
217 */
218#define PERF_EVENT_IOC_ENABLE _IO ('$', 0)
219#define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
220#define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
221#define PERF_EVENT_IOC_RESET _IO ('$', 3)
222#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64)
223#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
224
225enum perf_event_ioc_flags {
226 PERF_IOC_FLAG_GROUP = 1U << 0,
227};
228
229/*
230 * Structure of the page that can be mapped via mmap
231 */
232struct perf_event_mmap_page {
233 __u32 version; /* version number of this structure */
234 __u32 compat_version; /* lowest version this is compat with */
235
236 /*
237 * Bits needed to read the hw events in user-space.
238 *
239 * u32 seq;
240 * s64 count;
241 *
242 * do {
243 * seq = pc->lock;
244 *
245 * barrier()
246 * if (pc->index) {
247 * count = pmc_read(pc->index - 1);
248 * count += pc->offset;
249 * } else
250 * goto regular_read;
251 *
252 * barrier();
253 * } while (pc->lock != seq);
254 *
255 * NOTE: for obvious reason this only works on self-monitoring
256 * processes.
257 */
258 __u32 lock; /* seqlock for synchronization */
259 __u32 index; /* hardware event identifier */
260 __s64 offset; /* add to hardware event value */
261 __u64 time_enabled; /* time event active */
262 __u64 time_running; /* time event on cpu */
263
264 /*
265 * Hole for extension of the self monitor capabilities
266 */
267
268 __u64 __reserved[123]; /* align to 1k */
269
270 /*
271 * Control data for the mmap() data buffer.
272 *
273 * User-space reading the @data_head value should issue an rmb(), on
274 * SMP capable platforms, after reading this value -- see
275 * perf_event_wakeup().
276 *
277 * When the mapping is PROT_WRITE the @data_tail value should be
278 * written by userspace to reflect the last read data. In this case
279 * the kernel will not over-write unread data.
280 */
281 __u64 data_head; /* head in the data section */
282 __u64 data_tail; /* user-space written tail */
283};
284
285#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0)
286#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
287#define PERF_RECORD_MISC_KERNEL (1 << 0)
288#define PERF_RECORD_MISC_USER (2 << 0)
289#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
290
291struct perf_event_header {
292 __u32 type;
293 __u16 misc;
294 __u16 size;
295};
296
297enum perf_event_type {
298
299 /*
300 * The MMAP events record the PROT_EXEC mappings so that we can
301 * correlate userspace IPs to code. They have the following structure:
302 *
303 * struct {
304 * struct perf_event_header header;
305 *
306 * u32 pid, tid;
307 * u64 addr;
308 * u64 len;
309 * u64 pgoff;
310 * char filename[];
311 * };
312 */
313 PERF_RECORD_MMAP = 1,
314
315 /*
316 * struct {
317 * struct perf_event_header header;
318 * u64 id;
319 * u64 lost;
320 * };
321 */
322 PERF_RECORD_LOST = 2,
323
324 /*
325 * struct {
326 * struct perf_event_header header;
327 *
328 * u32 pid, tid;
329 * char comm[];
330 * };
331 */
332 PERF_RECORD_COMM = 3,
333
334 /*
335 * struct {
336 * struct perf_event_header header;
337 * u32 pid, ppid;
338 * u32 tid, ptid;
339 * u64 time;
340 * };
341 */
342 PERF_RECORD_EXIT = 4,
343
344 /*
345 * struct {
346 * struct perf_event_header header;
347 * u64 time;
348 * u64 id;
349 * u64 stream_id;
350 * };
351 */
352 PERF_RECORD_THROTTLE = 5,
353 PERF_RECORD_UNTHROTTLE = 6,
354
355 /*
356 * struct {
357 * struct perf_event_header header;
358 * u32 pid, ppid;
359 * u32 tid, ptid;
360 * u64 time;
361 * };
362 */
363 PERF_RECORD_FORK = 7,
364
365 /*
366 * struct {
367 * struct perf_event_header header;
368 * u32 pid, tid;
369 *
370 * struct read_format values;
371 * };
372 */
373 PERF_RECORD_READ = 8,
374
375 /*
376 * struct {
377 * struct perf_event_header header;
378 *
379 * { u64 ip; } && PERF_SAMPLE_IP
380 * { u32 pid, tid; } && PERF_SAMPLE_TID
381 * { u64 time; } && PERF_SAMPLE_TIME
382 * { u64 addr; } && PERF_SAMPLE_ADDR
383 * { u64 id; } && PERF_SAMPLE_ID
384 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
385 * { u32 cpu, res; } && PERF_SAMPLE_CPU
386 * { u64 period; } && PERF_SAMPLE_PERIOD
387 *
388 * { struct read_format values; } && PERF_SAMPLE_READ
389 *
390 * { u64 nr,
391 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
392 *
393 * #
394 * # The RAW record below is opaque data wrt the ABI
395 * #
396 * # That is, the ABI doesn't make any promises wrt to
397 * # the stability of its content, it may vary depending
398 * # on event, hardware, kernel version and phase of
399 * # the moon.
400 * #
401 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
402 * #
403 *
404 * { u32 size;
405 * char data[size];}&& PERF_SAMPLE_RAW
406 * };
407 */
408 PERF_RECORD_SAMPLE = 9,
409
410 PERF_RECORD_MAX, /* non-ABI */
411};
412
413enum perf_callchain_context {
414 PERF_CONTEXT_HV = (__u64)-32,
415 PERF_CONTEXT_KERNEL = (__u64)-128,
416 PERF_CONTEXT_USER = (__u64)-512,
417
418 PERF_CONTEXT_GUEST = (__u64)-2048,
419 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
420 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
421
422 PERF_CONTEXT_MAX = (__u64)-4095,
423};
424
425#define PERF_FLAG_FD_NO_GROUP (1U << 0)
426#define PERF_FLAG_FD_OUTPUT (1U << 1)
427
428#ifdef __KERNEL__
429/*
430 * Kernel-internal data types and definitions:
431 */
432
433#ifdef CONFIG_PERF_EVENTS
434# include <asm/perf_event.h>
435#endif
436
437#include <linux/list.h>
438#include <linux/mutex.h>
439#include <linux/rculist.h>
440#include <linux/rcupdate.h>
441#include <linux/spinlock.h>
442#include <linux/hrtimer.h>
443#include <linux/fs.h>
444#include <linux/pid_namespace.h>
445#include <linux/workqueue.h>
446#include <asm/atomic.h>
447
448#define PERF_MAX_STACK_DEPTH 255
449
450struct perf_callchain_entry {
451 __u64 nr;
452 __u64 ip[PERF_MAX_STACK_DEPTH];
453};
454
455struct perf_raw_record {
456 u32 size;
457 void *data;
458};
459
460struct task_struct;
461
462/**
463 * struct hw_perf_event - performance event hardware details:
464 */
465struct hw_perf_event {
466#ifdef CONFIG_PERF_EVENTS
467 union {
468 struct { /* hardware */
469 u64 config;
470 unsigned long config_base;
471 unsigned long event_base;
472 int idx;
473 };
474 struct { /* software */
475 s64 remaining;
476 struct hrtimer hrtimer;
477 };
478 };
479 atomic64_t prev_count;
480 u64 sample_period;
481 u64 last_period;
482 atomic64_t period_left;
483 u64 interrupts;
484
485 u64 freq_count;
486 u64 freq_interrupts;
487 u64 freq_stamp;
488#endif
489};
490
491struct perf_event;
492
493/**
494 * struct pmu - generic performance monitoring unit
495 */
496struct pmu {
497 int (*enable) (struct perf_event *event);
498 void (*disable) (struct perf_event *event);
499 void (*read) (struct perf_event *event);
500 void (*unthrottle) (struct perf_event *event);
501};
502
503/**
504 * enum perf_event_active_state - the states of a event
505 */
506enum perf_event_active_state {
507 PERF_EVENT_STATE_ERROR = -2,
508 PERF_EVENT_STATE_OFF = -1,
509 PERF_EVENT_STATE_INACTIVE = 0,
510 PERF_EVENT_STATE_ACTIVE = 1,
511};
512
513struct file;
514
515struct perf_mmap_data {
516 struct rcu_head rcu_head;
517#ifdef CONFIG_PERF_USE_VMALLOC
518 struct work_struct work;
519#endif
520 int data_order;
521 int nr_pages; /* nr of data pages */
522 int writable; /* are we writable */
523 int nr_locked; /* nr pages mlocked */
524
525 atomic_t poll; /* POLL_ for wakeups */
526 atomic_t events; /* event_id limit */
527
528 atomic_long_t head; /* write position */
529 atomic_long_t done_head; /* completed head */
530
531 atomic_t lock; /* concurrent writes */
532 atomic_t wakeup; /* needs a wakeup */
533 atomic_t lost; /* nr records lost */
534
535 long watermark; /* wakeup watermark */
536
537 struct perf_event_mmap_page *user_page;
538 void *data_pages[0];
539};
540
541struct perf_pending_entry {
542 struct perf_pending_entry *next;
543 void (*func)(struct perf_pending_entry *);
544};
545
546/**
547 * struct perf_event - performance event kernel representation:
548 */
549struct perf_event {
550#ifdef CONFIG_PERF_EVENTS
551 struct list_head group_entry;
552 struct list_head event_entry;
553 struct list_head sibling_list;
554 int nr_siblings;
555 struct perf_event *group_leader;
556 struct perf_event *output;
557 const struct pmu *pmu;
558
559 enum perf_event_active_state state;
560 atomic64_t count;
561
562 /*
563 * These are the total time in nanoseconds that the event
564 * has been enabled (i.e. eligible to run, and the task has
565 * been scheduled in, if this is a per-task event)
566 * and running (scheduled onto the CPU), respectively.
567 *
568 * They are computed from tstamp_enabled, tstamp_running and
569 * tstamp_stopped when the event is in INACTIVE or ACTIVE state.
570 */
571 u64 total_time_enabled;
572 u64 total_time_running;
573
574 /*
575 * These are timestamps used for computing total_time_enabled
576 * and total_time_running when the event is in INACTIVE or
577 * ACTIVE state, measured in nanoseconds from an arbitrary point
578 * in time.
579 * tstamp_enabled: the notional time when the event was enabled
580 * tstamp_running: the notional time when the event was scheduled on
581 * tstamp_stopped: in INACTIVE state, the notional time when the
582 * event was scheduled off.
583 */
584 u64 tstamp_enabled;
585 u64 tstamp_running;
586 u64 tstamp_stopped;
587
588 struct perf_event_attr attr;
589 struct hw_perf_event hw;
590
591 struct perf_event_context *ctx;
592 struct file *filp;
593
594 /*
595 * These accumulate total time (in nanoseconds) that children
596 * events have been enabled and running, respectively.
597 */
598 atomic64_t child_total_time_enabled;
599 atomic64_t child_total_time_running;
600
601 /*
602 * Protect attach/detach and child_list:
603 */
604 struct mutex child_mutex;
605 struct list_head child_list;
606 struct perf_event *parent;
607
608 int oncpu;
609 int cpu;
610
611 struct list_head owner_entry;
612 struct task_struct *owner;
613
614 /* mmap bits */
615 struct mutex mmap_mutex;
616 atomic_t mmap_count;
617 struct perf_mmap_data *data;
618
619 /* poll related */
620 wait_queue_head_t waitq;
621 struct fasync_struct *fasync;
622
623 /* delayed work for NMIs and such */
624 int pending_wakeup;
625 int pending_kill;
626 int pending_disable;
627 struct perf_pending_entry pending;
628
629 atomic_t event_limit;
630
631 void (*destroy)(struct perf_event *);
632 struct rcu_head rcu_head;
633
634 struct pid_namespace *ns;
635 u64 id;
636#endif
637};
638
639/**
640 * struct perf_event_context - event context structure
641 *
642 * Used as a container for task events and CPU events as well:
643 */
644struct perf_event_context {
645 /*
646 * Protect the states of the events in the list,
647 * nr_active, and the list:
648 */
649 spinlock_t lock;
650 /*
651 * Protect the list of events. Locking either mutex or lock
652 * is sufficient to ensure the list doesn't change; to change
653 * the list you need to lock both the mutex and the spinlock.
654 */
655 struct mutex mutex;
656
657 struct list_head group_list;
658 struct list_head event_list;
659 int nr_events;
660 int nr_active;
661 int is_active;
662 int nr_stat;
663 atomic_t refcount;
664 struct task_struct *task;
665
666 /*
667 * Context clock, runs when context enabled.
668 */
669 u64 time;
670 u64 timestamp;
671
672 /*
673 * These fields let us detect when two contexts have both
674 * been cloned (inherited) from a common ancestor.
675 */
676 struct perf_event_context *parent_ctx;
677 u64 parent_gen;
678 u64 generation;
679 int pin_count;
680 struct rcu_head rcu_head;
681};
682
683/**
684 * struct perf_event_cpu_context - per cpu event context structure
685 */
686struct perf_cpu_context {
687 struct perf_event_context ctx;
688 struct perf_event_context *task_ctx;
689 int active_oncpu;
690 int max_pertask;
691 int exclusive;
692
693 /*
694 * Recursion avoidance:
695 *
696 * task, softirq, irq, nmi context
697 */
698 int recursion[4];
699};
700
701struct perf_output_handle {
702 struct perf_event *event;
703 struct perf_mmap_data *data;
704 unsigned long head;
705 unsigned long offset;
706 int nmi;
707 int sample;
708 int locked;
709 unsigned long flags;
710};
711
712#ifdef CONFIG_PERF_EVENTS
713
714/*
715 * Set by architecture code:
716 */
717extern int perf_max_events;
718
719extern const struct pmu *hw_perf_event_init(struct perf_event *event);
720
721extern void perf_event_task_sched_in(struct task_struct *task, int cpu);
722extern void perf_event_task_sched_out(struct task_struct *task,
723 struct task_struct *next, int cpu);
724extern void perf_event_task_tick(struct task_struct *task, int cpu);
725extern int perf_event_init_task(struct task_struct *child);
726extern void perf_event_exit_task(struct task_struct *child);
727extern void perf_event_free_task(struct task_struct *task);
728extern void set_perf_event_pending(void);
729extern void perf_event_do_pending(void);
730extern void perf_event_print_debug(void);
731extern void __perf_disable(void);
732extern bool __perf_enable(void);
733extern void perf_disable(void);
734extern void perf_enable(void);
735extern int perf_event_task_disable(void);
736extern int perf_event_task_enable(void);
737extern int hw_perf_group_sched_in(struct perf_event *group_leader,
738 struct perf_cpu_context *cpuctx,
739 struct perf_event_context *ctx, int cpu);
740extern void perf_event_update_userpage(struct perf_event *event);
741
742struct perf_sample_data {
743 u64 type;
744
745 u64 ip;
746 struct {
747 u32 pid;
748 u32 tid;
749 } tid_entry;
750 u64 time;
751 u64 addr;
752 u64 id;
753 u64 stream_id;
754 struct {
755 u32 cpu;
756 u32 reserved;
757 } cpu_entry;
758 u64 period;
759 struct perf_callchain_entry *callchain;
760 struct perf_raw_record *raw;
761};
762
763extern void perf_output_sample(struct perf_output_handle *handle,
764 struct perf_event_header *header,
765 struct perf_sample_data *data,
766 struct perf_event *event);
767extern void perf_prepare_sample(struct perf_event_header *header,
768 struct perf_sample_data *data,
769 struct perf_event *event,
770 struct pt_regs *regs);
771
772extern int perf_event_overflow(struct perf_event *event, int nmi,
773 struct perf_sample_data *data,
774 struct pt_regs *regs);
775
776/*
777 * Return 1 for a software event, 0 for a hardware event
778 */
779static inline int is_software_event(struct perf_event *event)
780{
781 return (event->attr.type != PERF_TYPE_RAW) &&
782 (event->attr.type != PERF_TYPE_HARDWARE) &&
783 (event->attr.type != PERF_TYPE_HW_CACHE);
784}
785
786extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
787
788extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
789
790static inline void
791perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
792{
793 if (atomic_read(&perf_swevent_enabled[event_id]))
794 __perf_sw_event(event_id, nr, nmi, regs, addr);
795}
796
797extern void __perf_event_mmap(struct vm_area_struct *vma);
798
799static inline void perf_event_mmap(struct vm_area_struct *vma)
800{
801 if (vma->vm_flags & VM_EXEC)
802 __perf_event_mmap(vma);
803}
804
805extern void perf_event_comm(struct task_struct *tsk);
806extern void perf_event_fork(struct task_struct *tsk);
807
808extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
809
810extern int sysctl_perf_event_paranoid;
811extern int sysctl_perf_event_mlock;
812extern int sysctl_perf_event_sample_rate;
813
814extern void perf_event_init(void);
815extern void perf_tp_event(int event_id, u64 addr, u64 count,
816 void *record, int entry_size);
817
818#ifndef perf_misc_flags
819#define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \
820 PERF_RECORD_MISC_KERNEL)
821#define perf_instruction_pointer(regs) instruction_pointer(regs)
822#endif
823
824extern int perf_output_begin(struct perf_output_handle *handle,
825 struct perf_event *event, unsigned int size,
826 int nmi, int sample);
827extern void perf_output_end(struct perf_output_handle *handle);
828extern void perf_output_copy(struct perf_output_handle *handle,
829 const void *buf, unsigned int len);
830#else
831static inline void
832perf_event_task_sched_in(struct task_struct *task, int cpu) { }
833static inline void
834perf_event_task_sched_out(struct task_struct *task,
835 struct task_struct *next, int cpu) { }
836static inline void
837perf_event_task_tick(struct task_struct *task, int cpu) { }
838static inline int perf_event_init_task(struct task_struct *child) { return 0; }
839static inline void perf_event_exit_task(struct task_struct *child) { }
840static inline void perf_event_free_task(struct task_struct *task) { }
841static inline void perf_event_do_pending(void) { }
842static inline void perf_event_print_debug(void) { }
843static inline void perf_disable(void) { }
844static inline void perf_enable(void) { }
845static inline int perf_event_task_disable(void) { return -EINVAL; }
846static inline int perf_event_task_enable(void) { return -EINVAL; }
847
848static inline void
849perf_sw_event(u32 event_id, u64 nr, int nmi,
850 struct pt_regs *regs, u64 addr) { }
851
852static inline void perf_event_mmap(struct vm_area_struct *vma) { }
853static inline void perf_event_comm(struct task_struct *tsk) { }
854static inline void perf_event_fork(struct task_struct *tsk) { }
855static inline void perf_event_init(void) { }
856
857#endif
858
859#define perf_output_put(handle, x) \
860 perf_output_copy((handle), &(x), sizeof(x))
861
862#endif /* __KERNEL__ */
863#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index ee5e3c9e2bca..e5126cff9b2a 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -38,6 +38,7 @@
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39 39
40#define PNADDR_ANY 0 40#define PNADDR_ANY 0
41#define PNADDR_BROADCAST 0xFC
41#define PNPORT_RESOURCE_ROUTING 0 42#define PNPORT_RESOURCE_ROUTING 0
42 43
43/* Values for PNPIPE_ENCAP option */ 44/* Values for PNPIPE_ENCAP option */
@@ -99,6 +100,9 @@ struct sockaddr_pn {
99 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; 100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
100} __attribute__ ((packed)); 101} __attribute__ ((packed));
101 102
103/* Well known address */
104#define PN_DEV_PC 0x10
105
102static inline __u16 pn_object(__u8 addr, __u16 port) 106static inline __u16 pn_object(__u8 addr, __u16 port)
103{ 107{
104 return (addr << 8) | (port & 0x3ff); 108 return (addr << 8) | (port & 0x3ff);
@@ -170,4 +174,21 @@ static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
170 return spn->spn_resource; 174 return spn->spn_resource;
171} 175}
172 176
177/* Phonet device ioctl requests */
178#ifdef __KERNEL__
179#define SIOCPNGAUTOCONF (SIOCDEVPRIVATE + 0)
180
181struct if_phonet_autoconf {
182 uint8_t device;
183};
184
185struct if_phonet_req {
186 char ifr_phonet_name[16];
187 union {
188 struct if_phonet_autoconf ifru_phonet_autoconf;
189 } ifr_ifru;
190};
191#define ifr_phonet_autoconf ifr_ifru.ifru_phonet_autoconf
192#endif /* __KERNEL__ */
193
173#endif 194#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8dc5123b6305..3c6675c2444b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -22,6 +22,9 @@ struct platform_device {
22 struct resource * resource; 22 struct resource * resource;
23 23
24 struct platform_device_id *id_entry; 24 struct platform_device_id *id_entry;
25
26 /* arch specific additions */
27 struct pdev_archdata archdata;
25}; 28};
26 29
27#define platform_get_device_id(pdev) ((pdev)->id_entry) 30#define platform_get_device_id(pdev) ((pdev)->id_entry)
@@ -57,8 +60,6 @@ struct platform_driver {
57 int (*remove)(struct platform_device *); 60 int (*remove)(struct platform_device *);
58 void (*shutdown)(struct platform_device *); 61 void (*shutdown)(struct platform_device *);
59 int (*suspend)(struct platform_device *, pm_message_t state); 62 int (*suspend)(struct platform_device *, pm_message_t state);
60 int (*suspend_late)(struct platform_device *, pm_message_t state);
61 int (*resume_early)(struct platform_device *);
62 int (*resume)(struct platform_device *); 63 int (*resume)(struct platform_device *);
63 struct device_driver driver; 64 struct device_driver driver;
64 struct platform_device_id *id_table; 65 struct platform_device_id *id_table;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index b3f74764a586..3b7e04b95bd2 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -22,6 +22,10 @@
22#define _LINUX_PM_H 22#define _LINUX_PM_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/workqueue.h>
26#include <linux/spinlock.h>
27#include <linux/wait.h>
28#include <linux/timer.h>
25 29
26/* 30/*
27 * Callbacks for platform drivers to implement. 31 * Callbacks for platform drivers to implement.
@@ -165,6 +169,28 @@ typedef struct pm_message {
165 * It is allowed to unregister devices while the above callbacks are being 169 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any 170 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks. 171 * of its own callbacks.
172 *
173 * There also are the following callbacks related to run-time power management
174 * of devices:
175 *
176 * @runtime_suspend: Prepare the device for a condition in which it won't be
177 * able to communicate with the CPU(s) and RAM due to power management.
178 * This need not mean that the device should be put into a low power state.
179 * For example, if the device is behind a link which is about to be turned
180 * off, the device may remain at full power. If the device does go to low
181 * power and if device_may_wakeup(dev) is true, remote wake-up (i.e., a
182 * hardware mechanism allowing the device to request a change of its power
183 * state, such as PCI PME) should be enabled for it.
184 *
185 * @runtime_resume: Put the device into the fully active state in response to a
186 * wake-up event generated by hardware or at the request of software. If
187 * necessary, put the device into the full power state and restore its
188 * registers, so that it is fully operational.
189 *
190 * @runtime_idle: Device appears to be inactive and it might be put into a low
191 * power state if all of the necessary conditions are satisfied. Check
192 * these conditions and handle the device as appropriate, possibly queueing
193 * a suspend request for it. The return value is ignored by the PM core.
168 */ 194 */
169 195
170struct dev_pm_ops { 196struct dev_pm_ops {
@@ -182,8 +208,25 @@ struct dev_pm_ops {
182 int (*thaw_noirq)(struct device *dev); 208 int (*thaw_noirq)(struct device *dev);
183 int (*poweroff_noirq)(struct device *dev); 209 int (*poweroff_noirq)(struct device *dev);
184 int (*restore_noirq)(struct device *dev); 210 int (*restore_noirq)(struct device *dev);
211 int (*runtime_suspend)(struct device *dev);
212 int (*runtime_resume)(struct device *dev);
213 int (*runtime_idle)(struct device *dev);
185}; 214};
186 215
216/*
217 * Use this if you want to use the same suspend and resume callbacks for suspend
218 * to RAM and hibernation.
219 */
220#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
221struct dev_pm_ops name = { \
222 .suspend = suspend_fn, \
223 .resume = resume_fn, \
224 .freeze = suspend_fn, \
225 .thaw = resume_fn, \
226 .poweroff = suspend_fn, \
227 .restore = resume_fn, \
228}
229
187/** 230/**
188 * PM_EVENT_ messages 231 * PM_EVENT_ messages
189 * 232 *
@@ -315,14 +358,80 @@ enum dpm_state {
315 DPM_OFF_IRQ, 358 DPM_OFF_IRQ,
316}; 359};
317 360
361/**
362 * Device run-time power management status.
363 *
364 * These status labels are used internally by the PM core to indicate the
365 * current status of a device with respect to the PM core operations. They do
366 * not reflect the actual power state of the device or its status as seen by the
367 * driver.
368 *
369 * RPM_ACTIVE Device is fully operational. Indicates that the device
370 * bus type's ->runtime_resume() callback has completed
371 * successfully.
372 *
373 * RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has
374 * completed successfully. The device is regarded as
375 * suspended.
376 *
377 * RPM_RESUMING Device bus type's ->runtime_resume() callback is being
378 * executed.
379 *
380 * RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being
381 * executed.
382 */
383
384enum rpm_status {
385 RPM_ACTIVE = 0,
386 RPM_RESUMING,
387 RPM_SUSPENDED,
388 RPM_SUSPENDING,
389};
390
391/**
392 * Device run-time power management request types.
393 *
394 * RPM_REQ_NONE Do nothing.
395 *
396 * RPM_REQ_IDLE Run the device bus type's ->runtime_idle() callback
397 *
398 * RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback
399 *
400 * RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback
401 */
402
403enum rpm_request {
404 RPM_REQ_NONE = 0,
405 RPM_REQ_IDLE,
406 RPM_REQ_SUSPEND,
407 RPM_REQ_RESUME,
408};
409
318struct dev_pm_info { 410struct dev_pm_info {
319 pm_message_t power_state; 411 pm_message_t power_state;
320 unsigned can_wakeup:1; 412 unsigned int can_wakeup:1;
321 unsigned should_wakeup:1; 413 unsigned int should_wakeup:1;
322 enum dpm_state status; /* Owned by the PM core */ 414 enum dpm_state status; /* Owned by the PM core */
323#ifdef CONFIG_PM_SLEEP 415#ifdef CONFIG_PM_SLEEP
324 struct list_head entry; 416 struct list_head entry;
325#endif 417#endif
418#ifdef CONFIG_PM_RUNTIME
419 struct timer_list suspend_timer;
420 unsigned long timer_expires;
421 struct work_struct work;
422 wait_queue_head_t wait_queue;
423 spinlock_t lock;
424 atomic_t usage_count;
425 atomic_t child_count;
426 unsigned int disable_depth:3;
427 unsigned int ignore_children:1;
428 unsigned int idle_notification:1;
429 unsigned int request_pending:1;
430 unsigned int deferred_resume:1;
431 enum rpm_request request;
432 enum rpm_status runtime_status;
433 int runtime_error;
434#endif
326}; 435};
327 436
328/* 437/*
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
new file mode 100644
index 000000000000..44087044910f
--- /dev/null
+++ b/include/linux/pm_runtime.h
@@ -0,0 +1,114 @@
1/*
2 * pm_runtime.h - Device run-time power management helper functions.
3 *
4 * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_PM_RUNTIME_H
10#define _LINUX_PM_RUNTIME_H
11
12#include <linux/device.h>
13#include <linux/pm.h>
14
15#ifdef CONFIG_PM_RUNTIME
16
17extern struct workqueue_struct *pm_wq;
18
19extern int pm_runtime_idle(struct device *dev);
20extern int pm_runtime_suspend(struct device *dev);
21extern int pm_runtime_resume(struct device *dev);
22extern int pm_request_idle(struct device *dev);
23extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
24extern int pm_request_resume(struct device *dev);
25extern int __pm_runtime_get(struct device *dev, bool sync);
26extern int __pm_runtime_put(struct device *dev, bool sync);
27extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
28extern int pm_runtime_barrier(struct device *dev);
29extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31
32static inline bool pm_children_suspended(struct device *dev)
33{
34 return dev->power.ignore_children
35 || !atomic_read(&dev->power.child_count);
36}
37
38static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
39{
40 dev->power.ignore_children = enable;
41}
42
43static inline void pm_runtime_get_noresume(struct device *dev)
44{
45 atomic_inc(&dev->power.usage_count);
46}
47
48static inline void pm_runtime_put_noidle(struct device *dev)
49{
50 atomic_add_unless(&dev->power.usage_count, -1, 0);
51}
52
53#else /* !CONFIG_PM_RUNTIME */
54
55static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; }
56static inline int pm_runtime_suspend(struct device *dev) { return -ENOSYS; }
57static inline int pm_runtime_resume(struct device *dev) { return 0; }
58static inline int pm_request_idle(struct device *dev) { return -ENOSYS; }
59static inline int pm_schedule_suspend(struct device *dev, unsigned int delay)
60{
61 return -ENOSYS;
62}
63static inline int pm_request_resume(struct device *dev) { return 0; }
64static inline int __pm_runtime_get(struct device *dev, bool sync) { return 1; }
65static inline int __pm_runtime_put(struct device *dev, bool sync) { return 0; }
66static inline int __pm_runtime_set_status(struct device *dev,
67 unsigned int status) { return 0; }
68static inline int pm_runtime_barrier(struct device *dev) { return 0; }
69static inline void pm_runtime_enable(struct device *dev) {}
70static inline void __pm_runtime_disable(struct device *dev, bool c) {}
71
72static inline bool pm_children_suspended(struct device *dev) { return false; }
73static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
74static inline void pm_runtime_get_noresume(struct device *dev) {}
75static inline void pm_runtime_put_noidle(struct device *dev) {}
76
77#endif /* !CONFIG_PM_RUNTIME */
78
79static inline int pm_runtime_get(struct device *dev)
80{
81 return __pm_runtime_get(dev, false);
82}
83
84static inline int pm_runtime_get_sync(struct device *dev)
85{
86 return __pm_runtime_get(dev, true);
87}
88
89static inline int pm_runtime_put(struct device *dev)
90{
91 return __pm_runtime_put(dev, false);
92}
93
94static inline int pm_runtime_put_sync(struct device *dev)
95{
96 return __pm_runtime_put(dev, true);
97}
98
99static inline int pm_runtime_set_active(struct device *dev)
100{
101 return __pm_runtime_set_status(dev, RPM_ACTIVE);
102}
103
104static inline void pm_runtime_set_suspended(struct device *dev)
105{
106 __pm_runtime_set_status(dev, RPM_SUSPENDED);
107}
108
109static inline void pm_runtime_disable(struct device *dev)
110{
111 __pm_runtime_disable(dev, true);
112}
113
114#endif
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index b063c7328ba5..fddfafaed024 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -360,6 +360,7 @@ struct pnp_driver {
360 unsigned int flags; 360 unsigned int flags;
361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 361 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
362 void (*remove) (struct pnp_dev *dev); 362 void (*remove) (struct pnp_dev *dev);
363 void (*shutdown) (struct pnp_dev *dev);
363 int (*suspend) (struct pnp_dev *dev, pm_message_t state); 364 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
364 int (*resume) (struct pnp_dev *dev); 365 int (*resume) (struct pnp_dev *dev);
365 struct device_driver driver; 366 struct device_driver driver;
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 6729f7dcd60e..7fc194aef8c2 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -65,6 +65,9 @@
65#define MUTEX_DEBUG_INIT 0x11 65#define MUTEX_DEBUG_INIT 0x11
66#define MUTEX_DEBUG_FREE 0x22 66#define MUTEX_DEBUG_FREE 0x22
67 67
68/********** lib/flex_array.c **********/
69#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
70
68/********** security/ **********/ 71/********** security/ **********/
69#define KEY_DESTROY 0xbd 72#define KEY_DESTROY 0xbd
70 73
diff --git a/include/linux/poll.h b/include/linux/poll.h
index fa287f25138d..6673743946f7 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -6,10 +6,10 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/ktime.h>
9#include <linux/wait.h> 10#include <linux/wait.h>
10#include <linux/string.h> 11#include <linux/string.h>
11#include <linux/fs.h> 12#include <linux/fs.h>
12#include <linux/sched.h>
13#include <asm/uaccess.h> 13#include <asm/uaccess.h>
14 14
15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating 15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 594c494ac3f0..b5d096d3a9be 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -39,6 +39,13 @@ enum {
39}; 39};
40 40
41enum { 41enum {
42 POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0,
43 POWER_SUPPLY_CHARGE_TYPE_NONE,
44 POWER_SUPPLY_CHARGE_TYPE_TRICKLE,
45 POWER_SUPPLY_CHARGE_TYPE_FAST,
46};
47
48enum {
42 POWER_SUPPLY_HEALTH_UNKNOWN = 0, 49 POWER_SUPPLY_HEALTH_UNKNOWN = 0,
43 POWER_SUPPLY_HEALTH_GOOD, 50 POWER_SUPPLY_HEALTH_GOOD,
44 POWER_SUPPLY_HEALTH_OVERHEAT, 51 POWER_SUPPLY_HEALTH_OVERHEAT,
@@ -58,9 +65,19 @@ enum {
58 POWER_SUPPLY_TECHNOLOGY_LiMn, 65 POWER_SUPPLY_TECHNOLOGY_LiMn,
59}; 66};
60 67
68enum {
69 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
70 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
71 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
72 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
73 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75};
76
61enum power_supply_property { 77enum power_supply_property {
62 /* Properties of type `int' */ 78 /* Properties of type `int' */
63 POWER_SUPPLY_PROP_STATUS = 0, 79 POWER_SUPPLY_PROP_STATUS = 0,
80 POWER_SUPPLY_PROP_CHARGE_TYPE,
64 POWER_SUPPLY_PROP_HEALTH, 81 POWER_SUPPLY_PROP_HEALTH,
65 POWER_SUPPLY_PROP_PRESENT, 82 POWER_SUPPLY_PROP_PRESENT,
66 POWER_SUPPLY_PROP_ONLINE, 83 POWER_SUPPLY_PROP_ONLINE,
@@ -89,6 +106,7 @@ enum power_supply_property {
89 POWER_SUPPLY_PROP_ENERGY_NOW, 106 POWER_SUPPLY_PROP_ENERGY_NOW,
90 POWER_SUPPLY_PROP_ENERGY_AVG, 107 POWER_SUPPLY_PROP_ENERGY_AVG,
91 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ 108 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
109 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
92 POWER_SUPPLY_PROP_TEMP, 110 POWER_SUPPLY_PROP_TEMP,
93 POWER_SUPPLY_PROP_TEMP_AMBIENT, 111 POWER_SUPPLY_PROP_TEMP_AMBIENT,
94 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 112 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
@@ -126,6 +144,7 @@ struct power_supply {
126 enum power_supply_property psp, 144 enum power_supply_property psp,
127 union power_supply_propval *val); 145 union power_supply_propval *val);
128 void (*external_power_changed)(struct power_supply *psy); 146 void (*external_power_changed)(struct power_supply *psy);
147 void (*set_charged)(struct power_supply *psy);
129 148
130 /* For APM emulation, think legacy userspace. */ 149 /* For APM emulation, think legacy userspace. */
131 int use_for_apm; 150 int use_for_apm;
@@ -165,8 +184,10 @@ struct power_supply_info {
165 int use_for_apm; 184 int use_for_apm;
166}; 185};
167 186
187extern struct power_supply *power_supply_get_by_name(char *name);
168extern void power_supply_changed(struct power_supply *psy); 188extern void power_supply_changed(struct power_supply *psy);
169extern int power_supply_am_i_supplied(struct power_supply *psy); 189extern int power_supply_am_i_supplied(struct power_supply *psy);
190extern int power_supply_set_battery_charged(struct power_supply *psy);
170 191
171#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) 192#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE)
172extern int power_supply_is_system_supplied(void); 193extern int power_supply_is_system_supplied(void);
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index b00df4c79c63..a3baeb2c2161 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -85,7 +85,21 @@
85#define PR_SET_TIMERSLACK 29 85#define PR_SET_TIMERSLACK 29
86#define PR_GET_TIMERSLACK 30 86#define PR_GET_TIMERSLACK 30
87 87
88#define PR_TASK_PERF_COUNTERS_DISABLE 31 88#define PR_TASK_PERF_EVENTS_DISABLE 31
89#define PR_TASK_PERF_COUNTERS_ENABLE 32 89#define PR_TASK_PERF_EVENTS_ENABLE 32
90
91/*
92 * Set early/late kill mode for hwpoison memory corruption.
93 * This influences when the process gets killed on a memory corruption.
94 */
95#define PR_MCE_KILL 33
96# define PR_MCE_KILL_CLEAR 0
97# define PR_MCE_KILL_SET 1
98
99# define PR_MCE_KILL_LATE 0
100# define PR_MCE_KILL_EARLY 1
101# define PR_MCE_KILL_DEFAULT 2
102
103#define PR_MCE_KILL_GET 34
90 104
91#endif /* _LINUX_PRCTL_H */ 105#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e6e77d31c418..379eaed72d4b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -78,10 +78,19 @@ struct proc_dir_entry {
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 78 struct list_head pde_openers; /* who did ->open, but not ->release */
79}; 79};
80 80
81enum kcore_type {
82 KCORE_TEXT,
83 KCORE_VMALLOC,
84 KCORE_RAM,
85 KCORE_VMEMMAP,
86 KCORE_OTHER,
87};
88
81struct kcore_list { 89struct kcore_list {
82 struct kcore_list *next; 90 struct list_head list;
83 unsigned long addr; 91 unsigned long addr;
84 size_t size; 92 size_t size;
93 int type;
85}; 94};
86 95
87struct vmcore { 96struct vmcore {
@@ -233,11 +242,12 @@ static inline void dup_mm_exe_file(struct mm_struct *oldmm,
233#endif /* CONFIG_PROC_FS */ 242#endif /* CONFIG_PROC_FS */
234 243
235#if !defined(CONFIG_PROC_KCORE) 244#if !defined(CONFIG_PROC_KCORE)
236static inline void kclist_add(struct kcore_list *new, void *addr, size_t size) 245static inline void
246kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
237{ 247{
238} 248}
239#else 249#else
240extern void kclist_add(struct kcore_list *, void *, size_t); 250extern void kclist_add(struct kcore_list *, void *, size_t, int type);
241#endif 251#endif
242 252
243union proc_op { 253union proc_op {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 26361c4c037a..3ebb23153640 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -135,8 +135,8 @@ static inline int sb_any_quota_active(struct super_block *sb)
135/* 135/*
136 * Operations supported for diskquotas. 136 * Operations supported for diskquotas.
137 */ 137 */
138extern struct dquot_operations dquot_operations; 138extern const struct dquot_operations dquot_operations;
139extern struct quotactl_ops vfs_quotactl_ops; 139extern const struct quotactl_ops vfs_quotactl_ops;
140 140
141#define sb_dquot_ops (&dquot_operations) 141#define sb_dquot_ops (&dquot_operations)
142#define sb_quotactl_ops (&vfs_quotactl_ops) 142#define sb_quotactl_ops (&vfs_quotactl_ops)
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 37aaf2b39863..4e768dda87b0 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -17,7 +17,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
17#endif 17#endif
18 18
19extern const struct file_operations ramfs_file_operations; 19extern const struct file_operations ramfs_file_operations;
20extern struct vm_operations_struct generic_file_vm_ops; 20extern const struct vm_operations_struct generic_file_vm_ops;
21extern int __init init_rootfs(void); 21extern int __init init_rootfs(void);
22 22
23#endif 23#endif
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
deleted file mode 100644
index bfd92e1e5d2c..000000000000
--- a/include/linux/rcuclassic.h
+++ /dev/null
@@ -1,178 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (classic version)
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 * Copyright IBM Corporation, 2001
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H
35
36#include <linux/cache.h>
37#include <linux/spinlock.h>
38#include <linux/threads.h>
39#include <linux/cpumask.h>
40#include <linux/seqlock.h>
41
42#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
43#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rcp->jiffies_stall */
44#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */
45#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
46
47/* Global control variables for rcupdate callback mechanism. */
48struct rcu_ctrlblk {
49 long cur; /* Current batch number. */
50 long completed; /* Number of the last completed batch */
51 long pending; /* Number of the last pending batch */
52#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
53 unsigned long gp_start; /* Time at which GP started in jiffies. */
54 unsigned long jiffies_stall;
55 /* Time at which to check for CPU stalls. */
56#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
57
58 int signaled;
59
60 spinlock_t lock ____cacheline_internodealigned_in_smp;
61 DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */
62 /* current batch to proceed. */
63} ____cacheline_internodealigned_in_smp;
64
65/* Is batch a before batch b ? */
66static inline int rcu_batch_before(long a, long b)
67{
68 return (a - b) < 0;
69}
70
71/* Is batch a after batch b ? */
72static inline int rcu_batch_after(long a, long b)
73{
74 return (a - b) > 0;
75}
76
77/* Per-CPU data for Read-Copy UPdate. */
78struct rcu_data {
79 /* 1) quiescent state handling : */
80 long quiescbatch; /* Batch # for grace period */
81 int passed_quiesc; /* User-mode/idle loop etc. */
82 int qs_pending; /* core waits for quiesc state */
83
84 /* 2) batch handling */
85 /*
86 * if nxtlist is not NULL, then:
87 * batch:
88 * The batch # for the last entry of nxtlist
89 * [*nxttail[1], NULL = *nxttail[2]):
90 * Entries that batch # <= batch
91 * [*nxttail[0], *nxttail[1]):
92 * Entries that batch # <= batch - 1
93 * [nxtlist, *nxttail[0]):
94 * Entries that batch # <= batch - 2
95 * The grace period for these entries has completed, and
96 * the other grace-period-completed entries may be moved
97 * here temporarily in rcu_process_callbacks().
98 */
99 long batch;
100 struct rcu_head *nxtlist;
101 struct rcu_head **nxttail[3];
102 long qlen; /* # of queued callbacks */
103 struct rcu_head *donelist;
104 struct rcu_head **donetail;
105 long blimit; /* Upper limit on a processed batch */
106 int cpu;
107 struct rcu_head barrier;
108};
109
110/*
111 * Increment the quiescent state counter.
112 * The counter is a bit degenerated: We do not need to know
113 * how many quiescent states passed, just if there was at least
114 * one since the start of the grace period. Thus just a flag.
115 */
116extern void rcu_qsctr_inc(int cpu);
117extern void rcu_bh_qsctr_inc(int cpu);
118
119extern int rcu_pending(int cpu);
120extern int rcu_needs_cpu(int cpu);
121
122#ifdef CONFIG_DEBUG_LOCK_ALLOC
123extern struct lockdep_map rcu_lock_map;
124# define rcu_read_acquire() \
125 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
126# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
127#else
128# define rcu_read_acquire() do { } while (0)
129# define rcu_read_release() do { } while (0)
130#endif
131
132#define __rcu_read_lock() \
133 do { \
134 preempt_disable(); \
135 __acquire(RCU); \
136 rcu_read_acquire(); \
137 } while (0)
138#define __rcu_read_unlock() \
139 do { \
140 rcu_read_release(); \
141 __release(RCU); \
142 preempt_enable(); \
143 } while (0)
144#define __rcu_read_lock_bh() \
145 do { \
146 local_bh_disable(); \
147 __acquire(RCU_BH); \
148 rcu_read_acquire(); \
149 } while (0)
150#define __rcu_read_unlock_bh() \
151 do { \
152 rcu_read_release(); \
153 __release(RCU_BH); \
154 local_bh_enable(); \
155 } while (0)
156
157#define __synchronize_sched() synchronize_rcu()
158
159#define call_rcu_sched(head, func) call_rcu(head, func)
160
161extern void __rcu_init(void);
162#define rcu_init_sched() do { } while (0)
163extern void rcu_check_callbacks(int cpu, int user);
164extern void rcu_restart_cpu(int cpu);
165
166extern long rcu_batches_completed(void);
167extern long rcu_batches_completed_bh(void);
168
169#define rcu_enter_nohz() do { } while (0)
170#define rcu_exit_nohz() do { } while (0)
171
172/* A context switch is a grace period for rcuclassic. */
173static inline int rcu_blocking_is_gp(void)
174{
175 return num_online_cpus() == 1;
176}
177
178#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index f9ddd03961a8..589a40919f01 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -102,7 +102,7 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
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((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(pos->next))
108 108
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 15fbb3ca634d..3ebd0b7bcb08 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Read-Copy Update mechanism for mutual exclusion 2 * Read-Copy Update mechanism for mutual exclusion
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
18 * Copyright IBM Corporation, 2001 18 * Copyright IBM Corporation, 2001
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com> 22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers: 24 * Papers:
@@ -26,7 +26,7 @@
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) 26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 * 27 *
28 * For detailed explanation of Read-Copy Update mechanism see - 28 * For detailed explanation of Read-Copy Update mechanism see -
29 * http://lse.sourceforge.net/locking/rcupdate.html 29 * http://lse.sourceforge.net/locking/rcupdate.html
30 * 30 *
31 */ 31 */
32 32
@@ -51,25 +51,48 @@ struct rcu_head {
51 void (*func)(struct rcu_head *head); 51 void (*func)(struct rcu_head *head);
52}; 52};
53 53
54/* Internal to kernel, but needed by rcupreempt.h. */ 54/* Exported common interfaces */
55#ifdef CONFIG_TREE_PREEMPT_RCU
56extern void synchronize_rcu(void);
57#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
58#define synchronize_rcu synchronize_sched
59#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
60extern void synchronize_rcu_bh(void);
61extern void synchronize_sched(void);
62extern void rcu_barrier(void);
63extern void rcu_barrier_bh(void);
64extern void rcu_barrier_sched(void);
65extern void synchronize_sched_expedited(void);
66extern int sched_expedited_torture_stats(char *page);
67
68/* Internal to kernel */
69extern void rcu_init(void);
70extern void rcu_scheduler_starting(void);
71extern int rcu_needs_cpu(int cpu);
55extern int rcu_scheduler_active; 72extern int rcu_scheduler_active;
56 73
57#if defined(CONFIG_CLASSIC_RCU) 74#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
58#include <linux/rcuclassic.h>
59#elif defined(CONFIG_TREE_RCU)
60#include <linux/rcutree.h> 75#include <linux/rcutree.h>
61#elif defined(CONFIG_PREEMPT_RCU)
62#include <linux/rcupreempt.h>
63#else 76#else
64#error "Unknown RCU implementation specified to kernel configuration" 77#error "Unknown RCU implementation specified to kernel configuration"
65#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */ 78#endif
66 79
67#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 80#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
68#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 81#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
69#define INIT_RCU_HEAD(ptr) do { \ 82#define INIT_RCU_HEAD(ptr) do { \
70 (ptr)->next = NULL; (ptr)->func = NULL; \ 83 (ptr)->next = NULL; (ptr)->func = NULL; \
71} while (0) 84} while (0)
72 85
86#ifdef CONFIG_DEBUG_LOCK_ALLOC
87extern struct lockdep_map rcu_lock_map;
88# define rcu_read_acquire() \
89 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
90# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
91#else
92# define rcu_read_acquire() do { } while (0)
93# define rcu_read_release() do { } while (0)
94#endif
95
73/** 96/**
74 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 97 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
75 * 98 *
@@ -99,13 +122,12 @@ extern int rcu_scheduler_active;
99 * 122 *
100 * It is illegal to block while in an RCU read-side critical section. 123 * It is illegal to block while in an RCU read-side critical section.
101 */ 124 */
102#define rcu_read_lock() __rcu_read_lock() 125static inline void rcu_read_lock(void)
103 126{
104/** 127 __rcu_read_lock();
105 * rcu_read_unlock - marks the end of an RCU read-side critical section. 128 __acquire(RCU);
106 * 129 rcu_read_acquire();
107 * See rcu_read_lock() for more information. 130}
108 */
109 131
110/* 132/*
111 * So where is rcu_write_lock()? It does not exist, as there is no 133 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -116,7 +138,18 @@ extern int rcu_scheduler_active;
116 * used as well. RCU does not care how the writers keep out of each 138 * used as well. RCU does not care how the writers keep out of each
117 * others' way, as long as they do so. 139 * others' way, as long as they do so.
118 */ 140 */
119#define rcu_read_unlock() __rcu_read_unlock() 141
142/**
143 * rcu_read_unlock - marks the end of an RCU read-side critical section.
144 *
145 * See rcu_read_lock() for more information.
146 */
147static inline void rcu_read_unlock(void)
148{
149 rcu_read_release();
150 __release(RCU);
151 __rcu_read_unlock();
152}
120 153
121/** 154/**
122 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section 155 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section
@@ -129,14 +162,24 @@ extern int rcu_scheduler_active;
129 * can use just rcu_read_lock(). 162 * can use just rcu_read_lock().
130 * 163 *
131 */ 164 */
132#define rcu_read_lock_bh() __rcu_read_lock_bh() 165static inline void rcu_read_lock_bh(void)
166{
167 __rcu_read_lock_bh();
168 __acquire(RCU_BH);
169 rcu_read_acquire();
170}
133 171
134/* 172/*
135 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 173 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
136 * 174 *
137 * See rcu_read_lock_bh() for more information. 175 * See rcu_read_lock_bh() for more information.
138 */ 176 */
139#define rcu_read_unlock_bh() __rcu_read_unlock_bh() 177static inline void rcu_read_unlock_bh(void)
178{
179 rcu_read_release();
180 __release(RCU_BH);
181 __rcu_read_unlock_bh();
182}
140 183
141/** 184/**
142 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section 185 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section
@@ -147,17 +190,38 @@ extern int rcu_scheduler_active;
147 * - call_rcu_sched() and rcu_barrier_sched() 190 * - call_rcu_sched() and rcu_barrier_sched()
148 * on the write-side to insure proper synchronization. 191 * on the write-side to insure proper synchronization.
149 */ 192 */
150#define rcu_read_lock_sched() preempt_disable() 193static inline void rcu_read_lock_sched(void)
151#define rcu_read_lock_sched_notrace() preempt_disable_notrace() 194{
195 preempt_disable();
196 __acquire(RCU_SCHED);
197 rcu_read_acquire();
198}
199
200/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
201static inline notrace void rcu_read_lock_sched_notrace(void)
202{
203 preempt_disable_notrace();
204 __acquire(RCU_SCHED);
205}
152 206
153/* 207/*
154 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section 208 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
155 * 209 *
156 * See rcu_read_lock_sched for more information. 210 * See rcu_read_lock_sched for more information.
157 */ 211 */
158#define rcu_read_unlock_sched() preempt_enable() 212static inline void rcu_read_unlock_sched(void)
159#define rcu_read_unlock_sched_notrace() preempt_enable_notrace() 213{
214 rcu_read_release();
215 __release(RCU_SCHED);
216 preempt_enable();
217}
160 218
219/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
220static inline notrace void rcu_read_unlock_sched_notrace(void)
221{
222 __release(RCU_SCHED);
223 preempt_enable_notrace();
224}
161 225
162 226
163/** 227/**
@@ -207,24 +271,6 @@ struct rcu_synchronize {
207extern void wakeme_after_rcu(struct rcu_head *head); 271extern void wakeme_after_rcu(struct rcu_head *head);
208 272
209/** 273/**
210 * synchronize_sched - block until all CPUs have exited any non-preemptive
211 * kernel code sequences.
212 *
213 * This means that all preempt_disable code sequences, including NMI and
214 * hardware-interrupt handlers, in progress on entry will have completed
215 * before this primitive returns. However, this does not guarantee that
216 * softirq handlers will have completed, since in some kernels, these
217 * handlers can run in process context, and can block.
218 *
219 * This primitive provides the guarantees made by the (now removed)
220 * synchronize_kernel() API. In contrast, synchronize_rcu() only
221 * guarantees that rcu_read_lock() sections will have completed.
222 * In "classic RCU", these two guarantees happen to be one and
223 * the same, but can differ in realtime RCU implementations.
224 */
225#define synchronize_sched() __synchronize_sched()
226
227/**
228 * call_rcu - Queue an RCU callback for invocation after a grace period. 274 * call_rcu - Queue an RCU callback for invocation after a grace period.
229 * @head: structure to be used for queueing the RCU updates. 275 * @head: structure to be used for queueing the RCU updates.
230 * @func: actual update function to be invoked after the grace period 276 * @func: actual update function to be invoked after the grace period
@@ -259,15 +305,4 @@ extern void call_rcu(struct rcu_head *head,
259extern void call_rcu_bh(struct rcu_head *head, 305extern void call_rcu_bh(struct rcu_head *head,
260 void (*func)(struct rcu_head *head)); 306 void (*func)(struct rcu_head *head));
261 307
262/* Exported common interfaces */
263extern void synchronize_rcu(void);
264extern void rcu_barrier(void);
265extern void rcu_barrier_bh(void);
266extern void rcu_barrier_sched(void);
267
268/* Internal to kernel */
269extern void rcu_init(void);
270extern void rcu_scheduler_starting(void);
271extern int rcu_needs_cpu(int cpu);
272
273#endif /* __LINUX_RCUPDATE_H */ 308#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
deleted file mode 100644
index fce522782ffa..000000000000
--- a/include/linux/rcupreempt.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
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 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H
35
36#include <linux/cache.h>
37#include <linux/spinlock.h>
38#include <linux/threads.h>
39#include <linux/smp.h>
40#include <linux/cpumask.h>
41#include <linux/seqlock.h>
42
43extern void rcu_qsctr_inc(int cpu);
44static inline void rcu_bh_qsctr_inc(int cpu) { }
45
46/*
47 * Someone might want to pass call_rcu_bh as a function pointer.
48 * So this needs to just be a rename and not a macro function.
49 * (no parentheses)
50 */
51#define call_rcu_bh call_rcu
52
53/**
54 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
55 * @head: structure to be used for queueing the RCU updates.
56 * @func: actual update function to be invoked after the grace period
57 *
58 * The update function will be invoked some time after a full
59 * synchronize_sched()-style grace period elapses, in other words after
60 * all currently executing preempt-disabled sections of code (including
61 * hardirq handlers, NMI handlers, and local_irq_save() blocks) have
62 * completed.
63 */
64extern void call_rcu_sched(struct rcu_head *head,
65 void (*func)(struct rcu_head *head));
66
67extern void __rcu_read_lock(void) __acquires(RCU);
68extern void __rcu_read_unlock(void) __releases(RCU);
69extern int rcu_pending(int cpu);
70extern int rcu_needs_cpu(int cpu);
71
72#define __rcu_read_lock_bh() { rcu_read_lock(); local_bh_disable(); }
73#define __rcu_read_unlock_bh() { local_bh_enable(); rcu_read_unlock(); }
74
75extern void __synchronize_sched(void);
76
77extern void __rcu_init(void);
78extern void rcu_init_sched(void);
79extern void rcu_check_callbacks(int cpu, int user);
80extern void rcu_restart_cpu(int cpu);
81extern long rcu_batches_completed(void);
82
83/*
84 * Return the number of RCU batches processed thus far. Useful for debug
85 * and statistic. The _bh variant is identifcal to straight RCU
86 */
87static inline long rcu_batches_completed_bh(void)
88{
89 return rcu_batches_completed();
90}
91
92#ifdef CONFIG_RCU_TRACE
93struct rcupreempt_trace;
94extern long *rcupreempt_flipctr(int cpu);
95extern long rcupreempt_data_completed(void);
96extern int rcupreempt_flip_flag(int cpu);
97extern int rcupreempt_mb_flag(int cpu);
98extern char *rcupreempt_try_flip_state_name(void);
99extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
100#endif
101
102struct softirq_action;
103
104#ifdef CONFIG_NO_HZ
105extern void rcu_enter_nohz(void);
106extern void rcu_exit_nohz(void);
107#else
108# define rcu_enter_nohz() do { } while (0)
109# define rcu_exit_nohz() do { } while (0)
110#endif
111
112/*
113 * A context switch is a grace period for rcupreempt synchronize_rcu()
114 * only during early boot, before the scheduler has been initialized.
115 * So, how the heck do we get a context switch? Well, if the caller
116 * invokes synchronize_rcu(), they are willing to accept a context
117 * switch, so we simply pretend that one happened.
118 *
119 * After boot, there might be a blocked or preempted task in an RCU
120 * read-side critical section, so we cannot then take the fastpath.
121 */
122static inline int rcu_blocking_is_gp(void)
123{
124 return num_online_cpus() == 1 && !rcu_scheduler_active;
125}
126
127#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
deleted file mode 100644
index b99ae073192a..000000000000
--- a/include/linux/rcupreempt_trace.h
+++ /dev/null
@@ -1,97 +0,0 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
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 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of the Preemptible Read-Copy Update mechanism see -
29 * http://lwn.net/Articles/253651/
30 */
31
32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H
34
35#include <linux/types.h>
36#include <linux/kernel.h>
37
38#include <asm/atomic.h>
39
40/*
41 * PREEMPT_RCU data structures.
42 */
43
44struct rcupreempt_trace {
45 long next_length;
46 long next_add;
47 long wait_length;
48 long wait_add;
49 long done_length;
50 long done_add;
51 long done_remove;
52 atomic_t done_invoked;
53 long rcu_check_callbacks;
54 atomic_t rcu_try_flip_1;
55 atomic_t rcu_try_flip_e1;
56 long rcu_try_flip_i1;
57 long rcu_try_flip_ie1;
58 long rcu_try_flip_g1;
59 long rcu_try_flip_a1;
60 long rcu_try_flip_ae1;
61 long rcu_try_flip_a2;
62 long rcu_try_flip_z1;
63 long rcu_try_flip_ze1;
64 long rcu_try_flip_z2;
65 long rcu_try_flip_m1;
66 long rcu_try_flip_me1;
67 long rcu_try_flip_m2;
68};
69
70#ifdef CONFIG_RCU_TRACE
71#define RCU_TRACE(fn, arg) fn(arg);
72#else
73#define RCU_TRACE(fn, arg)
74#endif
75
76extern void rcupreempt_trace_move2done(struct rcupreempt_trace *trace);
77extern void rcupreempt_trace_move2wait(struct rcupreempt_trace *trace);
78extern void rcupreempt_trace_try_flip_1(struct rcupreempt_trace *trace);
79extern void rcupreempt_trace_try_flip_e1(struct rcupreempt_trace *trace);
80extern void rcupreempt_trace_try_flip_i1(struct rcupreempt_trace *trace);
81extern void rcupreempt_trace_try_flip_ie1(struct rcupreempt_trace *trace);
82extern void rcupreempt_trace_try_flip_g1(struct rcupreempt_trace *trace);
83extern void rcupreempt_trace_try_flip_a1(struct rcupreempt_trace *trace);
84extern void rcupreempt_trace_try_flip_ae1(struct rcupreempt_trace *trace);
85extern void rcupreempt_trace_try_flip_a2(struct rcupreempt_trace *trace);
86extern void rcupreempt_trace_try_flip_z1(struct rcupreempt_trace *trace);
87extern void rcupreempt_trace_try_flip_ze1(struct rcupreempt_trace *trace);
88extern void rcupreempt_trace_try_flip_z2(struct rcupreempt_trace *trace);
89extern void rcupreempt_trace_try_flip_m1(struct rcupreempt_trace *trace);
90extern void rcupreempt_trace_try_flip_me1(struct rcupreempt_trace *trace);
91extern void rcupreempt_trace_try_flip_m2(struct rcupreempt_trace *trace);
92extern void rcupreempt_trace_check_callbacks(struct rcupreempt_trace *trace);
93extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
94extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
96
97#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 5a5153806c42..9642c6bcb399 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -24,278 +24,71 @@
24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. 24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
25 * 25 *
26 * For detailed explanation of Read-Copy Update mechanism see - 26 * For detailed explanation of Read-Copy Update mechanism see -
27 * Documentation/RCU 27 * Documentation/RCU
28 */ 28 */
29 29
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33#include <linux/cache.h> 33struct notifier_block;
34#include <linux/spinlock.h>
35#include <linux/threads.h>
36#include <linux/cpumask.h>
37#include <linux/seqlock.h>
38 34
39/* 35extern void rcu_sched_qs(int cpu);
40 * Define shape of hierarchy based on NR_CPUS and CONFIG_RCU_FANOUT. 36extern void rcu_bh_qs(int cpu);
41 * In theory, it should be possible to add more levels straightforwardly. 37extern int rcu_cpu_notify(struct notifier_block *self,
42 * In practice, this has not been tested, so there is probably some 38 unsigned long action, void *hcpu);
43 * bug somewhere. 39extern int rcu_needs_cpu(int cpu);
44 */ 40extern int rcu_expedited_torture_stats(char *page);
45#define MAX_RCU_LVLS 3
46#define RCU_FANOUT (CONFIG_RCU_FANOUT)
47#define RCU_FANOUT_SQ (RCU_FANOUT * RCU_FANOUT)
48#define RCU_FANOUT_CUBE (RCU_FANOUT_SQ * RCU_FANOUT)
49
50#if NR_CPUS <= RCU_FANOUT
51# define NUM_RCU_LVLS 1
52# define NUM_RCU_LVL_0 1
53# define NUM_RCU_LVL_1 (NR_CPUS)
54# define NUM_RCU_LVL_2 0
55# define NUM_RCU_LVL_3 0
56#elif NR_CPUS <= RCU_FANOUT_SQ
57# define NUM_RCU_LVLS 2
58# define NUM_RCU_LVL_0 1
59# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT - 1) / RCU_FANOUT)
60# define NUM_RCU_LVL_2 (NR_CPUS)
61# define NUM_RCU_LVL_3 0
62#elif NR_CPUS <= RCU_FANOUT_CUBE
63# define NUM_RCU_LVLS 3
64# define NUM_RCU_LVL_0 1
65# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT_SQ - 1) / RCU_FANOUT_SQ)
66# define NUM_RCU_LVL_2 (((NR_CPUS) + (RCU_FANOUT) - 1) / (RCU_FANOUT))
67# define NUM_RCU_LVL_3 NR_CPUS
68#else
69# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
70#endif /* #if (NR_CPUS) <= RCU_FANOUT */
71
72#define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3)
73#define NUM_RCU_NODES (RCU_SUM - NR_CPUS)
74
75/*
76 * Dynticks per-CPU state.
77 */
78struct rcu_dynticks {
79 int dynticks_nesting; /* Track nesting level, sort of. */
80 int dynticks; /* Even value for dynticks-idle, else odd. */
81 int dynticks_nmi; /* Even value for either dynticks-idle or */
82 /* not in nmi handler, else odd. So this */
83 /* remains even for nmi from irq handler. */
84};
85
86/*
87 * Definition for node within the RCU grace-period-detection hierarchy.
88 */
89struct rcu_node {
90 spinlock_t lock;
91 unsigned long qsmask; /* CPUs or groups that need to switch in */
92 /* order for current grace period to proceed.*/
93 unsigned long qsmaskinit;
94 /* Per-GP initialization for qsmask. */
95 unsigned long grpmask; /* Mask to apply to parent qsmask. */
96 int grplo; /* lowest-numbered CPU or group here. */
97 int grphi; /* highest-numbered CPU or group here. */
98 u8 grpnum; /* CPU/group number for next level up. */
99 u8 level; /* root is at level 0. */
100 struct rcu_node *parent;
101} ____cacheline_internodealigned_in_smp;
102
103/* Index values for nxttail array in struct rcu_data. */
104#define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
105#define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
106#define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
107#define RCU_NEXT_TAIL 3
108#define RCU_NEXT_SIZE 4
109
110/* Per-CPU data for read-copy update. */
111struct rcu_data {
112 /* 1) quiescent-state and grace-period handling : */
113 long completed; /* Track rsp->completed gp number */
114 /* in order to detect GP end. */
115 long gpnum; /* Highest gp number that this CPU */
116 /* is aware of having started. */
117 long passed_quiesc_completed;
118 /* Value of completed at time of qs. */
119 bool passed_quiesc; /* User-mode/idle loop etc. */
120 bool qs_pending; /* Core waits for quiesc state. */
121 bool beenonline; /* CPU online at least once. */
122 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
123 unsigned long grpmask; /* Mask to apply to leaf qsmask. */
124
125 /* 2) batch handling */
126 /*
127 * If nxtlist is not NULL, it is partitioned as follows.
128 * Any of the partitions might be empty, in which case the
129 * pointer to that partition will be equal to the pointer for
130 * the following partition. When the list is empty, all of
131 * the nxttail elements point to nxtlist, which is NULL.
132 *
133 * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]):
134 * Entries that might have arrived after current GP ended
135 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
136 * Entries known to have arrived before current GP ended
137 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
138 * Entries that batch # <= ->completed - 1: waiting for current GP
139 * [nxtlist, *nxttail[RCU_DONE_TAIL]):
140 * Entries that batch # <= ->completed
141 * The grace period for these entries has completed, and
142 * the other grace-period-completed entries may be moved
143 * here temporarily in rcu_process_callbacks().
144 */
145 struct rcu_head *nxtlist;
146 struct rcu_head **nxttail[RCU_NEXT_SIZE];
147 long qlen; /* # of queued callbacks */
148 long blimit; /* Upper limit on a processed batch */
149
150#ifdef CONFIG_NO_HZ
151 /* 3) dynticks interface. */
152 struct rcu_dynticks *dynticks; /* Shared per-CPU dynticks state. */
153 int dynticks_snap; /* Per-GP tracking for dynticks. */
154 int dynticks_nmi_snap; /* Per-GP tracking for dynticks_nmi. */
155#endif /* #ifdef CONFIG_NO_HZ */
156
157 /* 4) reasons this CPU needed to be kicked by force_quiescent_state */
158#ifdef CONFIG_NO_HZ
159 unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */
160#endif /* #ifdef CONFIG_NO_HZ */
161 unsigned long offline_fqs; /* Kicked due to being offline. */
162 unsigned long resched_ipi; /* Sent a resched IPI. */
163
164 /* 5) __rcu_pending() statistics. */
165 long n_rcu_pending; /* rcu_pending() calls since boot. */
166 long n_rp_qs_pending;
167 long n_rp_cb_ready;
168 long n_rp_cpu_needs_gp;
169 long n_rp_gp_completed;
170 long n_rp_gp_started;
171 long n_rp_need_fqs;
172 long n_rp_need_nothing;
173
174 int cpu;
175};
176
177/* Values for signaled field in struct rcu_state. */
178#define RCU_GP_INIT 0 /* Grace period being initialized. */
179#define RCU_SAVE_DYNTICK 1 /* Need to scan dyntick state. */
180#define RCU_FORCE_QS 2 /* Need to force quiescent state. */
181#ifdef CONFIG_NO_HZ
182#define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
183#else /* #ifdef CONFIG_NO_HZ */
184#define RCU_SIGNAL_INIT RCU_FORCE_QS
185#endif /* #else #ifdef CONFIG_NO_HZ */
186
187#define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
188#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
189#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rsp->jiffies_stall */
190#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rsp->jiffies_stall */
191#define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time */
192 /* to take at least one */
193 /* scheduling clock irq */
194 /* before ratting on them. */
195
196#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
197
198/*
199 * RCU global state, including node hierarchy. This hierarchy is
200 * represented in "heap" form in a dense array. The root (first level)
201 * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
202 * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
203 * and the third level in ->node[m+1] and following (->node[m+1] referenced
204 * by ->level[2]). The number of levels is determined by the number of
205 * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy"
206 * consisting of a single rcu_node.
207 */
208struct rcu_state {
209 struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */
210 struct rcu_node *level[NUM_RCU_LVLS]; /* Hierarchy levels. */
211 u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */
212 u8 levelspread[NUM_RCU_LVLS]; /* kids/node in each level. */
213 struct rcu_data *rda[NR_CPUS]; /* array of rdp pointers. */
214
215 /* The following fields are guarded by the root rcu_node's lock. */
216
217 u8 signaled ____cacheline_internodealigned_in_smp;
218 /* Force QS state. */
219 long gpnum; /* Current gp number. */
220 long completed; /* # of last completed gp. */
221 spinlock_t onofflock; /* exclude on/offline and */
222 /* starting new GP. */
223 spinlock_t fqslock; /* Only one task forcing */
224 /* quiescent states. */
225 unsigned long jiffies_force_qs; /* Time at which to invoke */
226 /* force_quiescent_state(). */
227 unsigned long n_force_qs; /* Number of calls to */
228 /* force_quiescent_state(). */
229 unsigned long n_force_qs_lh; /* ~Number of calls leaving */
230 /* due to lock unavailable. */
231 unsigned long n_force_qs_ngp; /* Number of calls leaving */
232 /* due to no GP active. */
233#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
234 unsigned long gp_start; /* Time at which GP started, */
235 /* but in jiffies. */
236 unsigned long jiffies_stall; /* Time at which to check */
237 /* for CPU stalls. */
238#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
239#ifdef CONFIG_NO_HZ
240 long dynticks_completed; /* Value of completed @ snap. */
241#endif /* #ifdef CONFIG_NO_HZ */
242};
243 41
244extern void rcu_qsctr_inc(int cpu); 42#ifdef CONFIG_TREE_PREEMPT_RCU
245extern void rcu_bh_qsctr_inc(int cpu);
246 43
247extern int rcu_pending(int cpu); 44extern void __rcu_read_lock(void);
248extern int rcu_needs_cpu(int cpu); 45extern void __rcu_read_unlock(void);
46extern void exit_rcu(void);
249 47
250#ifdef CONFIG_DEBUG_LOCK_ALLOC 48#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
251extern struct lockdep_map rcu_lock_map;
252# define rcu_read_acquire() \
253 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
254# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
255#else
256# define rcu_read_acquire() do { } while (0)
257# define rcu_read_release() do { } while (0)
258#endif
259 49
260static inline void __rcu_read_lock(void) 50static inline void __rcu_read_lock(void)
261{ 51{
262 preempt_disable(); 52 preempt_disable();
263 __acquire(RCU);
264 rcu_read_acquire();
265} 53}
54
266static inline void __rcu_read_unlock(void) 55static inline void __rcu_read_unlock(void)
267{ 56{
268 rcu_read_release();
269 __release(RCU);
270 preempt_enable(); 57 preempt_enable();
271} 58}
59
60#define __synchronize_sched() synchronize_rcu()
61
62static inline void exit_rcu(void)
63{
64}
65
66#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
67
272static inline void __rcu_read_lock_bh(void) 68static inline void __rcu_read_lock_bh(void)
273{ 69{
274 local_bh_disable(); 70 local_bh_disable();
275 __acquire(RCU_BH);
276 rcu_read_acquire();
277} 71}
278static inline void __rcu_read_unlock_bh(void) 72static inline void __rcu_read_unlock_bh(void)
279{ 73{
280 rcu_read_release();
281 __release(RCU_BH);
282 local_bh_enable(); 74 local_bh_enable();
283} 75}
284 76
285#define __synchronize_sched() synchronize_rcu() 77extern void call_rcu_sched(struct rcu_head *head,
286 78 void (*func)(struct rcu_head *rcu));
287#define call_rcu_sched(head, func) call_rcu(head, func) 79extern void synchronize_rcu_expedited(void);
288 80
289static inline void rcu_init_sched(void) 81static inline void synchronize_rcu_bh_expedited(void)
290{ 82{
83 synchronize_sched_expedited();
291} 84}
292 85
293extern void __rcu_init(void); 86extern void __rcu_init(void);
294extern void rcu_check_callbacks(int cpu, int user); 87extern void rcu_check_callbacks(int cpu, int user);
295extern void rcu_restart_cpu(int cpu);
296 88
297extern long rcu_batches_completed(void); 89extern long rcu_batches_completed(void);
298extern long rcu_batches_completed_bh(void); 90extern long rcu_batches_completed_bh(void);
91extern long rcu_batches_completed_sched(void);
299 92
300#ifdef CONFIG_NO_HZ 93#ifdef CONFIG_NO_HZ
301void rcu_enter_nohz(void); 94void rcu_enter_nohz(void);
@@ -309,7 +102,7 @@ static inline void rcu_exit_nohz(void)
309} 102}
310#endif /* CONFIG_NO_HZ */ 103#endif /* CONFIG_NO_HZ */
311 104
312/* A context switch is a grace period for rcutree. */ 105/* A context switch is a grace period for RCU-sched and RCU-bh. */
313static inline int rcu_blocking_is_gp(void) 106static inline int rcu_blocking_is_gp(void)
314{ 107{
315 return num_online_cpus() == 1; 108 return num_online_cpus() == 1;
diff --git a/include/linux/rds.h b/include/linux/rds.h
index d91dc91f5443..89d46e1afbb1 100644
--- a/include/linux/rds.h
+++ b/include/linux/rds.h
@@ -147,6 +147,18 @@ struct rds_info_socket {
147 u_int64_t inum; 147 u_int64_t inum;
148} __attribute__((packed)); 148} __attribute__((packed));
149 149
150struct rds_info_tcp_socket {
151 __be32 local_addr;
152 __be16 local_port;
153 __be32 peer_addr;
154 __be16 peer_port;
155 u_int64_t hdr_rem;
156 u_int64_t data_rem;
157 u_int32_t last_sent_nxt;
158 u_int32_t last_expected_una;
159 u_int32_t last_seen_una;
160} __attribute__((packed));
161
150#define RDS_IB_GID_LEN 16 162#define RDS_IB_GID_LEN 16
151struct rds_info_rdma_connection { 163struct rds_info_rdma_connection {
152 __be32 src_addr; 164 __be32 src_addr;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 277f4b964df5..490c5b37b6d7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -125,6 +125,8 @@ struct regulator_bulk_data {
125/* regulator get and put */ 125/* regulator get and put */
126struct regulator *__must_check regulator_get(struct device *dev, 126struct regulator *__must_check regulator_get(struct device *dev,
127 const char *id); 127 const char *id);
128struct regulator *__must_check regulator_get_exclusive(struct device *dev,
129 const char *id);
128void regulator_put(struct regulator *regulator); 130void regulator_put(struct regulator *regulator);
129 131
130/* regulator output control and status */ 132/* regulator output control and status */
@@ -144,6 +146,8 @@ void regulator_bulk_free(int num_consumers,
144 146
145int regulator_count_voltages(struct regulator *regulator); 147int regulator_count_voltages(struct regulator *regulator);
146int regulator_list_voltage(struct regulator *regulator, unsigned selector); 148int regulator_list_voltage(struct regulator *regulator, unsigned selector);
149int regulator_is_supported_voltage(struct regulator *regulator,
150 int min_uV, int max_uV);
147int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 151int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
148int regulator_get_voltage(struct regulator *regulator); 152int regulator_get_voltage(struct regulator *regulator);
149int regulator_set_current_limit(struct regulator *regulator, 153int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 225f733e7533..31f2055eae28 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -37,7 +37,8 @@ enum regulator_status {
37 * 37 *
38 * @enable: Configure the regulator as enabled. 38 * @enable: Configure the regulator as enabled.
39 * @disable: Configure the regulator as disabled. 39 * @disable: Configure the regulator as disabled.
40 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. 40 * @is_enabled: Return 1 if the regulator is enabled, 0 if not.
41 * May also return negative errno.
41 * 42 *
42 * @set_voltage: Set the voltage for the regulator within the range specified. 43 * @set_voltage: Set the voltage for the regulator within the range specified.
43 * The driver should select the voltage closest to min_uV. 44 * The driver should select the voltage closest to min_uV.
@@ -162,6 +163,8 @@ struct regulator_desc {
162struct regulator_dev { 163struct regulator_dev {
163 struct regulator_desc *desc; 164 struct regulator_desc *desc;
164 int use_count; 165 int use_count;
166 int open_count;
167 int exclusive;
165 168
166 /* lists we belong to */ 169 /* lists we belong to */
167 struct list_head list; /* list of all regulators */ 170 struct list_head list; /* list of all regulators */
@@ -193,6 +196,8 @@ void *rdev_get_drvdata(struct regulator_dev *rdev);
193struct device *rdev_get_dev(struct regulator_dev *rdev); 196struct device *rdev_get_dev(struct regulator_dev *rdev);
194int rdev_get_id(struct regulator_dev *rdev); 197int rdev_get_id(struct regulator_dev *rdev);
195 198
199int regulator_mode_to_status(unsigned int);
200
196void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 201void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
197 202
198#endif 203#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 91b4da31f1b5..e94a4a1c7c8a 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -5,6 +5,9 @@
5 * 5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 * 7 *
8 * Copyright (c) 2009 Nokia Corporation
9 * Roger Quadros <ext-roger.quadros@nokia.com>
10 *
8 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 12 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the 13 * published by the Free Software Foundation; either version 2 of the
@@ -16,9 +19,30 @@
16 19
17struct regulator_init_data; 20struct regulator_init_data;
18 21
22/**
23 * struct fixed_voltage_config - fixed_voltage_config structure
24 * @supply_name: Name of the regulator supply
25 * @microvolts: Output voltage of regulator
26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used
28 * @enable_high: Polarity of enable GPIO
29 * 1 = Active high, 0 = Active low
30 * @enabled_at_boot: Whether regulator has been enabled at
31 * boot or not. 1 = Yes, 0 = No
32 * This is used to keep the regulator at
33 * the default state
34 * @init_data: regulator_init_data
35 *
36 * This structure contains fixed voltage regulator configuration
37 * information that must be passed by platform code to the fixed
38 * voltage regulator driver.
39 */
19struct fixed_voltage_config { 40struct fixed_voltage_config {
20 const char *supply_name; 41 const char *supply_name;
21 int microvolts; 42 int microvolts;
43 int gpio;
44 unsigned enable_high:1;
45 unsigned enabled_at_boot:1;
22 struct regulator_init_data *init_data; 46 struct regulator_init_data *init_data;
23}; 47};
24 48
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index bac64fa390f2..87f5f176d4ef 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -41,7 +41,7 @@ struct regulator;
41#define REGULATOR_CHANGE_DRMS 0x10 41#define REGULATOR_CHANGE_DRMS 0x10
42 42
43/** 43/**
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power system states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 * 47 *
@@ -117,25 +117,37 @@ struct regulation_constraints {
117 /* mode to set on startup */ 117 /* mode to set on startup */
118 unsigned int initial_mode; 118 unsigned int initial_mode;
119 119
120 /* constriant flags */ 120 /* constraint flags */
121 unsigned always_on:1; /* regulator never off when system is on */ 121 unsigned always_on:1; /* regulator never off when system is on */
122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
123 unsigned apply_uV:1; /* apply uV constraint iff min == max */ 123 unsigned apply_uV:1; /* apply uV constraint if min == max */
124}; 124};
125 125
126/** 126/**
127 * struct regulator_consumer_supply - supply -> device mapping 127 * struct regulator_consumer_supply - supply -> device mapping
128 * 128 *
129 * This maps a supply name to a device. 129 * This maps a supply name to a device. Only one of dev or dev_name
130 * can be specified. Use of dev_name allows support for buses which
131 * make struct device available late such as I2C and is the preferred
132 * form.
130 * 133 *
131 * @dev: Device structure for the consumer. 134 * @dev: Device structure for the consumer.
135 * @dev_name: Result of dev_name() for the consumer.
132 * @supply: Name for the supply. 136 * @supply: Name for the supply.
133 */ 137 */
134struct regulator_consumer_supply { 138struct regulator_consumer_supply {
135 struct device *dev; /* consumer */ 139 struct device *dev; /* consumer */
140 const char *dev_name; /* dev_name() for consumer */
136 const char *supply; /* consumer supply - e.g. "vcc" */ 141 const char *supply; /* consumer supply - e.g. "vcc" */
137}; 142};
138 143
144/* Initialize struct regulator_consumer_supply */
145#define REGULATOR_SUPPLY(_name, _dev_name) \
146{ \
147 .supply = _name, \
148 .dev_name = _dev_name, \
149}
150
139/** 151/**
140 * struct regulator_init_data - regulator platform initialisation data. 152 * struct regulator_init_data - regulator platform initialisation data.
141 * 153 *
@@ -166,6 +178,12 @@ struct regulator_init_data {
166 178
167int regulator_suspend_prepare(suspend_state_t state); 179int regulator_suspend_prepare(suspend_state_t state);
168 180
181#ifdef CONFIG_REGULATOR
169void regulator_has_full_constraints(void); 182void regulator_has_full_constraints(void);
183#else
184static inline void regulator_has_full_constraints(void)
185{
186}
187#endif
170 188
171#endif 189#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
index 44563192bf16..de9a7fae20be 100644
--- a/include/linux/regulator/max1586.h
+++ b/include/linux/regulator/max1586.h
@@ -36,7 +36,7 @@
36 * max1586_subdev_data - regulator data 36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6) 37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core") 38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...) 39 * @platform_data: regulator init data (constraints, supplies, ...)
40 */ 40 */
41struct max1586_subdev_data { 41struct max1586_subdev_data {
42 int id; 42 int id;
@@ -46,7 +46,7 @@ struct max1586_subdev_data {
46 46
47/** 47/**
48 * max1586_platform_data - platform data for max1586 48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2) 49 * @num_subdevs: number of regulators used (may be 1 or 2)
50 * @subdevs: regulator used 50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages. 51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6. 52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 953fc055e875..14a86bc7102b 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -140,7 +140,7 @@ struct rchan_callbacks
140 * cause relay_open() to create a single global buffer rather 140 * cause relay_open() to create a single global buffer rather
141 * than the default set of per-cpu buffers. 141 * than the default set of per-cpu buffers.
142 * 142 *
143 * See Documentation/filesystems/relayfs.txt for more info. 143 * See Documentation/filesystems/relay.txt for more info.
144 */ 144 */
145 struct dentry *(*create_buf_file)(const char *filename, 145 struct dentry *(*create_buf_file)(const char *filename,
146 struct dentry *parent, 146 struct dentry *parent,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 511f42fc6816..fcb9884df618 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -35,6 +35,10 @@ struct res_counter {
35 */ 35 */
36 unsigned long long limit; 36 unsigned long long limit;
37 /* 37 /*
38 * the limit that usage can be exceed
39 */
40 unsigned long long soft_limit;
41 /*
38 * the number of unsuccessful attempts to consume the resource 42 * the number of unsuccessful attempts to consume the resource
39 */ 43 */
40 unsigned long long failcnt; 44 unsigned long long failcnt;
@@ -87,6 +91,7 @@ enum {
87 RES_MAX_USAGE, 91 RES_MAX_USAGE,
88 RES_LIMIT, 92 RES_LIMIT,
89 RES_FAILCNT, 93 RES_FAILCNT,
94 RES_SOFT_LIMIT,
90}; 95};
91 96
92/* 97/*
@@ -132,6 +137,36 @@ static inline bool res_counter_limit_check_locked(struct res_counter *cnt)
132 return false; 137 return false;
133} 138}
134 139
140static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
141{
142 if (cnt->usage < cnt->soft_limit)
143 return true;
144
145 return false;
146}
147
148/**
149 * Get the difference between the usage and the soft limit
150 * @cnt: The counter
151 *
152 * Returns 0 if usage is less than or equal to soft limit
153 * The difference between usage and soft limit, otherwise.
154 */
155static inline unsigned long long
156res_counter_soft_limit_excess(struct res_counter *cnt)
157{
158 unsigned long long excess;
159 unsigned long flags;
160
161 spin_lock_irqsave(&cnt->lock, flags);
162 if (cnt->usage <= cnt->soft_limit)
163 excess = 0;
164 else
165 excess = cnt->usage - cnt->soft_limit;
166 spin_unlock_irqrestore(&cnt->lock, flags);
167 return excess;
168}
169
135/* 170/*
136 * Helper function to detect if the cgroup is within it's limit or 171 * Helper function to detect if the cgroup is within it's limit or
137 * not. It's currently called from cgroup_rss_prepare() 172 * not. It's currently called from cgroup_rss_prepare()
@@ -147,6 +182,17 @@ static inline bool res_counter_check_under_limit(struct res_counter *cnt)
147 return ret; 182 return ret;
148} 183}
149 184
185static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
186{
187 bool ret;
188 unsigned long flags;
189
190 spin_lock_irqsave(&cnt->lock, flags);
191 ret = res_counter_soft_limit_check_locked(cnt);
192 spin_unlock_irqrestore(&cnt->lock, flags);
193 return ret;
194}
195
150static inline void res_counter_reset_max(struct res_counter *cnt) 196static inline void res_counter_reset_max(struct res_counter *cnt)
151{ 197{
152 unsigned long flags; 198 unsigned long flags;
@@ -180,4 +226,16 @@ static inline int res_counter_set_limit(struct res_counter *cnt,
180 return ret; 226 return ret;
181} 227}
182 228
229static inline int
230res_counter_set_soft_limit(struct res_counter *cnt,
231 unsigned long long soft_limit)
232{
233 unsigned long flags;
234
235 spin_lock_irqsave(&cnt->lock, flags);
236 cnt->soft_limit = soft_limit;
237 spin_unlock_irqrestore(&cnt->lock, flags);
238 return 0;
239}
240
183#endif 241#endif
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 278777fa8a3a..3392c59d2706 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -6,20 +6,17 @@
6 * Copyright (C) 2007 Dmitry Torokhov 6 * Copyright (C) 2007 Dmitry Torokhov
7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> 7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * Permission to use, copy, modify, and/or distribute this software for any
10 * it under the terms of the GNU General Public License as published by 10 * purpose with or without fee is hereby granted, provided that the above
11 * the Free Software Foundation; either version 2 of the License, or 11 * copyright notice and this permission notice appear in all copies.
12 * (at your option) any later version.
13 * 12 *
14 * This program is distributed in the hope that it will be useful, 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 * GNU General Public License for more details. 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 * You should have received a copy of the GNU General Public License 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 * along with this program; if not, write to the 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */ 20 */
24 21
25#include <linux/types.h> 22#include <linux/types.h>
@@ -47,6 +44,7 @@ enum rfkill_type {
47 RFKILL_TYPE_UWB, 44 RFKILL_TYPE_UWB,
48 RFKILL_TYPE_WIMAX, 45 RFKILL_TYPE_WIMAX,
49 RFKILL_TYPE_WWAN, 46 RFKILL_TYPE_WWAN,
47 RFKILL_TYPE_GPS,
50 NUM_RFKILL_TYPES, 48 NUM_RFKILL_TYPES,
51}; 49};
52 50
@@ -82,6 +80,20 @@ struct rfkill_event {
82 __u8 soft, hard; 80 __u8 soft, hard;
83} __packed; 81} __packed;
84 82
83/*
84 * We are planning to be backward and forward compatible with changes
85 * to the event struct, by adding new, optional, members at the end.
86 * When reading an event (whether the kernel from userspace or vice
87 * versa) we need to accept anything that's at least as large as the
88 * version 1 event size, but might be able to accept other sizes in
89 * the future.
90 *
91 * One exception is the kernel -- we already have two event sizes in
92 * that we've made the 'hard' member optional since our only option
93 * is to ignore it anyway.
94 */
95#define RFKILL_EVENT_SIZE_V1 8
96
85/* ioctl for turning off rfkill-input (if present) */ 97/* ioctl for turning off rfkill-input (if present) */
86#define RFKILL_IOC_MAGIC 'R' 98#define RFKILL_IOC_MAGIC 'R'
87#define RFKILL_IOC_NOINPUT 1 99#define RFKILL_IOC_NOINPUT 1
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 29f8599e6bea..5fcc31ed5771 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -75,20 +75,6 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event)
75} 75}
76 76
77/* 77/*
78 * ring_buffer_event_discard can discard any event in the ring buffer.
79 * it is up to the caller to protect against a reader from
80 * consuming it or a writer from wrapping and replacing it.
81 *
82 * No external protection is needed if this is called before
83 * the event is commited. But in that case it would be better to
84 * use ring_buffer_discard_commit.
85 *
86 * Note, if an event that has not been committed is discarded
87 * with ring_buffer_event_discard, it must still be committed.
88 */
89void ring_buffer_event_discard(struct ring_buffer_event *event);
90
91/*
92 * ring_buffer_discard_commit will remove an event that has not 78 * ring_buffer_discard_commit will remove an event that has not
93 * ben committed yet. If this is used, then ring_buffer_unlock_commit 79 * ben committed yet. If this is used, then ring_buffer_unlock_commit
94 * must not be called on the discarded event. This function 80 * must not be called on the discarded event. This function
@@ -154,8 +140,17 @@ unsigned long ring_buffer_size(struct ring_buffer *buffer);
154void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); 140void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
155void ring_buffer_reset(struct ring_buffer *buffer); 141void ring_buffer_reset(struct ring_buffer *buffer);
156 142
143#ifdef CONFIG_RING_BUFFER_ALLOW_SWAP
157int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, 144int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
158 struct ring_buffer *buffer_b, int cpu); 145 struct ring_buffer *buffer_b, int cpu);
146#else
147static inline int
148ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
149 struct ring_buffer *buffer_b, int cpu)
150{
151 return -ENODEV;
152}
153#endif
159 154
160int ring_buffer_empty(struct ring_buffer *buffer); 155int ring_buffer_empty(struct ring_buffer *buffer);
161int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); 156int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
@@ -170,7 +165,6 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
170unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 165unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
171unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 166unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
172unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); 167unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
173unsigned long ring_buffer_nmi_dropped_cpu(struct ring_buffer *buffer, int cpu);
174 168
175u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 169u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
176void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 170void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf116d0dbf23..cb0ba7032609 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,21 +71,29 @@ void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned lon
71void page_add_file_rmap(struct page *); 71void page_add_file_rmap(struct page *);
72void page_remove_rmap(struct page *); 72void page_remove_rmap(struct page *);
73 73
74#ifdef CONFIG_DEBUG_VM 74static inline void page_dup_rmap(struct page *page)
75void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address);
76#else
77static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address)
78{ 75{
79 atomic_inc(&page->_mapcount); 76 atomic_inc(&page->_mapcount);
80} 77}
81#endif
82 78
83/* 79/*
84 * Called from mm/vmscan.c to handle paging out 80 * Called from mm/vmscan.c to handle paging out
85 */ 81 */
86int page_referenced(struct page *, int is_locked, 82int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags); 83 struct mem_cgroup *cnt, unsigned long *vm_flags);
88int try_to_unmap(struct page *, int ignore_refs); 84enum ttu_flags {
85 TTU_UNMAP = 0, /* unmap mode */
86 TTU_MIGRATION = 1, /* migration mode */
87 TTU_MUNLOCK = 2, /* munlock mode */
88 TTU_ACTION_MASK = 0xff,
89
90 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
91 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
92 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
93};
94#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
95
96int try_to_unmap(struct page *, enum ttu_flags flags);
89 97
90/* 98/*
91 * Called from mm/filemap_xip.c to unmap empty zero page 99 * Called from mm/filemap_xip.c to unmap empty zero page
@@ -112,6 +120,13 @@ int page_mkclean(struct page *);
112 */ 120 */
113int try_to_munlock(struct page *); 121int try_to_munlock(struct page *);
114 122
123/*
124 * Called by memory-failure.c to kill processes.
125 */
126struct anon_vma *page_lock_anon_vma(struct page *page);
127void page_unlock_anon_vma(struct anon_vma *anon_vma);
128int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
129
115#else /* !CONFIG_MMU */ 130#else /* !CONFIG_MMU */
116 131
117#define anon_vma_init() do {} while (0) 132#define anon_vma_init() do {} while (0)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index ba3254ecf7fb..adf2068d12b5 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -104,7 +104,7 @@ enum {
104 RTM_NEWADDRLABEL = 72, 104 RTM_NEWADDRLABEL = 72,
105#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL 105#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
106 RTM_DELADDRLABEL, 106 RTM_DELADDRLABEL,
107#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL 107#define RTM_DELADDRLABEL RTM_DELADDRLABEL
108 RTM_GETADDRLABEL, 108 RTM_GETADDRLABEL,
109#define RTM_GETADDRLABEL RTM_GETADDRLABEL 109#define RTM_GETADDRLABEL RTM_GETADDRLABEL
110 110
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
index f7b826b565c7..a53915cd5581 100644
--- a/include/linux/rxrpc.h
+++ b/include/linux/rxrpc.h
@@ -58,5 +58,12 @@ struct sockaddr_rxrpc {
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */ 58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */ 59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60 60
61/*
62 * RxRPC security indices
63 */
64#define RXRPC_SECURITY_NONE 0 /* no security protocol */
65#define RXRPC_SECURITY_RXKAD 2 /* kaserver or kerberos 4 */
66#define RXRPC_SECURITY_RXGK 4 /* gssapi-based */
67#define RXRPC_SECURITY_RXK5 5 /* kerberos 5 */
61 68
62#endif /* _LINUX_RXRPC_H */ 69#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0f1ea4a66957..75e6e60bf583 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -38,6 +38,8 @@
38#define SCHED_BATCH 3 38#define SCHED_BATCH 3
39/* SCHED_ISO: reserved but not implemented yet */ 39/* SCHED_ISO: reserved but not implemented yet */
40#define SCHED_IDLE 5 40#define SCHED_IDLE 5
41/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
42#define SCHED_RESET_ON_FORK 0x40000000
41 43
42#ifdef __KERNEL__ 44#ifdef __KERNEL__
43 45
@@ -98,7 +100,7 @@ struct robust_list_head;
98struct bio; 100struct bio;
99struct fs_struct; 101struct fs_struct;
100struct bts_context; 102struct bts_context;
101struct perf_counter_context; 103struct perf_event_context;
102 104
103/* 105/*
104 * List of flags we want to share for kernel threads, 106 * List of flags we want to share for kernel threads,
@@ -138,6 +140,10 @@ extern int nr_processes(void);
138extern unsigned long nr_running(void); 140extern unsigned long nr_running(void);
139extern unsigned long nr_uninterruptible(void); 141extern unsigned long nr_uninterruptible(void);
140extern unsigned long nr_iowait(void); 142extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void);
144extern unsigned long this_cpu_load(void);
145
146
141extern void calc_global_load(void); 147extern void calc_global_load(void);
142extern u64 cpu_nr_migrations(int cpu); 148extern u64 cpu_nr_migrations(int cpu);
143 149
@@ -188,6 +194,7 @@ extern unsigned long long time_sync_thresh;
188/* in tsk->state again */ 194/* in tsk->state again */
189#define TASK_DEAD 64 195#define TASK_DEAD 64
190#define TASK_WAKEKILL 128 196#define TASK_WAKEKILL 128
197#define TASK_WAKING 256
191 198
192/* Convenience macros for the sake of set_task_state */ 199/* Convenience macros for the sake of set_task_state */
193#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) 200#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
@@ -254,7 +261,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
254extern void init_idle(struct task_struct *idle, int cpu); 261extern void init_idle(struct task_struct *idle, int cpu);
255extern void init_idle_bootup_task(struct task_struct *idle); 262extern void init_idle_bootup_task(struct task_struct *idle);
256 263
257extern int runqueue_is_locked(void); 264extern int runqueue_is_locked(int cpu);
258extern void task_rq_unlock_wait(struct task_struct *p); 265extern void task_rq_unlock_wait(struct task_struct *p);
259 266
260extern cpumask_var_t nohz_cpu_mask; 267extern cpumask_var_t nohz_cpu_mask;
@@ -302,7 +309,7 @@ extern void softlockup_tick(void);
302extern void touch_softlockup_watchdog(void); 309extern void touch_softlockup_watchdog(void);
303extern void touch_all_softlockup_watchdogs(void); 310extern void touch_all_softlockup_watchdogs(void);
304extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 311extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
305 struct file *filp, void __user *buffer, 312 void __user *buffer,
306 size_t *lenp, loff_t *ppos); 313 size_t *lenp, loff_t *ppos);
307extern unsigned int softlockup_panic; 314extern unsigned int softlockup_panic;
308extern int softlockup_thresh; 315extern int softlockup_thresh;
@@ -324,7 +331,7 @@ extern unsigned long sysctl_hung_task_check_count;
324extern unsigned long sysctl_hung_task_timeout_secs; 331extern unsigned long sysctl_hung_task_timeout_secs;
325extern unsigned long sysctl_hung_task_warnings; 332extern unsigned long sysctl_hung_task_warnings;
326extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, 333extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
327 struct file *filp, void __user *buffer, 334 void __user *buffer,
328 size_t *lenp, loff_t *ppos); 335 size_t *lenp, loff_t *ppos);
329#endif 336#endif
330 337
@@ -419,6 +426,15 @@ static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
419 return max(mm->hiwater_rss, get_mm_rss(mm)); 426 return max(mm->hiwater_rss, get_mm_rss(mm));
420} 427}
421 428
429static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
430 struct mm_struct *mm)
431{
432 unsigned long hiwater_rss = get_mm_hiwater_rss(mm);
433
434 if (*maxrss < hiwater_rss)
435 *maxrss = hiwater_rss;
436}
437
422static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm) 438static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
423{ 439{
424 return max(mm->hiwater_vm, mm->total_vm); 440 return max(mm->hiwater_vm, mm->total_vm);
@@ -431,7 +447,9 @@ extern int get_dumpable(struct mm_struct *mm);
431/* dumpable bits */ 447/* dumpable bits */
432#define MMF_DUMPABLE 0 /* core dump is permitted */ 448#define MMF_DUMPABLE 0 /* core dump is permitted */
433#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */ 449#define MMF_DUMP_SECURELY 1 /* core file is readable only by root */
450
434#define MMF_DUMPABLE_BITS 2 451#define MMF_DUMPABLE_BITS 2
452#define MMF_DUMPABLE_MASK ((1 << MMF_DUMPABLE_BITS) - 1)
435 453
436/* coredump filter bits */ 454/* coredump filter bits */
437#define MMF_DUMP_ANON_PRIVATE 2 455#define MMF_DUMP_ANON_PRIVATE 2
@@ -441,6 +459,7 @@ extern int get_dumpable(struct mm_struct *mm);
441#define MMF_DUMP_ELF_HEADERS 6 459#define MMF_DUMP_ELF_HEADERS 6
442#define MMF_DUMP_HUGETLB_PRIVATE 7 460#define MMF_DUMP_HUGETLB_PRIVATE 7
443#define MMF_DUMP_HUGETLB_SHARED 8 461#define MMF_DUMP_HUGETLB_SHARED 8
462
444#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 463#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
445#define MMF_DUMP_FILTER_BITS 7 464#define MMF_DUMP_FILTER_BITS 7
446#define MMF_DUMP_FILTER_MASK \ 465#define MMF_DUMP_FILTER_MASK \
@@ -454,6 +473,10 @@ extern int get_dumpable(struct mm_struct *mm);
454#else 473#else
455# define MMF_DUMP_MASK_DEFAULT_ELF 0 474# define MMF_DUMP_MASK_DEFAULT_ELF 0
456#endif 475#endif
476 /* leave room for more dump flags */
477#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */
478
479#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
457 480
458struct sighand_struct { 481struct sighand_struct {
459 atomic_t count; 482 atomic_t count;
@@ -470,6 +493,13 @@ struct pacct_struct {
470 unsigned long ac_minflt, ac_majflt; 493 unsigned long ac_minflt, ac_majflt;
471}; 494};
472 495
496struct cpu_itimer {
497 cputime_t expires;
498 cputime_t incr;
499 u32 error;
500 u32 incr_error;
501};
502
473/** 503/**
474 * struct task_cputime - collected CPU time counts 504 * struct task_cputime - collected CPU time counts
475 * @utime: time spent in user mode, in &cputime_t units 505 * @utime: time spent in user mode, in &cputime_t units
@@ -564,9 +594,12 @@ struct signal_struct {
564 struct pid *leader_pid; 594 struct pid *leader_pid;
565 ktime_t it_real_incr; 595 ktime_t it_real_incr;
566 596
567 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 597 /*
568 cputime_t it_prof_expires, it_virt_expires; 598 * ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use
569 cputime_t it_prof_incr, it_virt_incr; 599 * CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these
600 * values are defined to 0 and 1 respectively
601 */
602 struct cpu_itimer it[2];
570 603
571 /* 604 /*
572 * Thread group totals for process CPU timers. 605 * Thread group totals for process CPU timers.
@@ -598,6 +631,7 @@ struct signal_struct {
598 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 631 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
599 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 632 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
600 unsigned long inblock, oublock, cinblock, coublock; 633 unsigned long inblock, oublock, cinblock, coublock;
634 unsigned long maxrss, cmaxrss;
601 struct task_io_accounting ioac; 635 struct task_io_accounting ioac;
602 636
603 /* 637 /*
@@ -629,6 +663,8 @@ struct signal_struct {
629 unsigned audit_tty; 663 unsigned audit_tty;
630 struct tty_audit_buf *tty_audit_buf; 664 struct tty_audit_buf *tty_audit_buf;
631#endif 665#endif
666
667 int oom_adj; /* OOM kill score adjustment (bit shift) */
632}; 668};
633 669
634/* Context switch must be unlocked if interrupts are to be enabled */ 670/* Context switch must be unlocked if interrupts are to be enabled */
@@ -698,7 +734,7 @@ struct user_struct {
698#endif 734#endif
699#endif 735#endif
700 736
701#ifdef CONFIG_PERF_COUNTERS 737#ifdef CONFIG_PERF_EVENTS
702 atomic_long_t locked_vm; 738 atomic_long_t locked_vm;
703#endif 739#endif
704}; 740};
@@ -796,18 +832,19 @@ enum cpu_idle_type {
796#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE 832#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE
797 833
798#ifdef CONFIG_SMP 834#ifdef CONFIG_SMP
799#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 835#define SD_LOAD_BALANCE 0x0001 /* Do load balancing on this domain. */
800#define SD_BALANCE_NEWIDLE 2 /* Balance when about to become idle */ 836#define SD_BALANCE_NEWIDLE 0x0002 /* Balance when about to become idle */
801#define SD_BALANCE_EXEC 4 /* Balance on exec */ 837#define SD_BALANCE_EXEC 0x0004 /* Balance on exec */
802#define SD_BALANCE_FORK 8 /* Balance on fork, clone */ 838#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
803#define SD_WAKE_IDLE 16 /* Wake to idle CPU on task wakeup */ 839#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
804#define SD_WAKE_AFFINE 32 /* Wake task to waking CPU */ 840#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
805#define SD_WAKE_BALANCE 64 /* Perform balancing at task wakeup */ 841#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
806#define SD_SHARE_CPUPOWER 128 /* Domain members share cpu power */ 842#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
807#define SD_POWERSAVINGS_BALANCE 256 /* Balance for power savings */ 843#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
808#define SD_SHARE_PKG_RESOURCES 512 /* Domain members share cpu pkg resources */ 844#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
809#define SD_SERIALIZE 1024 /* Only a single load balancing instance */ 845#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
810#define SD_WAKE_IDLE_FAR 2048 /* Gain latency sacrificing cache hit */ 846
847#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
811 848
812enum powersavings_balance_level { 849enum powersavings_balance_level {
813 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */ 850 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */
@@ -827,7 +864,7 @@ static inline int sd_balance_for_mc_power(void)
827 if (sched_smt_power_savings) 864 if (sched_smt_power_savings)
828 return SD_POWERSAVINGS_BALANCE; 865 return SD_POWERSAVINGS_BALANCE;
829 866
830 return 0; 867 return SD_PREFER_SIBLING;
831} 868}
832 869
833static inline int sd_balance_for_package_power(void) 870static inline int sd_balance_for_package_power(void)
@@ -835,7 +872,7 @@ static inline int sd_balance_for_package_power(void)
835 if (sched_mc_power_savings | sched_smt_power_savings) 872 if (sched_mc_power_savings | sched_smt_power_savings)
836 return SD_POWERSAVINGS_BALANCE; 873 return SD_POWERSAVINGS_BALANCE;
837 874
838 return 0; 875 return SD_PREFER_SIBLING;
839} 876}
840 877
841/* 878/*
@@ -857,15 +894,9 @@ struct sched_group {
857 894
858 /* 895 /*
859 * CPU power of this group, SCHED_LOAD_SCALE being max power for a 896 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
860 * single CPU. This is read only (except for setup, hotplug CPU). 897 * single CPU.
861 * Note : Never change cpu_power without recompute its reciprocal
862 */ 898 */
863 unsigned int __cpu_power; 899 unsigned int cpu_power;
864 /*
865 * reciprocal value of cpu_power to avoid expensive divides
866 * (see include/linux/reciprocal_div.h)
867 */
868 u32 reciprocal_cpu_power;
869 900
870 /* 901 /*
871 * The CPUs this group covers. 902 * The CPUs this group covers.
@@ -918,6 +949,7 @@ struct sched_domain {
918 unsigned int newidle_idx; 949 unsigned int newidle_idx;
919 unsigned int wake_idx; 950 unsigned int wake_idx;
920 unsigned int forkexec_idx; 951 unsigned int forkexec_idx;
952 unsigned int smt_gain;
921 int flags; /* See SD_* */ 953 int flags; /* See SD_* */
922 enum sched_domain_level level; 954 enum sched_domain_level level;
923 955
@@ -993,6 +1025,9 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
993 return 0; 1025 return 0;
994} 1026}
995 1027
1028unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
1029unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
1030
996#else /* CONFIG_SMP */ 1031#else /* CONFIG_SMP */
997 1032
998struct sched_domain_attr; 1033struct sched_domain_attr;
@@ -1004,6 +1039,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
1004} 1039}
1005#endif /* !CONFIG_SMP */ 1040#endif /* !CONFIG_SMP */
1006 1041
1042
1007struct io_context; /* See blkdev.h */ 1043struct io_context; /* See blkdev.h */
1008 1044
1009 1045
@@ -1021,6 +1057,12 @@ struct uts_namespace;
1021struct rq; 1057struct rq;
1022struct sched_domain; 1058struct sched_domain;
1023 1059
1060/*
1061 * wake flags
1062 */
1063#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1064#define WF_FORK 0x02 /* child wakeup after fork */
1065
1024struct sched_class { 1066struct sched_class {
1025 const struct sched_class *next; 1067 const struct sched_class *next;
1026 1068
@@ -1028,13 +1070,13 @@ struct sched_class {
1028 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 1070 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
1029 void (*yield_task) (struct rq *rq); 1071 void (*yield_task) (struct rq *rq);
1030 1072
1031 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync); 1073 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
1032 1074
1033 struct task_struct * (*pick_next_task) (struct rq *rq); 1075 struct task_struct * (*pick_next_task) (struct rq *rq);
1034 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1076 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1035 1077
1036#ifdef CONFIG_SMP 1078#ifdef CONFIG_SMP
1037 int (*select_task_rq)(struct task_struct *p, int sync); 1079 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1038 1080
1039 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu, 1081 unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
1040 struct rq *busiest, unsigned long max_load_move, 1082 struct rq *busiest, unsigned long max_load_move,
@@ -1045,7 +1087,6 @@ struct sched_class {
1045 struct rq *busiest, struct sched_domain *sd, 1087 struct rq *busiest, struct sched_domain *sd,
1046 enum cpu_idle_type idle); 1088 enum cpu_idle_type idle);
1047 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1089 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1048 int (*needs_post_schedule) (struct rq *this_rq);
1049 void (*post_schedule) (struct rq *this_rq); 1090 void (*post_schedule) (struct rq *this_rq);
1050 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 1091 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
1051 1092
@@ -1067,6 +1108,8 @@ struct sched_class {
1067 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1108 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1068 int oldprio, int running); 1109 int oldprio, int running);
1069 1110
1111 unsigned int (*get_rr_interval) (struct task_struct *task);
1112
1070#ifdef CONFIG_FAIR_GROUP_SCHED 1113#ifdef CONFIG_FAIR_GROUP_SCHED
1071 void (*moved_group) (struct task_struct *p); 1114 void (*moved_group) (struct task_struct *p);
1072#endif 1115#endif
@@ -1105,11 +1148,15 @@ struct sched_entity {
1105 u64 start_runtime; 1148 u64 start_runtime;
1106 u64 avg_wakeup; 1149 u64 avg_wakeup;
1107 1150
1151 u64 avg_running;
1152
1108#ifdef CONFIG_SCHEDSTATS 1153#ifdef CONFIG_SCHEDSTATS
1109 u64 wait_start; 1154 u64 wait_start;
1110 u64 wait_max; 1155 u64 wait_max;
1111 u64 wait_count; 1156 u64 wait_count;
1112 u64 wait_sum; 1157 u64 wait_sum;
1158 u64 iowait_count;
1159 u64 iowait_sum;
1113 1160
1114 u64 sleep_start; 1161 u64 sleep_start;
1115 u64 sleep_max; 1162 u64 sleep_max;
@@ -1163,6 +1210,8 @@ struct sched_rt_entity {
1163#endif 1210#endif
1164}; 1211};
1165 1212
1213struct rcu_node;
1214
1166struct task_struct { 1215struct task_struct {
1167 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 1216 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
1168 void *stack; 1217 void *stack;
@@ -1198,7 +1247,6 @@ struct task_struct {
1198 * a short time 1247 * a short time
1199 */ 1248 */
1200 unsigned char fpu_counter; 1249 unsigned char fpu_counter;
1201 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1202#ifdef CONFIG_BLK_DEV_IO_TRACE 1250#ifdef CONFIG_BLK_DEV_IO_TRACE
1203 unsigned int btrace_seq; 1251 unsigned int btrace_seq;
1204#endif 1252#endif
@@ -1206,10 +1254,12 @@ struct task_struct {
1206 unsigned int policy; 1254 unsigned int policy;
1207 cpumask_t cpus_allowed; 1255 cpumask_t cpus_allowed;
1208 1256
1209#ifdef CONFIG_PREEMPT_RCU 1257#ifdef CONFIG_TREE_PREEMPT_RCU
1210 int rcu_read_lock_nesting; 1258 int rcu_read_lock_nesting;
1211 int rcu_flipctr_idx; 1259 char rcu_read_unlock_special;
1212#endif /* #ifdef CONFIG_PREEMPT_RCU */ 1260 struct rcu_node *rcu_blocked_node;
1261 struct list_head rcu_node_entry;
1262#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1213 1263
1214#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1264#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1215 struct sched_info sched_info; 1265 struct sched_info sched_info;
@@ -1221,7 +1271,6 @@ struct task_struct {
1221 struct mm_struct *mm, *active_mm; 1271 struct mm_struct *mm, *active_mm;
1222 1272
1223/* task state */ 1273/* task state */
1224 struct linux_binfmt *binfmt;
1225 int exit_state; 1274 int exit_state;
1226 int exit_code, exit_signal; 1275 int exit_code, exit_signal;
1227 int pdeath_signal; /* The signal sent when the parent dies */ 1276 int pdeath_signal; /* The signal sent when the parent dies */
@@ -1230,11 +1279,19 @@ struct task_struct {
1230 unsigned did_exec:1; 1279 unsigned did_exec:1;
1231 unsigned in_execve:1; /* Tell the LSMs that the process is doing an 1280 unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1232 * execve */ 1281 * execve */
1282 unsigned in_iowait:1;
1283
1284
1285 /* Revert to default priority/policy when forking */
1286 unsigned sched_reset_on_fork:1;
1287
1233 pid_t pid; 1288 pid_t pid;
1234 pid_t tgid; 1289 pid_t tgid;
1235 1290
1291#ifdef CONFIG_CC_STACKPROTECTOR
1236 /* Canary value for the -fstack-protector gcc feature */ 1292 /* Canary value for the -fstack-protector gcc feature */
1237 unsigned long stack_canary; 1293 unsigned long stack_canary;
1294#endif
1238 1295
1239 /* 1296 /*
1240 * pointers to (original) parent process, youngest child, younger sibling, 1297 * pointers to (original) parent process, youngest child, younger sibling,
@@ -1292,6 +1349,7 @@ struct task_struct {
1292 struct mutex cred_guard_mutex; /* guard against foreign influences on 1349 struct mutex cred_guard_mutex; /* guard against foreign influences on
1293 * credential calculations 1350 * credential calculations
1294 * (notably. ptrace) */ 1351 * (notably. ptrace) */
1352 struct cred *replacement_session_keyring; /* for KEYCTL_SESSION_TO_PARENT */
1295 1353
1296 char comm[TASK_COMM_LEN]; /* executable name excluding path 1354 char comm[TASK_COMM_LEN]; /* executable name excluding path
1297 - access with [gs]et_task_comm (which lock 1355 - access with [gs]et_task_comm (which lock
@@ -1424,10 +1482,10 @@ struct task_struct {
1424 struct list_head pi_state_list; 1482 struct list_head pi_state_list;
1425 struct futex_pi_state *pi_state_cache; 1483 struct futex_pi_state *pi_state_cache;
1426#endif 1484#endif
1427#ifdef CONFIG_PERF_COUNTERS 1485#ifdef CONFIG_PERF_EVENTS
1428 struct perf_counter_context *perf_counter_ctxp; 1486 struct perf_event_context *perf_event_ctxp;
1429 struct mutex perf_counter_mutex; 1487 struct mutex perf_event_mutex;
1430 struct list_head perf_counter_list; 1488 struct list_head perf_event_list;
1431#endif 1489#endif
1432#ifdef CONFIG_NUMA 1490#ifdef CONFIG_NUMA
1433 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1491 struct mempolicy *mempolicy; /* Protected by alloc_lock */
@@ -1480,6 +1538,7 @@ struct task_struct {
1480 /* bitmask of trace recursion */ 1538 /* bitmask of trace recursion */
1481 unsigned long trace_recursion; 1539 unsigned long trace_recursion;
1482#endif /* CONFIG_TRACING */ 1540#endif /* CONFIG_TRACING */
1541 unsigned long stack_start;
1483}; 1542};
1484 1543
1485/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1544/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1675,6 +1734,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1675#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1734#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1676#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1735#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1677#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1736#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1737#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1678#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1738#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1679#define PF_DUMPCORE 0x00000200 /* dumped core */ 1739#define PF_DUMPCORE 0x00000200 /* dumped core */
1680#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1740#define PF_SIGNALED 0x00000400 /* killed by a signal */
@@ -1686,7 +1746,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1686#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1746#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1687#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1747#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1688#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1748#define PF_KSWAPD 0x00040000 /* I am kswapd */
1689#define PF_SWAPOFF 0x00080000 /* I am in swapoff */ 1749#define PF_OOM_ORIGIN 0x00080000 /* Allocating much memory to others */
1690#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1750#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1691#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1751#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1692#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1752#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1694,6 +1754,7 @@ extern cputime_t task_gtime(struct task_struct *p);
1694#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1754#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1695#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1755#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1696#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */ 1756#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1757#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1697#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1758#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1698#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1759#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1699#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1760#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1724,6 +1785,27 @@ extern cputime_t task_gtime(struct task_struct *p);
1724#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1785#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1725#define used_math() tsk_used_math(current) 1786#define used_math() tsk_used_math(current)
1726 1787
1788#ifdef CONFIG_TREE_PREEMPT_RCU
1789
1790#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1791#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1792
1793static inline void rcu_copy_process(struct task_struct *p)
1794{
1795 p->rcu_read_lock_nesting = 0;
1796 p->rcu_read_unlock_special = 0;
1797 p->rcu_blocked_node = NULL;
1798 INIT_LIST_HEAD(&p->rcu_node_entry);
1799}
1800
1801#else
1802
1803static inline void rcu_copy_process(struct task_struct *p)
1804{
1805}
1806
1807#endif
1808
1727#ifdef CONFIG_SMP 1809#ifdef CONFIG_SMP
1728extern int set_cpus_allowed_ptr(struct task_struct *p, 1810extern int set_cpus_allowed_ptr(struct task_struct *p,
1729 const struct cpumask *new_mask); 1811 const struct cpumask *new_mask);
@@ -1736,10 +1818,13 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
1736 return 0; 1818 return 0;
1737} 1819}
1738#endif 1820#endif
1821
1822#ifndef CONFIG_CPUMASK_OFFSTACK
1739static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) 1823static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1740{ 1824{
1741 return set_cpus_allowed_ptr(p, &new_mask); 1825 return set_cpus_allowed_ptr(p, &new_mask);
1742} 1826}
1827#endif
1743 1828
1744/* 1829/*
1745 * Architectures can set this to 1 if they have specified 1830 * Architectures can set this to 1 if they have specified
@@ -1813,15 +1898,16 @@ extern unsigned int sysctl_sched_min_granularity;
1813extern unsigned int sysctl_sched_wakeup_granularity; 1898extern unsigned int sysctl_sched_wakeup_granularity;
1814extern unsigned int sysctl_sched_shares_ratelimit; 1899extern unsigned int sysctl_sched_shares_ratelimit;
1815extern unsigned int sysctl_sched_shares_thresh; 1900extern unsigned int sysctl_sched_shares_thresh;
1816#ifdef CONFIG_SCHED_DEBUG
1817extern unsigned int sysctl_sched_child_runs_first; 1901extern unsigned int sysctl_sched_child_runs_first;
1902#ifdef CONFIG_SCHED_DEBUG
1818extern unsigned int sysctl_sched_features; 1903extern unsigned int sysctl_sched_features;
1819extern unsigned int sysctl_sched_migration_cost; 1904extern unsigned int sysctl_sched_migration_cost;
1820extern unsigned int sysctl_sched_nr_migrate; 1905extern unsigned int sysctl_sched_nr_migrate;
1906extern unsigned int sysctl_sched_time_avg;
1821extern unsigned int sysctl_timer_migration; 1907extern unsigned int sysctl_timer_migration;
1822 1908
1823int sched_nr_latency_handler(struct ctl_table *table, int write, 1909int sched_nr_latency_handler(struct ctl_table *table, int write,
1824 struct file *file, void __user *buffer, size_t *length, 1910 void __user *buffer, size_t *length,
1825 loff_t *ppos); 1911 loff_t *ppos);
1826#endif 1912#endif
1827#ifdef CONFIG_SCHED_DEBUG 1913#ifdef CONFIG_SCHED_DEBUG
@@ -1839,7 +1925,7 @@ extern unsigned int sysctl_sched_rt_period;
1839extern int sysctl_sched_rt_runtime; 1925extern int sysctl_sched_rt_runtime;
1840 1926
1841int sched_rt_handler(struct ctl_table *table, int write, 1927int sched_rt_handler(struct ctl_table *table, int write,
1842 struct file *filp, void __user *buffer, size_t *lenp, 1928 void __user *buffer, size_t *lenp,
1843 loff_t *ppos); 1929 loff_t *ppos);
1844 1930
1845extern unsigned int sysctl_sched_compat_yield; 1931extern unsigned int sysctl_sched_compat_yield;
@@ -1974,6 +2060,7 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
1974extern int kill_pid(struct pid *pid, int sig, int priv); 2060extern int kill_pid(struct pid *pid, int sig, int priv);
1975extern int kill_proc_info(int, struct siginfo *, pid_t); 2061extern int kill_proc_info(int, struct siginfo *, pid_t);
1976extern int do_notify_parent(struct task_struct *, int); 2062extern int do_notify_parent(struct task_struct *, int);
2063extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
1977extern void force_sig(int, struct task_struct *); 2064extern void force_sig(int, struct task_struct *);
1978extern void force_sig_specific(int, struct task_struct *); 2065extern void force_sig_specific(int, struct task_struct *);
1979extern int send_sig(int, struct task_struct *, int); 2066extern int send_sig(int, struct task_struct *, int);
@@ -2077,7 +2164,7 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2077#define for_each_process(p) \ 2164#define for_each_process(p) \
2078 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 2165 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
2079 2166
2080extern bool is_single_threaded(struct task_struct *); 2167extern bool current_is_single_threaded(void);
2081 2168
2082/* 2169/*
2083 * Careful: do_each_thread/while_each_thread is a double loop so 2170 * Careful: do_each_thread/while_each_thread is a double loop so
@@ -2251,7 +2338,10 @@ static inline int signal_pending(struct task_struct *p)
2251 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2338 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
2252} 2339}
2253 2340
2254extern int __fatal_signal_pending(struct task_struct *p); 2341static inline int __fatal_signal_pending(struct task_struct *p)
2342{
2343 return unlikely(sigismember(&p->pending.signal, SIGKILL));
2344}
2255 2345
2256static inline int fatal_signal_pending(struct task_struct *p) 2346static inline int fatal_signal_pending(struct task_struct *p)
2257{ 2347{
@@ -2281,23 +2371,31 @@ static inline int need_resched(void)
2281 * cond_resched_softirq() will enable bhs before scheduling. 2371 * cond_resched_softirq() will enable bhs before scheduling.
2282 */ 2372 */
2283extern int _cond_resched(void); 2373extern int _cond_resched(void);
2284#ifdef CONFIG_PREEMPT_BKL 2374
2285static inline int cond_resched(void) 2375#define cond_resched() ({ \
2286{ 2376 __might_sleep(__FILE__, __LINE__, 0); \
2287 return 0; 2377 _cond_resched(); \
2288} 2378})
2379
2380extern int __cond_resched_lock(spinlock_t *lock);
2381
2382#ifdef CONFIG_PREEMPT
2383#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET
2289#else 2384#else
2290static inline int cond_resched(void) 2385#define PREEMPT_LOCK_OFFSET 0
2291{
2292 return _cond_resched();
2293}
2294#endif 2386#endif
2295extern int cond_resched_lock(spinlock_t * lock); 2387
2296extern int cond_resched_softirq(void); 2388#define cond_resched_lock(lock) ({ \
2297static inline int cond_resched_bkl(void) 2389 __might_sleep(__FILE__, __LINE__, PREEMPT_LOCK_OFFSET); \
2298{ 2390 __cond_resched_lock(lock); \
2299 return _cond_resched(); 2391})
2300} 2392
2393extern int __cond_resched_softirq(void);
2394
2395#define cond_resched_softirq() ({ \
2396 __might_sleep(__FILE__, __LINE__, SOFTIRQ_OFFSET); \
2397 __cond_resched_softirq(); \
2398})
2301 2399
2302/* 2400/*
2303 * Does a critical section need to be broken due to another 2401 * Does a critical section need to be broken due to another
diff --git a/include/linux/security.h b/include/linux/security.h
index 1f16eea2017b..239e40d0450b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -53,7 +53,7 @@ struct audit_krule;
53extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 53extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
54 int cap, int audit); 54 int cap, int audit);
55extern int cap_settime(struct timespec *ts, struct timezone *tz); 55extern int cap_settime(struct timespec *ts, struct timezone *tz);
56extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 56extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
57extern int cap_ptrace_traceme(struct task_struct *parent); 57extern int cap_ptrace_traceme(struct task_struct *parent);
58extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 58extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
59extern int cap_capset(struct cred *new, const struct cred *old, 59extern int cap_capset(struct cred *new, const struct cred *old,
@@ -133,7 +133,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
133 return PAGE_ALIGN(mmap_min_addr); 133 return PAGE_ALIGN(mmap_min_addr);
134 return hint; 134 return hint;
135} 135}
136extern int mmap_min_addr_handler(struct ctl_table *table, int write, struct file *filp, 136extern int mmap_min_addr_handler(struct ctl_table *table, int write,
137 void __user *buffer, size_t *lenp, loff_t *ppos); 137 void __user *buffer, size_t *lenp, loff_t *ppos);
138 138
139#ifdef CONFIG_SECURITY 139#ifdef CONFIG_SECURITY
@@ -653,6 +653,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
653 * manual page for definitions of the @clone_flags. 653 * manual page for definitions of the @clone_flags.
654 * @clone_flags contains the flags indicating what should be shared. 654 * @clone_flags contains the flags indicating what should be shared.
655 * Return 0 if permission is granted. 655 * Return 0 if permission is granted.
656 * @cred_alloc_blank:
657 * @cred points to the credentials.
658 * @gfp indicates the atomicity of any memory allocations.
659 * Only allocate sufficient memory and attach to @cred such that
660 * cred_transfer() will not get ENOMEM.
656 * @cred_free: 661 * @cred_free:
657 * @cred points to the credentials. 662 * @cred points to the credentials.
658 * Deallocate and clear the cred->security field in a set of credentials. 663 * Deallocate and clear the cred->security field in a set of credentials.
@@ -665,6 +670,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
665 * @new points to the new credentials. 670 * @new points to the new credentials.
666 * @old points to the original credentials. 671 * @old points to the original credentials.
667 * Install a new set of credentials. 672 * Install a new set of credentials.
673 * @cred_transfer:
674 * @new points to the new credentials.
675 * @old points to the original credentials.
676 * Transfer data from original creds to new creds
668 * @kernel_act_as: 677 * @kernel_act_as:
669 * Set the credentials for a kernel service to act as (subjective context). 678 * Set the credentials for a kernel service to act as (subjective context).
670 * @new points to the credentials to be modified. 679 * @new points to the credentials to be modified.
@@ -678,6 +687,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
678 * @inode points to the inode to use as a reference. 687 * @inode points to the inode to use as a reference.
679 * The current task must be the one that nominated @inode. 688 * The current task must be the one that nominated @inode.
680 * Return 0 if successful. 689 * Return 0 if successful.
690 * @kernel_module_request:
691 * Ability to trigger the kernel to automatically upcall to userspace for
692 * userspace to load a kernel module with the given name.
693 * Return 0 if successful.
681 * @task_setuid: 694 * @task_setuid:
682 * Check permission before setting one or more of the user identity 695 * Check permission before setting one or more of the user identity
683 * attributes of the current process. The @flags parameter indicates 696 * attributes of the current process. The @flags parameter indicates
@@ -994,6 +1007,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
994 * Sets the connection's peersid to the secmark on skb. 1007 * Sets the connection's peersid to the secmark on skb.
995 * @req_classify_flow: 1008 * @req_classify_flow:
996 * Sets the flow's sid to the openreq sid. 1009 * Sets the flow's sid to the openreq sid.
1010 * @tun_dev_create:
1011 * Check permissions prior to creating a new TUN device.
1012 * @tun_dev_post_create:
1013 * This hook allows a module to update or allocate a per-socket security
1014 * structure.
1015 * @sk contains the newly created sock structure.
1016 * @tun_dev_attach:
1017 * Check permissions prior to attaching to a persistent TUN device. This
1018 * hook can also be used by the module to update any security state
1019 * associated with the TUN device's sock structure.
1020 * @sk contains the existing sock structure.
997 * 1021 *
998 * Security hooks for XFRM operations. 1022 * Security hooks for XFRM operations.
999 * 1023 *
@@ -1088,6 +1112,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1088 * Return the length of the string (including terminating NUL) or -ve if 1112 * Return the length of the string (including terminating NUL) or -ve if
1089 * an error. 1113 * an error.
1090 * May also return 0 (and a NULL buffer pointer) if there is no label. 1114 * May also return 0 (and a NULL buffer pointer) if there is no label.
1115 * @key_session_to_parent:
1116 * Forcibly assign the session keyring from a process to its parent
1117 * process.
1118 * @cred: Pointer to process's credentials
1119 * @parent_cred: Pointer to parent process's credentials
1120 * @keyring: Proposed new session keyring
1121 * Return 0 if permission is granted, -ve error otherwise.
1091 * 1122 *
1092 * Security hooks affecting all System V IPC operations. 1123 * Security hooks affecting all System V IPC operations.
1093 * 1124 *
@@ -1229,7 +1260,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1229 * @alter contains the flag indicating whether changes are to be made. 1260 * @alter contains the flag indicating whether changes are to be made.
1230 * Return 0 if permission is granted. 1261 * Return 0 if permission is granted.
1231 * 1262 *
1232 * @ptrace_may_access: 1263 * @ptrace_access_check:
1233 * Check permission before allowing the current process to trace the 1264 * Check permission before allowing the current process to trace the
1234 * @child process. 1265 * @child process.
1235 * Security modules may also want to perform a process tracing check 1266 * Security modules may also want to perform a process tracing check
@@ -1244,7 +1275,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1244 * Check that the @parent process has sufficient permission to trace the 1275 * Check that the @parent process has sufficient permission to trace the
1245 * current process before allowing the current process to present itself 1276 * current process before allowing the current process to present itself
1246 * to the @parent process for tracing. 1277 * to the @parent process for tracing.
1247 * The parent process will still have to undergo the ptrace_may_access 1278 * The parent process will still have to undergo the ptrace_access_check
1248 * checks before it is allowed to trace this one. 1279 * checks before it is allowed to trace this one.
1249 * @parent contains the task_struct structure for debugger process. 1280 * @parent contains the task_struct structure for debugger process.
1250 * Return 0 if permission is granted. 1281 * Return 0 if permission is granted.
@@ -1351,12 +1382,47 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1351 * audit_rule_init. 1382 * audit_rule_init.
1352 * @rule contains the allocated rule 1383 * @rule contains the allocated rule
1353 * 1384 *
1385 * @inode_notifysecctx:
1386 * Notify the security module of what the security context of an inode
1387 * should be. Initializes the incore security context managed by the
1388 * security module for this inode. Example usage: NFS client invokes
1389 * this hook to initialize the security context in its incore inode to the
1390 * value provided by the server for the file when the server returned the
1391 * file's attributes to the client.
1392 *
1393 * Must be called with inode->i_mutex locked.
1394 *
1395 * @inode we wish to set the security context of.
1396 * @ctx contains the string which we wish to set in the inode.
1397 * @ctxlen contains the length of @ctx.
1398 *
1399 * @inode_setsecctx:
1400 * Change the security context of an inode. Updates the
1401 * incore security context managed by the security module and invokes the
1402 * fs code as needed (via __vfs_setxattr_noperm) to update any backing
1403 * xattrs that represent the context. Example usage: NFS server invokes
1404 * this hook to change the security context in its incore inode and on the
1405 * backing filesystem to a value provided by the client on a SETATTR
1406 * operation.
1407 *
1408 * Must be called with inode->i_mutex locked.
1409 *
1410 * @dentry contains the inode we wish to set the security context of.
1411 * @ctx contains the string which we wish to set in the inode.
1412 * @ctxlen contains the length of @ctx.
1413 *
1414 * @inode_getsecctx:
1415 * Returns a string containing all relavent security context information
1416 *
1417 * @inode we wish to set the security context of.
1418 * @ctx is a pointer in which to place the allocated security context.
1419 * @ctxlen points to the place to put the length of @ctx.
1354 * This is the main security structure. 1420 * This is the main security structure.
1355 */ 1421 */
1356struct security_operations { 1422struct security_operations {
1357 char name[SECURITY_NAME_MAX + 1]; 1423 char name[SECURITY_NAME_MAX + 1];
1358 1424
1359 int (*ptrace_may_access) (struct task_struct *child, unsigned int mode); 1425 int (*ptrace_access_check) (struct task_struct *child, unsigned int mode);
1360 int (*ptrace_traceme) (struct task_struct *parent); 1426 int (*ptrace_traceme) (struct task_struct *parent);
1361 int (*capget) (struct task_struct *target, 1427 int (*capget) (struct task_struct *target,
1362 kernel_cap_t *effective, 1428 kernel_cap_t *effective,
@@ -1483,12 +1549,15 @@ struct security_operations {
1483 int (*dentry_open) (struct file *file, const struct cred *cred); 1549 int (*dentry_open) (struct file *file, const struct cred *cred);
1484 1550
1485 int (*task_create) (unsigned long clone_flags); 1551 int (*task_create) (unsigned long clone_flags);
1552 int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp);
1486 void (*cred_free) (struct cred *cred); 1553 void (*cred_free) (struct cred *cred);
1487 int (*cred_prepare)(struct cred *new, const struct cred *old, 1554 int (*cred_prepare)(struct cred *new, const struct cred *old,
1488 gfp_t gfp); 1555 gfp_t gfp);
1489 void (*cred_commit)(struct cred *new, const struct cred *old); 1556 void (*cred_commit)(struct cred *new, const struct cred *old);
1557 void (*cred_transfer)(struct cred *new, const struct cred *old);
1490 int (*kernel_act_as)(struct cred *new, u32 secid); 1558 int (*kernel_act_as)(struct cred *new, u32 secid);
1491 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1559 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1560 int (*kernel_module_request)(void);
1492 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1561 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1493 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1562 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1494 int flags); 1563 int flags);
@@ -1556,6 +1625,10 @@ struct security_operations {
1556 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1625 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1557 void (*release_secctx) (char *secdata, u32 seclen); 1626 void (*release_secctx) (char *secdata, u32 seclen);
1558 1627
1628 int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen);
1629 int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
1630 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
1631
1559#ifdef CONFIG_SECURITY_NETWORK 1632#ifdef CONFIG_SECURITY_NETWORK
1560 int (*unix_stream_connect) (struct socket *sock, 1633 int (*unix_stream_connect) (struct socket *sock,
1561 struct socket *other, struct sock *newsk); 1634 struct socket *other, struct sock *newsk);
@@ -1592,6 +1665,9 @@ struct security_operations {
1592 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req); 1665 void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
1593 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb); 1666 void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
1594 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1667 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1668 int (*tun_dev_create)(void);
1669 void (*tun_dev_post_create)(struct sock *sk);
1670 int (*tun_dev_attach)(struct sock *sk);
1595#endif /* CONFIG_SECURITY_NETWORK */ 1671#endif /* CONFIG_SECURITY_NETWORK */
1596 1672
1597#ifdef CONFIG_SECURITY_NETWORK_XFRM 1673#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -1620,6 +1696,9 @@ struct security_operations {
1620 const struct cred *cred, 1696 const struct cred *cred,
1621 key_perm_t perm); 1697 key_perm_t perm);
1622 int (*key_getsecurity)(struct key *key, char **_buffer); 1698 int (*key_getsecurity)(struct key *key, char **_buffer);
1699 int (*key_session_to_parent)(const struct cred *cred,
1700 const struct cred *parent_cred,
1701 struct key *key);
1623#endif /* CONFIG_KEYS */ 1702#endif /* CONFIG_KEYS */
1624 1703
1625#ifdef CONFIG_AUDIT 1704#ifdef CONFIG_AUDIT
@@ -1637,7 +1716,7 @@ extern int security_module_enable(struct security_operations *ops);
1637extern int register_security(struct security_operations *ops); 1716extern int register_security(struct security_operations *ops);
1638 1717
1639/* Security operations */ 1718/* Security operations */
1640int security_ptrace_may_access(struct task_struct *child, unsigned int mode); 1719int security_ptrace_access_check(struct task_struct *child, unsigned int mode);
1641int security_ptrace_traceme(struct task_struct *parent); 1720int security_ptrace_traceme(struct task_struct *parent);
1642int security_capget(struct task_struct *target, 1721int security_capget(struct task_struct *target,
1643 kernel_cap_t *effective, 1722 kernel_cap_t *effective,
@@ -1736,11 +1815,14 @@ int security_file_send_sigiotask(struct task_struct *tsk,
1736int security_file_receive(struct file *file); 1815int security_file_receive(struct file *file);
1737int security_dentry_open(struct file *file, const struct cred *cred); 1816int security_dentry_open(struct file *file, const struct cred *cred);
1738int security_task_create(unsigned long clone_flags); 1817int security_task_create(unsigned long clone_flags);
1818int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1739void security_cred_free(struct cred *cred); 1819void security_cred_free(struct cred *cred);
1740int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1820int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1741void security_commit_creds(struct cred *new, const struct cred *old); 1821void security_commit_creds(struct cred *new, const struct cred *old);
1822void security_transfer_creds(struct cred *new, const struct cred *old);
1742int security_kernel_act_as(struct cred *new, u32 secid); 1823int security_kernel_act_as(struct cred *new, u32 secid);
1743int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1824int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1825int security_kernel_module_request(void);
1744int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1826int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1745int security_task_fix_setuid(struct cred *new, const struct cred *old, 1827int security_task_fix_setuid(struct cred *new, const struct cred *old,
1746 int flags); 1828 int flags);
@@ -1796,6 +1878,9 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1796int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1878int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1797void security_release_secctx(char *secdata, u32 seclen); 1879void security_release_secctx(char *secdata, u32 seclen);
1798 1880
1881int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen);
1882int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen);
1883int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen);
1799#else /* CONFIG_SECURITY */ 1884#else /* CONFIG_SECURITY */
1800struct security_mnt_opts { 1885struct security_mnt_opts {
1801}; 1886};
@@ -1818,10 +1903,10 @@ static inline int security_init(void)
1818 return 0; 1903 return 0;
1819} 1904}
1820 1905
1821static inline int security_ptrace_may_access(struct task_struct *child, 1906static inline int security_ptrace_access_check(struct task_struct *child,
1822 unsigned int mode) 1907 unsigned int mode)
1823{ 1908{
1824 return cap_ptrace_may_access(child, mode); 1909 return cap_ptrace_access_check(child, mode);
1825} 1910}
1826 1911
1827static inline int security_ptrace_traceme(struct task_struct *parent) 1912static inline int security_ptrace_traceme(struct task_struct *parent)
@@ -2266,6 +2351,11 @@ static inline int security_task_create(unsigned long clone_flags)
2266 return 0; 2351 return 0;
2267} 2352}
2268 2353
2354static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
2355{
2356 return 0;
2357}
2358
2269static inline void security_cred_free(struct cred *cred) 2359static inline void security_cred_free(struct cred *cred)
2270{ } 2360{ }
2271 2361
@@ -2281,6 +2371,11 @@ static inline void security_commit_creds(struct cred *new,
2281{ 2371{
2282} 2372}
2283 2373
2374static inline void security_transfer_creds(struct cred *new,
2375 const struct cred *old)
2376{
2377}
2378
2284static inline int security_kernel_act_as(struct cred *cred, u32 secid) 2379static inline int security_kernel_act_as(struct cred *cred, u32 secid)
2285{ 2380{
2286 return 0; 2381 return 0;
@@ -2292,6 +2387,11 @@ static inline int security_kernel_create_files_as(struct cred *cred,
2292 return 0; 2387 return 0;
2293} 2388}
2294 2389
2390static inline int security_kernel_module_request(void)
2391{
2392 return 0;
2393}
2394
2295static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, 2395static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2296 int flags) 2396 int flags)
2297{ 2397{
@@ -2537,6 +2637,19 @@ static inline int security_secctx_to_secid(const char *secdata,
2537static inline void security_release_secctx(char *secdata, u32 seclen) 2637static inline void security_release_secctx(char *secdata, u32 seclen)
2538{ 2638{
2539} 2639}
2640
2641static inline int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen)
2642{
2643 return -EOPNOTSUPP;
2644}
2645static inline int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
2646{
2647 return -EOPNOTSUPP;
2648}
2649static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
2650{
2651 return -EOPNOTSUPP;
2652}
2540#endif /* CONFIG_SECURITY */ 2653#endif /* CONFIG_SECURITY */
2541 2654
2542#ifdef CONFIG_SECURITY_NETWORK 2655#ifdef CONFIG_SECURITY_NETWORK
@@ -2575,6 +2688,9 @@ void security_inet_csk_clone(struct sock *newsk,
2575 const struct request_sock *req); 2688 const struct request_sock *req);
2576void security_inet_conn_established(struct sock *sk, 2689void security_inet_conn_established(struct sock *sk,
2577 struct sk_buff *skb); 2690 struct sk_buff *skb);
2691int security_tun_dev_create(void);
2692void security_tun_dev_post_create(struct sock *sk);
2693int security_tun_dev_attach(struct sock *sk);
2578 2694
2579#else /* CONFIG_SECURITY_NETWORK */ 2695#else /* CONFIG_SECURITY_NETWORK */
2580static inline int security_unix_stream_connect(struct socket *sock, 2696static inline int security_unix_stream_connect(struct socket *sock,
@@ -2725,6 +2841,20 @@ static inline void security_inet_conn_established(struct sock *sk,
2725 struct sk_buff *skb) 2841 struct sk_buff *skb)
2726{ 2842{
2727} 2843}
2844
2845static inline int security_tun_dev_create(void)
2846{
2847 return 0;
2848}
2849
2850static inline void security_tun_dev_post_create(struct sock *sk)
2851{
2852}
2853
2854static inline int security_tun_dev_attach(struct sock *sk)
2855{
2856 return 0;
2857}
2728#endif /* CONFIG_SECURITY_NETWORK */ 2858#endif /* CONFIG_SECURITY_NETWORK */
2729 2859
2730#ifdef CONFIG_SECURITY_NETWORK_XFRM 2860#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2881,6 +3011,9 @@ void security_key_free(struct key *key);
2881int security_key_permission(key_ref_t key_ref, 3011int security_key_permission(key_ref_t key_ref,
2882 const struct cred *cred, key_perm_t perm); 3012 const struct cred *cred, key_perm_t perm);
2883int security_key_getsecurity(struct key *key, char **_buffer); 3013int security_key_getsecurity(struct key *key, char **_buffer);
3014int security_key_session_to_parent(const struct cred *cred,
3015 const struct cred *parent_cred,
3016 struct key *key);
2884 3017
2885#else 3018#else
2886 3019
@@ -2908,6 +3041,13 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
2908 return 0; 3041 return 0;
2909} 3042}
2910 3043
3044static inline int security_key_session_to_parent(const struct cred *cred,
3045 const struct cred *parent_cred,
3046 struct key *key)
3047{
3048 return 0;
3049}
3050
2911#endif 3051#endif
2912#endif /* CONFIG_KEYS */ 3052#endif /* CONFIG_KEYS */
2913 3053
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index 20f965d4b041..82e0f26a1299 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -61,6 +61,11 @@ void selinux_secmark_refcount_inc(void);
61 * existing SECMARK targets has been removed/flushed. 61 * existing SECMARK targets has been removed/flushed.
62 */ 62 */
63void selinux_secmark_refcount_dec(void); 63void selinux_secmark_refcount_dec(void);
64
65/**
66 * selinux_is_enabled - is SELinux enabled?
67 */
68bool selinux_is_enabled(void);
64#else 69#else
65 70
66static inline int selinux_string_to_sid(const char *str, u32 *sid) 71static inline int selinux_string_to_sid(const char *str, u32 *sid)
@@ -84,6 +89,10 @@ static inline void selinux_secmark_refcount_dec(void)
84 return; 89 return;
85} 90}
86 91
92static inline bool selinux_is_enabled(void)
93{
94 return false;
95}
87#endif /* CONFIG_SECURITY_SELINUX */ 96#endif /* CONFIG_SECURITY_SELINUX */
88 97
89#endif /* _LINUX_SELINUX_H */ 98#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 0c6a86b79596..8366d8f12e53 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -35,6 +35,44 @@ struct seq_operations {
35 35
36#define SEQ_SKIP 1 36#define SEQ_SKIP 1
37 37
38/**
39 * seq_get_buf - get buffer to write arbitrary data to
40 * @m: the seq_file handle
41 * @bufp: the beginning of the buffer is stored here
42 *
43 * Return the number of bytes available in the buffer, or zero if
44 * there's no space.
45 */
46static inline size_t seq_get_buf(struct seq_file *m, char **bufp)
47{
48 BUG_ON(m->count > m->size);
49 if (m->count < m->size)
50 *bufp = m->buf + m->count;
51 else
52 *bufp = NULL;
53
54 return m->size - m->count;
55}
56
57/**
58 * seq_commit - commit data to the buffer
59 * @m: the seq_file handle
60 * @num: the number of bytes to commit
61 *
62 * Commit @num bytes of data written to a buffer previously acquired
63 * by seq_buf_get. To signal an error condition, or that the data
64 * didn't fit in the available space, pass a negative @num value.
65 */
66static inline void seq_commit(struct seq_file *m, int num)
67{
68 if (num < 0) {
69 m->count = m->size;
70 } else {
71 BUG_ON(m->count + num > m->size);
72 m->count += num;
73 }
74}
75
38char *mangle_path(char *s, char *p, char *esc); 76char *mangle_path(char *s, char *p, char *esc);
39int seq_open(struct file *, const struct seq_operations *); 77int seq_open(struct file *, const struct seq_operations *);
40ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 78ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
diff --git a/include/linux/serial.h b/include/linux/serial.h
index e5bb75a63802..c8613c3ff9d3 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -122,6 +122,7 @@ struct serial_uart_config {
122 122
123/* Internal flags used only by kernel */ 123/* Internal flags used only by kernel */
124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ 124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
125#define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
125#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ 126#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
126#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ 127#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
127#define ASYNCB_CLOSING 27 /* Serial port is closing */ 128#define ASYNCB_CLOSING 27 /* Serial port is closing */
@@ -133,6 +134,7 @@ struct serial_uart_config {
133#define ASYNCB_FIRST_KERNEL 22 134#define ASYNCB_FIRST_KERNEL 22
134 135
135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
137#define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED)
136#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) 138#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
137#define ASYNC_SAK (1U << ASYNCB_SAK) 139#define ASYNC_SAK (1U << ASYNCB_SAK)
138#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) 140#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index d4d2a78ad43e..fb46aba11fb5 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
22 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
23 resource_size_t mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned long irqflags; /* request_irq flags */
25 unsigned int uartclk; /* UART clock rate */ 26 unsigned int uartclk; /* UART clock rate */
26 void *private_data; 27 void *private_data;
27 unsigned char regshift; /* register shift */ 28 unsigned char regshift; /* register shift */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 23d2fb051f97..db532ce288be 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -20,6 +20,8 @@
20#ifndef LINUX_SERIAL_CORE_H 20#ifndef LINUX_SERIAL_CORE_H
21#define LINUX_SERIAL_CORE_H 21#define LINUX_SERIAL_CORE_H
22 22
23#include <linux/serial.h>
24
23/* 25/*
24 * The type definitions. These are from Ted Ts'o's serial.h 26 * The type definitions. These are from Ted Ts'o's serial.h
25 */ 27 */
@@ -174,6 +176,9 @@
174/* Qualcomm MSM SoCs */ 176/* Qualcomm MSM SoCs */
175#define PORT_MSM 88 177#define PORT_MSM 88
176 178
179/* BCM63xx family SoCs */
180#define PORT_BCM63XX 89
181
177#ifdef __KERNEL__ 182#ifdef __KERNEL__
178 183
179#include <linux/compiler.h> 184#include <linux/compiler.h>
@@ -186,7 +191,6 @@
186#include <linux/sysrq.h> 191#include <linux/sysrq.h>
187 192
188struct uart_port; 193struct uart_port;
189struct uart_info;
190struct serial_struct; 194struct serial_struct;
191struct device; 195struct device;
192 196
@@ -265,6 +269,7 @@ struct uart_port {
265 unsigned int (*serial_in)(struct uart_port *, int); 269 unsigned int (*serial_in)(struct uart_port *, int);
266 void (*serial_out)(struct uart_port *, int, int); 270 void (*serial_out)(struct uart_port *, int, int);
267 unsigned int irq; /* irq number */ 271 unsigned int irq; /* irq number */
272 unsigned long irqflags; /* irq flags */
268 unsigned int uartclk; /* base uart clock */ 273 unsigned int uartclk; /* base uart clock */
269 unsigned int fifosize; /* tx fifo size */ 274 unsigned int fifosize; /* tx fifo size */
270 unsigned char x_char; /* xon/xoff char */ 275 unsigned char x_char; /* xon/xoff char */
@@ -283,7 +288,7 @@ struct uart_port {
283 288
284 unsigned int read_status_mask; /* driver specific */ 289 unsigned int read_status_mask; /* driver specific */
285 unsigned int ignore_status_mask; /* driver specific */ 290 unsigned int ignore_status_mask; /* driver specific */
286 struct uart_info *info; /* pointer to parent info */ 291 struct uart_state *state; /* pointer to parent state */
287 struct uart_icount icount; /* statistics */ 292 struct uart_icount icount; /* statistics */
288 293
289 struct console *cons; /* struct console, if any */ 294 struct console *cons; /* struct console, if any */
@@ -335,52 +340,16 @@ struct uart_port {
335}; 340};
336 341
337/* 342/*
338 * This is the state information which is only valid when the port
339 * is open; it may be cleared the core driver once the device has
340 * been closed. Either the low level driver or the core can modify
341 * stuff here.
342 */
343typedef unsigned int __bitwise__ uif_t;
344
345struct uart_info {
346 struct tty_port port;
347 struct circ_buf xmit;
348 uif_t flags;
349
350/*
351 * Definitions for info->flags. These are _private_ to serial_core, and
352 * are specific to this structure. They may be queried by low level drivers.
353 *
354 * FIXME: use the ASY_ definitions
355 */
356#define UIF_CHECK_CD ((__force uif_t) (1 << 25))
357#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
358#define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29))
359#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
360#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
361
362 struct tasklet_struct tlet;
363 wait_queue_head_t delta_msr_wait;
364};
365
366/*
367 * This is the state information which is persistent across opens. 343 * This is the state information which is persistent across opens.
368 * The low level driver must not to touch any elements contained
369 * within.
370 */ 344 */
371struct uart_state { 345struct uart_state {
372 unsigned int close_delay; /* msec */ 346 struct tty_port port;
373 unsigned int closing_wait; /* msec */
374
375#define USF_CLOSING_WAIT_INF (0)
376#define USF_CLOSING_WAIT_NONE (~0U)
377 347
378 int count;
379 int pm_state; 348 int pm_state;
380 struct uart_info info; 349 struct circ_buf xmit;
381 struct uart_port *port;
382 350
383 struct mutex mutex; 351 struct tasklet_struct tlet;
352 struct uart_port *uart_port;
384}; 353};
385 354
386#define UART_XMIT_SIZE PAGE_SIZE 355#define UART_XMIT_SIZE PAGE_SIZE
@@ -461,7 +430,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
461 430
462static inline int uart_tx_stopped(struct uart_port *port) 431static inline int uart_tx_stopped(struct uart_port *port)
463{ 432{
464 struct tty_struct *tty = port->info->port.tty; 433 struct tty_struct *tty = port->state->port.tty;
465 if(tty->stopped || tty->hw_stopped) 434 if(tty->stopped || tty->hw_stopped)
466 return 1; 435 return 1;
467 return 0; 436 return 0;
@@ -476,7 +445,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
476#ifdef SUPPORT_SYSRQ 445#ifdef SUPPORT_SYSRQ
477 if (port->sysrq) { 446 if (port->sysrq) {
478 if (ch && time_before(jiffies, port->sysrq)) { 447 if (ch && time_before(jiffies, port->sysrq)) {
479 handle_sysrq(ch, port->info->port.tty); 448 handle_sysrq(ch, port->state->port.tty);
480 port->sysrq = 0; 449 port->sysrq = 0;
481 return 1; 450 return 1;
482 } 451 }
@@ -494,7 +463,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
494 */ 463 */
495static inline int uart_handle_break(struct uart_port *port) 464static inline int uart_handle_break(struct uart_port *port)
496{ 465{
497 struct uart_info *info = port->info; 466 struct uart_state *state = port->state;
498#ifdef SUPPORT_SYSRQ 467#ifdef SUPPORT_SYSRQ
499 if (port->cons && port->cons->index == port->line) { 468 if (port->cons && port->cons->index == port->line) {
500 if (!port->sysrq) { 469 if (!port->sysrq) {
@@ -505,59 +474,60 @@ static inline int uart_handle_break(struct uart_port *port)
505 } 474 }
506#endif 475#endif
507 if (port->flags & UPF_SAK) 476 if (port->flags & UPF_SAK)
508 do_SAK(info->port.tty); 477 do_SAK(state->port.tty);
509 return 0; 478 return 0;
510} 479}
511 480
512/** 481/**
513 * uart_handle_dcd_change - handle a change of carrier detect state 482 * uart_handle_dcd_change - handle a change of carrier detect state
514 * @port: uart_port structure for the open port 483 * @uport: uart_port structure for the open port
515 * @status: new carrier detect status, nonzero if active 484 * @status: new carrier detect status, nonzero if active
516 */ 485 */
517static inline void 486static inline void
518uart_handle_dcd_change(struct uart_port *port, unsigned int status) 487uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
519{ 488{
520 struct uart_info *info = port->info; 489 struct uart_state *state = uport->state;
490 struct tty_port *port = &state->port;
521 491
522 port->icount.dcd++; 492 uport->icount.dcd++;
523 493
524#ifdef CONFIG_HARD_PPS 494#ifdef CONFIG_HARD_PPS
525 if ((port->flags & UPF_HARDPPS_CD) && status) 495 if ((uport->flags & UPF_HARDPPS_CD) && status)
526 hardpps(); 496 hardpps();
527#endif 497#endif
528 498
529 if (info->flags & UIF_CHECK_CD) { 499 if (port->flags & ASYNC_CHECK_CD) {
530 if (status) 500 if (status)
531 wake_up_interruptible(&info->port.open_wait); 501 wake_up_interruptible(&port->open_wait);
532 else if (info->port.tty) 502 else if (port->tty)
533 tty_hangup(info->port.tty); 503 tty_hangup(port->tty);
534 } 504 }
535} 505}
536 506
537/** 507/**
538 * uart_handle_cts_change - handle a change of clear-to-send state 508 * uart_handle_cts_change - handle a change of clear-to-send state
539 * @port: uart_port structure for the open port 509 * @uport: uart_port structure for the open port
540 * @status: new clear to send status, nonzero if active 510 * @status: new clear to send status, nonzero if active
541 */ 511 */
542static inline void 512static inline void
543uart_handle_cts_change(struct uart_port *port, unsigned int status) 513uart_handle_cts_change(struct uart_port *uport, unsigned int status)
544{ 514{
545 struct uart_info *info = port->info; 515 struct tty_port *port = &uport->state->port;
546 struct tty_struct *tty = info->port.tty; 516 struct tty_struct *tty = port->tty;
547 517
548 port->icount.cts++; 518 uport->icount.cts++;
549 519
550 if (info->flags & UIF_CTS_FLOW) { 520 if (port->flags & ASYNC_CTS_FLOW) {
551 if (tty->hw_stopped) { 521 if (tty->hw_stopped) {
552 if (status) { 522 if (status) {
553 tty->hw_stopped = 0; 523 tty->hw_stopped = 0;
554 port->ops->start_tx(port); 524 uport->ops->start_tx(uport);
555 uart_write_wakeup(port); 525 uart_write_wakeup(uport);
556 } 526 }
557 } else { 527 } else {
558 if (!status) { 528 if (!status) {
559 tty->hw_stopped = 1; 529 tty->hw_stopped = 1;
560 port->ops->stop_tx(port); 530 uport->ops->stop_tx(uport);
561 } 531 }
562 } 532 }
563 } 533 }
@@ -569,7 +539,7 @@ static inline void
569uart_insert_char(struct uart_port *port, unsigned int status, 539uart_insert_char(struct uart_port *port, unsigned int status,
570 unsigned int overrun, unsigned int ch, unsigned int flag) 540 unsigned int overrun, unsigned int ch, unsigned int flag)
571{ 541{
572 struct tty_struct *tty = port->info->port.tty; 542 struct tty_struct *tty = port->state->port.tty;
573 543
574 if ((status & port->ignore_status_mask & ~overrun) == 0) 544 if ((status & port->ignore_status_mask & ~overrun) == 0)
575 tty_insert_flip_char(tty, ch, flag); 545 tty_insert_flip_char(tty, ch, flag);
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 126d24c9eaa8..a640bc2afe76 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -31,8 +31,6 @@ struct serio {
31 31
32 bool manual_bind; 32 bool manual_bind;
33 bool registered; /* port has been fully registered with driver core */ 33 bool registered; /* port has been fully registered with driver core */
34 bool suspended; /* port is suspended */
35
36 34
37 struct serio_device_id id; 35 struct serio_device_id id;
38 36
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
new file mode 100644
index 000000000000..9a6f7607174e
--- /dev/null
+++ b/include/linux/sfi.h
@@ -0,0 +1,206 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H
61
62/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ"
65#define SFI_SIG_IDLE "IDLE"
66#define SFI_SIG_CPUS "CPUS"
67#define SFI_SIG_MTMR "MTMR"
68#define SFI_SIG_MRTC "MRTC"
69#define SFI_SIG_MMAP "MMAP"
70#define SFI_SIG_APIC "APIC"
71#define SFI_SIG_XSDT "XSDT"
72#define SFI_SIG_WAKE "WAKE"
73#define SFI_SIG_SPIB "SPIB"
74#define SFI_SIG_I2CB "I2CB"
75#define SFI_SIG_GPEM "GPEM"
76
77#define SFI_SIGNATURE_SIZE 4
78#define SFI_OEM_ID_SIZE 6
79#define SFI_OEM_TABLE_ID_SIZE 8
80
81#define SFI_SYST_SEARCH_BEGIN 0x000E0000
82#define SFI_SYST_SEARCH_END 0x000FFFFF
83
84#define SFI_GET_NUM_ENTRIES(ptable, entry_type) \
85 ((ptable->header.len - sizeof(struct sfi_table_header)) / \
86 (sizeof(entry_type)))
87/*
88 * Table structures must be byte-packed to match the SFI specification,
89 * as they are provided by the BIOS.
90 */
91struct sfi_table_header {
92 char sig[SFI_SIGNATURE_SIZE];
93 u32 len;
94 u8 rev;
95 u8 csum;
96 char oem_id[SFI_OEM_ID_SIZE];
97 char oem_table_id[SFI_OEM_TABLE_ID_SIZE];
98} __packed;
99
100struct sfi_table_simple {
101 struct sfi_table_header header;
102 u64 pentry[1];
103} __packed;
104
105/* Comply with UEFI spec 2.1 */
106struct sfi_mem_entry {
107 u32 type;
108 u64 phys_start;
109 u64 virt_start;
110 u64 pages;
111 u64 attrib;
112} __packed;
113
114struct sfi_cpu_table_entry {
115 u32 apic_id;
116} __packed;
117
118struct sfi_cstate_table_entry {
119 u32 hint; /* MWAIT hint */
120 u32 latency; /* latency in ms */
121} __packed;
122
123struct sfi_apic_table_entry {
124 u64 phys_addr; /* phy base addr for APIC reg */
125} __packed;
126
127struct sfi_freq_table_entry {
128 u32 freq_mhz; /* in MHZ */
129 u32 latency; /* transition latency in ms */
130 u32 ctrl_val; /* value to write to PERF_CTL */
131} __packed;
132
133struct sfi_wake_table_entry {
134 u64 phys_addr; /* pointer to where the wake vector locates */
135} __packed;
136
137struct sfi_timer_table_entry {
138 u64 phys_addr; /* phy base addr for the timer */
139 u32 freq_hz; /* in HZ */
140 u32 irq;
141} __packed;
142
143struct sfi_rtc_table_entry {
144 u64 phys_addr; /* phy base addr for the RTC */
145 u32 irq;
146} __packed;
147
148struct sfi_spi_table_entry {
149 u16 host_num; /* attached to host 0, 1...*/
150 u16 cs; /* chip select */
151 u16 irq_info;
152 char name[16];
153 u8 dev_info[10];
154} __packed;
155
156struct sfi_i2c_table_entry {
157 u16 host_num;
158 u16 addr; /* slave addr */
159 u16 irq_info;
160 char name[16];
161 u8 dev_info[10];
162} __packed;
163
164struct sfi_gpe_table_entry {
165 u16 logical_id; /* logical id */
166 u16 phys_id; /* physical GPE id */
167} __packed;
168
169
170typedef int (*sfi_table_handler) (struct sfi_table_header *table);
171
172#ifdef CONFIG_SFI
173extern void __init sfi_init(void);
174extern int __init sfi_platform_init(void);
175extern void __init sfi_init_late(void);
176extern int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id,
177 sfi_table_handler handler);
178
179extern int sfi_disabled;
180static inline void disable_sfi(void)
181{
182 sfi_disabled = 1;
183}
184
185#else /* !CONFIG_SFI */
186
187static inline void sfi_init(void)
188{
189}
190
191static inline void sfi_init_late(void)
192{
193}
194
195#define sfi_disabled 0
196
197static inline int sfi_table_parse(char *signature, char *oem_id,
198 char *oem_table_id,
199 sfi_table_handler handler)
200{
201 return -1;
202}
203
204#endif /* !CONFIG_SFI */
205
206#endif /*_LINUX_SFI_H*/
diff --git a/include/linux/sfi_acpi.h b/include/linux/sfi_acpi.h
new file mode 100644
index 000000000000..c4a5a8cd4469
--- /dev/null
+++ b/include/linux/sfi_acpi.h
@@ -0,0 +1,93 @@
1/* sfi.h Simple Firmware Interface */
2
3/*
4
5 This file is provided under a dual BSD/GPLv2 license. When using or
6 redistributing this file, you may do so under either license.
7
8 GPL LICENSE SUMMARY
9
10 Copyright(c) 2009 Intel Corporation. All rights reserved.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of version 2 of the GNU General Public License as
14 published by the Free Software Foundation.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 The full GNU General Public License is included in this distribution
25 in the file called LICENSE.GPL.
26
27 BSD LICENSE
28
29 Copyright(c) 2009 Intel Corporation. All rights reserved.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34
35 * Redistributions of source code must retain the above copyright
36 notice, this list of conditions and the following disclaimer.
37 * Redistributions in binary form must reproduce the above copyright
38 notice, this list of conditions and the following disclaimer in
39 the documentation and/or other materials provided with the
40 distribution.
41 * Neither the name of Intel Corporation nor the names of its
42 contributors may be used to endorse or promote products derived
43 from this software without specific prior written permission.
44
45 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
47 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
48 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
49 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
57*/
58
59#ifndef _LINUX_SFI_ACPI_H
60#define _LINUX_SFI_ACPI_H
61
62#ifdef CONFIG_SFI
63#include <acpi/acpi.h> /* struct acpi_table_header */
64
65extern int sfi_acpi_table_parse(char *signature, char *oem_id,
66 char *oem_table_id,
67 int (*handler)(struct acpi_table_header *));
68
69static inline int acpi_sfi_table_parse(char *signature,
70 int (*handler)(struct acpi_table_header *))
71{
72 if (!acpi_table_parse(signature, handler))
73 return 0;
74
75 return sfi_acpi_table_parse(signature, NULL, NULL, handler);
76}
77#else /* !CONFIG_SFI */
78
79static inline int sfi_acpi_table_parse(char *signature, char *oem_id,
80 char *oem_table_id,
81 int (*handler)(struct acpi_table_header *))
82{
83 return -1;
84}
85
86static inline int acpi_sfi_table_parse(char *signature,
87 int (*handler)(struct acpi_table_header *))
88{
89 return acpi_table_parse(signature, handler);
90}
91#endif /* !CONFIG_SFI */
92
93#endif /*_LINUX_SFI_ACPI_H*/
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index eb1423a0078d..68e212ff9dde 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -85,7 +85,6 @@ struct intc_desc symbol __initdata = { \
85} 85}
86#endif 86#endif
87 87
88unsigned int intc_evt2irq(unsigned int vector);
89void __init register_intc_controller(struct intc_desc *desc); 88void __init register_intc_controller(struct intc_desc *desc);
90int intc_set_priority(unsigned int irq, unsigned int prio); 89int intc_set_priority(unsigned int irq, unsigned int prio);
91 90
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index abff6c9b413c..deee7afd8d66 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -38,8 +38,11 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
38 return container_of(inode, struct shmem_inode_info, vfs_inode); 38 return container_of(inode, struct shmem_inode_info, vfs_inode);
39} 39}
40 40
41extern int init_tmpfs(void);
42extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
43
41#ifdef CONFIG_TMPFS_POSIX_ACL 44#ifdef CONFIG_TMPFS_POSIX_ACL
42int shmem_permission(struct inode *, int); 45int shmem_check_acl(struct inode *, int);
43int shmem_acl_init(struct inode *, struct inode *); 46int shmem_acl_init(struct inode *, struct inode *);
44 47
45extern struct xattr_handler shmem_xattr_acl_access_handler; 48extern struct xattr_handler shmem_xattr_acl_access_handler;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index c7552836bd95..ab9272cc270c 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -233,6 +233,8 @@ static inline int valid_signal(unsigned long sig)
233} 233}
234 234
235extern int next_signal(struct sigpending *pending, sigset_t *mask); 235extern int next_signal(struct sigpending *pending, sigset_t *mask);
236extern int do_send_sig_info(int sig, struct siginfo *info,
237 struct task_struct *p, bool group);
236extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 238extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 239extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
238extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, 240extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f2c69a2cca17..bcdd6606f468 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -304,7 +304,6 @@ typedef unsigned char *sk_buff_data_t;
304 * @tc_index: Traffic control index 304 * @tc_index: Traffic control index
305 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
306 * @ndisc_nodetype: router type (from link layer) 306 * @ndisc_nodetype: router type (from link layer)
307 * @do_not_encrypt: set to prevent encryption of this frame
308 * @dma_cookie: a cookie to one of several possible DMA operations 307 * @dma_cookie: a cookie to one of several possible DMA operations
309 * done by skb DMA functions 308 * done by skb DMA functions
310 * @secmark: security marking 309 * @secmark: security marking
@@ -355,8 +354,8 @@ struct sk_buff {
355 ipvs_property:1, 354 ipvs_property:1,
356 peeked:1, 355 peeked:1,
357 nf_trace:1; 356 nf_trace:1;
357 __be16 protocol:16;
358 kmemcheck_bitfield_end(flags1); 358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol;
360 359
361 void (*destructor)(struct sk_buff *skb); 360 void (*destructor)(struct sk_buff *skb);
362#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 361#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -368,7 +367,6 @@ struct sk_buff {
368#endif 367#endif
369 368
370 int iif; 369 int iif;
371 __u16 queue_mapping;
372#ifdef CONFIG_NET_SCHED 370#ifdef CONFIG_NET_SCHED
373 __u16 tc_index; /* traffic control index */ 371 __u16 tc_index; /* traffic control index */
374#ifdef CONFIG_NET_CLS_ACT 372#ifdef CONFIG_NET_CLS_ACT
@@ -377,15 +375,13 @@ struct sk_buff {
377#endif 375#endif
378 376
379 kmemcheck_bitfield_begin(flags2); 377 kmemcheck_bitfield_begin(flags2);
378 __u16 queue_mapping:16;
380#ifdef CONFIG_IPV6_NDISC_NODETYPE 379#ifdef CONFIG_IPV6_NDISC_NODETYPE
381 __u8 ndisc_nodetype:2; 380 __u8 ndisc_nodetype:2;
382#endif 381#endif
383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
384 __u8 do_not_encrypt:1;
385#endif
386 kmemcheck_bitfield_end(flags2); 382 kmemcheck_bitfield_end(flags2);
387 383
388 /* 0/13/14 bit hole */ 384 /* 0/14 bit hole */
389 385
390#ifdef CONFIG_NET_DMA 386#ifdef CONFIG_NET_DMA
391 dma_cookie_t dma_cookie; 387 dma_cookie_t dma_cookie;
@@ -1761,6 +1757,8 @@ extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1761 int to_offset, 1757 int to_offset,
1762 int size); 1758 int size);
1763extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1759extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1760extern void skb_free_datagram_locked(struct sock *sk,
1761 struct sk_buff *skb);
1764extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1762extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1765 unsigned int flags); 1763 unsigned int flags);
1766extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 1764extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index bb5368df4be8..0ec00b39d006 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -34,9 +34,4 @@ static __always_inline void *__kmalloc(size_t size, gfp_t flags)
34 return kmalloc(size, flags); 34 return kmalloc(size, flags);
35} 35}
36 36
37static inline void kmem_cache_init_late(void)
38{
39 /* Nothing to do */
40}
41
42#endif /* __LINUX_SLOB_DEF_H */ 37#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
index b65c8881f07a..13337bf6c3f5 100644
--- a/include/linux/slow-work.h
+++ b/include/linux/slow-work.h
@@ -17,13 +17,20 @@
17#ifdef CONFIG_SLOW_WORK 17#ifdef CONFIG_SLOW_WORK
18 18
19#include <linux/sysctl.h> 19#include <linux/sysctl.h>
20#include <linux/timer.h>
20 21
21struct slow_work; 22struct slow_work;
23#ifdef CONFIG_SLOW_WORK_DEBUG
24struct seq_file;
25#endif
22 26
23/* 27/*
24 * The operations used to support slow work items 28 * The operations used to support slow work items
25 */ 29 */
26struct slow_work_ops { 30struct slow_work_ops {
31 /* owner */
32 struct module *owner;
33
27 /* get a ref on a work item 34 /* get a ref on a work item
28 * - return 0 if successful, -ve if not 35 * - return 0 if successful, -ve if not
29 */ 36 */
@@ -34,6 +41,11 @@ struct slow_work_ops {
34 41
35 /* execute a work item */ 42 /* execute a work item */
36 void (*execute)(struct slow_work *work); 43 void (*execute)(struct slow_work *work);
44
45#ifdef CONFIG_SLOW_WORK_DEBUG
46 /* describe a work item for debugfs */
47 void (*desc)(struct slow_work *work, struct seq_file *m);
48#endif
37}; 49};
38 50
39/* 51/*
@@ -42,13 +54,24 @@ struct slow_work_ops {
42 * queued 54 * queued
43 */ 55 */
44struct slow_work { 56struct slow_work {
57 struct module *owner; /* the owning module */
45 unsigned long flags; 58 unsigned long flags;
46#define SLOW_WORK_PENDING 0 /* item pending (further) execution */ 59#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
47#define SLOW_WORK_EXECUTING 1 /* item currently executing */ 60#define SLOW_WORK_EXECUTING 1 /* item currently executing */
48#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */ 61#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
49#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */ 62#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
63#define SLOW_WORK_CANCELLING 4 /* item is being cancelled, don't enqueue */
64#define SLOW_WORK_DELAYED 5 /* item is struct delayed_slow_work with active timer */
50 const struct slow_work_ops *ops; /* operations table for this item */ 65 const struct slow_work_ops *ops; /* operations table for this item */
51 struct list_head link; /* link in queue */ 66 struct list_head link; /* link in queue */
67#ifdef CONFIG_SLOW_WORK_DEBUG
68 struct timespec mark; /* jiffies at which queued or exec begun */
69#endif
70};
71
72struct delayed_slow_work {
73 struct slow_work work;
74 struct timer_list timer;
52}; 75};
53 76
54/** 77/**
@@ -67,6 +90,20 @@ static inline void slow_work_init(struct slow_work *work,
67} 90}
68 91
69/** 92/**
93 * slow_work_init - Initialise a delayed slow work item
94 * @work: The work item to initialise
95 * @ops: The operations to use to handle the slow work item
96 *
97 * Initialise a delayed slow work item.
98 */
99static inline void delayed_slow_work_init(struct delayed_slow_work *dwork,
100 const struct slow_work_ops *ops)
101{
102 init_timer(&dwork->timer);
103 slow_work_init(&dwork->work, ops);
104}
105
106/**
70 * vslow_work_init - Initialise a very slow work item 107 * vslow_work_init - Initialise a very slow work item
71 * @work: The work item to initialise 108 * @work: The work item to initialise
72 * @ops: The operations to use to handle the slow work item 109 * @ops: The operations to use to handle the slow work item
@@ -83,9 +120,40 @@ static inline void vslow_work_init(struct slow_work *work,
83 INIT_LIST_HEAD(&work->link); 120 INIT_LIST_HEAD(&work->link);
84} 121}
85 122
123/**
124 * slow_work_is_queued - Determine if a slow work item is on the work queue
125 * work: The work item to test
126 *
127 * Determine if the specified slow-work item is on the work queue. This
128 * returns true if it is actually on the queue.
129 *
130 * If the item is executing and has been marked for requeue when execution
131 * finishes, then false will be returned.
132 *
133 * Anyone wishing to wait for completion of execution can wait on the
134 * SLOW_WORK_EXECUTING bit.
135 */
136static inline bool slow_work_is_queued(struct slow_work *work)
137{
138 unsigned long flags = work->flags;
139 return flags & SLOW_WORK_PENDING && !(flags & SLOW_WORK_EXECUTING);
140}
141
86extern int slow_work_enqueue(struct slow_work *work); 142extern int slow_work_enqueue(struct slow_work *work);
87extern int slow_work_register_user(void); 143extern void slow_work_cancel(struct slow_work *work);
88extern void slow_work_unregister_user(void); 144extern int slow_work_register_user(struct module *owner);
145extern void slow_work_unregister_user(struct module *owner);
146
147extern int delayed_slow_work_enqueue(struct delayed_slow_work *dwork,
148 unsigned long delay);
149
150static inline void delayed_slow_work_cancel(struct delayed_slow_work *dwork)
151{
152 slow_work_cancel(&dwork->work);
153}
154
155extern bool slow_work_sleep_till_thread_needed(struct slow_work *work,
156 signed long *_timeout);
89 157
90#ifdef CONFIG_SYSCTL 158#ifdef CONFIG_SYSCTL
91extern ctl_table slow_work_sysctls[]; 159extern ctl_table slow_work_sysctls[];
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index c1c862b1d01a..5ad70a60fd74 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -153,12 +153,10 @@ static __always_inline int kmalloc_index(size_t size)
153 if (size <= KMALLOC_MIN_SIZE) 153 if (size <= KMALLOC_MIN_SIZE)
154 return KMALLOC_SHIFT_LOW; 154 return KMALLOC_SHIFT_LOW;
155 155
156#if KMALLOC_MIN_SIZE <= 64 156 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96)
157 if (size > 64 && size <= 96)
158 return 1; 157 return 1;
159 if (size > 128 && size <= 192) 158 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192)
160 return 2; 159 return 2;
161#endif
162 if (size <= 8) return 3; 160 if (size <= 8) return 3;
163 if (size <= 16) return 4; 161 if (size <= 16) return 4;
164 if (size <= 32) return 5; 162 if (size <= 32) return 5;
@@ -304,6 +302,4 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
304} 302}
305#endif 303#endif
306 304
307void __init kmem_cache_init_late(void);
308
309#endif /* _LINUX_SLUB_DEF_H */ 305#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 9e3d8af09207..39c64bae776d 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -73,15 +73,6 @@ int smp_call_function(void(*func)(void *info), void *info, int wait);
73void smp_call_function_many(const struct cpumask *mask, 73void smp_call_function_many(const struct cpumask *mask,
74 void (*func)(void *info), void *info, bool wait); 74 void (*func)(void *info), void *info, bool wait);
75 75
76/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */
77static inline int
78smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
79 int wait)
80{
81 smp_call_function_many(&mask, func, info, wait);
82 return 0;
83}
84
85void __smp_call_function_single(int cpuid, struct call_single_data *data, 76void __smp_call_function_single(int cpuid, struct call_single_data *data,
86 int wait); 77 int wait);
87 78
@@ -144,8 +135,6 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
144static inline void smp_send_reschedule(int cpu) { } 135static inline void smp_send_reschedule(int cpu) { }
145#define num_booting_cpus() 1 136#define num_booting_cpus() 1
146#define smp_prepare_boot_cpu() do {} while (0) 137#define smp_prepare_boot_cpu() do {} while (0)
147#define smp_call_function_mask(mask, func, info, wait) \
148 (up_smp_call_function(func, info))
149#define smp_call_function_many(mask, func, info, wait) \ 138#define smp_call_function_many(mask, func, info, wait) \
150 (up_smp_call_function(func, info)) 139 (up_smp_call_function(func, info))
151static inline void init_call_single_data(void) 140static inline void init_call_single_data(void)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 3b461dffe244..3273a0c5043b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
16 /* _SS_MAXSIZE value minus size of ss_family */ 16 /* _SS_MAXSIZE value minus size of ss_family */
17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ 17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
18 18
19#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) 19#ifdef __KERNEL__
20 20
21#include <asm/socket.h> /* arch-dependent defines */ 21#include <asm/socket.h> /* arch-dependent defines */
22#include <linux/sockios.h> /* the SIOCxxx I/O controls */ 22#include <linux/sockios.h> /* the SIOCxxx I/O controls */
@@ -101,21 +101,6 @@ struct cmsghdr {
101 ((char *)(cmsg) - (char *)(mhdr)->msg_control))) 101 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
102 102
103/* 103/*
104 * This mess will go away with glibc
105 */
106
107#ifdef __KERNEL__
108#define __KINLINE static inline
109#elif defined(__GNUC__)
110#define __KINLINE static __inline__
111#elif defined(__cplusplus)
112#define __KINLINE static inline
113#else
114#define __KINLINE static
115#endif
116
117
118/*
119 * Get the next cmsg header 104 * Get the next cmsg header
120 * 105 *
121 * PLEASE, do not touch this function. If you think, that it is 106 * PLEASE, do not touch this function. If you think, that it is
@@ -128,7 +113,7 @@ struct cmsghdr {
128 * ancillary object DATA. --ANK (980731) 113 * ancillary object DATA. --ANK (980731)
129 */ 114 */
130 115
131__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, 116static inline struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
132 struct cmsghdr *__cmsg) 117 struct cmsghdr *__cmsg)
133{ 118{
134 struct cmsghdr * __ptr; 119 struct cmsghdr * __ptr;
@@ -140,7 +125,7 @@ __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
140 return __ptr; 125 return __ptr;
141} 126}
142 127
143__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) 128static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
144{ 129{
145 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 130 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
146} 131}
diff --git a/include/linux/spi/lms283gf05.h b/include/linux/spi/lms283gf05.h
new file mode 100644
index 000000000000..555d254e6606
--- /dev/null
+++ b/include/linux/spi/lms283gf05.h
@@ -0,0 +1,28 @@
1/*
2 * lms283gf05.h - Platform glue for Samsung LMS283GF05 LCD
3 *
4 * Copyright (C) 2009 Marek Vasut <marek.vasut@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 * 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 _INCLUDE_LINUX_SPI_LMS283GF05_H_
21#define _INCLUDE_LINUX_SPI_LMS283GF05_H_
22
23struct lms283gf05_pdata {
24 unsigned long reset_gpio;
25 bool reset_inverted;
26};
27
28#endif /* _INCLUDE_LINUX_SPI_LMS283GF05_H_ */
diff --git a/include/linux/spi/mc33880.h b/include/linux/spi/mc33880.h
new file mode 100644
index 000000000000..82ffccd6fbe5
--- /dev/null
+++ b/include/linux/spi/mc33880.h
@@ -0,0 +1,10 @@
1#ifndef LINUX_SPI_MC33880_H
2#define LINUX_SPI_MC33880_H
3
4struct mc33880_platform_data {
5 /* number assigned to the first GPIO */
6 unsigned base;
7};
8
9#endif
10
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4da97e..97b60b37f445 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
20#define __LINUX_SPI_H 20#define __LINUX_SPI_H
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h>
23 24
24/* 25/*
25 * INTERFACES between SPI master-side drivers and SPI infrastructure. 26 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
86 int irq; 87 int irq;
87 void *controller_state; 88 void *controller_state;
88 void *controller_data; 89 void *controller_data;
89 char modalias[32]; 90 char modalias[SPI_NAME_SIZE];
90 91
91 /* 92 /*
92 * likely need more hooks for more protocol options affecting how 93 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,7 @@ struct spi_message;
145 146
146/** 147/**
147 * struct spi_driver - Host side "protocol" driver 148 * struct spi_driver - Host side "protocol" driver
149 * @id_table: List of SPI devices supported by this driver
148 * @probe: Binds this driver to the spi device. Drivers can verify 150 * @probe: Binds this driver to the spi device. Drivers can verify
149 * that the device is actually present, and may need to configure 151 * that the device is actually present, and may need to configure
150 * characteristics (such as bits_per_word) which weren't needed for 152 * characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +172,7 @@ struct spi_message;
170 * MMC, RTC, filesystem character device nodes, and hardware monitoring. 172 * MMC, RTC, filesystem character device nodes, and hardware monitoring.
171 */ 173 */
172struct spi_driver { 174struct spi_driver {
175 const struct spi_device_id *id_table;
173 int (*probe)(struct spi_device *spi); 176 int (*probe)(struct spi_device *spi);
174 int (*remove)(struct spi_device *spi); 177 int (*remove)(struct spi_device *spi);
175 void (*shutdown)(struct spi_device *spi); 178 void (*shutdown)(struct spi_device *spi);
@@ -207,6 +210,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
207 * each slave has a chipselect signal, but it's common that not 210 * each slave has a chipselect signal, but it's common that not
208 * every chipselect is connected to a slave. 211 * every chipselect is connected to a slave.
209 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 212 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
213 * @mode_bits: flags understood by this controller driver
214 * @flags: other constraints relevant to this driver
210 * @setup: updates the device mode and clocking records used by a 215 * @setup: updates the device mode and clocking records used by a
211 * device's SPI controller; protocol code may call this. This 216 * device's SPI controller; protocol code may call this. This
212 * must fail if an unrecognized or unsupported mode is requested. 217 * must fail if an unrecognized or unsupported mode is requested.
@@ -253,6 +258,8 @@ struct spi_master {
253 /* other constraints relevant to this driver */ 258 /* other constraints relevant to this driver */
254 u16 flags; 259 u16 flags;
255#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 260#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
261#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
262#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
256 263
257 /* Setup mode and clock, etc (spi driver may call many times). 264 /* Setup mode and clock, etc (spi driver may call many times).
258 * 265 *
@@ -533,42 +540,7 @@ static inline void spi_message_free(struct spi_message *m)
533} 540}
534 541
535extern int spi_setup(struct spi_device *spi); 542extern int spi_setup(struct spi_device *spi);
536 543extern int spi_async(struct spi_device *spi, struct spi_message *message);
537/**
538 * spi_async - asynchronous SPI transfer
539 * @spi: device with which data will be exchanged
540 * @message: describes the data transfers, including completion callback
541 * Context: any (irqs may be blocked, etc)
542 *
543 * This call may be used in_irq and other contexts which can't sleep,
544 * as well as from task contexts which can sleep.
545 *
546 * The completion callback is invoked in a context which can't sleep.
547 * Before that invocation, the value of message->status is undefined.
548 * When the callback is issued, message->status holds either zero (to
549 * indicate complete success) or a negative error code. After that
550 * callback returns, the driver which issued the transfer request may
551 * deallocate the associated memory; it's no longer in use by any SPI
552 * core or controller driver code.
553 *
554 * Note that although all messages to a spi_device are handled in
555 * FIFO order, messages may go to different devices in other orders.
556 * Some device might be higher priority, or have various "hard" access
557 * time requirements, for example.
558 *
559 * On detection of any fault during the transfer, processing of
560 * the entire message is aborted, and the device is deselected.
561 * Until returning from the associated message completion callback,
562 * no other spi_message queued to that device will be processed.
563 * (This rule applies equally to all the synchronous transfer calls,
564 * which are wrappers around this core asynchronous primitive.)
565 */
566static inline int
567spi_async(struct spi_device *spi, struct spi_message *message)
568{
569 message->spi = spi;
570 return spi->master->transfer(spi, message);
571}
572 544
573/*---------------------------------------------------------------------------*/ 545/*---------------------------------------------------------------------------*/
574 546
@@ -732,7 +704,7 @@ struct spi_board_info {
732 * controller_data goes to spi_device.controller_data, 704 * controller_data goes to spi_device.controller_data,
733 * irq is copied too 705 * irq is copied too
734 */ 706 */
735 char modalias[32]; 707 char modalias[SPI_NAME_SIZE];
736 const void *platform_data; 708 const void *platform_data;
737 void *controller_data; 709 void *controller_data;
738 int irq; 710 int irq;
@@ -800,4 +772,7 @@ spi_unregister_device(struct spi_device *spi)
800 device_unregister(&spi->dev); 772 device_unregister(&spi->dev);
801} 773}
802 774
775extern const struct spi_device_id *
776spi_get_device_id(const struct spi_device *sdev);
777
803#endif /* __LINUX_SPI_H */ 778#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 4be57ab03478..f0ca7a7a1757 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -143,15 +143,6 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
143 */ 143 */
144#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) 144#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
145 145
146/*
147 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
148 */
149#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
150# include <linux/spinlock_api_smp.h>
151#else
152# include <linux/spinlock_api_up.h>
153#endif
154
155#ifdef CONFIG_DEBUG_SPINLOCK 146#ifdef CONFIG_DEBUG_SPINLOCK
156 extern void _raw_spin_lock(spinlock_t *lock); 147 extern void _raw_spin_lock(spinlock_t *lock);
157#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock) 148#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
@@ -268,50 +259,16 @@ static inline void smp_mb__after_lock(void) { smp_mb(); }
268 259
269#define spin_lock_irq(lock) _spin_lock_irq(lock) 260#define spin_lock_irq(lock) _spin_lock_irq(lock)
270#define spin_lock_bh(lock) _spin_lock_bh(lock) 261#define spin_lock_bh(lock) _spin_lock_bh(lock)
271
272#define read_lock_irq(lock) _read_lock_irq(lock) 262#define read_lock_irq(lock) _read_lock_irq(lock)
273#define read_lock_bh(lock) _read_lock_bh(lock) 263#define read_lock_bh(lock) _read_lock_bh(lock)
274
275#define write_lock_irq(lock) _write_lock_irq(lock) 264#define write_lock_irq(lock) _write_lock_irq(lock)
276#define write_lock_bh(lock) _write_lock_bh(lock) 265#define write_lock_bh(lock) _write_lock_bh(lock)
277 266#define spin_unlock(lock) _spin_unlock(lock)
278/* 267#define read_unlock(lock) _read_unlock(lock)
279 * We inline the unlock functions in the nondebug case: 268#define write_unlock(lock) _write_unlock(lock)
280 */ 269#define spin_unlock_irq(lock) _spin_unlock_irq(lock)
281#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || \ 270#define read_unlock_irq(lock) _read_unlock_irq(lock)
282 !defined(CONFIG_SMP) 271#define write_unlock_irq(lock) _write_unlock_irq(lock)
283# define spin_unlock(lock) _spin_unlock(lock)
284# define read_unlock(lock) _read_unlock(lock)
285# define write_unlock(lock) _write_unlock(lock)
286# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
287# define read_unlock_irq(lock) _read_unlock_irq(lock)
288# define write_unlock_irq(lock) _write_unlock_irq(lock)
289#else
290# define spin_unlock(lock) \
291 do {__raw_spin_unlock(&(lock)->raw_lock); __release(lock); } while (0)
292# define read_unlock(lock) \
293 do {__raw_read_unlock(&(lock)->raw_lock); __release(lock); } while (0)
294# define write_unlock(lock) \
295 do {__raw_write_unlock(&(lock)->raw_lock); __release(lock); } while (0)
296# define spin_unlock_irq(lock) \
297do { \
298 __raw_spin_unlock(&(lock)->raw_lock); \
299 __release(lock); \
300 local_irq_enable(); \
301} while (0)
302# define read_unlock_irq(lock) \
303do { \
304 __raw_read_unlock(&(lock)->raw_lock); \
305 __release(lock); \
306 local_irq_enable(); \
307} while (0)
308# define write_unlock_irq(lock) \
309do { \
310 __raw_write_unlock(&(lock)->raw_lock); \
311 __release(lock); \
312 local_irq_enable(); \
313} while (0)
314#endif
315 272
316#define spin_unlock_irqrestore(lock, flags) \ 273#define spin_unlock_irqrestore(lock, flags) \
317 do { \ 274 do { \
@@ -380,4 +337,13 @@ extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
380 */ 337 */
381#define spin_can_lock(lock) (!spin_is_locked(lock)) 338#define spin_can_lock(lock) (!spin_is_locked(lock))
382 339
340/*
341 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
342 */
343#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
344# include <linux/spinlock_api_smp.h>
345#else
346# include <linux/spinlock_api_up.h>
347#endif
348
383#endif /* __LINUX_SPINLOCK_H */ 349#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index d79845d034b5..7a7e18fc2415 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -60,4 +60,398 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
61 __releases(lock); 61 __releases(lock);
62 62
63/*
64 * We inline the unlock functions in the nondebug case:
65 */
66#if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT)
67#define __always_inline__spin_unlock
68#define __always_inline__read_unlock
69#define __always_inline__write_unlock
70#define __always_inline__spin_unlock_irq
71#define __always_inline__read_unlock_irq
72#define __always_inline__write_unlock_irq
73#endif
74
75#ifndef CONFIG_DEBUG_SPINLOCK
76#ifndef CONFIG_GENERIC_LOCKBREAK
77
78#ifdef __always_inline__spin_lock
79#define _spin_lock(lock) __spin_lock(lock)
80#endif
81
82#ifdef __always_inline__read_lock
83#define _read_lock(lock) __read_lock(lock)
84#endif
85
86#ifdef __always_inline__write_lock
87#define _write_lock(lock) __write_lock(lock)
88#endif
89
90#ifdef __always_inline__spin_lock_bh
91#define _spin_lock_bh(lock) __spin_lock_bh(lock)
92#endif
93
94#ifdef __always_inline__read_lock_bh
95#define _read_lock_bh(lock) __read_lock_bh(lock)
96#endif
97
98#ifdef __always_inline__write_lock_bh
99#define _write_lock_bh(lock) __write_lock_bh(lock)
100#endif
101
102#ifdef __always_inline__spin_lock_irq
103#define _spin_lock_irq(lock) __spin_lock_irq(lock)
104#endif
105
106#ifdef __always_inline__read_lock_irq
107#define _read_lock_irq(lock) __read_lock_irq(lock)
108#endif
109
110#ifdef __always_inline__write_lock_irq
111#define _write_lock_irq(lock) __write_lock_irq(lock)
112#endif
113
114#ifdef __always_inline__spin_lock_irqsave
115#define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock)
116#endif
117
118#ifdef __always_inline__read_lock_irqsave
119#define _read_lock_irqsave(lock) __read_lock_irqsave(lock)
120#endif
121
122#ifdef __always_inline__write_lock_irqsave
123#define _write_lock_irqsave(lock) __write_lock_irqsave(lock)
124#endif
125
126#endif /* !CONFIG_GENERIC_LOCKBREAK */
127
128#ifdef __always_inline__spin_trylock
129#define _spin_trylock(lock) __spin_trylock(lock)
130#endif
131
132#ifdef __always_inline__read_trylock
133#define _read_trylock(lock) __read_trylock(lock)
134#endif
135
136#ifdef __always_inline__write_trylock
137#define _write_trylock(lock) __write_trylock(lock)
138#endif
139
140#ifdef __always_inline__spin_trylock_bh
141#define _spin_trylock_bh(lock) __spin_trylock_bh(lock)
142#endif
143
144#ifdef __always_inline__spin_unlock
145#define _spin_unlock(lock) __spin_unlock(lock)
146#endif
147
148#ifdef __always_inline__read_unlock
149#define _read_unlock(lock) __read_unlock(lock)
150#endif
151
152#ifdef __always_inline__write_unlock
153#define _write_unlock(lock) __write_unlock(lock)
154#endif
155
156#ifdef __always_inline__spin_unlock_bh
157#define _spin_unlock_bh(lock) __spin_unlock_bh(lock)
158#endif
159
160#ifdef __always_inline__read_unlock_bh
161#define _read_unlock_bh(lock) __read_unlock_bh(lock)
162#endif
163
164#ifdef __always_inline__write_unlock_bh
165#define _write_unlock_bh(lock) __write_unlock_bh(lock)
166#endif
167
168#ifdef __always_inline__spin_unlock_irq
169#define _spin_unlock_irq(lock) __spin_unlock_irq(lock)
170#endif
171
172#ifdef __always_inline__read_unlock_irq
173#define _read_unlock_irq(lock) __read_unlock_irq(lock)
174#endif
175
176#ifdef __always_inline__write_unlock_irq
177#define _write_unlock_irq(lock) __write_unlock_irq(lock)
178#endif
179
180#ifdef __always_inline__spin_unlock_irqrestore
181#define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags)
182#endif
183
184#ifdef __always_inline__read_unlock_irqrestore
185#define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags)
186#endif
187
188#ifdef __always_inline__write_unlock_irqrestore
189#define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags)
190#endif
191
192#endif /* CONFIG_DEBUG_SPINLOCK */
193
194static inline int __spin_trylock(spinlock_t *lock)
195{
196 preempt_disable();
197 if (_raw_spin_trylock(lock)) {
198 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
199 return 1;
200 }
201 preempt_enable();
202 return 0;
203}
204
205static inline int __read_trylock(rwlock_t *lock)
206{
207 preempt_disable();
208 if (_raw_read_trylock(lock)) {
209 rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
210 return 1;
211 }
212 preempt_enable();
213 return 0;
214}
215
216static inline int __write_trylock(rwlock_t *lock)
217{
218 preempt_disable();
219 if (_raw_write_trylock(lock)) {
220 rwlock_acquire(&lock->dep_map, 0, 1, _RET_IP_);
221 return 1;
222 }
223 preempt_enable();
224 return 0;
225}
226
227/*
228 * If lockdep is enabled then we use the non-preemption spin-ops
229 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
230 * not re-enabled during lock-acquire (which the preempt-spin-ops do):
231 */
232#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
233
234static inline void __read_lock(rwlock_t *lock)
235{
236 preempt_disable();
237 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
238 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
239}
240
241static inline unsigned long __spin_lock_irqsave(spinlock_t *lock)
242{
243 unsigned long flags;
244
245 local_irq_save(flags);
246 preempt_disable();
247 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
248 /*
249 * On lockdep we dont want the hand-coded irq-enable of
250 * _raw_spin_lock_flags() code, because lockdep assumes
251 * that interrupts are not re-enabled during lock-acquire:
252 */
253#ifdef CONFIG_LOCKDEP
254 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
255#else
256 _raw_spin_lock_flags(lock, &flags);
257#endif
258 return flags;
259}
260
261static inline void __spin_lock_irq(spinlock_t *lock)
262{
263 local_irq_disable();
264 preempt_disable();
265 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
266 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
267}
268
269static inline void __spin_lock_bh(spinlock_t *lock)
270{
271 local_bh_disable();
272 preempt_disable();
273 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
274 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
275}
276
277static inline unsigned long __read_lock_irqsave(rwlock_t *lock)
278{
279 unsigned long flags;
280
281 local_irq_save(flags);
282 preempt_disable();
283 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
284 LOCK_CONTENDED_FLAGS(lock, _raw_read_trylock, _raw_read_lock,
285 _raw_read_lock_flags, &flags);
286 return flags;
287}
288
289static inline void __read_lock_irq(rwlock_t *lock)
290{
291 local_irq_disable();
292 preempt_disable();
293 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
294 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
295}
296
297static inline void __read_lock_bh(rwlock_t *lock)
298{
299 local_bh_disable();
300 preempt_disable();
301 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
302 LOCK_CONTENDED(lock, _raw_read_trylock, _raw_read_lock);
303}
304
305static inline unsigned long __write_lock_irqsave(rwlock_t *lock)
306{
307 unsigned long flags;
308
309 local_irq_save(flags);
310 preempt_disable();
311 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
312 LOCK_CONTENDED_FLAGS(lock, _raw_write_trylock, _raw_write_lock,
313 _raw_write_lock_flags, &flags);
314 return flags;
315}
316
317static inline void __write_lock_irq(rwlock_t *lock)
318{
319 local_irq_disable();
320 preempt_disable();
321 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
322 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
323}
324
325static inline void __write_lock_bh(rwlock_t *lock)
326{
327 local_bh_disable();
328 preempt_disable();
329 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
330 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
331}
332
333static inline void __spin_lock(spinlock_t *lock)
334{
335 preempt_disable();
336 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
337 LOCK_CONTENDED(lock, _raw_spin_trylock, _raw_spin_lock);
338}
339
340static inline void __write_lock(rwlock_t *lock)
341{
342 preempt_disable();
343 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
344 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);
345}
346
347#endif /* CONFIG_PREEMPT */
348
349static inline void __spin_unlock(spinlock_t *lock)
350{
351 spin_release(&lock->dep_map, 1, _RET_IP_);
352 _raw_spin_unlock(lock);
353 preempt_enable();
354}
355
356static inline void __write_unlock(rwlock_t *lock)
357{
358 rwlock_release(&lock->dep_map, 1, _RET_IP_);
359 _raw_write_unlock(lock);
360 preempt_enable();
361}
362
363static inline void __read_unlock(rwlock_t *lock)
364{
365 rwlock_release(&lock->dep_map, 1, _RET_IP_);
366 _raw_read_unlock(lock);
367 preempt_enable();
368}
369
370static inline void __spin_unlock_irqrestore(spinlock_t *lock,
371 unsigned long flags)
372{
373 spin_release(&lock->dep_map, 1, _RET_IP_);
374 _raw_spin_unlock(lock);
375 local_irq_restore(flags);
376 preempt_enable();
377}
378
379static inline void __spin_unlock_irq(spinlock_t *lock)
380{
381 spin_release(&lock->dep_map, 1, _RET_IP_);
382 _raw_spin_unlock(lock);
383 local_irq_enable();
384 preempt_enable();
385}
386
387static inline void __spin_unlock_bh(spinlock_t *lock)
388{
389 spin_release(&lock->dep_map, 1, _RET_IP_);
390 _raw_spin_unlock(lock);
391 preempt_enable_no_resched();
392 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
393}
394
395static inline void __read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
396{
397 rwlock_release(&lock->dep_map, 1, _RET_IP_);
398 _raw_read_unlock(lock);
399 local_irq_restore(flags);
400 preempt_enable();
401}
402
403static inline void __read_unlock_irq(rwlock_t *lock)
404{
405 rwlock_release(&lock->dep_map, 1, _RET_IP_);
406 _raw_read_unlock(lock);
407 local_irq_enable();
408 preempt_enable();
409}
410
411static inline void __read_unlock_bh(rwlock_t *lock)
412{
413 rwlock_release(&lock->dep_map, 1, _RET_IP_);
414 _raw_read_unlock(lock);
415 preempt_enable_no_resched();
416 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
417}
418
419static inline void __write_unlock_irqrestore(rwlock_t *lock,
420 unsigned long flags)
421{
422 rwlock_release(&lock->dep_map, 1, _RET_IP_);
423 _raw_write_unlock(lock);
424 local_irq_restore(flags);
425 preempt_enable();
426}
427
428static inline void __write_unlock_irq(rwlock_t *lock)
429{
430 rwlock_release(&lock->dep_map, 1, _RET_IP_);
431 _raw_write_unlock(lock);
432 local_irq_enable();
433 preempt_enable();
434}
435
436static inline void __write_unlock_bh(rwlock_t *lock)
437{
438 rwlock_release(&lock->dep_map, 1, _RET_IP_);
439 _raw_write_unlock(lock);
440 preempt_enable_no_resched();
441 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
442}
443
444static inline int __spin_trylock_bh(spinlock_t *lock)
445{
446 local_bh_disable();
447 preempt_disable();
448 if (_raw_spin_trylock(lock)) {
449 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
450 return 1;
451 }
452 preempt_enable_no_resched();
453 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
454 return 0;
455}
456
63#endif /* __LINUX_SPINLOCK_API_SMP_H */ 457#endif /* __LINUX_SPINLOCK_API_SMP_H */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 5ae8fa22d331..3d0a9ff24f01 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -27,24 +27,54 @@ struct ssb_sprom {
27 u8 et1mdcport; /* MDIO for enet1 */ 27 u8 et1mdcport; /* MDIO for enet1 */
28 u8 board_rev; /* Board revision number from SPROM. */ 28 u8 board_rev; /* Board revision number from SPROM. */
29 u8 country_code; /* Country Code */ 29 u8 country_code; /* Country Code */
30 u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */ 30 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
31 u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */ 31 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
32 u16 pa0b0; 32 u16 pa0b0;
33 u16 pa0b1; 33 u16 pa0b1;
34 u16 pa0b2; 34 u16 pa0b2;
35 u16 pa1b0; 35 u16 pa1b0;
36 u16 pa1b1; 36 u16 pa1b1;
37 u16 pa1b2; 37 u16 pa1b2;
38 u16 pa1lob0;
39 u16 pa1lob1;
40 u16 pa1lob2;
41 u16 pa1hib0;
42 u16 pa1hib1;
43 u16 pa1hib2;
38 u8 gpio0; /* GPIO pin 0 */ 44 u8 gpio0; /* GPIO pin 0 */
39 u8 gpio1; /* GPIO pin 1 */ 45 u8 gpio1; /* GPIO pin 1 */
40 u8 gpio2; /* GPIO pin 2 */ 46 u8 gpio2; /* GPIO pin 2 */
41 u8 gpio3; /* GPIO pin 3 */ 47 u8 gpio3; /* GPIO pin 3 */
42 u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */ 48 u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
43 u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */ 49 u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
50 u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
51 u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
44 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 52 u8 itssi_a; /* Idle TSSI Target for A-PHY */
45 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 53 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
46 u16 boardflags_lo; /* Boardflags (low 16 bits) */ 54 u8 tri2g; /* 2.4GHz TX isolation */
47 u16 boardflags_hi; /* Boardflags (high 16 bits) */ 55 u8 tri5gl; /* 5.2GHz TX isolation */
56 u8 tri5g; /* 5.3GHz TX isolation */
57 u8 tri5gh; /* 5.8GHz TX isolation */
58 u8 rxpo2g; /* 2GHz RX power offset */
59 u8 rxpo5g; /* 5GHz RX power offset */
60 u8 rssisav2g; /* 2GHz RSSI params */
61 u8 rssismc2g;
62 u8 rssismf2g;
63 u8 bxa2g; /* 2GHz BX arch */
64 u8 rssisav5g; /* 5GHz RSSI params */
65 u8 rssismc5g;
66 u8 rssismf5g;
67 u8 bxa5g; /* 5GHz BX arch */
68 u16 cck2gpo; /* CCK power offset */
69 u32 ofdm2gpo; /* 2.4GHz OFDM power offset */
70 u32 ofdm5glpo; /* 5.2GHz OFDM power offset */
71 u32 ofdm5gpo; /* 5.3GHz OFDM power offset */
72 u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */
73 u16 boardflags_lo; /* Board flags (bits 0-15) */
74 u16 boardflags_hi; /* Board flags (bits 16-31) */
75 u16 boardflags2_lo; /* Board flags (bits 32-47) */
76 u16 boardflags2_hi; /* Board flags (bits 48-63) */
77 /* TODO store board flags in a single u64 */
48 78
49 /* Antenna gain values for up to 4 antennas 79 /* Antenna gain values for up to 4 antennas
50 * on each band. Values in dBm/4 (Q5.2). Negative gain means the 80 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
@@ -58,7 +88,7 @@ struct ssb_sprom {
58 } ghz5; /* 5GHz band */ 88 } ghz5; /* 5GHz band */
59 } antenna_gain; 89 } antenna_gain;
60 90
61 /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */ 91 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */
62}; 92};
63 93
64/* Information about the PCB the circuitry is soldered on. */ 94/* Information about the PCB the circuitry is soldered on. */
@@ -208,6 +238,7 @@ enum ssb_bustype {
208 SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */ 238 SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */
209 SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */ 239 SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */
210 SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */ 240 SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */
241 SSB_BUSTYPE_SDIO, /* SSB is connected to SDIO bus */
211}; 242};
212 243
213/* board_vendor */ 244/* board_vendor */
@@ -240,8 +271,12 @@ struct ssb_bus {
240 271
241 /* The core in the basic address register window. (PCI bus only) */ 272 /* The core in the basic address register window. (PCI bus only) */
242 struct ssb_device *mapped_device; 273 struct ssb_device *mapped_device;
243 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ 274 union {
244 u8 mapped_pcmcia_seg; 275 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
276 u8 mapped_pcmcia_seg;
277 /* Current SSB base address window for SDIO. */
278 u32 sdio_sbaddr;
279 };
245 /* Lock for core and segment switching. 280 /* Lock for core and segment switching.
246 * On PCMCIA-host busses this is used to protect the whole MMIO access. */ 281 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
247 spinlock_t bar_lock; 282 spinlock_t bar_lock;
@@ -252,6 +287,11 @@ struct ssb_bus {
252 struct pci_dev *host_pci; 287 struct pci_dev *host_pci;
253 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 288 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
254 struct pcmcia_device *host_pcmcia; 289 struct pcmcia_device *host_pcmcia;
290 /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */
291 struct sdio_func *host_sdio;
292
293 /* See enum ssb_quirks */
294 unsigned int quirks;
255 295
256#ifdef CONFIG_SSB_SPROM 296#ifdef CONFIG_SSB_SPROM
257 /* Mutex to protect the SPROM writing. */ 297 /* Mutex to protect the SPROM writing. */
@@ -306,6 +346,11 @@ struct ssb_bus {
306#endif /* DEBUG */ 346#endif /* DEBUG */
307}; 347};
308 348
349enum ssb_quirks {
350 /* SDIO connected card requires performing a read after writing a 32-bit value */
351 SSB_QUIRK_SDIO_READ_AFTER_WRITE32 = (1 << 0),
352};
353
309/* The initialization-invariants. */ 354/* The initialization-invariants. */
310struct ssb_init_invariants { 355struct ssb_init_invariants {
311 /* Versioning information about the PCB. */ 356 /* Versioning information about the PCB. */
@@ -336,6 +381,12 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
336 struct pcmcia_device *pcmcia_dev, 381 struct pcmcia_device *pcmcia_dev,
337 unsigned long baseaddr); 382 unsigned long baseaddr);
338#endif /* CONFIG_SSB_PCMCIAHOST */ 383#endif /* CONFIG_SSB_PCMCIAHOST */
384#ifdef CONFIG_SSB_SDIOHOST
385extern int ssb_bus_sdiobus_register(struct ssb_bus *bus,
386 struct sdio_func *sdio_func,
387 unsigned int quirks);
388#endif /* CONFIG_SSB_SDIOHOST */
389
339 390
340extern void ssb_bus_unregister(struct ssb_bus *bus); 391extern void ssb_bus_unregister(struct ssb_bus *bus);
341 392
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index d3b1d18922f2..4e27acf0a92f 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -629,5 +629,15 @@ extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
629/* PMU support */ 629/* PMU support */
630extern void ssb_pmu_init(struct ssb_chipcommon *cc); 630extern void ssb_pmu_init(struct ssb_chipcommon *cc);
631 631
632enum ssb_pmu_ldo_volt_id {
633 LDO_PAREF = 0,
634 LDO_VOLT1,
635 LDO_VOLT2,
636 LDO_VOLT3,
637};
638
639void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc,
640 enum ssb_pmu_ldo_volt_id id, u32 voltage);
641void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on);
632 642
633#endif /* LINUX_SSB_CHIPCO_H_ */ 643#endif /* LINUX_SSB_CHIPCO_H_ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index a01b982b5783..9ae9082eaeb4 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -162,7 +162,7 @@
162 162
163/* SPROM shadow area. If not otherwise noted, fields are 163/* SPROM shadow area. If not otherwise noted, fields are
164 * two bytes wide. Note that the SPROM can _only_ be read 164 * two bytes wide. Note that the SPROM can _only_ be read
165 * in two-byte quantinies. 165 * in two-byte quantities.
166 */ 166 */
167#define SSB_SPROMSIZE_WORDS 64 167#define SSB_SPROMSIZE_WORDS 64
168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) 168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
@@ -327,8 +327,11 @@
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 328
329/* SPROM Revision 8 */ 329/* SPROM Revision 8 */
330#define SSB_SPROM8_BFLLO 0x1084 /* Boardflags (low 16 bits) */ 330#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */
331#define SSB_SPROM8_BFLHI 0x1086 /* Boardflags Hi */ 331#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */
332#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */
333#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */
334#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */
332#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ 335#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */
333#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ 336#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */
334#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ 337#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/
@@ -354,14 +357,63 @@
354#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ 357#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
355#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ 358#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
356#define SSB_SPROM8_GPIOB_P3_SHIFT 8 359#define SSB_SPROM8_GPIOB_P3_SHIFT 8
357#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power BG in path 1 */ 360#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
358#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 361#define SSB_SPROM8_RSSISMF2G 0x000F
362#define SSB_SPROM8_RSSISMC2G 0x00F0
363#define SSB_SPROM8_RSSISMC2G_SHIFT 4
364#define SSB_SPROM8_RSSISAV2G 0x0700
365#define SSB_SPROM8_RSSISAV2G_SHIFT 8
366#define SSB_SPROM8_BXA2G 0x1800
367#define SSB_SPROM8_BXA2G_SHIFT 11
368#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */
369#define SSB_SPROM8_RSSISMF5G 0x000F
370#define SSB_SPROM8_RSSISMC5G 0x00F0
371#define SSB_SPROM8_RSSISMC5G_SHIFT 4
372#define SSB_SPROM8_RSSISAV5G 0x0700
373#define SSB_SPROM8_RSSISAV5G_SHIFT 8
374#define SSB_SPROM8_BXA5G 0x1800
375#define SSB_SPROM8_BXA5G_SHIFT 11
376#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */
377#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
378#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
379#define SSB_SPROM8_TRI5G_SHIFT 8
380#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */
381#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
382#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
383#define SSB_SPROM8_TRI5GH_SHIFT 8
384#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */
385#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
386#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
387#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_MASK 0x00FF /* Mask for Max Power 2GHz */
359#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 390#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
360#define SSB_SPROM8_ITSSI_BG_SHIFT 8 391#define SSB_SPROM8_ITSSI_BG_SHIFT 8
361#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power A in path 1 */ 392#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */
362#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ 393#define SSB_SPROM8_PA0B1 0x10C4
394#define SSB_SPROM8_PA0B2 0x10C6
395#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */
396#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
363#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 397#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
364#define SSB_SPROM8_ITSSI_A_SHIFT 8 398#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_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_SHIFT 8
403#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */
404#define SSB_SPROM8_PA1B1 0x10CE
405#define SSB_SPROM8_PA1B2 0x10D0
406#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */
407#define SSB_SPROM8_PA1LOB1 0x10D4
408#define SSB_SPROM8_PA1LOB2 0x10D6
409#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */
410#define SSB_SPROM8_PA1HIB1 0x10DA
411#define SSB_SPROM8_PA1HIB2 0x10DC
412#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */
413#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */
414#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */
415#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */
416#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */
365 417
366/* Values for SSB_SPROM1_BINF_CCODE */ 418/* Values for SSB_SPROM1_BINF_CCODE */
367enum { 419enum {
diff --git a/include/linux/string.h b/include/linux/string.h
index 489019ef1694..b8508868d5ad 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -62,7 +62,7 @@ extern char * strnchr(const char *, size_t, int);
62#ifndef __HAVE_ARCH_STRRCHR 62#ifndef __HAVE_ARCH_STRRCHR
63extern char * strrchr(const char *,int); 63extern char * strrchr(const char *,int);
64#endif 64#endif
65extern char * strstrip(char *); 65extern char * __must_check strstrip(char *);
66#ifndef __HAVE_ARCH_STRSTR 66#ifndef __HAVE_ARCH_STRSTR
67extern char * strstr(const char *,const char *); 67extern char * strstr(const char *,const char *);
68#endif 68#endif
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 3f632182d8eb..996df4dac7d4 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -111,7 +111,7 @@ struct rpc_credops {
111 void (*crdestroy)(struct rpc_cred *); 111 void (*crdestroy)(struct rpc_cred *);
112 112
113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *); 114 void (*crbind)(struct rpc_task *, struct rpc_cred *, int);
115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
116 int (*crrefresh)(struct rpc_task *); 116 int (*crrefresh)(struct rpc_task *);
117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -140,7 +140,7 @@ struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *
140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int);
143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *); 143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void put_rpccred(struct rpc_cred *); 144void put_rpccred(struct rpc_cred *);
145void rpcauth_unbindcred(struct rpc_task *); 145void rpcauth_unbindcred(struct rpc_task *);
146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 2d8b211b9324..6f52b4d7c447 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -59,6 +59,15 @@ struct cache_head {
59 59
60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
61 61
62struct cache_detail_procfs {
63 struct proc_dir_entry *proc_ent;
64 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
65};
66
67struct cache_detail_pipefs {
68 struct dentry *dir;
69};
70
62struct cache_detail { 71struct cache_detail {
63 struct module * owner; 72 struct module * owner;
64 int hash_size; 73 int hash_size;
@@ -70,15 +79,17 @@ struct cache_detail {
70 char *name; 79 char *name;
71 void (*cache_put)(struct kref *); 80 void (*cache_put)(struct kref *);
72 81
73 void (*cache_request)(struct cache_detail *cd, 82 int (*cache_upcall)(struct cache_detail *,
74 struct cache_head *h, 83 struct cache_head *);
75 char **bpp, int *blen); 84
76 int (*cache_parse)(struct cache_detail *, 85 int (*cache_parse)(struct cache_detail *,
77 char *buf, int len); 86 char *buf, int len);
78 87
79 int (*cache_show)(struct seq_file *m, 88 int (*cache_show)(struct seq_file *m,
80 struct cache_detail *cd, 89 struct cache_detail *cd,
81 struct cache_head *h); 90 struct cache_head *h);
91 void (*warn_no_listener)(struct cache_detail *cd,
92 int has_died);
82 93
83 struct cache_head * (*alloc)(void); 94 struct cache_head * (*alloc)(void);
84 int (*match)(struct cache_head *orig, struct cache_head *new); 95 int (*match)(struct cache_head *orig, struct cache_head *new);
@@ -96,13 +107,15 @@ struct cache_detail {
96 107
97 /* fields for communication over channel */ 108 /* fields for communication over channel */
98 struct list_head queue; 109 struct list_head queue;
99 struct proc_dir_entry *proc_ent;
100 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
101 110
102 atomic_t readers; /* how many time is /chennel open */ 111 atomic_t readers; /* how many time is /chennel open */
103 time_t last_close; /* if no readers, when did last close */ 112 time_t last_close; /* if no readers, when did last close */
104 time_t last_warn; /* when we last warned about no readers */ 113 time_t last_warn; /* when we last warned about no readers */
105 void (*warn_no_listener)(struct cache_detail *cd); 114
115 union {
116 struct cache_detail_procfs procfs;
117 struct cache_detail_pipefs pipefs;
118 } u;
106}; 119};
107 120
108 121
@@ -127,6 +140,10 @@ struct cache_deferred_req {
127}; 140};
128 141
129 142
143extern const struct file_operations cache_file_operations_pipefs;
144extern const struct file_operations content_file_operations_pipefs;
145extern const struct file_operations cache_flush_operations_pipefs;
146
130extern struct cache_head * 147extern struct cache_head *
131sunrpc_cache_lookup(struct cache_detail *detail, 148sunrpc_cache_lookup(struct cache_detail *detail,
132 struct cache_head *key, int hash); 149 struct cache_head *key, int hash);
@@ -134,6 +151,13 @@ extern struct cache_head *
134sunrpc_cache_update(struct cache_detail *detail, 151sunrpc_cache_update(struct cache_detail *detail,
135 struct cache_head *new, struct cache_head *old, int hash); 152 struct cache_head *new, struct cache_head *old, int hash);
136 153
154extern int
155sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
156 void (*cache_request)(struct cache_detail *,
157 struct cache_head *,
158 char **,
159 int *));
160
137 161
138extern void cache_clean_deferred(void *owner); 162extern void cache_clean_deferred(void *owner);
139 163
@@ -171,6 +195,10 @@ extern void cache_purge(struct cache_detail *detail);
171extern int cache_register(struct cache_detail *cd); 195extern int cache_register(struct cache_detail *cd);
172extern void cache_unregister(struct cache_detail *cd); 196extern void cache_unregister(struct cache_detail *cd);
173 197
198extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
199 mode_t, struct cache_detail *);
200extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
201
174extern void qword_add(char **bpp, int *lp, char *str); 202extern void qword_add(char **bpp, int *lp, char *str);
175extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); 203extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
176extern int qword_get(char **bpp, char *dest, int bufsize); 204extern int qword_get(char **bpp, char *dest, int bufsize);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 37881f1a0bd7..8ed9642a5a76 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -9,6 +9,10 @@
9#ifndef _LINUX_SUNRPC_CLNT_H 9#ifndef _LINUX_SUNRPC_CLNT_H
10#define _LINUX_SUNRPC_CLNT_H 10#define _LINUX_SUNRPC_CLNT_H
11 11
12#include <linux/socket.h>
13#include <linux/in.h>
14#include <linux/in6.h>
15
12#include <linux/sunrpc/msg_prot.h> 16#include <linux/sunrpc/msg_prot.h>
13#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
14#include <linux/sunrpc/xprt.h> 18#include <linux/sunrpc/xprt.h>
@@ -17,6 +21,8 @@
17#include <linux/sunrpc/xdr.h> 21#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/timer.h> 22#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 23#include <asm/signal.h>
24#include <linux/path.h>
25#include <net/ipv6.h>
20 26
21struct rpc_inode; 27struct rpc_inode;
22 28
@@ -50,9 +56,7 @@ struct rpc_clnt {
50 56
51 int cl_nodelen; /* nodename length */ 57 int cl_nodelen; /* nodename length */
52 char cl_nodename[UNX_MAXNODENAME]; 58 char cl_nodename[UNX_MAXNODENAME];
53 char cl_pathname[30];/* Path in rpc_pipe_fs */ 59 struct path cl_path;
54 struct vfsmount * cl_vfsmnt;
55 struct dentry * cl_dentry; /* inode */
56 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 60 struct rpc_clnt * cl_parent; /* Points to parent of clones */
57 struct rpc_rtt cl_rtt_default; 61 struct rpc_rtt cl_rtt_default;
58 struct rpc_timeout cl_timeout_default; 62 struct rpc_timeout cl_timeout_default;
@@ -110,6 +114,7 @@ struct rpc_create_args {
110 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
111 unsigned long flags; 115 unsigned long flags;
112 char *client_name; 116 char *client_name;
117 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
113}; 118};
114 119
115/* Values for "flags" field */ 120/* Values for "flags" field */
@@ -151,5 +156,151 @@ void rpc_force_rebind(struct rpc_clnt *);
151size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 156size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
152const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 157const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
153 158
159size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
160size_t rpc_pton(const char *, const size_t,
161 struct sockaddr *, const size_t);
162char * rpc_sockaddr2uaddr(const struct sockaddr *);
163size_t rpc_uaddr2sockaddr(const char *, const size_t,
164 struct sockaddr *, const size_t);
165
166static inline unsigned short rpc_get_port(const struct sockaddr *sap)
167{
168 switch (sap->sa_family) {
169 case AF_INET:
170 return ntohs(((struct sockaddr_in *)sap)->sin_port);
171 case AF_INET6:
172 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
173 }
174 return 0;
175}
176
177static inline void rpc_set_port(struct sockaddr *sap,
178 const unsigned short port)
179{
180 switch (sap->sa_family) {
181 case AF_INET:
182 ((struct sockaddr_in *)sap)->sin_port = htons(port);
183 break;
184 case AF_INET6:
185 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
186 break;
187 }
188}
189
190#define IPV6_SCOPE_DELIMITER '%'
191#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
192
193static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
194 const struct sockaddr *sap2)
195{
196 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
197 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
198
199 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
200}
201
202static inline bool __rpc_copy_addr4(struct sockaddr *dst,
203 const struct sockaddr *src)
204{
205 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
206 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
207
208 dsin->sin_family = ssin->sin_family;
209 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
210 return true;
211}
212
213#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
214static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
215 const struct sockaddr *sap2)
216{
217 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
218 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
219 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
220}
221
222static inline bool __rpc_copy_addr6(struct sockaddr *dst,
223 const struct sockaddr *src)
224{
225 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
226 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
227
228 dsin6->sin6_family = ssin6->sin6_family;
229 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr);
230 return true;
231}
232#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
233static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
234 const struct sockaddr *sap2)
235{
236 return false;
237}
238
239static inline bool __rpc_copy_addr6(struct sockaddr *dst,
240 const struct sockaddr *src)
241{
242 return false;
243}
244#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
245
246/**
247 * rpc_cmp_addr - compare the address portion of two sockaddrs.
248 * @sap1: first sockaddr
249 * @sap2: second sockaddr
250 *
251 * Just compares the family and address portion. Ignores port, scope, etc.
252 * Returns true if the addrs are equal, false if they aren't.
253 */
254static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
255 const struct sockaddr *sap2)
256{
257 if (sap1->sa_family == sap2->sa_family) {
258 switch (sap1->sa_family) {
259 case AF_INET:
260 return __rpc_cmp_addr4(sap1, sap2);
261 case AF_INET6:
262 return __rpc_cmp_addr6(sap1, sap2);
263 }
264 }
265 return false;
266}
267
268/**
269 * rpc_copy_addr - copy the address portion of one sockaddr to another
270 * @dst: destination sockaddr
271 * @src: source sockaddr
272 *
273 * Just copies the address portion and family. Ignores port, scope, etc.
274 * Caller is responsible for making certain that dst is large enough to hold
275 * the address in src. Returns true if address family is supported. Returns
276 * false otherwise.
277 */
278static inline bool rpc_copy_addr(struct sockaddr *dst,
279 const struct sockaddr *src)
280{
281 switch (src->sa_family) {
282 case AF_INET:
283 return __rpc_copy_addr4(dst, src);
284 case AF_INET6:
285 return __rpc_copy_addr6(dst, src);
286 }
287 return false;
288}
289
290/**
291 * rpc_get_scope_id - return scopeid for a given sockaddr
292 * @sa: sockaddr to get scopeid from
293 *
294 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
295 * not an AF_INET6 address.
296 */
297static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
298{
299 if (sa->sa_family != AF_INET6)
300 return 0;
301
302 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
303}
304
154#endif /* __KERNEL__ */ 305#endif /* __KERNEL__ */
155#endif /* _LINUX_SUNRPC_CLNT_H */ 306#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 70df4f1d8847..77e624883393 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -189,7 +189,22 @@ typedef __be32 rpc_fraghdr;
189 * Additionally, the two alternative forms specified in Section 2.2 of 189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable. 190 * [RFC2373] are also acceptable.
191 */ 191 */
192#define RPCBIND_MAXUADDRLEN (56u) 192
193#include <linux/inet.h>
194
195/* Maximum size of the port number part of a universal address */
196#define RPCBIND_MAXUADDRPLEN sizeof(".255.255")
197
198/* Maximum size of an IPv4 universal address */
199#define RPCBIND_MAXUADDR4LEN \
200 (INET_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
201
202/* Maximum size of an IPv6 universal address */
203#define RPCBIND_MAXUADDR6LEN \
204 (INET6_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
205
206/* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */
207#define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN
193 208
194#endif /* __KERNEL__ */ 209#endif /* __KERNEL__ */
195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 210#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cea764c2359f..cf14db975da0 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -3,6 +3,8 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/workqueue.h>
7
6struct rpc_pipe_msg { 8struct rpc_pipe_msg {
7 struct list_head list; 9 struct list_head list;
8 void *data; 10 void *data;
@@ -32,8 +34,8 @@ struct rpc_inode {
32 wait_queue_head_t waitq; 34 wait_queue_head_t waitq;
33#define RPC_PIPE_WAIT_FOR_OPEN 1 35#define RPC_PIPE_WAIT_FOR_OPEN 1
34 int flags; 36 int flags;
35 struct rpc_pipe_ops *ops;
36 struct delayed_work queue_timeout; 37 struct delayed_work queue_timeout;
38 const struct rpc_pipe_ops *ops;
37}; 39};
38 40
39static inline struct rpc_inode * 41static inline struct rpc_inode *
@@ -44,9 +46,19 @@ RPC_I(struct inode *inode)
44 46
45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 47extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
46 48
47extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 49struct rpc_clnt;
48extern int rpc_rmdir(struct dentry *); 50extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
49extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags); 51extern int rpc_remove_client_dir(struct dentry *);
52
53struct cache_detail;
54extern struct dentry *rpc_create_cache_dir(struct dentry *,
55 struct qstr *,
56 mode_t umode,
57 struct cache_detail *);
58extern void rpc_remove_cache_dir(struct dentry *);
59
60extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
61 const struct rpc_pipe_ops *, int flags);
50extern int rpc_unlink(struct dentry *); 62extern int rpc_unlink(struct dentry *);
51extern struct vfsmount *rpc_get_mount(void); 63extern struct vfsmount *rpc_get_mount(void);
52extern void rpc_put_mount(void); 64extern void rpc_put_mount(void);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index ea8009695c69..52e8cb0a7569 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -94,8 +94,6 @@ struct svc_serv {
94 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
95 * adding threads */ 95 * adding threads */
96 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
99#if defined(CONFIG_NFS_V4_1) 97#if defined(CONFIG_NFS_V4_1)
100 struct list_head sv_cb_list; /* queue for callback requests 98 struct list_head sv_cb_list; /* queue for callback requests
101 * that arrive over the same 99 * that arrive over the same
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 2223ae0b5ed5..5f4e18b3ce73 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -65,6 +65,7 @@ struct svc_xprt {
65 size_t xpt_locallen; /* length of address */ 65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */ 66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */ 67 size_t xpt_remotelen; /* length of address */
68 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
68}; 69};
69 70
70int svc_reg_xprt_class(struct svc_xprt_class *); 71int svc_reg_xprt_class(struct svc_xprt_class *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 04dba23c59f2..1b353a76c304 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -28,6 +28,7 @@ struct svc_sock {
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 u32 sk_reclen; /* length of record */
30 u32 sk_tcplen; /* current read length */ 30 u32 sk_tcplen; /* current read length */
31 struct rpc_xprt *sk_bc_xprt; /* NFSv4.1 backchannel xprt */
31}; 32};
32 33
33/* 34/*
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index b99c625fddfe..f5cc0898bc53 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <asm/unaligned.h>
14#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
15 16
16/* 17/*
@@ -117,17 +118,15 @@ static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int le
117static inline __be32 * 118static inline __be32 *
118xdr_encode_hyper(__be32 *p, __u64 val) 119xdr_encode_hyper(__be32 *p, __u64 val)
119{ 120{
120 *p++ = htonl(val >> 32); 121 put_unaligned_be64(val, p);
121 *p++ = htonl(val & 0xFFFFFFFF); 122 return p + 2;
122 return p;
123} 123}
124 124
125static inline __be32 * 125static inline __be32 *
126xdr_decode_hyper(__be32 *p, __u64 *valp) 126xdr_decode_hyper(__be32 *p, __u64 *valp)
127{ 127{
128 *valp = ((__u64) ntohl(*p++)) << 32; 128 *valp = get_unaligned_be64(p);
129 *valp |= ntohl(*p++); 129 return p + 2;
130 return p;
131} 130}
132 131
133/* 132/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 1175d58efc2e..6f9457a75b8f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -38,10 +38,8 @@ enum rpc_display_format_t {
38 RPC_DISPLAY_ADDR = 0, 38 RPC_DISPLAY_ADDR = 0,
39 RPC_DISPLAY_PORT, 39 RPC_DISPLAY_PORT,
40 RPC_DISPLAY_PROTO, 40 RPC_DISPLAY_PROTO,
41 RPC_DISPLAY_ALL,
42 RPC_DISPLAY_HEX_ADDR, 41 RPC_DISPLAY_HEX_ADDR,
43 RPC_DISPLAY_HEX_PORT, 42 RPC_DISPLAY_HEX_PORT,
44 RPC_DISPLAY_UNIVERSAL_ADDR,
45 RPC_DISPLAY_NETID, 43 RPC_DISPLAY_NETID,
46 RPC_DISPLAY_MAX, 44 RPC_DISPLAY_MAX,
47}; 45};
@@ -126,6 +124,23 @@ struct rpc_xprt_ops {
126 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); 124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
127}; 125};
128 126
127/*
128 * RPC transport identifiers
129 *
130 * To preserve compatibility with the historical use of raw IP protocol
131 * id's for transport selection, UDP and TCP identifiers are specified
132 * with the previous values. No such restriction exists for new transports,
133 * except that they may not collide with these values (17 and 6,
134 * respectively).
135 */
136#define XPRT_TRANSPORT_BC (1 << 31)
137enum xprt_transports {
138 XPRT_TRANSPORT_UDP = IPPROTO_UDP,
139 XPRT_TRANSPORT_TCP = IPPROTO_TCP,
140 XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
141 XPRT_TRANSPORT_RDMA = 256
142};
143
129struct rpc_xprt { 144struct rpc_xprt {
130 struct kref kref; /* Reference count */ 145 struct kref kref; /* Reference count */
131 struct rpc_xprt_ops * ops; /* transport methods */ 146 struct rpc_xprt_ops * ops; /* transport methods */
@@ -181,6 +196,7 @@ struct rpc_xprt {
181 spinlock_t reserve_lock; /* lock slot table */ 196 spinlock_t reserve_lock; /* lock slot table */
182 u32 xid; /* Next XID value to use */ 197 u32 xid; /* Next XID value to use */
183 struct rpc_task * snd_task; /* Task blocked in send */ 198 struct rpc_task * snd_task; /* Task blocked in send */
199 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
184#if defined(CONFIG_NFS_V4_1) 200#if defined(CONFIG_NFS_V4_1)
185 struct svc_serv *bc_serv; /* The RPC service which will */ 201 struct svc_serv *bc_serv; /* The RPC service which will */
186 /* process the callback */ 202 /* process the callback */
@@ -233,6 +249,7 @@ struct xprt_create {
233 struct sockaddr * srcaddr; /* optional local address */ 249 struct sockaddr * srcaddr; /* optional local address */
234 struct sockaddr * dstaddr; /* remote peer address */ 250 struct sockaddr * dstaddr; /* remote peer address */
235 size_t addrlen; 251 size_t addrlen;
252 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
236}; 253};
237 254
238struct xprt_class { 255struct xprt_class {
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 54a379c9e8eb..c2f04e1ae159 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -41,11 +41,6 @@
41#define _LINUX_SUNRPC_XPRTRDMA_H 41#define _LINUX_SUNRPC_XPRTRDMA_H
42 42
43/* 43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid. 44 * rpcbind (v3+) RDMA netid.
50 */ 45 */
51#define RPCBIND_NETID_RDMA "rdma" 46#define RPCBIND_NETID_RDMA "rdma"
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index c2a46c45c8f7..3f14a02e9cc0 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -13,17 +13,6 @@ int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/* 15/*
16 * RPC transport identifiers for UDP, TCP
17 *
18 * To preserve compatibility with the historical use of raw IP protocol
19 * id's for transport selection, these are specified with the previous
20 * values. No such restriction exists for new transports, except that
21 * they may not collide with these values (17 and 6, respectively).
22 */
23#define XPRT_TRANSPORT_UDP IPPROTO_UDP
24#define XPRT_TRANSPORT_TCP IPPROTO_TCP
25
26/*
27 * RPC slot table sizes for UDP, TCP transports 16 * RPC slot table sizes for UDP, TCP transports
28 */ 17 */
29extern unsigned int xprt_udp_slot_table_entries; 18extern unsigned int xprt_udp_slot_table_entries;
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index cd15df6c63cd..5e781d824e6d 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -301,6 +301,8 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
301#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 301#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
302#endif /* !CONFIG_PM_SLEEP */ 302#endif /* !CONFIG_PM_SLEEP */
303 303
304extern struct mutex pm_mutex;
305
304#ifndef CONFIG_HIBERNATION 306#ifndef CONFIG_HIBERNATION
305static inline void register_nosave_region(unsigned long b, unsigned long e) 307static inline void register_nosave_region(unsigned long b, unsigned long e)
306{ 308{
@@ -308,8 +310,23 @@ static inline void register_nosave_region(unsigned long b, unsigned long e)
308static inline void register_nosave_region_late(unsigned long b, unsigned long e) 310static inline void register_nosave_region_late(unsigned long b, unsigned long e)
309{ 311{
310} 312}
311#endif
312 313
313extern struct mutex pm_mutex; 314static inline void lock_system_sleep(void) {}
315static inline void unlock_system_sleep(void) {}
316
317#else
318
319/* Let some subsystems like memory hotadd exclude hibernation */
320
321static inline void lock_system_sleep(void)
322{
323 mutex_lock(&pm_mutex);
324}
325
326static inline void unlock_system_sleep(void)
327{
328 mutex_unlock(&pm_mutex);
329}
330#endif
314 331
315#endif /* _LINUX_SUSPEND_H */ 332#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7c15334f3ff2..4ec90019c1a4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -34,15 +34,37 @@ static inline int current_is_kswapd(void)
34 * the type/offset into the pte as 5/27 as well. 34 * the type/offset into the pte as 5/27 as well.
35 */ 35 */
36#define MAX_SWAPFILES_SHIFT 5 36#define MAX_SWAPFILES_SHIFT 5
37#ifndef CONFIG_MIGRATION 37
38#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) 38/*
39 * Use some of the swap files numbers for other purposes. This
40 * is a convenient way to hook into the VM to trigger special
41 * actions on faults.
42 */
43
44/*
45 * NUMA node memory migration support
46 */
47#ifdef CONFIG_MIGRATION
48#define SWP_MIGRATION_NUM 2
49#define SWP_MIGRATION_READ (MAX_SWAPFILES + SWP_HWPOISON_NUM)
50#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM + 1)
51#else
52#define SWP_MIGRATION_NUM 0
53#endif
54
55/*
56 * Handling of hardware poisoned pages with memory corruption.
57 */
58#ifdef CONFIG_MEMORY_FAILURE
59#define SWP_HWPOISON_NUM 1
60#define SWP_HWPOISON MAX_SWAPFILES
39#else 61#else
40/* Use last two entries for page migration swap entries */ 62#define SWP_HWPOISON_NUM 0
41#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2)
42#define SWP_MIGRATION_READ MAX_SWAPFILES
43#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1)
44#endif 63#endif
45 64
65#define MAX_SWAPFILES \
66 ((1 << MAX_SWAPFILES_SHIFT) - SWP_MIGRATION_NUM - SWP_HWPOISON_NUM)
67
46/* 68/*
47 * Magic header for a swap area. The first part of the union is 69 * Magic header for a swap area. The first part of the union is
48 * what the swap magic looks like for the old (limited to 128MB) 70 * what the swap magic looks like for the old (limited to 128MB)
@@ -217,6 +239,11 @@ extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
217extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 239extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
218 gfp_t gfp_mask, bool noswap, 240 gfp_t gfp_mask, bool noswap,
219 unsigned int swappiness); 241 unsigned int swappiness);
242extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
243 gfp_t gfp_mask, bool noswap,
244 unsigned int swappiness,
245 struct zone *zone,
246 int nid);
220extern int __isolate_lru_page(struct page *page, int mode, int file); 247extern int __isolate_lru_page(struct page *page, int mode, int file);
221extern unsigned long shrink_all_memory(unsigned long nr_pages); 248extern unsigned long shrink_all_memory(unsigned long nr_pages);
222extern int vm_swappiness; 249extern int vm_swappiness;
@@ -240,7 +267,7 @@ extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 267extern void scan_mapping_unevictable_pages(struct address_space *);
241 268
242extern unsigned long scan_unevictable_pages; 269extern unsigned long scan_unevictable_pages;
243extern int scan_unevictable_handler(struct ctl_table *, int, struct file *, 270extern int scan_unevictable_handler(struct ctl_table *, int,
244 void __user *, size_t *, loff_t *); 271 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 272extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 273extern void scan_unevictable_unregister_node(struct node *node);
@@ -419,10 +446,22 @@ static inline swp_entry_t get_swap_page(void)
419} 446}
420 447
421/* linux/mm/thrash.c */ 448/* linux/mm/thrash.c */
422#define put_swap_token(mm) do { } while (0) 449static inline void put_swap_token(struct mm_struct *mm)
423#define grab_swap_token(mm) do { } while (0) 450{
424#define has_swap_token(mm) 0 451}
425#define disable_swap_token() do { } while (0) 452
453static inline void grab_swap_token(struct mm_struct *mm)
454{
455}
456
457static inline int has_swap_token(struct mm_struct *mm)
458{
459 return 0;
460}
461
462static inline void disable_swap_token(void)
463{
464}
426 465
427static inline void 466static inline void
428mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 467mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 6ec39ab27b4b..cd42e30b7c6e 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -131,3 +131,41 @@ static inline int is_write_migration_entry(swp_entry_t entry)
131 131
132#endif 132#endif
133 133
134#ifdef CONFIG_MEMORY_FAILURE
135/*
136 * Support for hardware poisoned pages
137 */
138static inline swp_entry_t make_hwpoison_entry(struct page *page)
139{
140 BUG_ON(!PageLocked(page));
141 return swp_entry(SWP_HWPOISON, page_to_pfn(page));
142}
143
144static inline int is_hwpoison_entry(swp_entry_t entry)
145{
146 return swp_type(entry) == SWP_HWPOISON;
147}
148#else
149
150static inline swp_entry_t make_hwpoison_entry(struct page *page)
151{
152 return swp_entry(0, 0);
153}
154
155static inline int is_hwpoison_entry(swp_entry_t swp)
156{
157 return 0;
158}
159#endif
160
161#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
162static inline int non_swap_entry(swp_entry_t entry)
163{
164 return swp_type(entry) >= MAX_SWAPFILES;
165}
166#else
167static inline int non_swap_entry(swp_entry_t entry)
168{
169 return 0;
170}
171#endif
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index cb1a6631b8f4..73b1f1cec423 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -14,7 +14,6 @@ struct scatterlist;
14 */ 14 */
15#define IO_TLB_SEGSIZE 128 15#define IO_TLB_SEGSIZE 128
16 16
17
18/* 17/*
19 * log of the size of each IO TLB slab. The number of slabs is command line 18 * log of the size of each IO TLB slab. The number of slabs is command line
20 * controllable. 19 * controllable.
@@ -24,16 +23,6 @@ struct scatterlist;
24extern void 23extern void
25swiotlb_init(void); 24swiotlb_init(void);
26 25
27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29
30extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(struct device *hwdev,
33 dma_addr_t address);
34
35extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
36
37extern void 26extern void
38*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 27*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flags); 28 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 80de7003d8c2..a990ace1a838 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -55,7 +55,7 @@ struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent; 57struct old_linux_dirent;
58struct perf_counter_attr; 58struct perf_event_attr;
59 59
60#include <linux/types.h> 60#include <linux/types.h>
61#include <linux/aio_abi.h> 61#include <linux/aio_abi.h>
@@ -64,6 +64,7 @@ struct perf_counter_attr;
64#include <linux/sem.h> 64#include <linux/sem.h>
65#include <asm/siginfo.h> 65#include <asm/siginfo.h>
66#include <asm/signal.h> 66#include <asm/signal.h>
67#include <linux/unistd.h>
67#include <linux/quota.h> 68#include <linux/quota.h>
68#include <linux/key.h> 69#include <linux/key.h>
69#include <trace/syscall.h> 70#include <trace/syscall.h>
@@ -97,6 +98,45 @@ struct perf_counter_attr;
97#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 98#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
98#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 99#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
99 100
101#ifdef CONFIG_EVENT_PROFILE
102#define TRACE_SYS_ENTER_PROFILE(sname) \
103static int prof_sysenter_enable_##sname(void) \
104{ \
105 return reg_prof_syscall_enter("sys"#sname); \
106} \
107 \
108static void prof_sysenter_disable_##sname(void) \
109{ \
110 unreg_prof_syscall_enter("sys"#sname); \
111}
112
113#define TRACE_SYS_EXIT_PROFILE(sname) \
114static int prof_sysexit_enable_##sname(void) \
115{ \
116 return reg_prof_syscall_exit("sys"#sname); \
117} \
118 \
119static void prof_sysexit_disable_##sname(void) \
120{ \
121 unreg_prof_syscall_exit("sys"#sname); \
122}
123
124#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
125 .profile_count = ATOMIC_INIT(-1), \
126 .profile_enable = prof_sysenter_enable_##sname, \
127 .profile_disable = prof_sysenter_disable_##sname,
128
129#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
130 .profile_count = ATOMIC_INIT(-1), \
131 .profile_enable = prof_sysexit_enable_##sname, \
132 .profile_disable = prof_sysexit_disable_##sname,
133#else
134#define TRACE_SYS_ENTER_PROFILE(sname)
135#define TRACE_SYS_ENTER_PROFILE_INIT(sname)
136#define TRACE_SYS_EXIT_PROFILE(sname)
137#define TRACE_SYS_EXIT_PROFILE_INIT(sname)
138#endif
139
100#ifdef CONFIG_FTRACE_SYSCALLS 140#ifdef CONFIG_FTRACE_SYSCALLS
101#define __SC_STR_ADECL1(t, a) #a 141#define __SC_STR_ADECL1(t, a) #a
102#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 142#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
@@ -112,7 +152,81 @@ struct perf_counter_attr;
112#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) 152#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
113#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 153#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
114 154
155#define SYSCALL_TRACE_ENTER_EVENT(sname) \
156 static struct ftrace_event_call event_enter_##sname; \
157 struct trace_event enter_syscall_print_##sname = { \
158 .trace = print_syscall_enter, \
159 }; \
160 static int init_enter_##sname(void) \
161 { \
162 int num, id; \
163 num = syscall_name_to_nr("sys"#sname); \
164 if (num < 0) \
165 return -ENOSYS; \
166 id = register_ftrace_event(&enter_syscall_print_##sname);\
167 if (!id) \
168 return -ENODEV; \
169 event_enter_##sname.id = id; \
170 set_syscall_enter_id(num, id); \
171 INIT_LIST_HEAD(&event_enter_##sname.fields); \
172 return 0; \
173 } \
174 TRACE_SYS_ENTER_PROFILE(sname); \
175 static struct ftrace_event_call __used \
176 __attribute__((__aligned__(4))) \
177 __attribute__((section("_ftrace_events"))) \
178 event_enter_##sname = { \
179 .name = "sys_enter"#sname, \
180 .system = "syscalls", \
181 .event = &event_syscall_enter, \
182 .raw_init = init_enter_##sname, \
183 .show_format = syscall_enter_format, \
184 .define_fields = syscall_enter_define_fields, \
185 .regfunc = reg_event_syscall_enter, \
186 .unregfunc = unreg_event_syscall_enter, \
187 .data = "sys"#sname, \
188 TRACE_SYS_ENTER_PROFILE_INIT(sname) \
189 }
190
191#define SYSCALL_TRACE_EXIT_EVENT(sname) \
192 static struct ftrace_event_call event_exit_##sname; \
193 struct trace_event exit_syscall_print_##sname = { \
194 .trace = print_syscall_exit, \
195 }; \
196 static int init_exit_##sname(void) \
197 { \
198 int num, id; \
199 num = syscall_name_to_nr("sys"#sname); \
200 if (num < 0) \
201 return -ENOSYS; \
202 id = register_ftrace_event(&exit_syscall_print_##sname);\
203 if (!id) \
204 return -ENODEV; \
205 event_exit_##sname.id = id; \
206 set_syscall_exit_id(num, id); \
207 INIT_LIST_HEAD(&event_exit_##sname.fields); \
208 return 0; \
209 } \
210 TRACE_SYS_EXIT_PROFILE(sname); \
211 static struct ftrace_event_call __used \
212 __attribute__((__aligned__(4))) \
213 __attribute__((section("_ftrace_events"))) \
214 event_exit_##sname = { \
215 .name = "sys_exit"#sname, \
216 .system = "syscalls", \
217 .event = &event_syscall_exit, \
218 .raw_init = init_exit_##sname, \
219 .show_format = syscall_exit_format, \
220 .define_fields = syscall_exit_define_fields, \
221 .regfunc = reg_event_syscall_exit, \
222 .unregfunc = unreg_event_syscall_exit, \
223 .data = "sys"#sname, \
224 TRACE_SYS_EXIT_PROFILE_INIT(sname) \
225 }
226
115#define SYSCALL_METADATA(sname, nb) \ 227#define SYSCALL_METADATA(sname, nb) \
228 SYSCALL_TRACE_ENTER_EVENT(sname); \
229 SYSCALL_TRACE_EXIT_EVENT(sname); \
116 static const struct syscall_metadata __used \ 230 static const struct syscall_metadata __used \
117 __attribute__((__aligned__(4))) \ 231 __attribute__((__aligned__(4))) \
118 __attribute__((section("__syscalls_metadata"))) \ 232 __attribute__((section("__syscalls_metadata"))) \
@@ -121,18 +235,23 @@ struct perf_counter_attr;
121 .nb_args = nb, \ 235 .nb_args = nb, \
122 .types = types_##sname, \ 236 .types = types_##sname, \
123 .args = args_##sname, \ 237 .args = args_##sname, \
124 } 238 .enter_event = &event_enter_##sname, \
239 .exit_event = &event_exit_##sname, \
240 };
125 241
126#define SYSCALL_DEFINE0(sname) \ 242#define SYSCALL_DEFINE0(sname) \
243 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
244 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
127 static const struct syscall_metadata __used \ 245 static const struct syscall_metadata __used \
128 __attribute__((__aligned__(4))) \ 246 __attribute__((__aligned__(4))) \
129 __attribute__((section("__syscalls_metadata"))) \ 247 __attribute__((section("__syscalls_metadata"))) \
130 __syscall_meta_##sname = { \ 248 __syscall_meta_##sname = { \
131 .name = "sys_"#sname, \ 249 .name = "sys_"#sname, \
132 .nb_args = 0, \ 250 .nb_args = 0, \
251 .enter_event = &event_enter__##sname, \
252 .exit_event = &event_exit__##sname, \
133 }; \ 253 }; \
134 asmlinkage long sys_##sname(void) 254 asmlinkage long sys_##sname(void)
135
136#else 255#else
137#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 256#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
138#endif 257#endif
@@ -341,8 +460,7 @@ asmlinkage long sys_mount(char __user *dev_name, char __user *dir_name,
341 void __user *data); 460 void __user *data);
342asmlinkage long sys_umount(char __user *name, int flags); 461asmlinkage long sys_umount(char __user *name, int flags);
343asmlinkage long sys_oldumount(char __user *name); 462asmlinkage long sys_oldumount(char __user *name);
344asmlinkage long sys_truncate(const char __user *path, 463asmlinkage long sys_truncate(const char __user *path, long length);
345 unsigned long length);
346asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 464asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
347asmlinkage long sys_stat(char __user *filename, 465asmlinkage long sys_stat(char __user *filename,
348 struct __old_kernel_stat __user *statbuf); 466 struct __old_kernel_stat __user *statbuf);
@@ -758,7 +876,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
758int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 876int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
759 877
760 878
761asmlinkage long sys_perf_counter_open( 879asmlinkage long sys_perf_event_open(
762 struct perf_counter_attr __user *attr_uptr, 880 struct perf_event_attr __user *attr_uptr,
763 pid_t pid, int cpu, int group_fd, unsigned long flags); 881 pid_t pid, int cpu, int group_fd, unsigned long flags);
764#endif 882#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e76d3b22a466..1e4743ee6831 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/compiler.h> 30#include <linux/compiler.h>
31 31
32struct file;
33struct completion; 32struct completion;
34 33
35#define CTL_MAXNAME 10 /* how many path components do we allow in a 34#define CTL_MAXNAME 10 /* how many path components do we allow in a
@@ -977,25 +976,25 @@ typedef int ctl_handler (struct ctl_table *table,
977 void __user *oldval, size_t __user *oldlenp, 976 void __user *oldval, size_t __user *oldlenp,
978 void __user *newval, size_t newlen); 977 void __user *newval, size_t newlen);
979 978
980typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp, 979typedef int proc_handler (struct ctl_table *ctl, int write,
981 void __user *buffer, size_t *lenp, loff_t *ppos); 980 void __user *buffer, size_t *lenp, loff_t *ppos);
982 981
983extern int proc_dostring(struct ctl_table *, int, struct file *, 982extern int proc_dostring(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *); 983 void __user *, size_t *, loff_t *);
985extern int proc_dointvec(struct ctl_table *, int, struct file *, 984extern int proc_dointvec(struct ctl_table *, int,
986 void __user *, size_t *, loff_t *); 985 void __user *, size_t *, loff_t *);
987extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *, 986extern int proc_dointvec_minmax(struct ctl_table *, int,
988 void __user *, size_t *, loff_t *); 987 void __user *, size_t *, loff_t *);
989extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *, 988extern int proc_dointvec_jiffies(struct ctl_table *, int,
990 void __user *, size_t *, loff_t *); 989 void __user *, size_t *, loff_t *);
991extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, struct file *, 990extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int,
992 void __user *, size_t *, loff_t *); 991 void __user *, size_t *, loff_t *);
993extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, struct file *, 992extern int proc_dointvec_ms_jiffies(struct ctl_table *, int,
994 void __user *, size_t *, loff_t *); 993 void __user *, size_t *, loff_t *);
995extern int proc_doulongvec_minmax(struct ctl_table *, int, struct file *, 994extern int proc_doulongvec_minmax(struct ctl_table *, int,
996 void __user *, size_t *, loff_t *); 995 void __user *, size_t *, loff_t *);
997extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 996extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
998 struct file *, void __user *, size_t *, loff_t *); 997 void __user *, size_t *, loff_t *);
999 998
1000extern int do_sysctl (int __user *name, int nlen, 999extern int do_sysctl (int __user *name, int nlen,
1001 void __user *oldval, size_t __user *oldlenp, 1000 void __user *oldval, size_t __user *oldlenp,
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 7e9680f4afdd..3398f4553269 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -9,7 +9,6 @@
9 9
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <net/genetlink.h>
13 12
14#ifdef CONFIG_TASKSTATS 13#ifdef CONFIG_TASKSTATS
15extern struct kmem_cache *taskstats_cache; 14extern struct kmem_cache *taskstats_cache;
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
new file mode 100644
index 000000000000..bf2a0c748878
--- /dev/null
+++ b/include/linux/tboot.h
@@ -0,0 +1,162 @@
1/*
2 * tboot.h: shared data structure with tboot and kernel and functions
3 * used by kernel for runtime support of Intel(R) Trusted
4 * Execution Technology
5 *
6 * Copyright (c) 2006-2009, Intel Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef _LINUX_TBOOT_H
24#define _LINUX_TBOOT_H
25
26/* these must have the values from 0-5 in this order */
27enum {
28 TB_SHUTDOWN_REBOOT = 0,
29 TB_SHUTDOWN_S5,
30 TB_SHUTDOWN_S4,
31 TB_SHUTDOWN_S3,
32 TB_SHUTDOWN_HALT,
33 TB_SHUTDOWN_WFS
34};
35
36#ifdef CONFIG_INTEL_TXT
37#include <acpi/acpi.h>
38/* used to communicate between tboot and the launched kernel */
39
40#define TB_KEY_SIZE 64 /* 512 bits */
41
42#define MAX_TB_MAC_REGIONS 32
43
44struct tboot_mac_region {
45 u64 start; /* must be 64 byte -aligned */
46 u32 size; /* must be 64 byte -granular */
47} __packed;
48
49/* GAS - Generic Address Structure (ACPI 2.0+) */
50struct tboot_acpi_generic_address {
51 u8 space_id;
52 u8 bit_width;
53 u8 bit_offset;
54 u8 access_width;
55 u64 address;
56} __packed;
57
58/*
59 * combines Sx info from FADT and FACS tables per ACPI 2.0+ spec
60 * (http://www.acpi.info/)
61 */
62struct tboot_acpi_sleep_info {
63 struct tboot_acpi_generic_address pm1a_cnt_blk;
64 struct tboot_acpi_generic_address pm1b_cnt_blk;
65 struct tboot_acpi_generic_address pm1a_evt_blk;
66 struct tboot_acpi_generic_address pm1b_evt_blk;
67 u16 pm1a_cnt_val;
68 u16 pm1b_cnt_val;
69 u64 wakeup_vector;
70 u32 vector_width;
71 u64 kernel_s3_resume_vector;
72} __packed;
73
74/*
75 * shared memory page used for communication between tboot and kernel
76 */
77struct tboot {
78 /*
79 * version 3+ fields:
80 */
81
82 /* TBOOT_UUID */
83 u8 uuid[16];
84
85 /* version number: 5 is current */
86 u32 version;
87
88 /* physical addr of tb_log_t log */
89 u32 log_addr;
90
91 /*
92 * physical addr of entry point for tboot shutdown and
93 * type of shutdown (TB_SHUTDOWN_*) being requested
94 */
95 u32 shutdown_entry;
96 u32 shutdown_type;
97
98 /* kernel-specified ACPI info for Sx shutdown */
99 struct tboot_acpi_sleep_info acpi_sinfo;
100
101 /* tboot location in memory (physical) */
102 u32 tboot_base;
103 u32 tboot_size;
104
105 /* memory regions (phys addrs) for tboot to MAC on S3 */
106 u8 num_mac_regions;
107 struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
108
109
110 /*
111 * version 4+ fields:
112 */
113
114 /* symmetric key for use by kernel; will be encrypted on S3 */
115 u8 s3_key[TB_KEY_SIZE];
116
117
118 /*
119 * version 5+ fields:
120 */
121
122 /* used to 4byte-align num_in_wfs */
123 u8 reserved_align[3];
124
125 /* number of processors in wait-for-SIPI */
126 u32 num_in_wfs;
127} __packed;
128
129/*
130 * UUID for tboot data struct to facilitate matching
131 * defined as {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} by tboot, which is
132 * represented as {} in the char array used here
133 */
134#define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
135 0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
136
137extern struct tboot *tboot;
138
139static inline int tboot_enabled(void)
140{
141 return tboot != NULL;
142}
143
144extern void tboot_probe(void);
145extern void tboot_shutdown(u32 shutdown_type);
146extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
147extern struct acpi_table_header *tboot_get_dmar_table(
148 struct acpi_table_header *dmar_tbl);
149extern int tboot_force_iommu(void);
150
151#else
152
153#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
156 do { } while (0)
157#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
158#define tboot_force_iommu() 0
159
160#endif /* !CONFIG_INTEL_TXT */
161
162#endif /* _LINUX_TBOOT_H */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8afac76cd748..61723a7c21fe 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -233,7 +233,7 @@ struct tcp_request_sock {
233 struct inet_request_sock req; 233 struct inet_request_sock req;
234#ifdef CONFIG_TCP_MD5SIG 234#ifdef CONFIG_TCP_MD5SIG
235 /* Only used by TCP MD5 Signature so far. */ 235 /* Only used by TCP MD5 Signature so far. */
236 struct tcp_request_sock_ops *af_specific; 236 const struct tcp_request_sock_ops *af_specific;
237#endif 237#endif
238 u32 rcv_isn; 238 u32 rcv_isn;
239 u32 snt_isn; 239 u32 snt_isn;
@@ -401,9 +401,9 @@ struct tcp_sock {
401 401
402#ifdef CONFIG_TCP_MD5SIG 402#ifdef CONFIG_TCP_MD5SIG
403/* TCP AF-Specific parts; only used by MD5 Signature support so far */ 403/* TCP AF-Specific parts; only used by MD5 Signature support so far */
404 struct tcp_sock_af_ops *af_specific; 404 const struct tcp_sock_af_ops *af_specific;
405 405
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signature Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409}; 409};
diff --git a/include/linux/time.h b/include/linux/time.h
index ea16c1a01d51..fe04e5ef6a59 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
75 const unsigned int day, const unsigned int hour, 75 const unsigned int day, const unsigned int hour,
76 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
77 77
78extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
79extern struct timespec timespec_add_safe(const struct timespec lhs, 79extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs); 80 const struct timespec rhs);
81 81
@@ -101,7 +101,8 @@ extern struct timespec xtime;
101extern struct timespec wall_to_monotonic; 101extern struct timespec wall_to_monotonic;
102extern seqlock_t xtime_lock; 102extern seqlock_t xtime_lock;
103 103
104extern unsigned long read_persistent_clock(void); 104extern void read_persistent_clock(struct timespec *ts);
105extern void read_boot_clock(struct timespec *ts);
105extern int update_persistent_clock(struct timespec now); 106extern int update_persistent_clock(struct timespec now);
106extern int no_sync_cmos_clock __read_mostly; 107extern int no_sync_cmos_clock __read_mostly;
107void timekeeping_init(void); 108void timekeeping_init(void);
@@ -109,6 +110,8 @@ extern int timekeeping_suspended;
109 110
110unsigned long get_seconds(void); 111unsigned long get_seconds(void);
111struct timespec current_kernel_time(void); 112struct timespec current_kernel_time(void);
113struct timespec __current_kernel_time(void); /* does not hold xtime_lock */
114struct timespec get_monotonic_coarse(void);
112 115
113#define CURRENT_TIME (current_kernel_time()) 116#define CURRENT_TIME (current_kernel_time())
114#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 117#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -147,10 +150,39 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
147extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
148extern void update_wall_time(void); 151extern void update_wall_time(void);
149extern void update_xtime_cache(u64 nsec); 152extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond);
150 154
151struct tms; 155struct tms;
152extern void do_sys_times(struct tms *); 156extern void do_sys_times(struct tms *);
153 157
158/*
159 * Similar to the struct tm in userspace <time.h>, but it needs to be here so
160 * that the kernel source is self contained.
161 */
162struct tm {
163 /*
164 * the number of seconds after the minute, normally in the range
165 * 0 to 59, but can be up to 60 to allow for leap seconds
166 */
167 int tm_sec;
168 /* the number of minutes after the hour, in the range 0 to 59*/
169 int tm_min;
170 /* the number of hours past midnight, in the range 0 to 23 */
171 int tm_hour;
172 /* the day of the month, in the range 1 to 31 */
173 int tm_mday;
174 /* the number of months since January, in the range 0 to 11 */
175 int tm_mon;
176 /* the number of years since 1900 */
177 long tm_year;
178 /* the number of days since Sunday, in the range 0 to 6 */
179 int tm_wday;
180 /* the number of days since January 1, in the range 0 to 365 */
181 int tm_yday;
182};
183
184void time_to_tm(time_t totalsecs, int offset, struct tm *result);
185
154/** 186/**
155 * timespec_to_ns - Convert timespec to nanoseconds 187 * timespec_to_ns - Convert timespec to nanoseconds
156 * @ts: pointer to the timespec variable to be converted 188 * @ts: pointer to the timespec variable to be converted
@@ -241,6 +273,8 @@ struct itimerval {
241#define CLOCK_PROCESS_CPUTIME_ID 2 273#define CLOCK_PROCESS_CPUTIME_ID 2
242#define CLOCK_THREAD_CPUTIME_ID 3 274#define CLOCK_THREAD_CPUTIME_ID 3
243#define CLOCK_MONOTONIC_RAW 4 275#define CLOCK_MONOTONIC_RAW 4
276#define CLOCK_REALTIME_COARSE 5
277#define CLOCK_MONOTONIC_COARSE 6
244 278
245/* 279/*
246 * The IDs of various hardware clocks: 280 * The IDs of various hardware clocks:
diff --git a/include/linux/timer.h b/include/linux/timer.h
index be62ec2ebea5..a2d1eb6cb3f0 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -175,11 +175,6 @@ extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
175 175
176/* 176/*
177 * Return when the next timer-wheel timeout occurs (in absolute jiffies), 177 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
178 * locks the timer base:
179 */
180extern unsigned long next_timer_interrupt(void);
181/*
182 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
183 * locks the timer base and does the comparison against the given 178 * locks the timer base and does the comparison against the given
184 * jiffie. 179 * jiffie.
185 */ 180 */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index bea469455a0c..3d92396639de 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -209,5 +209,7 @@ struct sockaddr_tipc {
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
213#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
212 214
213#endif 215#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 7402c1a27c4f..57e63579bfdd 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -85,20 +85,27 @@ int arch_update_cpu_topology(void);
85#define ARCH_HAS_SCHED_WAKE_IDLE 85#define ARCH_HAS_SCHED_WAKE_IDLE
86/* Common values for SMT siblings */ 86/* Common values for SMT siblings */
87#ifndef SD_SIBLING_INIT 87#ifndef SD_SIBLING_INIT
88#define SD_SIBLING_INIT (struct sched_domain) { \ 88#define SD_SIBLING_INIT (struct sched_domain) { \
89 .min_interval = 1, \ 89 .min_interval = 1, \
90 .max_interval = 2, \ 90 .max_interval = 2, \
91 .busy_factor = 64, \ 91 .busy_factor = 64, \
92 .imbalance_pct = 110, \ 92 .imbalance_pct = 110, \
93 .flags = SD_LOAD_BALANCE \ 93 \
94 | SD_BALANCE_NEWIDLE \ 94 .flags = 1*SD_LOAD_BALANCE \
95 | SD_BALANCE_FORK \ 95 | 1*SD_BALANCE_NEWIDLE \
96 | SD_BALANCE_EXEC \ 96 | 1*SD_BALANCE_EXEC \
97 | SD_WAKE_AFFINE \ 97 | 1*SD_BALANCE_FORK \
98 | SD_WAKE_BALANCE \ 98 | 0*SD_BALANCE_WAKE \
99 | SD_SHARE_CPUPOWER, \ 99 | 1*SD_WAKE_AFFINE \
100 .last_balance = jiffies, \ 100 | 1*SD_SHARE_CPUPOWER \
101 .balance_interval = 1, \ 101 | 0*SD_POWERSAVINGS_BALANCE \
102 | 0*SD_SHARE_PKG_RESOURCES \
103 | 0*SD_SERIALIZE \
104 | 0*SD_PREFER_SIBLING \
105 , \
106 .last_balance = jiffies, \
107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \
102} 109}
103#endif 110#endif
104#endif /* CONFIG_SCHED_SMT */ 111#endif /* CONFIG_SCHED_SMT */
@@ -106,69 +113,90 @@ int arch_update_cpu_topology(void);
106#ifdef CONFIG_SCHED_MC 113#ifdef CONFIG_SCHED_MC
107/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */ 114/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
108#ifndef SD_MC_INIT 115#ifndef SD_MC_INIT
109#define SD_MC_INIT (struct sched_domain) { \ 116#define SD_MC_INIT (struct sched_domain) { \
110 .min_interval = 1, \ 117 .min_interval = 1, \
111 .max_interval = 4, \ 118 .max_interval = 4, \
112 .busy_factor = 64, \ 119 .busy_factor = 64, \
113 .imbalance_pct = 125, \ 120 .imbalance_pct = 125, \
114 .cache_nice_tries = 1, \ 121 .cache_nice_tries = 1, \
115 .busy_idx = 2, \ 122 .busy_idx = 2, \
116 .wake_idx = 1, \ 123 .wake_idx = 0, \
117 .forkexec_idx = 1, \ 124 .forkexec_idx = 0, \
118 .flags = SD_LOAD_BALANCE \ 125 \
119 | SD_BALANCE_FORK \ 126 .flags = 1*SD_LOAD_BALANCE \
120 | SD_BALANCE_EXEC \ 127 | 1*SD_BALANCE_NEWIDLE \
121 | SD_WAKE_AFFINE \ 128 | 1*SD_BALANCE_EXEC \
122 | SD_WAKE_BALANCE \ 129 | 1*SD_BALANCE_FORK \
123 | SD_SHARE_PKG_RESOURCES\ 130 | 0*SD_BALANCE_WAKE \
124 | sd_balance_for_mc_power()\ 131 | 1*SD_WAKE_AFFINE \
125 | sd_power_saving_flags(),\ 132 | 0*SD_PREFER_LOCAL \
126 .last_balance = jiffies, \ 133 | 0*SD_SHARE_CPUPOWER \
127 .balance_interval = 1, \ 134 | 1*SD_SHARE_PKG_RESOURCES \
135 | 0*SD_SERIALIZE \
136 | sd_balance_for_mc_power() \
137 | sd_power_saving_flags() \
138 , \
139 .last_balance = jiffies, \
140 .balance_interval = 1, \
128} 141}
129#endif 142#endif
130#endif /* CONFIG_SCHED_MC */ 143#endif /* CONFIG_SCHED_MC */
131 144
132/* Common values for CPUs */ 145/* Common values for CPUs */
133#ifndef SD_CPU_INIT 146#ifndef SD_CPU_INIT
134#define SD_CPU_INIT (struct sched_domain) { \ 147#define SD_CPU_INIT (struct sched_domain) { \
135 .min_interval = 1, \ 148 .min_interval = 1, \
136 .max_interval = 4, \ 149 .max_interval = 4, \
137 .busy_factor = 64, \ 150 .busy_factor = 64, \
138 .imbalance_pct = 125, \ 151 .imbalance_pct = 125, \
139 .cache_nice_tries = 1, \ 152 .cache_nice_tries = 1, \
140 .busy_idx = 2, \ 153 .busy_idx = 2, \
141 .idle_idx = 1, \ 154 .idle_idx = 1, \
142 .newidle_idx = 2, \ 155 .newidle_idx = 0, \
143 .wake_idx = 1, \ 156 .wake_idx = 0, \
144 .forkexec_idx = 1, \ 157 .forkexec_idx = 0, \
145 .flags = SD_LOAD_BALANCE \ 158 \
146 | SD_BALANCE_EXEC \ 159 .flags = 1*SD_LOAD_BALANCE \
147 | SD_BALANCE_FORK \ 160 | 1*SD_BALANCE_NEWIDLE \
148 | SD_WAKE_AFFINE \ 161 | 1*SD_BALANCE_EXEC \
149 | SD_WAKE_BALANCE \ 162 | 1*SD_BALANCE_FORK \
150 | sd_balance_for_package_power()\ 163 | 0*SD_BALANCE_WAKE \
151 | sd_power_saving_flags(),\ 164 | 1*SD_WAKE_AFFINE \
152 .last_balance = jiffies, \ 165 | 0*SD_PREFER_LOCAL \
153 .balance_interval = 1, \ 166 | 0*SD_SHARE_CPUPOWER \
167 | 0*SD_SHARE_PKG_RESOURCES \
168 | 0*SD_SERIALIZE \
169 | sd_balance_for_package_power() \
170 | sd_power_saving_flags() \
171 , \
172 .last_balance = jiffies, \
173 .balance_interval = 1, \
154} 174}
155#endif 175#endif
156 176
157/* sched_domains SD_ALLNODES_INIT for NUMA machines */ 177/* sched_domains SD_ALLNODES_INIT for NUMA machines */
158#define SD_ALLNODES_INIT (struct sched_domain) { \ 178#define SD_ALLNODES_INIT (struct sched_domain) { \
159 .min_interval = 64, \ 179 .min_interval = 64, \
160 .max_interval = 64*num_online_cpus(), \ 180 .max_interval = 64*num_online_cpus(), \
161 .busy_factor = 128, \ 181 .busy_factor = 128, \
162 .imbalance_pct = 133, \ 182 .imbalance_pct = 133, \
163 .cache_nice_tries = 1, \ 183 .cache_nice_tries = 1, \
164 .busy_idx = 3, \ 184 .busy_idx = 3, \
165 .idle_idx = 3, \ 185 .idle_idx = 3, \
166 .flags = SD_LOAD_BALANCE \ 186 .flags = 1*SD_LOAD_BALANCE \
167 | SD_BALANCE_NEWIDLE \ 187 | 1*SD_BALANCE_NEWIDLE \
168 | SD_WAKE_AFFINE \ 188 | 0*SD_BALANCE_EXEC \
169 | SD_SERIALIZE, \ 189 | 0*SD_BALANCE_FORK \
170 .last_balance = jiffies, \ 190 | 0*SD_BALANCE_WAKE \
171 .balance_interval = 64, \ 191 | 0*SD_WAKE_AFFINE \
192 | 0*SD_SHARE_CPUPOWER \
193 | 0*SD_POWERSAVINGS_BALANCE \
194 | 0*SD_SHARE_PKG_RESOURCES \
195 | 1*SD_SERIALIZE \
196 | 0*SD_PREFER_SIBLING \
197 , \
198 .last_balance = jiffies, \
199 .balance_interval = 64, \
172} 200}
173 201
174#ifdef CONFIG_NUMA 202#ifdef CONFIG_NUMA
@@ -183,12 +211,6 @@ int arch_update_cpu_topology(void);
183#ifndef topology_core_id 211#ifndef topology_core_id
184#define topology_core_id(cpu) ((void)(cpu), 0) 212#define topology_core_id(cpu) ((void)(cpu), 0)
185#endif 213#endif
186#ifndef topology_thread_siblings
187#define topology_thread_siblings(cpu) cpumask_of_cpu(cpu)
188#endif
189#ifndef topology_core_siblings
190#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
191#endif
192#ifndef topology_thread_cpumask 214#ifndef topology_thread_cpumask
193#define topology_thread_cpumask(cpu) cpumask_of(cpu) 215#define topology_thread_cpumask(cpu) cpumask_of(cpu)
194#endif 216#endif
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index c134dd1fe6b6..09077f6ed128 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -7,7 +7,7 @@
7 7
8/* 8/*
9 * Trace sequences are used to allow a function to call several other functions 9 * Trace sequences are used to allow a function to call several other functions
10 * to create a string of data to use (up to a max of PAGE_SIZE. 10 * to create a string of data to use (up to a max of PAGE_SIZE).
11 */ 11 */
12 12
13struct trace_seq { 13struct trace_seq {
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 17ba82efa483..1eb44a924e56 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tracing hooks 2 * Tracing hooks
3 * 3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved. 4 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5 * 5 *
6 * This copyrighted material is made available to anyone wishing to use, 6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions 7 * modify, copy, or redistribute it subject to the terms and conditions
@@ -463,22 +463,38 @@ static inline int tracehook_get_signal(struct task_struct *task,
463 463
464/** 464/**
465 * tracehook_notify_jctl - report about job control stop/continue 465 * tracehook_notify_jctl - report about job control stop/continue
466 * @notify: nonzero if this is the last thread in the group to stop 466 * @notify: zero, %CLD_STOPPED or %CLD_CONTINUED
467 * @why: %CLD_STOPPED or %CLD_CONTINUED 467 * @why: %CLD_STOPPED or %CLD_CONTINUED
468 * 468 *
469 * This is called when we might call do_notify_parent_cldstop(). 469 * This is called when we might call do_notify_parent_cldstop().
470 * It's called when about to stop for job control; we are already in
471 * %TASK_STOPPED state, about to call schedule(). It's also called when
472 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
473 * 470 *
474 * Return nonzero to generate a %SIGCHLD with @why, which is 471 * @notify is zero if we would not ordinarily send a %SIGCHLD,
475 * normal if @notify is nonzero. 472 * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
476 * 473 *
477 * Called with no locks held. 474 * @why is %CLD_STOPPED when about to stop for job control;
475 * we are already in %TASK_STOPPED state, about to call schedule().
476 * It might also be that we have just exited (check %PF_EXITING),
477 * but need to report that a group-wide stop is complete.
478 *
479 * @why is %CLD_CONTINUED when waking up after job control stop and
480 * ready to make a delayed @notify report.
481 *
482 * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
483 *
484 * Called with the siglock held.
478 */ 485 */
479static inline int tracehook_notify_jctl(int notify, int why) 486static inline int tracehook_notify_jctl(int notify, int why)
480{ 487{
481 return notify || (current->ptrace & PT_PTRACED); 488 return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
489}
490
491/**
492 * tracehook_finish_jctl - report about return from job control stop
493 *
494 * This is called by do_signal_stop() after wakeup.
495 */
496static inline void tracehook_finish_jctl(void)
497{
482} 498}
483 499
484#define DEATH_REAP -1 500#define DEATH_REAP -1
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index b9dc4ca0246f..2aac8a83e89b 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -4,7 +4,7 @@
4/* 4/*
5 * Kernel Tracepoint API. 5 * Kernel Tracepoint API.
6 * 6 *
7 * See Documentation/tracepoint.txt. 7 * See Documentation/trace/tracepoints.txt.
8 * 8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> 9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 * 10 *
@@ -23,6 +23,8 @@ struct tracepoint;
23struct tracepoint { 23struct tracepoint {
24 const char *name; /* Tracepoint name */ 24 const char *name; /* Tracepoint name */
25 int state; /* State. */ 25 int state; /* State. */
26 void (*regfunc)(void);
27 void (*unregfunc)(void);
26 void **funcs; 28 void **funcs;
27} __attribute__((aligned(32))); /* 29} __attribute__((aligned(32))); /*
28 * Aligned on 32 bytes because it is 30 * Aligned on 32 bytes because it is
@@ -34,7 +36,7 @@ struct tracepoint {
34#ifndef DECLARE_TRACE 36#ifndef DECLARE_TRACE
35 37
36#define TP_PROTO(args...) args 38#define TP_PROTO(args...) args
37#define TP_ARGS(args...) args 39#define TP_ARGS(args...) args
38 40
39#ifdef CONFIG_TRACEPOINTS 41#ifdef CONFIG_TRACEPOINTS
40 42
@@ -78,12 +80,16 @@ struct tracepoint {
78 return tracepoint_probe_unregister(#name, (void *)probe);\ 80 return tracepoint_probe_unregister(#name, (void *)probe);\
79 } 81 }
80 82
81#define DEFINE_TRACE(name) \ 83
84#define DEFINE_TRACE_FN(name, reg, unreg) \
82 static const char __tpstrtab_##name[] \ 85 static const char __tpstrtab_##name[] \
83 __attribute__((section("__tracepoints_strings"))) = #name; \ 86 __attribute__((section("__tracepoints_strings"))) = #name; \
84 struct tracepoint __tracepoint_##name \ 87 struct tracepoint __tracepoint_##name \
85 __attribute__((section("__tracepoints"), aligned(32))) = \ 88 __attribute__((section("__tracepoints"), aligned(32))) = \
86 { __tpstrtab_##name, 0, NULL } 89 { __tpstrtab_##name, 0, reg, unreg, NULL }
90
91#define DEFINE_TRACE(name) \
92 DEFINE_TRACE_FN(name, NULL, NULL);
87 93
88#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \ 94#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
89 EXPORT_SYMBOL_GPL(__tracepoint_##name) 95 EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -108,6 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
108 return -ENOSYS; \ 114 return -ENOSYS; \
109 } 115 }
110 116
117#define DEFINE_TRACE_FN(name, reg, unreg)
111#define DEFINE_TRACE(name) 118#define DEFINE_TRACE(name)
112#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
113#define EXPORT_TRACEPOINT_SYMBOL(name) 120#define EXPORT_TRACEPOINT_SYMBOL(name)
@@ -158,6 +165,15 @@ static inline void tracepoint_synchronize_unregister(void)
158 165
159#define PARAMS(args...) args 166#define PARAMS(args...) args
160 167
168#endif /* _LINUX_TRACEPOINT_H */
169
170/*
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
161#ifndef TRACE_EVENT 177#ifndef TRACE_EVENT
162/* 178/*
163 * For use with the TRACE_EVENT macro: 179 * For use with the TRACE_EVENT macro:
@@ -259,10 +275,15 @@ static inline void tracepoint_synchronize_unregister(void)
259 * can also by used by generic instrumentation like SystemTap), and 275 * can also by used by generic instrumentation like SystemTap), and
260 * it is also used to expose a structured trace record in 276 * it is also used to expose a structured trace record in
261 * /sys/kernel/debug/tracing/events/. 277 * /sys/kernel/debug/tracing/events/.
278 *
279 * A set of (un)registration functions can be passed to the variant
280 * TRACE_EVENT_FN to perform any (un)registration work.
262 */ 281 */
263 282
264#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 283#define TRACE_EVENT(name, proto, args, struct, assign, print) \
265 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 284 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
266#endif 285#define TRACE_EVENT_FN(name, proto, args, struct, \
286 assign, print, reg, unreg) \
287 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
267 288
268#endif 289#endif /* ifdef TRACE_EVENT (see note above) */
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index eaec1ea9558e..9ae8da3e6407 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -55,7 +55,7 @@ struct anon_transport_class cls = { \
55 55
56struct transport_container { 56struct transport_container {
57 struct attribute_container ac; 57 struct attribute_container ac;
58 struct attribute_group *statistics; 58 const struct attribute_group *statistics;
59}; 59};
60 60
61#define attribute_container_to_transport_container(x) \ 61#define attribute_container_to_transport_container(x) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e8c6c9136c97..f0f43d08d8b8 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 19 26#define NR_LDISCS 20
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -47,6 +47,8 @@
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 49
50#define N_V253 19 /* Codec control over voice modem */
51
50/* 52/*
51 * This character is the same as _POSIX_VDISABLE: it cannot be used as 53 * This character is the same as _POSIX_VDISABLE: it cannot be used as
52 * a c_cc[] character, but indicates that a particular special character 54 * a c_cc[] character, but indicates that a particular special character
@@ -185,7 +187,12 @@ struct tty_port;
185struct tty_port_operations { 187struct tty_port_operations {
186 /* Return 1 if the carrier is raised */ 188 /* Return 1 if the carrier is raised */
187 int (*carrier_raised)(struct tty_port *port); 189 int (*carrier_raised)(struct tty_port *port);
190 /* Control the DTR line */
188 void (*dtr_rts)(struct tty_port *port, int raise); 191 void (*dtr_rts)(struct tty_port *port, int raise);
192 /* Called when the last close completes or a hangup finishes
193 IFF the port was initialized. Do not use to free resources */
194 void (*shutdown)(struct tty_port *port);
195 void (*drop)(struct tty_port *port);
189}; 196};
190 197
191struct tty_port { 198struct tty_port {
@@ -196,11 +203,12 @@ struct tty_port {
196 int count; /* Usage count */ 203 int count; /* Usage count */
197 wait_queue_head_t open_wait; /* Open waiters */ 204 wait_queue_head_t open_wait; /* Open waiters */
198 wait_queue_head_t close_wait; /* Close waiters */ 205 wait_queue_head_t close_wait; /* Close waiters */
206 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 207 unsigned long flags; /* TTY flags ASY_*/
200 struct mutex mutex; /* Locking */ 208 struct mutex mutex; /* Locking */
201 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */
202 int close_delay; /* Close port delay */ 210 unsigned int close_delay; /* Close port delay */
203 int closing_wait; /* Delay for output */ 211 unsigned int closing_wait; /* Delay for output */
204 int drain_delay; /* Set to zero if no pure time 212 int drain_delay; /* Set to zero if no pure time
205 based drain is needed else 213 based drain is needed else
206 set to size of fifo */ 214 set to size of fifo */
@@ -457,6 +465,12 @@ extern int tty_port_block_til_ready(struct tty_port *port,
457extern int tty_port_close_start(struct tty_port *port, 465extern int tty_port_close_start(struct tty_port *port,
458 struct tty_struct *tty, struct file *filp); 466 struct tty_struct *tty, struct file *filp);
459extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 467extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
468extern void tty_port_close(struct tty_port *port,
469 struct tty_struct *tty, struct file *filp);
470extern inline int tty_port_users(struct tty_port *port)
471{
472 return port->count + port->blocked_open;
473}
460 474
461extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 475extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
462extern int tty_unregister_ldisc(int disc); 476extern int tty_unregister_ldisc(int disc);
@@ -517,14 +531,13 @@ extern void serial_console_init(void);
517 531
518extern int pcxe_open(struct tty_struct *tty, struct file *filp); 532extern int pcxe_open(struct tty_struct *tty, struct file *filp);
519 533
520/* printk.c */
521
522extern void console_print(const char *);
523
524/* vt.c */ 534/* vt.c */
525 535
526extern int vt_ioctl(struct tty_struct *tty, struct file *file, 536extern int vt_ioctl(struct tty_struct *tty, struct file *file,
527 unsigned int cmd, unsigned long arg); 537 unsigned int cmd, unsigned long arg);
528 538
539extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
540 unsigned int cmd, unsigned long arg);
541
529#endif /* __KERNEL__ */ 542#endif /* __KERNEL__ */
530#endif 543#endif
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 3566129384a4..b08677982525 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -45,8 +45,16 @@
45 * 45 *
46 * void (*shutdown)(struct tty_struct * tty); 46 * void (*shutdown)(struct tty_struct * tty);
47 * 47 *
48 * This routine is called when a particular tty device is closed for 48 * This routine is called synchronously when a particular tty device
49 * the last time freeing up the resources. 49 * is closed for the last time freeing up the resources.
50 *
51 *
52 * void (*cleanup)(struct tty_struct * tty);
53 *
54 * This routine is called asynchronously when a particular tty device
55 * is closed for the last time freeing up the resources. This is
56 * actually the second part of shutdown for routines that might sleep.
57 *
50 * 58 *
51 * int (*write)(struct tty_struct * tty, 59 * int (*write)(struct tty_struct * tty,
52 * const unsigned char *buf, int count); 60 * const unsigned char *buf, int count);
@@ -233,6 +241,7 @@ struct tty_operations {
233 int (*open)(struct tty_struct * tty, struct file * filp); 241 int (*open)(struct tty_struct * tty, struct file * filp);
234 void (*close)(struct tty_struct * tty, struct file * filp); 242 void (*close)(struct tty_struct * tty, struct file * filp);
235 void (*shutdown)(struct tty_struct *tty); 243 void (*shutdown)(struct tty_struct *tty);
244 void (*cleanup)(struct tty_struct *tty);
236 int (*write)(struct tty_struct * tty, 245 int (*write)(struct tty_struct * tty,
237 const unsigned char *buf, int count); 246 const unsigned char *buf, int count);
238 int (*put_char)(struct tty_struct *tty, unsigned char ch); 247 int (*put_char)(struct tty_struct *tty, unsigned char ch);
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index ae779bb8cc0f..adb44066680c 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -26,6 +26,7 @@
26#include <sound/ac97_codec.h> 26#include <sound/ac97_codec.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h>
29 30
30/* 31/*
31 * UCB1400 AC-link registers 32 * UCB1400 AC-link registers
@@ -82,6 +83,17 @@
82#define UCB_ID 0x7e 83#define UCB_ID 0x7e
83#define UCB_ID_1400 0x4304 84#define UCB_ID_1400 0x4304
84 85
86struct ucb1400_gpio_data {
87 int gpio_offset;
88 int (*gpio_setup)(struct device *dev, int ngpio);
89 int (*gpio_teardown)(struct device *dev, int ngpio);
90};
91
92struct ucb1400_gpio {
93 struct gpio_chip gc;
94 struct snd_ac97 *ac97;
95};
96
85struct ucb1400_ts { 97struct ucb1400_ts {
86 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
87 struct task_struct *ts_task; 99 struct task_struct *ts_task;
@@ -95,6 +107,7 @@ struct ucb1400_ts {
95 107
96struct ucb1400 { 108struct ucb1400 {
97 struct platform_device *ucb1400_ts; 109 struct platform_device *ucb1400_ts;
110 struct platform_device *ucb1400_gpio;
98}; 111};
99 112
100static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg) 113static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
@@ -147,4 +160,10 @@ static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
147unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel, 160unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
148 int adcsync); 161 int adcsync);
149 162
163#ifdef CONFIG_GPIO_UCB1400
164void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data);
165#else
166static inline void ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) {}
167#endif
168
150#endif 169#endif
diff --git a/include/linux/unaligned/be_byteshift.h b/include/linux/unaligned/be_byteshift.h
index 46dd12c5709e..9356b24223ac 100644
--- a/include/linux/unaligned/be_byteshift.h
+++ b/include/linux/unaligned/be_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_BE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_be16(const u8 *p) 6static inline u16 __get_unaligned_be16(const u8 *p)
7{ 7{
diff --git a/include/linux/unaligned/le_byteshift.h b/include/linux/unaligned/le_byteshift.h
index 59777e951baf..be376fb79b64 100644
--- a/include/linux/unaligned/le_byteshift.h
+++ b/include/linux/unaligned/le_byteshift.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H 1#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H
2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H 2#define _LINUX_UNALIGNED_LE_BYTESHIFT_H
3 3
4#include <linux/kernel.h> 4#include <linux/types.h>
5 5
6static inline u16 __get_unaligned_le16(const u8 *p) 6static inline u16 __get_unaligned_le16(const u8 *p)
7{ 7{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index b1e3c2fbfe11..a34fa89f1474 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -195,7 +195,7 @@ struct usb_interface {
195 195
196 struct device dev; /* interface specific device info */ 196 struct device dev; /* interface specific device info */
197 struct device *usb_dev; 197 struct device *usb_dev;
198 int pm_usage_cnt; /* usage counter for autosuspend */ 198 atomic_t pm_usage_cnt; /* usage counter for autosuspend */
199 struct work_struct reset_ws; /* for resets in atomic context */ 199 struct work_struct reset_ws; /* for resets in atomic context */
200}; 200};
201#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 201#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
@@ -551,13 +551,13 @@ extern void usb_autopm_put_interface_async(struct usb_interface *intf);
551 551
552static inline void usb_autopm_enable(struct usb_interface *intf) 552static inline void usb_autopm_enable(struct usb_interface *intf)
553{ 553{
554 intf->pm_usage_cnt = 0; 554 atomic_set(&intf->pm_usage_cnt, 0);
555 usb_autopm_set_interface(intf); 555 usb_autopm_set_interface(intf);
556} 556}
557 557
558static inline void usb_autopm_disable(struct usb_interface *intf) 558static inline void usb_autopm_disable(struct usb_interface *intf)
559{ 559{
560 intf->pm_usage_cnt = 1; 560 atomic_set(&intf->pm_usage_cnt, 1);
561 usb_autopm_set_interface(intf); 561 usb_autopm_set_interface(intf);
562} 562}
563 563
@@ -922,7 +922,7 @@ extern struct bus_type usb_bus_type;
922/** 922/**
923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 923 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
924 * @name: the usb class device name for this driver. Will show up in sysfs. 924 * @name: the usb class device name for this driver. Will show up in sysfs.
925 * @nodename: Callback to provide a naming hint for a possible 925 * @devnode: Callback to provide a naming hint for a possible
926 * device node to create. 926 * device node to create.
927 * @fops: pointer to the struct file_operations of this driver. 927 * @fops: pointer to the struct file_operations of this driver.
928 * @minor_base: the start of the minor range for this driver. 928 * @minor_base: the start of the minor range for this driver.
@@ -933,7 +933,7 @@ extern struct bus_type usb_bus_type;
933 */ 933 */
934struct usb_class_driver { 934struct usb_class_driver {
935 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev); 936 char *(*devnode)(struct device *dev, mode_t *mode);
937 const struct file_operations *fops; 937 const struct file_operations *fops;
938 int minor_base; 938 int minor_base;
939}; 939};
@@ -1036,9 +1036,10 @@ typedef void (*usb_complete_t)(struct urb *);
1036 * @transfer_flags: A variety of flags may be used to affect how URB 1036 * @transfer_flags: A variety of flags may be used to affect how URB
1037 * submission, unlinking, or operation are handled. Different 1037 * submission, unlinking, or operation are handled. Different
1038 * kinds of URB can use different flags. 1038 * kinds of URB can use different flags.
1039 * @transfer_buffer: This identifies the buffer to (or from) which 1039 * @transfer_buffer: This identifies the buffer to (or from) which the I/O
1040 * the I/O request will be performed (unless URB_NO_TRANSFER_DMA_MAP 1040 * request will be performed unless URB_NO_TRANSFER_DMA_MAP is set
1041 * is set). This buffer must be suitable for DMA; allocate it with 1041 * (however, do not leave garbage in transfer_buffer even then).
1042 * This buffer must be suitable for DMA; allocate it with
1042 * kmalloc() or equivalent. For transfers to "in" endpoints, contents 1043 * kmalloc() or equivalent. For transfers to "in" endpoints, contents
1043 * of this buffer will be modified. This buffer is used for the data 1044 * of this buffer will be modified. This buffer is used for the data
1044 * stage of control transfers. 1045 * stage of control transfers.
@@ -1071,7 +1072,7 @@ typedef void (*usb_complete_t)(struct urb *);
1071 * @start_frame: Returns the initial frame for isochronous transfers. 1072 * @start_frame: Returns the initial frame for isochronous transfers.
1072 * @number_of_packets: Lists the number of ISO transfer buffers. 1073 * @number_of_packets: Lists the number of ISO transfer buffers.
1073 * @interval: Specifies the polling interval for interrupt or isochronous 1074 * @interval: Specifies the polling interval for interrupt or isochronous
1074 * transfers. The units are frames (milliseconds) for for full and low 1075 * transfers. The units are frames (milliseconds) for full and low
1075 * speed devices, and microframes (1/8 millisecond) for highspeed ones. 1076 * speed devices, and microframes (1/8 millisecond) for highspeed ones.
1076 * @error_count: Returns the number of ISO transfers that reported errors. 1077 * @error_count: Returns the number of ISO transfers that reported errors.
1077 * @context: For use in completion functions. This normally points to 1078 * @context: For use in completion functions. This normally points to
@@ -1104,9 +1105,15 @@ typedef void (*usb_complete_t)(struct urb *);
1104 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). 1105 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map().
1105 * When these transfer flags are provided, host controller drivers will 1106 * When these transfer flags are provided, host controller drivers will
1106 * attempt to use the dma addresses found in the transfer_dma and/or 1107 * attempt to use the dma addresses found in the transfer_dma and/or
1107 * setup_dma fields rather than determining a dma address themselves. (Note 1108 * setup_dma fields rather than determining a dma address themselves.
1108 * that transfer_buffer and setup_packet must still be set because not all 1109 *
1109 * host controllers use DMA, nor do virtual root hubs). 1110 * Note that transfer_buffer must still be set if the controller
1111 * does not support DMA (as indicated by bus.uses_dma) and when talking
1112 * to root hub. If you have to trasfer between highmem zone and the device
1113 * on such controller, create a bounce buffer or bail out with an error.
1114 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA
1115 * capable, assign NULL to it, so that usbmon knows not to use the value.
1116 * The setup_packet must always be set, so it cannot be located in highmem.
1110 * 1117 *
1111 * Initialization: 1118 * Initialization:
1112 * 1119 *
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index b5744bc218ab..eaf9dffe0a01 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,88 +24,78 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff 27
28 28/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/ 29#define UAC_HEADER 0x01
30#define HEADER 0x01 30#define UAC_INPUT_TERMINAL 0x02
31#define INPUT_TERMINAL 0x02 31#define UAC_OUTPUT_TERMINAL 0x03
32#define OUTPUT_TERMINAL 0x03 32#define UAC_MIXER_UNIT 0x04
33#define MIXER_UNIT 0x04 33#define UAC_SELECTOR_UNIT 0x05
34#define SELECTOR_UNIT 0x05 34#define UAC_FEATURE_UNIT 0x06
35#define FEATURE_UNIT 0x06 35#define UAC_PROCESSING_UNIT 0x07
36#define PROCESSING_UNIT 0x07 36#define UAC_EXTENSION_UNIT 0x08
37#define EXTENSION_UNIT 0x08 37
38 38/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
39#define AS_GENERAL 0x01 39#define UAC_AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02 40#define UAC_FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03 41#define UAC_FORMAT_SPECIFIC 0x03
42 42
43#define EP_GENERAL 0x01 43/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
44 44#define UAC_EP_GENERAL 0x01
45#define MS_GENERAL 0x01 45
46#define MIDI_IN_JACK 0x02 46/* A.9 Audio Class-Specific Request Codes */
47#define MIDI_OUT_JACK 0x03 47#define UAC_SET_ 0x00
48 48#define UAC_GET_ 0x80
49/* endpoint attributes */ 49
50#define EP_ATTR_MASK 0x0c 50#define UAC__CUR 0x1
51#define EP_ATTR_ASYNC 0x04 51#define UAC__MIN 0x2
52#define EP_ATTR_ADAPTIVE 0x08 52#define UAC__MAX 0x3
53#define EP_ATTR_SYNC 0x0c 53#define UAC__RES 0x4
54 54#define UAC__MEM 0x5
55/* cs endpoint attributes */ 55
56#define EP_CS_ATTR_SAMPLE_RATE 0x01 56#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
57#define EP_CS_ATTR_PITCH_CONTROL 0x02 57#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
58#define EP_CS_ATTR_FILL_MAX 0x80 58#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
59 59#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
60/* Audio Class specific Request Codes */ 60#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
61#define USB_AUDIO_SET_INTF 0x21 61#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
62#define USB_AUDIO_SET_ENDPOINT 0x22 62#define UAC_SET_RES (UAC_SET_ | UAC__RES)
63#define USB_AUDIO_GET_INTF 0xa1 63#define UAC_GET_RES (UAC_GET_ | UAC__RES)
64#define USB_AUDIO_GET_ENDPOINT 0xa2 64#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
65 65#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
66#define SET_ 0x00 66
67#define GET_ 0x80 67#define UAC_GET_STAT 0xff
68 68
69#define _CUR 0x1 69/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
70#define _MIN 0x2 70#define UAC_MS_HEADER 0x01
71#define _MAX 0x3 71#define UAC_MIDI_IN_JACK 0x02
72#define _RES 0x4 72#define UAC_MIDI_OUT_JACK 0x03
73#define _MEM 0x5 73
74 74/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
75#define SET_CUR (SET_ | _CUR) 75#define UAC_MS_GENERAL 0x01
76#define GET_CUR (GET_ | _CUR) 76
77#define SET_MIN (SET_ | _MIN) 77/* Terminals - 2.1 USB Terminal Types */
78#define GET_MIN (GET_ | _MIN) 78#define UAC_TERMINAL_UNDEFINED 0x100
79#define SET_MAX (SET_ | _MAX) 79#define UAC_TERMINAL_STREAMING 0x101
80#define GET_MAX (GET_ | _MAX) 80#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91 81
92/* Terminal Control Selectors */ 82/* Terminal Control Selectors */
93/* 4.3.2 Class-Specific AC Interface Descriptor */ 83/* 4.3.2 Class-Specific AC Interface Descriptor */
94struct usb_ac_header_descriptor { 84struct uac_ac_header_descriptor {
95 __u8 bLength; /* 8 + n */ 85 __u8 bLength; /* 8 + n */
96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 86 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 87 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
98 __le16 bcdADC; /* 0x0100 */ 88 __le16 bcdADC; /* 0x0100 */
99 __le16 wTotalLength; /* includes Unit and Terminal desc. */ 89 __le16 wTotalLength; /* includes Unit and Terminal desc. */
100 __u8 bInCollection; /* n */ 90 __u8 bInCollection; /* n */
101 __u8 baInterfaceNr[]; /* [n] */ 91 __u8 baInterfaceNr[]; /* [n] */
102} __attribute__ ((packed)); 92} __attribute__ ((packed));
103 93
104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n)) 94#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
105 95
106/* As above, but more useful for defining your own descriptors: */ 96/* As above, but more useful for defining your own descriptors: */
107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 97#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
108struct usb_ac_header_descriptor_##n { \ 98struct uac_ac_header_descriptor_##n { \
109 __u8 bLength; \ 99 __u8 bLength; \
110 __u8 bDescriptorType; \ 100 __u8 bDescriptorType; \
111 __u8 bDescriptorSubtype; \ 101 __u8 bDescriptorSubtype; \
@@ -116,7 +106,7 @@ struct usb_ac_header_descriptor_##n { \
116} __attribute__ ((packed)) 106} __attribute__ ((packed))
117 107
118/* 4.3.2.1 Input Terminal Descriptor */ 108/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor { 109struct uac_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */ 110 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 111 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ 112 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
@@ -129,18 +119,19 @@ struct usb_input_terminal_descriptor {
129 __u8 iTerminal; 119 __u8 iTerminal;
130} __attribute__ ((packed)); 120} __attribute__ ((packed));
131 121
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12 122#define UAC_DT_INPUT_TERMINAL_SIZE 12
133 123
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200 124/* Terminals - 2.2 Input Terminal Types */
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201 125#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 126#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 127#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 128#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 129#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 130#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
131#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141 132
142/* 4.3.2.2 Output Terminal Descriptor */ 133/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor { 134struct uac_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */ 135 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 136 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 137 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -151,23 +142,24 @@ struct usb_output_terminal_descriptor {
151 __u8 iTerminal; 142 __u8 iTerminal;
152} __attribute__ ((packed)); 143} __attribute__ ((packed));
153 144
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9 145#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
155 146
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300 147/* Terminals - 2.3 Output Terminal Types */
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301 148#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302 149#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 150#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 151#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 152#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 153#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 154#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
155#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164 156
165/* Set bControlSize = 2 as default setting */ 157/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 158#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167 159
168/* As above, but more useful for defining your own descriptors: */ 160/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \ 161#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \ 162struct uac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \ 163 __u8 bLength; \
172 __u8 bDescriptorType; \ 164 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \ 165 __u8 bDescriptorSubtype; \
@@ -179,7 +171,7 @@ struct usb_ac_feature_unit_descriptor_##ch { \
179} __attribute__ ((packed)) 171} __attribute__ ((packed))
180 172
181/* 4.5.2 Class-Specific AS Interface Descriptor */ 173/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor { 174struct uac_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */ 175 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 176 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */ 177 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -188,16 +180,17 @@ struct usb_as_header_descriptor {
188 __le16 wFormatTag; /* The Audio Data Format */ 180 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed)); 181} __attribute__ ((packed));
190 182
191#define USB_DT_AS_HEADER_SIZE 7 183#define UAC_DT_AS_HEADER_SIZE 7
192 184
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0 185/* Formats - A.1.1 Audio Data Format Type I Codes */
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1 186#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2 187#define UAC_FORMAT_TYPE_I_PCM 0x1
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3 188#define UAC_FORMAT_TYPE_I_PCM8 0x2
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4 189#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5 190#define UAC_FORMAT_TYPE_I_ALAW 0x4
191#define UAC_FORMAT_TYPE_I_MULAW 0x5
199 192
200struct usb_as_format_type_i_continuous_descriptor { 193struct uac_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 194 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 195 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 196 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -210,9 +203,9 @@ struct usb_as_format_type_i_continuous_descriptor {
210 __u8 tUpperSamFreq[3]; 203 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed)); 204} __attribute__ ((packed));
212 205
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 206#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214 207
215struct usb_as_formate_type_i_discrete_descriptor { 208struct uac_format_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */ 209 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 210 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */ 211 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
@@ -224,8 +217,8 @@ struct usb_as_formate_type_i_discrete_descriptor {
224 __u8 tSamFreq[][3]; 217 __u8 tSamFreq[][3];
225} __attribute__ ((packed)); 218} __attribute__ ((packed));
226 219
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 220#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \ 221struct uac_format_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \ 222 __u8 bLength; \
230 __u8 bDescriptorType; \ 223 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \ 224 __u8 bDescriptorSubtype; \
@@ -237,18 +230,15 @@ struct usb_as_formate_type_i_discrete_descriptor_##n { \
237 __u8 tSamFreq[n][3]; \ 230 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed)) 231} __attribute__ ((packed))
239 232
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) 233#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246 234
247#define USB_AS_ENDPOINT_ASYNC (1 << 2) 235/* Formats - A.2 Format Type Codes */
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2) 236#define UAC_FORMAT_TYPE_UNDEFINED 0x0
249#define USB_AS_ENDPOINT_SYNC (3 << 2) 237#define UAC_FORMAT_TYPE_I 0x1
238#define UAC_FORMAT_TYPE_II 0x2
239#define UAC_FORMAT_TYPE_III 0x3
250 240
251struct usb_as_iso_endpoint_descriptor { 241struct uac_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */ 242 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ 243 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */ 244 __u8 bDescriptorSubtype; /* EP_GENERAL */
@@ -256,30 +246,37 @@ struct usb_as_iso_endpoint_descriptor {
256 __u8 bLockDelayUnits; 246 __u8 bLockDelayUnits;
257 __le16 wLockDelay; 247 __le16 wLockDelay;
258}; 248};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7 249#define UAC_ISO_ENDPOINT_DESC_SIZE 7
260 250
261#define FU_CONTROL_UNDEFINED 0x00 251#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
262#define MUTE_CONTROL 0x01 252#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
263#define VOLUME_CONTROL 0x02 253#define UAC_EP_CS_ATTR_FILL_MAX 0x80
264#define BASS_CONTROL 0x03 254
265#define MID_CONTROL 0x04 255/* A.10.2 Feature Unit Control Selectors */
266#define TREBLE_CONTROL 0x05 256#define UAC_FU_CONTROL_UNDEFINED 0x00
267#define GRAPHIC_EQUALIZER_CONTROL 0x06 257#define UAC_MUTE_CONTROL 0x01
268#define AUTOMATIC_GAIN_CONTROL 0x07 258#define UAC_VOLUME_CONTROL 0x02
269#define DELAY_CONTROL 0x08 259#define UAC_BASS_CONTROL 0x03
270#define BASS_BOOST_CONTROL 0x09 260#define UAC_MID_CONTROL 0x04
271#define LOUDNESS_CONTROL 0x0a 261#define UAC_TREBLE_CONTROL 0x05
272 262#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06
273#define FU_MUTE (1 << (MUTE_CONTROL - 1)) 263#define UAC_AUTOMATIC_GAIN_CONTROL 0x07
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1)) 264#define UAC_DELAY_CONTROL 0x08
275#define FU_BASS (1 << (BASS_CONTROL - 1)) 265#define UAC_BASS_BOOST_CONTROL 0x09
276#define FU_MID (1 << (MID_CONTROL - 1)) 266#define UAC_LOUDNESS_CONTROL 0x0a
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1)) 267
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1)) 268#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1)) 269#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1)) 270#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1)) 271#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_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
279#ifdef __KERNEL__
283 280
284struct usb_audio_control { 281struct usb_audio_control {
285 struct list_head list; 282 struct list_head list;
@@ -290,18 +287,6 @@ struct usb_audio_control {
290 int (*get)(struct usb_audio_control *con, u8 cmd); 287 int (*get)(struct usb_audio_control *con, u8 cmd);
291}; 288};
292 289
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector { 290struct usb_audio_control_selector {
306 struct list_head list; 291 struct list_head list;
307 struct list_head control; 292 struct list_head control;
@@ -311,4 +296,6 @@ struct usb_audio_control_selector {
311 struct usb_descriptor_header *desc; 296 struct usb_descriptor_header *desc;
312}; 297};
313 298
299#endif /* __KERNEL__ */
300
314#endif /* __LINUX_USB_AUDIO_H */ 301#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 93223638f702..94012e649d86 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -258,6 +258,8 @@ struct usb_device_descriptor {
258#define USB_CLASS_APP_SPEC 0xfe 258#define USB_CLASS_APP_SPEC 0xfe
259#define USB_CLASS_VENDOR_SPEC 0xff 259#define USB_CLASS_VENDOR_SPEC 0xff
260 260
261#define USB_SUBCLASS_VENDOR_SPEC 0xff
262
261/*-------------------------------------------------------------------------*/ 263/*-------------------------------------------------------------------------*/
262 264
263/* USB_DT_CONFIG: Configuration descriptor information. 265/* USB_DT_CONFIG: Configuration descriptor information.
@@ -348,6 +350,12 @@ struct usb_endpoint_descriptor {
348#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ 350#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
349#define USB_ENDPOINT_DIR_MASK 0x80 351#define USB_ENDPOINT_DIR_MASK 0x80
350 352
353#define USB_ENDPOINT_SYNCTYPE 0x0c
354#define USB_ENDPOINT_SYNC_NONE (0 << 2)
355#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
356#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
357#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
358
351#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ 359#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
352#define USB_ENDPOINT_XFER_CONTROL 0 360#define USB_ENDPOINT_XFER_CONTROL 0
353#define USB_ENDPOINT_XFER_ISOC 1 361#define USB_ENDPOINT_XFER_ISOC 1
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 5b88e36c9103..af4b86f3aca3 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -105,6 +105,7 @@ struct ehci_regs {
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */ 107/* 19:16 for port testing */
108#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */
108#define PORT_LED_OFF (0<<14) 109#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14) 110#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14) 111#define PORT_LED_GREEN (2<<14)
@@ -132,6 +133,19 @@ struct ehci_regs {
132#define USBMODE_CM_HC (3<<0) /* host controller mode */ 133#define USBMODE_CM_HC (3<<0) /* host controller mode */
133#define USBMODE_CM_IDLE (0<<0) /* idle state */ 134#define USBMODE_CM_IDLE (0<<0) /* idle state */
134 135
136/* Moorestown has some non-standard registers, partially due to the fact that
137 * its EHCI controller has both TT and LPM support. HOSTPCx are extentions to
138 * PORTSCx
139 */
140#define HOSTPC0 0x84 /* HOSTPC extension */
141#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
142#define HOSTPC_PSPD (3<<25) /* Port speed detection */
143#define USBMODE_EX 0xc8 /* USB Device mode extension */
144#define USBMODE_EX_VBPS (1<<5) /* VBus Power Select On */
145#define USBMODE_EX_HC (3<<0) /* host controller mode */
146#define TXFILLTUNING 0x24 /* TX FIFO Tuning register */
147#define TXFIFO_DEFAULT (8<<16) /* FIFO burst threshold 8 */
148
135/* Appendix C, Debug port ... intended for use with special "debug devices" 149/* Appendix C, Debug port ... intended for use with special "debug devices"
136 * that can help if there's no serial console. (nonstandard enumeration.) 150 * that can help if there's no serial console. (nonstandard enumeration.)
137 */ 151 */
@@ -157,4 +171,25 @@ struct ehci_dbg_port {
157#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) 171#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
158} __attribute__ ((packed)); 172} __attribute__ ((packed));
159 173
174#ifdef CONFIG_EARLY_PRINTK_DBGP
175#include <linux/init.h>
176extern int __init early_dbgp_init(char *s);
177extern struct console early_dbgp_console;
178#endif /* CONFIG_EARLY_PRINTK_DBGP */
179
180#ifdef CONFIG_EARLY_PRINTK_DBGP
181/* Call backs from ehci host driver to ehci debug driver */
182extern int dbgp_external_startup(void);
183extern int dbgp_reset_prep(void);
184#else
185static inline int dbgp_reset_prep(void)
186{
187 return 1;
188}
189static inline int dbgp_external_startup(void)
190{
191 return -1;
192}
193#endif
194
160#endif /* __LINUX_USB_EHCI_DEF_H */ 195#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/isp1362.h b/include/linux/usb/isp1362.h
new file mode 100644
index 000000000000..642684bb9292
--- /dev/null
+++ b/include/linux/usb/isp1362.h
@@ -0,0 +1,46 @@
1/*
2 * board initialization code should put one of these into dev->platform_data
3 * and place the isp1362 onto platform_bus.
4 */
5
6#ifndef __LINUX_USB_ISP1362_H__
7#define __LINUX_USB_ISP1362_H__
8
9struct isp1362_platform_data {
10 /* Enable internal pulldown resistors on downstream ports */
11 unsigned sel15Kres:1;
12 /* Clock cannot be stopped */
13 unsigned clknotstop:1;
14 /* On-chip overcurrent protection */
15 unsigned oc_enable:1;
16 /* INT output polarity */
17 unsigned int_act_high:1;
18 /* INT edge or level triggered */
19 unsigned int_edge_triggered:1;
20 /* DREQ output polarity */
21 unsigned dreq_act_high:1;
22 /* DACK input polarity */
23 unsigned dack_act_high:1;
24 /* chip can be resumed via H_WAKEUP pin */
25 unsigned remote_wakeup_connected:1;
26 /* Switch or not to switch (keep always powered) */
27 unsigned no_power_switching:1;
28 /* Ganged port power switching (0) or individual port power switching (1) */
29 unsigned power_switching_mode:1;
30 /* Given port_power, msec/2 after power on till power good */
31 u8 potpg;
32 /* Hardware reset set/clear */
33 void (*reset) (struct device *dev, int set);
34 /* Clock start/stop */
35 void (*clock) (struct device *dev, int start);
36 /* Inter-io delay (ns). The chip is picky about access timings; it
37 * expects at least:
38 * 110ns delay between consecutive accesses to DATA_REG,
39 * 300ns delay between access to ADDR_REG and DATA_REG (registers)
40 * 462ns delay between access to ADDR_REG and DATA_REG (buffer memory)
41 * WE MUST NOT be activated during these intervals (even without CS!)
42 */
43 void (*delay) (struct device *dev, unsigned int delay);
44};
45
46#endif
diff --git a/include/linux/usb/isp1760.h b/include/linux/usb/isp1760.h
new file mode 100644
index 000000000000..de7de53c5531
--- /dev/null
+++ b/include/linux/usb/isp1760.h
@@ -0,0 +1,18 @@
1/*
2 * board initialization should put one of these into dev->platform_data
3 * and place the isp1760 onto platform_bus named "isp1760-hcd".
4 */
5
6#ifndef __LINUX_USB_ISP1760_H
7#define __LINUX_USB_ISP1760_H
8
9struct isp1760_platform_data {
10 unsigned is_isp1761:1; /* Chip is ISP1761 */
11 unsigned bus_width_16:1; /* 16/32-bit data bus width */
12 unsigned port1_otg:1; /* Port 1 supports OTG */
13 unsigned analog_oc:1; /* Analog overcurrent */
14 unsigned dack_polarity_high:1; /* DACK active high */
15 unsigned dreq_polarity_high:1; /* DREQ active high */
16};
17
18#endif /* __LINUX_USB_ISP1760_H */
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h
new file mode 100644
index 000000000000..cda9625e7df0
--- /dev/null
+++ b/include/linux/usb/m66592.h
@@ -0,0 +1,44 @@
1/*
2 * M66592 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef __LINUX_USB_M66592_H
22#define __LINUX_USB_M66592_H
23
24#define M66592_PLATDATA_XTAL_12MHZ 0x01
25#define M66592_PLATDATA_XTAL_24MHZ 0x02
26#define M66592_PLATDATA_XTAL_48MHZ 0x03
27
28struct m66592_platdata {
29 /* one = on chip controller, zero = external controller */
30 unsigned on_chip:1;
31
32 /* one = big endian, zero = little endian */
33 unsigned endian:1;
34
35 /* (external controller only) M66592_PLATDATA_XTAL_nnMHZ */
36 unsigned xtal:2;
37
38 /* (external controller only) one = 3.3V, zero = 1.5V */
39 unsigned vif:1;
40
41};
42
43#endif /* __LINUX_USB_M66592_H */
44
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index e9f0384fa20c..26d216734057 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -28,9 +28,12 @@
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03 28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29 29
30struct r8a66597_platdata { 30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */ 31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power); 32 void (*port_power)(int port, int power);
33 33
34 /* set one = on chip controller, set zero = external controller */
35 unsigned on_chip:1;
36
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ 37 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2; 38 unsigned xtal:2;
36 39
@@ -40,5 +43,373 @@ struct r8a66597_platdata {
40 /* set one = big endian, set zero = little endian */ 43 /* set one = big endian, set zero = little endian */
41 unsigned endian:1; 44 unsigned endian:1;
42}; 45};
43#endif 46
47/* Register definitions */
48#define SYSCFG0 0x00
49#define SYSCFG1 0x02
50#define SYSSTS0 0x04
51#define SYSSTS1 0x06
52#define DVSTCTR0 0x08
53#define DVSTCTR1 0x0A
54#define TESTMODE 0x0C
55#define PINCFG 0x0E
56#define DMA0CFG 0x10
57#define DMA1CFG 0x12
58#define CFIFO 0x14
59#define D0FIFO 0x18
60#define D1FIFO 0x1C
61#define CFIFOSEL 0x20
62#define CFIFOCTR 0x22
63#define CFIFOSIE 0x24
64#define D0FIFOSEL 0x28
65#define D0FIFOCTR 0x2A
66#define D1FIFOSEL 0x2C
67#define D1FIFOCTR 0x2E
68#define INTENB0 0x30
69#define INTENB1 0x32
70#define INTENB2 0x34
71#define BRDYENB 0x36
72#define NRDYENB 0x38
73#define BEMPENB 0x3A
74#define SOFCFG 0x3C
75#define INTSTS0 0x40
76#define INTSTS1 0x42
77#define INTSTS2 0x44
78#define BRDYSTS 0x46
79#define NRDYSTS 0x48
80#define BEMPSTS 0x4A
81#define FRMNUM 0x4C
82#define UFRMNUM 0x4E
83#define USBADDR 0x50
84#define USBREQ 0x54
85#define USBVAL 0x56
86#define USBINDX 0x58
87#define USBLENG 0x5A
88#define DCPCFG 0x5C
89#define DCPMAXP 0x5E
90#define DCPCTR 0x60
91#define PIPESEL 0x64
92#define PIPECFG 0x68
93#define PIPEBUF 0x6A
94#define PIPEMAXP 0x6C
95#define PIPEPERI 0x6E
96#define PIPE1CTR 0x70
97#define PIPE2CTR 0x72
98#define PIPE3CTR 0x74
99#define PIPE4CTR 0x76
100#define PIPE5CTR 0x78
101#define PIPE6CTR 0x7A
102#define PIPE7CTR 0x7C
103#define PIPE8CTR 0x7E
104#define PIPE9CTR 0x80
105#define PIPE1TRE 0x90
106#define PIPE1TRN 0x92
107#define PIPE2TRE 0x94
108#define PIPE2TRN 0x96
109#define PIPE3TRE 0x98
110#define PIPE3TRN 0x9A
111#define PIPE4TRE 0x9C
112#define PIPE4TRN 0x9E
113#define PIPE5TRE 0xA0
114#define PIPE5TRN 0xA2
115#define DEVADD0 0xD0
116#define DEVADD1 0xD2
117#define DEVADD2 0xD4
118#define DEVADD3 0xD6
119#define DEVADD4 0xD8
120#define DEVADD5 0xDA
121#define DEVADD6 0xDC
122#define DEVADD7 0xDE
123#define DEVADD8 0xE0
124#define DEVADD9 0xE2
125#define DEVADDA 0xE4
126
127/* System Configuration Control Register */
128#define XTAL 0xC000 /* b15-14: Crystal selection */
129#define XTAL48 0x8000 /* 48MHz */
130#define XTAL24 0x4000 /* 24MHz */
131#define XTAL12 0x0000 /* 12MHz */
132#define XCKE 0x2000 /* b13: External clock enable */
133#define PLLC 0x0800 /* b11: PLL control */
134#define SCKE 0x0400 /* b10: USB clock enable */
135#define PCSDIS 0x0200 /* b9: not CS wakeup */
136#define LPSME 0x0100 /* b8: Low power sleep mode */
137#define HSE 0x0080 /* b7: Hi-speed enable */
138#define DCFM 0x0040 /* b6: Controller function select */
139#define DRPD 0x0020 /* b5: D+/- pull down control */
140#define DPRPU 0x0010 /* b4: D+ pull up control */
141#define USBE 0x0001 /* b0: USB module operation enable */
142
143/* System Configuration Status Register */
144#define OVCBIT 0x8000 /* b15-14: Over-current bit */
145#define OVCMON 0xC000 /* b15-14: Over-current monitor */
146#define SOFEA 0x0020 /* b5: SOF monitor */
147#define IDMON 0x0004 /* b3: ID-pin monitor */
148#define LNST 0x0003 /* b1-0: D+, D- line status */
149#define SE1 0x0003 /* SE1 */
150#define FS_KSTS 0x0002 /* Full-Speed K State */
151#define FS_JSTS 0x0001 /* Full-Speed J State */
152#define LS_JSTS 0x0002 /* Low-Speed J State */
153#define LS_KSTS 0x0001 /* Low-Speed K State */
154#define SE0 0x0000 /* SE0 */
155
156/* Device State Control Register */
157#define EXTLP0 0x0400 /* b10: External port */
158#define VBOUT 0x0200 /* b9: VBUS output */
159#define WKUP 0x0100 /* b8: Remote wakeup */
160#define RWUPE 0x0080 /* b7: Remote wakeup sense */
161#define USBRST 0x0040 /* b6: USB reset enable */
162#define RESUME 0x0020 /* b5: Resume enable */
163#define UACT 0x0010 /* b4: USB bus enable */
164#define RHST 0x0007 /* b1-0: Reset handshake status */
165#define HSPROC 0x0004 /* HS handshake is processing */
166#define HSMODE 0x0003 /* Hi-Speed mode */
167#define FSMODE 0x0002 /* Full-Speed mode */
168#define LSMODE 0x0001 /* Low-Speed mode */
169#define UNDECID 0x0000 /* Undecided */
170
171/* Test Mode Register */
172#define UTST 0x000F /* b3-0: Test select */
173#define H_TST_PACKET 0x000C /* HOST TEST Packet */
174#define H_TST_SE0_NAK 0x000B /* HOST TEST SE0 NAK */
175#define H_TST_K 0x000A /* HOST TEST K */
176#define H_TST_J 0x0009 /* HOST TEST J */
177#define H_TST_NORMAL 0x0000 /* HOST Normal Mode */
178#define P_TST_PACKET 0x0004 /* PERI TEST Packet */
179#define P_TST_SE0_NAK 0x0003 /* PERI TEST SE0 NAK */
180#define P_TST_K 0x0002 /* PERI TEST K */
181#define P_TST_J 0x0001 /* PERI TEST J */
182#define P_TST_NORMAL 0x0000 /* PERI Normal Mode */
183
184/* Data Pin Configuration Register */
185#define LDRV 0x8000 /* b15: Drive Current Adjust */
186#define VIF1 0x0000 /* VIF = 1.8V */
187#define VIF3 0x8000 /* VIF = 3.3V */
188#define INTA 0x0001 /* b1: USB INT-pin active */
189
190/* DMAx Pin Configuration Register */
191#define DREQA 0x4000 /* b14: Dreq active select */
192#define BURST 0x2000 /* b13: Burst mode */
193#define DACKA 0x0400 /* b10: Dack active select */
194#define DFORM 0x0380 /* b9-7: DMA mode select */
195#define CPU_ADR_RD_WR 0x0000 /* Address + RD/WR mode (CPU bus) */
196#define CPU_DACK_RD_WR 0x0100 /* DACK + RD/WR mode (CPU bus) */
197#define CPU_DACK_ONLY 0x0180 /* DACK only mode (CPU bus) */
198#define SPLIT_DACK_ONLY 0x0200 /* DACK only mode (SPLIT bus) */
199#define DENDA 0x0040 /* b6: Dend active select */
200#define PKTM 0x0020 /* b5: Packet mode */
201#define DENDE 0x0010 /* b4: Dend enable */
202#define OBUS 0x0004 /* b2: OUTbus mode */
203
204/* CFIFO/DxFIFO Port Select Register */
205#define RCNT 0x8000 /* b15: Read count mode */
206#define REW 0x4000 /* b14: Buffer rewind */
207#define DCLRM 0x2000 /* b13: DMA buffer clear mode */
208#define DREQE 0x1000 /* b12: DREQ output enable */
209#define MBW_8 0x0000 /* 8bit */
210#define MBW_16 0x0400 /* 16bit */
211#define MBW_32 0x0800 /* 32bit */
212#define BIGEND 0x0100 /* b8: Big endian mode */
213#define BYTE_LITTLE 0x0000 /* little dendian */
214#define BYTE_BIG 0x0100 /* big endifan */
215#define ISEL 0x0020 /* b5: DCP FIFO port direction select */
216#define CURPIPE 0x000F /* b2-0: PIPE select */
217
218/* CFIFO/DxFIFO Port Control Register */
219#define BVAL 0x8000 /* b15: Buffer valid flag */
220#define BCLR 0x4000 /* b14: Buffer clear */
221#define FRDY 0x2000 /* b13: FIFO ready */
222#define DTLN 0x0FFF /* b11-0: FIFO received data length */
223
224/* Interrupt Enable Register 0 */
225#define VBSE 0x8000 /* b15: VBUS interrupt */
226#define RSME 0x4000 /* b14: Resume interrupt */
227#define SOFE 0x2000 /* b13: Frame update interrupt */
228#define DVSE 0x1000 /* b12: Device state transition interrupt */
229#define CTRE 0x0800 /* b11: Control transfer stage transition interrupt */
230#define BEMPE 0x0400 /* b10: Buffer empty interrupt */
231#define NRDYE 0x0200 /* b9: Buffer not ready interrupt */
232#define BRDYE 0x0100 /* b8: Buffer ready interrupt */
233
234/* Interrupt Enable Register 1 */
235#define OVRCRE 0x8000 /* b15: Over-current interrupt */
236#define BCHGE 0x4000 /* b14: USB us chenge interrupt */
237#define DTCHE 0x1000 /* b12: Detach sense interrupt */
238#define ATTCHE 0x0800 /* b11: Attach sense interrupt */
239#define EOFERRE 0x0040 /* b6: EOF error interrupt */
240#define SIGNE 0x0020 /* b5: SETUP IGNORE interrupt */
241#define SACKE 0x0010 /* b4: SETUP ACK interrupt */
242
243/* BRDY Interrupt Enable/Status Register */
244#define BRDY9 0x0200 /* b9: PIPE9 */
245#define BRDY8 0x0100 /* b8: PIPE8 */
246#define BRDY7 0x0080 /* b7: PIPE7 */
247#define BRDY6 0x0040 /* b6: PIPE6 */
248#define BRDY5 0x0020 /* b5: PIPE5 */
249#define BRDY4 0x0010 /* b4: PIPE4 */
250#define BRDY3 0x0008 /* b3: PIPE3 */
251#define BRDY2 0x0004 /* b2: PIPE2 */
252#define BRDY1 0x0002 /* b1: PIPE1 */
253#define BRDY0 0x0001 /* b1: PIPE0 */
254
255/* NRDY Interrupt Enable/Status Register */
256#define NRDY9 0x0200 /* b9: PIPE9 */
257#define NRDY8 0x0100 /* b8: PIPE8 */
258#define NRDY7 0x0080 /* b7: PIPE7 */
259#define NRDY6 0x0040 /* b6: PIPE6 */
260#define NRDY5 0x0020 /* b5: PIPE5 */
261#define NRDY4 0x0010 /* b4: PIPE4 */
262#define NRDY3 0x0008 /* b3: PIPE3 */
263#define NRDY2 0x0004 /* b2: PIPE2 */
264#define NRDY1 0x0002 /* b1: PIPE1 */
265#define NRDY0 0x0001 /* b1: PIPE0 */
266
267/* BEMP Interrupt Enable/Status Register */
268#define BEMP9 0x0200 /* b9: PIPE9 */
269#define BEMP8 0x0100 /* b8: PIPE8 */
270#define BEMP7 0x0080 /* b7: PIPE7 */
271#define BEMP6 0x0040 /* b6: PIPE6 */
272#define BEMP5 0x0020 /* b5: PIPE5 */
273#define BEMP4 0x0010 /* b4: PIPE4 */
274#define BEMP3 0x0008 /* b3: PIPE3 */
275#define BEMP2 0x0004 /* b2: PIPE2 */
276#define BEMP1 0x0002 /* b1: PIPE1 */
277#define BEMP0 0x0001 /* b0: PIPE0 */
278
279/* SOF Pin Configuration Register */
280#define TRNENSEL 0x0100 /* b8: Select transaction enable period */
281#define BRDYM 0x0040 /* b6: BRDY clear timing */
282#define INTL 0x0020 /* b5: Interrupt sense select */
283#define EDGESTS 0x0010 /* b4: */
284#define SOFMODE 0x000C /* b3-2: SOF pin select */
285#define SOF_125US 0x0008 /* SOF OUT 125us Frame Signal */
286#define SOF_1MS 0x0004 /* SOF OUT 1ms Frame Signal */
287#define SOF_DISABLE 0x0000 /* SOF OUT Disable */
288
289/* Interrupt Status Register 0 */
290#define VBINT 0x8000 /* b15: VBUS interrupt */
291#define RESM 0x4000 /* b14: Resume interrupt */
292#define SOFR 0x2000 /* b13: SOF frame update interrupt */
293#define DVST 0x1000 /* b12: Device state transition interrupt */
294#define CTRT 0x0800 /* b11: Control transfer stage transition interrupt */
295#define BEMP 0x0400 /* b10: Buffer empty interrupt */
296#define NRDY 0x0200 /* b9: Buffer not ready interrupt */
297#define BRDY 0x0100 /* b8: Buffer ready interrupt */
298#define VBSTS 0x0080 /* b7: VBUS input port */
299#define DVSQ 0x0070 /* b6-4: Device state */
300#define DS_SPD_CNFG 0x0070 /* Suspend Configured */
301#define DS_SPD_ADDR 0x0060 /* Suspend Address */
302#define DS_SPD_DFLT 0x0050 /* Suspend Default */
303#define DS_SPD_POWR 0x0040 /* Suspend Powered */
304#define DS_SUSP 0x0040 /* Suspend */
305#define DS_CNFG 0x0030 /* Configured */
306#define DS_ADDS 0x0020 /* Address */
307#define DS_DFLT 0x0010 /* Default */
308#define DS_POWR 0x0000 /* Powered */
309#define DVSQS 0x0030 /* b5-4: Device state */
310#define VALID 0x0008 /* b3: Setup packet detected flag */
311#define CTSQ 0x0007 /* b2-0: Control transfer stage */
312#define CS_SQER 0x0006 /* Sequence error */
313#define CS_WRND 0x0005 /* Control write nodata status stage */
314#define CS_WRSS 0x0004 /* Control write status stage */
315#define CS_WRDS 0x0003 /* Control write data stage */
316#define CS_RDSS 0x0002 /* Control read status stage */
317#define CS_RDDS 0x0001 /* Control read data stage */
318#define CS_IDST 0x0000 /* Idle or setup stage */
319
320/* Interrupt Status Register 1 */
321#define OVRCR 0x8000 /* b15: Over-current interrupt */
322#define BCHG 0x4000 /* b14: USB bus chenge interrupt */
323#define DTCH 0x1000 /* b12: Detach sense interrupt */
324#define ATTCH 0x0800 /* b11: Attach sense interrupt */
325#define EOFERR 0x0040 /* b6: EOF-error interrupt */
326#define SIGN 0x0020 /* b5: Setup ignore interrupt */
327#define SACK 0x0010 /* b4: Setup acknowledge interrupt */
328
329/* Frame Number Register */
330#define OVRN 0x8000 /* b15: Overrun error */
331#define CRCE 0x4000 /* b14: Received data error */
332#define FRNM 0x07FF /* b10-0: Frame number */
333
334/* Micro Frame Number Register */
335#define UFRNM 0x0007 /* b2-0: Micro frame number */
336
337/* Default Control Pipe Maxpacket Size Register */
338/* Pipe Maxpacket Size Register */
339#define DEVSEL 0xF000 /* b15-14: Device address select */
340#define MAXP 0x007F /* b6-0: Maxpacket size of default control pipe */
341
342/* Default Control Pipe Control Register */
343#define BSTS 0x8000 /* b15: Buffer status */
344#define SUREQ 0x4000 /* b14: Send USB request */
345#define CSCLR 0x2000 /* b13: complete-split status clear */
346#define CSSTS 0x1000 /* b12: complete-split status */
347#define SUREQCLR 0x0800 /* b11: stop setup request */
348#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
349#define SQSET 0x0080 /* b7: Sequence toggle bit set */
350#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
351#define PBUSY 0x0020 /* b5: pipe busy */
352#define PINGE 0x0010 /* b4: ping enable */
353#define CCPL 0x0004 /* b2: Enable control transfer complete */
354#define PID 0x0003 /* b1-0: Response PID */
355#define PID_STALL11 0x0003 /* STALL */
356#define PID_STALL 0x0002 /* STALL */
357#define PID_BUF 0x0001 /* BUF */
358#define PID_NAK 0x0000 /* NAK */
359
360/* Pipe Window Select Register */
361#define PIPENM 0x0007 /* b2-0: Pipe select */
362
363/* Pipe Configuration Register */
364#define R8A66597_TYP 0xC000 /* b15-14: Transfer type */
365#define R8A66597_ISO 0xC000 /* Isochronous */
366#define R8A66597_INT 0x8000 /* Interrupt */
367#define R8A66597_BULK 0x4000 /* Bulk */
368#define R8A66597_BFRE 0x0400 /* b10: Buffer ready interrupt mode select */
369#define R8A66597_DBLB 0x0200 /* b9: Double buffer mode select */
370#define R8A66597_CNTMD 0x0100 /* b8: Continuous transfer mode select */
371#define R8A66597_SHTNAK 0x0080 /* b7: Transfer end NAK */
372#define R8A66597_DIR 0x0010 /* b4: Transfer direction select */
373#define R8A66597_EPNUM 0x000F /* b3-0: Eendpoint number select */
374
375/* Pipe Buffer Configuration Register */
376#define BUFSIZE 0x7C00 /* b14-10: Pipe buffer size */
377#define BUFNMB 0x007F /* b6-0: Pipe buffer number */
378#define PIPE0BUF 256
379#define PIPExBUF 64
380
381/* Pipe Maxpacket Size Register */
382#define MXPS 0x07FF /* b10-0: Maxpacket size */
383
384/* Pipe Cycle Configuration Register */
385#define IFIS 0x1000 /* b12: Isochronous in-buffer flush mode select */
386#define IITV 0x0007 /* b2-0: Isochronous interval */
387
388/* Pipex Control Register */
389#define BSTS 0x8000 /* b15: Buffer status */
390#define INBUFM 0x4000 /* b14: IN buffer monitor (Only for PIPE1 to 5) */
391#define CSCLR 0x2000 /* b13: complete-split status clear */
392#define CSSTS 0x1000 /* b12: complete-split status */
393#define ATREPM 0x0400 /* b10: Auto repeat mode */
394#define ACLRM 0x0200 /* b9: Out buffer auto clear mode */
395#define SQCLR 0x0100 /* b8: Sequence toggle bit clear */
396#define SQSET 0x0080 /* b7: Sequence toggle bit set */
397#define SQMON 0x0040 /* b6: Sequence toggle bit monitor */
398#define PBUSY 0x0020 /* b5: pipe busy */
399#define PID 0x0003 /* b1-0: Response PID */
400
401/* PIPExTRE */
402#define TRENB 0x0200 /* b9: Transaction counter enable */
403#define TRCLR 0x0100 /* b8: Transaction counter clear */
404
405/* PIPExTRN */
406#define TRNCNT 0xFFFF /* b15-0: Transaction counter */
407
408/* DEVADDx */
409#define UPPHUB 0x7800
410#define HUBPORT 0x0700
411#define USBSPD 0x00C0
412#define RTPORT 0x0001
413
414#endif /* __LINUX_USB_R8A66597_H */
44 415
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 37836b937d97..1ef1ebc2b04f 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -70,12 +70,13 @@ struct rndis_msg_hdr {
70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
71 71
72/* codes for "status" field of completion messages */ 72/* codes for "status" field of completion messages */
73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000) 73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001) 74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015) 75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb) 76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b) 77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c) 78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
79#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
79 80
80/* codes for OID_GEN_PHYSICAL_MEDIUM */ 81/* codes for OID_GEN_PHYSICAL_MEDIUM */
81#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000) 82#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0ec50ba62139..ce911ebf91e8 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -59,6 +59,7 @@ enum port_dev_state {
59 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 59 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 60 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
61 * @write_urb: pointer to the bulk out struct urb for this port. 61 * @write_urb: pointer to the bulk out struct urb for this port.
62 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 63 * @write_urb_busy: port`s writing status
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 64 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 65 * port.
@@ -96,6 +97,7 @@ struct usb_serial_port {
96 unsigned char *bulk_out_buffer; 97 unsigned char *bulk_out_buffer;
97 int bulk_out_size; 98 int bulk_out_size;
98 struct urb *write_urb; 99 struct urb *write_urb;
100 struct kfifo *write_fifo;
99 int write_urb_busy; 101 int write_urb_busy;
100 __u8 bulk_out_endpointAddress; 102 __u8 bulk_out_endpointAddress;
101 103
@@ -148,6 +150,7 @@ struct usb_serial {
148 struct usb_interface *interface; 150 struct usb_interface *interface;
149 unsigned char disconnected:1; 151 unsigned char disconnected:1;
150 unsigned char suspending:1; 152 unsigned char suspending:1;
153 unsigned char attached:1;
151 unsigned char minor; 154 unsigned char minor;
152 unsigned char num_ports; 155 unsigned char num_ports;
153 unsigned char num_port_pointers; 156 unsigned char num_port_pointers;
@@ -238,9 +241,8 @@ struct usb_serial_driver {
238 int (*resume)(struct usb_serial *serial); 241 int (*resume)(struct usb_serial *serial);
239 242
240 /* serial function calls */ 243 /* serial function calls */
241 /* Called by console with tty = NULL and by tty */ 244 /* Called by console and by the tty layer */
242 int (*open)(struct tty_struct *tty, 245 int (*open)(struct tty_struct *tty, struct usb_serial_port *port);
243 struct usb_serial_port *port, struct file *filp);
244 void (*close)(struct usb_serial_port *port); 246 void (*close)(struct usb_serial_port *port);
245 int (*write)(struct tty_struct *tty, struct usb_serial_port *port, 247 int (*write)(struct tty_struct *tty, struct usb_serial_port *port,
246 const unsigned char *buf, int count); 248 const unsigned char *buf, int count);
@@ -261,6 +263,9 @@ struct usb_serial_driver {
261 be an attached tty at this point */ 263 be an attached tty at this point */
262 void (*dtr_rts)(struct usb_serial_port *port, int on); 264 void (*dtr_rts)(struct usb_serial_port *port, int on);
263 int (*carrier_raised)(struct usb_serial_port *port); 265 int (*carrier_raised)(struct usb_serial_port *port);
266 /* Called by the usb serial hooks to allow the user to rework the
267 termios state */
268 void (*init_termios)(struct tty_struct *tty);
264 /* USB events */ 269 /* USB events */
265 void (*read_int_callback)(struct urb *urb); 270 void (*read_int_callback)(struct urb *urb);
266 void (*write_int_callback)(struct urb *urb); 271 void (*write_int_callback)(struct urb *urb);
@@ -300,7 +305,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
300extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 305extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
301extern void usb_serial_put(struct usb_serial *serial); 306extern void usb_serial_put(struct usb_serial *serial);
302extern int usb_serial_generic_open(struct tty_struct *tty, 307extern int usb_serial_generic_open(struct tty_struct *tty,
303 struct usb_serial_port *port, struct file *filp); 308 struct usb_serial_port *port);
304extern int usb_serial_generic_write(struct tty_struct *tty, 309extern int usb_serial_generic_write(struct tty_struct *tty,
305 struct usb_serial_port *port, const unsigned char *buf, int count); 310 struct usb_serial_port *port, const unsigned char *buf, int count);
306extern void usb_serial_generic_close(struct usb_serial_port *port); 311extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 310e18a880ff..f81473052059 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -53,6 +53,7 @@ struct usbnet {
53 struct sk_buff_head rxq; 53 struct sk_buff_head rxq;
54 struct sk_buff_head txq; 54 struct sk_buff_head txq;
55 struct sk_buff_head done; 55 struct sk_buff_head done;
56 struct sk_buff_head rxq_pause;
56 struct urb *interrupt; 57 struct urb *interrupt;
57 struct tasklet_struct bh; 58 struct tasklet_struct bh;
58 59
@@ -63,6 +64,7 @@ struct usbnet {
63# define EVENT_RX_MEMORY 2 64# define EVENT_RX_MEMORY 2
64# define EVENT_STS_SPLIT 3 65# define EVENT_STS_SPLIT 3
65# define EVENT_LINK_RESET 4 66# define EVENT_LINK_RESET 4
67# define EVENT_RX_PAUSED 5
66}; 68};
67 69
68static inline struct usb_driver *driver_of(struct usb_interface *intf) 70static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -86,6 +88,8 @@ struct driver_info {
86 88
87#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ 89#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
88#define FLAG_WLAN 0x0080 /* use "wlan%d" names */ 90#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
91#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
92#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
89 93
90 94
91 /* init device ... can sleep, or cause probe() failure */ 95 /* init device ... can sleep, or cause probe() failure */
@@ -97,6 +101,9 @@ struct driver_info {
97 /* reset device ... can sleep */ 101 /* reset device ... can sleep */
98 int (*reset)(struct usbnet *); 102 int (*reset)(struct usbnet *);
99 103
104 /* stop device ... can sleep */
105 int (*stop)(struct usbnet *);
106
100 /* see if peer is connected ... can sleep */ 107 /* see if peer is connected ... can sleep */
101 int (*check_connect)(struct usbnet *); 108 int (*check_connect)(struct usbnet *);
102 109
@@ -118,9 +125,8 @@ struct driver_info {
118 * right after minidriver have initialized hardware. */ 125 * right after minidriver have initialized hardware. */
119 int (*early_init)(struct usbnet *dev); 126 int (*early_init)(struct usbnet *dev);
120 127
121 /* called by minidriver when link state changes, state: 0=disconnect, 128 /* called by minidriver when receiving indication */
122 * 1=connect */ 129 void (*indication)(struct usbnet *dev, void *ind, int indlen);
123 void (*link_change)(struct usbnet *dev, int state);
124 130
125 /* for new devices, use the descriptor-reading code instead */ 131 /* for new devices, use the descriptor-reading code instead */
126 int in; /* rx endpoint */ 132 int in; /* rx endpoint */
@@ -177,7 +183,8 @@ struct skb_data { /* skb->cb is one of these */
177 183
178extern int usbnet_open (struct net_device *net); 184extern int usbnet_open (struct net_device *net);
179extern int usbnet_stop (struct net_device *net); 185extern int usbnet_stop (struct net_device *net);
180extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net); 186extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
187 struct net_device *net);
181extern void usbnet_tx_timeout (struct net_device *net); 188extern void usbnet_tx_timeout (struct net_device *net);
182extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 189extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
183 190
@@ -187,6 +194,10 @@ extern void usbnet_defer_kevent (struct usbnet *, int);
187extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 194extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
188extern void usbnet_unlink_rx_urbs(struct usbnet *); 195extern void usbnet_unlink_rx_urbs(struct usbnet *);
189 196
197extern void usbnet_pause_rx(struct usbnet *);
198extern void usbnet_resume_rx(struct usbnet *);
199extern void usbnet_purge_paused_rxq(struct usbnet *);
200
190extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); 201extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
191extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); 202extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
192extern u32 usbnet_get_link (struct net_device *net); 203extern u32 usbnet_get_link (struct net_device *net);
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h
new file mode 100644
index 000000000000..be436d9ee479
--- /dev/null
+++ b/include/linux/usb/video.h
@@ -0,0 +1,164 @@
1/*
2 * USB Video Class definitions.
3 *
4 * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be>
5 *
6 * This file holds USB constants and structures defined by the USB Device
7 * Class Definition for Video Devices. Unless otherwise stated, comments
8 * below reference relevant sections of the USB Video Class 1.1 specification
9 * available at
10 *
11 * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip
12 */
13
14#ifndef __LINUX_USB_VIDEO_H
15#define __LINUX_USB_VIDEO_H
16
17#include <linux/types.h>
18
19/* --------------------------------------------------------------------------
20 * UVC constants
21 */
22
23/* A.2. Video Interface Subclass Codes */
24#define UVC_SC_UNDEFINED 0x00
25#define UVC_SC_VIDEOCONTROL 0x01
26#define UVC_SC_VIDEOSTREAMING 0x02
27#define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03
28
29/* A.3. Video Interface Protocol Codes */
30#define UVC_PC_PROTOCOL_UNDEFINED 0x00
31
32/* A.5. Video Class-Specific VC Interface Descriptor Subtypes */
33#define UVC_VC_DESCRIPTOR_UNDEFINED 0x00
34#define UVC_VC_HEADER 0x01
35#define UVC_VC_INPUT_TERMINAL 0x02
36#define UVC_VC_OUTPUT_TERMINAL 0x03
37#define UVC_VC_SELECTOR_UNIT 0x04
38#define UVC_VC_PROCESSING_UNIT 0x05
39#define UVC_VC_EXTENSION_UNIT 0x06
40
41/* A.6. Video Class-Specific VS Interface Descriptor Subtypes */
42#define UVC_VS_UNDEFINED 0x00
43#define UVC_VS_INPUT_HEADER 0x01
44#define UVC_VS_OUTPUT_HEADER 0x02
45#define UVC_VS_STILL_IMAGE_FRAME 0x03
46#define UVC_VS_FORMAT_UNCOMPRESSED 0x04
47#define UVC_VS_FRAME_UNCOMPRESSED 0x05
48#define UVC_VS_FORMAT_MJPEG 0x06
49#define UVC_VS_FRAME_MJPEG 0x07
50#define UVC_VS_FORMAT_MPEG2TS 0x0a
51#define UVC_VS_FORMAT_DV 0x0c
52#define UVC_VS_COLORFORMAT 0x0d
53#define UVC_VS_FORMAT_FRAME_BASED 0x10
54#define UVC_VS_FRAME_FRAME_BASED 0x11
55#define UVC_VS_FORMAT_STREAM_BASED 0x12
56
57/* A.7. Video Class-Specific Endpoint Descriptor Subtypes */
58#define UVC_EP_UNDEFINED 0x00
59#define UVC_EP_GENERAL 0x01
60#define UVC_EP_ENDPOINT 0x02
61#define UVC_EP_INTERRUPT 0x03
62
63/* A.8. Video Class-Specific Request Codes */
64#define UVC_RC_UNDEFINED 0x00
65#define UVC_SET_CUR 0x01
66#define UVC_GET_CUR 0x81
67#define UVC_GET_MIN 0x82
68#define UVC_GET_MAX 0x83
69#define UVC_GET_RES 0x84
70#define UVC_GET_LEN 0x85
71#define UVC_GET_INFO 0x86
72#define UVC_GET_DEF 0x87
73
74/* A.9.1. VideoControl Interface Control Selectors */
75#define UVC_VC_CONTROL_UNDEFINED 0x00
76#define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01
77#define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02
78
79/* A.9.2. Terminal Control Selectors */
80#define UVC_TE_CONTROL_UNDEFINED 0x00
81
82/* A.9.3. Selector Unit Control Selectors */
83#define UVC_SU_CONTROL_UNDEFINED 0x00
84#define UVC_SU_INPUT_SELECT_CONTROL 0x01
85
86/* A.9.4. Camera Terminal Control Selectors */
87#define UVC_CT_CONTROL_UNDEFINED 0x00
88#define UVC_CT_SCANNING_MODE_CONTROL 0x01
89#define UVC_CT_AE_MODE_CONTROL 0x02
90#define UVC_CT_AE_PRIORITY_CONTROL 0x03
91#define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
92#define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
93#define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06
94#define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07
95#define UVC_CT_FOCUS_AUTO_CONTROL 0x08
96#define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09
97#define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a
98#define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b
99#define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c
100#define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d
101#define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e
102#define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f
103#define UVC_CT_ROLL_RELATIVE_CONTROL 0x10
104#define UVC_CT_PRIVACY_CONTROL 0x11
105
106/* A.9.5. Processing Unit Control Selectors */
107#define UVC_PU_CONTROL_UNDEFINED 0x00
108#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
109#define UVC_PU_BRIGHTNESS_CONTROL 0x02
110#define UVC_PU_CONTRAST_CONTROL 0x03
111#define UVC_PU_GAIN_CONTROL 0x04
112#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05
113#define UVC_PU_HUE_CONTROL 0x06
114#define UVC_PU_SATURATION_CONTROL 0x07
115#define UVC_PU_SHARPNESS_CONTROL 0x08
116#define UVC_PU_GAMMA_CONTROL 0x09
117#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
118#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
119#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
120#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
121#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
122#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
123#define UVC_PU_HUE_AUTO_CONTROL 0x10
124#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
125#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12
126
127/* A.9.7. VideoStreaming Interface Control Selectors */
128#define UVC_VS_CONTROL_UNDEFINED 0x00
129#define UVC_VS_PROBE_CONTROL 0x01
130#define UVC_VS_COMMIT_CONTROL 0x02
131#define UVC_VS_STILL_PROBE_CONTROL 0x03
132#define UVC_VS_STILL_COMMIT_CONTROL 0x04
133#define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
134#define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06
135#define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07
136#define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
137#define UVC_VS_SYNC_DELAY_CONTROL 0x09
138
139/* B.1. USB Terminal Types */
140#define UVC_TT_VENDOR_SPECIFIC 0x0100
141#define UVC_TT_STREAMING 0x0101
142
143/* B.2. Input Terminal Types */
144#define UVC_ITT_VENDOR_SPECIFIC 0x0200
145#define UVC_ITT_CAMERA 0x0201
146#define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202
147
148/* B.3. Output Terminal Types */
149#define UVC_OTT_VENDOR_SPECIFIC 0x0300
150#define UVC_OTT_DISPLAY 0x0301
151#define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
152
153/* B.4. External Terminal Types */
154#define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400
155#define UVC_COMPOSITE_CONNECTOR 0x0401
156#define UVC_SVIDEO_CONNECTOR 0x0402
157#define UVC_COMPONENT_CONNECTOR 0x0403
158
159/* 2.4.2.2. Status Packet Type */
160#define UVC_STATUS_TYPE_CONTROL 1
161#define UVC_STATUS_TYPE_STREAMING 2
162
163#endif /* __LINUX_USB_VIDEO_H */
164
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 0044d9b4cb85..b2a7d8ba6ee3 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -77,6 +77,7 @@ struct usbdevfs_connectinfo {
77 77
78#define USBDEVFS_URB_SHORT_NOT_OK 0x01 78#define USBDEVFS_URB_SHORT_NOT_OK 0x01
79#define USBDEVFS_URB_ISO_ASAP 0x02 79#define USBDEVFS_URB_ISO_ASAP 0x02
80#define USBDEVFS_URB_BULK_CONTINUATION 0x04
80#define USBDEVFS_URB_NO_FSBR 0x20 81#define USBDEVFS_URB_NO_FSBR 0x20
81#define USBDEVFS_URB_ZERO_PACKET 0x40 82#define USBDEVFS_URB_ZERO_PACKET 0x40
82#define USBDEVFS_URB_NO_INTERRUPT 0x80 83#define USBDEVFS_URB_NO_INTERRUPT 0x80
@@ -175,4 +176,6 @@ struct usbdevfs_ioctl32 {
175#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 176#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
176#define USBDEVFS_DISCONNECT _IO('U', 22) 177#define USBDEVFS_DISCONNECT _IO('U', 22)
177#define USBDEVFS_CONNECT _IO('U', 23) 178#define USBDEVFS_CONNECT _IO('U', 23)
179#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
180#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
178#endif /* _LINUX_USBDEVICE_FS_H */ 181#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 3656b300de3a..69f39974c041 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -36,7 +36,6 @@ struct new_utsname {
36#include <linux/kref.h> 36#include <linux/kref.h>
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39#include <asm/atomic.h>
40 39
41struct uts_namespace { 40struct uts_namespace {
42 struct kref kref; 41 struct kref kref;
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
index c02128991ff7..7fc9746f22cd 100644
--- a/include/linux/uwb.h
+++ b/include/linux/uwb.h
@@ -597,7 +597,7 @@ void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t);
597void uwb_rc_neh_error(struct uwb_rc *, int); 597void uwb_rc_neh_error(struct uwb_rc *, int);
598void uwb_rc_reset_all(struct uwb_rc *rc); 598void uwb_rc_reset_all(struct uwb_rc *rc);
599void uwb_rc_pre_reset(struct uwb_rc *rc); 599void uwb_rc_pre_reset(struct uwb_rc *rc);
600void uwb_rc_post_reset(struct uwb_rc *rc); 600int uwb_rc_post_reset(struct uwb_rc *rc);
601 601
602/** 602/**
603 * uwb_rsv_is_owner - is the owner of this reservation the RC? 603 * uwb_rsv_is_owner - is the owner of this reservation the RC?
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
new file mode 100644
index 000000000000..2dfaa293ae8c
--- /dev/null
+++ b/include/linux/vgaarb.h
@@ -0,0 +1,210 @@
1/*
2 * The VGA aribiter manages VGA space routing and VGA resource decode to
3 * allow multiple VGA devices to be used in a system in a safe way.
4 *
5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>
8 */
9
10#ifndef LINUX_VGA_H
11
12#include <asm/vga.h>
13
14/* Legacy VGA regions */
15#define VGA_RSRC_NONE 0x00
16#define VGA_RSRC_LEGACY_IO 0x01
17#define VGA_RSRC_LEGACY_MEM 0x02
18#define VGA_RSRC_LEGACY_MASK (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)
19/* Non-legacy access */
20#define VGA_RSRC_NORMAL_IO 0x04
21#define VGA_RSRC_NORMAL_MEM 0x08
22
23/* Passing that instead of a pci_dev to use the system "default"
24 * device, that is the one used by vgacon. Archs will probably
25 * have to provide their own vga_default_device();
26 */
27#define VGA_DEFAULT_DEVICE (NULL)
28
29/* For use by clients */
30
31/**
32 * vga_set_legacy_decoding
33 *
34 * @pdev: pci device of the VGA card
35 * @decodes: bit mask of what legacy regions the card decodes
36 *
37 * Indicates to the arbiter if the card decodes legacy VGA IOs,
38 * legacy VGA Memory, both, or none. All cards default to both,
39 * the card driver (fbdev for example) should tell the arbiter
40 * if it has disabled legacy decoding, so the card can be left
41 * out of the arbitration process (and can be safe to take
42 * interrupts at any time.
43 */
44extern void vga_set_legacy_decoding(struct pci_dev *pdev,
45 unsigned int decodes);
46
47/**
48 * vga_get - acquire & locks VGA resources
49 *
50 * @pdev: pci device of the VGA card or NULL for the system default
51 * @rsrc: bit mask of resources to acquire and lock
52 * @interruptible: blocking should be interruptible by signals ?
53 *
54 * This function acquires VGA resources for the given
55 * card and mark those resources locked. If the resource requested
56 * are "normal" (and not legacy) resources, the arbiter will first check
57 * wether the card is doing legacy decoding for that type of resource. If
58 * yes, the lock is "converted" into a legacy resource lock.
59 * The arbiter will first look for all VGA cards that might conflict
60 * and disable their IOs and/or Memory access, inlcuding VGA forwarding
61 * on P2P bridges if necessary, so that the requested resources can
62 * be used. Then, the card is marked as locking these resources and
63 * the IO and/or Memory accesse are enabled on the card (including
64 * VGA forwarding on parent P2P bridges if any).
65 * This function will block if some conflicting card is already locking
66 * one of the required resources (or any resource on a different bus
67 * segment, since P2P bridges don't differenciate VGA memory and IO
68 * afaik). You can indicate wether this blocking should be interruptible
69 * by a signal (for userland interface) or not.
70 * Must not be called at interrupt time or in atomic context.
71 * If the card already owns the resources, the function succeeds.
72 * Nested calls are supported (a per-resource counter is maintained)
73 */
74
75extern int vga_get(struct pci_dev *pdev, unsigned int rsrc,
76 int interruptible);
77
78/**
79 * vga_get_interruptible
80 *
81 * Shortcut to vga_get
82 */
83
84static inline int vga_get_interruptible(struct pci_dev *pdev,
85 unsigned int rsrc)
86{
87 return vga_get(pdev, rsrc, 1);
88}
89
90/**
91 * vga_get_uninterruptible
92 *
93 * Shortcut to vga_get
94 */
95
96static inline int vga_get_uninterruptible(struct pci_dev *pdev,
97 unsigned int rsrc)
98{
99 return vga_get(pdev, rsrc, 0);
100}
101
102/**
103 * vga_tryget - try to acquire & lock legacy VGA resources
104 *
105 * @pdev: pci devivce of VGA card or NULL for system default
106 * @rsrc: bit mask of resources to acquire and lock
107 *
108 * This function performs the same operation as vga_get(), but
109 * will return an error (-EBUSY) instead of blocking if the resources
110 * are already locked by another card. It can be called in any context
111 */
112
113extern int vga_tryget(struct pci_dev *pdev, unsigned int rsrc);
114
115/**
116 * vga_put - release lock on legacy VGA resources
117 *
118 * @pdev: pci device of VGA card or NULL for system default
119 * @rsrc: but mask of resource to release
120 *
121 * This function releases resources previously locked by vga_get()
122 * or vga_tryget(). The resources aren't disabled right away, so
123 * that a subsequence vga_get() on the same card will succeed
124 * immediately. Resources have a counter, so locks are only
125 * released if the counter reaches 0.
126 */
127
128extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
129
130
131/**
132 * vga_default_device
133 *
134 * This can be defined by the platform. The default implementation
135 * is rather dumb and will probably only work properly on single
136 * vga card setups and/or x86 platforms.
137 *
138 * If your VGA default device is not PCI, you'll have to return
139 * NULL here. In this case, I assume it will not conflict with
140 * any PCI card. If this is not true, I'll have to define two archs
141 * hooks for enabling/disabling the VGA default device if that is
142 * possible. This may be a problem with real _ISA_ VGA cards, in
143 * addition to a PCI one. I don't know at this point how to deal
144 * with that card. Can theirs IOs be disabled at all ? If not, then
145 * I suppose it's a matter of having the proper arch hook telling
146 * us about it, so we basically never allow anybody to succeed a
147 * vga_get()...
148 */
149
150#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
151extern struct pci_dev *vga_default_device(void);
152#endif
153
154/**
155 * vga_conflicts
156 *
157 * Architectures should define this if they have several
158 * independant PCI domains that can afford concurrent VGA
159 * decoding
160 */
161
162#ifndef __ARCH_HAS_VGA_CONFLICT
163static inline int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2)
164{
165 return 1;
166}
167#endif
168
169/**
170 * vga_client_register
171 *
172 * @pdev: pci device of the VGA client
173 * @cookie: client cookie to be used in callbacks
174 * @irq_set_state: irq state change callback
175 * @set_vga_decode: vga decode change callback
176 *
177 * return value: 0 on success, -1 on failure
178 * Register a client with the VGA arbitration logic
179 *
180 * Clients have two callback mechanisms they can use.
181 * irq enable/disable callback -
182 * If a client can't disable its GPUs VGA resources, then we
183 * need to be able to ask it to turn off its irqs when we
184 * turn off its mem and io decoding.
185 * set_vga_decode
186 * If a client can disable its GPU VGA resource, it will
187 * get a callback from this to set the encode/decode state
188 *
189 * Rationale: we cannot disable VGA decode resources unconditionally
190 * some single GPU laptops seem to require ACPI or BIOS access to the
191 * VGA registers to control things like backlights etc.
192 * Hopefully newer multi-GPU laptops do something saner, and desktops
193 * won't have any special ACPI for this.
194 * They driver will get a callback when VGA arbitration is first used
195 * by userspace since we some older X servers have issues.
196 */
197#if defined(CONFIG_VGA_ARB)
198int vga_client_register(struct pci_dev *pdev, void *cookie,
199 void (*irq_set_state)(void *cookie, bool state),
200 unsigned int (*set_vga_decode)(void *cookie, bool state));
201#else
202static inline int vga_client_register(struct pci_dev *pdev, void *cookie,
203 void (*irq_set_state)(void *cookie, bool state),
204 unsigned int (*set_vga_decode)(void *cookie, bool state))
205{
206 return 0;
207}
208#endif
209
210#endif /* LINUX_VGA_H */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 74f16876f38d..b59e78c57161 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -167,6 +167,7 @@ enum v4l2_ctrl_type {
167 V4L2_CTRL_TYPE_BUTTON = 4, 167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5, 168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
170}; 171};
171 172
172enum v4l2_tuner_type { 173enum v4l2_tuner_type {
@@ -252,10 +253,12 @@ struct v4l2_capability {
252#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 253#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
253#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ 254#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
254#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ 255#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
256#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
255 257
256#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 258#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
257#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 259#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
258#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 260#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
261#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
259 262
260#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 263#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
261#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 264#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
@@ -275,7 +278,9 @@ struct v4l2_pix_format {
275 __u32 priv; /* private data, depends on pixelformat */ 278 __u32 priv; /* private data, depends on pixelformat */
276}; 279};
277 280
278/* Pixel format FOURCC depth Description */ 281/* Pixel format FOURCC depth Description */
282
283/* RGB formats */
279#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ 284#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
280#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ 285#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
281#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ 286#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
@@ -286,12 +291,20 @@ struct v4l2_pix_format {
286#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 291#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
287#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 292#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
288#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ 293#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
294
295/* Grey formats */
289#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 297#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
298
299/* Palette formats */
291#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ 300#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
301
302/* Luminance+Chrominance formats */
292#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ 303#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ 304#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ 305#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
306#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
307#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ 308#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ 309#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
297#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ 310#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
@@ -301,6 +314,10 @@ struct v4l2_pix_format {
301#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ 314#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
302#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ 315#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
303#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ 316#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
317#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
318#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
319#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
320#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
304 321
305/* two planes -- one Y, one Cr + Cb interleaved */ 322/* two planes -- one Y, one Cr + Cb interleaved */
306#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ 323#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
@@ -308,25 +325,17 @@ struct v4l2_pix_format {
308#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 325#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
309#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 326#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
310 327
311/* The following formats are not defined in the V4L2 specification */ 328/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
312#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
313#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
314#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
315#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
316#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
317
318/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
319#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 329#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
320#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 330#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
321#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ 331#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
322 332#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10bit raw bayer */
323/* 333 /* 10bit raw bayer DPCM compressed to 8 bits */
324 * 10bit raw bayer, expanded to 16 bits
325 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
326 */
327#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0')
328/* 10bit raw bayer DPCM compressed to 8 bits */
329#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 334#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
335 /*
336 * 10bit raw bayer, expanded to 16 bits
337 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
338 */
330#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ 339#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
331 340
332/* compressed formats */ 341/* compressed formats */
@@ -350,7 +359,6 @@ struct v4l2_pix_format {
350#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 359#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
351#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 360#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
352#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 361#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
353#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
354#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 362#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
355#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
356 364
@@ -367,6 +375,7 @@ struct v4l2_fmtdesc {
367}; 375};
368 376
369#define V4L2_FMT_FLAG_COMPRESSED 0x0001 377#define V4L2_FMT_FLAG_COMPRESSED 0x0001
378#define V4L2_FMT_FLAG_EMULATED 0x0002
370 379
371#if 1 380#if 1
372 /* Experimental Frame Size and frame rate enumeration */ 381 /* Experimental Frame Size and frame rate enumeration */
@@ -788,11 +797,12 @@ struct v4l2_control {
788 797
789struct v4l2_ext_control { 798struct v4l2_ext_control {
790 __u32 id; 799 __u32 id;
791 __u32 reserved2[2]; 800 __u32 size;
801 __u32 reserved2[1];
792 union { 802 union {
793 __s32 value; 803 __s32 value;
794 __s64 value64; 804 __s64 value64;
795 void *reserved; 805 char *string;
796 }; 806 };
797} __attribute__ ((packed)); 807} __attribute__ ((packed));
798 808
@@ -808,6 +818,7 @@ struct v4l2_ext_controls {
808#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ 818#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
809#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 819#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
810#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 820#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
821#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
811 822
812#define V4L2_CTRL_ID_MASK (0x0fffffff) 823#define V4L2_CTRL_ID_MASK (0x0fffffff)
813#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 824#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -899,9 +910,10 @@ enum v4l2_colorfx {
899 V4L2_COLORFX_SEPIA = 2, 910 V4L2_COLORFX_SEPIA = 2,
900}; 911};
901#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 912#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
913#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
902 914
903/* last CID + 1 */ 915/* last CID + 1 */
904#define V4L2_CID_LASTP1 (V4L2_CID_BASE+33) 916#define V4L2_CID_LASTP1 (V4L2_CID_BASE+34)
905 917
906/* MPEG-class control IDs defined by V4L2 */ 918/* MPEG-class control IDs defined by V4L2 */
907#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 919#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1147,6 +1159,39 @@ enum v4l2_exposure_auto_type {
1147 1159
1148#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1160#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1149 1161
1162/* FM Modulator class control IDs */
1163#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1164#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
1165
1166#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
1167#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
1168#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
1169#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
1170#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
1171
1172#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
1173#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
1174#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
1175
1176#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
1177#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
1178#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
1179#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
1180#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
1181
1182#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
1183#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
1184#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
1185
1186#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
1187enum v4l2_preemphasis {
1188 V4L2_PREEMPHASIS_DISABLED = 0,
1189 V4L2_PREEMPHASIS_50_uS = 1,
1190 V4L2_PREEMPHASIS_75_uS = 2,
1191};
1192#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
1193#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
1194
1150/* 1195/*
1151 * T U N I N G 1196 * T U N I N G
1152 */ 1197 */
@@ -1181,6 +1226,7 @@ struct v4l2_modulator {
1181#define V4L2_TUNER_CAP_LANG2 0x0020 1226#define V4L2_TUNER_CAP_LANG2 0x0020
1182#define V4L2_TUNER_CAP_SAP 0x0020 1227#define V4L2_TUNER_CAP_SAP 0x0020
1183#define V4L2_TUNER_CAP_LANG1 0x0040 1228#define V4L2_TUNER_CAP_LANG1 0x0040
1229#define V4L2_TUNER_CAP_RDS 0x0080
1184 1230
1185/* Flags for the 'rxsubchans' field */ 1231/* Flags for the 'rxsubchans' field */
1186#define V4L2_TUNER_SUB_MONO 0x0001 1232#define V4L2_TUNER_SUB_MONO 0x0001
@@ -1188,6 +1234,7 @@ struct v4l2_modulator {
1188#define V4L2_TUNER_SUB_LANG2 0x0004 1234#define V4L2_TUNER_SUB_LANG2 0x0004
1189#define V4L2_TUNER_SUB_SAP 0x0004 1235#define V4L2_TUNER_SUB_SAP 0x0004
1190#define V4L2_TUNER_SUB_LANG1 0x0008 1236#define V4L2_TUNER_SUB_LANG1 0x0008
1237#define V4L2_TUNER_SUB_RDS 0x0010
1191 1238
1192/* Values for the 'audmode' field */ 1239/* Values for the 'audmode' field */
1193#define V4L2_TUNER_MODE_MONO 0x0000 1240#define V4L2_TUNER_MODE_MONO 0x0000
@@ -1213,6 +1260,27 @@ struct v4l2_hw_freq_seek {
1213}; 1260};
1214 1261
1215/* 1262/*
1263 * R D S
1264 */
1265
1266struct v4l2_rds_data {
1267 __u8 lsb;
1268 __u8 msb;
1269 __u8 block;
1270} __attribute__ ((packed));
1271
1272#define V4L2_RDS_BLOCK_MSK 0x7
1273#define V4L2_RDS_BLOCK_A 0
1274#define V4L2_RDS_BLOCK_B 1
1275#define V4L2_RDS_BLOCK_C 2
1276#define V4L2_RDS_BLOCK_D 3
1277#define V4L2_RDS_BLOCK_C_ALT 4
1278#define V4L2_RDS_BLOCK_INVALID 7
1279
1280#define V4L2_RDS_BLOCK_CORRECTED 0x40
1281#define V4L2_RDS_BLOCK_ERROR 0x80
1282
1283/*
1216 * A U D I O 1284 * A U D I O
1217 */ 1285 */
1218struct v4l2_audio { 1286struct v4l2_audio {
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4fca4f5440ba..057a2e010758 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -34,7 +34,7 @@ struct virtqueue {
34 * out_num: the number of sg readable by other side 34 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 35 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 36 * data: the token identifying the buffer.
37 * Returns 0 or an error. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * @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.
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index b3c4a60ceeb3..095e10d148b4 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,10 +2,9 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio console */
8#define VIRTIO_ID_9P 9
9/* Maximum number of virtio channels per partition (1 for now) */ 8/* Maximum number of virtio channels per partition (1 for now) */
10#define MAX_9P_CHAN 1 9#define MAX_9P_CHAN 1
11 10
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index 8726ff77763e..1418f048cb34 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -2,11 +2,9 @@
2#define _LINUX_VIRTIO_BALLOON_H 2#define _LINUX_VIRTIO_BALLOON_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio_balloon */
8#define VIRTIO_ID_BALLOON 5
9
10/* The feature bitmap for virtio balloon */ 8/* The feature bitmap for virtio balloon */
11#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 */
12 10
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 8dab9f2b8832..fd294c56d571 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -3,11 +3,9 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7 8
8/* The ID for virtio_block */
9#define VIRTIO_ID_BLOCK 2
10
11/* Feature bits */ 9/* Feature bits */
12#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 10#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
13#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 11#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
@@ -16,9 +14,7 @@
16#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ 14#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
17#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*/
18#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 16#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
20
21#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
22 18
23struct virtio_blk_config { 19struct virtio_blk_config {
24 /* The capacity (in 512-byte sectors). */ 20 /* The capacity (in 512-byte sectors). */
@@ -35,9 +31,19 @@ struct virtio_blk_config {
35 } geometry; 31 } geometry;
36 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 32 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
37 __u32 blk_size; 33 __u32 blk_size;
38 __u8 identify[VIRTIO_BLK_ID_BYTES];
39} __attribute__((packed)); 34} __attribute__((packed));
40 35
36/*
37 * Command types
38 *
39 * Usage is a bit tricky as some bits are used as flags and some are not.
40 *
41 * Rules:
42 * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
43 * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
44 * and may not be combined with any of the other flags.
45 */
46
41/* These two define direction. */ 47/* These two define direction. */
42#define VIRTIO_BLK_T_IN 0 48#define VIRTIO_BLK_T_IN 0
43#define VIRTIO_BLK_T_OUT 1 49#define VIRTIO_BLK_T_OUT 1
@@ -45,6 +51,9 @@ struct virtio_blk_config {
45/* This bit says it's a scsi command, not an actual read or write. */ 51/* This bit says it's a scsi command, not an actual read or write. */
46#define VIRTIO_BLK_T_SCSI_CMD 2 52#define VIRTIO_BLK_T_SCSI_CMD 2
47 53
54/* Cache flush command */
55#define VIRTIO_BLK_T_FLUSH 4
56
48/* Barrier before this op. */ 57/* Barrier before this op. */
49#define VIRTIO_BLK_T_BARRIER 0x80000000 58#define VIRTIO_BLK_T_BARRIER 0x80000000
50 59
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e547e3c8ee9a..0093dd7c1d6f 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,8 +109,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
109 unsigned int fbit) 109 unsigned int fbit)
110{ 110{
111 /* Did you forget to fix assumptions on max features? */ 111 /* Did you forget to fix assumptions on max features? */
112 if (__builtin_constant_p(fbit)) 112 MAYBE_BUILD_BUG_ON(fbit >= 32);
113 BUILD_BUG_ON(fbit >= 32);
114 113
115 if (fbit < VIRTIO_TRANSPORT_F_START) 114 if (fbit < VIRTIO_TRANSPORT_F_START)
116 virtio_check_driver_offered_feature(vdev, fbit); 115 virtio_check_driver_offered_feature(vdev, fbit);
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index dc161115ae35..fe885174cc1f 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -1,13 +1,11 @@
1#ifndef _LINUX_VIRTIO_CONSOLE_H 1#ifndef _LINUX_VIRTIO_CONSOLE_H
2#define _LINUX_VIRTIO_CONSOLE_H 2#define _LINUX_VIRTIO_CONSOLE_H
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/virtio_ids.h>
4#include <linux/virtio_config.h> 5#include <linux/virtio_config.h>
5/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 6/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
6 * anyone can use the definitions to implement compatible drivers/servers. */ 7 * anyone can use the definitions to implement compatible drivers/servers. */
7 8
8/* The ID for virtio console */
9#define VIRTIO_ID_CONSOLE 3
10
11/* Feature bits */ 9/* Feature bits */
12#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 10#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
13 11
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h
new file mode 100644
index 000000000000..06660c0a78d7
--- /dev/null
+++ b/include/linux/virtio_ids.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_VIRTIO_IDS_H
2#define _LINUX_VIRTIO_IDS_H
3/*
4 * Virtio IDs
5 *
6 * This header is BSD licensed so anyone can use the definitions to implement
7 * compatible drivers/servers.
8 */
9
10#define VIRTIO_ID_NET 1 /* virtio net */
11#define VIRTIO_ID_BLOCK 2 /* virtio block */
12#define VIRTIO_ID_CONSOLE 3 /* virtio console */
13#define VIRTIO_ID_RNG 4 /* virtio ring */
14#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
15#define VIRTIO_ID_9P 9 /* 9p virtio console */
16
17#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index d8dd539c9f48..085e42298ce5 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -3,12 +3,10 @@
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7#include <linux/if_ether.h> 8#include <linux/if_ether.h>
8 9
9/* The ID for virtio_net */
10#define VIRTIO_ID_NET 1
11
12/* The feature bitmap for virtio net */ 10/* The feature bitmap for virtio net */
13#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */ 11#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
14#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */ 12#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h
index 1a85dab8a940..c4d5de896f0c 100644
--- a/include/linux/virtio_rng.h
+++ b/include/linux/virtio_rng.h
@@ -2,9 +2,7 @@
2#define _LINUX_VIRTIO_RNG_H 2#define _LINUX_VIRTIO_RNG_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
6 7
7/* The ID for virtio_rng */
8#define VIRTIO_ID_RNG 4
9
10#endif /* _LINUX_VIRTIO_RNG_H */ 8#endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index a43ebec3a7b9..227c2a585e4f 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -115,4 +115,10 @@ extern rwlock_t vmlist_lock;
115extern struct vm_struct *vmlist; 115extern struct vm_struct *vmlist;
116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
117 117
118struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
119 const size_t *sizes, int nr_vms,
120 size_t align, gfp_t gfp_mask);
121
122void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
123
118#endif /* _LINUX_VMALLOC_H */ 124#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 81a97cf8f0a0..2d0f222388a8 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -166,15 +166,8 @@ static inline unsigned long zone_page_state(struct zone *zone,
166 return x; 166 return x;
167} 167}
168 168
169extern unsigned long global_lru_pages(void); 169extern unsigned long global_reclaimable_pages(void);
170 170extern unsigned long zone_reclaimable_pages(struct zone *zone);
171static inline unsigned long zone_lru_pages(struct zone *zone)
172{
173 return (zone_page_state(zone, NR_ACTIVE_ANON)
174 + zone_page_state(zone, NR_ACTIVE_FILE)
175 + zone_page_state(zone, NR_INACTIVE_ANON)
176 + zone_page_state(zone, NR_INACTIVE_FILE));
177}
178 171
179#ifdef CONFIG_NUMA 172#ifdef CONFIG_NUMA
180/* 173/*
@@ -210,11 +203,6 @@ extern void zone_statistics(struct zone *, struct zone *);
210 203
211#endif /* CONFIG_NUMA */ 204#endif /* CONFIG_NUMA */
212 205
213#define __add_zone_page_state(__z, __i, __d) \
214 __mod_zone_page_state(__z, __i, __d)
215#define __sub_zone_page_state(__z, __i, __d) \
216 __mod_zone_page_state(__z, __i,-(__d))
217
218#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) 206#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
219#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 207#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
220 208
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 02c1c0288770..7ffa11f06232 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,17 +1,6 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4#ifdef __KERNEL__
5struct notifier_block;
6
7struct vt_notifier_param {
8 struct vc_data *vc; /* VC on which the update happened */
9 unsigned int c; /* Printed char */
10};
11
12extern int register_vt_notifier(struct notifier_block *nb);
13extern int unregister_vt_notifier(struct notifier_block *nb);
14#endif
15 4
16/* 5/*
17 * These constants are also useful for user-level apps (e.g., VC 6 * These constants are also useful for user-level apps (e.g., VC
@@ -74,4 +63,25 @@ struct vt_consize {
74#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 63#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
75#define VT_GETHIFONTMASK 0x560D /* return hi font mask */ 64#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
76 65
66struct vt_event {
67 unsigned int event;
68#define VT_EVENT_SWITCH 0x0001 /* Console switch */
69#define VT_EVENT_BLANK 0x0002 /* Screen blank */
70#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
71#define VT_EVENT_RESIZE 0x0008 /* Resize display */
72#define VT_MAX_EVENT 0x000F
73 unsigned int oldev; /* Old console */
74 unsigned int newev; /* New console (if changing) */
75 unsigned int pad[4]; /* Padding for expansion */
76};
77
78#define VT_WAITEVENT 0x560E /* Wait for an event */
79
80struct vt_setactivate {
81 unsigned int console;
82 struct vt_mode mode;
83};
84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86
77#endif /* _LINUX_VT_H */ 87#endif /* _LINUX_VT_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 2f1113467f70..c0c4e1103a73 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -13,6 +13,7 @@
13#include <linux/console_struct.h> 13#include <linux/console_struct.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/consolemap.h> 15#include <linux/consolemap.h>
16#include <linux/notifier.h>
16 17
17/* 18/*
18 * Presently, a lot of graphics programs do not restore the contents of 19 * Presently, a lot of graphics programs do not restore the contents of
@@ -91,7 +92,8 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
91#endif 92#endif
92 93
93/* vt.c */ 94/* vt.c */
94int vt_waitactive(int vt); 95void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
96int vt_waitactive(int n);
95void change_console(struct vc_data *new_vc); 97void change_console(struct vc_data *new_vc);
96void reset_vc(struct vc_data *vc); 98void reset_vc(struct vc_data *vc);
97extern int unbind_con_driver(const struct consw *csw, int first, int last, 99extern int unbind_con_driver(const struct consw *csw, int first, int last,
@@ -116,4 +118,16 @@ struct vt_spawn_console {
116}; 118};
117extern struct vt_spawn_console vt_spawn_con; 119extern struct vt_spawn_console vt_spawn_con;
118 120
121extern int vt_move_to_console(unsigned int vt, int alloc);
122
123/* Interfaces for VC notification of character events (for accessibility etc) */
124
125struct vt_notifier_param {
126 struct vc_data *vc; /* VC on which the update happened */
127 unsigned int c; /* Printed char */
128};
129
130extern int register_vt_notifier(struct notifier_block *nb);
131extern int unregister_vt_notifier(struct notifier_block *nb);
132
119#endif /* _VT_KERN_H */ 133#endif /* _VT_KERN_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index cf3c2f5dba51..a48e16b77d5e 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -26,8 +26,8 @@
26#include <asm/current.h> 26#include <asm/current.h>
27 27
28typedef struct __wait_queue wait_queue_t; 28typedef struct __wait_queue wait_queue_t;
29typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int sync, void *key); 29typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
30int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 30int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
31 31
32struct __wait_queue { 32struct __wait_queue {
33 unsigned int flags; 33 unsigned int flags;
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index cb24204851f7..5b4c6c772a9b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1132,6 +1132,14 @@ struct __compat_iw_event {
1132}; 1132};
1133#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer) 1133#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer)
1134#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length) 1134#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length)
1135
1136/* Size of the various events for compat */
1137#define IW_EV_COMPAT_CHAR_LEN (IW_EV_COMPAT_LCP_LEN + IFNAMSIZ)
1138#define IW_EV_COMPAT_UINT_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(__u32))
1139#define IW_EV_COMPAT_FREQ_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_freq))
1140#define IW_EV_COMPAT_PARAM_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_param))
1141#define IW_EV_COMPAT_ADDR_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct sockaddr))
1142#define IW_EV_COMPAT_QUAL_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_quality))
1135#define IW_EV_COMPAT_POINT_LEN \ 1143#define IW_EV_COMPAT_POINT_LEN \
1136 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ 1144 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \
1137 IW_EV_COMPAT_POINT_OFF) 1145 IW_EV_COMPAT_POINT_OFF)
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 6f69968eab24..38e8c4d9289e 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -16,6 +16,12 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18/* 18/*
19 * WM97xx variants
20 */
21#define WM97xx_GENERIC 0x0000
22#define WM97xx_WM1613 0x1613
23
24/*
19 * WM97xx AC97 Touchscreen registers 25 * WM97xx AC97 Touchscreen registers
20 */ 26 */
21#define AC97_WM97XX_DIGITISER1 0x76 27#define AC97_WM97XX_DIGITISER1 0x76
@@ -283,9 +289,28 @@ struct wm97xx {
283 unsigned pen_is_down:1; /* Pen is down */ 289 unsigned pen_is_down:1; /* Pen is down */
284 unsigned aux_waiting:1; /* aux measurement waiting */ 290 unsigned aux_waiting:1; /* aux measurement waiting */
285 unsigned pen_probably_down:1; /* used in polling mode */ 291 unsigned pen_probably_down:1; /* used in polling mode */
292 u16 variant; /* WM97xx chip variant */
286 u16 suspend_mode; /* PRP in suspend mode */ 293 u16 suspend_mode; /* PRP in suspend mode */
287}; 294};
288 295
296struct wm97xx_batt_pdata {
297 int batt_aux;
298 int temp_aux;
299 int charge_gpio;
300 int min_voltage;
301 int max_voltage;
302 int batt_div;
303 int batt_mult;
304 int temp_div;
305 int temp_mult;
306 int batt_tech;
307 char *batt_name;
308};
309
310struct wm97xx_pdata {
311 struct wm97xx_batt_pdata *batt_pdata; /* battery data */
312};
313
289/* 314/*
290 * Codec GPIO access (not supported on WM9705) 315 * Codec GPIO access (not supported on WM9705)
291 * This can be used to set/get codec GPIO and Virtual GPIO status. 316 * This can be used to set/get codec GPIO and Virtual GPIO status.
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
index 9681d1ab0e4f..a1d6419c2ff8 100644
--- a/include/linux/wm97xx_batt.h
+++ b/include/linux/wm97xx_batt.h
@@ -3,22 +3,12 @@
3 3
4#include <linux/wm97xx.h> 4#include <linux/wm97xx.h>
5 5
6struct wm97xx_batt_info { 6#warning This file will be removed soon, use wm97xx.h instead!
7 int batt_aux; 7
8 int temp_aux; 8#define wm97xx_batt_info wm97xx_batt_pdata
9 int charge_gpio;
10 int min_voltage;
11 int max_voltage;
12 int batt_div;
13 int batt_mult;
14 int temp_div;
15 int temp_mult;
16 int batt_tech;
17 char *batt_name;
18};
19 9
20#ifdef CONFIG_BATTERY_WM97XX 10#ifdef CONFIG_BATTERY_WM97XX
21void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); 11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
22#else 12#else
23static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} 13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
24#endif 14#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 6273fa97b527..cf24c20de9e4 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -94,7 +94,7 @@ struct execute_work {
94/* 94/*
95 * initialize all of a work item in one go 95 * initialize all of a work item in one go
96 * 96 *
97 * NOTE! No point in using "atomic_long_set()": useing a direct 97 * NOTE! No point in using "atomic_long_set()": using a direct
98 * assignment of the work data initializer allows the compiler 98 * assignment of the work data initializer allows the compiler
99 * to generate better code. 99 * to generate better code.
100 */ 100 */
@@ -207,6 +207,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
207 207
208extern void flush_workqueue(struct workqueue_struct *wq); 208extern void flush_workqueue(struct workqueue_struct *wq);
209extern void flush_scheduled_work(void); 209extern void flush_scheduled_work(void);
210extern void flush_delayed_work(struct delayed_work *work);
210 211
211extern int schedule_work(struct work_struct *work); 212extern int schedule_work(struct work_struct *work);
212extern int schedule_work_on(int cpu, struct work_struct *work); 213extern int schedule_work_on(int cpu, struct work_struct *work);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 3224820c8514..66ebddcff664 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -14,17 +14,6 @@ extern struct list_head inode_in_use;
14extern struct list_head inode_unused; 14extern struct list_head inode_unused;
15 15
16/* 16/*
17 * Yes, writeback.h requires sched.h
18 * No, sched.h is not included from here.
19 */
20static inline int task_is_pdflush(struct task_struct *task)
21{
22 return task->flags & PF_FLUSHER;
23}
24
25#define current_is_pdflush() task_is_pdflush(current)
26
27/*
28 * fs/fs-writeback.c 17 * fs/fs-writeback.c
29 */ 18 */
30enum writeback_sync_modes { 19enum writeback_sync_modes {
@@ -40,6 +29,8 @@ enum writeback_sync_modes {
40struct writeback_control { 29struct writeback_control {
41 struct backing_dev_info *bdi; /* If !NULL, only write back this 30 struct backing_dev_info *bdi; /* If !NULL, only write back this
42 queue */ 31 queue */
32 struct super_block *sb; /* if !NULL, only write inodes from
33 this super_block */
43 enum writeback_sync_modes sync_mode; 34 enum writeback_sync_modes sync_mode;
44 unsigned long *older_than_this; /* If !NULL, only write back inodes 35 unsigned long *older_than_this; /* If !NULL, only write back inodes
45 older than this */ 36 older than this */
@@ -59,7 +50,6 @@ struct writeback_control {
59 unsigned encountered_congestion:1; /* An output: a queue is full */ 50 unsigned encountered_congestion:1; /* An output: a queue is full */
60 unsigned for_kupdate:1; /* A kupdate writeback */ 51 unsigned for_kupdate:1; /* A kupdate writeback */
61 unsigned for_reclaim:1; /* Invoked from the page allocator */ 52 unsigned for_reclaim:1; /* Invoked from the page allocator */
62 unsigned for_writepages:1; /* This is a writepages() call */
63 unsigned range_cyclic:1; /* range_start is cyclic */ 53 unsigned range_cyclic:1; /* range_start is cyclic */
64 unsigned more_io:1; /* more io to be dispatched */ 54 unsigned more_io:1; /* more io to be dispatched */
65 /* 55 /*
@@ -76,9 +66,13 @@ struct writeback_control {
76/* 66/*
77 * fs/fs-writeback.c 67 * fs/fs-writeback.c
78 */ 68 */
79void writeback_inodes(struct writeback_control *wbc); 69struct bdi_writeback;
80int inode_wait(void *); 70int inode_wait(void *);
81void sync_inodes_sb(struct super_block *, int wait); 71void writeback_inodes_sb(struct super_block *);
72void sync_inodes_sb(struct super_block *);
73void writeback_inodes_wbc(struct writeback_control *wbc);
74long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
75void wakeup_flusher_threads(long nr_pages);
82 76
83/* writeback.h requires fs.h; it, too, is not included from here. */ 77/* writeback.h requires fs.h; it, too, is not included from here. */
84static inline void wait_on_inode(struct inode *inode) 78static inline void wait_on_inode(struct inode *inode)
@@ -98,7 +92,6 @@ static inline void inode_sync_wait(struct inode *inode)
98/* 92/*
99 * mm/page-writeback.c 93 * mm/page-writeback.c
100 */ 94 */
101int wakeup_pdflush(long nr_pages);
102void laptop_io_completion(void); 95void laptop_io_completion(void);
103void laptop_sync_completion(void); 96void laptop_sync_completion(void);
104void throttle_vm_writeout(gfp_t gfp_mask); 97void throttle_vm_writeout(gfp_t gfp_mask);
@@ -117,21 +110,20 @@ extern int laptop_mode;
117extern unsigned long determine_dirtyable_memory(void); 110extern unsigned long determine_dirtyable_memory(void);
118 111
119extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 112extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
120 struct file *filp, void __user *buffer, size_t *lenp, 113 void __user *buffer, size_t *lenp,
121 loff_t *ppos); 114 loff_t *ppos);
122extern int dirty_background_bytes_handler(struct ctl_table *table, int write, 115extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
123 struct file *filp, void __user *buffer, size_t *lenp, 116 void __user *buffer, size_t *lenp,
124 loff_t *ppos); 117 loff_t *ppos);
125extern int dirty_ratio_handler(struct ctl_table *table, int write, 118extern int dirty_ratio_handler(struct ctl_table *table, int write,
126 struct file *filp, void __user *buffer, size_t *lenp, 119 void __user *buffer, size_t *lenp,
127 loff_t *ppos); 120 loff_t *ppos);
128extern int dirty_bytes_handler(struct ctl_table *table, int write, 121extern int dirty_bytes_handler(struct ctl_table *table, int write,
129 struct file *filp, void __user *buffer, size_t *lenp, 122 void __user *buffer, size_t *lenp,
130 loff_t *ppos); 123 loff_t *ppos);
131 124
132struct ctl_table; 125struct ctl_table;
133struct file; 126int dirty_writeback_centisecs_handler(struct ctl_table *, int,
134int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
135 void __user *, size_t *, loff_t *); 127 void __user *, size_t *, loff_t *);
136 128
137void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, 129void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
@@ -150,17 +142,12 @@ balance_dirty_pages_ratelimited(struct address_space *mapping)
150typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, 142typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
151 void *data); 143 void *data);
152 144
153int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
154int generic_writepages(struct address_space *mapping, 145int generic_writepages(struct address_space *mapping,
155 struct writeback_control *wbc); 146 struct writeback_control *wbc);
156int write_cache_pages(struct address_space *mapping, 147int write_cache_pages(struct address_space *mapping,
157 struct writeback_control *wbc, writepage_t writepage, 148 struct writeback_control *wbc, writepage_t writepage,
158 void *data); 149 void *data);
159int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 150int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
160int sync_page_range(struct inode *inode, struct address_space *mapping,
161 loff_t pos, loff_t count);
162int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
163 loff_t pos, loff_t count);
164void set_page_dirty_balance(struct page *page, int page_mkwrite); 151void set_page_dirty_balance(struct page *page, int page_mkwrite);
165void writeback_set_ratelimit(void); 152void writeback_set_ratelimit(void);
166 153
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index d131e352cfe1..5c84af8c5f6f 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -49,6 +49,7 @@ struct xattr_handler {
49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); 49ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); 50ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); 51ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
52int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
52int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); 53int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
53int vfs_removexattr(struct dentry *, const char *); 54int vfs_removexattr(struct dentry *, const char *);
54 55
diff --git a/include/media/davinci/ccdc_types.h b/include/media/davinci/ccdc_types.h
new file mode 100644
index 000000000000..5773874bf266
--- /dev/null
+++ b/include/media/davinci/ccdc_types.h
@@ -0,0 +1,43 @@
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 **************************************************************************/
19#ifndef _CCDC_TYPES_H
20#define _CCDC_TYPES_H
21enum ccdc_pixfmt {
22 CCDC_PIXFMT_RAW,
23 CCDC_PIXFMT_YCBCR_16BIT,
24 CCDC_PIXFMT_YCBCR_8BIT
25};
26
27enum ccdc_frmfmt {
28 CCDC_FRMFMT_PROGRESSIVE,
29 CCDC_FRMFMT_INTERLACED
30};
31
32/* PIXEL ORDER IN MEMORY from LSB to MSB */
33/* only applicable for 8-bit input mode */
34enum ccdc_pixorder {
35 CCDC_PIXORDER_YCBYCR,
36 CCDC_PIXORDER_CBYCRY,
37};
38
39enum ccdc_buftype {
40 CCDC_BUFTYPE_FLD_INTERLEAVED,
41 CCDC_BUFTYPE_FLD_SEPARATED
42};
43#endif
diff --git a/include/media/davinci/dm355_ccdc.h b/include/media/davinci/dm355_ccdc.h
new file mode 100644
index 000000000000..df8a7b107477
--- /dev/null
+++ b/include/media/davinci/dm355_ccdc.h
@@ -0,0 +1,321 @@
1/*
2 * Copyright (C) 2005-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#ifndef _DM355_CCDC_H
19#define _DM355_CCDC_H
20#include <media/davinci/ccdc_types.h>
21#include <media/davinci/vpfe_types.h>
22
23/* enum for No of pixel per line to be avg. in Black Clamping */
24enum ccdc_sample_length {
25 CCDC_SAMPLE_1PIXELS,
26 CCDC_SAMPLE_2PIXELS,
27 CCDC_SAMPLE_4PIXELS,
28 CCDC_SAMPLE_8PIXELS,
29 CCDC_SAMPLE_16PIXELS
30};
31
32/* enum for No of lines in Black Clamping */
33enum ccdc_sample_line {
34 CCDC_SAMPLE_1LINES,
35 CCDC_SAMPLE_2LINES,
36 CCDC_SAMPLE_4LINES,
37 CCDC_SAMPLE_8LINES,
38 CCDC_SAMPLE_16LINES
39};
40
41/* enum for Alaw gama width */
42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_13_4,
44 CCDC_GAMMA_BITS_12_3,
45 CCDC_GAMMA_BITS_11_2,
46 CCDC_GAMMA_BITS_10_1,
47 CCDC_GAMMA_BITS_09_0
48};
49
50enum ccdc_colpats {
51 CCDC_RED,
52 CCDC_GREEN_RED,
53 CCDC_GREEN_BLUE,
54 CCDC_BLUE
55};
56
57struct ccdc_col_pat {
58 enum ccdc_colpats olop;
59 enum ccdc_colpats olep;
60 enum ccdc_colpats elop;
61 enum ccdc_colpats elep;
62};
63
64enum ccdc_datasft {
65 CCDC_DATA_NO_SHIFT,
66 CCDC_DATA_SHIFT_1BIT,
67 CCDC_DATA_SHIFT_2BIT,
68 CCDC_DATA_SHIFT_3BIT,
69 CCDC_DATA_SHIFT_4BIT,
70 CCDC_DATA_SHIFT_5BIT,
71 CCDC_DATA_SHIFT_6BIT
72};
73
74enum ccdc_data_size {
75 CCDC_DATA_16BITS,
76 CCDC_DATA_15BITS,
77 CCDC_DATA_14BITS,
78 CCDC_DATA_13BITS,
79 CCDC_DATA_12BITS,
80 CCDC_DATA_11BITS,
81 CCDC_DATA_10BITS,
82 CCDC_DATA_8BITS
83};
84enum ccdc_mfilt1 {
85 CCDC_NO_MEDIAN_FILTER1,
86 CCDC_AVERAGE_FILTER1,
87 CCDC_MEDIAN_FILTER1
88};
89
90enum ccdc_mfilt2 {
91 CCDC_NO_MEDIAN_FILTER2,
92 CCDC_AVERAGE_FILTER2,
93 CCDC_MEDIAN_FILTER2
94};
95
96/* structure for ALaw */
97struct ccdc_a_law {
98 /* Enable/disable A-Law */
99 unsigned char enable;
100 /* Gama Width Input */
101 enum ccdc_gamma_width gama_wd;
102};
103
104/* structure for Black Clamping */
105struct ccdc_black_clamp {
106 /* only if bClampEnable is TRUE */
107 unsigned char b_clamp_enable;
108 /* only if bClampEnable is TRUE */
109 enum ccdc_sample_length sample_pixel;
110 /* only if bClampEnable is TRUE */
111 enum ccdc_sample_line sample_ln;
112 /* only if bClampEnable is TRUE */
113 unsigned short start_pixel;
114 /* only if bClampEnable is FALSE */
115 unsigned short sgain;
116 unsigned short dc_sub;
117};
118
119/* structure for Black Level Compensation */
120struct ccdc_black_compensation {
121 /* Constant value to subtract from Red component */
122 unsigned char r;
123 /* Constant value to subtract from Gr component */
124 unsigned char gr;
125 /* Constant value to subtract from Blue component */
126 unsigned char b;
127 /* Constant value to subtract from Gb component */
128 unsigned char gb;
129};
130
131struct ccdc_float {
132 int integer;
133 unsigned int decimal;
134};
135
136#define CCDC_CSC_COEFF_TABLE_SIZE 16
137/* structure for color space converter */
138struct ccdc_csc {
139 unsigned char enable;
140 /*
141 * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99.
142 * example - to use 1.03, set integer part as 1, and decimal part as 3
143 * to use -1.03, set integer part as -1 and decimal part as 3
144 */
145 struct ccdc_float coeff[CCDC_CSC_COEFF_TABLE_SIZE];
146};
147
148/* Structures for Vertical Defect Correction*/
149enum ccdc_vdf_csl {
150 CCDC_VDF_NORMAL,
151 CCDC_VDF_HORZ_INTERPOL_SAT,
152 CCDC_VDF_HORZ_INTERPOL
153};
154
155enum ccdc_vdf_cuda {
156 CCDC_VDF_WHOLE_LINE_CORRECT,
157 CCDC_VDF_UPPER_DISABLE
158};
159
160enum ccdc_dfc_mwr {
161 CCDC_DFC_MWR_WRITE_COMPLETE,
162 CCDC_DFC_WRITE_REG
163};
164
165enum ccdc_dfc_mrd {
166 CCDC_DFC_READ_COMPLETE,
167 CCDC_DFC_READ_REG
168};
169
170enum ccdc_dfc_ma_rst {
171 CCDC_DFC_INCR_ADDR,
172 CCDC_DFC_CLR_ADDR
173};
174
175enum ccdc_dfc_mclr {
176 CCDC_DFC_CLEAR_COMPLETE,
177 CCDC_DFC_CLEAR
178};
179
180struct ccdc_dft_corr_ctl {
181 enum ccdc_vdf_csl vdfcsl;
182 enum ccdc_vdf_cuda vdfcuda;
183 unsigned int vdflsft;
184};
185
186struct ccdc_dft_corr_mem_ctl {
187 enum ccdc_dfc_mwr dfcmwr;
188 enum ccdc_dfc_mrd dfcmrd;
189 enum ccdc_dfc_ma_rst dfcmarst;
190 enum ccdc_dfc_mclr dfcmclr;
191};
192
193#define CCDC_DFT_TABLE_SIZE 16
194/*
195 * Main Structure for vertical defect correction. Vertical defect
196 * correction can correct upto 16 defects if defects less than 16
197 * then pad the rest with 0
198 */
199struct ccdc_vertical_dft {
200 unsigned char ver_dft_en;
201 unsigned char gen_dft_en;
202 unsigned int saturation_ctl;
203 struct ccdc_dft_corr_ctl dft_corr_ctl;
204 struct ccdc_dft_corr_mem_ctl dft_corr_mem_ctl;
205 int table_size;
206 unsigned int dft_corr_horz[CCDC_DFT_TABLE_SIZE];
207 unsigned int dft_corr_vert[CCDC_DFT_TABLE_SIZE];
208 unsigned int dft_corr_sub1[CCDC_DFT_TABLE_SIZE];
209 unsigned int dft_corr_sub2[CCDC_DFT_TABLE_SIZE];
210 unsigned int dft_corr_sub3[CCDC_DFT_TABLE_SIZE];
211};
212
213struct ccdc_data_offset {
214 unsigned char horz_offset;
215 unsigned char vert_offset;
216};
217
218/*
219 * Structure for CCDC configuration parameters for raw capture mode passed
220 * by application
221 */
222struct ccdc_config_params_raw {
223 /* data shift to be applied before storing */
224 enum ccdc_datasft datasft;
225 /* data size value from 8 to 16 bits */
226 enum ccdc_data_size data_sz;
227 /* median filter for sdram */
228 enum ccdc_mfilt1 mfilt1;
229 enum ccdc_mfilt2 mfilt2;
230 /* low pass filter enable/disable */
231 unsigned char lpf_enable;
232 /* Threshold of median filter */
233 int med_filt_thres;
234 /*
235 * horz and vertical data offset. Appliable for defect correction
236 * and lsc
237 */
238 struct ccdc_data_offset data_offset;
239 /* Structure for Optional A-Law */
240 struct ccdc_a_law alaw;
241 /* Structure for Optical Black Clamp */
242 struct ccdc_black_clamp blk_clamp;
243 /* Structure for Black Compensation */
244 struct ccdc_black_compensation blk_comp;
245 /* struture for vertical Defect Correction Module Configuration */
246 struct ccdc_vertical_dft vertical_dft;
247 /* structure for color space converter Module Configuration */
248 struct ccdc_csc csc;
249 /* color patters for bayer capture */
250 struct ccdc_col_pat col_pat_field0;
251 struct ccdc_col_pat col_pat_field1;
252};
253
254#ifdef __KERNEL__
255#include <linux/io.h>
256
257#define CCDC_WIN_PAL {0, 0, 720, 576}
258#define CCDC_WIN_VGA {0, 0, 640, 480}
259
260struct ccdc_params_ycbcr {
261 /* pixel format */
262 enum ccdc_pixfmt pix_fmt;
263 /* progressive or interlaced frame */
264 enum ccdc_frmfmt frm_fmt;
265 /* video window */
266 struct v4l2_rect win;
267 /* field id polarity */
268 enum vpfe_pin_pol fid_pol;
269 /* vertical sync polarity */
270 enum vpfe_pin_pol vd_pol;
271 /* horizontal sync polarity */
272 enum vpfe_pin_pol hd_pol;
273 /* enable BT.656 embedded sync mode */
274 int bt656_enable;
275 /* cb:y:cr:y or y:cb:y:cr in memory */
276 enum ccdc_pixorder pix_order;
277 /* interleaved or separated fields */
278 enum ccdc_buftype buf_type;
279};
280
281/* Gain applied to Raw Bayer data */
282struct ccdc_gain {
283 unsigned short r_ye;
284 unsigned short gr_cy;
285 unsigned short gb_g;
286 unsigned short b_mg;
287};
288
289/* Structure for CCDC configuration parameters for raw capture mode */
290struct ccdc_params_raw {
291 /* pixel format */
292 enum ccdc_pixfmt pix_fmt;
293 /* progressive or interlaced frame */
294 enum ccdc_frmfmt frm_fmt;
295 /* video window */
296 struct v4l2_rect win;
297 /* field id polarity */
298 enum vpfe_pin_pol fid_pol;
299 /* vertical sync polarity */
300 enum vpfe_pin_pol vd_pol;
301 /* horizontal sync polarity */
302 enum vpfe_pin_pol hd_pol;
303 /* interleaved or separated fields */
304 enum ccdc_buftype buf_type;
305 /* Gain values */
306 struct ccdc_gain gain;
307 /* offset */
308 unsigned int ccdc_offset;
309 /* horizontal flip enable */
310 unsigned char horz_flip_enable;
311 /*
312 * enable to store the image in inverse order in memory
313 * (bottom to top)
314 */
315 unsigned char image_invert_enable;
316 /* Configurable part of raw data */
317 struct ccdc_config_params_raw config_params;
318};
319
320#endif
321#endif /* DM355_CCDC_H */
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h
new file mode 100644
index 000000000000..3e178eb52fb3
--- /dev/null
+++ b/include/media/davinci/dm644x_ccdc.h
@@ -0,0 +1,184 @@
1/*
2 * Copyright (C) 2006-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#ifndef _DM644X_CCDC_H
19#define _DM644X_CCDC_H
20#include <media/davinci/ccdc_types.h>
21#include <media/davinci/vpfe_types.h>
22
23/* enum for No of pixel per line to be avg. in Black Clamping*/
24enum ccdc_sample_length {
25 CCDC_SAMPLE_1PIXELS,
26 CCDC_SAMPLE_2PIXELS,
27 CCDC_SAMPLE_4PIXELS,
28 CCDC_SAMPLE_8PIXELS,
29 CCDC_SAMPLE_16PIXELS
30};
31
32/* enum for No of lines in Black Clamping */
33enum ccdc_sample_line {
34 CCDC_SAMPLE_1LINES,
35 CCDC_SAMPLE_2LINES,
36 CCDC_SAMPLE_4LINES,
37 CCDC_SAMPLE_8LINES,
38 CCDC_SAMPLE_16LINES
39};
40
41/* enum for Alaw gama width */
42enum ccdc_gama_width {
43 CCDC_GAMMA_BITS_15_6,
44 CCDC_GAMMA_BITS_14_5,
45 CCDC_GAMMA_BITS_13_4,
46 CCDC_GAMMA_BITS_12_3,
47 CCDC_GAMMA_BITS_11_2,
48 CCDC_GAMMA_BITS_10_1,
49 CCDC_GAMMA_BITS_09_0
50};
51
52enum ccdc_data_size {
53 CCDC_DATA_16BITS,
54 CCDC_DATA_15BITS,
55 CCDC_DATA_14BITS,
56 CCDC_DATA_13BITS,
57 CCDC_DATA_12BITS,
58 CCDC_DATA_11BITS,
59 CCDC_DATA_10BITS,
60 CCDC_DATA_8BITS
61};
62
63/* structure for ALaw */
64struct ccdc_a_law {
65 /* Enable/disable A-Law */
66 unsigned char enable;
67 /* Gama Width Input */
68 enum ccdc_gama_width gama_wd;
69};
70
71/* structure for Black Clamping */
72struct ccdc_black_clamp {
73 unsigned char enable;
74 /* only if bClampEnable is TRUE */
75 enum ccdc_sample_length sample_pixel;
76 /* only if bClampEnable is TRUE */
77 enum ccdc_sample_line sample_ln;
78 /* only if bClampEnable is TRUE */
79 unsigned short start_pixel;
80 /* only if bClampEnable is TRUE */
81 unsigned short sgain;
82 /* only if bClampEnable is FALSE */
83 unsigned short dc_sub;
84};
85
86/* structure for Black Level Compensation */
87struct ccdc_black_compensation {
88 /* Constant value to subtract from Red component */
89 char r;
90 /* Constant value to subtract from Gr component */
91 char gr;
92 /* Constant value to subtract from Blue component */
93 char b;
94 /* Constant value to subtract from Gb component */
95 char gb;
96};
97
98/* structure for fault pixel correction */
99struct ccdc_fault_pixel {
100 /* Enable or Disable fault pixel correction */
101 unsigned char enable;
102 /* Number of fault pixel */
103 unsigned short fp_num;
104 /* Address of fault pixel table */
105 unsigned int fpc_table_addr;
106};
107
108/* Structure for CCDC configuration parameters for raw capture mode passed
109 * by application
110 */
111struct ccdc_config_params_raw {
112 /* data size value from 8 to 16 bits */
113 enum ccdc_data_size data_sz;
114 /* Structure for Optional A-Law */
115 struct ccdc_a_law alaw;
116 /* Structure for Optical Black Clamp */
117 struct ccdc_black_clamp blk_clamp;
118 /* Structure for Black Compensation */
119 struct ccdc_black_compensation blk_comp;
120 /* Structure for Fault Pixel Module Configuration */
121 struct ccdc_fault_pixel fault_pxl;
122};
123
124
125#ifdef __KERNEL__
126#include <linux/io.h>
127/* Define to enable/disable video port */
128#define FP_NUM_BYTES 4
129/* Define for extra pixel/line and extra lines/frame */
130#define NUM_EXTRAPIXELS 8
131#define NUM_EXTRALINES 8
132
133/* settings for commonly used video formats */
134#define CCDC_WIN_PAL {0, 0, 720, 576}
135/* ntsc square pixel */
136#define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
137
138/* Structure for CCDC configuration parameters for raw capture mode */
139struct ccdc_params_raw {
140 /* pixel format */
141 enum ccdc_pixfmt pix_fmt;
142 /* progressive or interlaced frame */
143 enum ccdc_frmfmt frm_fmt;
144 /* video window */
145 struct v4l2_rect win;
146 /* field id polarity */
147 enum vpfe_pin_pol fid_pol;
148 /* vertical sync polarity */
149 enum vpfe_pin_pol vd_pol;
150 /* horizontal sync polarity */
151 enum vpfe_pin_pol hd_pol;
152 /* interleaved or separated fields */
153 enum ccdc_buftype buf_type;
154 /*
155 * enable to store the image in inverse
156 * order in memory(bottom to top)
157 */
158 unsigned char image_invert_enable;
159 /* configurable paramaters */
160 struct ccdc_config_params_raw config_params;
161};
162
163struct ccdc_params_ycbcr {
164 /* pixel format */
165 enum ccdc_pixfmt pix_fmt;
166 /* progressive or interlaced frame */
167 enum ccdc_frmfmt frm_fmt;
168 /* video window */
169 struct v4l2_rect win;
170 /* field id polarity */
171 enum vpfe_pin_pol fid_pol;
172 /* vertical sync polarity */
173 enum vpfe_pin_pol vd_pol;
174 /* horizontal sync polarity */
175 enum vpfe_pin_pol hd_pol;
176 /* enable BT.656 embedded sync mode */
177 int bt656_enable;
178 /* cb:y:cr:y or y:cb:y:cr in memory */
179 enum ccdc_pixorder pix_order;
180 /* interleaved or separated fields */
181 enum ccdc_buftype buf_type;
182};
183#endif
184#endif /* _DM644X_CCDC_H */
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
new file mode 100644
index 000000000000..71d8982e13ff
--- /dev/null
+++ b/include/media/davinci/vpfe_capture.h
@@ -0,0 +1,198 @@
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
19#ifndef _VPFE_CAPTURE_H
20#define _VPFE_CAPTURE_H
21
22#ifdef __KERNEL__
23
24/* Header files */
25#include <media/v4l2-dev.h>
26#include <linux/videodev2.h>
27#include <linux/clk.h>
28#include <linux/i2c.h>
29#include <media/v4l2-ioctl.h>
30#include <media/v4l2-device.h>
31#include <media/videobuf-dma-contig.h>
32#include <media/davinci/vpfe_types.h>
33
34#define VPFE_CAPTURE_NUM_DECODERS 5
35
36/* Macros */
37#define VPFE_MAJOR_RELEASE 0
38#define VPFE_MINOR_RELEASE 0
39#define VPFE_BUILD 1
40#define VPFE_CAPTURE_VERSION_CODE ((VPFE_MAJOR_RELEASE << 16) | \
41 (VPFE_MINOR_RELEASE << 8) | \
42 VPFE_BUILD)
43
44#define CAPTURE_DRV_NAME "vpfe-capture"
45
46struct vpfe_pixel_format {
47 struct v4l2_fmtdesc fmtdesc;
48 /* bytes per pixel */
49 int bpp;
50};
51
52struct vpfe_std_info {
53 int active_pixels;
54 int active_lines;
55 /* current frame format */
56 int frame_format;
57};
58
59struct vpfe_route {
60 u32 input;
61 u32 output;
62};
63
64struct vpfe_subdev_info {
65 /* Sub device name */
66 char name[32];
67 /* Sub device group id */
68 int grp_id;
69 /* Number of inputs supported */
70 int num_inputs;
71 /* inputs available at the sub device */
72 struct v4l2_input *inputs;
73 /* Sub dev routing information for each input */
74 struct vpfe_route *routes;
75 /* check if sub dev supports routing */
76 int can_route;
77 /* ccdc bus/interface configuration */
78 struct vpfe_hw_if_param ccdc_if_params;
79 /* i2c subdevice board info */
80 struct i2c_board_info board_info;
81};
82
83struct vpfe_config {
84 /* Number of sub devices connected to vpfe */
85 int num_subdevs;
86 /* information about each subdev */
87 struct vpfe_subdev_info *sub_devs;
88 /* evm card info */
89 char *card_name;
90 /* ccdc name */
91 char *ccdc;
92 /* vpfe clock */
93 struct clk *vpssclk;
94 struct clk *slaveclk;
95};
96
97struct vpfe_device {
98 /* V4l2 specific parameters */
99 /* Identifies video device for this channel */
100 struct video_device *video_dev;
101 /* sub devices */
102 struct v4l2_subdev **sd;
103 /* vpfe cfg */
104 struct vpfe_config *cfg;
105 /* V4l2 device */
106 struct v4l2_device v4l2_dev;
107 /* parent device */
108 struct device *pdev;
109 /* Used to keep track of state of the priority */
110 struct v4l2_prio_state prio;
111 /* number of open instances of the channel */
112 u32 usrs;
113 /* Indicates id of the field which is being displayed */
114 u32 field_id;
115 /* flag to indicate whether decoder is initialized */
116 u8 initialized;
117 /* current interface type */
118 struct vpfe_hw_if_param vpfe_if_params;
119 /* ptr to currently selected sub device */
120 struct vpfe_subdev_info *current_subdev;
121 /* current input at the sub device */
122 int current_input;
123 /* Keeps track of the information about the standard */
124 struct vpfe_std_info std_info;
125 /* std index into std table */
126 int std_index;
127 /* CCDC IRQs used when CCDC/ISIF output to SDRAM */
128 unsigned int ccdc_irq0;
129 unsigned int ccdc_irq1;
130 /* number of buffers in fbuffers */
131 u32 numbuffers;
132 /* List of buffer pointers for storing frames */
133 u8 *fbuffers[VIDEO_MAX_FRAME];
134 /* Pointer pointing to current v4l2_buffer */
135 struct videobuf_buffer *cur_frm;
136 /* Pointer pointing to next v4l2_buffer */
137 struct videobuf_buffer *next_frm;
138 /*
139 * This field keeps track of type of buffer exchange mechanism
140 * user has selected
141 */
142 enum v4l2_memory memory;
143 /* Used to store pixel format */
144 struct v4l2_format fmt;
145 /*
146 * used when IMP is chained to store the crop window which
147 * is different from the image window
148 */
149 struct v4l2_rect crop;
150 /* Buffer queue used in video-buf */
151 struct videobuf_queue buffer_queue;
152 /* Queue of filled frames */
153 struct list_head dma_queue;
154 /* Used in video-buf */
155 spinlock_t irqlock;
156 /* IRQ lock for DMA queue */
157 spinlock_t dma_queue_lock;
158 /* lock used to access this structure */
159 struct mutex lock;
160 /* number of users performing IO */
161 u32 io_usrs;
162 /* Indicates whether streaming started */
163 u8 started;
164 /*
165 * offset where second field starts from the starting of the
166 * buffer for field seperated YCbCr formats
167 */
168 u32 field_off;
169};
170
171/* File handle structure */
172struct vpfe_fh {
173 struct vpfe_device *vpfe_dev;
174 /* Indicates whether this file handle is doing IO */
175 u8 io_allowed;
176 /* Used to keep track priority of this instance */
177 enum v4l2_priority prio;
178};
179
180struct vpfe_config_params {
181 u8 min_numbuffers;
182 u8 numbuffers;
183 u32 min_bufsize;
184 u32 device_bufsize;
185};
186
187#endif /* End of __KERNEL__ */
188/**
189 * VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params
190 * This can be used to configure modules such as defect pixel correction,
191 * color space conversion, culling etc. This is an experimental ioctl that
192 * will change in future kernels. So use this ioctl with care !
193 * TODO: This is to be split into multiple ioctls and also explore the
194 * possibility of extending the v4l2 api to include this
195 **/
196#define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
197 void *)
198#endif /* _DAVINCI_VPFE_H */
diff --git a/include/media/davinci/vpfe_types.h b/include/media/davinci/vpfe_types.h
new file mode 100644
index 000000000000..76fb74bad08c
--- /dev/null
+++ b/include/media/davinci/vpfe_types.h
@@ -0,0 +1,51 @@
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#ifndef _VPFE_TYPES_H
19#define _VPFE_TYPES_H
20
21#ifdef __KERNEL__
22
23enum vpfe_pin_pol {
24 VPFE_PINPOL_POSITIVE,
25 VPFE_PINPOL_NEGATIVE
26};
27
28enum vpfe_hw_if_type {
29 /* BT656 - 8 bit */
30 VPFE_BT656,
31 /* BT1120 - 16 bit */
32 VPFE_BT1120,
33 /* Raw Bayer */
34 VPFE_RAW_BAYER,
35 /* YCbCr - 8 bit with external sync */
36 VPFE_YCBCR_SYNC_8,
37 /* YCbCr - 16 bit with external sync */
38 VPFE_YCBCR_SYNC_16,
39 /* BT656 - 10 bit */
40 VPFE_BT656_10BIT
41};
42
43/* interface description */
44struct vpfe_hw_if_param {
45 enum vpfe_hw_if_type if_type;
46 enum vpfe_pin_pol hdpol;
47 enum vpfe_pin_pol vdpol;
48};
49
50#endif
51#endif
diff --git a/include/media/davinci/vpss.h b/include/media/davinci/vpss.h
new file mode 100644
index 000000000000..fcdff745fae2
--- /dev/null
+++ b/include/media/davinci/vpss.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 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 * vpss - video processing subsystem module header file.
19 *
20 * Include this header file if a driver needs to configure vpss system
21 * module. It exports a set of library functions for video drivers to
22 * configure vpss system module functions such as clock enable/disable,
23 * vpss interrupt mux to arm, and other common vpss system module
24 * functions.
25 */
26#ifndef _VPSS_H
27#define _VPSS_H
28
29/* selector for ccdc input selection on DM355 */
30enum vpss_ccdc_source_sel {
31 VPSS_CCDCIN,
32 VPSS_HSSIIN
33};
34
35/* Used for enable/diable VPSS Clock */
36enum vpss_clock_sel {
37 /* DM355/DM365 */
38 VPSS_CCDC_CLOCK,
39 VPSS_IPIPE_CLOCK,
40 VPSS_H3A_CLOCK,
41 VPSS_CFALD_CLOCK,
42 /*
43 * When using VPSS_VENC_CLOCK_SEL in vpss_enable_clock() api
44 * following applies:-
45 * en = 0 selects ENC_CLK
46 * en = 1 selects ENC_CLK/2
47 */
48 VPSS_VENC_CLOCK_SEL,
49 VPSS_VPBE_CLOCK,
50};
51
52/* select input to ccdc on dm355 */
53int vpss_select_ccdc_source(enum vpss_ccdc_source_sel src_sel);
54/* enable/disable a vpss clock, 0 - success, -1 - failure */
55int vpss_enable_clock(enum vpss_clock_sel clock_sel, int en);
56
57/* wbl reset for dm644x */
58enum vpss_wbl_sel {
59 VPSS_PCR_AEW_WBL_0 = 16,
60 VPSS_PCR_AF_WBL_0,
61 VPSS_PCR_RSZ4_WBL_0,
62 VPSS_PCR_RSZ3_WBL_0,
63 VPSS_PCR_RSZ2_WBL_0,
64 VPSS_PCR_RSZ1_WBL_0,
65 VPSS_PCR_PREV_WBL_0,
66 VPSS_PCR_CCDC_WBL_O,
67};
68int vpss_clear_wbl_overflow(enum vpss_wbl_sel wbl_sel);
69#endif
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 9dcb632f6083..29f0e53cff94 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -31,8 +31,18 @@
31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
32#define IR_TYPE_OTHER 99 32#define IR_TYPE_OTHER 99
33 33
34#define IR_KEYTAB_TYPE u32 34#define IR_KEYTAB_TYPE u32
35#define IR_KEYTAB_SIZE 128 // enougth for rc5, probably need more some day ... 35#define IR_KEYTAB_SIZE 128 /* enougth for rc5, probably need more some day */
36
37struct ir_scancode {
38 u16 scancode;
39 u32 keycode;
40};
41
42struct ir_scancode_table {
43 struct ir_scancode *scan;
44 int size;
45};
36 46
37#define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ 47#define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \
38 ? tab[code] : KEY_RESERVED) 48 ? tab[code] : KEY_RESERVED)
@@ -93,7 +103,7 @@ struct card_ir {
93}; 103};
94 104
95void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 105void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
96 int ir_type, IR_KEYTAB_TYPE *ir_codes); 106 int ir_type, struct ir_scancode_table *ir_codes);
97void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 107void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
98void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 108void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
99 u32 ir_key, u32 ir_raw); 109 u32 ir_key, u32 ir_raw);
@@ -107,67 +117,63 @@ void ir_rc5_timer_keyup(unsigned long data);
107 117
108/* Keymaps to be used by other modules */ 118/* Keymaps to be used by other modules */
109 119
110extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; 120extern struct ir_scancode_table ir_codes_empty_table;
111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 121extern struct ir_scancode_table ir_codes_avermedia_table;
112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 122extern struct ir_scancode_table ir_codes_avermedia_dvbt_table;
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; 123extern struct ir_scancode_table ir_codes_avermedia_m135a_table;
114extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE]; 124extern struct ir_scancode_table ir_codes_avermedia_cardbus_table;
115extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 125extern struct ir_scancode_table ir_codes_apac_viewcomp_table;
116extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 126extern struct ir_scancode_table ir_codes_pixelview_table;
117extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 127extern struct ir_scancode_table ir_codes_pixelview_new_table;
118extern IR_KEYTAB_TYPE ir_codes_nebula[IR_KEYTAB_SIZE]; 128extern struct ir_scancode_table ir_codes_nebula_table;
119extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE]; 129extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table;
120extern IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE]; 130extern struct ir_scancode_table ir_codes_iodata_bctv7e_table;
121extern IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE]; 131extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table;
122extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE]; 132extern struct ir_scancode_table ir_codes_msi_tvanywhere_table;
123extern IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE]; 133extern struct ir_scancode_table ir_codes_cinergy_1400_table;
124extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE]; 134extern struct ir_scancode_table ir_codes_avertv_303_table;
125extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE]; 135extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table;
126extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE]; 136extern struct ir_scancode_table ir_codes_em_terratec_table;
127extern IR_KEYTAB_TYPE ir_codes_pinnacle_grey[IR_KEYTAB_SIZE]; 137extern struct ir_scancode_table ir_codes_pinnacle_grey_table;
128extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE]; 138extern struct ir_scancode_table ir_codes_flyvideo_table;
129extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE]; 139extern struct ir_scancode_table ir_codes_flydvb_table;
130extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE]; 140extern struct ir_scancode_table ir_codes_cinergy_table;
131extern IR_KEYTAB_TYPE ir_codes_eztv[IR_KEYTAB_SIZE]; 141extern struct ir_scancode_table ir_codes_eztv_table;
132extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 142extern struct ir_scancode_table ir_codes_avermedia_table;
133extern IR_KEYTAB_TYPE ir_codes_videomate_tv_pvr[IR_KEYTAB_SIZE]; 143extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table;
134extern IR_KEYTAB_TYPE ir_codes_manli[IR_KEYTAB_SIZE]; 144extern struct ir_scancode_table ir_codes_manli_table;
135extern IR_KEYTAB_TYPE ir_codes_gotview7135[IR_KEYTAB_SIZE]; 145extern struct ir_scancode_table ir_codes_gotview7135_table;
136extern IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE]; 146extern struct ir_scancode_table ir_codes_purpletv_table;
137extern IR_KEYTAB_TYPE ir_codes_pctv_sedna[IR_KEYTAB_SIZE]; 147extern struct ir_scancode_table ir_codes_pctv_sedna_table;
138extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE]; 148extern struct ir_scancode_table ir_codes_pv951_table;
139extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; 149extern struct ir_scancode_table ir_codes_rc5_tv_table;
140extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; 150extern struct ir_scancode_table ir_codes_winfast_table;
141extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE]; 151extern struct ir_scancode_table ir_codes_pinnacle_color_table;
142extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; 152extern struct ir_scancode_table ir_codes_hauppauge_new_table;
143extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE]; 153extern struct ir_scancode_table ir_codes_npgtech_table;
144extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE]; 154extern struct ir_scancode_table ir_codes_norwood_table;
145extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE]; 155extern struct ir_scancode_table ir_codes_proteus_2309_table;
146extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE]; 156extern struct ir_scancode_table ir_codes_budget_ci_old_table;
147extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; 157extern struct ir_scancode_table ir_codes_asus_pc39_table;
148extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; 158extern struct ir_scancode_table ir_codes_encore_enltv_table;
149extern IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE]; 159extern struct ir_scancode_table ir_codes_encore_enltv2_table;
150extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; 160extern struct ir_scancode_table ir_codes_tt_1500_table;
151extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; 161extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table;
152extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; 162extern struct ir_scancode_table ir_codes_behold_table;
153extern IR_KEYTAB_TYPE ir_codes_behold_columbus[IR_KEYTAB_SIZE]; 163extern struct ir_scancode_table ir_codes_behold_columbus_table;
154extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE]; 164extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table;
155extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; 165extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table;
156extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE]; 166extern struct ir_scancode_table ir_codes_powercolor_real_angel_table;
157extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE]; 167extern struct ir_scancode_table ir_codes_avermedia_a16d_table;
158extern IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE]; 168extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table;
159extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE]; 169extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table;
160extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; 170extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table;
161extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE]; 171extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table;
162extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE]; 172extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
163extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE]; 173extern struct ir_scancode_table ir_codes_kaiomy_table;
164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE]; 174extern struct ir_scancode_table ir_codes_dm1105_nec_table;
165extern IR_KEYTAB_TYPE ir_codes_evga_indtube[IR_KEYTAB_SIZE]; 175extern struct ir_scancode_table ir_codes_evga_indtube_table;
166 176extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
177extern struct ir_scancode_table ir_codes_videomate_s350_table;
178extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
167#endif 179#endif
168
169/*
170 * Local variables:
171 * c-basic-offset: 8
172 * End:
173 */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 3ad4ed5402fb..aaf65e8b1a40 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -6,7 +6,8 @@
6struct IR_i2c; 6struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 IR_KEYTAB_TYPE *ir_codes; 9 struct ir_scancode_table *ir_codes;
10
10 struct i2c_client *c; 11 struct i2c_client *c;
11 struct input_dev *input; 12 struct input_dev *input;
12 struct ir_input_state ir; 13 struct ir_input_state ir;
@@ -20,10 +21,27 @@ struct IR_i2c {
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 21 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 22};
22 23
24enum ir_kbd_get_key_fn {
25 IR_KBD_GET_KEY_CUSTOM = 0,
26 IR_KBD_GET_KEY_PIXELVIEW,
27 IR_KBD_GET_KEY_PV951,
28 IR_KBD_GET_KEY_HAUP,
29 IR_KBD_GET_KEY_KNC1,
30 IR_KBD_GET_KEY_FUSIONHDTV,
31 IR_KBD_GET_KEY_HAUP_XVR,
32 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS,
33};
34
23/* Can be passed when instantiating an ir_video i2c device */ 35/* Can be passed when instantiating an ir_video i2c device */
24struct IR_i2c_init_data { 36struct IR_i2c_init_data {
25 IR_KEYTAB_TYPE *ir_codes; 37 struct ir_scancode_table *ir_codes;
26 const char *name; 38 const char *name;
39 int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */
40 /*
41 * Specify either a function pointer or a value indicating one of
42 * ir_kbd_i2c's internal get_key functions
43 */
27 int (*get_key)(struct IR_i2c*, u32*, u32*); 44 int (*get_key)(struct IR_i2c*, u32*, u32*);
45 enum ir_kbd_get_key_fn internal_get_key_func;
28}; 46};
29#endif 47#endif
diff --git a/include/media/radio-si4713.h b/include/media/radio-si4713.h
new file mode 100644
index 000000000000..f6aae29c7741
--- /dev/null
+++ b/include/media/radio-si4713.h
@@ -0,0 +1,30 @@
1/*
2 * include/media/radio-si4713.h
3 *
4 * Board related data definitions for Si4713 radio transmitter chip.
5 *
6 * Copyright (c) 2009 Nokia Corporation
7 * Contact: Eduardo Valentin <eduardo.valentin@nokia.com>
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 *
13 */
14
15#ifndef RADIO_SI4713_H
16#define RADIO_SI4713_H
17
18#include <linux/i2c.h>
19
20#define SI4713_NAME "radio-si4713"
21
22/*
23 * Platform dependent definition
24 */
25struct radio_si4713_platform_data {
26 int i2c_bus;
27 struct i2c_board_info *subdev_board_info;
28};
29
30#endif /* ifndef RADIO_SI4713_H*/
diff --git a/include/media/si4713.h b/include/media/si4713.h
new file mode 100644
index 000000000000..99850a54ed09
--- /dev/null
+++ b/include/media/si4713.h
@@ -0,0 +1,49 @@
1/*
2 * include/media/si4713.h
3 *
4 * Board related data definitions for Si4713 i2c device driver.
5 *
6 * Copyright (c) 2009 Nokia Corporation
7 * Contact: Eduardo Valentin <eduardo.valentin@nokia.com>
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 *
13 */
14
15#ifndef SI4713_H
16#define SI4713_H
17
18/* The SI4713 I2C sensor chip has a fixed slave address of 0xc6 or 0x22. */
19#define SI4713_I2C_ADDR_BUSEN_HIGH 0x63
20#define SI4713_I2C_ADDR_BUSEN_LOW 0x11
21
22/*
23 * Platform dependent definition
24 */
25struct si4713_platform_data {
26 /* Set power state, zero is off, non-zero is on. */
27 int (*set_power)(int power);
28};
29
30/*
31 * Structure to query for Received Noise Level (RNL).
32 */
33struct si4713_rnl {
34 __u32 index; /* modulator index */
35 __u32 frequency; /* frequency to peform rnl measurement */
36 __s32 rnl; /* result of measurement in dBuV */
37 __u32 reserved[4]; /* drivers and apps must init this to 0 */
38};
39
40/*
41 * This is the ioctl number to query for rnl. Users must pass a
42 * struct si4713_rnl pointer specifying desired frequency in 'frequency' field
43 * following driver capabilities (i.e V4L2_TUNER_CAP_LOW).
44 * Driver must return measured value in the same struture, filling 'rnl' field.
45 */
46#define SI4713_IOC_MEASURE_RNL _IOWR('V', BASE_VIDIOC_PRIVATE + 0, \
47 struct si4713_rnl)
48
49#endif /* ifndef SI4713_H*/
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 23ecead35e7a..3d74e60032dd 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -16,24 +16,17 @@
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/videobuf-core.h> 18#include <media/videobuf-core.h>
19#include <media/v4l2-device.h>
19 20
20struct soc_camera_device { 21struct soc_camera_device {
21 struct list_head list; 22 struct list_head list;
22 struct device dev; 23 struct device dev;
23 struct device *control; 24 struct device *pdev; /* Platform device */
24 unsigned short width; /* Current window */ 25 s32 user_width;
25 unsigned short height; /* sizes */ 26 s32 user_height;
26 unsigned short x_min; /* Camera capabilities */
27 unsigned short y_min;
28 unsigned short x_current; /* Current window location */
29 unsigned short y_current;
30 unsigned short width_min; 27 unsigned short width_min;
31 unsigned short width_max;
32 unsigned short height_min; 28 unsigned short height_min;
33 unsigned short height_max;
34 unsigned short y_skip_top; /* Lines to skip at the top */ 29 unsigned short y_skip_top; /* Lines to skip at the top */
35 unsigned short gain;
36 unsigned short exposure;
37 unsigned char iface; /* Host number */ 30 unsigned char iface; /* Host number */
38 unsigned char devnum; /* Device number per host */ 31 unsigned char devnum; /* Device number per host */
39 unsigned char buswidth; /* See comment in .c */ 32 unsigned char buswidth; /* See comment in .c */
@@ -46,7 +39,6 @@ struct soc_camera_device {
46 struct soc_camera_format_xlate *user_formats; 39 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats; 40 int num_user_formats;
48 enum v4l2_field field; /* Preserve field over close() */ 41 enum v4l2_field field; /* Preserve field over close() */
49 struct module *owner;
50 void *host_priv; /* Per-device host private data */ 42 void *host_priv; /* Per-device host private data */
51 /* soc_camera.c private count. Only accessed with .video_lock held */ 43 /* soc_camera.c private count. Only accessed with .video_lock held */
52 int use_count; 44 int use_count;
@@ -59,8 +51,8 @@ struct soc_camera_file {
59}; 51};
60 52
61struct soc_camera_host { 53struct soc_camera_host {
54 struct v4l2_device v4l2_dev;
62 struct list_head list; 55 struct list_head list;
63 struct device *dev;
64 unsigned char nr; /* Host number */ 56 unsigned char nr; /* Host number */
65 void *priv; 57 void *priv;
66 const char *drv_name; 58 const char *drv_name;
@@ -73,9 +65,18 @@ struct soc_camera_host_ops {
73 void (*remove)(struct soc_camera_device *); 65 void (*remove)(struct soc_camera_device *);
74 int (*suspend)(struct soc_camera_device *, pm_message_t); 66 int (*suspend)(struct soc_camera_device *, pm_message_t);
75 int (*resume)(struct soc_camera_device *); 67 int (*resume)(struct soc_camera_device *);
68 /*
69 * .get_formats() is called for each client device format, but
70 * .put_formats() is only called once. Further, if any of the calls to
71 * .get_formats() fail, .put_formats() will not be called at all, the
72 * failing .get_formats() must then clean up internally.
73 */
76 int (*get_formats)(struct soc_camera_device *, int, 74 int (*get_formats)(struct soc_camera_device *, int,
77 struct soc_camera_format_xlate *); 75 struct soc_camera_format_xlate *);
78 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *); 76 void (*put_formats)(struct soc_camera_device *);
77 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
78 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *);
79 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *);
79 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); 80 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
80 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 81 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
81 void (*init_videobuf)(struct videobuf_queue *, 82 void (*init_videobuf)(struct videobuf_queue *,
@@ -83,7 +84,11 @@ struct soc_camera_host_ops {
83 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *); 84 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
84 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 85 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
85 int (*set_bus_param)(struct soc_camera_device *, __u32); 86 int (*set_bus_param)(struct soc_camera_device *, __u32);
87 int (*get_ctrl)(struct soc_camera_device *, struct v4l2_control *);
88 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
86 unsigned int (*poll)(struct file *, poll_table *); 89 unsigned int (*poll)(struct file *, poll_table *);
90 const struct v4l2_queryctrl *controls;
91 int num_controls;
87}; 92};
88 93
89#define SOCAM_SENSOR_INVERT_PCLK (1 << 0) 94#define SOCAM_SENSOR_INVERT_PCLK (1 << 0)
@@ -102,6 +107,12 @@ struct soc_camera_link {
102 int i2c_adapter_id; 107 int i2c_adapter_id;
103 struct i2c_board_info *board_info; 108 struct i2c_board_info *board_info;
104 const char *module_name; 109 const char *module_name;
110 /*
111 * For non-I2C devices platform platform has to provide methods to
112 * add a device to the system and to remove
113 */
114 int (*add_device)(struct soc_camera_link *, struct device *);
115 void (*del_device)(struct soc_camera_link *);
105 /* Optional callbacks to power on or off and reset the sensor */ 116 /* Optional callbacks to power on or off and reset the sensor */
106 int (*power)(struct device *, int); 117 int (*power)(struct device *, int);
107 int (*reset)(struct device *); 118 int (*reset)(struct device *);
@@ -115,27 +126,45 @@ struct soc_camera_link {
115 void (*free_bus)(struct soc_camera_link *); 126 void (*free_bus)(struct soc_camera_link *);
116}; 127};
117 128
118static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 129static inline struct soc_camera_device *to_soc_camera_dev(
130 const struct device *dev)
119{ 131{
120 return container_of(dev, struct soc_camera_device, dev); 132 return container_of(dev, struct soc_camera_device, dev);
121} 133}
122 134
123static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 135static inline struct soc_camera_host *to_soc_camera_host(
136 const struct device *dev)
124{ 137{
125 return dev_get_drvdata(dev); 138 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
139
140 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
126} 141}
127 142
128extern int soc_camera_host_register(struct soc_camera_host *ici); 143static inline struct soc_camera_link *to_soc_camera_link(
129extern void soc_camera_host_unregister(struct soc_camera_host *ici); 144 const struct soc_camera_device *icd)
130extern int soc_camera_device_register(struct soc_camera_device *icd); 145{
131extern void soc_camera_device_unregister(struct soc_camera_device *icd); 146 return icd->dev.platform_data;
147}
132 148
133extern int soc_camera_video_start(struct soc_camera_device *icd); 149static inline struct device *to_soc_camera_control(
134extern void soc_camera_video_stop(struct soc_camera_device *icd); 150 const struct soc_camera_device *icd)
151{
152 return dev_get_drvdata(&icd->dev);
153}
135 154
136extern const struct soc_camera_data_format *soc_camera_format_by_fourcc( 155static inline struct v4l2_subdev *soc_camera_to_subdev(
156 const struct soc_camera_device *icd)
157{
158 struct device *control = to_soc_camera_control(icd);
159 return dev_get_drvdata(control);
160}
161
162int soc_camera_host_register(struct soc_camera_host *ici);
163void soc_camera_host_unregister(struct soc_camera_host *ici);
164
165const struct soc_camera_data_format *soc_camera_format_by_fourcc(
137 struct soc_camera_device *icd, unsigned int fourcc); 166 struct soc_camera_device *icd, unsigned int fourcc);
138extern const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc( 167const struct soc_camera_format_xlate *soc_camera_xlate_by_fourcc(
139 struct soc_camera_device *icd, unsigned int fourcc); 168 struct soc_camera_device *icd, unsigned int fourcc);
140 169
141struct soc_camera_data_format { 170struct soc_camera_data_format {
@@ -163,30 +192,11 @@ struct soc_camera_format_xlate {
163}; 192};
164 193
165struct soc_camera_ops { 194struct soc_camera_ops {
166 struct module *owner;
167 int (*probe)(struct soc_camera_device *);
168 void (*remove)(struct soc_camera_device *);
169 int (*suspend)(struct soc_camera_device *, pm_message_t state); 195 int (*suspend)(struct soc_camera_device *, pm_message_t state);
170 int (*resume)(struct soc_camera_device *); 196 int (*resume)(struct soc_camera_device *);
171 int (*init)(struct soc_camera_device *);
172 int (*release)(struct soc_camera_device *);
173 int (*start_capture)(struct soc_camera_device *);
174 int (*stop_capture)(struct soc_camera_device *);
175 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
176 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
177 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
178 unsigned long (*query_bus_param)(struct soc_camera_device *); 197 unsigned long (*query_bus_param)(struct soc_camera_device *);
179 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 198 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
180 int (*get_chip_id)(struct soc_camera_device *,
181 struct v4l2_dbg_chip_ident *);
182 int (*set_std)(struct soc_camera_device *, v4l2_std_id *);
183 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 199 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
184#ifdef CONFIG_VIDEO_ADV_DEBUG
185 int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
186 int (*set_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
187#endif
188 int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
189 int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
190 const struct v4l2_queryctrl *controls; 200 const struct v4l2_queryctrl *controls;
191 int num_controls; 201 int num_controls;
192}; 202};
@@ -268,6 +278,21 @@ static inline unsigned long soc_camera_bus_param_compatible(
268 common_flags; 278 common_flags;
269} 279}
270 280
281static inline void soc_camera_limit_side(unsigned int *start,
282 unsigned int *length, unsigned int start_min,
283 unsigned int length_min, unsigned int length_max)
284{
285 if (*length < length_min)
286 *length = length_min;
287 else if (*length > length_max)
288 *length = length_max;
289
290 if (*start < start_min)
291 *start = start_min;
292 else if (*start > start_min + length_max - *length)
293 *start = start_min + length_max - *length;
294}
295
271extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 296extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
272 unsigned long flags); 297 unsigned long flags);
273 298
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 1d092b4678aa..bb70401b8141 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -12,15 +12,18 @@
12#define __SOC_CAMERA_H__ 12#define __SOC_CAMERA_H__
13 13
14#include <linux/videodev2.h> 14#include <linux/videodev2.h>
15#include <media/soc_camera.h>
16
17struct device;
15 18
16struct soc_camera_platform_info { 19struct soc_camera_platform_info {
17 int iface; 20 const char *format_name;
18 char *format_name;
19 unsigned long format_depth; 21 unsigned long format_depth;
20 struct v4l2_pix_format format; 22 struct v4l2_pix_format format;
21 unsigned long bus_param; 23 unsigned long bus_param;
22 void (*power)(int); 24 struct device *dev;
23 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 25 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
26 struct soc_camera_link link;
24}; 27};
25 28
26#endif /* __SOC_CAMERA_H__ */ 29#endif /* __SOC_CAMERA_H__ */
diff --git a/include/media/tuner.h b/include/media/tuner.h
index cbf97f45fbec..4d5b53ff17db 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -126,6 +126,9 @@
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78 126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
127#define TUNER_PHILIPS_FM1216MK5 79 127#define TUNER_PHILIPS_FM1216MK5 79
128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ 128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
129#define TUNER_PARTSNIC_PTI_5NF05 81
130#define TUNER_PHILIPS_CU1216L 82
131#define TUNER_NXP_TDA18271 83
129 132
130/* tv card specific */ 133/* tv card specific */
131#define TDA9887_PRESENT (1<<0) 134#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/tvp514x.h b/include/media/tvp514x.h
index 5e7ee968c6dc..74387e83f5b9 100644
--- a/include/media/tvp514x.h
+++ b/include/media/tvp514x.h
@@ -104,10 +104,6 @@ enum tvp514x_output {
104 * @ vs_polarity: VSYNC Polarity configuration for current interface. 104 * @ vs_polarity: VSYNC Polarity configuration for current interface.
105 */ 105 */
106struct tvp514x_platform_data { 106struct tvp514x_platform_data {
107 char *master;
108 int (*power_set) (enum v4l2_power on);
109 int (*ifparm) (struct v4l2_ifparm *p);
110 int (*priv_data_set) (void *);
111 /* Interface control params */ 107 /* Interface control params */
112 bool clk_polarity; 108 bool clk_polarity;
113 bool hs_polarity; 109 bool hs_polarity;
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 94e908c0d7a0..cf16689adba7 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -135,6 +135,9 @@ enum {
135 /* module adv7175: just ident 7175 */ 135 /* module adv7175: just ident 7175 */
136 V4L2_IDENT_ADV7175 = 7175, 136 V4L2_IDENT_ADV7175 = 7175,
137 137
138 /* module adv7180: just ident 7180 */
139 V4L2_IDENT_ADV7180 = 7180,
140
138 /* module saa7185: just ident 7185 */ 141 /* module saa7185: just ident 7185 */
139 V4L2_IDENT_SAA7185 = 7185, 142 V4L2_IDENT_SAA7185 = 7185,
140 143
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 33a18426ab9b..1c25b10da34b 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -139,29 +139,23 @@ struct v4l2_subdev_ops;
139/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
140 Only call request_module if module_name != NULL. 140 Only call request_module if module_name != NULL.
141 The client_type argument is the name of the chip that's on the adapter. */ 141 The client_type argument is the name of the chip that's on the adapter. */
142struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev, 142struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
143 struct i2c_adapter *adapter,
144 const char *module_name, const char *client_type, u8 addr);
145/* Probe and load an i2c module and return an initialized v4l2_subdev struct.
146 Only call request_module if module_name != NULL.
147 The client_type argument is the name of the chip that's on the adapter. */
148struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter, 143 struct i2c_adapter *adapter,
150 const char *module_name, const char *client_type, 144 const char *module_name, const char *client_type,
151 const unsigned short *addrs); 145 int irq, void *platform_data,
152/* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */ 146 u8 addr, const unsigned short *probe_addrs);
153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev,
154 struct i2c_adapter *adapter,
155 const char *module_name, const char *client_type, u8 addr);
156 147
157/* Load an i2c module and return an initialized v4l2_subdev struct. 148/* Load an i2c module and return an initialized v4l2_subdev struct.
158 Only call request_module if module_name != NULL. 149 Only call request_module if module_name != NULL.
159 The client_type argument is the name of the chip that's on the adapter. */ 150 The client_type argument is the name of the chip that's on the adapter. */
160struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, 151static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
161 struct i2c_adapter *adapter, 152 struct i2c_adapter *adapter,
162 const char *module_name, const char *client_type, 153 const char *module_name, const char *client_type,
163 int irq, void *platform_data, 154 u8 addr, const unsigned short *probe_addrs)
164 u8 addr, const unsigned short *probe_addrs); 155{
156 return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, module_name,
157 client_type, 0, NULL, addr, probe_addrs);
158}
165 159
166struct i2c_board_info; 160struct i2c_board_info;
167 161
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2058dd45e915..73c9867d744c 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -100,8 +100,10 @@ struct video_device
100 100
101 Also note that vdev->minor is set to -1 if the registration failed. */ 101 Also note that vdev->minor is set to -1 if the registration failed. */
102int __must_check video_register_device(struct video_device *vdev, int type, int nr); 102int __must_check video_register_device(struct video_device *vdev, int type, int nr);
103int __must_check video_register_device_index(struct video_device *vdev, 103
104 int type, int nr, int index); 104/* Same as video_register_device, but no warning is issued if the desired
105 device node number was already in use. */
106int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr);
105 107
106/* Unregister video devices. Will do nothing if vdev == NULL or 108/* Unregister video devices. Will do nothing if vdev == NULL or
107 vdev->minor < 0. */ 109 vdev->minor < 0. */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5dcb36785529..d411345f244b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -137,6 +137,8 @@ struct v4l2_subdev_tuner_ops {
137 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 137 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
138 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 138 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
139 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 139 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
140 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
141 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
140 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 142 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
141 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 143 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
142 int (*s_standby)(struct v4l2_subdev *sd); 144 int (*s_standby)(struct v4l2_subdev *sd);
@@ -220,6 +222,9 @@ struct v4l2_subdev_video_ops {
220 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 222 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
221 int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 223 int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
222 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 224 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
225 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
226 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
227 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
223 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 228 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
224 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 229 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
225 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 230 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index b77c1478c99f..a7fb54808a23 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -38,6 +38,8 @@
38 * @P9_DEBUG_SLABS: memory management tracing 38 * @P9_DEBUG_SLABS: memory management tracing
39 * @P9_DEBUG_FCALL: verbose dump of protocol messages 39 * @P9_DEBUG_FCALL: verbose dump of protocol messages
40 * @P9_DEBUG_FID: fid allocation/deallocation tracking 40 * @P9_DEBUG_FID: fid allocation/deallocation tracking
41 * @P9_DEBUG_PKT: packet marshalling/unmarshalling
42 * @P9_DEBUG_FSC: FS-cache tracing
41 * 43 *
42 * These flags are passed at mount time to turn on various levels of 44 * These flags are passed at mount time to turn on various levels of
43 * verbosity and tracing which will be output to the system logs. 45 * verbosity and tracing which will be output to the system logs.
@@ -54,6 +56,7 @@ enum p9_debug_flags {
54 P9_DEBUG_FCALL = (1<<8), 56 P9_DEBUG_FCALL = (1<<8),
55 P9_DEBUG_FID = (1<<9), 57 P9_DEBUG_FID = (1<<9),
56 P9_DEBUG_PKT = (1<<10), 58 P9_DEBUG_PKT = (1<<10),
59 P9_DEBUG_FSC = (1<<11),
57}; 60};
58 61
59#ifdef CONFIG_NET_9P_DEBUG 62#ifdef CONFIG_NET_9P_DEBUG
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index e26812274b75..fb00b329f0d3 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -159,8 +159,7 @@ struct p9_client {
159 * @qid: the &p9_qid server identifier this handle points to 159 * @qid: the &p9_qid server identifier this handle points to
160 * @iounit: the server reported maximum transaction size for this file 160 * @iounit: the server reported maximum transaction size for this file
161 * @uid: the numeric uid of the local user who owns this handle 161 * @uid: the numeric uid of the local user who owns this handle
162 * @aux: transport specific information (unused?) 162 * @rdir: readdir accounting structure (allocated on demand)
163 * @rdir_fpos: tracks offset of file position when reading directory contents
164 * @flist: per-client-instance fid tracking 163 * @flist: per-client-instance fid tracking
165 * @dlist: per-dentry fid tracking 164 * @dlist: per-dentry fid tracking
166 * 165 *
@@ -174,9 +173,9 @@ struct p9_fid {
174 struct p9_qid qid; 173 struct p9_qid qid;
175 u32 iounit; 174 u32 iounit;
176 uid_t uid; 175 uid_t uid;
177 void *aux;
178 176
179 int rdir_fpos; 177 void *rdir;
178
180 struct list_head flist; 179 struct list_head flist;
181 struct list_head dlist; /* list of all fids attached to a dentry */ 180 struct list_head dlist; /* list of all fids attached to a dentry */
182}; 181};
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 7b55ab215a64..0f7c37825fc1 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -143,6 +143,8 @@ extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr
143extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr); 143extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
144extern void ipv6_mc_up(struct inet6_dev *idev); 144extern void ipv6_mc_up(struct inet6_dev *idev);
145extern void ipv6_mc_down(struct inet6_dev *idev); 145extern void ipv6_mc_down(struct inet6_dev *idev);
146extern void ipv6_mc_unmap(struct inet6_dev *idev);
147extern void ipv6_mc_remap(struct inet6_dev *idev);
146extern void ipv6_mc_init_dev(struct inet6_dev *idev); 148extern void ipv6_mc_init_dev(struct inet6_dev *idev);
147extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 149extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
148extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 150extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/af_ieee802154.h
index 0d78605fb1a6..75e64c7a2960 100644
--- a/include/net/ieee802154/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -54,7 +54,9 @@ struct sockaddr_ieee802154 {
54 struct ieee802154_addr addr; 54 struct ieee802154_addr addr;
55}; 55};
56 56
57/* master device */ 57/* get/setsockopt */
58#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0) 58#define SOL_IEEE802154 0
59
60#define WPAN_WANTACK 0
59 61
60#endif 62#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index c236270ec95e..716f43c5c98e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -26,6 +26,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
26 const unsigned char *target_hw); 26 const unsigned char *target_hw);
27extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
28 28
29extern struct neigh_ops arp_broken_ops; 29extern const struct neigh_ops arp_broken_ops;
30 30
31#endif /* _ARP_H */ 31#endif /* _ARP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 968166a45f86..718394e2c01e 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -138,8 +138,11 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
138struct bt_skb_cb { 138struct bt_skb_cb {
139 __u8 pkt_type; 139 __u8 pkt_type;
140 __u8 incoming; 140 __u8 incoming;
141 __u8 tx_seq;
142 __u8 retries;
143 __u8 sar;
141}; 144};
142#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 145#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
143 146
144static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) 147static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
145{ 148{
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c4ca4228b083..7b640aeddb64 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -117,7 +117,7 @@ struct hci_dev {
117 struct sk_buff *sent_cmd; 117 struct sk_buff *sent_cmd;
118 struct sk_buff *reassembly[3]; 118 struct sk_buff *reassembly[3];
119 119
120 struct semaphore req_lock; 120 struct mutex req_lock;
121 wait_queue_head_t req_wait_q; 121 wait_queue_head_t req_wait_q;
122 __u32 req_status; 122 __u32 req_status;
123 __u32 req_result; 123 __u32 req_result;
@@ -187,6 +187,7 @@ struct hci_conn {
187 struct work_struct work_del; 187 struct work_struct work_del;
188 188
189 struct device dev; 189 struct device dev;
190 atomic_t devref;
190 191
191 struct hci_dev *hdev; 192 struct hci_dev *hdev;
192 void *l2cap_data; 193 void *l2cap_data;
@@ -339,6 +340,9 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
339void hci_conn_enter_active_mode(struct hci_conn *conn); 340void hci_conn_enter_active_mode(struct hci_conn *conn);
340void hci_conn_enter_sniff_mode(struct hci_conn *conn); 341void hci_conn_enter_sniff_mode(struct hci_conn *conn);
341 342
343void hci_conn_hold_device(struct hci_conn *conn);
344void hci_conn_put_device(struct hci_conn *conn);
345
342static inline void hci_conn_hold(struct hci_conn *conn) 346static inline void hci_conn_hold(struct hci_conn *conn)
343{ 347{
344 atomic_inc(&conn->refcnt); 348 atomic_inc(&conn->refcnt);
@@ -700,8 +704,8 @@ struct hci_sec_filter {
700#define HCI_REQ_PEND 1 704#define HCI_REQ_PEND 1
701#define HCI_REQ_CANCELED 2 705#define HCI_REQ_CANCELED 2
702 706
703#define hci_req_lock(d) down(&d->req_lock) 707#define hci_req_lock(d) mutex_lock(&d->req_lock)
704#define hci_req_unlock(d) up(&d->req_lock) 708#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
705 709
706void hci_req_complete(struct hci_dev *hdev, int result); 710void hci_req_complete(struct hci_dev *hdev, int result);
707 711
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index e919fca1072a..9516f4b4a3c2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -27,12 +27,14 @@
27 27
28/* L2CAP defaults */ 28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672 29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_MIN_MTU 48
30#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1 32#define L2CAP_DEFAULT_TX_WINDOW 63
32#define L2CAP_DEFAULT_MAX_RECEIVE 1 33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */ 34#define L2CAP_DEFAULT_MAX_TX 3
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */ 35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7 36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
36 38
37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -52,6 +54,7 @@ struct l2cap_options {
52 __u16 imtu; 54 __u16 imtu;
53 __u16 flush_to; 55 __u16 flush_to;
54 __u8 mode; 56 __u8 mode;
57 __u8 fcs;
55}; 58};
56 59
57#define L2CAP_CONNINFO 0x02 60#define L2CAP_CONNINFO 0x02
@@ -93,6 +96,32 @@ struct l2cap_conninfo {
93#define L2CAP_FCS_NONE 0x00 96#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01 97#define L2CAP_FCS_CRC16 0x01
95 98
99/* L2CAP Control Field bit masks */
100#define L2CAP_CTRL_SAR 0xC000
101#define L2CAP_CTRL_REQSEQ 0x3F00
102#define L2CAP_CTRL_TXSEQ 0x007E
103#define L2CAP_CTRL_RETRANS 0x0080
104#define L2CAP_CTRL_FINAL 0x0080
105#define L2CAP_CTRL_POLL 0x0010
106#define L2CAP_CTRL_SUPERVISE 0x000C
107#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
108
109#define L2CAP_CTRL_TXSEQ_SHIFT 1
110#define L2CAP_CTRL_REQSEQ_SHIFT 8
111#define L2CAP_CTRL_SAR_SHIFT 14
112
113/* L2CAP Supervisory Function */
114#define L2CAP_SUPER_RCV_READY 0x0000
115#define L2CAP_SUPER_REJECT 0x0004
116#define L2CAP_SUPER_RCV_NOT_READY 0x0008
117#define L2CAP_SUPER_SELECT_REJECT 0x000C
118
119/* L2CAP Segmentation and Reassembly */
120#define L2CAP_SDU_UNSEGMENTED 0x0000
121#define L2CAP_SDU_START 0x4000
122#define L2CAP_SDU_END 0x8000
123#define L2CAP_SDU_CONTINUE 0xC000
124
96/* L2CAP structures */ 125/* L2CAP structures */
97struct l2cap_hdr { 126struct l2cap_hdr {
98 __le16 len; 127 __le16 len;
@@ -190,7 +219,7 @@ struct l2cap_conf_rfc {
190#define L2CAP_MODE_RETRANS 0x01 219#define L2CAP_MODE_RETRANS 0x01
191#define L2CAP_MODE_FLOWCTL 0x02 220#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03 221#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04 222#define L2CAP_MODE_STREAMING 0x04
194 223
195struct l2cap_disconn_req { 224struct l2cap_disconn_req {
196 __le16 dcid; 225 __le16 dcid;
@@ -261,6 +290,14 @@ struct l2cap_conn {
261 290
262/* ----- L2CAP channel and socket info ----- */ 291/* ----- L2CAP channel and socket info ----- */
263#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296
297struct srej_list {
298 __u8 tx_seq;
299 struct list_head list;
300};
264 301
265struct l2cap_pinfo { 302struct l2cap_pinfo {
266 struct bt_sock bt; 303 struct bt_sock bt;
@@ -271,30 +308,97 @@ struct l2cap_pinfo {
271 __u16 imtu; 308 __u16 imtu;
272 __u16 omtu; 309 __u16 omtu;
273 __u16 flush_to; 310 __u16 flush_to;
274 __u8 sec_level; 311 __u8 mode;
312 __u8 num_conf_req;
313 __u8 num_conf_rsp;
314
315 __u8 fcs;
316 __u8 sec_level;
275 __u8 role_switch; 317 __u8 role_switch;
276 __u8 force_reliable; 318 __u8 force_reliable;
277 319
278 __u8 conf_req[64]; 320 __u8 conf_req[64];
279 __u8 conf_len; 321 __u8 conf_len;
280 __u8 conf_state; 322 __u8 conf_state;
281 __u8 conf_retry; 323 __u8 conn_state;
324
325 __u8 next_tx_seq;
326 __u8 expected_ack_seq;
327 __u8 req_seq;
328 __u8 expected_tx_seq;
329 __u8 buffer_seq;
330 __u8 buffer_seq_srej;
331 __u8 srej_save_reqseq;
332 __u8 unacked_frames;
333 __u8 retry_count;
334 __u8 num_to_ack;
335 __u16 sdu_len;
336 __u16 partial_sdu_len;
337 struct sk_buff *sdu;
282 338
283 __u8 ident; 339 __u8 ident;
284 340
341 __u8 remote_tx_win;
342 __u8 remote_max_tx;
343 __u16 retrans_timeout;
344 __u16 monitor_timeout;
345 __u16 max_pdu_size;
346
285 __le16 sport; 347 __le16 sport;
286 348
349 struct timer_list retrans_timer;
350 struct timer_list monitor_timer;
351 struct sk_buff_head tx_queue;
352 struct sk_buff_head srej_queue;
353 struct srej_list srej_l;
287 struct l2cap_conn *conn; 354 struct l2cap_conn *conn;
288 struct sock *next_c; 355 struct sock *next_c;
289 struct sock *prev_c; 356 struct sock *prev_c;
290}; 357};
291 358
292#define L2CAP_CONF_REQ_SENT 0x01 359#define L2CAP_CONF_REQ_SENT 0x01
293#define L2CAP_CONF_INPUT_DONE 0x02 360#define L2CAP_CONF_INPUT_DONE 0x02
294#define L2CAP_CONF_OUTPUT_DONE 0x04 361#define L2CAP_CONF_OUTPUT_DONE 0x04
295#define L2CAP_CONF_CONNECT_PEND 0x80 362#define L2CAP_CONF_MTU_DONE 0x08
296 363#define L2CAP_CONF_MODE_DONE 0x10
297#define L2CAP_CONF_MAX_RETRIES 2 364#define L2CAP_CONF_CONNECT_PEND 0x20
365#define L2CAP_CONF_NO_FCS_RECV 0x40
366#define L2CAP_CONF_STATE2_DEVICE 0x80
367
368#define L2CAP_CONF_MAX_CONF_REQ 2
369#define L2CAP_CONF_MAX_CONF_RSP 2
370
371#define L2CAP_CONN_SAR_SDU 0x01
372#define L2CAP_CONN_SREJ_SENT 0x02
373#define L2CAP_CONN_WAIT_F 0x04
374#define L2CAP_CONN_SREJ_ACT 0x08
375#define L2CAP_CONN_SEND_PBIT 0x10
376#define L2CAP_CONN_REMOTE_BUSY 0x20
377#define L2CAP_CONN_LOCAL_BUSY 0x40
378
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
383
384static inline int l2cap_tx_window_full(struct sock *sk)
385{
386 struct l2cap_pinfo *pi = l2cap_pi(sk);
387 int sub;
388
389 sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64;
390
391 if (sub < 0)
392 sub += 64;
393
394 return (sub == pi->remote_tx_win);
395}
396
397#define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1
398#define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8
399#define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE)
400#define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE
401#define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START
298 402
299void l2cap_load(void); 403void l2cap_load(void);
300 404
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index c274993234e3..921d7b3c7f8d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -29,6 +29,7 @@
29#define RFCOMM_CONN_TIMEOUT (HZ * 30) 29#define RFCOMM_CONN_TIMEOUT (HZ * 30)
30#define RFCOMM_DISC_TIMEOUT (HZ * 20) 30#define RFCOMM_DISC_TIMEOUT (HZ * 20)
31#define RFCOMM_AUTH_TIMEOUT (HZ * 25) 31#define RFCOMM_AUTH_TIMEOUT (HZ * 25)
32#define RFCOMM_IDLE_TIMEOUT (HZ * 2)
32 33
33#define RFCOMM_DEFAULT_MTU 127 34#define RFCOMM_DEFAULT_MTU 127
34#define RFCOMM_DEFAULT_CREDITS 7 35#define RFCOMM_DEFAULT_CREDITS 7
@@ -154,6 +155,7 @@ struct rfcomm_msc {
154struct rfcomm_session { 155struct rfcomm_session {
155 struct list_head list; 156 struct list_head list;
156 struct socket *sock; 157 struct socket *sock;
158 struct timer_list timer;
157 unsigned long state; 159 unsigned long state;
158 unsigned long flags; 160 unsigned long flags;
159 atomic_t refcnt; 161 atomic_t refcnt;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d1892d66701a..3d874c620219 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
80 * with cfg80211. 80 * with cfg80211.
81 * 81 *
82 * @center_freq: center frequency in MHz 82 * @center_freq: center frequency in MHz
83 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
84 * @hw_value: hardware-specific value for the channel 83 * @hw_value: hardware-specific value for the channel
85 * @flags: channel flags from &enum ieee80211_channel_flags. 84 * @flags: channel flags from &enum ieee80211_channel_flags.
86 * @orig_flags: channel flags at registration time, used by regulatory 85 * @orig_flags: channel flags at registration time, used by regulatory
@@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
97struct ieee80211_channel { 96struct ieee80211_channel {
98 enum ieee80211_band band; 97 enum ieee80211_band band;
99 u16 center_freq; 98 u16 center_freq;
100 u8 max_bandwidth;
101 u16 hw_value; 99 u16 hw_value;
102 u32 flags; 100 u32 flags;
103 int max_antenna_gain; 101 int max_antenna_gain;
@@ -372,6 +370,10 @@ struct rate_info {
372 * @txrate: current unicast bitrate to this station 370 * @txrate: current unicast bitrate to this station
373 * @rx_packets: packets received from this station 371 * @rx_packets: packets received from this station
374 * @tx_packets: packets transmitted to this station 372 * @tx_packets: packets transmitted to this station
373 * @generation: generation number for nl80211 dumps.
374 * This number should increase every time the list of stations
375 * changes, i.e. when a station is added or removed, so that
376 * userspace can tell whether it got a consistent snapshot.
375 */ 377 */
376struct station_info { 378struct station_info {
377 u32 filled; 379 u32 filled;
@@ -385,6 +387,8 @@ struct station_info {
385 struct rate_info txrate; 387 struct rate_info txrate;
386 u32 rx_packets; 388 u32 rx_packets;
387 u32 tx_packets; 389 u32 tx_packets;
390
391 int generation;
388}; 392};
389 393
390/** 394/**
@@ -444,6 +448,10 @@ enum mpath_info_flags {
444 * @flags: mesh path flags 448 * @flags: mesh path flags
445 * @discovery_timeout: total mesh path discovery timeout, in msecs 449 * @discovery_timeout: total mesh path discovery timeout, in msecs
446 * @discovery_retries: mesh path discovery retries 450 * @discovery_retries: mesh path discovery retries
451 * @generation: generation number for nl80211 dumps.
452 * This number should increase every time the list of mesh paths
453 * changes, i.e. when a station is added or removed, so that
454 * userspace can tell whether it got a consistent snapshot.
447 */ 455 */
448struct mpath_info { 456struct mpath_info {
449 u32 filled; 457 u32 filled;
@@ -454,6 +462,8 @@ struct mpath_info {
454 u32 discovery_timeout; 462 u32 discovery_timeout;
455 u8 discovery_retries; 463 u8 discovery_retries;
456 u8 flags; 464 u8 flags;
465
466 int generation;
457}; 467};
458 468
459/** 469/**
@@ -538,23 +548,26 @@ struct cfg80211_ssid {
538 * @ssids: SSIDs to scan for (active scan only) 548 * @ssids: SSIDs to scan for (active scan only)
539 * @n_ssids: number of SSIDs 549 * @n_ssids: number of SSIDs
540 * @channels: channels to scan on. 550 * @channels: channels to scan on.
541 * @n_channels: number of channels for each band 551 * @n_channels: total number of channels to scan
542 * @ie: optional information element(s) to add into Probe Request or %NULL 552 * @ie: optional information element(s) to add into Probe Request or %NULL
543 * @ie_len: length of ie in octets 553 * @ie_len: length of ie in octets
544 * @wiphy: the wiphy this was for 554 * @wiphy: the wiphy this was for
545 * @ifidx: the interface index 555 * @dev: the interface
546 */ 556 */
547struct cfg80211_scan_request { 557struct cfg80211_scan_request {
548 struct cfg80211_ssid *ssids; 558 struct cfg80211_ssid *ssids;
549 int n_ssids; 559 int n_ssids;
550 struct ieee80211_channel **channels;
551 u32 n_channels; 560 u32 n_channels;
552 const u8 *ie; 561 const u8 *ie;
553 size_t ie_len; 562 size_t ie_len;
554 563
555 /* internal */ 564 /* internal */
556 struct wiphy *wiphy; 565 struct wiphy *wiphy;
557 int ifidx; 566 struct net_device *dev;
567 bool aborted;
568
569 /* keep last */
570 struct ieee80211_channel *channels[0];
558}; 571};
559 572
560/** 573/**
@@ -584,7 +597,6 @@ enum cfg80211_signal_type {
584 * is no guarantee that these are well-formed!) 597 * is no guarantee that these are well-formed!)
585 * @len_information_elements: total length of the information elements 598 * @len_information_elements: total length of the information elements
586 * @signal: signal strength value (type depends on the wiphy's signal_type) 599 * @signal: signal strength value (type depends on the wiphy's signal_type)
587 * @hold: BSS should not expire
588 * @free_priv: function pointer to free private data 600 * @free_priv: function pointer to free private data
589 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 601 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
590 */ 602 */
@@ -605,37 +617,59 @@ struct cfg80211_bss {
605}; 617};
606 618
607/** 619/**
620 * ieee80211_bss_get_ie - find IE with given ID
621 * @bss: the bss to search
622 * @ie: the IE ID
623 * Returns %NULL if not found.
624 */
625const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
626
627
628/**
629 * struct cfg80211_crypto_settings - Crypto settings
630 * @wpa_versions: indicates which, if any, WPA versions are enabled
631 * (from enum nl80211_wpa_versions)
632 * @cipher_group: group key cipher suite (or 0 if unset)
633 * @n_ciphers_pairwise: number of AP supported unicast ciphers
634 * @ciphers_pairwise: unicast key cipher suites
635 * @n_akm_suites: number of AKM suites
636 * @akm_suites: AKM suites
637 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
638 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
639 * required to assume that the port is unauthorized until authorized by
640 * user space. Otherwise, port is marked authorized by default.
641 */
642struct cfg80211_crypto_settings {
643 u32 wpa_versions;
644 u32 cipher_group;
645 int n_ciphers_pairwise;
646 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
647 int n_akm_suites;
648 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
649 bool control_port;
650};
651
652/**
608 * struct cfg80211_auth_request - Authentication request data 653 * struct cfg80211_auth_request - Authentication request data
609 * 654 *
610 * This structure provides information needed to complete IEEE 802.11 655 * This structure provides information needed to complete IEEE 802.11
611 * authentication. 656 * authentication.
612 * NOTE: This structure will likely change when more code from mac80211 is 657 *
613 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. 658 * @bss: The BSS to authenticate with.
614 * Before using this in a driver that does not use mac80211, it would be better
615 * to check the status of that work and better yet, volunteer to work on it.
616 *
617 * @chan: The channel to use or %NULL if not specified (auto-select based on
618 * scan results)
619 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
620 * this field is required to be present; if the driver wants to help with
621 * BSS selection, it should use (yet to be added) MLME event to allow user
622 * space SME to be notified of roaming candidate, so that the SME can then
623 * use the authentication request with the recommended BSSID and whatever
624 * other data may be needed for authentication/association
625 * @ssid: SSID or %NULL if not yet available
626 * @ssid_len: Length of ssid in octets
627 * @auth_type: Authentication type (algorithm) 659 * @auth_type: Authentication type (algorithm)
628 * @ie: Extra IEs to add to Authentication frame or %NULL 660 * @ie: Extra IEs to add to Authentication frame or %NULL
629 * @ie_len: Length of ie buffer in octets 661 * @ie_len: Length of ie buffer in octets
662 * @key_len: length of WEP key for shared key authentication
663 * @key_idx: index of WEP key for shared key authentication
664 * @key: WEP key for shared key authentication
630 */ 665 */
631struct cfg80211_auth_request { 666struct cfg80211_auth_request {
632 struct ieee80211_channel *chan; 667 struct cfg80211_bss *bss;
633 u8 *peer_addr;
634 const u8 *ssid;
635 size_t ssid_len;
636 enum nl80211_auth_type auth_type;
637 const u8 *ie; 668 const u8 *ie;
638 size_t ie_len; 669 size_t ie_len;
670 enum nl80211_auth_type auth_type;
671 const u8 *key;
672 u8 key_len, key_idx;
639}; 673};
640 674
641/** 675/**
@@ -643,35 +677,19 @@ struct cfg80211_auth_request {
643 * 677 *
644 * This structure provides information needed to complete IEEE 802.11 678 * This structure provides information needed to complete IEEE 802.11
645 * (re)association. 679 * (re)association.
646 * NOTE: This structure will likely change when more code from mac80211 is 680 * @bss: The BSS to associate with.
647 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
648 * Before using this in a driver that does not use mac80211, it would be better
649 * to check the status of that work and better yet, volunteer to work on it.
650 *
651 * @chan: The channel to use or %NULL if not specified (auto-select based on
652 * scan results)
653 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
654 * to be present and the STA must be in State 2 (authenticated) with the
655 * peer STA
656 * @ssid: SSID
657 * @ssid_len: Length of ssid in octets
658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 681 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
659 * @ie_len: Length of ie buffer in octets 682 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 683 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 684 * @crypto: crypto settings
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 685 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
665 */ 686 */
666struct cfg80211_assoc_request { 687struct cfg80211_assoc_request {
667 struct ieee80211_channel *chan; 688 struct cfg80211_bss *bss;
668 u8 *peer_addr; 689 const u8 *ie, *prev_bssid;
669 const u8 *ssid;
670 size_t ssid_len;
671 const u8 *ie;
672 size_t ie_len; 690 size_t ie_len;
691 struct cfg80211_crypto_settings crypto;
673 bool use_mfp; 692 bool use_mfp;
674 bool control_port;
675}; 693};
676 694
677/** 695/**
@@ -680,16 +698,16 @@ struct cfg80211_assoc_request {
680 * This structure provides information needed to complete IEEE 802.11 698 * This structure provides information needed to complete IEEE 802.11
681 * deauthentication. 699 * deauthentication.
682 * 700 *
683 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 701 * @bss: the BSS to deauthenticate from
684 * to be present and the STA must be authenticated with the peer STA
685 * @ie: Extra IEs to add to Deauthentication frame or %NULL 702 * @ie: Extra IEs to add to Deauthentication frame or %NULL
686 * @ie_len: Length of ie buffer in octets 703 * @ie_len: Length of ie buffer in octets
704 * @reason_code: The reason code for the deauthentication
687 */ 705 */
688struct cfg80211_deauth_request { 706struct cfg80211_deauth_request {
689 u8 *peer_addr; 707 struct cfg80211_bss *bss;
690 u16 reason_code;
691 const u8 *ie; 708 const u8 *ie;
692 size_t ie_len; 709 size_t ie_len;
710 u16 reason_code;
693}; 711};
694 712
695/** 713/**
@@ -698,16 +716,16 @@ struct cfg80211_deauth_request {
698 * This structure provides information needed to complete IEEE 802.11 716 * This structure provides information needed to complete IEEE 802.11
699 * disassocation. 717 * disassocation.
700 * 718 *
701 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 719 * @bss: the BSS to disassociate from
702 * to be present and the STA must be associated with the peer STA
703 * @ie: Extra IEs to add to Disassociation frame or %NULL 720 * @ie: Extra IEs to add to Disassociation frame or %NULL
704 * @ie_len: Length of ie buffer in octets 721 * @ie_len: Length of ie buffer in octets
722 * @reason_code: The reason code for the disassociation
705 */ 723 */
706struct cfg80211_disassoc_request { 724struct cfg80211_disassoc_request {
707 u8 *peer_addr; 725 struct cfg80211_bss *bss;
708 u16 reason_code;
709 const u8 *ie; 726 const u8 *ie;
710 size_t ie_len; 727 size_t ie_len;
728 u16 reason_code;
711}; 729};
712 730
713/** 731/**
@@ -726,6 +744,8 @@ struct cfg80211_disassoc_request {
726 * @ie: information element(s) to include in the beacon 744 * @ie: information element(s) to include in the beacon
727 * @ie_len: length of that 745 * @ie_len: length of that
728 * @beacon_interval: beacon interval to use 746 * @beacon_interval: beacon interval to use
747 * @privacy: this is a protected network, keys will be configured
748 * after joining
729 */ 749 */
730struct cfg80211_ibss_params { 750struct cfg80211_ibss_params {
731 u8 *ssid; 751 u8 *ssid;
@@ -735,6 +755,42 @@ struct cfg80211_ibss_params {
735 u8 ssid_len, ie_len; 755 u8 ssid_len, ie_len;
736 u16 beacon_interval; 756 u16 beacon_interval;
737 bool channel_fixed; 757 bool channel_fixed;
758 bool privacy;
759};
760
761/**
762 * struct cfg80211_connect_params - Connection parameters
763 *
764 * This structure provides information needed to complete IEEE 802.11
765 * authentication and association.
766 *
767 * @channel: The channel to use or %NULL if not specified (auto-select based
768 * on scan results)
769 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
770 * results)
771 * @ssid: SSID
772 * @ssid_len: Length of ssid in octets
773 * @auth_type: Authentication type (algorithm)
774 * @assoc_ie: IEs for association request
775 * @assoc_ie_len: Length of assoc_ie in octets
776 * @privacy: indicates whether privacy-enabled APs should be used
777 * @crypto: crypto settings
778 * @key_len: length of WEP key for shared key authentication
779 * @key_idx: index of WEP key for shared key authentication
780 * @key: WEP key for shared key authentication
781 */
782struct cfg80211_connect_params {
783 struct ieee80211_channel *channel;
784 u8 *bssid;
785 u8 *ssid;
786 size_t ssid_len;
787 enum nl80211_auth_type auth_type;
788 u8 *ie;
789 size_t ie_len;
790 bool privacy;
791 struct cfg80211_crypto_settings crypto;
792 const u8 *key;
793 u8 key_len, key_idx;
738}; 794};
739 795
740/** 796/**
@@ -764,6 +820,26 @@ enum tx_power_setting {
764 TX_POWER_FIXED, 820 TX_POWER_FIXED,
765}; 821};
766 822
823/*
824 * cfg80211_bitrate_mask - masks for bitrate control
825 */
826struct cfg80211_bitrate_mask {
827/*
828 * As discussed in Berlin, this struct really
829 * should look like this:
830
831 struct {
832 u32 legacy;
833 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
834 } control[IEEE80211_NUM_BANDS];
835
836 * Since we can always fix in-kernel users, let's keep
837 * it simpler for now:
838 */
839 u32 fixed; /* fixed bitrate, 0 == not fixed */
840 u32 maxrate; /* in kbps, 0 == no limit */
841};
842
767/** 843/**
768 * struct cfg80211_ops - backend description for wireless configuration 844 * struct cfg80211_ops - backend description for wireless configuration
769 * 845 *
@@ -781,7 +857,8 @@ enum tx_power_setting {
781 * @resume: wiphy device needs to be resumed 857 * @resume: wiphy device needs to be resumed
782 * 858 *
783 * @add_virtual_intf: create a new virtual interface with the given name, 859 * @add_virtual_intf: create a new virtual interface with the given name,
784 * must set the struct wireless_dev's iftype. 860 * must set the struct wireless_dev's iftype. Beware: You must create
861 * the new netdev in the wiphy's network namespace!
785 * 862 *
786 * @del_virtual_intf: remove the virtual interface determined by ifindex. 863 * @del_virtual_intf: remove the virtual interface determined by ifindex.
787 * 864 *
@@ -841,6 +918,12 @@ enum tx_power_setting {
841 * @deauth: Request to deauthenticate from the specified peer 918 * @deauth: Request to deauthenticate from the specified peer
842 * @disassoc: Request to disassociate from the specified peer 919 * @disassoc: Request to disassociate from the specified peer
843 * 920 *
921 * @connect: Connect to the ESS with the specified parameters. When connected,
922 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
923 * If the connection fails for some reason, call cfg80211_connect_result()
924 * with the status from the AP.
925 * @disconnect: Disconnect from the BSS/ESS.
926 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 927 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due 928 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge. 929 * to a merge.
@@ -857,6 +940,8 @@ enum tx_power_setting {
857 * 940 *
858 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 941 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
859 * functions to adjust rfkill hw state 942 * functions to adjust rfkill hw state
943 *
944 * @testmode_cmd: run a test mode command
860 */ 945 */
861struct cfg80211_ops { 946struct cfg80211_ops {
862 int (*suspend)(struct wiphy *wiphy); 947 int (*suspend)(struct wiphy *wiphy);
@@ -865,8 +950,9 @@ struct cfg80211_ops {
865 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 950 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
866 enum nl80211_iftype type, u32 *flags, 951 enum nl80211_iftype type, u32 *flags,
867 struct vif_params *params); 952 struct vif_params *params);
868 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 953 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
869 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 954 int (*change_virtual_intf)(struct wiphy *wiphy,
955 struct net_device *dev,
870 enum nl80211_iftype type, u32 *flags, 956 enum nl80211_iftype type, u32 *flags,
871 struct vif_params *params); 957 struct vif_params *params);
872 958
@@ -939,9 +1025,16 @@ struct cfg80211_ops {
939 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1025 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
940 struct cfg80211_assoc_request *req); 1026 struct cfg80211_assoc_request *req);
941 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1027 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
942 struct cfg80211_deauth_request *req); 1028 struct cfg80211_deauth_request *req,
1029 void *cookie);
943 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1030 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
944 struct cfg80211_disassoc_request *req); 1031 struct cfg80211_disassoc_request *req,
1032 void *cookie);
1033
1034 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1035 struct cfg80211_connect_params *sme);
1036 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1037 u16 reason_code);
945 1038
946 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 1039 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_ibss_params *params); 1040 struct cfg80211_ibss_params *params);
@@ -953,7 +1046,23 @@ struct cfg80211_ops {
953 enum tx_power_setting type, int dbm); 1046 enum tx_power_setting type, int dbm);
954 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1047 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
955 1048
1049 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1050 u8 *addr);
1051
956 void (*rfkill_poll)(struct wiphy *wiphy); 1052 void (*rfkill_poll)(struct wiphy *wiphy);
1053
1054#ifdef CONFIG_NL80211_TESTMODE
1055 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
1056#endif
1057
1058 int (*set_bitrate_mask)(struct wiphy *wiphy,
1059 struct net_device *dev,
1060 const u8 *peer,
1061 const struct cfg80211_bitrate_mask *mask);
1062
1063 /* some temporary stuff to finish wext */
1064 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1065 bool enabled, int timeout);
957}; 1066};
958 1067
959/* 1068/*
@@ -996,6 +1105,12 @@ struct cfg80211_ops {
996 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1105 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
997 * -1 = fragmentation disabled, only odd values >= 256 used 1106 * -1 = fragmentation disabled, only odd values >= 256 used
998 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1107 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1108 * @net: the network namespace this wiphy currently lives in
1109 * @netnsok: if set to false, do not allow changing the netns of this
1110 * wiphy at all
1111 * @ps_default: default for powersave, will be set depending on the
1112 * kernel's default on wiphy_new(), but can be changed by the
1113 * driver if it has a good reason to override the default
999 */ 1114 */
1000struct wiphy { 1115struct wiphy {
1001 /* assign these fields before you register the wiphy */ 1116 /* assign these fields before you register the wiphy */
@@ -1010,6 +1125,9 @@ struct wiphy {
1010 bool strict_regulatory; 1125 bool strict_regulatory;
1011 bool disable_beacon_hints; 1126 bool disable_beacon_hints;
1012 1127
1128 bool netnsok;
1129 bool ps_default;
1130
1013 enum cfg80211_signal_type signal_type; 1131 enum cfg80211_signal_type signal_type;
1014 1132
1015 int bss_priv_size; 1133 int bss_priv_size;
@@ -1048,9 +1166,35 @@ struct wiphy {
1048 /* dir in debugfs: ieee80211/<wiphyname> */ 1166 /* dir in debugfs: ieee80211/<wiphyname> */
1049 struct dentry *debugfsdir; 1167 struct dentry *debugfsdir;
1050 1168
1169#ifdef CONFIG_NET_NS
1170 /* the network namespace this phy lives in currently */
1171 struct net *_net;
1172#endif
1173
1051 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1174 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1052}; 1175};
1053 1176
1177#ifdef CONFIG_NET_NS
1178static inline struct net *wiphy_net(struct wiphy *wiphy)
1179{
1180 return wiphy->_net;
1181}
1182
1183static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1184{
1185 wiphy->_net = net;
1186}
1187#else
1188static inline struct net *wiphy_net(struct wiphy *wiphy)
1189{
1190 return &init_net;
1191}
1192
1193static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1194{
1195}
1196#endif
1197
1054/** 1198/**
1055 * wiphy_priv - return priv from wiphy 1199 * wiphy_priv - return priv from wiphy
1056 * 1200 *
@@ -1063,6 +1207,17 @@ static inline void *wiphy_priv(struct wiphy *wiphy)
1063} 1207}
1064 1208
1065/** 1209/**
1210 * priv_to_wiphy - return the wiphy containing the priv
1211 *
1212 * @priv: a pointer previously returned by wiphy_priv
1213 */
1214static inline struct wiphy *priv_to_wiphy(void *priv)
1215{
1216 BUG_ON(!priv);
1217 return container_of(priv, struct wiphy, priv);
1218}
1219
1220/**
1066 * set_wiphy_dev - set device pointer for wiphy 1221 * set_wiphy_dev - set device pointer for wiphy
1067 * 1222 *
1068 * @wiphy: The wiphy whose device to bind 1223 * @wiphy: The wiphy whose device to bind
@@ -1134,6 +1289,13 @@ extern void wiphy_unregister(struct wiphy *wiphy);
1134 */ 1289 */
1135extern void wiphy_free(struct wiphy *wiphy); 1290extern void wiphy_free(struct wiphy *wiphy);
1136 1291
1292/* internal structs */
1293struct cfg80211_conn;
1294struct cfg80211_internal_bss;
1295struct cfg80211_cached_keys;
1296
1297#define MAX_AUTH_BSSES 4
1298
1137/** 1299/**
1138 * struct wireless_dev - wireless per-netdev state 1300 * struct wireless_dev - wireless per-netdev state
1139 * 1301 *
@@ -1157,22 +1319,45 @@ struct wireless_dev {
1157 struct wiphy *wiphy; 1319 struct wiphy *wiphy;
1158 enum nl80211_iftype iftype; 1320 enum nl80211_iftype iftype;
1159 1321
1160 /* private to the generic wireless code */ 1322 /* the remainder of this struct should be private to cfg80211 */
1161 struct list_head list; 1323 struct list_head list;
1162 struct net_device *netdev; 1324 struct net_device *netdev;
1163 1325
1164 /* currently used for IBSS - might be rearranged in the future */ 1326 struct mutex mtx;
1165 struct cfg80211_bss *current_bss; 1327
1166 u8 bssid[ETH_ALEN]; 1328 struct work_struct cleanup_work;
1329
1330 /* currently used for IBSS and SME - might be rearranged later */
1167 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1331 u8 ssid[IEEE80211_MAX_SSID_LEN];
1168 u8 ssid_len; 1332 u8 ssid_len;
1333 enum {
1334 CFG80211_SME_IDLE,
1335 CFG80211_SME_CONNECTING,
1336 CFG80211_SME_CONNECTED,
1337 } sme_state;
1338 struct cfg80211_conn *conn;
1339 struct cfg80211_cached_keys *connect_keys;
1340
1341 struct list_head event_list;
1342 spinlock_t event_lock;
1343
1344 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1345 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1346 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1169 1347
1170#ifdef CONFIG_WIRELESS_EXT 1348#ifdef CONFIG_WIRELESS_EXT
1171 /* wext data */ 1349 /* wext data */
1172 struct { 1350 struct {
1173 struct cfg80211_ibss_params ibss; 1351 struct cfg80211_ibss_params ibss;
1174 u8 bssid[ETH_ALEN]; 1352 struct cfg80211_connect_params connect;
1353 struct cfg80211_cached_keys *keys;
1354 u8 *ie;
1355 size_t ie_len;
1356 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1357 u8 ssid[IEEE80211_MAX_SSID_LEN];
1175 s8 default_key, default_mgmt_key; 1358 s8 default_key, default_mgmt_key;
1359 bool ps, prev_bssid_valid;
1360 int ps_timeout;
1176 } wext; 1361 } wext;
1177#endif 1362#endif
1178}; 1363};
@@ -1352,20 +1537,6 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1352extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1537extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1353 1538
1354/** 1539/**
1355 * regulatory_hint_11d - hints a country IE as a regulatory domain
1356 * @wiphy: the wireless device giving the hint (used only for reporting
1357 * conflicts)
1358 * @country_ie: pointer to the country IE
1359 * @country_ie_len: length of the country IE
1360 *
1361 * We will intersect the rd with the what CRDA tells us should apply
1362 * for the alpha2 this country IE belongs to, this prevents APs from
1363 * sending us incorrect or outdated information against a country.
1364 */
1365extern void regulatory_hint_11d(struct wiphy *wiphy,
1366 u8 *country_ie,
1367 u8 country_ie_len);
1368/**
1369 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1540 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1370 * @wiphy: the wireless device we want to process the regulatory domain on 1541 * @wiphy: the wireless device we want to process the regulatory domain on
1371 * @regd: the custom regulatory domain to use for this wiphy 1542 * @regd: the custom regulatory domain to use for this wiphy
@@ -1433,27 +1604,34 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
1433int cfg80211_wext_giwrange(struct net_device *dev, 1604int cfg80211_wext_giwrange(struct net_device *dev,
1434 struct iw_request_info *info, 1605 struct iw_request_info *info,
1435 struct iw_point *data, char *extra); 1606 struct iw_point *data, char *extra);
1436int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 1607int cfg80211_wext_siwgenie(struct net_device *dev,
1437 struct iw_request_info *info, 1608 struct iw_request_info *info,
1438 struct iw_freq *freq, char *extra); 1609 struct iw_point *data, char *extra);
1439int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 1610int cfg80211_wext_siwauth(struct net_device *dev,
1440 struct iw_request_info *info, 1611 struct iw_request_info *info,
1441 struct iw_freq *freq, char *extra); 1612 struct iw_param *data, char *extra);
1442int cfg80211_ibss_wext_siwessid(struct net_device *dev, 1613int cfg80211_wext_giwauth(struct net_device *dev,
1443 struct iw_request_info *info, 1614 struct iw_request_info *info,
1444 struct iw_point *data, char *ssid); 1615 struct iw_param *data, char *extra);
1445int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1446 struct iw_request_info *info,
1447 struct iw_point *data, char *ssid);
1448int cfg80211_ibss_wext_siwap(struct net_device *dev,
1449 struct iw_request_info *info,
1450 struct sockaddr *ap_addr, char *extra);
1451int cfg80211_ibss_wext_giwap(struct net_device *dev,
1452 struct iw_request_info *info,
1453 struct sockaddr *ap_addr, char *extra);
1454 1616
1455struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 1617int cfg80211_wext_siwfreq(struct net_device *dev,
1456 struct iw_freq *freq); 1618 struct iw_request_info *info,
1619 struct iw_freq *freq, char *extra);
1620int cfg80211_wext_giwfreq(struct net_device *dev,
1621 struct iw_request_info *info,
1622 struct iw_freq *freq, char *extra);
1623int cfg80211_wext_siwessid(struct net_device *dev,
1624 struct iw_request_info *info,
1625 struct iw_point *data, char *ssid);
1626int cfg80211_wext_giwessid(struct net_device *dev,
1627 struct iw_request_info *info,
1628 struct iw_point *data, char *ssid);
1629int cfg80211_wext_siwrate(struct net_device *dev,
1630 struct iw_request_info *info,
1631 struct iw_param *rate, char *extra);
1632int cfg80211_wext_giwrate(struct net_device *dev,
1633 struct iw_request_info *info,
1634 struct iw_param *rate, char *extra);
1457 1635
1458int cfg80211_wext_siwrts(struct net_device *dev, 1636int cfg80211_wext_siwrts(struct net_device *dev,
1459 struct iw_request_info *info, 1637 struct iw_request_info *info,
@@ -1488,6 +1666,21 @@ int cfg80211_wext_siwtxpower(struct net_device *dev,
1488int cfg80211_wext_giwtxpower(struct net_device *dev, 1666int cfg80211_wext_giwtxpower(struct net_device *dev,
1489 struct iw_request_info *info, 1667 struct iw_request_info *info,
1490 union iwreq_data *data, char *keybuf); 1668 union iwreq_data *data, char *keybuf);
1669struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
1670
1671int cfg80211_wext_siwpower(struct net_device *dev,
1672 struct iw_request_info *info,
1673 struct iw_param *wrq, char *extra);
1674int cfg80211_wext_giwpower(struct net_device *dev,
1675 struct iw_request_info *info,
1676 struct iw_param *wrq, char *extra);
1677
1678int cfg80211_wext_siwap(struct net_device *dev,
1679 struct iw_request_info *info,
1680 struct sockaddr *ap_addr, char *extra);
1681int cfg80211_wext_giwap(struct net_device *dev,
1682 struct iw_request_info *info,
1683 struct sockaddr *ap_addr, char *extra);
1491 1684
1492/* 1685/*
1493 * callbacks for asynchronous cfg80211 methods, notification 1686 * callbacks for asynchronous cfg80211 methods, notification
@@ -1569,7 +1762,7 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1569 * This function is called whenever an authentication has been processed in 1762 * This function is called whenever an authentication has been processed in
1570 * station mode. The driver is required to call either this function or 1763 * station mode. The driver is required to call either this function or
1571 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1764 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1572 * call. 1765 * call. This function may sleep.
1573 */ 1766 */
1574void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1767void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1575 1768
@@ -1577,6 +1770,8 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1577 * cfg80211_send_auth_timeout - notification of timed out authentication 1770 * cfg80211_send_auth_timeout - notification of timed out authentication
1578 * @dev: network device 1771 * @dev: network device
1579 * @addr: The MAC address of the device with which the authentication timed out 1772 * @addr: The MAC address of the device with which the authentication timed out
1773 *
1774 * This function may sleep.
1580 */ 1775 */
1581void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 1776void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1582 1777
@@ -1589,7 +1784,7 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1589 * This function is called whenever a (re)association response has been 1784 * This function is called whenever a (re)association response has been
1590 * processed in station mode. The driver is required to call either this 1785 * processed in station mode. The driver is required to call either this
1591 * function or cfg80211_send_assoc_timeout() to indicate the result of 1786 * function or cfg80211_send_assoc_timeout() to indicate the result of
1592 * cfg80211_ops::assoc() call. 1787 * cfg80211_ops::assoc() call. This function may sleep.
1593 */ 1788 */
1594void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1789void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1595 1790
@@ -1597,6 +1792,8 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1597 * cfg80211_send_assoc_timeout - notification of timed out association 1792 * cfg80211_send_assoc_timeout - notification of timed out association
1598 * @dev: network device 1793 * @dev: network device
1599 * @addr: The MAC address of the device with which the association timed out 1794 * @addr: The MAC address of the device with which the association timed out
1795 *
1796 * This function may sleep.
1600 */ 1797 */
1601void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 1798void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1602 1799
@@ -1605,41 +1802,30 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1605 * @dev: network device 1802 * @dev: network device
1606 * @buf: deauthentication frame (header + body) 1803 * @buf: deauthentication frame (header + body)
1607 * @len: length of the frame data 1804 * @len: length of the frame data
1805 * @cookie: cookie from ->deauth if called within that callback,
1806 * %NULL otherwise
1608 * 1807 *
1609 * This function is called whenever deauthentication has been processed in 1808 * This function is called whenever deauthentication has been processed in
1610 * station mode. This includes both received deauthentication frames and 1809 * station mode. This includes both received deauthentication frames and
1611 * locally generated ones. 1810 * locally generated ones. This function may sleep.
1612 */ 1811 */
1613void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 1812void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
1813 void *cookie);
1614 1814
1615/** 1815/**
1616 * cfg80211_send_disassoc - notification of processed disassociation 1816 * cfg80211_send_disassoc - notification of processed disassociation
1617 * @dev: network device 1817 * @dev: network device
1618 * @buf: disassociation response frame (header + body) 1818 * @buf: disassociation response frame (header + body)
1619 * @len: length of the frame data 1819 * @len: length of the frame data
1820 * @cookie: cookie from ->disassoc if called within that callback,
1821 * %NULL otherwise
1620 * 1822 *
1621 * This function is called whenever disassociation has been processed in 1823 * This function is called whenever disassociation has been processed in
1622 * station mode. This includes both received disassociation frames and locally 1824 * station mode. This includes both received disassociation frames and locally
1623 * generated ones. 1825 * generated ones. This function may sleep.
1624 */
1625void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1626
1627/**
1628 * cfg80211_hold_bss - exclude bss from expiration
1629 * @bss: bss which should not expire
1630 *
1631 * In a case when the BSS is not updated but it shouldn't expire this
1632 * function can be used to mark the BSS to be excluded from expiration.
1633 */
1634void cfg80211_hold_bss(struct cfg80211_bss *bss);
1635
1636/**
1637 * cfg80211_unhold_bss - remove expiration exception from the BSS
1638 * @bss: bss which can expire again
1639 *
1640 * This function marks the BSS to be expirable again.
1641 */ 1826 */
1642void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1827void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len,
1828 void *cookie);
1643 1829
1644/** 1830/**
1645 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1831 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -1648,6 +1834,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1648 * @key_type: The key type that the received frame used 1834 * @key_type: The key type that the received frame used
1649 * @key_id: Key identifier (0..3) 1835 * @key_id: Key identifier (0..3)
1650 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1836 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1837 * @gfp: allocation flags
1651 * 1838 *
1652 * This function is called whenever the local MAC detects a MIC failure in a 1839 * This function is called whenever the local MAC detects a MIC failure in a
1653 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1840 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
@@ -1655,7 +1842,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1655 */ 1842 */
1656void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1843void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1657 enum nl80211_key_type key_type, int key_id, 1844 enum nl80211_key_type key_type, int key_id,
1658 const u8 *tsc); 1845 const u8 *tsc, gfp_t gfp);
1659 1846
1660/** 1847/**
1661 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 1848 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
@@ -1692,4 +1879,137 @@ void wiphy_rfkill_start_polling(struct wiphy *wiphy);
1692 */ 1879 */
1693void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 1880void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
1694 1881
1882#ifdef CONFIG_NL80211_TESTMODE
1883/**
1884 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
1885 * @wiphy: the wiphy
1886 * @approxlen: an upper bound of the length of the data that will
1887 * be put into the skb
1888 *
1889 * This function allocates and pre-fills an skb for a reply to
1890 * the testmode command. Since it is intended for a reply, calling
1891 * it outside of the @testmode_cmd operation is invalid.
1892 *
1893 * The returned skb (or %NULL if any errors happen) is pre-filled
1894 * with the wiphy index and set up in a way that any data that is
1895 * put into the skb (with skb_put(), nla_put() or similar) will end
1896 * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
1897 * needs to be done with the skb is adding data for the corresponding
1898 * userspace tool which can then read that data out of the testdata
1899 * attribute. You must not modify the skb in any other way.
1900 *
1901 * When done, call cfg80211_testmode_reply() with the skb and return
1902 * its error code as the result of the @testmode_cmd operation.
1903 */
1904struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
1905 int approxlen);
1906
1907/**
1908 * cfg80211_testmode_reply - send the reply skb
1909 * @skb: The skb, must have been allocated with
1910 * cfg80211_testmode_alloc_reply_skb()
1911 *
1912 * Returns an error code or 0 on success, since calling this
1913 * function will usually be the last thing before returning
1914 * from the @testmode_cmd you should return the error code.
1915 * Note that this function consumes the skb regardless of the
1916 * return value.
1917 */
1918int cfg80211_testmode_reply(struct sk_buff *skb);
1919
1920/**
1921 * cfg80211_testmode_alloc_event_skb - allocate testmode event
1922 * @wiphy: the wiphy
1923 * @approxlen: an upper bound of the length of the data that will
1924 * be put into the skb
1925 * @gfp: allocation flags
1926 *
1927 * This function allocates and pre-fills an skb for an event on the
1928 * testmode multicast group.
1929 *
1930 * The returned skb (or %NULL if any errors happen) is set up in the
1931 * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
1932 * for an event. As there, you should simply add data to it that will
1933 * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
1934 * not modify the skb in any other way.
1935 *
1936 * When done filling the skb, call cfg80211_testmode_event() with the
1937 * skb to send the event.
1938 */
1939struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
1940 int approxlen, gfp_t gfp);
1941
1942/**
1943 * cfg80211_testmode_event - send the event
1944 * @skb: The skb, must have been allocated with
1945 * cfg80211_testmode_alloc_event_skb()
1946 * @gfp: allocation flags
1947 *
1948 * This function sends the given @skb, which must have been allocated
1949 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
1950 * consumes it.
1951 */
1952void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
1953
1954#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
1955#else
1956#define CFG80211_TESTMODE_CMD(cmd)
1957#endif
1958
1959/**
1960 * cfg80211_connect_result - notify cfg80211 of connection result
1961 *
1962 * @dev: network device
1963 * @bssid: the BSSID of the AP
1964 * @req_ie: association request IEs (maybe be %NULL)
1965 * @req_ie_len: association request IEs length
1966 * @resp_ie: association response IEs (may be %NULL)
1967 * @resp_ie_len: assoc response IEs length
1968 * @status: status code, 0 for successful connection, use
1969 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
1970 * the real status code for failures.
1971 * @gfp: allocation flags
1972 *
1973 * It should be called by the underlying driver whenever connect() has
1974 * succeeded.
1975 */
1976void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
1977 const u8 *req_ie, size_t req_ie_len,
1978 const u8 *resp_ie, size_t resp_ie_len,
1979 u16 status, gfp_t gfp);
1980
1981/**
1982 * cfg80211_roamed - notify cfg80211 of roaming
1983 *
1984 * @dev: network device
1985 * @bssid: the BSSID of the new AP
1986 * @req_ie: association request IEs (maybe be %NULL)
1987 * @req_ie_len: association request IEs length
1988 * @resp_ie: association response IEs (may be %NULL)
1989 * @resp_ie_len: assoc response IEs length
1990 * @gfp: allocation flags
1991 *
1992 * It should be called by the underlying driver whenever it roamed
1993 * from one AP to another while connected.
1994 */
1995void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
1996 const u8 *req_ie, size_t req_ie_len,
1997 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
1998
1999/**
2000 * cfg80211_disconnected - notify cfg80211 that connection was dropped
2001 *
2002 * @dev: network device
2003 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
2004 * @ie_len: length of IEs
2005 * @reason: reason code for the disconnection, set it to 0 if unknown
2006 * @gfp: allocation flags
2007 *
2008 * After it calls this function, the driver should enter an idle state
2009 * and not try to connect to any AP any more.
2010 */
2011void cfg80211_disconnected(struct net_device *dev, u16 reason,
2012 u8 *ie, size_t ie_len, gfp_t gfp);
2013
2014
1695#endif /* __NET_CFG80211_H */ 2015#endif /* __NET_CFG80211_H */
diff --git a/include/net/compat.h b/include/net/compat.h
index 5bbf8bf9efea..7c3002832d05 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,8 +40,8 @@ extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
40 40
41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
42 42
43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int, 43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
44 int (*)(struct sock *, int, int, char __user *, int)); 44 int (*)(struct sock *, int, int, char __user *, unsigned int));
45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 45extern int compat_mc_getsockopt(struct sock *, int, int, char __user *,
46 int __user *, int (*)(struct sock *, int, int, char __user *, 46 int __user *, int (*)(struct sock *, int, int, char __user *,
47 int __user *)); 47 int __user *));
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 775cfc8055be..b36ac7e0914d 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 void (*setbcncfg)(struct net_device *, int, u32); 48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *); 49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8); 50 void (*setbcnrp)(struct net_device *, int, u8);
51 u8 (*setapp)(struct net_device *, u8, u16, u8);
52 u8 (*getapp)(struct net_device *, u8, u16);
51}; 53};
52 54
53#endif /* __NET_DCBNL_H__ */ 55#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dst.h b/include/net/dst.h
index 7fc409c19b37..5a900ddcf10d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -8,6 +8,7 @@
8#ifndef _NET_DST_H 8#ifndef _NET_DST_H
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <net/dst_ops.h>
11#include <linux/netdevice.h> 12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
@@ -102,28 +103,6 @@ struct dst_entry
102 }; 103 };
103}; 104};
104 105
105
106struct dst_ops
107{
108 unsigned short family;
109 __be16 protocol;
110 unsigned gc_thresh;
111
112 int (*gc)(struct dst_ops *ops);
113 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
114 void (*destroy)(struct dst_entry *);
115 void (*ifdown)(struct dst_entry *,
116 struct net_device *dev, int how);
117 struct dst_entry * (*negative_advice)(struct dst_entry *);
118 void (*link_failure)(struct sk_buff *);
119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
120 int (*local_out)(struct sk_buff *skb);
121
122 atomic_t entries;
123 struct kmem_cache *kmem_cachep;
124 struct net *dst_net;
125};
126
127#ifdef __KERNEL__ 106#ifdef __KERNEL__
128 107
129static inline u32 108static inline u32
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
new file mode 100644
index 000000000000..d1ff9b7e99b8
--- /dev/null
+++ b/include/net/dst_ops.h
@@ -0,0 +1,28 @@
1#ifndef _NET_DST_OPS_H
2#define _NET_DST_OPS_H
3#include <linux/types.h>
4
5struct dst_entry;
6struct kmem_cachep;
7struct net_device;
8struct sk_buff;
9
10struct dst_ops {
11 unsigned short family;
12 __be16 protocol;
13 unsigned gc_thresh;
14
15 int (*gc)(struct dst_ops *ops);
16 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
17 void (*destroy)(struct dst_entry *);
18 void (*ifdown)(struct dst_entry *,
19 struct net_device *dev, int how);
20 struct dst_entry * (*negative_advice)(struct dst_entry *);
21 void (*link_failure)(struct sk_buff *);
22 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
23 int (*local_out)(struct sk_buff *skb);
24
25 atomic_t entries;
26 struct kmem_cache *kmem_cachep;
27};
28#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 1b0e3ee4ddd8..2a1c06874c42 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/genetlink.h> 4#include <linux/genetlink.h>
5#include <net/netlink.h> 5#include <net/netlink.h>
6#include <net/net_namespace.h>
6 7
7/** 8/**
8 * struct genl_multicast_group - generic netlink multicast group 9 * struct genl_multicast_group - generic netlink multicast group
@@ -27,6 +28,8 @@ struct genl_multicast_group
27 * @name: name of family 28 * @name: name of family
28 * @version: protocol version 29 * @version: protocol version
29 * @maxattr: maximum number of attributes supported 30 * @maxattr: maximum number of attributes supported
31 * @netnsok: set to true if the family can handle network
32 * namespaces and should be presented in all of them
30 * @attrbuf: buffer to store parsed attributes 33 * @attrbuf: buffer to store parsed attributes
31 * @ops_list: list of all assigned operations 34 * @ops_list: list of all assigned operations
32 * @family_list: family list 35 * @family_list: family list
@@ -39,6 +42,7 @@ struct genl_family
39 char name[GENL_NAMSIZ]; 42 char name[GENL_NAMSIZ];
40 unsigned int version; 43 unsigned int version;
41 unsigned int maxattr; 44 unsigned int maxattr;
45 bool netnsok;
42 struct nlattr ** attrbuf; /* private */ 46 struct nlattr ** attrbuf; /* private */
43 struct list_head ops_list; /* private */ 47 struct list_head ops_list; /* private */
44 struct list_head family_list; /* private */ 48 struct list_head family_list; /* private */
@@ -62,8 +66,32 @@ struct genl_info
62 struct genlmsghdr * genlhdr; 66 struct genlmsghdr * genlhdr;
63 void * userhdr; 67 void * userhdr;
64 struct nlattr ** attrs; 68 struct nlattr ** attrs;
69#ifdef CONFIG_NET_NS
70 struct net * _net;
71#endif
65}; 72};
66 73
74#ifdef CONFIG_NET_NS
75static inline struct net *genl_info_net(struct genl_info *info)
76{
77 return info->_net;
78}
79
80static inline void genl_info_net_set(struct genl_info *info, struct net *net)
81{
82 info->_net = net;
83}
84#else
85static inline struct net *genl_info_net(struct genl_info *info)
86{
87 return &init_net;
88}
89
90static inline void genl_info_net_set(struct genl_info *info, struct net *net)
91{
92}
93#endif
94
67/** 95/**
68 * struct genl_ops - generic netlink operations 96 * struct genl_ops - generic netlink operations
69 * @cmd: command identifier 97 * @cmd: command identifier
@@ -98,8 +126,6 @@ extern int genl_register_mc_group(struct genl_family *family,
98extern void genl_unregister_mc_group(struct genl_family *family, 126extern void genl_unregister_mc_group(struct genl_family *family,
99 struct genl_multicast_group *grp); 127 struct genl_multicast_group *grp);
100 128
101extern struct sock *genl_sock;
102
103/** 129/**
104 * genlmsg_put - Add generic netlink header to netlink message 130 * genlmsg_put - Add generic netlink header to netlink message
105 * @skb: socket buffer holding the message 131 * @skb: socket buffer holding the message
@@ -170,7 +196,21 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
170} 196}
171 197
172/** 198/**
173 * genlmsg_multicast - multicast a netlink message 199 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
200 * @net: the net namespace
201 * @skb: netlink message as socket buffer
202 * @pid: own netlink pid to avoid sending to yourself
203 * @group: multicast group id
204 * @flags: allocation flags
205 */
206static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
207 u32 pid, unsigned int group, gfp_t flags)
208{
209 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags);
210}
211
212/**
213 * genlmsg_multicast - multicast a netlink message to the default netns
174 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
175 * @pid: own netlink pid to avoid sending to yourself 215 * @pid: own netlink pid to avoid sending to yourself
176 * @group: multicast group id 216 * @group: multicast group id
@@ -179,17 +219,29 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
179static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 219static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
180 unsigned int group, gfp_t flags) 220 unsigned int group, gfp_t flags)
181{ 221{
182 return nlmsg_multicast(genl_sock, skb, pid, group, flags); 222 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags);
183} 223}
184 224
185/** 225/**
226 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself
229 * @group: multicast group id
230 * @flags: allocation flags
231 *
232 * This function must hold the RTNL or rcu_read_lock().
233 */
234int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid,
235 unsigned int group, gfp_t flags);
236
237/**
186 * genlmsg_unicast - unicast a netlink message 238 * genlmsg_unicast - unicast a netlink message
187 * @skb: netlink message as socket buffer 239 * @skb: netlink message as socket buffer
188 * @pid: netlink pid of the destination socket 240 * @pid: netlink pid of the destination socket
189 */ 241 */
190static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) 242static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
191{ 243{
192 return nlmsg_unicast(genl_sock, skb, pid); 244 return nlmsg_unicast(net->genl_sock, skb, pid);
193} 245}
194 246
195/** 247/**
@@ -199,7 +251,7 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
199 */ 251 */
200static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 252static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
201{ 253{
202 return genlmsg_unicast(skb, info->snd_pid); 254 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid);
203} 255}
204 256
205/** 257/**
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154.h
index 8cb684635650..d52685defb11 100644
--- a/include/net/ieee802154/mac_def.h
+++ b/include/net/ieee802154.h
@@ -23,8 +23,8 @@
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */ 24 */
25 25
26#ifndef IEEE802154_MAC_DEF_H 26#ifndef NET_IEEE802154_H
27#define IEEE802154_MAC_DEF_H 27#define NET_IEEE802154_H
28 28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
deleted file mode 100644
index 78efcdf52b59..000000000000
--- a/include/net/ieee802154/nl802154.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154_netdev.h
index e2506af3e7c8..5dc6a61952de 100644
--- a/include/net/ieee802154/netdevice.h
+++ b/include/net/ieee802154_netdev.h
@@ -80,7 +80,7 @@ static inline int mac_cb_type(struct sk_buff *skb)
80struct ieee802154_mlme_ops { 80struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev, 81 int (*assoc_req)(struct net_device *dev,
82 struct ieee802154_addr *addr, 82 struct ieee802154_addr *addr,
83 u8 channel, u8 cap); 83 u8 channel, u8 page, u8 cap);
84 int (*assoc_resp)(struct net_device *dev, 84 int (*assoc_resp)(struct net_device *dev,
85 struct ieee802154_addr *addr, 85 struct ieee802154_addr *addr,
86 u16 short_addr, u8 status); 86 u16 short_addr, u8 status);
@@ -89,10 +89,10 @@ struct ieee802154_mlme_ops {
89 u8 reason); 89 u8 reason);
90 int (*start_req)(struct net_device *dev, 90 int (*start_req)(struct net_device *dev,
91 struct ieee802154_addr *addr, 91 struct ieee802154_addr *addr,
92 u8 channel, u8 bcn_ord, u8 sf_ord, 92 u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
93 u8 pan_coord, u8 blx, u8 coord_realign); 93 u8 pan_coord, u8 blx, u8 coord_realign);
94 int (*scan_req)(struct net_device *dev, 94 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 duration); 95 u8 type, u32 channels, u8 page, u8 duration);
96 96
97 /* 97 /*
98 * FIXME: these should become the part of PIB/MIB interface. 98 * FIXME: these should become the part of PIB/MIB interface.
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 03cffd9f64e3..696d6e4ce68a 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -48,13 +48,13 @@ struct inet_connection_sock_af_ops {
48 u16 net_header_len; 48 u16 net_header_len;
49 u16 sockaddr_len; 49 u16 sockaddr_len;
50 int (*setsockopt)(struct sock *sk, int level, int optname, 50 int (*setsockopt)(struct sock *sk, int level, int optname,
51 char __user *optval, int optlen); 51 char __user *optval, unsigned int optlen);
52 int (*getsockopt)(struct sock *sk, int level, int optname, 52 int (*getsockopt)(struct sock *sk, int level, int optname,
53 char __user *optval, int __user *optlen); 53 char __user *optval, int __user *optlen);
54#ifdef CONFIG_COMPAT 54#ifdef CONFIG_COMPAT
55 int (*compat_setsockopt)(struct sock *sk, 55 int (*compat_setsockopt)(struct sock *sk,
56 int level, int optname, 56 int level, int optname,
57 char __user *optval, int optlen); 57 char __user *optval, unsigned int optlen);
58 int (*compat_getsockopt)(struct sock *sk, 58 int (*compat_getsockopt)(struct sock *sk,
59 int level, int optname, 59 int level, int optname,
60 char __user *optval, int __user *optlen); 60 char __user *optval, int __user *optlen);
@@ -332,5 +332,5 @@ extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 332extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
333 char __user *optval, int __user *optlen); 333 char __user *optval, int __user *optlen);
334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 334extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
335 char __user *optval, int optlen); 335 char __user *optval, unsigned int optlen);
336#endif /* _INET_CONNECTION_SOCK_H */ 336#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b63b80fac567..f93ad90a601b 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -130,11 +130,11 @@ struct inet_timewait_sock {
130 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags); 131 kmemcheck_bitfield_begin(flags);
132 /* And these are ours. */ 132 /* And these are ours. */
133 __u8 tw_ipv6only:1, 133 unsigned int tw_ipv6only : 1,
134 tw_transparent:1; 134 tw_transparent : 1,
135 /* 14 bits hole, try to pack */ 135 tw_pad : 14, /* 14 bits hole */
136 tw_ipv6_offset : 16;
136 kmemcheck_bitfield_end(flags); 137 kmemcheck_bitfield_end(flags);
137 __u16 tw_ipv6_offset;
138 unsigned long tw_ttd; 138 unsigned long tw_ttd;
139 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
140 struct hlist_node tw_death_node; 140 struct hlist_node tw_death_node;
diff --git a/include/net/ip.h b/include/net/ip.h
index 72c36926c26d..2f47e5482b55 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -381,10 +381,10 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 381extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
382extern int ip_cmsg_send(struct net *net, 382extern int ip_cmsg_send(struct net *net,
383 struct msghdr *msg, struct ipcm_cookie *ipc); 383 struct msghdr *msg, struct ipcm_cookie *ipc);
384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); 384extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen);
385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 385extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
386extern int compat_ip_setsockopt(struct sock *sk, int level, 386extern int compat_ip_setsockopt(struct sock *sk, int level,
387 int optname, char __user *optval, int optlen); 387 int optname, char __user *optval, unsigned int optlen);
388extern int compat_ip_getsockopt(struct sock *sk, int level, 388extern int compat_ip_getsockopt(struct sock *sk, int level,
389 int optname, char __user *optval, int __user *optlen); 389 int optname, char __user *optval, int __user *optlen);
390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 390extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
@@ -399,7 +399,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
399 * fed into the routing cache should use these handlers. 399 * fed into the routing cache should use these handlers.
400 */ 400 */
401int ipv4_doint_and_flush(ctl_table *ctl, int write, 401int ipv4_doint_and_flush(ctl_table *ctl, int write,
402 struct file* filp, void __user *buffer, 402 void __user *buffer,
403 size_t *lenp, loff_t *ppos); 403 size_t *lenp, loff_t *ppos);
404int ipv4_doint_and_flush_strategy(ctl_table *table, 404int ipv4_doint_and_flush_strategy(ctl_table *table,
405 void __user *oldval, size_t __user *oldlenp, 405 void __user *oldval, size_t __user *oldlenp,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 7c5c0f79168a..15b492a9aa79 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -22,6 +22,12 @@
22#include <net/flow.h> 22#include <net/flow.h>
23#include <net/netlink.h> 23#include <net/netlink.h>
24 24
25#ifdef CONFIG_IPV6_MULTIPLE_TABLES
26#define FIB6_TABLE_HASHSZ 256
27#else
28#define FIB6_TABLE_HASHSZ 1
29#endif
30
25struct rt6_info; 31struct rt6_info;
26 32
27struct fib6_config 33struct fib6_config
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index ef91fe924ba4..4d22fabc7719 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -210,7 +210,8 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id);
210extern const struct nla_policy rtm_ipv4_policy[]; 210extern const struct nla_policy rtm_ipv4_policy[];
211extern void ip_fib_init(void); 211extern void ip_fib_init(void);
212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 212extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
213 struct net_device *dev, __be32 *spec_dst, u32 *itag); 213 struct net_device *dev, __be32 *spec_dst,
214 u32 *itag, u32 mark);
214extern void fib_select_default(struct net *net, const struct flowi *flp, 215extern void fib_select_default(struct net *net, const struct flowi *flp,
215 struct fib_result *res); 216 struct fib_result *res);
216 217
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index bbae1e87efcd..98978e73f666 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
99 return &buf[*idx - len]; 99 return &buf[*idx - len];
100} 100}
101 101
102#define IP_VS_DBG_BUF(level, msg...) \ 102#define IP_VS_DBG_BUF(level, msg, ...) \
103 do { \ 103 do { \
104 char ip_vs_dbg_buf[160]; \ 104 char ip_vs_dbg_buf[160]; \
105 int ip_vs_dbg_idx = 0; \ 105 int ip_vs_dbg_idx = 0; \
106 if (level <= ip_vs_get_debug_level()) \ 106 if (level <= ip_vs_get_debug_level()) \
107 printk(KERN_DEBUG "IPVS: " msg); \ 107 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
108 } while (0) 108 } while (0)
109#define IP_VS_ERR_BUF(msg...) \ 109#define IP_VS_ERR_BUF(msg...) \
110 do { \ 110 do { \
111 char ip_vs_dbg_buf[160]; \ 111 char ip_vs_dbg_buf[160]; \
112 int ip_vs_dbg_idx = 0; \ 112 int ip_vs_dbg_idx = 0; \
113 printk(KERN_ERR "IPVS: " msg); \ 113 pr_err(msg); \
114 } while (0) 114 } while (0)
115 115
116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ 116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
117#define IP_VS_DBG_ADDR(af, addr) \ 117#define IP_VS_DBG_ADDR(af, addr) \
118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ 118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
119 sizeof(ip_vs_dbg_buf), addr, \ 119 sizeof(ip_vs_dbg_buf), addr, \
120 &ip_vs_dbg_idx) 120 &ip_vs_dbg_idx)
121 121
122#define IP_VS_DBG(level, msg...) \ 122#define IP_VS_DBG(level, msg, ...) \
123 do { \ 123 do { \
124 if (level <= ip_vs_get_debug_level()) \ 124 if (level <= ip_vs_get_debug_level()) \
125 printk(KERN_DEBUG "IPVS: " msg); \ 125 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
126 } while (0) 126 } while (0)
127#define IP_VS_DBG_RL(msg...) \ 127#define IP_VS_DBG_RL(msg, ...) \
128 do { \ 128 do { \
129 if (net_ratelimit()) \ 129 if (net_ratelimit()) \
130 printk(KERN_DEBUG "IPVS: " msg); \ 130 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
131 } while (0) 131 } while (0)
132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ 132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \
133 do { \ 133 do { \
134 if (level <= ip_vs_get_debug_level()) \ 134 if (level <= ip_vs_get_debug_level()) \
135 pp->debug_packet(pp, skb, ofs, msg); \ 135 pp->debug_packet(pp, skb, ofs, msg); \
136 } while (0) 136 } while (0)
137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ 137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
138 do { \ 138 do { \
139 if (level <= ip_vs_get_debug_level() && \ 139 if (level <= ip_vs_get_debug_level() && \
140 net_ratelimit()) \ 140 net_ratelimit()) \
141 pp->debug_packet(pp, skb, ofs, msg); \ 141 pp->debug_packet(pp, skb, ofs, msg); \
142 } while (0) 142 } while (0)
143#else /* NO DEBUGGING at ALL */ 143#else /* NO DEBUGGING at ALL */
144#define IP_VS_DBG_BUF(level, msg...) do {} while (0) 144#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
145#define IP_VS_ERR_BUF(msg...) do {} while (0) 145#define IP_VS_ERR_BUF(msg...) do {} while (0)
@@ -150,29 +150,27 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
150#endif 150#endif
151 151
152#define IP_VS_BUG() BUG() 152#define IP_VS_BUG() BUG()
153#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg) 153#define IP_VS_ERR_RL(msg, ...) \
154#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg) 154 do { \
155#define IP_VS_WARNING(msg...) \ 155 if (net_ratelimit()) \
156 printk(KERN_WARNING "IPVS: " msg) 156 pr_err(msg, ##__VA_ARGS__); \
157#define IP_VS_ERR_RL(msg...) \ 157 } while (0)
158 do { \
159 if (net_ratelimit()) \
160 printk(KERN_ERR "IPVS: " msg); \
161 } while (0)
162 158
163#ifdef CONFIG_IP_VS_DEBUG 159#ifdef CONFIG_IP_VS_DEBUG
164#define EnterFunction(level) \ 160#define EnterFunction(level) \
165 do { \ 161 do { \
166 if (level <= ip_vs_get_debug_level()) \ 162 if (level <= ip_vs_get_debug_level()) \
167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 163 printk(KERN_DEBUG \
168 __func__, __FILE__, __LINE__); \ 164 pr_fmt("Enter: %s, %s line %i\n"), \
169 } while (0) 165 __func__, __FILE__, __LINE__); \
170#define LeaveFunction(level) \ 166 } while (0)
171 do { \ 167#define LeaveFunction(level) \
172 if (level <= ip_vs_get_debug_level()) \ 168 do { \
173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 169 if (level <= ip_vs_get_debug_level()) \
174 __func__, __FILE__, __LINE__); \ 170 printk(KERN_DEBUG \
175 } while (0) 171 pr_fmt("Leave: %s, %s line %i\n"), \
172 __func__, __FILE__, __LINE__); \
173 } while (0)
176#else 174#else
177#define EnterFunction(level) do {} while (0) 175#define EnterFunction(level) do {} while (0)
178#define LeaveFunction(level) do {} while (0) 176#define LeaveFunction(level) do {} while (0)
@@ -740,7 +738,8 @@ extern void ip_vs_protocol_cleanup(void);
740extern void ip_vs_protocol_timeout_change(int flags); 738extern void ip_vs_protocol_timeout_change(int flags);
741extern int *ip_vs_create_timeout_table(int *table, int size); 739extern int *ip_vs_create_timeout_table(int *table, int size);
742extern int 740extern int
743ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to); 741ip_vs_set_state_timeout(int *table, int num, const char *const *names,
742 const char *name, int to);
744extern void 743extern void
745ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb, 744ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb,
746 int offset, const char *msg); 745 int offset, const char *msg);
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 5d3036fa1511..87acf8f3a155 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -12,7 +12,6 @@ struct ip_tunnel
12 struct ip_tunnel *next; 12 struct ip_tunnel *next;
13 struct net_device *dev; 13 struct net_device *dev;
14 14
15 int recursion; /* Depth of hard_start_xmit recursion */
16 int err_count; /* Number of arrived ICMP errors */ 15 int err_count; /* Number of arrived ICMP errors */
17 unsigned long err_time; /* Time when the last ICMP error arrived */ 16 unsigned long err_time; /* Time when the last ICMP error arrived */
18 17
@@ -28,18 +27,11 @@ struct ip_tunnel
28 unsigned int prl_count; /* # of entries in PRL */ 27 unsigned int prl_count; /* # of entries in PRL */
29}; 28};
30 29
31/* ISATAP: default interval between RS in secondy */
32#define IPTUNNEL_RS_DEFAULT_DELAY (900)
33
34struct ip_tunnel_prl_entry 30struct ip_tunnel_prl_entry
35{ 31{
36 struct ip_tunnel_prl_entry *next; 32 struct ip_tunnel_prl_entry *next;
37 __be32 addr; 33 __be32 addr;
38 u16 flags; 34 u16 flags;
39 unsigned long rs_delay;
40 struct timer_list rs_timer;
41 struct ip_tunnel *tunnel;
42 spinlock_t lock;
43}; 35};
44 36
45#define IPTUNNEL_XMIT() do { \ 37#define IPTUNNEL_XMIT() do { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f27fd83d67d8..8c31d8a0c1fe 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -441,6 +441,18 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
442} 442}
443 443
444static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr)
445{
446 static u32 ipv6_fragmentation_id = 1;
447 static DEFINE_SPINLOCK(ip6_id_lock);
448
449 spin_lock_bh(&ip6_id_lock);
450 fhdr->identification = htonl(ipv6_fragmentation_id);
451 if (++ipv6_fragmentation_id == 0)
452 ipv6_fragmentation_id = 1;
453 spin_unlock_bh(&ip6_id_lock);
454}
455
444/* 456/*
445 * Prototypes exported by ipv6 457 * Prototypes exported by ipv6
446 */ 458 */
@@ -538,7 +550,7 @@ extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
538extern int ipv6_setsockopt(struct sock *sk, int level, 550extern int ipv6_setsockopt(struct sock *sk, int level,
539 int optname, 551 int optname,
540 char __user *optval, 552 char __user *optval,
541 int optlen); 553 unsigned int optlen);
542extern int ipv6_getsockopt(struct sock *sk, int level, 554extern int ipv6_getsockopt(struct sock *sk, int level,
543 int optname, 555 int optname,
544 char __user *optval, 556 char __user *optval,
@@ -547,7 +559,7 @@ extern int compat_ipv6_setsockopt(struct sock *sk,
547 int level, 559 int level,
548 int optname, 560 int optname,
549 char __user *optval, 561 char __user *optval,
550 int optlen); 562 unsigned int optlen);
551extern int compat_ipv6_getsockopt(struct sock *sk, 563extern int compat_ipv6_getsockopt(struct sock *sk,
552 int level, 564 int level,
553 int optname, 565 int optname,
diff --git a/include/net/irda/ircomm_event.h b/include/net/irda/ircomm_event.h
index c290447872d1..bc0c6f31f1c6 100644
--- a/include/net/irda/ircomm_event.h
+++ b/include/net/irda/ircomm_event.h
@@ -74,7 +74,7 @@ struct ircomm_info {
74 struct qos_info *qos; 74 struct qos_info *qos;
75}; 75};
76 76
77extern char *ircomm_state[]; 77extern const char *const ircomm_state[];
78 78
79struct ircomm_cb; /* Forward decl. */ 79struct ircomm_cb; /* Forward decl. */
80 80
diff --git a/include/net/irda/ircomm_tty_attach.h b/include/net/irda/ircomm_tty_attach.h
index f91a5695aa44..0a63bbb972d7 100644
--- a/include/net/irda/ircomm_tty_attach.h
+++ b/include/net/irda/ircomm_tty_attach.h
@@ -66,8 +66,8 @@ struct ircomm_tty_info {
66 __u8 dlsap_sel; 66 __u8 dlsap_sel;
67}; 67};
68 68
69extern char *ircomm_state[]; 69extern const char *const ircomm_state[];
70extern char *ircomm_tty_state[]; 70extern const char *const ircomm_tty_state[];
71 71
72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, 72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
73 struct sk_buff *skb, struct ircomm_tty_info *info); 73 struct sk_buff *skb, struct ircomm_tty_info *info);
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 2ae2e119ef4b..4c90824c50fb 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -120,7 +120,7 @@ typedef enum { /* FIXME check the two first reason codes */
120 LAP_PRIMARY_CONFLICT, 120 LAP_PRIMARY_CONFLICT,
121} LAP_REASON; 121} LAP_REASON;
122 122
123extern const char *irlap_state[]; 123extern const char *const irlap_state[];
124 124
125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, 125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 struct sk_buff *skb, struct irlap_info *info); 126 struct sk_buff *skb, struct irlap_info *info);
diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h
index e03ae4ae3963..9e4ec17a7449 100644
--- a/include/net/irda/irlmp_event.h
+++ b/include/net/irda/irlmp_event.h
@@ -79,8 +79,8 @@ typedef enum {
79 LM_LAP_IDLE_TIMEOUT, 79 LM_LAP_IDLE_TIMEOUT,
80} IRLMP_EVENT; 80} IRLMP_EVENT;
81 81
82extern const char *irlmp_state[]; 82extern const char *const irlmp_state[];
83extern const char *irlsap_state[]; 83extern const char *const irlsap_state[];
84 84
85void irlmp_watchdog_timer_expired(void *data); 85void irlmp_watchdog_timer_expired(void *data);
86void irlmp_discovery_timer_expired(void *data); 86void irlmp_discovery_timer_expired(void *data);
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 51b9a37de991..e9054a283fde 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -416,13 +416,13 @@ struct iw_spy_data
416 * data (i.e. valid as long as struct net_device exist, same locking rules). 416 * data (i.e. valid as long as struct net_device exist, same locking rules).
417 */ 417 */
418/* Forward declaration */ 418/* Forward declaration */
419struct ieee80211_device; 419struct libipw_device;
420/* The struct */ 420/* The struct */
421struct iw_public_data { 421struct iw_public_data {
422 /* Driver enhanced spy support */ 422 /* Driver enhanced spy support */
423 struct iw_spy_data * spy_data; 423 struct iw_spy_data * spy_data;
424 /* Structure managed by the in-kernel IEEE 802.11 layer */ 424 /* Legacy structure managed by the ipw2x00-specific IEEE 802.11 layer */
425 struct ieee80211_device * ieee80211; 425 struct libipw_device * libipw;
426}; 426};
427 427
428/**************************** PROTOTYPES ****************************/ 428/**************************** PROTOTYPES ****************************/
@@ -443,7 +443,7 @@ extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
443extern void wireless_send_event(struct net_device * dev, 443extern void wireless_send_event(struct net_device * dev,
444 unsigned int cmd, 444 unsigned int cmd,
445 union iwreq_data * wrqu, 445 union iwreq_data * wrqu,
446 char * extra); 446 const char * extra);
447 447
448/* We may need a function to send a stream of events to user space. 448/* We may need a function to send a stream of events to user space.
449 * More on that later... */ 449 * More on that later... */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c06104476973..998c30fc8981 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -73,6 +73,21 @@
73 */ 73 */
74 74
75/** 75/**
76 * DOC: mac80211 workqueue
77 *
78 * mac80211 provides its own workqueue for drivers and internal mac80211 use.
79 * The workqueue is a single threaded workqueue and can only be accessed by
80 * helpers for sanity checking. Drivers must ensure all work added onto the
81 * mac80211 workqueue should be cancelled on the driver stop() callback.
82 *
83 * mac80211 will flushed the workqueue upon interface removal and during
84 * suspend.
85 *
86 * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
87 *
88 */
89
90/**
76 * enum ieee80211_max_queues - maximum number of queues 91 * enum ieee80211_max_queues - maximum number of queues
77 * 92 *
78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 93 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -224,7 +239,14 @@ struct ieee80211_bss_conf {
224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 239 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
225 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. 240 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
226 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 241 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
227 * because the destination STA was in powersave mode. 242 * because the destination STA was in powersave mode. Note that to
243 * avoid race conditions, the filter must be set by the hardware or
244 * firmware upon receiving a frame that indicates that the station
245 * went to sleep (must be done on device to filter frames already on
246 * the queue) and may only be unset after mac80211 gives the OK for
247 * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
248 * since only then is it guaranteed that no more frames are in the
249 * hardware queue.
228 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 250 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
229 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status 251 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
230 * is for the whole aggregation. 252 * is for the whole aggregation.
@@ -241,6 +263,15 @@ struct ieee80211_bss_conf {
241 * it can be sent out. 263 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, 264 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS 265 * used to indicate that a frame was already retried due to PS
266 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
267 * used to indicate frame should not be encrypted
268 * @IEEE80211_TX_CTL_PSPOLL_RESPONSE: (internal?)
269 * This frame is a response to a PS-poll frame and should be sent
270 * although the station is in powersave mode.
271 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
272 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full.
244 */ 275 */
245enum mac80211_tx_control_flags { 276enum mac80211_tx_control_flags {
246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -259,6 +290,9 @@ enum mac80211_tx_control_flags {
259 IEEE80211_TX_INTFL_RCALGO = BIT(13), 290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15), 292 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
262}; 296};
263 297
264/** 298/**
@@ -316,6 +350,21 @@ enum mac80211_rate_control_flags {
316 * 350 *
317 * When used for transmit status reporting, the driver should 351 * When used for transmit status reporting, the driver should
318 * always report the rate along with the flags it used. 352 * always report the rate along with the flags it used.
353 *
354 * &struct ieee80211_tx_info contains an array of these structs
355 * in the control information, and it will be filled by the rate
356 * control algorithm according to what should be sent. For example,
357 * if this array contains, in the format { <idx>, <count> } the
358 * information
359 * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
360 * then this means that the frame should be transmitted
361 * up to twice at rate 3, up to twice at rate 2, and up to four
362 * times at rate 1 if it doesn't get acknowledged. Say it gets
363 * acknowledged by the peer after the fifth attempt, the status
364 * information should then contain
365 * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
366 * since it was transmitted twice at rate 3, twice at rate 2
367 * and once at rate 1 after which we received an acknowledgement.
319 */ 368 */
320struct ieee80211_tx_rate { 369struct ieee80211_tx_rate {
321 s8 idx; 370 s8 idx;
@@ -397,6 +446,11 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
397 return (struct ieee80211_tx_info *)skb->cb; 446 return (struct ieee80211_tx_info *)skb->cb;
398} 447}
399 448
449static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
450{
451 return (struct ieee80211_rx_status *)skb->cb;
452}
453
400/** 454/**
401 * ieee80211_tx_info_clear_status - clear TX status 455 * ieee80211_tx_info_clear_status - clear TX status
402 * 456 *
@@ -478,7 +532,7 @@ enum mac80211_rx_flags {
478 * 532 *
479 * The low-level driver should provide this information (the subset 533 * The low-level driver should provide this information (the subset
480 * supported by hardware) to the 802.11 code with each received 534 * supported by hardware) to the 802.11 code with each received
481 * frame. 535 * frame, in the skb's control buffer (cb).
482 * 536 *
483 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 537 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
484 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 538 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
@@ -529,7 +583,6 @@ enum ieee80211_conf_flags {
529/** 583/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 584 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 585 *
532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
@@ -539,7 +592,6 @@ enum ieee80211_conf_flags {
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 592 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
540 */ 593 */
541enum ieee80211_conf_changed { 594enum ieee80211_conf_changed {
542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
545 IEEE80211_CONF_CHANGE_PS = BIT(4), 597 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -549,14 +601,6 @@ enum ieee80211_conf_changed {
549 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 601 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
550}; 602};
551 603
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
560/** 604/**
561 * struct ieee80211_conf - configuration of the device 605 * struct ieee80211_conf - configuration of the device
562 * 606 *
@@ -564,9 +608,6 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
564 * 608 *
565 * @flags: configuration flags defined above 609 * @flags: configuration flags defined above
566 * 610 *
567 * @radio_enabled: when zero, driver is required to switch off the radio.
568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
570 * @listen_interval: listen interval in units of beacon interval 611 * @listen_interval: listen interval in units of beacon interval
571 * @max_sleep_period: the maximum number of beacon intervals to sleep for 612 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this 613 * before checking the beacon for a TIM bit (managed mode only); this
@@ -590,13 +631,11 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
590 * number of transmissions not the number of retries 631 * number of transmissions not the number of retries
591 */ 632 */
592struct ieee80211_conf { 633struct ieee80211_conf {
593 int __deprecated beacon_int;
594 u32 flags; 634 u32 flags;
595 int power_level, dynamic_ps_timeout; 635 int power_level, dynamic_ps_timeout;
596 int max_sleep_period; 636 int max_sleep_period;
597 637
598 u16 listen_interval; 638 u16 listen_interval;
599 bool __deprecated radio_enabled;
600 639
601 u8 long_frame_max_tx_count, short_frame_max_tx_count; 640 u8 long_frame_max_tx_count, short_frame_max_tx_count;
602 641
@@ -901,12 +940,6 @@ enum ieee80211_hw_flags {
901 * 940 *
902 * @conf: &struct ieee80211_conf, device configuration, don't use. 941 * @conf: &struct ieee80211_conf, device configuration, don't use.
903 * 942 *
904 * @workqueue: single threaded workqueue available for driver use,
905 * allocated by mac80211 on registration and flushed when an
906 * interface is removed.
907 * NOTICE: All work performed on this workqueue must not
908 * acquire the RTNL lock.
909 *
910 * @priv: pointer to private area that was allocated for driver use 943 * @priv: pointer to private area that was allocated for driver use
911 * along with this structure. 944 * along with this structure.
912 * 945 *
@@ -942,7 +975,6 @@ enum ieee80211_hw_flags {
942struct ieee80211_hw { 975struct ieee80211_hw {
943 struct ieee80211_conf conf; 976 struct ieee80211_conf conf;
944 struct wiphy *wiphy; 977 struct wiphy *wiphy;
945 struct workqueue_struct *workqueue;
946 const char *rate_control_algorithm; 978 const char *rate_control_algorithm;
947 void *priv; 979 void *priv;
948 u32 flags; 980 u32 flags;
@@ -1172,10 +1204,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1172 * the driver's configure_filter() function which frames should be 1204 * the driver's configure_filter() function which frames should be
1173 * passed to mac80211 and which should be filtered out. 1205 * passed to mac80211 and which should be filtered out.
1174 * 1206 *
1175 * The configure_filter() callback is invoked with the parameters 1207 * Before configure_filter() is invoked, the prepare_multicast()
1176 * @mc_count and @mc_list for the combined multicast address list 1208 * callback is invoked with the parameters @mc_count and @mc_list
1177 * of all virtual interfaces, @changed_flags telling which flags 1209 * for the combined multicast address list of all virtual interfaces.
1178 * were changed and @total_flags with the new flag states. 1210 * It's use is optional, and it returns a u64 that is passed to
1211 * configure_filter(). Additionally, configure_filter() has the
1212 * arguments @changed_flags telling which flags were changed and
1213 * @total_flags with the new flag states.
1179 * 1214 *
1180 * If your device has no multicast address filters your driver will 1215 * If your device has no multicast address filters your driver will
1181 * need to check both the %FIF_ALLMULTI flag and the @mc_count 1216 * need to check both the %FIF_ALLMULTI flag and the @mc_count
@@ -1224,10 +1259,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1224 * mac80211 needs to do and the amount of CPU wakeups, so you should 1259 * mac80211 needs to do and the amount of CPU wakeups, so you should
1225 * honour this flag if possible. 1260 * honour this flag if possible.
1226 * 1261 *
1227 * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then 1262 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
1228 * only those addressed to this station 1263 * is not set then only those addressed to this station.
1229 * 1264 *
1230 * @FIF_OTHER_BSS: pass frames destined to other BSSes 1265 * @FIF_OTHER_BSS: pass frames destined to other BSSes
1266 *
1267 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
1268 * those addressed to this station.
1231 */ 1269 */
1232enum ieee80211_filter_flags { 1270enum ieee80211_filter_flags {
1233 FIF_PROMISC_IN_BSS = 1<<0, 1271 FIF_PROMISC_IN_BSS = 1<<0,
@@ -1237,6 +1275,7 @@ enum ieee80211_filter_flags {
1237 FIF_BCN_PRBRESP_PROMISC = 1<<4, 1275 FIF_BCN_PRBRESP_PROMISC = 1<<4,
1238 FIF_CONTROL = 1<<5, 1276 FIF_CONTROL = 1<<5,
1239 FIF_OTHER_BSS = 1<<6, 1277 FIF_OTHER_BSS = 1<<6,
1278 FIF_PSPOLL = 1<<7,
1240}; 1279};
1241 1280
1242/** 1281/**
@@ -1244,6 +1283,12 @@ enum ieee80211_filter_flags {
1244 * 1283 *
1245 * These flags are used with the ampdu_action() callback in 1284 * These flags are used with the ampdu_action() callback in
1246 * &struct ieee80211_ops to indicate which action is needed. 1285 * &struct ieee80211_ops to indicate which action is needed.
1286 *
1287 * Note that drivers MUST be able to deal with a TX aggregation
1288 * session being stopped even before they OK'ed starting it by
1289 * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer
1290 * might receive the addBA frame and send a delBA right away!
1291 *
1247 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 1292 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
1248 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1293 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1249 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1294 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
@@ -1289,7 +1334,8 @@ enum ieee80211_ampdu_mlme_action {
1289 * is disabled. This should turn off the hardware (at least 1334 * is disabled. This should turn off the hardware (at least
1290 * it must turn off frame reception.) 1335 * it must turn off frame reception.)
1291 * May be called right after add_interface if that rejects 1336 * May be called right after add_interface if that rejects
1292 * an interface. 1337 * an interface. If you added any work onto the mac80211 workqueue
1338 * you should ensure to cancel it on this callback.
1293 * Must be implemented. 1339 * Must be implemented.
1294 * 1340 *
1295 * @add_interface: Called when a netdevice attached to the hardware is 1341 * @add_interface: Called when a netdevice attached to the hardware is
@@ -1323,9 +1369,13 @@ enum ieee80211_ampdu_mlme_action {
1323 * for association indication. The @changed parameter indicates which 1369 * for association indication. The @changed parameter indicates which
1324 * of the bss parameters has changed when a call is made. 1370 * of the bss parameters has changed when a call is made.
1325 * 1371 *
1372 * @prepare_multicast: Prepare for multicast filter configuration.
1373 * This callback is optional, and its return value is passed
1374 * to configure_filter(). This callback must be atomic.
1375 *
1326 * @configure_filter: Configure the device's RX filter. 1376 * @configure_filter: Configure the device's RX filter.
1327 * See the section "Frame filtering" for more information. 1377 * See the section "Frame filtering" for more information.
1328 * This callback must be implemented and atomic. 1378 * This callback must be implemented.
1329 * 1379 *
1330 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1380 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1331 * must be set or cleared for a given STA. Must be atomic. 1381 * must be set or cleared for a given STA. Must be atomic.
@@ -1411,6 +1461,8 @@ enum ieee80211_ampdu_mlme_action {
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1461 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration, 1462 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1463 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1464 *
1465 * @testmode_cmd: Implement a cfg80211 test mode command.
1414 */ 1466 */
1415struct ieee80211_ops { 1467struct ieee80211_ops {
1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1468 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1425,10 +1477,12 @@ struct ieee80211_ops {
1425 struct ieee80211_vif *vif, 1477 struct ieee80211_vif *vif,
1426 struct ieee80211_bss_conf *info, 1478 struct ieee80211_bss_conf *info,
1427 u32 changed); 1479 u32 changed);
1480 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1481 int mc_count, struct dev_addr_list *mc_list);
1428 void (*configure_filter)(struct ieee80211_hw *hw, 1482 void (*configure_filter)(struct ieee80211_hw *hw,
1429 unsigned int changed_flags, 1483 unsigned int changed_flags,
1430 unsigned int *total_flags, 1484 unsigned int *total_flags,
1431 int mc_count, struct dev_addr_list *mc_list); 1485 u64 multicast);
1432 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1486 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1433 bool set); 1487 bool set);
1434 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1488 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -1461,6 +1515,9 @@ struct ieee80211_ops {
1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1515 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462 1516
1463 void (*rfkill_poll)(struct ieee80211_hw *hw); 1517 void (*rfkill_poll)(struct ieee80211_hw *hw);
1518#ifdef CONFIG_NL80211_TESTMODE
1519 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1520#endif
1464}; 1521};
1465 1522
1466/** 1523/**
@@ -1606,10 +1663,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
1606 */ 1663 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw); 1664void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608 1665
1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1611 struct ieee80211_rx_status *status);
1612
1613/** 1666/**
1614 * ieee80211_rx - receive frame 1667 * ieee80211_rx - receive frame
1615 * 1668 *
@@ -1622,16 +1675,12 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1622 * to this function and ieee80211_rx_irqsafe() may not be mixed for a 1675 * to this function and ieee80211_rx_irqsafe() may not be mixed for a
1623 * single hardware. 1676 * single hardware.
1624 * 1677 *
1678 * Note that right now, this function must be called with softirqs disabled.
1679 *
1625 * @hw: the hardware this frame came in on 1680 * @hw: the hardware this frame came in on
1626 * @skb: the buffer to receive, owned by mac80211 after this call 1681 * @skb: the buffer to receive, owned by mac80211 after this call
1627 * @status: status of this frame; the status pointer need not be valid
1628 * after this function returns
1629 */ 1682 */
1630static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1683void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1631 struct ieee80211_rx_status *status)
1632{
1633 __ieee80211_rx(hw, skb, status);
1634}
1635 1684
1636/** 1685/**
1637 * ieee80211_rx_irqsafe - receive frame 1686 * ieee80211_rx_irqsafe - receive frame
@@ -1644,13 +1693,8 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1644 * 1693 *
1645 * @hw: the hardware this frame came in on 1694 * @hw: the hardware this frame came in on
1646 * @skb: the buffer to receive, owned by mac80211 after this call 1695 * @skb: the buffer to receive, owned by mac80211 after this call
1647 * @status: status of this frame; the status pointer need not be valid
1648 * after this function returns and is not freed by mac80211,
1649 * it is recommended that it points to a stack area
1650 */ 1696 */
1651void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, 1697void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
1652 struct sk_buff *skb,
1653 struct ieee80211_rx_status *status);
1654 1698
1655/** 1699/**
1656 * ieee80211_tx_status - transmit status callback 1700 * ieee80211_tx_status - transmit status callback
@@ -1917,6 +1961,31 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1917 void *data); 1961 void *data);
1918 1962
1919/** 1963/**
1964 * ieee80211_queue_work - add work onto the mac80211 workqueue
1965 *
1966 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
1967 * This helper ensures drivers are not queueing work when they should not be.
1968 *
1969 * @hw: the hardware struct for the interface we are adding work for
1970 * @work: the work we want to add onto the mac80211 workqueue
1971 */
1972void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
1973
1974/**
1975 * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
1976 *
1977 * Drivers and mac80211 use this to queue delayed work onto the mac80211
1978 * workqueue.
1979 *
1980 * @hw: the hardware struct for the interface we are adding work for
1981 * @dwork: delayable work to queue onto the mac80211 workqueue
1982 * @delay: number of jiffies to wait before queueing
1983 */
1984void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1985 struct delayed_work *dwork,
1986 unsigned long delay);
1987
1988/**
1920 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 1989 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1921 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1990 * @hw: pointer as obtained from ieee80211_alloc_hw().
1922 * @ra: receiver address of the BA session recipient 1991 * @ra: receiver address of the BA session recipient
@@ -2090,6 +2159,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
2090 return (sta == NULL || sta->supp_rates[band] & BIT(index)); 2159 return (sta == NULL || sta->supp_rates[band] & BIT(index));
2091} 2160}
2092 2161
2162/**
2163 * rate_control_send_low - helper for drivers for management/no-ack frames
2164 *
2165 * Rate control algorithms that agree to use the lowest rate to
2166 * send management frames and NO_ACK data with the respective hw
2167 * retries should use this in the beginning of their mac80211 get_rate
2168 * callback. If true is returned the rate control can simply return.
2169 * If false is returned we guarantee that sta and sta and priv_sta is
2170 * not null.
2171 *
2172 * Rate control algorithms wishing to do more intelligent selection of
2173 * rate for multicast/broadcast frames may choose to not use this.
2174 *
2175 * @sta: &struct ieee80211_sta pointer to the target destination. Note
2176 * that this may be null.
2177 * @priv_sta: private rate control structure. This may be null.
2178 * @txrc: rate control information we sholud populate for mac80211.
2179 */
2180bool rate_control_send_low(struct ieee80211_sta *sta,
2181 void *priv_sta,
2182 struct ieee80211_tx_rate_control *txrc);
2183
2184
2093static inline s8 2185static inline s8
2094rate_lowest_index(struct ieee80211_supported_band *sband, 2186rate_lowest_index(struct ieee80211_supported_band *sband,
2095 struct ieee80211_sta *sta) 2187 struct ieee80211_sta *sta)
@@ -2106,6 +2198,17 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
2106 return 0; 2198 return 0;
2107} 2199}
2108 2200
2201static inline
2202bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
2203 struct ieee80211_sta *sta)
2204{
2205 unsigned int i;
2206
2207 for (i = 0; i < sband->n_bitrates; i++)
2208 if (rate_supported(sta, sband->band, i))
2209 return true;
2210 return false;
2211}
2109 2212
2110int ieee80211_rate_control_register(struct rate_control_ops *ops); 2213int ieee80211_rate_control_register(struct rate_control_ops *ops);
2111void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2214void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 1459ed3e2697..f76f22d05721 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -55,7 +55,6 @@ enum {
55#include <net/neighbour.h> 55#include <net/neighbour.h>
56 56
57struct ctl_table; 57struct ctl_table;
58struct file;
59struct inet6_dev; 58struct inet6_dev;
60struct net_device; 59struct net_device;
61struct net_proto_family; 60struct net_proto_family;
@@ -139,7 +138,6 @@ extern int igmp6_event_report(struct sk_buff *skb);
139#ifdef CONFIG_SYSCTL 138#ifdef CONFIG_SYSCTL
140extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 139extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
141 int write, 140 int write,
142 struct file * filp,
143 void __user *buffer, 141 void __user *buffer,
144 size_t *lenp, 142 size_t *lenp,
145 loff_t *ppos); 143 loff_t *ppos);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index d8d790e56d3d..3817fda82a80 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <linux/workqueue.h>
27#include <net/rtnetlink.h> 28#include <net/rtnetlink.h>
28 29
29/* 30/*
@@ -117,7 +118,7 @@ struct neighbour
117 int (*output)(struct sk_buff *skb); 118 int (*output)(struct sk_buff *skb);
118 struct sk_buff_head arp_queue; 119 struct sk_buff_head arp_queue;
119 struct timer_list timer; 120 struct timer_list timer;
120 struct neigh_ops *ops; 121 const struct neigh_ops *ops;
121 u8 primary_key[0]; 122 u8 primary_key[0];
122}; 123};
123 124
@@ -167,7 +168,7 @@ struct neigh_table
167 int gc_thresh2; 168 int gc_thresh2;
168 int gc_thresh3; 169 int gc_thresh3;
169 unsigned long last_flush; 170 unsigned long last_flush;
170 struct timer_list gc_timer; 171 struct delayed_work gc_work;
171 struct timer_list proxy_timer; 172 struct timer_list proxy_timer;
172 struct sk_buff_head proxy_queue; 173 struct sk_buff_head proxy_queue;
173 atomic_t entries; 174 atomic_t entries;
@@ -178,7 +179,6 @@ struct neigh_table
178 struct neighbour **hash_buckets; 179 struct neighbour **hash_buckets;
179 unsigned int hash_mask; 180 unsigned int hash_mask;
180 __u32 hash_rnd; 181 __u32 hash_rnd;
181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183}; 183};
184 184
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ded434b032a4..a1202841aadd 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -26,6 +26,7 @@ struct net_device;
26struct sock; 26struct sock;
27struct ctl_table_header; 27struct ctl_table_header;
28struct net_generic; 28struct net_generic;
29struct sock;
29 30
30struct net { 31struct net {
31 atomic_t count; /* To decided when the network 32 atomic_t count; /* To decided when the network
@@ -57,6 +58,7 @@ struct net {
57 spinlock_t rules_mod_lock; 58 spinlock_t rules_mod_lock;
58 59
59 struct sock *rtnl; /* rtnetlink socket */ 60 struct sock *rtnl; /* rtnetlink socket */
61 struct sock *genl_sock;
60 62
61 struct netns_core core; 63 struct netns_core core;
62 struct netns_mib mib; 64 struct netns_mib mib;
@@ -78,6 +80,9 @@ struct net {
78#ifdef CONFIG_XFRM 80#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm; 81 struct netns_xfrm xfrm;
80#endif 82#endif
83#ifdef CONFIG_WIRELESS_EXT
84 struct sk_buff_head wext_nlevents;
85#endif
81 struct net_generic *gen; 86 struct net_generic *gen;
82}; 87};
83 88
@@ -106,6 +111,8 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
106 111
107extern struct list_head net_namespace_list; 112extern struct list_head net_namespace_list;
108 113
114extern struct net *get_net_ns_by_pid(pid_t pid);
115
109#ifdef CONFIG_NET_NS 116#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 117extern void __put_net(struct net *net);
111 118
@@ -208,6 +215,9 @@ static inline struct net *read_pnet(struct net * const *pnet)
208#define for_each_net(VAR) \ 215#define for_each_net(VAR) \
209 list_for_each_entry(VAR, &net_namespace_list, list) 216 list_for_each_entry(VAR, &net_namespace_list, list)
210 217
218#define for_each_net_rcu(VAR) \
219 list_for_each_entry_rcu(VAR, &net_namespace_list, list)
220
211#ifdef CONFIG_NET_NS 221#ifdef CONFIG_NET_NS
212#define __net_init 222#define __net_init
213#define __net_exit 223#define __net_exit
@@ -229,13 +239,15 @@ struct pernet_operations {
229 * needs per network namespace operations use device pernet operations, 239 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations. 240 * otherwise use pernet subsys operations.
231 * 241 *
232 * This is critically important. Most of the network code cleanup 242 * Network interfaces need to be removed from a dying netns _before_
233 * runs with the assumption that dev_remove_pack has been called so no 243 * subsys notifiers can be called, as most of the network code cleanup
234 * new packets will arrive during and after the cleanup functions have 244 * (which is done from subsys notifiers) runs with the assumption that
235 * been called. dev_remove_pack is not per namespace so instead the 245 * dev_remove_pack has been called so no new packets will arrive during
236 * guarantee of no more packets arriving in a network namespace is 246 * and after the cleanup functions have been called. dev_remove_pack
237 * provided by ensuring that all network devices and all sockets have 247 * is not per namespace so instead the guarantee of no more packets
238 * left the network namespace before the cleanup methods are called. 248 * arriving in a network namespace is provided by ensuring that all
249 * network devices and all sockets have left the network namespace
250 * before the cleanup methods are called.
239 * 251 *
240 * For the longest time the ipv4 icmp code was registered as a pernet 252 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network 253 * device which caused kernel oops, and panics during network
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index cbdd6284996d..5cf7270e3ffc 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -255,11 +255,9 @@ static inline bool nf_ct_kill(struct nf_conn *ct)
255} 255}
256 256
257/* These are for NAT. Icky. */ 257/* These are for NAT. Icky. */
258/* Update TCP window tracking data when NAT mangles the packet */ 258extern s16 (*nf_ct_nat_offset)(const struct nf_conn *ct,
259extern void nf_conntrack_tcp_update(const struct sk_buff *skb, 259 enum ip_conntrack_dir dir,
260 unsigned int dataoff, 260 u32 seq);
261 struct nf_conn *ct, int dir,
262 s16 offset);
263 261
264/* Fake conntrack entry for untracked connections */ 262/* Fake conntrack entry for untracked connections */
265extern struct nf_conn nf_conntrack_untracked; 263extern struct nf_conn nf_conntrack_untracked;
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 58684066388c..33602ab66190 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -31,6 +31,6 @@ struct nlattr;
31extern int 31extern int
32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, 32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
33 enum nf_nat_manip_type manip, 33 enum nf_nat_manip_type manip,
34 struct nlattr *attr); 34 const struct nlattr *attr);
35 35
36#endif /* _NF_NAT_CORE_H */ 36#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 237a961f40e1..4222220920a5 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -32,4 +32,8 @@ extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
32 * to port ct->master->saved_proto. */ 32 * to port ct->master->saved_proto. */
33extern void nf_nat_follow_master(struct nf_conn *ct, 33extern void nf_nat_follow_master(struct nf_conn *ct,
34 struct nf_conntrack_expect *this); 34 struct nf_conntrack_expect *this);
35
36extern s16 nf_nat_get_offset(const struct nf_conn *ct,
37 enum ip_conntrack_dir dir,
38 u32 seq);
35#endif 39#endif
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 007bdb07dabb..a63b2192ac1c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -365,7 +365,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
365 * 365 *
366 * See nla_parse() 366 * See nla_parse()
367 */ 367 */
368static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, 368static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
369 struct nlattr *tb[], int maxtype, 369 struct nlattr *tb[], int maxtype,
370 const struct nla_policy *policy) 370 const struct nla_policy *policy)
371{ 371{
@@ -414,7 +414,7 @@ static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
414 * 414 *
415 * Returns 1 if a report back to the application is requested. 415 * Returns 1 if a report back to the application is requested.
416 */ 416 */
417static inline int nlmsg_report(struct nlmsghdr *nlh) 417static inline int nlmsg_report(const struct nlmsghdr *nlh)
418{ 418{
419 return !!(nlh->nlmsg_flags & NLM_F_ECHO); 419 return !!(nlh->nlmsg_flags & NLM_F_ECHO);
420} 420}
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index afab4e4cbac7..dfeb2d7c425b 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -6,6 +6,7 @@
6 6
7#ifndef __NETNS_IPV6_H__ 7#ifndef __NETNS_IPV6_H__
8#define __NETNS_IPV6_H__ 8#define __NETNS_IPV6_H__
9#include <net/dst_ops.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -42,7 +43,7 @@ struct netns_ipv6 {
42 struct timer_list ip6_fib_timer; 43 struct timer_list ip6_fib_timer;
43 struct hlist_head *fib_table_hash; 44 struct hlist_head *fib_table_hash;
44 struct fib6_table *fib6_main_tbl; 45 struct fib6_table *fib6_main_tbl;
45 struct dst_ops *ip6_dst_ops; 46 struct dst_ops ip6_dst_ops;
46 unsigned int ip6_rt_gc_expire; 47 unsigned int ip6_rt_gc_expire;
47 unsigned long ip6_rt_last_gc; 48 unsigned long ip6_rt_last_gc;
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 49#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 9554a644a8f8..591db7d657a3 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,8 +8,11 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
11 struct ebt_table *broute_table; 13 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter; 14 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat; 15 struct ebt_table *frame_nat;
16#endif
14}; 17};
15#endif 18#endif
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
new file mode 100644
index 000000000000..99d2ba1c7e03
--- /dev/null
+++ b/include/net/nl802154.h
@@ -0,0 +1,126 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned, u8 page,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
115 u16 coord_addr);
116
117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
119 * @dev: The device which was instructed to scan.
120 * @status: The status of the scan operation.
121 *
122 * Note: This is in section 7.1.14 of the IEEE 802.15.4 document.
123 */
124int ieee802154_nl_start_confirm(struct net_device *dev, u8 status);
125
126#endif
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index 29d126736611..44c923c9e21d 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -49,4 +49,6 @@ void phonet_address_notify(int event, struct net_device *dev, u8 addr);
49 49
50#define PN_NO_ADDR 0xff 50#define PN_NO_ADDR 0xff
51 51
52extern const struct file_operations pn_sock_seq_fops;
53
52#endif 54#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 82a3191375f5..f911ec7598ef 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -87,6 +87,9 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
87extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 87extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
88extern void qdisc_put_stab(struct qdisc_size_table *tab); 88extern void qdisc_put_stab(struct qdisc_size_table *tab);
89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); 89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
90extern int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
91 struct net_device *dev, struct netdev_queue *txq,
92 spinlock_t *root_lock);
90 93
91extern void __qdisc_run(struct Qdisc *q); 94extern void __qdisc_run(struct Qdisc *q);
92 95
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 1089d5aabd49..60249e51b669 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -94,21 +94,20 @@ struct inet_protosw {
94#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ 94#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
95#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ 95#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
96 96
97extern struct net_protocol *inet_protocol_base; 97extern const struct net_protocol *inet_protos[MAX_INET_PROTOS];
98extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
99 98
100#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 99#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
101extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; 100extern const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
102#endif 101#endif
103 102
104extern int inet_add_protocol(struct net_protocol *prot, unsigned char num); 103extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
105extern int inet_del_protocol(struct net_protocol *prot, unsigned char num); 104extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
106extern void inet_register_protosw(struct inet_protosw *p); 105extern void inet_register_protosw(struct inet_protosw *p);
107extern void inet_unregister_protosw(struct inet_protosw *p); 106extern void inet_unregister_protosw(struct inet_protosw *p);
108 107
109#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 108#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
110extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); 109extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
111extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); 110extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
112extern int inet6_register_protosw(struct inet_protosw *p); 111extern int inet6_register_protosw(struct inet_protosw *p);
113extern void inet6_unregister_protosw(struct inet_protosw *p); 112extern void inet6_unregister_protosw(struct inet_protosw *p);
114#endif 113#endif
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 3c1895e54b7f..c3aa044d3fc3 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -14,7 +14,7 @@ extern void rtnl_register(int protocol, int msgtype,
14extern int rtnl_unregister(int protocol, int msgtype); 14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol); 15extern void rtnl_unregister_all(int protocol);
16 16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh) 17static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
18{ 18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg)) 19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family; 20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
@@ -70,6 +70,9 @@ struct rtnl_link_ops {
70 size_t (*get_xstats_size)(const struct net_device *dev); 70 size_t (*get_xstats_size)(const struct net_device *dev);
71 int (*fill_xstats)(struct sk_buff *skb, 71 int (*fill_xstats)(struct sk_buff *skb,
72 const struct net_device *dev); 72 const struct net_device *dev);
73 int (*get_tx_queues)(struct net *net, struct nlattr *tb[],
74 unsigned int *tx_queues,
75 unsigned int *real_tx_queues);
73}; 76};
74 77
75extern int __rtnl_link_register(struct rtnl_link_ops *ops); 78extern int __rtnl_link_register(struct rtnl_link_ops *ops);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5482e9582f55..c33180dd42b4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -45,6 +45,8 @@ struct Qdisc
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_CAN_BYPASS 8
49#define TCQ_F_MQROOT 16
48#define TCQ_F_WARN_NONWC (1 << 16) 50#define TCQ_F_WARN_NONWC (1 << 16)
49 int padded; 51 int padded;
50 struct Qdisc_ops *ops; 52 struct Qdisc_ops *ops;
@@ -79,6 +81,7 @@ struct Qdisc
79struct Qdisc_class_ops 81struct Qdisc_class_ops
80{ 82{
81 /* Child qdisc manipulation */ 83 /* Child qdisc manipulation */
84 struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *);
82 int (*graft)(struct Qdisc *, unsigned long cl, 85 int (*graft)(struct Qdisc *, unsigned long cl,
83 struct Qdisc *, struct Qdisc **); 86 struct Qdisc *, struct Qdisc **);
84 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); 87 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
@@ -121,6 +124,7 @@ struct Qdisc_ops
121 void (*reset)(struct Qdisc *); 124 void (*reset)(struct Qdisc *);
122 void (*destroy)(struct Qdisc *); 125 void (*destroy)(struct Qdisc *);
123 int (*change)(struct Qdisc *, struct nlattr *arg); 126 int (*change)(struct Qdisc *, struct nlattr *arg);
127 void (*attach)(struct Qdisc *);
124 128
125 int (*dump)(struct Qdisc *, struct sk_buff *); 129 int (*dump)(struct Qdisc *, struct sk_buff *);
126 int (*dump_stats)(struct Qdisc *, struct gnet_dump *); 130 int (*dump_stats)(struct Qdisc *, struct gnet_dump *);
@@ -182,6 +186,11 @@ struct qdisc_skb_cb {
182 char data[]; 186 char data[];
183}; 187};
184 188
189static inline int qdisc_qlen(struct Qdisc *q)
190{
191 return q->q.qlen;
192}
193
185static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb) 194static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
186{ 195{
187 return (struct qdisc_skb_cb *)skb->cb; 196 return (struct qdisc_skb_cb *)skb->cb;
@@ -249,6 +258,8 @@ static inline void sch_tree_unlock(struct Qdisc *q)
249 258
250extern struct Qdisc noop_qdisc; 259extern struct Qdisc noop_qdisc;
251extern struct Qdisc_ops noop_qdisc_ops; 260extern struct Qdisc_ops noop_qdisc_ops;
261extern struct Qdisc_ops pfifo_fast_ops;
262extern struct Qdisc_ops mq_qdisc_ops;
252 263
253struct Qdisc_class_common 264struct Qdisc_class_common
254{ 265{
@@ -296,6 +307,8 @@ extern void dev_init_scheduler(struct net_device *dev);
296extern void dev_shutdown(struct net_device *dev); 307extern void dev_shutdown(struct net_device *dev);
297extern void dev_activate(struct net_device *dev); 308extern void dev_activate(struct net_device *dev);
298extern void dev_deactivate(struct net_device *dev); 309extern void dev_deactivate(struct net_device *dev);
310extern struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
311 struct Qdisc *qdisc);
299extern void qdisc_reset(struct Qdisc *qdisc); 312extern void qdisc_reset(struct Qdisc *qdisc);
300extern void qdisc_destroy(struct Qdisc *qdisc); 313extern void qdisc_destroy(struct Qdisc *qdisc);
301extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); 314extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
@@ -387,13 +400,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
387 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 400 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
388} 401}
389 402
403static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
404{
405 sch->bstats.bytes += len;
406 sch->bstats.packets++;
407}
408
390static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 409static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
391 struct sk_buff_head *list) 410 struct sk_buff_head *list)
392{ 411{
393 __skb_queue_tail(list, skb); 412 __skb_queue_tail(list, skb);
394 sch->qstats.backlog += qdisc_pkt_len(skb); 413 sch->qstats.backlog += qdisc_pkt_len(skb);
395 sch->bstats.bytes += qdisc_pkt_len(skb); 414 __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
396 sch->bstats.packets++;
397 415
398 return NET_XMIT_SUCCESS; 416 return NET_XMIT_SUCCESS;
399} 417}
diff --git a/include/net/scm.h b/include/net/scm.h
index f45bb6eca7d4..cf48c800e926 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -26,7 +26,6 @@ struct scm_cookie
26#ifdef CONFIG_SECURITY_NETWORK 26#ifdef CONFIG_SECURITY_NETWORK
27 u32 secid; /* Passed security ID */ 27 u32 secid; /* Passed security ID */
28#endif 28#endif
29 unsigned long seq; /* Connection seqno */
30}; 29};
31 30
32extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); 31extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
@@ -59,7 +58,6 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
59 scm->creds.gid = current_gid(); 58 scm->creds.gid = current_gid();
60 scm->creds.pid = task_tgid_vnr(p); 59 scm->creds.pid = task_tgid_vnr(p);
61 scm->fp = NULL; 60 scm->fp = NULL;
62 scm->seq = 0;
63 unix_get_peersec_dgram(sock, scm); 61 unix_get_peersec_dgram(sock, scm);
64 if (msg->msg_controllen <= 0) 62 if (msg->msg_controllen <= 0)
65 return 0; 63 return 0;
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 3b966802e05d..8be5135ff7aa 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -106,6 +106,7 @@ typedef enum {
106 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 106 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
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_LAST 110 SCTP_CMD_LAST
110} sctp_verb_t; 111} sctp_verb_t;
111 112
@@ -139,6 +140,7 @@ typedef union {
139 struct sctp_ulpevent *ulpevent; 140 struct sctp_ulpevent *ulpevent;
140 struct sctp_packet *packet; 141 struct sctp_packet *packet;
141 sctp_sackhdr_t *sackh; 142 sctp_sackhdr_t *sackh;
143 struct sctp_datamsg *msg;
142} sctp_arg_t; 144} sctp_arg_t;
143 145
144/* We are simulating ML type constructors here. 146/* We are simulating ML type constructors here.
@@ -188,6 +190,7 @@ SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init)
188SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent) 190SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent)
189SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet) 191SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet)
190SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) 192SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh)
193SCTP_ARG_CONSTRUCTOR(DATAMSG, struct sctp_datamsg *, msg)
191 194
192typedef struct { 195typedef struct {
193 sctp_arg_t obj; 196 sctp_arg_t obj;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index b05b0557211f..58f714a3b670 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -231,7 +231,7 @@ typedef enum {
231 SCTP_SS_LISTENING = TCP_LISTEN, 231 SCTP_SS_LISTENING = TCP_LISTEN,
232 SCTP_SS_ESTABLISHING = TCP_SYN_SENT, 232 SCTP_SS_ESTABLISHING = TCP_SYN_SENT,
233 SCTP_SS_ESTABLISHED = TCP_ESTABLISHED, 233 SCTP_SS_ESTABLISHED = TCP_ESTABLISHED,
234 SCTP_SS_DISCONNECTING = TCP_CLOSING, 234 SCTP_SS_CLOSING = TCP_CLOSING,
235} sctp_sock_state_t; 235} sctp_sock_state_t;
236 236
237/* These functions map various type to printable names. */ 237/* These functions map various type to printable names. */
@@ -241,7 +241,9 @@ const char *sctp_tname(const sctp_subtype_t); /* timeouts */
241const char *sctp_pname(const sctp_subtype_t); /* primitives */ 241const char *sctp_pname(const sctp_subtype_t); /* primitives */
242 242
243/* This is a table of printable names of sctp_state_t's. */ 243/* This is a table of printable names of sctp_state_t's. */
244extern const char *sctp_state_tbl[], *sctp_evttype_tbl[], *sctp_status_tbl[]; 244extern const char *const sctp_state_tbl[];
245extern const char *const sctp_evttype_tbl[];
246extern const char *const sctp_status_tbl[];
245 247
246/* Maximum chunk length considering padding requirements. */ 248/* Maximum chunk length considering padding requirements. */
247enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) }; 249enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) };
@@ -361,6 +363,13 @@ typedef enum {
361 SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ 363 SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */
362} sctp_scope_t; 364} sctp_scope_t;
363 365
366typedef enum {
367 SCTP_SCOPE_POLICY_DISABLE, /* Disable IPv4 address scoping */
368 SCTP_SCOPE_POLICY_ENABLE, /* Enable IPv4 address scoping */
369 SCTP_SCOPE_POLICY_PRIVATE, /* Follow draft but allow IPv4 private addresses */
370 SCTP_SCOPE_POLICY_LINK, /* Follow draft but allow IPv4 link local addresses */
371} sctp_scope_policy_t;
372
364/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>, 373/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>,
365 * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24, 374 * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24,
366 * 192.88.99.0/24. 375 * 192.88.99.0/24.
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d16a304cbed4..8a6d5297de16 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -486,15 +486,16 @@ static inline __s32 sctp_jitter(__u32 rto)
486} 486}
487 487
488/* Break down data chunks at this point. */ 488/* Break down data chunks at this point. */
489static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu) 489static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
490{ 490{
491 struct sctp_sock *sp = sctp_sk(asoc->base.sk);
491 int frag = pmtu; 492 int frag = pmtu;
492 493
493 frag -= sp->pf->af->net_header_len; 494 frag -= sp->pf->af->net_header_len;
494 frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk); 495 frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk);
495 496
496 if (sp->user_frag) 497 if (asoc->user_frag)
497 frag = min_t(int, frag, sp->user_frag); 498 frag = min_t(int, frag, asoc->user_frag);
498 499
499 frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN); 500 frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN);
500 501
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index edfcacf3250e..0a474568b003 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -219,6 +219,15 @@ extern struct sctp_globals {
219 /* Flag to idicate if SCTP-AUTH is enabled */ 219 /* Flag to idicate if SCTP-AUTH is enabled */
220 int auth_enable; 220 int auth_enable;
221 221
222 /*
223 * Policy to control SCTP IPv4 address scoping
224 * 0 - Disable IPv4 address scoping
225 * 1 - Enable IPv4 address scoping
226 * 2 - Selectively allow only IPv4 private addresses
227 * 3 - Selectively allow only IPv4 link local address
228 */
229 int ipv4_scope_policy;
230
222 /* Flag to indicate whether computing and verifying checksum 231 /* Flag to indicate whether computing and verifying checksum
223 * is disabled. */ 232 * is disabled. */
224 int checksum_disable; 233 int checksum_disable;
@@ -252,6 +261,7 @@ extern struct sctp_globals {
252#define sctp_port_hashtable (sctp_globals.port_hashtable) 261#define sctp_port_hashtable (sctp_globals.port_hashtable)
253#define sctp_local_addr_list (sctp_globals.local_addr_list) 262#define sctp_local_addr_list (sctp_globals.local_addr_list)
254#define sctp_local_addr_lock (sctp_globals.addr_list_lock) 263#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
264#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
255#define sctp_addip_enable (sctp_globals.addip_enable) 265#define sctp_addip_enable (sctp_globals.addip_enable)
256#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 266#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
257#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 267#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
@@ -534,7 +544,7 @@ struct sctp_af {
534 int level, 544 int level,
535 int optname, 545 int optname,
536 char __user *optval, 546 char __user *optval,
537 int optlen); 547 unsigned int optlen);
538 int (*getsockopt) (struct sock *sk, 548 int (*getsockopt) (struct sock *sk,
539 int level, 549 int level,
540 int optname, 550 int optname,
@@ -544,7 +554,7 @@ struct sctp_af {
544 int level, 554 int level,
545 int optname, 555 int optname,
546 char __user *optval, 556 char __user *optval,
547 int optlen); 557 unsigned int optlen);
548 int (*compat_getsockopt) (struct sock *sk, 558 int (*compat_getsockopt) (struct sock *sk,
549 int level, 559 int level,
550 int optname, 560 int optname,
@@ -628,7 +638,7 @@ struct sctp_datamsg {
628 /* Chunks waiting to be submitted to lower layer. */ 638 /* Chunks waiting to be submitted to lower layer. */
629 struct list_head chunks; 639 struct list_head chunks;
630 /* Chunks that have been transmitted. */ 640 /* Chunks that have been transmitted. */
631 struct list_head track; 641 size_t msg_size;
632 /* Reference counting. */ 642 /* Reference counting. */
633 atomic_t refcnt; 643 atomic_t refcnt;
634 /* When is this message no longer interesting to the peer? */ 644 /* When is this message no longer interesting to the peer? */
@@ -643,6 +653,7 @@ struct sctp_datamsg {
643struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 653struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
644 struct sctp_sndrcvinfo *, 654 struct sctp_sndrcvinfo *,
645 struct msghdr *, int len); 655 struct msghdr *, int len);
656void sctp_datamsg_free(struct sctp_datamsg *);
646void sctp_datamsg_put(struct sctp_datamsg *); 657void sctp_datamsg_put(struct sctp_datamsg *);
647void sctp_chunk_fail(struct sctp_chunk *, int error); 658void sctp_chunk_fail(struct sctp_chunk *, int error);
648int sctp_chunk_abandoned(struct sctp_chunk *); 659int sctp_chunk_abandoned(struct sctp_chunk *);
@@ -811,22 +822,12 @@ struct sctp_packet {
811 /* pointer to the auth chunk for this packet */ 822 /* pointer to the auth chunk for this packet */
812 struct sctp_chunk *auth; 823 struct sctp_chunk *auth;
813 824
814 /* This packet contains a COOKIE-ECHO chunk. */ 825 u8 has_cookie_echo:1, /* This packet contains a COOKIE-ECHO chunk. */
815 __u8 has_cookie_echo; 826 has_sack:1, /* This packet contains a SACK chunk. */
816 827 has_auth:1, /* This packet contains an AUTH chunk */
817 /* This packet contains a SACK chunk. */ 828 has_data:1, /* This packet contains at least 1 DATA chunk */
818 __u8 has_sack; 829 ipfragok:1, /* So let ip fragment this packet */
819 830 malloced:1; /* Is it malloced? */
820 /* This packet contains an AUTH chunk */
821 __u8 has_auth;
822
823 /* This packet contains at least 1 DATA chunk */
824 __u8 has_data;
825
826 /* SCTP cannot fragment this packet. So let ip fragment it. */
827 __u8 ipfragok;
828
829 __u8 malloced;
830}; 831};
831 832
832struct sctp_packet *sctp_packet_init(struct sctp_packet *, 833struct sctp_packet *sctp_packet_init(struct sctp_packet *,
@@ -892,7 +893,6 @@ struct sctp_transport {
892 */ 893 */
893 /* RTO : The current retransmission timeout value. */ 894 /* RTO : The current retransmission timeout value. */
894 unsigned long rto; 895 unsigned long rto;
895 unsigned long last_rto;
896 896
897 __u32 rtt; /* This is the most recent RTT. */ 897 __u32 rtt; /* This is the most recent RTT. */
898 898
@@ -1567,13 +1567,13 @@ struct sctp_association {
1567 __u32 sack_cnt; 1567 __u32 sack_cnt;
1568 1568
1569 /* These are capabilities which our peer advertised. */ 1569 /* These are capabilities which our peer advertised. */
1570 __u8 ecn_capable; /* Can peer do ECN? */ 1570 __u8 ecn_capable:1, /* Can peer do ECN? */
1571 __u8 ipv4_address; /* Peer understands IPv4 addresses? */ 1571 ipv4_address:1, /* Peer understands IPv4 addresses? */
1572 __u8 ipv6_address; /* Peer understands IPv6 addresses? */ 1572 ipv6_address:1, /* Peer understands IPv6 addresses? */
1573 __u8 hostname_address;/* Peer understands DNS addresses? */ 1573 hostname_address:1, /* Peer understands DNS addresses? */
1574 __u8 asconf_capable; /* Does peer support ADDIP? */ 1574 asconf_capable:1, /* Does peer support ADDIP? */
1575 __u8 prsctp_capable; /* Can peer do PR-SCTP? */ 1575 prsctp_capable:1, /* Can peer do PR-SCTP? */
1576 __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ 1576 auth_capable:1; /* Is peer doing SCTP-AUTH? */
1577 1577
1578 __u32 adaptation_ind; /* Adaptation Code point. */ 1578 __u32 adaptation_ind; /* Adaptation Code point. */
1579 1579
@@ -1738,6 +1738,12 @@ struct sctp_association {
1738 */ 1738 */
1739 __u32 rwnd_over; 1739 __u32 rwnd_over;
1740 1740
1741 /* Keeps treack of rwnd pressure. This happens when we have
1742 * a window, but not recevie buffer (i.e small packets). This one
1743 * is releases slowly (1 PMTU at a time ).
1744 */
1745 __u32 rwnd_press;
1746
1741 /* This is the sndbuf size in use for the association. 1747 /* This is the sndbuf size in use for the association.
1742 * This corresponds to the sndbuf size for the association, 1748 * This corresponds to the sndbuf size for the association,
1743 * as specified in the sk->sndbuf. 1749 * as specified in the sk->sndbuf.
@@ -1756,6 +1762,7 @@ struct sctp_association {
1756 1762
1757 /* The message size at which SCTP fragmentation will occur. */ 1763 /* The message size at which SCTP fragmentation will occur. */
1758 __u32 frag_point; 1764 __u32 frag_point;
1765 __u32 user_frag;
1759 1766
1760 /* Counter used to count INIT errors. */ 1767 /* Counter used to count INIT errors. */
1761 int init_err_counter; 1768 int init_err_counter;
@@ -1905,11 +1912,8 @@ struct sctp_association {
1905 1912
1906 __u16 active_key_id; 1913 __u16 active_key_id;
1907 1914
1908 /* Need to send an ECNE Chunk? */ 1915 __u8 need_ecne:1, /* Need to send an ECNE Chunk? */
1909 char need_ecne; 1916 temp:1; /* Is it a temporary association? */
1910
1911 /* Is it a temporary association? */
1912 char temp;
1913}; 1917};
1914 1918
1915 1919
@@ -1975,7 +1979,7 @@ void sctp_assoc_set_primary(struct sctp_association *,
1975void sctp_assoc_del_nonprimary_peers(struct sctp_association *, 1979void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
1976 struct sctp_transport *); 1980 struct sctp_transport *);
1977int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, 1981int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *,
1978 gfp_t); 1982 sctp_scope_t, gfp_t);
1979int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, 1983int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *,
1980 struct sctp_cookie*, 1984 struct sctp_cookie*,
1981 gfp_t gfp); 1985 gfp_t gfp);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 1580c04f68bc..be2334aaf52e 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -210,12 +210,6 @@ enum sctp_sinfo_flags {
210}; 210};
211 211
212 212
213typedef union {
214 __u8 raw;
215 struct sctp_initmsg init;
216 struct sctp_sndrcvinfo sndrcv;
217} sctp_cmsg_data_t;
218
219/* These are cmsg_types. */ 213/* These are cmsg_types. */
220typedef enum sctp_cmsg_type { 214typedef enum sctp_cmsg_type {
221 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ 215 SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
diff --git a/include/net/sock.h b/include/net/sock.h
index 950409dcec3d..9f96394f694e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -226,12 +226,12 @@ struct sock {
226#define sk_prot __sk_common.skc_prot 226#define sk_prot __sk_common.skc_prot
227#define sk_net __sk_common.skc_net 227#define sk_net __sk_common.skc_net
228 kmemcheck_bitfield_begin(flags); 228 kmemcheck_bitfield_begin(flags);
229 unsigned char sk_shutdown : 2, 229 unsigned int sk_shutdown : 2,
230 sk_no_check : 2, 230 sk_no_check : 2,
231 sk_userlocks : 4; 231 sk_userlocks : 4,
232 sk_protocol : 8,
233 sk_type : 16;
232 kmemcheck_bitfield_end(flags); 234 kmemcheck_bitfield_end(flags);
233 unsigned char sk_protocol;
234 unsigned short sk_type;
235 int sk_rcvbuf; 235 int sk_rcvbuf;
236 socket_lock_t sk_lock; 236 socket_lock_t sk_lock;
237 /* 237 /*
@@ -624,7 +624,7 @@ struct proto {
624 void (*shutdown)(struct sock *sk, int how); 624 void (*shutdown)(struct sock *sk, int how);
625 int (*setsockopt)(struct sock *sk, int level, 625 int (*setsockopt)(struct sock *sk, int level,
626 int optname, char __user *optval, 626 int optname, char __user *optval,
627 int optlen); 627 unsigned int optlen);
628 int (*getsockopt)(struct sock *sk, int level, 628 int (*getsockopt)(struct sock *sk, int level,
629 int optname, char __user *optval, 629 int optname, char __user *optval,
630 int __user *option); 630 int __user *option);
@@ -632,7 +632,7 @@ struct proto {
632 int (*compat_setsockopt)(struct sock *sk, 632 int (*compat_setsockopt)(struct sock *sk,
633 int level, 633 int level,
634 int optname, char __user *optval, 634 int optname, char __user *optval,
635 int optlen); 635 unsigned int optlen);
636 int (*compat_getsockopt)(struct sock *sk, 636 int (*compat_getsockopt)(struct sock *sk,
637 int level, 637 int level,
638 int optname, char __user *optval, 638 int optname, char __user *optval,
@@ -951,7 +951,7 @@ extern void sock_rfree(struct sk_buff *skb);
951 951
952extern int sock_setsockopt(struct socket *sock, int level, 952extern int sock_setsockopt(struct socket *sock, int level,
953 int op, char __user *optval, 953 int op, char __user *optval,
954 int optlen); 954 unsigned int optlen);
955 955
956extern int sock_getsockopt(struct socket *sock, int level, 956extern int sock_getsockopt(struct socket *sock, int level,
957 int op, char __user *optval, 957 int op, char __user *optval,
@@ -993,7 +993,7 @@ extern int sock_no_shutdown(struct socket *, int);
993extern int sock_no_getsockopt(struct socket *, int , int, 993extern int sock_no_getsockopt(struct socket *, int , int,
994 char __user *, int __user *); 994 char __user *, int __user *);
995extern int sock_no_setsockopt(struct socket *, int, int, 995extern int sock_no_setsockopt(struct socket *, int, int,
996 char __user *, int); 996 char __user *, unsigned int);
997extern int sock_no_sendmsg(struct kiocb *, struct socket *, 997extern int sock_no_sendmsg(struct kiocb *, struct socket *,
998 struct msghdr *, size_t); 998 struct msghdr *, size_t);
999extern int sock_no_recvmsg(struct kiocb *, struct socket *, 999extern int sock_no_recvmsg(struct kiocb *, struct socket *,
@@ -1015,11 +1015,11 @@ extern int sock_common_getsockopt(struct socket *sock, int level, int optname,
1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1015extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1016 struct msghdr *msg, size_t size, int flags); 1016 struct msghdr *msg, size_t size, int flags);
1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1017extern int sock_common_setsockopt(struct socket *sock, int level, int optname,
1018 char __user *optval, int optlen); 1018 char __user *optval, unsigned int optlen);
1019extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1019extern int compat_sock_common_getsockopt(struct socket *sock, int level,
1020 int optname, char __user *optval, int __user *optlen); 1020 int optname, char __user *optval, int __user *optlen);
1021extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1021extern int compat_sock_common_setsockopt(struct socket *sock, int level,
1022 int optname, char __user *optval, int optlen); 1022 int optname, char __user *optval, unsigned int optlen);
1023 1023
1024extern void sk_common_release(struct sock *sk); 1024extern void sk_common_release(struct sock *sk);
1025 1025
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 88af84306471..03a49c703377 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -394,13 +394,13 @@ extern int tcp_getsockopt(struct sock *sk, int level,
394 int __user *optlen); 394 int __user *optlen);
395extern int tcp_setsockopt(struct sock *sk, int level, 395extern int tcp_setsockopt(struct sock *sk, int level,
396 int optname, char __user *optval, 396 int optname, char __user *optval,
397 int optlen); 397 unsigned int optlen);
398extern int compat_tcp_getsockopt(struct sock *sk, 398extern int compat_tcp_getsockopt(struct sock *sk,
399 int level, int optname, 399 int level, int optname,
400 char __user *optval, int __user *optlen); 400 char __user *optval, int __user *optlen);
401extern int compat_tcp_setsockopt(struct sock *sk, 401extern int compat_tcp_setsockopt(struct sock *sk,
402 int level, int optname, 402 int level, int optname,
403 char __user *optval, int optlen); 403 char __user *optval, unsigned int optlen);
404extern void tcp_set_keepalive(struct sock *sk, int val); 404extern void tcp_set_keepalive(struct sock *sk, int val);
405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 405extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
406 struct msghdr *msg, 406 struct msghdr *msg,
@@ -469,6 +469,7 @@ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
469 int nonagle); 469 int nonagle);
470extern int tcp_may_send_now(struct sock *sk); 470extern int tcp_may_send_now(struct sock *sk);
471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
472extern void tcp_retransmit_timer(struct sock *sk);
472extern void tcp_xmit_retransmit_queue(struct sock *); 473extern void tcp_xmit_retransmit_queue(struct sock *);
473extern void tcp_simple_retransmit(struct sock *); 474extern void tcp_simple_retransmit(struct sock *);
474extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 475extern int tcp_trim_head(struct sock *, struct sk_buff *, u32);
@@ -521,6 +522,17 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
521extern int tcp_mss_to_mtu(struct sock *sk, int mss); 522extern int tcp_mss_to_mtu(struct sock *sk, int mss);
522extern void tcp_mtup_init(struct sock *sk); 523extern void tcp_mtup_init(struct sock *sk);
523 524
525static inline void tcp_bound_rto(const struct sock *sk)
526{
527 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
528 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
529}
530
531static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
532{
533 return (tp->srtt >> 3) + tp->rttvar;
534}
535
524static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 536static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
525{ 537{
526 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 538 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -781,6 +793,13 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
781 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 793 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
782} 794}
783 795
796#define TCP_INFINITE_SSTHRESH 0x7fffffff
797
798static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp)
799{
800 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH;
801}
802
784/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 803/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
785 * The exception is rate halving phase, when cwnd is decreasing towards 804 * The exception is rate halving phase, when cwnd is decreasing towards
786 * ssthresh. 805 * ssthresh.
@@ -1007,6 +1026,11 @@ static inline int keepalive_time_when(const struct tcp_sock *tp)
1007 return tp->keepalive_time ? : sysctl_tcp_keepalive_time; 1026 return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
1008} 1027}
1009 1028
1029static inline int keepalive_probes(const struct tcp_sock *tp)
1030{
1031 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1032}
1033
1010static inline int tcp_fin_time(const struct sock *sk) 1034static inline int tcp_fin_time(const struct sock *sk)
1011{ 1035{
1012 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1036 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
@@ -1169,7 +1193,7 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1169#define tcp_twsk_md5_key(twsk) NULL 1193#define tcp_twsk_md5_key(twsk) NULL
1170#endif 1194#endif
1171 1195
1172extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); 1196extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *);
1173extern void tcp_free_md5sig_pool(void); 1197extern void tcp_free_md5sig_pool(void);
1174 1198
1175extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1199extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
@@ -1235,6 +1259,29 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1235#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1259#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1236 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1260 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1237 1261
1262/* This function calculates a "timeout" which is equivalent to the timeout of a
1263 * TCP connection after "boundary" unsucessful, exponentially backed-off
1264 * retransmissions with an initial RTO of TCP_RTO_MIN.
1265 */
1266static inline bool retransmits_timed_out(const struct sock *sk,
1267 unsigned int boundary)
1268{
1269 unsigned int timeout, linear_backoff_thresh;
1270
1271 if (!inet_csk(sk)->icsk_retransmits)
1272 return false;
1273
1274 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1275
1276 if (boundary <= linear_backoff_thresh)
1277 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1278 else
1279 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1280 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1281
1282 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1283}
1284
1238static inline struct sk_buff *tcp_send_head(struct sock *sk) 1285static inline struct sk_buff *tcp_send_head(struct sock *sk)
1239{ 1286{
1240 return sk->sk_send_head; 1287 return sk->sk_send_head;
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index bfb240c6cf79..d65381cad0fc 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -51,7 +51,7 @@ extern int datagram_send_ctl(struct net *net,
51/* 51/*
52 * address family specific functions 52 * address family specific functions
53 */ 53 */
54extern struct inet_connection_sock_af_ops ipv4_specific; 54extern const struct inet_connection_sock_af_ops ipv4_specific;
55 55
56extern void inet6_destroy_sock(struct sock *sk); 56extern void inet6_destroy_sock(struct sock *sk);
57 57
diff --git a/include/net/udp.h b/include/net/udp.h
index 90e6ce56be65..f98abd2ce709 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -144,7 +144,7 @@ extern unsigned int udp_poll(struct file *file, struct socket *sock,
144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 144extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
145 char __user *optval, int __user *optlen); 145 char __user *optval, int __user *optlen);
146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 146extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
147 char __user *optval, int optlen, 147 char __user *optval, unsigned int optlen,
148 int (*push_pending_frames)(struct sock *)); 148 int (*push_pending_frames)(struct sock *));
149 149
150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 150extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
@@ -207,4 +207,7 @@ extern void udp4_proc_exit(void);
207#endif 207#endif
208 208
209extern void udp_init(void); 209extern void udp_init(void);
210
211extern int udp4_ufo_send_check(struct sk_buff *skb);
212extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features);
210#endif /* _UDP_H */ 213#endif /* _UDP_H */
diff --git a/include/net/wext.h b/include/net/wext.h
index 6d76a39a9c5b..3f2b94de2cfa 100644
--- a/include/net/wext.h
+++ b/include/net/wext.h
@@ -14,6 +14,7 @@ extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cm
14 void __user *arg); 14 void __user *arg);
15extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, 15extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
16 unsigned long arg); 16 unsigned long arg);
17extern struct iw_statistics *get_wireless_stats(struct net_device *dev);
17#else 18#else
18static inline int wext_proc_init(struct net *net) 19static inline int wext_proc_init(struct net *net)
19{ 20{
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
new file mode 100644
index 000000000000..547b1e271ac9
--- /dev/null
+++ b/include/net/wpan-phy.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2007, 2008, 2009 Siemens AG
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
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 */
20
21#ifndef WPAN_PHY_H
22#define WPAN_PHY_H
23
24#include <linux/netdevice.h>
25#include <linux/mutex.h>
26
27struct wpan_phy {
28 struct mutex pib_lock;
29
30 /*
31 * This is a PIB acording to 802.15.4-2006.
32 * We do not provide timing-related variables, as they
33 * aren't used outside of driver
34 */
35 u8 current_channel;
36 u8 current_page;
37 u32 channels_supported;
38 u8 transmit_power;
39 u8 cca_mode;
40
41 struct device dev;
42 int idx;
43
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45};
46
47struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy);
51
52static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{
54 BUG_ON(!phy);
55 return &phy->priv;
56}
57
58struct wpan_phy *wpan_phy_find(const char *str);
59static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{
61 return dev_name(&phy->dev);
62}
63#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9e3a3f4c1f60..223e90a44824 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1280,7 +1280,7 @@ struct xfrm6_tunnel {
1280}; 1280};
1281 1281
1282extern void xfrm_init(void); 1282extern void xfrm_init(void);
1283extern void xfrm4_init(void); 1283extern void xfrm4_init(int rt_hash_size);
1284extern int xfrm_state_init(struct net *net); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net); 1285extern void xfrm_state_fini(struct net *net);
1286extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 9b4ac9385f5d..e0f6feb8588c 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -90,14 +90,14 @@ typedef struct pccard_io_map {
90 u_char map; 90 u_char map;
91 u_char flags; 91 u_char flags;
92 u_short speed; 92 u_short speed;
93 u_int start, stop; 93 phys_addr_t start, stop;
94} pccard_io_map; 94} pccard_io_map;
95 95
96typedef struct pccard_mem_map { 96typedef struct pccard_mem_map {
97 u_char map; 97 u_char map;
98 u_char flags; 98 u_char flags;
99 u_short speed; 99 u_short speed;
100 u_long static_start; 100 phys_addr_t static_start;
101 u_int card_start; 101 u_int card_start;
102 struct resource *res; 102 struct resource *res;
103} pccard_mem_map; 103} pccard_mem_map;
@@ -262,6 +262,8 @@ struct pcmcia_socket {
262 struct device dev; 262 struct device dev;
263 /* data internal to the socket driver */ 263 /* data internal to the socket driver */
264 void *driver_data; 264 void *driver_data;
265 /* status of the card during resume from a system sleep state */
266 int resume_status;
265}; 267};
266 268
267 269
@@ -279,7 +281,9 @@ extern struct pccard_resource_ops pccard_iodyn_ops;
279extern struct pccard_resource_ops pccard_nonstatic_ops; 281extern struct pccard_resource_ops pccard_nonstatic_ops;
280 282
281/* socket drivers are expected to use these callbacks in their .drv struct */ 283/* socket drivers are expected to use these callbacks in their .drv struct */
282extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state); 284extern int pcmcia_socket_dev_suspend(struct device *dev);
285extern void pcmcia_socket_dev_early_resume(struct device *dev);
286extern void pcmcia_socket_dev_late_resume(struct device *dev);
283extern int pcmcia_socket_dev_resume(struct device *dev); 287extern int pcmcia_socket_dev_resume(struct device *dev);
284 288
285/* socket drivers use this callback in their IRQ handler */ 289/* socket drivers use this callback in their IRQ handler */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index 938858304300..c8f94e8db69c 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -482,7 +482,7 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id,
482 * message. 482 * message.
483 * @cm_id: Connection identifier associated with the connection message. 483 * @cm_id: Connection identifier associated with the connection message.
484 * @service_timeout: The lower 5-bits specify the maximum time required for 484 * @service_timeout: The lower 5-bits specify the maximum time required for
485 * the sender to reply to to the connection message. The upper 3-bits 485 * the sender to reply to the connection message. The upper 3-bits
486 * specify additional control flags. 486 * specify additional control flags.
487 * @private_data: Optional user-defined private data sent with the 487 * @private_data: Optional user-defined private data sent with the
488 * message receipt acknowledgement. 488 * message receipt acknowledgement.
diff --git a/include/scsi/fc/fc_fc2.h b/include/scsi/fc/fc_fc2.h
index cff8a8c22f50..f87777d0d5bd 100644
--- a/include/scsi/fc/fc_fc2.h
+++ b/include/scsi/fc/fc_fc2.h
@@ -92,8 +92,7 @@ struct fc_esb {
92 __u8 _esb_resvd[4]; 92 __u8 _esb_resvd[4];
93 __u8 esb_service_params[112]; /* TBD */ 93 __u8 esb_service_params[112]; /* TBD */
94 __u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */ 94 __u8 esb_seq_status[8]; /* sequence statuses, 8 bytes each */
95} __attribute__((packed));; 95} __attribute__((packed));
96
97 96
98/* 97/*
99 * Define expected size for ASSERTs. 98 * Define expected size for ASSERTs.
diff --git a/include/scsi/fc/fc_gs.h b/include/scsi/fc/fc_gs.h
index ffab0272c65a..324dd0e3c622 100644
--- a/include/scsi/fc/fc_gs.h
+++ b/include/scsi/fc/fc_gs.h
@@ -87,6 +87,7 @@ enum fc_ct_explan {
87 FC_FS_EXP_PNAM = 0x02, /* port name not registered */ 87 FC_FS_EXP_PNAM = 0x02, /* port name not registered */
88 FC_FS_EXP_NNAM = 0x03, /* node name not registered */ 88 FC_FS_EXP_NNAM = 0x03, /* node name not registered */
89 FC_FS_EXP_COS = 0x04, /* class of service not registered */ 89 FC_FS_EXP_COS = 0x04, /* class of service not registered */
90 FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */
90 /* definitions not complete */ 91 /* definitions not complete */
91}; 92};
92 93
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index a0ff61c3e935..27dad703824f 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -32,6 +32,7 @@ struct fc_ct_req {
32 struct fc_ns_gid_ft gid; 32 struct fc_ns_gid_ft gid;
33 struct fc_ns_rn_id rn; 33 struct fc_ns_rn_id rn;
34 struct fc_ns_rft rft; 34 struct fc_ns_rft rft;
35 struct fc_ns_fid fid;
35 } payload; 36 } payload;
36}; 37};
37 38
@@ -57,6 +58,23 @@ static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
57} 58}
58 59
59/** 60/**
61 * fc_adisc_fill() - Fill in adisc request frame
62 * @lport: local port.
63 * @fp: fc frame where payload will be placed.
64 */
65static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
66{
67 struct fc_els_adisc *adisc;
68
69 adisc = fc_frame_payload_get(fp, sizeof(*adisc));
70 memset(adisc, 0, sizeof(*adisc));
71 adisc->adisc_cmd = ELS_ADISC;
72 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn);
73 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn);
74 hton24(adisc->adisc_port_id, fc_host_port_id(lport->host));
75}
76
77/**
60 * fc_ct_hdr_fill- fills ct header and reset ct payload 78 * fc_ct_hdr_fill- fills ct header and reset ct payload
61 * returns pointer to ct request. 79 * returns pointer to ct request.
62 */ 80 */
@@ -77,10 +95,17 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
77} 95}
78 96
79/** 97/**
80 * fc_ct_fill - Fill in a name service request frame 98 * fc_ct_fill() - Fill in a name service request frame
99 * @lport: local port.
100 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
101 * @fp: frame to contain payload.
102 * @op: CT opcode.
103 * @r_ctl: pointer to FC header R_CTL.
104 * @fh_type: pointer to FC-4 type.
81 */ 105 */
82static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp, 106static inline int fc_ct_fill(struct fc_lport *lport,
83 unsigned int op, enum fc_rctl *r_ctl, u32 *did, 107 u32 fc_id, struct fc_frame *fp,
108 unsigned int op, enum fc_rctl *r_ctl,
84 enum fc_fh_type *fh_type) 109 enum fc_fh_type *fh_type)
85{ 110{
86 struct fc_ct_req *ct; 111 struct fc_ct_req *ct;
@@ -91,6 +116,11 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
91 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; 116 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
92 break; 117 break;
93 118
119 case FC_NS_GPN_ID:
120 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid));
121 hton24(ct->payload.fid.fp_fid, fc_id);
122 break;
123
94 case FC_NS_RFT_ID: 124 case FC_NS_RFT_ID:
95 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 125 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
96 hton24(ct->payload.rft.fid.fp_fid, 126 hton24(ct->payload.rft.fid.fp_fid,
@@ -110,7 +140,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
110 return -EINVAL; 140 return -EINVAL;
111 } 141 }
112 *r_ctl = FC_RCTL_DD_UNSOL_CTL; 142 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
113 *did = FC_FID_DIR_SERV;
114 *fh_type = FC_TYPE_CT; 143 *fh_type = FC_TYPE_CT;
115 return 0; 144 return 0;
116} 145}
@@ -249,51 +278,42 @@ static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp)
249/** 278/**
250 * fc_els_fill - Fill in an ELS request frame 279 * fc_els_fill - Fill in an ELS request frame
251 */ 280 */
252static inline int fc_els_fill(struct fc_lport *lport, struct fc_rport *rport, 281static inline int fc_els_fill(struct fc_lport *lport,
282 u32 did,
253 struct fc_frame *fp, unsigned int op, 283 struct fc_frame *fp, unsigned int op,
254 enum fc_rctl *r_ctl, u32 *did, enum fc_fh_type *fh_type) 284 enum fc_rctl *r_ctl, enum fc_fh_type *fh_type)
255{ 285{
256 switch (op) { 286 switch (op) {
287 case ELS_ADISC:
288 fc_adisc_fill(lport, fp);
289 break;
290
257 case ELS_PLOGI: 291 case ELS_PLOGI:
258 fc_plogi_fill(lport, fp, ELS_PLOGI); 292 fc_plogi_fill(lport, fp, ELS_PLOGI);
259 *did = rport->port_id;
260 break; 293 break;
261 294
262 case ELS_FLOGI: 295 case ELS_FLOGI:
263 fc_flogi_fill(lport, fp); 296 fc_flogi_fill(lport, fp);
264 *did = FC_FID_FLOGI;
265 break; 297 break;
266 298
267 case ELS_LOGO: 299 case ELS_LOGO:
268 fc_logo_fill(lport, fp); 300 fc_logo_fill(lport, fp);
269 *did = FC_FID_FLOGI;
270 /*
271 * if rport is valid then it
272 * is port logo, therefore
273 * set did to rport id.
274 */
275 if (rport)
276 *did = rport->port_id;
277 break; 301 break;
278 302
279 case ELS_RTV: 303 case ELS_RTV:
280 fc_rtv_fill(lport, fp); 304 fc_rtv_fill(lport, fp);
281 *did = rport->port_id;
282 break; 305 break;
283 306
284 case ELS_REC: 307 case ELS_REC:
285 fc_rec_fill(lport, fp); 308 fc_rec_fill(lport, fp);
286 *did = rport->port_id;
287 break; 309 break;
288 310
289 case ELS_PRLI: 311 case ELS_PRLI:
290 fc_prli_fill(lport, fp); 312 fc_prli_fill(lport, fp);
291 *did = rport->port_id;
292 break; 313 break;
293 314
294 case ELS_SCR: 315 case ELS_SCR:
295 fc_scr_fill(lport, fp); 316 fc_scr_fill(lport, fp);
296 *did = FC_FID_FCTRL;
297 break; 317 break;
298 318
299 default: 319 default:
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 59511057cee0..c35d2383cc26 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -37,13 +37,6 @@
37#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */ 37#define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */
38#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */ 38#define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
39 39
40/*
41 * Information about an individual fibre channel frame received or to be sent.
42 * The buffer may be in up to 4 additional non-contiguous sections,
43 * but the linear section must hold the frame header.
44 */
45#define FC_FRAME_SG_LEN 4 /* scatter/gather list maximum length */
46
47#define fp_skb(fp) (&((fp)->skb)) 40#define fp_skb(fp) (&((fp)->skb))
48#define fr_hdr(fp) ((fp)->skb.data) 41#define fr_hdr(fp) ((fp)->skb.data)
49#define fr_len(fp) ((fp)->skb.len) 42#define fr_len(fp) ((fp)->skb.len)
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 4426f00da5ff..d67dda2b6aa0 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -262,6 +262,7 @@ enum iscsi_err {
262 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, 262 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
263 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, 263 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
264 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, 264 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
265 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
265}; 266};
266 267
267/* 268/*
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index b92584a8843a..65dc9aacbf70 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -51,55 +51,49 @@ do { \
51 do { \ 51 do { \
52 CMD; \ 52 CMD; \
53 } while (0); \ 53 } while (0); \
54} while (0); 54} while (0)
55 55
56#define FC_LIBFC_DBG(fmt, args...) \ 56#define FC_LIBFC_DBG(fmt, args...) \
57 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ 57 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
58 printk(KERN_INFO "libfc: " fmt, ##args);) 58 printk(KERN_INFO "libfc: " fmt, ##args))
59 59
60#define FC_LPORT_DBG(lport, fmt, args...) \ 60#define FC_LPORT_DBG(lport, fmt, args...) \
61 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ 61 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
62 printk(KERN_INFO "lport: %6x: " fmt, \ 62 printk(KERN_INFO "host%u: lport %6x: " fmt, \
63 fc_host_port_id(lport->host), ##args);) 63 (lport)->host->host_no, \
64 fc_host_port_id((lport)->host), ##args))
64 65
65#define FC_DISC_DBG(disc, fmt, args...) \ 66#define FC_DISC_DBG(disc, fmt, args...) \
66 FC_CHECK_LOGGING(FC_DISC_LOGGING, \ 67 FC_CHECK_LOGGING(FC_DISC_LOGGING, \
67 printk(KERN_INFO "disc: %6x: " fmt, \ 68 printk(KERN_INFO "host%u: disc: " fmt, \
68 fc_host_port_id(disc->lport->host), \ 69 (disc)->lport->host->host_no, \
69 ##args);) 70 ##args))
70 71
71#define FC_RPORT_DBG(rport, fmt, args...) \ 72#define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \
72do { \
73 struct fc_rport_libfc_priv *rdata = rport->dd_data; \
74 struct fc_lport *lport = rdata->local_port; \
75 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ 73 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
76 printk(KERN_INFO "rport: %6x: %6x: " fmt, \ 74 printk(KERN_INFO "host%u: rport %6x: " fmt, \
77 fc_host_port_id(lport->host), \ 75 (lport)->host->host_no, \
78 rport->port_id, ##args);) \ 76 (port_id), ##args))
79} while (0); 77
78#define FC_RPORT_DBG(rdata, fmt, args...) \
79 FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args)
80 80
81#define FC_FCP_DBG(pkt, fmt, args...) \ 81#define FC_FCP_DBG(pkt, fmt, args...) \
82 FC_CHECK_LOGGING(FC_FCP_LOGGING, \ 82 FC_CHECK_LOGGING(FC_FCP_LOGGING, \
83 printk(KERN_INFO "fcp: %6x: %6x: " fmt, \ 83 printk(KERN_INFO "host%u: fcp: %6x: " fmt, \
84 fc_host_port_id(pkt->lp->host), \ 84 (pkt)->lp->host->host_no, \
85 pkt->rport->port_id, ##args);) 85 pkt->rport->port_id, ##args))
86
87#define FC_EM_DBG(em, fmt, args...) \
88 FC_CHECK_LOGGING(FC_EM_LOGGING, \
89 printk(KERN_INFO "em: %6x: " fmt, \
90 fc_host_port_id(em->lp->host), \
91 ##args);)
92 86
93#define FC_EXCH_DBG(exch, fmt, args...) \ 87#define FC_EXCH_DBG(exch, fmt, args...) \
94 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ 88 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
95 printk(KERN_INFO "exch: %6x: %4x: " fmt, \ 89 printk(KERN_INFO "host%u: xid %4x: " fmt, \
96 fc_host_port_id(exch->lp->host), \ 90 (exch)->lp->host->host_no, \
97 exch->xid, ##args);) 91 exch->xid, ##args))
98 92
99#define FC_SCSI_DBG(lport, fmt, args...) \ 93#define FC_SCSI_DBG(lport, fmt, args...) \
100 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ 94 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
101 printk(KERN_INFO "scsi: %6x: " fmt, \ 95 printk(KERN_INFO "host%u: scsi: " fmt, \
102 fc_host_port_id(lport->host), ##args);) 96 (lport)->host->host_no, ##args))
103 97
104/* 98/*
105 * libfc error codes 99 * libfc error codes
@@ -125,7 +119,7 @@ do { \
125 * FC HBA status 119 * FC HBA status
126 */ 120 */
127enum fc_lport_state { 121enum fc_lport_state {
128 LPORT_ST_NONE = 0, 122 LPORT_ST_DISABLED = 0,
129 LPORT_ST_FLOGI, 123 LPORT_ST_FLOGI,
130 LPORT_ST_DNS, 124 LPORT_ST_DNS,
131 LPORT_ST_RPN_ID, 125 LPORT_ST_RPN_ID,
@@ -143,53 +137,74 @@ enum fc_disc_event {
143}; 137};
144 138
145enum fc_rport_state { 139enum fc_rport_state {
146 RPORT_ST_NONE = 0,
147 RPORT_ST_INIT, /* initialized */ 140 RPORT_ST_INIT, /* initialized */
148 RPORT_ST_PLOGI, /* waiting for PLOGI completion */ 141 RPORT_ST_PLOGI, /* waiting for PLOGI completion */
149 RPORT_ST_PRLI, /* waiting for PRLI completion */ 142 RPORT_ST_PRLI, /* waiting for PRLI completion */
150 RPORT_ST_RTV, /* waiting for RTV completion */ 143 RPORT_ST_RTV, /* waiting for RTV completion */
151 RPORT_ST_READY, /* ready for use */ 144 RPORT_ST_READY, /* ready for use */
152 RPORT_ST_LOGO, /* port logout sent */ 145 RPORT_ST_LOGO, /* port logout sent */
153}; 146 RPORT_ST_ADISC, /* Discover Address sent */
154 147 RPORT_ST_DELETE, /* port being deleted */
155enum fc_rport_trans_state {
156 FC_PORTSTATE_ROGUE,
157 FC_PORTSTATE_REAL,
158}; 148};
159 149
160/** 150/**
161 * struct fc_disc_port - temporary discovery port to hold rport identifiers 151 * struct fc_disc_port - temporary discovery port to hold rport identifiers
162 * @lp: Fibre Channel host port instance 152 * @lp: Fibre Channel host port instance
163 * @peers: node for list management during discovery and RSCN processing 153 * @peers: Node for list management during discovery and RSCN processing
164 * @ids: identifiers structure to pass to fc_remote_port_add() 154 * @rport_work: Work struct for starting the rport state machine
165 * @rport_work: work struct for starting the rport state machine 155 * @port_id: Port ID of the discovered port
166 */ 156 */
167struct fc_disc_port { 157struct fc_disc_port {
168 struct fc_lport *lp; 158 struct fc_lport *lp;
169 struct list_head peers; 159 struct list_head peers;
170 struct fc_rport_identifiers ids;
171 struct work_struct rport_work; 160 struct work_struct rport_work;
161 u32 port_id;
172}; 162};
173 163
174enum fc_rport_event { 164enum fc_rport_event {
175 RPORT_EV_NONE = 0, 165 RPORT_EV_NONE = 0,
176 RPORT_EV_CREATED, 166 RPORT_EV_READY,
177 RPORT_EV_FAILED, 167 RPORT_EV_FAILED,
178 RPORT_EV_STOP, 168 RPORT_EV_STOP,
179 RPORT_EV_LOGO 169 RPORT_EV_LOGO
180}; 170};
181 171
172struct fc_rport_priv;
173
182struct fc_rport_operations { 174struct fc_rport_operations {
183 void (*event_callback)(struct fc_lport *, struct fc_rport *, 175 void (*event_callback)(struct fc_lport *, struct fc_rport_priv *,
184 enum fc_rport_event); 176 enum fc_rport_event);
185}; 177};
186 178
187/** 179/**
188 * struct fc_rport_libfc_priv - libfc internal information about a remote port 180 * struct fc_rport_libfc_priv - libfc internal information about a remote port
189 * @local_port: Fibre Channel host port instance 181 * @local_port: Fibre Channel host port instance
182 * @rp_state: indicates READY for I/O or DELETE when blocked.
183 * @flags: REC and RETRY supported flags
184 * @e_d_tov: error detect timeout value (in msec)
185 * @r_a_tov: resource allocation timeout value (in msec)
186 */
187struct fc_rport_libfc_priv {
188 struct fc_lport *local_port;
189 enum fc_rport_state rp_state;
190 u16 flags;
191 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
192 #define FC_RP_FLAGS_RETRY (1 << 1)
193 unsigned int e_d_tov;
194 unsigned int r_a_tov;
195};
196
197/**
198 * struct fc_rport_priv - libfc rport and discovery info about a remote port
199 * @local_port: Fibre Channel host port instance
200 * @rport: transport remote port
201 * @kref: reference counter
190 * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges 202 * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges
203 * @ids: remote port identifiers and roles
191 * @flags: REC and RETRY supported flags 204 * @flags: REC and RETRY supported flags
192 * @max_seq: maximum number of concurrent sequences 205 * @max_seq: maximum number of concurrent sequences
206 * @disc_id: discovery identifier
207 * @maxframe_size: maximum frame size
193 * @retries: retry count in current state 208 * @retries: retry count in current state
194 * @e_d_tov: error detect timeout value (in msec) 209 * @e_d_tov: error detect timeout value (in msec)
195 * @r_a_tov: resource allocation timeout value (in msec) 210 * @r_a_tov: resource allocation timeout value (in msec)
@@ -197,38 +212,28 @@ struct fc_rport_operations {
197 * @retry_work: 212 * @retry_work:
198 * @event_callback: Callback for rport READY, FAILED or LOGO 213 * @event_callback: Callback for rport READY, FAILED or LOGO
199 */ 214 */
200struct fc_rport_libfc_priv { 215struct fc_rport_priv {
201 struct fc_lport *local_port; 216 struct fc_lport *local_port;
217 struct fc_rport *rport;
218 struct kref kref;
202 enum fc_rport_state rp_state; 219 enum fc_rport_state rp_state;
220 struct fc_rport_identifiers ids;
203 u16 flags; 221 u16 flags;
204 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
205 #define FC_RP_FLAGS_RETRY (1 << 1)
206 u16 max_seq; 222 u16 max_seq;
223 u16 disc_id;
224 u16 maxframe_size;
207 unsigned int retries; 225 unsigned int retries;
208 unsigned int e_d_tov; 226 unsigned int e_d_tov;
209 unsigned int r_a_tov; 227 unsigned int r_a_tov;
210 enum fc_rport_trans_state trans_state;
211 struct mutex rp_mutex; 228 struct mutex rp_mutex;
212 struct delayed_work retry_work; 229 struct delayed_work retry_work;
213 enum fc_rport_event event; 230 enum fc_rport_event event;
214 struct fc_rport_operations *ops; 231 struct fc_rport_operations *ops;
215 struct list_head peers; 232 struct list_head peers;
216 struct work_struct event_work; 233 struct work_struct event_work;
234 u32 supported_classes;
217}; 235};
218 236
219#define PRIV_TO_RPORT(x) \
220 (struct fc_rport *)((void *)x - sizeof(struct fc_rport));
221#define RPORT_TO_PRIV(x) \
222 (struct fc_rport_libfc_priv *)((void *)x + sizeof(struct fc_rport));
223
224struct fc_rport *fc_rport_rogue_create(struct fc_disc_port *);
225
226static inline void fc_rport_set_name(struct fc_rport *rport, u64 wwpn, u64 wwnn)
227{
228 rport->node_name = wwnn;
229 rport->port_name = wwpn;
230}
231
232/* 237/*
233 * fcoe stats structure 238 * fcoe stats structure
234 */ 239 */
@@ -344,6 +349,8 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
344 */ 349 */
345 350
346struct fc_exch_mgr; 351struct fc_exch_mgr;
352struct fc_exch_mgr_anchor;
353extern u16 fc_cpu_mask; /* cpu mask for possible cpus */
347 354
348/* 355/*
349 * Sequence. 356 * Sequence.
@@ -368,6 +375,7 @@ struct fc_seq {
368 */ 375 */
369struct fc_exch { 376struct fc_exch {
370 struct fc_exch_mgr *em; /* exchange manager */ 377 struct fc_exch_mgr *em; /* exchange manager */
378 struct fc_exch_pool *pool; /* per cpu exches pool */
371 u32 state; /* internal driver state */ 379 u32 state; /* internal driver state */
372 u16 xid; /* our exchange ID */ 380 u16 xid; /* our exchange ID */
373 struct list_head ex_list; /* free or busy list linkage */ 381 struct list_head ex_list; /* free or busy list linkage */
@@ -415,7 +423,7 @@ struct libfc_function_template {
415 * STATUS: OPTIONAL 423 * STATUS: OPTIONAL
416 */ 424 */
417 struct fc_seq *(*elsct_send)(struct fc_lport *lport, 425 struct fc_seq *(*elsct_send)(struct fc_lport *lport,
418 struct fc_rport *rport, 426 u32 did,
419 struct fc_frame *fp, 427 struct fc_frame *fp,
420 unsigned int op, 428 unsigned int op,
421 void (*resp)(struct fc_seq *, 429 void (*resp)(struct fc_seq *,
@@ -519,25 +527,6 @@ struct libfc_function_template {
519 void (*exch_done)(struct fc_seq *sp); 527 void (*exch_done)(struct fc_seq *sp);
520 528
521 /* 529 /*
522 * Assigns a EM and a free XID for an new exchange and then
523 * allocates a new exchange and sequence pair.
524 * The fp can be used to determine free XID.
525 *
526 * STATUS: OPTIONAL
527 */
528 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp);
529
530 /*
531 * Release previously assigned XID by exch_get API.
532 * The LLD may implement this if XID is assigned by LLD
533 * in exch_get().
534 *
535 * STATUS: OPTIONAL
536 */
537 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp,
538 u16 ex_id);
539
540 /*
541 * Start a new sequence on the same exchange/sequence tuple. 530 * Start a new sequence on the same exchange/sequence tuple.
542 * 531 *
543 * STATUS: OPTIONAL 532 * STATUS: OPTIONAL
@@ -577,9 +566,11 @@ struct libfc_function_template {
577 int (*lport_reset)(struct fc_lport *); 566 int (*lport_reset)(struct fc_lport *);
578 567
579 /* 568 /*
580 * Create a remote port 569 * Create a remote port with a given port ID
570 *
571 * STATUS: OPTIONAL
581 */ 572 */
582 struct fc_rport *(*rport_create)(struct fc_disc_port *); 573 struct fc_rport_priv *(*rport_create)(struct fc_lport *, u32);
583 574
584 /* 575 /*
585 * Initiates the RP state machine. It is called from the LP module. 576 * Initiates the RP state machine. It is called from the LP module.
@@ -592,7 +583,7 @@ struct libfc_function_template {
592 * 583 *
593 * STATUS: OPTIONAL 584 * STATUS: OPTIONAL
594 */ 585 */
595 int (*rport_login)(struct fc_rport *rport); 586 int (*rport_login)(struct fc_rport_priv *);
596 587
597 /* 588 /*
598 * Logoff, and remove the rport from the transport if 589 * Logoff, and remove the rport from the transport if
@@ -600,7 +591,7 @@ struct libfc_function_template {
600 * 591 *
601 * STATUS: OPTIONAL 592 * STATUS: OPTIONAL
602 */ 593 */
603 int (*rport_logoff)(struct fc_rport *rport); 594 int (*rport_logoff)(struct fc_rport_priv *);
604 595
605 /* 596 /*
606 * Recieve a request from a remote port. 597 * Recieve a request from a remote port.
@@ -608,14 +599,20 @@ struct libfc_function_template {
608 * STATUS: OPTIONAL 599 * STATUS: OPTIONAL
609 */ 600 */
610 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 601 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
611 struct fc_rport *); 602 struct fc_lport *);
612 603
613 /* 604 /*
614 * lookup an rport by it's port ID. 605 * lookup an rport by it's port ID.
615 * 606 *
616 * STATUS: OPTIONAL 607 * STATUS: OPTIONAL
617 */ 608 */
618 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32); 609 struct fc_rport_priv *(*rport_lookup)(const struct fc_lport *, u32);
610
611 /*
612 * Destroy an rport after final kref_put().
613 * The argument is a pointer to the kref inside the fc_rport_priv.
614 */
615 void (*rport_destroy)(struct kref *);
619 616
620 /* 617 /*
621 * Send a fcp cmd from fsp pkt. 618 * Send a fcp cmd from fsp pkt.
@@ -681,18 +678,16 @@ struct libfc_function_template {
681/* information used by the discovery layer */ 678/* information used by the discovery layer */
682struct fc_disc { 679struct fc_disc {
683 unsigned char retry_count; 680 unsigned char retry_count;
684 unsigned char delay;
685 unsigned char pending; 681 unsigned char pending;
686 unsigned char requested; 682 unsigned char requested;
687 unsigned short seq_count; 683 unsigned short seq_count;
688 unsigned char buf_len; 684 unsigned char buf_len;
689 enum fc_disc_event event; 685 u16 disc_id;
690 686
691 void (*disc_callback)(struct fc_lport *, 687 void (*disc_callback)(struct fc_lport *,
692 enum fc_disc_event); 688 enum fc_disc_event);
693 689
694 struct list_head rports; 690 struct list_head rports;
695 struct list_head rogue_rports;
696 struct fc_lport *lport; 691 struct fc_lport *lport;
697 struct mutex disc_mutex; 692 struct mutex disc_mutex;
698 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ 693 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
@@ -704,9 +699,9 @@ struct fc_lport {
704 699
705 /* Associations */ 700 /* Associations */
706 struct Scsi_Host *host; 701 struct Scsi_Host *host;
707 struct fc_exch_mgr *emp; 702 struct list_head ema_list;
708 struct fc_rport *dns_rp; 703 struct fc_rport_priv *dns_rp;
709 struct fc_rport *ptp_rp; 704 struct fc_rport_priv *ptp_rp;
710 void *scsi_priv; 705 void *scsi_priv;
711 struct fc_disc disc; 706 struct fc_disc disc;
712 707
@@ -960,6 +955,28 @@ int fc_elsct_init(struct fc_lport *lp);
960int fc_exch_init(struct fc_lport *lp); 955int fc_exch_init(struct fc_lport *lp);
961 956
962/* 957/*
958 * Adds Exchange Manager (EM) mp to lport.
959 *
960 * Adds specified mp to lport using struct fc_exch_mgr_anchor,
961 * the struct fc_exch_mgr_anchor allows same EM sharing by
962 * more than one lport with their specified match function,
963 * the match function is used in allocating exchange from
964 * added mp.
965 */
966struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport,
967 struct fc_exch_mgr *mp,
968 bool (*match)(struct fc_frame *));
969
970/*
971 * Deletes Exchange Manager (EM) from lport by removing
972 * its anchor ema from lport.
973 *
974 * If removed anchor ema was the last user of its associated EM
975 * then also destroys associated EM.
976 */
977void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema);
978
979/*
963 * Allocates an Exchange Manager (EM). 980 * Allocates an Exchange Manager (EM).
964 * 981 *
965 * The EM manages exchanges for their allocation and 982 * The EM manages exchanges for their allocation and
@@ -974,27 +991,25 @@ int fc_exch_init(struct fc_lport *lp);
974 * a new exchange. 991 * a new exchange.
975 * The LLD may choose to have multiple EMs, 992 * The LLD may choose to have multiple EMs,
976 * e.g. one EM instance per CPU receive thread in LLD. 993 * e.g. one EM instance per CPU receive thread in LLD.
977 * The LLD can use exch_get() of struct libfc_function_template
978 * to specify XID for a new exchange within
979 * a specified EM instance.
980 * 994 *
981 * The em_idx to uniquely identify an EM instance. 995 * Specified match function is used in allocating exchanges
996 * from newly allocated EM.
982 */ 997 */
983struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, 998struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp,
984 enum fc_class class, 999 enum fc_class class,
985 u16 min_xid, 1000 u16 min_xid,
986 u16 max_xid); 1001 u16 max_xid,
1002 bool (*match)(struct fc_frame *));
987 1003
988/* 1004/*
989 * Free an exchange manager. 1005 * Free all exchange managers of a lport.
990 */ 1006 */
991void fc_exch_mgr_free(struct fc_exch_mgr *mp); 1007void fc_exch_mgr_free(struct fc_lport *lport);
992 1008
993/* 1009/*
994 * Receive a frame on specified local port and exchange manager. 1010 * Receive a frame on specified local port and exchange manager.
995 */ 1011 */
996void fc_exch_recv(struct fc_lport *lp, struct fc_exch_mgr *mp, 1012void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp);
997 struct fc_frame *fp);
998 1013
999/* 1014/*
1000 * This function is for exch_seq_send function pointer in 1015 * This function is for exch_seq_send function pointer in
@@ -1036,28 +1051,20 @@ int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec);
1036void fc_exch_done(struct fc_seq *sp); 1051void fc_exch_done(struct fc_seq *sp);
1037 1052
1038/* 1053/*
1039 * Assigns a EM and XID for a frame and then allocates
1040 * a new exchange and sequence pair.
1041 * The fp can be used to determine free XID.
1042 */
1043struct fc_exch *fc_exch_get(struct fc_lport *lp, struct fc_frame *fp);
1044
1045/*
1046 * Allocate a new exchange and sequence pair. 1054 * Allocate a new exchange and sequence pair.
1047 * if ex_id is zero then next free exchange id
1048 * from specified exchange manger mp will be assigned.
1049 */ 1055 */
1050struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp, 1056struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp);
1051 struct fc_frame *fp, u16 ex_id);
1052/* 1057/*
1053 * Start a new sequence on the same exchange as the supplied sequence. 1058 * Start a new sequence on the same exchange as the supplied sequence.
1054 */ 1059 */
1055struct fc_seq *fc_seq_start_next(struct fc_seq *sp); 1060struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
1056 1061
1062
1057/* 1063/*
1058 * Reset an exchange manager, completing all sequences and exchanges. 1064 * Reset all EMs of a lport, releasing its all sequences and
1059 * If s_id is non-zero, reset only exchanges originating from that FID. 1065 * exchanges. If sid is non-zero, then reset only exchanges
1060 * If d_id is non-zero, reset only exchanges sending to that FID. 1066 * we sourced from that FID. If did is non-zero, reset only
1067 * exchanges destined to that FID.
1061 */ 1068 */
1062void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); 1069void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
1063 1070
@@ -1078,4 +1085,9 @@ void fc_destroy_exch_mgr(void);
1078int fc_setup_rport(void); 1085int fc_setup_rport(void);
1079void fc_destroy_rport(void); 1086void fc_destroy_rport(void);
1080 1087
1088/*
1089 * Internal libfc functions.
1090 */
1091const char *fc_els_resp_type(struct fc_frame *);
1092
1081#endif /* _LIBFC_H_ */ 1093#endif /* _LIBFC_H_ */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 61afeb59a836..a72edd4eceec 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -303,6 +303,7 @@ struct iscsi_session {
303 int cmds_max; /* size of cmds array */ 303 int cmds_max; /* size of cmds array */
304 struct iscsi_task **cmds; /* Original Cmds arr */ 304 struct iscsi_task **cmds; /* Original Cmds arr */
305 struct iscsi_pool cmdpool; /* PDU's pool */ 305 struct iscsi_pool cmdpool; /* PDU's pool */
306 void *dd_data; /* LLD private data */
306}; 307};
307 308
308enum { 309enum {
@@ -363,7 +364,7 @@ extern int iscsi_target_alloc(struct scsi_target *starget);
363 */ 364 */
364extern struct iscsi_cls_session * 365extern struct iscsi_cls_session *
365iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost, 366iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost,
366 uint16_t, int, uint32_t, unsigned int); 367 uint16_t, int, int, uint32_t, unsigned int);
367extern void iscsi_session_teardown(struct iscsi_cls_session *); 368extern void iscsi_session_teardown(struct iscsi_cls_session *);
368extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); 369extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
369extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, 370extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
@@ -390,6 +391,7 @@ extern void iscsi_session_failure(struct iscsi_session *session,
390extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 391extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
391 enum iscsi_param param, char *buf); 392 enum iscsi_param param, char *buf);
392extern void iscsi_suspend_tx(struct iscsi_conn *conn); 393extern void iscsi_suspend_tx(struct iscsi_conn *conn);
394extern void iscsi_suspend_queue(struct iscsi_conn *conn);
393extern void iscsi_conn_queue_work(struct iscsi_conn *conn); 395extern void iscsi_conn_queue_work(struct iscsi_conn *conn);
394 396
395#define iscsi_conn_printk(prefix, _c, fmt, a...) \ 397#define iscsi_conn_printk(prefix, _c, fmt, a...) \
@@ -415,6 +417,8 @@ extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t);
415extern void iscsi_requeue_task(struct iscsi_task *task); 417extern void iscsi_requeue_task(struct iscsi_task *task);
416extern void iscsi_put_task(struct iscsi_task *task); 418extern void iscsi_put_task(struct iscsi_task *task);
417extern void __iscsi_get_task(struct iscsi_task *task); 419extern void __iscsi_get_task(struct iscsi_task *task);
420extern void iscsi_complete_scsi_task(struct iscsi_task *task,
421 uint32_t exp_cmdsn, uint32_t max_cmdsn);
418 422
419/* 423/*
420 * generic helpers 424 * generic helpers
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 084478e14d24..34c46ab5c31b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -129,6 +129,9 @@ struct scsi_cmnd;
129#define MI_REPORT_TARGET_PGS 0x0a 129#define MI_REPORT_TARGET_PGS 0x0a
130/* values for maintenance out */ 130/* values for maintenance out */
131#define MO_SET_TARGET_PGS 0x0a 131#define MO_SET_TARGET_PGS 0x0a
132/* values for variable length command */
133#define READ_32 0x09
134#define WRITE_32 0x0b
132 135
133/* Values for T10/04-262r7 */ 136/* Values for T10/04-262r7 */
134#define ATA_16 0x85 /* 16-byte pass-thru */ 137#define ATA_16 0x85 /* 16-byte pass-thru */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 3878d1dc7f59..a5e885a111df 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -229,10 +229,6 @@ enum scsi_prot_operations {
229 /* OS-HBA: Protected, HBA-Target: Protected */ 229 /* OS-HBA: Protected, HBA-Target: Protected */
230 SCSI_PROT_READ_PASS, 230 SCSI_PROT_READ_PASS,
231 SCSI_PROT_WRITE_PASS, 231 SCSI_PROT_WRITE_PASS,
232
233 /* OS-HBA: Protected, HBA-Target: Protected, checksum conversion */
234 SCSI_PROT_READ_CONVERT,
235 SCSI_PROT_WRITE_CONVERT,
236}; 232};
237 233
238static inline void scsi_set_prot_op(struct scsi_cmnd *scmd, unsigned char op) 234static inline void scsi_set_prot_op(struct scsi_cmnd *scmd, unsigned char op)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 3f566af3f101..f097ae340bc1 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -145,6 +145,7 @@ struct scsi_device {
145 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ 145 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
146 unsigned last_sector_bug:1; /* do not use multisector accesses on 146 unsigned last_sector_bug:1; /* do not use multisector accesses on
147 SD_LAST_BUGGY_SECTORS */ 147 SD_LAST_BUGGY_SECTORS */
148 unsigned is_visible:1; /* is the device visible in sysfs */
148 149
149 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ 150 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
150 struct list_head event_list; /* asserted events */ 151 struct list_head event_list; /* asserted events */
@@ -187,10 +188,13 @@ struct scsi_device_handler {
187 void (*detach)(struct scsi_device *); 188 void (*detach)(struct scsi_device *);
188 int (*activate)(struct scsi_device *); 189 int (*activate)(struct scsi_device *);
189 int (*prep_fn)(struct scsi_device *, struct request *); 190 int (*prep_fn)(struct scsi_device *, struct request *);
191 int (*set_params)(struct scsi_device *, const char *);
190}; 192};
191 193
192struct scsi_dh_data { 194struct scsi_dh_data {
193 struct scsi_device_handler *scsi_dh; 195 struct scsi_device_handler *scsi_dh;
196 struct scsi_device *sdev;
197 struct kref kref;
194 char buf[0]; 198 char buf[0];
195}; 199};
196 200
diff --git a/include/scsi/scsi_dh.h b/include/scsi/scsi_dh.h
index 33efce20c26c..ff2407405b42 100644
--- a/include/scsi/scsi_dh.h
+++ b/include/scsi/scsi_dh.h
@@ -60,6 +60,7 @@ extern int scsi_dh_activate(struct request_queue *);
60extern int scsi_dh_handler_exist(const char *); 60extern int scsi_dh_handler_exist(const char *);
61extern int scsi_dh_attach(struct request_queue *, const char *); 61extern int scsi_dh_attach(struct request_queue *, const char *);
62extern void scsi_dh_detach(struct request_queue *); 62extern void scsi_dh_detach(struct request_queue *);
63extern int scsi_dh_set_params(struct request_queue *, const char *);
63#else 64#else
64static inline int scsi_dh_activate(struct request_queue *req) 65static inline int scsi_dh_activate(struct request_queue *req)
65{ 66{
@@ -77,4 +78,8 @@ static inline void scsi_dh_detach(struct request_queue *q)
77{ 78{
78 return; 79 return;
79} 80}
81static inline int scsi_dh_set_params(struct request_queue *req, const char *params)
82{
83 return -SCSI_DH_NOSYS;
84}
80#endif 85#endif
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b62a097b3ecb..47941fc5aba7 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -797,24 +797,24 @@ static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost)
797 797
798static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) 798static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type)
799{ 799{
800 switch (target_type) { 800 static unsigned char cap[] = { 0,
801 case 1: return shost->prot_capabilities & SHOST_DIF_TYPE1_PROTECTION; 801 SHOST_DIF_TYPE1_PROTECTION,
802 case 2: return shost->prot_capabilities & SHOST_DIF_TYPE2_PROTECTION; 802 SHOST_DIF_TYPE2_PROTECTION,
803 case 3: return shost->prot_capabilities & SHOST_DIF_TYPE3_PROTECTION; 803 SHOST_DIF_TYPE3_PROTECTION };
804 }
805 804
806 return 0; 805 return shost->prot_capabilities & cap[target_type] ? target_type : 0;
807} 806}
808 807
809static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type) 808static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type)
810{ 809{
811 switch (target_type) { 810#if defined(CONFIG_BLK_DEV_INTEGRITY)
812 case 0: return shost->prot_capabilities & SHOST_DIX_TYPE0_PROTECTION; 811 static unsigned char cap[] = { SHOST_DIX_TYPE0_PROTECTION,
813 case 1: return shost->prot_capabilities & SHOST_DIX_TYPE1_PROTECTION; 812 SHOST_DIX_TYPE1_PROTECTION,
814 case 2: return shost->prot_capabilities & SHOST_DIX_TYPE2_PROTECTION; 813 SHOST_DIX_TYPE2_PROTECTION,
815 case 3: return shost->prot_capabilities & SHOST_DIX_TYPE3_PROTECTION; 814 SHOST_DIX_TYPE3_PROTECTION };
816 }
817 815
816 return shost->prot_capabilities & cap[target_type];
817#endif
818 return 0; 818 return 0;
819} 819}
820 820
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 251fc1cd5002..3dae3f799b9b 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -32,6 +32,9 @@
32#include "control.h" 32#include "control.h"
33#include "info.h" 33#include "info.h"
34 34
35/* maximum number of devices on the AC97 bus */
36#define AC97_BUS_MAX_DEVICES 4
37
35/* 38/*
36 * AC'97 codec registers 39 * AC'97 codec registers
37 */ 40 */
@@ -642,4 +645,10 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
642/* ad hoc AC97 device driver access */ 645/* ad hoc AC97 device driver access */
643extern struct bus_type ac97_bus_type; 646extern struct bus_type ac97_bus_type;
644 647
648/* AC97 platform_data adding function */
649static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data)
650{
651 ac97->dev.platform_data = data;
652}
653
645#endif /* __SOUND_AC97_CODEC_H */ 654#endif /* __SOUND_AC97_CODEC_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 82aed3f47534..1f57bb92eb5a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -138,7 +138,7 @@ struct snd_hwdep_dsp_image {
138 * * 138 * *
139 *****************************************************************************/ 139 *****************************************************************************/
140 140
141#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9) 141#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10)
142 142
143typedef unsigned long snd_pcm_uframes_t; 143typedef unsigned long snd_pcm_uframes_t;
144typedef signed long snd_pcm_sframes_t; 144typedef signed long snd_pcm_sframes_t;
diff --git a/include/sound/core.h b/include/sound/core.h
index 309cb9659a05..a61499c22b0b 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -93,15 +93,6 @@ struct snd_device {
93 93
94#define snd_device(n) list_entry(n, struct snd_device, list) 94#define snd_device(n) list_entry(n, struct snd_device, list)
95 95
96/* monitor files for graceful shutdown (hotplug) */
97
98struct snd_monitor_file {
99 struct file *file;
100 const struct file_operations *disconnected_f_op;
101 struct list_head shutdown_list; /* still need to shutdown */
102 struct list_head list; /* link of monitor files */
103};
104
105/* main structure for soundcard */ 96/* main structure for soundcard */
106 97
107struct snd_card { 98struct snd_card {
@@ -311,9 +302,7 @@ int snd_component_add(struct snd_card *card, const char *component);
311int snd_card_file_add(struct snd_card *card, struct file *file); 302int snd_card_file_add(struct snd_card *card, struct file *file);
312int snd_card_file_remove(struct snd_card *card, struct file *file); 303int snd_card_file_remove(struct snd_card *card, struct file *file);
313 304
314#ifndef snd_card_set_dev
315#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) 305#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
316#endif
317 306
318/* device.c */ 307/* device.c */
319 308
@@ -340,18 +329,17 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
340struct resource; 329struct resource;
341void release_and_free_resource(struct resource *res); 330void release_and_free_resource(struct resource *res);
342 331
343#ifdef CONFIG_SND_VERBOSE_PRINTK
344void snd_verbose_printk(const char *file, int line, const char *format, ...)
345 __attribute__ ((format (printf, 3, 4)));
346#endif
347#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
348void snd_verbose_printd(const char *file, int line, const char *format, ...)
349 __attribute__ ((format (printf, 3, 4)));
350#endif
351
352/* --- */ 332/* --- */
353 333
354#ifdef CONFIG_SND_VERBOSE_PRINTK 334#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
335void __snd_printk(unsigned int level, const char *file, int line,
336 const char *format, ...)
337 __attribute__ ((format (printf, 4, 5)));
338#else
339#define __snd_printk(level, file, line, format, args...) \
340 printk(format, ##args)
341#endif
342
355/** 343/**
356 * snd_printk - printk wrapper 344 * snd_printk - printk wrapper
357 * @fmt: format string 345 * @fmt: format string
@@ -360,15 +348,9 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
360 * when configured with CONFIG_SND_VERBOSE_PRINTK. 348 * when configured with CONFIG_SND_VERBOSE_PRINTK.
361 */ 349 */
362#define snd_printk(fmt, args...) \ 350#define snd_printk(fmt, args...) \
363 snd_verbose_printk(__FILE__, __LINE__, fmt ,##args) 351 __snd_printk(0, __FILE__, __LINE__, fmt, ##args)
364#else
365#define snd_printk(fmt, args...) \
366 printk(fmt ,##args)
367#endif
368 352
369#ifdef CONFIG_SND_DEBUG 353#ifdef CONFIG_SND_DEBUG
370
371#ifdef CONFIG_SND_VERBOSE_PRINTK
372/** 354/**
373 * snd_printd - debug printk 355 * snd_printd - debug printk
374 * @fmt: format string 356 * @fmt: format string
@@ -377,11 +359,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
377 * Ignored when CONFIG_SND_DEBUG is not set. 359 * Ignored when CONFIG_SND_DEBUG is not set.
378 */ 360 */
379#define snd_printd(fmt, args...) \ 361#define snd_printd(fmt, args...) \
380 snd_verbose_printd(__FILE__, __LINE__, fmt ,##args) 362 __snd_printk(1, __FILE__, __LINE__, fmt, ##args)
381#else
382#define snd_printd(fmt, args...) \
383 printk(fmt ,##args)
384#endif
385 363
386/** 364/**
387 * snd_BUG - give a BUG warning message and stack trace 365 * snd_BUG - give a BUG warning message and stack trace
@@ -428,9 +406,10 @@ static inline int __snd_bug_on(int cond)
428 * Works like snd_printk() for debugging purposes. 406 * Works like snd_printk() for debugging purposes.
429 * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. 407 * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set.
430 */ 408 */
431#define snd_printdd(format, args...) snd_printk(format, ##args) 409#define snd_printdd(format, args...) \
410 __snd_printk(2, __FILE__, __LINE__, format, ##args)
432#else 411#else
433#define snd_printdd(format, args...) /* nothing */ 412#define snd_printdd(format, args...) do { } while (0)
434#endif 413#endif
435 414
436 415
@@ -438,12 +417,10 @@ static inline int __snd_bug_on(int cond)
438 417
439/* for easier backward-porting */ 418/* for easier backward-porting */
440#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE) 419#if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
441#ifndef gameport_set_dev_parent
442#define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) 420#define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev))
443#define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) 421#define gameport_set_port_data(gp,r) ((gp)->port_data = (r))
444#define gameport_get_port_data(gp) (gp)->port_data 422#define gameport_get_port_data(gp) (gp)->port_data
445#endif 423#endif
446#endif
447 424
448/* PCI quirk list helper */ 425/* PCI quirk list helper */
449struct snd_pci_quirk { 426struct snd_pci_quirk {
diff --git a/include/sound/info.h b/include/sound/info.h
index 7c2ee1a21b00..112e8949e1a7 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -110,13 +110,13 @@ void snd_card_info_read_oss(struct snd_info_buffer *buffer);
110static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {} 110static inline void snd_card_info_read_oss(struct snd_info_buffer *buffer) {}
111#endif 111#endif
112 112
113int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) \ 113int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \
114 __attribute__ ((format (printf, 2, 3))); 114 __attribute__ ((format (printf, 2, 3)));
115int snd_info_init(void); 115int snd_info_init(void);
116int snd_info_done(void); 116int snd_info_done(void);
117 117
118int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len); 118int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len);
119char *snd_info_get_str(char *dest, char *src, int len); 119const char *snd_info_get_str(char *dest, const char *src, int len);
120struct snd_info_entry *snd_info_create_module_entry(struct module *module, 120struct snd_info_entry *snd_info_create_module_entry(struct module *module,
121 const char *name, 121 const char *name,
122 struct snd_info_entry *parent); 122 struct snd_info_entry *parent);
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index 7ccce94a5255..c42506212649 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -47,7 +47,11 @@ struct snd_dma_device {
47#define SNDRV_DMA_TYPE_UNKNOWN 0 /* not defined */ 47#define SNDRV_DMA_TYPE_UNKNOWN 0 /* not defined */
48#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ 48#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */
49#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ 49#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */
50#ifdef CONFIG_SND_DMA_SGBUF
50#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ 51#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */
52#else
53#define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */
54#endif
51 55
52/* 56/*
53 * info for buffer allocation 57 * info for buffer allocation
@@ -60,6 +64,7 @@ struct snd_dma_buffer {
60 void *private_data; /* private for allocator; don't touch */ 64 void *private_data; /* private for allocator; don't touch */
61}; 65};
62 66
67#ifdef CONFIG_SND_DMA_SGBUF
63/* 68/*
64 * Scatter-Gather generic device pages 69 * Scatter-Gather generic device pages
65 */ 70 */
@@ -107,6 +112,7 @@ static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset)
107{ 112{
108 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; 113 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
109} 114}
115#endif /* CONFIG_SND_DMA_SGBUF */
110 116
111/* allocate/release a buffer */ 117/* allocate/release a buffer */
112int snd_dma_alloc_pages(int type, struct device *dev, size_t size, 118int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 23893523dc8c..de6d981de5d6 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -902,6 +902,7 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
902int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 902int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
903int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 903int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
904 904
905#ifdef CONFIG_SND_DMA_SGBUF
905/* 906/*
906 * SG-buffer handling 907 * SG-buffer handling
907 */ 908 */
@@ -927,6 +928,28 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
927unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 928unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
928 unsigned int ofs, unsigned int size); 929 unsigned int ofs, unsigned int size);
929 930
931#else /* !SND_DMA_SGBUF */
932/*
933 * fake using a continuous buffer
934 */
935static inline dma_addr_t
936snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
937{
938 return substream->runtime->dma_addr + ofs;
939}
940
941static inline void *
942snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
943{
944 return substream->runtime->dma_area + ofs;
945}
946
947#define snd_pcm_sgbuf_ops_page NULL
948
949#define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size)
950
951#endif /* SND_DMA_SGBUF */
952
930/* handle mmap counter - PCM mmap callback should handle this counter properly */ 953/* handle mmap counter - PCM mmap callback should handle this counter properly */
931static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 954static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
932{ 955{
@@ -965,4 +988,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
965 988
966#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) 989#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
967 990
991const char *snd_pcm_format_name(snd_pcm_format_t format);
992
968#endif /* __SOUND_PCM_H */ 993#endif /* __SOUND_PCM_H */
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
new file mode 100644
index 000000000000..c0227361a876
--- /dev/null
+++ b/include/sound/sh_fsi.h
@@ -0,0 +1,83 @@
1#ifndef __SOUND_FSI_H
2#define __SOUND_FSI_H
3
4/*
5 * Fifo-attached Serial Interface (FSI) support for SH7724
6 *
7 * Copyright (C) 2009 Renesas Solutions Corp.
8 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15/* flags format
16
17 * 0xABCDEEFF
18 *
19 * A: channel size for TDM (input)
20 * B: channel size for TDM (ooutput)
21 * C: inversion
22 * D: mode
23 * E: input format
24 * F: output format
25 */
26
27#include <linux/clk.h>
28#include <sound/soc.h>
29
30/* TDM channel */
31#define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28)
32#define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24)
33
34#define SH_FSI_CH_IMASK 0xF0000000
35#define SH_FSI_CH_OMASK 0x0F000000
36#define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28)
37#define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24)
38
39/* clock inversion */
40#define SH_FSI_INVERSION_MASK 0x00F00000
41#define SH_FSI_LRM_INV (1 << 20)
42#define SH_FSI_BRM_INV (1 << 21)
43#define SH_FSI_LRS_INV (1 << 22)
44#define SH_FSI_BRS_INV (1 << 23)
45
46/* mode */
47#define SH_FSI_MODE_MASK 0x000F0000
48#define SH_FSI_IN_SLAVE_MODE (1 << 16) /* default master mode */
49#define SH_FSI_OUT_SLAVE_MODE (1 << 17) /* default master mode */
50
51/* DI format */
52#define SH_FSI_FMT_MASK 0x000000FF
53#define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8)
54#define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0)
55#define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK)
56#define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK)
57
58#define SH_FSI_FMT_MONO (1 << 0)
59#define SH_FSI_FMT_MONO_DELAY (1 << 1)
60#define SH_FSI_FMT_PCM (1 << 2)
61#define SH_FSI_FMT_I2S (1 << 3)
62#define SH_FSI_FMT_TDM (1 << 4)
63#define SH_FSI_FMT_TDM_DELAY (1 << 5)
64
65#define SH_FSI_IFMT_TDM_CH(x) \
66 (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x))
67#define SH_FSI_IFMT_TDM_DELAY_CH(x) \
68 (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x))
69
70#define SH_FSI_OFMT_TDM_CH(x) \
71 (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x))
72#define SH_FSI_OFMT_TDM_DELAY_CH(x) \
73 (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x))
74
75struct sh_fsi_platform_info {
76 unsigned long porta_flags;
77 unsigned long portb_flags;
78};
79
80extern struct snd_soc_dai fsi_soc_dai[2];
81extern struct snd_soc_platform fsi_soc_platform;
82
83#endif /* __SOUND_FSI_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 352d7eee9b6d..97ca9af414dc 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -27,8 +27,8 @@ struct snd_pcm_substream;
27#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */ 27#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
28#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */ 28#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right Justified mode */
29#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */ 29#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
30#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM LRC */ 30#define SND_SOC_DAIFMT_DSP_A 3 /* L data MSB after FRM LRC */
31#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM LRC */ 31#define SND_SOC_DAIFMT_DSP_B 4 /* L data MSB during FRM LRC */
32#define SND_SOC_DAIFMT_AC97 5 /* AC97 */ 32#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
33 33
34/* left and right justified also known as MSB and LSB respectively */ 34/* left and right justified also known as MSB and LSB respectively */
@@ -38,7 +38,7 @@ struct snd_pcm_substream;
38/* 38/*
39 * DAI Clock gating. 39 * DAI Clock gating.
40 * 40 *
41 * DAI bit clocks can be be gated (disabled) when not the DAI is not 41 * DAI bit clocks can be be gated (disabled) when the DAI is not
42 * sending or receiving PCM data in a frame. This can be used to save power. 42 * sending or receiving PCM data in a frame. This can be used to save power.
43 */ 43 */
44#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */ 44#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
@@ -51,21 +51,21 @@ struct snd_pcm_substream;
51 * format. 51 * format.
52 */ 52 */
53#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ 53#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
54#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ 54#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal BCLK + inv FRM */
55#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ 55#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert BCLK + nor FRM */
56#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ 56#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert BCLK + FRM */
57 57
58/* 58/*
59 * DAI hardware clock masters. 59 * DAI hardware clock masters.
60 * 60 *
61 * This is wrt the codec, the inverse is true for the interface 61 * This is wrt the codec, the inverse is true for the interface
62 * i.e. if the codec is clk and frm master then the interface is 62 * i.e. if the codec is clk and FRM master then the interface is
63 * clk and frame slave. 63 * clk and frame slave.
64 */ 64 */
65#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */ 65#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & FRM master */
66#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */ 66#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & FRM master */
67#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */ 67#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
68#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */ 68#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & FRM slave */
69 69
70#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f 70#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
71#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 71#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
@@ -78,7 +78,13 @@ struct snd_pcm_substream;
78#define SND_SOC_CLOCK_IN 0 78#define SND_SOC_CLOCK_IN 0
79#define SND_SOC_CLOCK_OUT 1 79#define SND_SOC_CLOCK_OUT 1
80 80
81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\ 81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S8 |\
82 SNDRV_PCM_FMTBIT_S16_LE |\
83 SNDRV_PCM_FMTBIT_S16_BE |\
84 SNDRV_PCM_FMTBIT_S20_3LE |\
85 SNDRV_PCM_FMTBIT_S20_3BE |\
86 SNDRV_PCM_FMTBIT_S24_3LE |\
87 SNDRV_PCM_FMTBIT_S24_3BE |\
82 SNDRV_PCM_FMTBIT_S32_LE |\ 88 SNDRV_PCM_FMTBIT_S32_LE |\
83 SNDRV_PCM_FMTBIT_S32_BE) 89 SNDRV_PCM_FMTBIT_S32_BE)
84 90
@@ -106,7 +112,7 @@ int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
106int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); 112int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
107 113
108int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 114int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
109 unsigned int mask, int slots); 115 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width);
110 116
111int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 117int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
112 118
@@ -116,12 +122,12 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
116/* 122/*
117 * Digital Audio Interface. 123 * Digital Audio Interface.
118 * 124 *
119 * Describes the Digital Audio Interface in terms of it's ALSA, DAI and AC97 125 * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97
120 * operations an capabilities. Codec and platfom drivers will register a this 126 * operations and capabilities. Codec and platform drivers will register this
121 * structure for every DAI they have. 127 * structure for every DAI they have.
122 * 128 *
123 * This structure covers the clocking, formating and ALSA operations for each 129 * This structure covers the clocking, formating and ALSA operations for each
124 * interface a 130 * interface.
125 */ 131 */
126struct snd_soc_dai_ops { 132struct snd_soc_dai_ops {
127 /* 133 /*
@@ -140,7 +146,8 @@ struct snd_soc_dai_ops {
140 */ 146 */
141 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); 147 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
142 int (*set_tdm_slot)(struct snd_soc_dai *dai, 148 int (*set_tdm_slot)(struct snd_soc_dai *dai,
143 unsigned int mask, int slots); 149 unsigned int tx_mask, unsigned int rx_mask,
150 int slots, int slot_width);
144 int (*set_tristate)(struct snd_soc_dai *dai, int tristate); 151 int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
145 152
146 /* 153 /*
@@ -179,6 +186,7 @@ struct snd_soc_dai {
179 int ac97_control; 186 int ac97_control;
180 187
181 struct device *dev; 188 struct device *dev;
189 void *ac97_pdata; /* platform_data for the ac97 codec */
182 190
183 /* DAI callbacks */ 191 /* DAI callbacks */
184 int (*probe)(struct platform_device *pdev, 192 int (*probe)(struct platform_device *pdev,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ec8a45f9a069..c1410e3191e3 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -137,6 +137,12 @@
137 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} 137 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
138 138
139/* stream domain */ 139/* stream domain */
140#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \
141{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
142 .reg = wreg, .shift = wshift, .invert = winvert }
143#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
144{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
145 .reg = wreg, .shift = wshift, .invert = winvert }
140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 146#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 147{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
142 .shift = wshift, .invert = winvert} 148 .shift = wshift, .invert = winvert}
@@ -279,9 +285,11 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
279/* dapm events */ 285/* dapm events */
280int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 286int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
281 int event); 287 int event);
288void snd_soc_dapm_shutdown(struct snd_soc_device *socdev);
282 289
283/* dapm sys fs - used by the core */ 290/* dapm sys fs - used by the core */
284int snd_soc_dapm_sys_add(struct device *dev); 291int snd_soc_dapm_sys_add(struct device *dev);
292void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec);
285 293
286/* dapm audio pin control and status */ 294/* dapm audio pin control and status */
287int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); 295int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
@@ -311,6 +319,8 @@ enum snd_soc_dapm_type {
311 snd_soc_dapm_pre, /* machine specific pre widget - exec first */ 319 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
312 snd_soc_dapm_post, /* machine specific post widget - exec last */ 320 snd_soc_dapm_post, /* machine specific post widget - exec last */
313 snd_soc_dapm_supply, /* power/clock supply */ 321 snd_soc_dapm_supply, /* power/clock supply */
322 snd_soc_dapm_aif_in, /* audio interface input */
323 snd_soc_dapm_aif_out, /* audio interface output */
314}; 324};
315 325
316/* 326/*
diff --git a/include/sound/soc.h b/include/sound/soc.h
index cf6111d72b17..475cb7ed6bec 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -135,6 +135,28 @@
135 .info = snd_soc_info_volsw, \ 135 .info = snd_soc_info_volsw, \
136 .get = xhandler_get, .put = xhandler_put, \ 136 .get = xhandler_get, .put = xhandler_put, \
137 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 137 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
138#define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
139 xhandler_get, xhandler_put, tlv_array) \
140{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
141 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
142 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
143 .tlv.p = (tlv_array), \
144 .info = snd_soc_info_volsw, \
145 .get = xhandler_get, .put = xhandler_put, \
146 .private_value = (unsigned long)&(struct soc_mixer_control) \
147 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
148 .max = xmax, .invert = xinvert} }
149#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
150 xhandler_get, xhandler_put, tlv_array) \
151{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
152 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
153 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
154 .tlv.p = (tlv_array), \
155 .info = snd_soc_info_volsw_2r, \
156 .get = xhandler_get, .put = xhandler_put, \
157 .private_value = (unsigned long)&(struct soc_mixer_control) \
158 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
159 .max = xmax, .invert = xinvert} }
138#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 160#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
139{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 161{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
140 .info = snd_soc_info_bool_ext, \ 162 .info = snd_soc_info_bool_ext, \
@@ -183,14 +205,28 @@ struct snd_soc_jack_gpio;
183#endif 205#endif
184 206
185typedef int (*hw_write_t)(void *,const char* ,int); 207typedef int (*hw_write_t)(void *,const char* ,int);
186typedef int (*hw_read_t)(void *,char* ,int);
187 208
188extern struct snd_ac97_bus_ops soc_ac97_ops; 209extern struct snd_ac97_bus_ops soc_ac97_ops;
189 210
211enum snd_soc_control_type {
212 SND_SOC_CUSTOM,
213 SND_SOC_I2C,
214 SND_SOC_SPI,
215};
216
190int snd_soc_register_platform(struct snd_soc_platform *platform); 217int snd_soc_register_platform(struct snd_soc_platform *platform);
191void snd_soc_unregister_platform(struct snd_soc_platform *platform); 218void snd_soc_unregister_platform(struct snd_soc_platform *platform);
192int snd_soc_register_codec(struct snd_soc_codec *codec); 219int snd_soc_register_codec(struct snd_soc_codec *codec);
193void snd_soc_unregister_codec(struct snd_soc_codec *codec); 220void snd_soc_unregister_codec(struct snd_soc_codec *codec);
221int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
222int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
223 int addr_bits, int data_bits,
224 enum snd_soc_control_type control);
225
226#ifdef CONFIG_PM
227int snd_soc_suspend_device(struct device *dev);
228int snd_soc_resume_device(struct device *dev);
229#endif
194 230
195/* pcm <-> DAI connect */ 231/* pcm <-> DAI connect */
196void snd_soc_free_pcms(struct snd_soc_device *socdev); 232void snd_soc_free_pcms(struct snd_soc_device *socdev);
@@ -216,9 +252,9 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
216 252
217/* codec register bit access */ 253/* codec register bit access */
218int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 254int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
219 unsigned short mask, unsigned short value); 255 unsigned int mask, unsigned int value);
220int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 256int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
221 unsigned short mask, unsigned short value); 257 unsigned int mask, unsigned int value);
222 258
223int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 259int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
224 struct snd_ac97_bus_ops *ops, int num); 260 struct snd_ac97_bus_ops *ops, int num);
@@ -356,8 +392,10 @@ struct snd_soc_codec {
356 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 392 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
357 int (*display_register)(struct snd_soc_codec *, char *, 393 int (*display_register)(struct snd_soc_codec *, char *,
358 size_t, unsigned int); 394 size_t, unsigned int);
395 int (*volatile_register)(unsigned int);
396 int (*readable_register)(unsigned int);
359 hw_write_t hw_write; 397 hw_write_t hw_write;
360 hw_read_t hw_read; 398 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
361 void *reg_cache; 399 void *reg_cache;
362 short reg_cache_size; 400 short reg_cache_size;
363 short reg_cache_step; 401 short reg_cache_step;
@@ -369,8 +407,6 @@ struct snd_soc_codec {
369 enum snd_soc_bias_level bias_level; 407 enum snd_soc_bias_level bias_level;
370 enum snd_soc_bias_level suspend_bias_level; 408 enum snd_soc_bias_level suspend_bias_level;
371 struct delayed_work delayed_work; 409 struct delayed_work delayed_work;
372 struct list_head up_list;
373 struct list_head down_list;
374 410
375 /* codec DAI's */ 411 /* codec DAI's */
376 struct snd_soc_dai *dai; 412 struct snd_soc_dai *dai;
@@ -379,6 +415,7 @@ struct snd_soc_codec {
379#ifdef CONFIG_DEBUG_FS 415#ifdef CONFIG_DEBUG_FS
380 struct dentry *debugfs_reg; 416 struct dentry *debugfs_reg;
381 struct dentry *debugfs_pop_time; 417 struct dentry *debugfs_pop_time;
418 struct dentry *debugfs_dapm;
382#endif 419#endif
383}; 420};
384 421
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index d136ea2181ed..9fd5b19ccf5c 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -35,6 +35,8 @@
35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ 35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ 36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
37#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ 37#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
38#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
39#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
38 40
39#define TLV_DB_SCALE_ITEM(min, step, mute) \ 41#define TLV_DB_SCALE_ITEM(min, step, mute) \
40 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \ 42 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
@@ -42,6 +44,18 @@
42#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ 44#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
43 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) } 45 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
44 46
47/* dB scale specified with min/max values instead of step */
48#define TLV_DB_MINMAX_ITEM(min_dB, max_dB) \
49 SNDRV_CTL_TLVT_DB_MINMAX, 2 * sizeof(unsigned int), \
50 (min_dB), (max_dB)
51#define TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
52 SNDRV_CTL_TLVT_DB_MINMAX_MUTE, 2 * sizeof(unsigned int), \
53 (min_dB), (max_dB)
54#define DECLARE_TLV_DB_MINMAX(name, min_dB, max_dB) \
55 unsigned int name[] = { TLV_DB_MINMAX_ITEM(min_dB, max_dB) }
56#define DECLARE_TLV_DB_MINMAX_MUTE(name, min_dB, max_dB) \
57 unsigned int name[] = { TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) }
58
45/* linear volume between min_dB and max_dB (.01dB unit) */ 59/* linear volume between min_dB and max_dB (.01dB unit) */
46#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \ 60#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \
47 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ 61 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
diff --git a/include/sound/uda1380.h b/include/sound/uda1380.h
new file mode 100644
index 000000000000..381319c7000c
--- /dev/null
+++ b/include/sound/uda1380.h
@@ -0,0 +1,22 @@
1/*
2 * UDA1380 ALSA SoC Codec driver
3 *
4 * Copyright 2009 Philipp Zabel
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 __UDA1380_H
12#define __UDA1380_H
13
14struct uda1380_platform_data {
15 int gpio_power;
16 int gpio_reset;
17 int dac_clk;
18#define UDA1380_DAC_CLK_SYSCLK 0
19#define UDA1380_DAC_CLK_WSPLL 1
20};
21
22#endif /* __UDA1380_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index 456f1359e1c0..22939142dd23 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.20" 2#define CONFIG_SND_VERSION "1.0.21"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h
new file mode 100644
index 000000000000..9c661f2f8cda
--- /dev/null
+++ b/include/sound/wm8993.h
@@ -0,0 +1,44 @@
1/*
2 * linux/sound/wm8993.h -- Platform data for WM8993
3 *
4 * Copyright 2009 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_WM8993_H
12#define __LINUX_SND_WM8993_H
13
14/* Note that EQ1 only contains the enable/disable bit so will be
15 ignored but is included for simplicity.
16 */
17struct wm8993_retune_mobile_setting {
18 const char *name;
19 unsigned int rate;
20 u16 config[24];
21};
22
23struct wm8993_platform_data {
24 struct wm8993_retune_mobile_setting *retune_configs;
25 int num_retune_configs;
26
27 /* LINEOUT can be differential or single ended */
28 unsigned int lineout1_diff:1;
29 unsigned int lineout2_diff:1;
30
31 /* Common mode feedback */
32 unsigned int lineout1fb:1;
33 unsigned int lineout2fb:1;
34
35 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
36 unsigned int micbias1_lvl:1;
37 unsigned int micbias2_lvl:1;
38
39 /* Jack detect threashold levels, see datasheet for values */
40 unsigned int jd_scthr:2;
41 unsigned int jd_thr:2;
42};
43
44#endif
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 05ead6698434..444cd6ba0ba7 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -331,6 +331,7 @@ struct snd_ymfpci {
331 struct snd_ac97 *ac97; 331 struct snd_ac97 *ac97;
332 struct snd_rawmidi *rawmidi; 332 struct snd_rawmidi *rawmidi;
333 struct snd_timer *timer; 333 struct snd_timer *timer;
334 unsigned int timer_ticks;
334 335
335 struct pci_dev *pci; 336 struct pci_dev *pci;
336 struct snd_card *card; 337 struct snd_card *card;
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index f7a7ae1e8f90..2a4b3bf74033 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -26,6 +26,11 @@
26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ 26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
27 DEFINE_TRACE(name) 27 DEFINE_TRACE(name)
28 28
29#undef TRACE_EVENT_FN
30#define TRACE_EVENT_FN(name, proto, args, tstruct, \
31 assign, print, reg, unreg) \
32 DEFINE_TRACE_FN(name, reg, unreg)
33
29#undef DECLARE_TRACE 34#undef DECLARE_TRACE
30#define DECLARE_TRACE(name, proto, args) \ 35#define DECLARE_TRACE(name, proto, args) \
31 DEFINE_TRACE(name) 36 DEFINE_TRACE(name)
@@ -56,6 +61,8 @@
56#include <trace/ftrace.h> 61#include <trace/ftrace.h>
57#endif 62#endif
58 63
64#undef TRACE_EVENT
65#undef TRACE_EVENT_FN
59#undef TRACE_HEADER_MULTI_READ 66#undef TRACE_HEADER_MULTI_READ
60 67
61/* Only undef what we defined in this file */ 68/* Only undef what we defined in this file */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 9a74b468a229..00405b5f624a 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -171,6 +171,7 @@ TRACE_EVENT(block_rq_complete,
171 (unsigned long long)__entry->sector, 171 (unsigned long long)__entry->sector,
172 __entry->nr_sector, __entry->errors) 172 __entry->nr_sector, __entry->errors)
173); 173);
174
174TRACE_EVENT(block_bio_bounce, 175TRACE_EVENT(block_bio_bounce,
175 176
176 TP_PROTO(struct request_queue *q, struct bio *bio), 177 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -186,7 +187,8 @@ TRACE_EVENT(block_bio_bounce,
186 ), 187 ),
187 188
188 TP_fast_assign( 189 TP_fast_assign(
189 __entry->dev = bio->bi_bdev->bd_dev; 190 __entry->dev = bio->bi_bdev ?
191 bio->bi_bdev->bd_dev : 0;
190 __entry->sector = bio->bi_sector; 192 __entry->sector = bio->bi_sector;
191 __entry->nr_sector = bio->bi_size >> 9; 193 __entry->nr_sector = bio->bi_size >> 9;
192 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 194 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
@@ -486,6 +488,39 @@ TRACE_EVENT(block_remap,
486 (unsigned long long)__entry->old_sector) 488 (unsigned long long)__entry->old_sector)
487); 489);
488 490
491TRACE_EVENT(block_rq_remap,
492
493 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
494 sector_t from),
495
496 TP_ARGS(q, rq, dev, from),
497
498 TP_STRUCT__entry(
499 __field( dev_t, dev )
500 __field( sector_t, sector )
501 __field( unsigned int, nr_sector )
502 __field( dev_t, old_dev )
503 __field( sector_t, old_sector )
504 __array( char, rwbs, 6 )
505 ),
506
507 TP_fast_assign(
508 __entry->dev = disk_devt(rq->rq_disk);
509 __entry->sector = blk_rq_pos(rq);
510 __entry->nr_sector = blk_rq_sectors(rq);
511 __entry->old_dev = dev;
512 __entry->old_sector = from;
513 blk_fill_rwbs_rq(__entry->rwbs, rq);
514 ),
515
516 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
517 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
518 (unsigned long long)__entry->sector,
519 __entry->nr_sector,
520 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
521 (unsigned long long)__entry->old_sector)
522);
523
489#endif /* _TRACE_BLOCK_H */ 524#endif /* _TRACE_BLOCK_H */
490 525
491/* This part must be outside protection */ 526/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 7d8b5bc74185..d09550bf3f95 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -5,10 +5,16 @@
5#define _TRACE_EXT4_H 5#define _TRACE_EXT4_H
6 6
7#include <linux/writeback.h> 7#include <linux/writeback.h>
8#include "../../../fs/ext4/ext4.h"
9#include "../../../fs/ext4/mballoc.h"
10#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
11 9
10struct ext4_allocation_context;
11struct ext4_allocation_request;
12struct ext4_prealloc_space;
13struct ext4_inode_info;
14struct mpage_da_data;
15
16#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
17
12TRACE_EVENT(ext4_free_inode, 18TRACE_EVENT(ext4_free_inode,
13 TP_PROTO(struct inode *inode), 19 TP_PROTO(struct inode *inode),
14 20
@@ -33,8 +39,8 @@ TRACE_EVENT(ext4_free_inode,
33 ), 39 ),
34 40
35 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", 41 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu",
36 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->mode, 42 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
37 __entry->uid, __entry->gid, 43 __entry->mode, __entry->uid, __entry->gid,
38 (unsigned long long) __entry->blocks) 44 (unsigned long long) __entry->blocks)
39); 45);
40 46
@@ -56,7 +62,8 @@ TRACE_EVENT(ext4_request_inode,
56 ), 62 ),
57 63
58 TP_printk("dev %s dir %lu mode %d", 64 TP_printk("dev %s dir %lu mode %d",
59 jbd2_dev_to_name(__entry->dev), __entry->dir, __entry->mode) 65 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir,
66 __entry->mode)
60); 67);
61 68
62TRACE_EVENT(ext4_allocate_inode, 69TRACE_EVENT(ext4_allocate_inode,
@@ -79,7 +86,8 @@ TRACE_EVENT(ext4_allocate_inode,
79 ), 86 ),
80 87
81 TP_printk("dev %s ino %lu dir %lu mode %d", 88 TP_printk("dev %s ino %lu dir %lu mode %d",
82 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->dir, __entry->mode) 89 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
90 (unsigned long) __entry->dir, __entry->mode)
83); 91);
84 92
85TRACE_EVENT(ext4_write_begin, 93TRACE_EVENT(ext4_write_begin,
@@ -106,8 +114,8 @@ TRACE_EVENT(ext4_write_begin,
106 ), 114 ),
107 115
108 TP_printk("dev %s ino %lu pos %llu len %u flags %u", 116 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
109 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 117 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
110 __entry->flags) 118 __entry->pos, __entry->len, __entry->flags)
111); 119);
112 120
113TRACE_EVENT(ext4_ordered_write_end, 121TRACE_EVENT(ext4_ordered_write_end,
@@ -133,8 +141,8 @@ TRACE_EVENT(ext4_ordered_write_end,
133 ), 141 ),
134 142
135 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 143 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
136 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 144 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
137 __entry->copied) 145 __entry->pos, __entry->len, __entry->copied)
138); 146);
139 147
140TRACE_EVENT(ext4_writeback_write_end, 148TRACE_EVENT(ext4_writeback_write_end,
@@ -160,8 +168,8 @@ TRACE_EVENT(ext4_writeback_write_end,
160 ), 168 ),
161 169
162 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 170 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
163 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 171 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
164 __entry->copied) 172 __entry->pos, __entry->len, __entry->copied)
165); 173);
166 174
167TRACE_EVENT(ext4_journalled_write_end, 175TRACE_EVENT(ext4_journalled_write_end,
@@ -186,8 +194,8 @@ TRACE_EVENT(ext4_journalled_write_end,
186 ), 194 ),
187 195
188 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 196 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
189 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 197 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
190 __entry->copied) 198 __entry->pos, __entry->len, __entry->copied)
191); 199);
192 200
193TRACE_EVENT(ext4_writepage, 201TRACE_EVENT(ext4_writepage,
@@ -209,7 +217,8 @@ TRACE_EVENT(ext4_writepage,
209 ), 217 ),
210 218
211 TP_printk("dev %s ino %lu page_index %lu", 219 TP_printk("dev %s ino %lu page_index %lu",
212 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index) 220 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
221 __entry->index)
213); 222);
214 223
215TRACE_EVENT(ext4_da_writepages, 224TRACE_EVENT(ext4_da_writepages,
@@ -227,8 +236,8 @@ TRACE_EVENT(ext4_da_writepages,
227 __field( char, nonblocking ) 236 __field( char, nonblocking )
228 __field( char, for_kupdate ) 237 __field( char, for_kupdate )
229 __field( char, for_reclaim ) 238 __field( char, for_reclaim )
230 __field( char, for_writepages )
231 __field( char, range_cyclic ) 239 __field( char, range_cyclic )
240 __field( pgoff_t, writeback_index )
232 ), 241 ),
233 242
234 TP_fast_assign( 243 TP_fast_assign(
@@ -241,16 +250,52 @@ TRACE_EVENT(ext4_da_writepages,
241 __entry->nonblocking = wbc->nonblocking; 250 __entry->nonblocking = wbc->nonblocking;
242 __entry->for_kupdate = wbc->for_kupdate; 251 __entry->for_kupdate = wbc->for_kupdate;
243 __entry->for_reclaim = wbc->for_reclaim; 252 __entry->for_reclaim = wbc->for_reclaim;
244 __entry->for_writepages = wbc->for_writepages;
245 __entry->range_cyclic = wbc->range_cyclic; 253 __entry->range_cyclic = wbc->range_cyclic;
254 __entry->writeback_index = inode->i_mapping->writeback_index;
246 ), 255 ),
247 256
248 TP_printk("dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d", 257 TP_printk("dev %s ino %lu nr_to_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d range_cyclic %d writeback_index %lu",
249 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->nr_to_write, 258 jbd2_dev_to_name(__entry->dev),
259 (unsigned long) __entry->ino, __entry->nr_to_write,
250 __entry->pages_skipped, __entry->range_start, 260 __entry->pages_skipped, __entry->range_start,
251 __entry->range_end, __entry->nonblocking, 261 __entry->range_end, __entry->nonblocking,
252 __entry->for_kupdate, __entry->for_reclaim, 262 __entry->for_kupdate, __entry->for_reclaim,
253 __entry->for_writepages, __entry->range_cyclic) 263 __entry->range_cyclic,
264 (unsigned long) __entry->writeback_index)
265);
266
267TRACE_EVENT(ext4_da_write_pages,
268 TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
269
270 TP_ARGS(inode, mpd),
271
272 TP_STRUCT__entry(
273 __field( dev_t, dev )
274 __field( ino_t, ino )
275 __field( __u64, b_blocknr )
276 __field( __u32, b_size )
277 __field( __u32, b_state )
278 __field( unsigned long, first_page )
279 __field( int, io_done )
280 __field( int, pages_written )
281 ),
282
283 TP_fast_assign(
284 __entry->dev = inode->i_sb->s_dev;
285 __entry->ino = inode->i_ino;
286 __entry->b_blocknr = mpd->b_blocknr;
287 __entry->b_size = mpd->b_size;
288 __entry->b_state = mpd->b_state;
289 __entry->first_page = mpd->first_page;
290 __entry->io_done = mpd->io_done;
291 __entry->pages_written = mpd->pages_written;
292 ),
293
294 TP_printk("dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d",
295 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
296 __entry->b_blocknr, __entry->b_size,
297 __entry->b_state, __entry->first_page,
298 __entry->io_done, __entry->pages_written)
254); 299);
255 300
256TRACE_EVENT(ext4_da_writepages_result, 301TRACE_EVENT(ext4_da_writepages_result,
@@ -268,6 +313,7 @@ TRACE_EVENT(ext4_da_writepages_result,
268 __field( char, encountered_congestion ) 313 __field( char, encountered_congestion )
269 __field( char, more_io ) 314 __field( char, more_io )
270 __field( char, no_nrwrite_index_update ) 315 __field( char, no_nrwrite_index_update )
316 __field( pgoff_t, writeback_index )
271 ), 317 ),
272 318
273 TP_fast_assign( 319 TP_fast_assign(
@@ -279,13 +325,16 @@ TRACE_EVENT(ext4_da_writepages_result,
279 __entry->encountered_congestion = wbc->encountered_congestion; 325 __entry->encountered_congestion = wbc->encountered_congestion;
280 __entry->more_io = wbc->more_io; 326 __entry->more_io = wbc->more_io;
281 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; 327 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
328 __entry->writeback_index = inode->i_mapping->writeback_index;
282 ), 329 ),
283 330
284 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d", 331 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d writeback_index %lu",
285 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->ret, 332 jbd2_dev_to_name(__entry->dev),
333 (unsigned long) __entry->ino, __entry->ret,
286 __entry->pages_written, __entry->pages_skipped, 334 __entry->pages_written, __entry->pages_skipped,
287 __entry->encountered_congestion, __entry->more_io, 335 __entry->encountered_congestion, __entry->more_io,
288 __entry->no_nrwrite_index_update) 336 __entry->no_nrwrite_index_update,
337 (unsigned long) __entry->writeback_index)
289); 338);
290 339
291TRACE_EVENT(ext4_da_write_begin, 340TRACE_EVENT(ext4_da_write_begin,
@@ -311,8 +360,8 @@ TRACE_EVENT(ext4_da_write_begin,
311 ), 360 ),
312 361
313 TP_printk("dev %s ino %lu pos %llu len %u flags %u", 362 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
314 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 363 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
315 __entry->flags) 364 __entry->pos, __entry->len, __entry->flags)
316); 365);
317 366
318TRACE_EVENT(ext4_da_write_end, 367TRACE_EVENT(ext4_da_write_end,
@@ -338,8 +387,8 @@ TRACE_EVENT(ext4_da_write_end,
338 ), 387 ),
339 388
340 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 389 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
341 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 390 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
342 __entry->copied) 391 __entry->pos, __entry->len, __entry->copied)
343); 392);
344 393
345TRACE_EVENT(ext4_discard_blocks, 394TRACE_EVENT(ext4_discard_blocks,
@@ -389,8 +438,8 @@ TRACE_EVENT(ext4_mb_new_inode_pa,
389 ), 438 ),
390 439
391 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", 440 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
392 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, 441 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
393 __entry->pa_len, __entry->pa_lstart) 442 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
394); 443);
395 444
396TRACE_EVENT(ext4_mb_new_group_pa, 445TRACE_EVENT(ext4_mb_new_group_pa,
@@ -417,8 +466,8 @@ TRACE_EVENT(ext4_mb_new_group_pa,
417 ), 466 ),
418 467
419 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", 468 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
420 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, 469 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
421 __entry->pa_len, __entry->pa_lstart) 470 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
422); 471);
423 472
424TRACE_EVENT(ext4_mb_release_inode_pa, 473TRACE_EVENT(ext4_mb_release_inode_pa,
@@ -444,8 +493,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
444 ), 493 ),
445 494
446 TP_printk("dev %s ino %lu block %llu count %u", 495 TP_printk("dev %s ino %lu block %llu count %u",
447 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, 496 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
448 __entry->count) 497 __entry->block, __entry->count)
449); 498);
450 499
451TRACE_EVENT(ext4_mb_release_group_pa, 500TRACE_EVENT(ext4_mb_release_group_pa,
@@ -490,7 +539,7 @@ TRACE_EVENT(ext4_discard_preallocations,
490 ), 539 ),
491 540
492 TP_printk("dev %s ino %lu", 541 TP_printk("dev %s ino %lu",
493 jbd2_dev_to_name(__entry->dev), __entry->ino) 542 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
494); 543);
495 544
496TRACE_EVENT(ext4_mb_discard_preallocations, 545TRACE_EVENT(ext4_mb_discard_preallocations,
@@ -545,8 +594,8 @@ TRACE_EVENT(ext4_request_blocks,
545 ), 594 ),
546 595
547 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 596 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
548 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, 597 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
549 __entry->len, 598 __entry->flags, __entry->len,
550 (unsigned long long) __entry->logical, 599 (unsigned long long) __entry->logical,
551 (unsigned long long) __entry->goal, 600 (unsigned long long) __entry->goal,
552 (unsigned long long) __entry->lleft, 601 (unsigned long long) __entry->lleft,
@@ -589,8 +638,8 @@ TRACE_EVENT(ext4_allocate_blocks,
589 ), 638 ),
590 639
591 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 640 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
592 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, 641 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
593 __entry->len, __entry->block, 642 __entry->flags, __entry->len, __entry->block,
594 (unsigned long long) __entry->logical, 643 (unsigned long long) __entry->logical,
595 (unsigned long long) __entry->goal, 644 (unsigned long long) __entry->goal,
596 (unsigned long long) __entry->lleft, 645 (unsigned long long) __entry->lleft,
@@ -623,8 +672,8 @@ TRACE_EVENT(ext4_free_blocks,
623 ), 672 ),
624 673
625 TP_printk("dev %s ino %lu block %llu count %lu metadata %d", 674 TP_printk("dev %s ino %lu block %llu count %lu metadata %d",
626 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, 675 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
627 __entry->count, __entry->metadata) 676 __entry->block, __entry->count, __entry->metadata)
628); 677);
629 678
630TRACE_EVENT(ext4_sync_file, 679TRACE_EVENT(ext4_sync_file,
@@ -647,8 +696,8 @@ TRACE_EVENT(ext4_sync_file,
647 ), 696 ),
648 697
649 TP_printk("dev %s ino %ld parent %ld datasync %d ", 698 TP_printk("dev %s ino %ld parent %ld datasync %d ",
650 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->parent, 699 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
651 __entry->datasync) 700 (unsigned long) __entry->parent, __entry->datasync)
652); 701);
653 702
654TRACE_EVENT(ext4_sync_fs, 703TRACE_EVENT(ext4_sync_fs,
@@ -671,6 +720,193 @@ TRACE_EVENT(ext4_sync_fs,
671 __entry->wait) 720 __entry->wait)
672); 721);
673 722
723TRACE_EVENT(ext4_alloc_da_blocks,
724 TP_PROTO(struct inode *inode),
725
726 TP_ARGS(inode),
727
728 TP_STRUCT__entry(
729 __field( dev_t, dev )
730 __field( ino_t, ino )
731 __field( unsigned int, data_blocks )
732 __field( unsigned int, meta_blocks )
733 ),
734
735 TP_fast_assign(
736 __entry->dev = inode->i_sb->s_dev;
737 __entry->ino = inode->i_ino;
738 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
739 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
740 ),
741
742 TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
743 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
744 __entry->data_blocks, __entry->meta_blocks)
745);
746
747TRACE_EVENT(ext4_mballoc_alloc,
748 TP_PROTO(struct ext4_allocation_context *ac),
749
750 TP_ARGS(ac),
751
752 TP_STRUCT__entry(
753 __field( dev_t, dev )
754 __field( ino_t, ino )
755 __field( __u16, found )
756 __field( __u16, groups )
757 __field( __u16, buddy )
758 __field( __u16, flags )
759 __field( __u16, tail )
760 __field( __u8, cr )
761 __field( __u32, orig_logical )
762 __field( int, orig_start )
763 __field( __u32, orig_group )
764 __field( int, orig_len )
765 __field( __u32, goal_logical )
766 __field( int, goal_start )
767 __field( __u32, goal_group )
768 __field( int, goal_len )
769 __field( __u32, result_logical )
770 __field( int, result_start )
771 __field( __u32, result_group )
772 __field( int, result_len )
773 ),
774
775 TP_fast_assign(
776 __entry->dev = ac->ac_inode->i_sb->s_dev;
777 __entry->ino = ac->ac_inode->i_ino;
778 __entry->found = ac->ac_found;
779 __entry->flags = ac->ac_flags;
780 __entry->groups = ac->ac_groups_scanned;
781 __entry->buddy = ac->ac_buddy;
782 __entry->tail = ac->ac_tail;
783 __entry->cr = ac->ac_criteria;
784 __entry->orig_logical = ac->ac_o_ex.fe_logical;
785 __entry->orig_start = ac->ac_o_ex.fe_start;
786 __entry->orig_group = ac->ac_o_ex.fe_group;
787 __entry->orig_len = ac->ac_o_ex.fe_len;
788 __entry->goal_logical = ac->ac_g_ex.fe_logical;
789 __entry->goal_start = ac->ac_g_ex.fe_start;
790 __entry->goal_group = ac->ac_g_ex.fe_group;
791 __entry->goal_len = ac->ac_g_ex.fe_len;
792 __entry->result_logical = ac->ac_f_ex.fe_logical;
793 __entry->result_start = ac->ac_f_ex.fe_start;
794 __entry->result_group = ac->ac_f_ex.fe_group;
795 __entry->result_len = ac->ac_f_ex.fe_len;
796 ),
797
798 TP_printk("dev %s inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
799 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
800 "tail %u broken %u",
801 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
802 __entry->orig_group, __entry->orig_start,
803 __entry->orig_len, __entry->orig_logical,
804 __entry->goal_group, __entry->goal_start,
805 __entry->goal_len, __entry->goal_logical,
806 __entry->result_group, __entry->result_start,
807 __entry->result_len, __entry->result_logical,
808 __entry->found, __entry->groups, __entry->cr,
809 __entry->flags, __entry->tail,
810 __entry->buddy ? 1 << __entry->buddy : 0)
811);
812
813TRACE_EVENT(ext4_mballoc_prealloc,
814 TP_PROTO(struct ext4_allocation_context *ac),
815
816 TP_ARGS(ac),
817
818 TP_STRUCT__entry(
819 __field( dev_t, dev )
820 __field( ino_t, ino )
821 __field( __u32, orig_logical )
822 __field( int, orig_start )
823 __field( __u32, orig_group )
824 __field( int, orig_len )
825 __field( __u32, result_logical )
826 __field( int, result_start )
827 __field( __u32, result_group )
828 __field( int, result_len )
829 ),
830
831 TP_fast_assign(
832 __entry->dev = ac->ac_inode->i_sb->s_dev;
833 __entry->ino = ac->ac_inode->i_ino;
834 __entry->orig_logical = ac->ac_o_ex.fe_logical;
835 __entry->orig_start = ac->ac_o_ex.fe_start;
836 __entry->orig_group = ac->ac_o_ex.fe_group;
837 __entry->orig_len = ac->ac_o_ex.fe_len;
838 __entry->result_logical = ac->ac_b_ex.fe_logical;
839 __entry->result_start = ac->ac_b_ex.fe_start;
840 __entry->result_group = ac->ac_b_ex.fe_group;
841 __entry->result_len = ac->ac_b_ex.fe_len;
842 ),
843
844 TP_printk("dev %s inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
845 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
846 __entry->orig_group, __entry->orig_start,
847 __entry->orig_len, __entry->orig_logical,
848 __entry->result_group, __entry->result_start,
849 __entry->result_len, __entry->result_logical)
850);
851
852TRACE_EVENT(ext4_mballoc_discard,
853 TP_PROTO(struct ext4_allocation_context *ac),
854
855 TP_ARGS(ac),
856
857 TP_STRUCT__entry(
858 __field( dev_t, dev )
859 __field( ino_t, ino )
860 __field( __u32, result_logical )
861 __field( int, result_start )
862 __field( __u32, result_group )
863 __field( int, result_len )
864 ),
865
866 TP_fast_assign(
867 __entry->dev = ac->ac_inode->i_sb->s_dev;
868 __entry->ino = ac->ac_inode->i_ino;
869 __entry->result_logical = ac->ac_b_ex.fe_logical;
870 __entry->result_start = ac->ac_b_ex.fe_start;
871 __entry->result_group = ac->ac_b_ex.fe_group;
872 __entry->result_len = ac->ac_b_ex.fe_len;
873 ),
874
875 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
876 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
877 __entry->result_group, __entry->result_start,
878 __entry->result_len, __entry->result_logical)
879);
880
881TRACE_EVENT(ext4_mballoc_free,
882 TP_PROTO(struct ext4_allocation_context *ac),
883
884 TP_ARGS(ac),
885
886 TP_STRUCT__entry(
887 __field( dev_t, dev )
888 __field( ino_t, ino )
889 __field( __u32, result_logical )
890 __field( int, result_start )
891 __field( __u32, result_group )
892 __field( int, result_len )
893 ),
894
895 TP_fast_assign(
896 __entry->dev = ac->ac_inode->i_sb->s_dev;
897 __entry->ino = ac->ac_inode->i_ino;
898 __entry->result_logical = ac->ac_b_ex.fe_logical;
899 __entry->result_start = ac->ac_b_ex.fe_start;
900 __entry->result_group = ac->ac_b_ex.fe_group;
901 __entry->result_len = ac->ac_b_ex.fe_len;
902 ),
903
904 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
905 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
906 __entry->result_group, __entry->result_start,
907 __entry->result_len, __entry->result_logical)
908);
909
674#endif /* _TRACE_EXT4_H */ 910#endif /* _TRACE_EXT4_H */
675 911
676/* This part must be outside protection */ 912/* This part must be outside protection */
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 1cb0c3aa11e6..b89f9db4a404 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -8,16 +8,17 @@
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9 9
10#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } 10#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
11#define show_softirq_name(val) \ 11#define show_softirq_name(val) \
12 __print_symbolic(val, \ 12 __print_symbolic(val, \
13 softirq_name(HI), \ 13 softirq_name(HI), \
14 softirq_name(TIMER), \ 14 softirq_name(TIMER), \
15 softirq_name(NET_TX), \ 15 softirq_name(NET_TX), \
16 softirq_name(NET_RX), \ 16 softirq_name(NET_RX), \
17 softirq_name(BLOCK), \ 17 softirq_name(BLOCK), \
18 softirq_name(TASKLET), \ 18 softirq_name(BLOCK_IOPOLL), \
19 softirq_name(SCHED), \ 19 softirq_name(TASKLET), \
20 softirq_name(HRTIMER), \ 20 softirq_name(SCHED), \
21 softirq_name(HRTIMER), \
21 softirq_name(RCU)) 22 softirq_name(RCU))
22 23
23/** 24/**
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 10813fa0c8d0..3c60b75adb9e 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -7,6 +7,9 @@
7#include <linux/jbd2.h> 7#include <linux/jbd2.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10struct transaction_chp_stats_s;
11struct transaction_run_stats_s;
12
10TRACE_EVENT(jbd2_checkpoint, 13TRACE_EVENT(jbd2_checkpoint,
11 14
12 TP_PROTO(journal_t *journal, int result), 15 TP_PROTO(journal_t *journal, int result),
@@ -159,7 +162,82 @@ TRACE_EVENT(jbd2_submit_inode_data,
159 ), 162 ),
160 163
161 TP_printk("dev %s ino %lu", 164 TP_printk("dev %s ino %lu",
162 jbd2_dev_to_name(__entry->dev), __entry->ino) 165 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
166);
167
168TRACE_EVENT(jbd2_run_stats,
169 TP_PROTO(dev_t dev, unsigned long tid,
170 struct transaction_run_stats_s *stats),
171
172 TP_ARGS(dev, tid, stats),
173
174 TP_STRUCT__entry(
175 __field( dev_t, dev )
176 __field( unsigned long, tid )
177 __field( unsigned long, wait )
178 __field( unsigned long, running )
179 __field( unsigned long, locked )
180 __field( unsigned long, flushing )
181 __field( unsigned long, logging )
182 __field( __u32, handle_count )
183 __field( __u32, blocks )
184 __field( __u32, blocks_logged )
185 ),
186
187 TP_fast_assign(
188 __entry->dev = dev;
189 __entry->tid = tid;
190 __entry->wait = stats->rs_wait;
191 __entry->running = stats->rs_running;
192 __entry->locked = stats->rs_locked;
193 __entry->flushing = stats->rs_flushing;
194 __entry->logging = stats->rs_logging;
195 __entry->handle_count = stats->rs_handle_count;
196 __entry->blocks = stats->rs_blocks;
197 __entry->blocks_logged = stats->rs_blocks_logged;
198 ),
199
200 TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
201 "logging %u handle_count %u blocks %u blocks_logged %u",
202 jbd2_dev_to_name(__entry->dev), __entry->tid,
203 jiffies_to_msecs(__entry->wait),
204 jiffies_to_msecs(__entry->running),
205 jiffies_to_msecs(__entry->locked),
206 jiffies_to_msecs(__entry->flushing),
207 jiffies_to_msecs(__entry->logging),
208 __entry->handle_count, __entry->blocks,
209 __entry->blocks_logged)
210);
211
212TRACE_EVENT(jbd2_checkpoint_stats,
213 TP_PROTO(dev_t dev, unsigned long tid,
214 struct transaction_chp_stats_s *stats),
215
216 TP_ARGS(dev, tid, stats),
217
218 TP_STRUCT__entry(
219 __field( dev_t, dev )
220 __field( unsigned long, tid )
221 __field( unsigned long, chp_time )
222 __field( __u32, forced_to_close )
223 __field( __u32, written )
224 __field( __u32, dropped )
225 ),
226
227 TP_fast_assign(
228 __entry->dev = dev;
229 __entry->tid = tid;
230 __entry->chp_time = stats->cs_chp_time;
231 __entry->forced_to_close= stats->cs_forced_to_close;
232 __entry->written = stats->cs_written;
233 __entry->dropped = stats->cs_dropped;
234 ),
235
236 TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
237 "written %u dropped %u",
238 jbd2_dev_to_name(__entry->dev), __entry->tid,
239 jiffies_to_msecs(__entry->chp_time),
240 __entry->forced_to_close, __entry->written, __entry->dropped)
163); 241);
164 242
165#endif /* _TRACE_JBD2_H */ 243#endif /* _TRACE_JBD2_H */
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 1493c541f9c4..eaf46bdd18a5 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -225,6 +225,169 @@ TRACE_EVENT(kmem_cache_free,
225 225
226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) 226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
227); 227);
228
229TRACE_EVENT(mm_page_free_direct,
230
231 TP_PROTO(struct page *page, unsigned int order),
232
233 TP_ARGS(page, order),
234
235 TP_STRUCT__entry(
236 __field( struct page *, page )
237 __field( unsigned int, order )
238 ),
239
240 TP_fast_assign(
241 __entry->page = page;
242 __entry->order = order;
243 ),
244
245 TP_printk("page=%p pfn=%lu order=%d",
246 __entry->page,
247 page_to_pfn(__entry->page),
248 __entry->order)
249);
250
251TRACE_EVENT(mm_pagevec_free,
252
253 TP_PROTO(struct page *page, int cold),
254
255 TP_ARGS(page, cold),
256
257 TP_STRUCT__entry(
258 __field( struct page *, page )
259 __field( int, cold )
260 ),
261
262 TP_fast_assign(
263 __entry->page = page;
264 __entry->cold = cold;
265 ),
266
267 TP_printk("page=%p pfn=%lu order=0 cold=%d",
268 __entry->page,
269 page_to_pfn(__entry->page),
270 __entry->cold)
271);
272
273TRACE_EVENT(mm_page_alloc,
274
275 TP_PROTO(struct page *page, unsigned int order,
276 gfp_t gfp_flags, int migratetype),
277
278 TP_ARGS(page, order, gfp_flags, migratetype),
279
280 TP_STRUCT__entry(
281 __field( struct page *, page )
282 __field( unsigned int, order )
283 __field( gfp_t, gfp_flags )
284 __field( int, migratetype )
285 ),
286
287 TP_fast_assign(
288 __entry->page = page;
289 __entry->order = order;
290 __entry->gfp_flags = gfp_flags;
291 __entry->migratetype = migratetype;
292 ),
293
294 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
295 __entry->page,
296 page_to_pfn(__entry->page),
297 __entry->order,
298 __entry->migratetype,
299 show_gfp_flags(__entry->gfp_flags))
300);
301
302TRACE_EVENT(mm_page_alloc_zone_locked,
303
304 TP_PROTO(struct page *page, unsigned int order, int migratetype),
305
306 TP_ARGS(page, order, migratetype),
307
308 TP_STRUCT__entry(
309 __field( struct page *, page )
310 __field( unsigned int, order )
311 __field( int, migratetype )
312 ),
313
314 TP_fast_assign(
315 __entry->page = page;
316 __entry->order = order;
317 __entry->migratetype = migratetype;
318 ),
319
320 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
321 __entry->page,
322 page_to_pfn(__entry->page),
323 __entry->order,
324 __entry->migratetype,
325 __entry->order == 0)
326);
327
328TRACE_EVENT(mm_page_pcpu_drain,
329
330 TP_PROTO(struct page *page, int order, int migratetype),
331
332 TP_ARGS(page, order, migratetype),
333
334 TP_STRUCT__entry(
335 __field( struct page *, page )
336 __field( int, order )
337 __field( int, migratetype )
338 ),
339
340 TP_fast_assign(
341 __entry->page = page;
342 __entry->order = order;
343 __entry->migratetype = migratetype;
344 ),
345
346 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
347 __entry->page,
348 page_to_pfn(__entry->page),
349 __entry->order,
350 __entry->migratetype)
351);
352
353TRACE_EVENT(mm_page_alloc_extfrag,
354
355 TP_PROTO(struct page *page,
356 int alloc_order, int fallback_order,
357 int alloc_migratetype, int fallback_migratetype),
358
359 TP_ARGS(page,
360 alloc_order, fallback_order,
361 alloc_migratetype, fallback_migratetype),
362
363 TP_STRUCT__entry(
364 __field( struct page *, page )
365 __field( int, alloc_order )
366 __field( int, fallback_order )
367 __field( int, alloc_migratetype )
368 __field( int, fallback_migratetype )
369 ),
370
371 TP_fast_assign(
372 __entry->page = page;
373 __entry->alloc_order = alloc_order;
374 __entry->fallback_order = fallback_order;
375 __entry->alloc_migratetype = alloc_migratetype;
376 __entry->fallback_migratetype = fallback_migratetype;
377 ),
378
379 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
380 __entry->page,
381 page_to_pfn(__entry->page),
382 __entry->alloc_order,
383 __entry->fallback_order,
384 pageblock_order,
385 __entry->alloc_migratetype,
386 __entry->fallback_migratetype,
387 __entry->fallback_order < pageblock_order,
388 __entry->alloc_migratetype == __entry->fallback_migratetype)
389);
390
228#endif /* _TRACE_KMEM_H */ 391#endif /* _TRACE_KMEM_H */
229 392
230/* This part must be outside protection */ 393/* This part must be outside protection */
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
new file mode 100644
index 000000000000..dbe108455275
--- /dev/null
+++ b/include/trace/events/kvm.h
@@ -0,0 +1,151 @@
1#if !defined(_TRACE_KVM_MAIN_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_KVM_MAIN_H
3
4#include <linux/tracepoint.h>
5
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm
8#define TRACE_INCLUDE_FILE kvm
9
10#if defined(__KVM_HAVE_IOAPIC)
11TRACE_EVENT(kvm_set_irq,
12 TP_PROTO(unsigned int gsi, int level, int irq_source_id),
13 TP_ARGS(gsi, level, irq_source_id),
14
15 TP_STRUCT__entry(
16 __field( unsigned int, gsi )
17 __field( int, level )
18 __field( int, irq_source_id )
19 ),
20
21 TP_fast_assign(
22 __entry->gsi = gsi;
23 __entry->level = level;
24 __entry->irq_source_id = irq_source_id;
25 ),
26
27 TP_printk("gsi %u level %d source %d",
28 __entry->gsi, __entry->level, __entry->irq_source_id)
29);
30
31#define kvm_deliver_mode \
32 {0x0, "Fixed"}, \
33 {0x1, "LowPrio"}, \
34 {0x2, "SMI"}, \
35 {0x3, "Res3"}, \
36 {0x4, "NMI"}, \
37 {0x5, "INIT"}, \
38 {0x6, "SIPI"}, \
39 {0x7, "ExtINT"}
40
41TRACE_EVENT(kvm_ioapic_set_irq,
42 TP_PROTO(__u64 e, int pin, bool coalesced),
43 TP_ARGS(e, pin, coalesced),
44
45 TP_STRUCT__entry(
46 __field( __u64, e )
47 __field( int, pin )
48 __field( bool, coalesced )
49 ),
50
51 TP_fast_assign(
52 __entry->e = e;
53 __entry->pin = pin;
54 __entry->coalesced = coalesced;
55 ),
56
57 TP_printk("pin %u dst %x vec=%u (%s|%s|%s%s)%s",
58 __entry->pin, (u8)(__entry->e >> 56), (u8)__entry->e,
59 __print_symbolic((__entry->e >> 8 & 0x7), kvm_deliver_mode),
60 (__entry->e & (1<<11)) ? "logical" : "physical",
61 (__entry->e & (1<<15)) ? "level" : "edge",
62 (__entry->e & (1<<16)) ? "|masked" : "",
63 __entry->coalesced ? " (coalesced)" : "")
64);
65
66TRACE_EVENT(kvm_msi_set_irq,
67 TP_PROTO(__u64 address, __u64 data),
68 TP_ARGS(address, data),
69
70 TP_STRUCT__entry(
71 __field( __u64, address )
72 __field( __u64, data )
73 ),
74
75 TP_fast_assign(
76 __entry->address = address;
77 __entry->data = data;
78 ),
79
80 TP_printk("dst %u vec %x (%s|%s|%s%s)",
81 (u8)(__entry->address >> 12), (u8)__entry->data,
82 __print_symbolic((__entry->data >> 8 & 0x7), kvm_deliver_mode),
83 (__entry->address & (1<<2)) ? "logical" : "physical",
84 (__entry->data & (1<<15)) ? "level" : "edge",
85 (__entry->address & (1<<3)) ? "|rh" : "")
86);
87
88#define kvm_irqchips \
89 {KVM_IRQCHIP_PIC_MASTER, "PIC master"}, \
90 {KVM_IRQCHIP_PIC_SLAVE, "PIC slave"}, \
91 {KVM_IRQCHIP_IOAPIC, "IOAPIC"}
92
93TRACE_EVENT(kvm_ack_irq,
94 TP_PROTO(unsigned int irqchip, unsigned int pin),
95 TP_ARGS(irqchip, pin),
96
97 TP_STRUCT__entry(
98 __field( unsigned int, irqchip )
99 __field( unsigned int, pin )
100 ),
101
102 TP_fast_assign(
103 __entry->irqchip = irqchip;
104 __entry->pin = pin;
105 ),
106
107 TP_printk("irqchip %s pin %u",
108 __print_symbolic(__entry->irqchip, kvm_irqchips),
109 __entry->pin)
110);
111
112
113
114#endif /* defined(__KVM_HAVE_IOAPIC) */
115
116#define KVM_TRACE_MMIO_READ_UNSATISFIED 0
117#define KVM_TRACE_MMIO_READ 1
118#define KVM_TRACE_MMIO_WRITE 2
119
120#define kvm_trace_symbol_mmio \
121 { KVM_TRACE_MMIO_READ_UNSATISFIED, "unsatisfied-read" }, \
122 { KVM_TRACE_MMIO_READ, "read" }, \
123 { KVM_TRACE_MMIO_WRITE, "write" }
124
125TRACE_EVENT(kvm_mmio,
126 TP_PROTO(int type, int len, u64 gpa, u64 val),
127 TP_ARGS(type, len, gpa, val),
128
129 TP_STRUCT__entry(
130 __field( u32, type )
131 __field( u32, len )
132 __field( u64, gpa )
133 __field( u64, val )
134 ),
135
136 TP_fast_assign(
137 __entry->type = type;
138 __entry->len = len;
139 __entry->gpa = gpa;
140 __entry->val = val;
141 ),
142
143 TP_printk("mmio %s len %u gpa 0x%llx val 0x%llx",
144 __print_symbolic(__entry->type, kvm_trace_symbol_mmio),
145 __entry->len, __entry->gpa, __entry->val)
146);
147
148#endif /* _TRACE_KVM_MAIN_H */
149
150/* This part must be outside protection */
151#include <trace/define_trace.h>
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
new file mode 100644
index 000000000000..84160fb18478
--- /dev/null
+++ b/include/trace/events/module.h
@@ -0,0 +1,126 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM module
3
4#if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_MODULE_H
6
7#include <linux/tracepoint.h>
8
9#ifdef CONFIG_MODULES
10
11struct module;
12
13#define show_module_flags(flags) __print_flags(flags, "", \
14 { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \
15 { (1UL << TAINT_FORCED_MODULE), "F" }, \
16 { (1UL << TAINT_CRAP), "C" })
17
18TRACE_EVENT(module_load,
19
20 TP_PROTO(struct module *mod),
21
22 TP_ARGS(mod),
23
24 TP_STRUCT__entry(
25 __field( unsigned int, taints )
26 __string( name, mod->name )
27 ),
28
29 TP_fast_assign(
30 __entry->taints = mod->taints;
31 __assign_str(name, mod->name);
32 ),
33
34 TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints))
35);
36
37TRACE_EVENT(module_free,
38
39 TP_PROTO(struct module *mod),
40
41 TP_ARGS(mod),
42
43 TP_STRUCT__entry(
44 __string( name, mod->name )
45 ),
46
47 TP_fast_assign(
48 __assign_str(name, mod->name);
49 ),
50
51 TP_printk("%s", __get_str(name))
52);
53
54TRACE_EVENT(module_get,
55
56 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
57
58 TP_ARGS(mod, ip, refcnt),
59
60 TP_STRUCT__entry(
61 __field( unsigned long, ip )
62 __field( int, refcnt )
63 __string( name, mod->name )
64 ),
65
66 TP_fast_assign(
67 __entry->ip = ip;
68 __entry->refcnt = refcnt;
69 __assign_str(name, mod->name);
70 ),
71
72 TP_printk("%s call_site=%pf refcnt=%d",
73 __get_str(name), (void *)__entry->ip, __entry->refcnt)
74);
75
76TRACE_EVENT(module_put,
77
78 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
79
80 TP_ARGS(mod, ip, refcnt),
81
82 TP_STRUCT__entry(
83 __field( unsigned long, ip )
84 __field( int, refcnt )
85 __string( name, mod->name )
86 ),
87
88 TP_fast_assign(
89 __entry->ip = ip;
90 __entry->refcnt = refcnt;
91 __assign_str(name, mod->name);
92 ),
93
94 TP_printk("%s call_site=%pf refcnt=%d",
95 __get_str(name), (void *)__entry->ip, __entry->refcnt)
96);
97
98TRACE_EVENT(module_request,
99
100 TP_PROTO(char *name, bool wait, unsigned long ip),
101
102 TP_ARGS(name, wait, ip),
103
104 TP_STRUCT__entry(
105 __field( bool, wait )
106 __field( unsigned long, ip )
107 __string( name, name )
108 ),
109
110 TP_fast_assign(
111 __entry->wait = wait;
112 __entry->ip = ip;
113 __assign_str(name, name);
114 ),
115
116 TP_printk("%s wait=%d call_site=%pf",
117 __get_str(name), (int)__entry->wait, (void *)__entry->ip)
118);
119
120#endif /* CONFIG_MODULES */
121
122#endif /* _TRACE_MODULE_H */
123
124/* This part must be outside protection */
125#include <trace/define_trace.h>
126
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
new file mode 100644
index 000000000000..ea6d579261ad
--- /dev/null
+++ b/include/trace/events/power.h
@@ -0,0 +1,81 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM power
3
4#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_POWER_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10#ifndef _TRACE_POWER_ENUM_
11#define _TRACE_POWER_ENUM_
12enum {
13 POWER_NONE = 0,
14 POWER_CSTATE = 1,
15 POWER_PSTATE = 2,
16};
17#endif
18
19
20
21TRACE_EVENT(power_start,
22
23 TP_PROTO(unsigned int type, unsigned int state),
24
25 TP_ARGS(type, state),
26
27 TP_STRUCT__entry(
28 __field( u64, type )
29 __field( u64, state )
30 ),
31
32 TP_fast_assign(
33 __entry->type = type;
34 __entry->state = state;
35 ),
36
37 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state)
38);
39
40TRACE_EVENT(power_end,
41
42 TP_PROTO(int dummy),
43
44 TP_ARGS(dummy),
45
46 TP_STRUCT__entry(
47 __field( u64, dummy )
48 ),
49
50 TP_fast_assign(
51 __entry->dummy = 0xffff;
52 ),
53
54 TP_printk("dummy=%lu", (unsigned long)__entry->dummy)
55
56);
57
58
59TRACE_EVENT(power_frequency,
60
61 TP_PROTO(unsigned int type, unsigned int state),
62
63 TP_ARGS(type, state),
64
65 TP_STRUCT__entry(
66 __field( u64, type )
67 __field( u64, state )
68 ),
69
70 TP_fast_assign(
71 __entry->type = type;
72 __entry->state = state;
73 ),
74
75 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long) __entry->state)
76);
77
78#endif /* _TRACE_POWER_H */
79
80/* This part must be outside protection */
81#include <trace/define_trace.h>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 8949bb7eb082..4069c43f4187 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -94,6 +94,7 @@ TRACE_EVENT(sched_wakeup,
94 __field( pid_t, pid ) 94 __field( pid_t, pid )
95 __field( int, prio ) 95 __field( int, prio )
96 __field( int, success ) 96 __field( int, success )
97 __field( int, cpu )
97 ), 98 ),
98 99
99 TP_fast_assign( 100 TP_fast_assign(
@@ -101,11 +102,12 @@ TRACE_EVENT(sched_wakeup,
101 __entry->pid = p->pid; 102 __entry->pid = p->pid;
102 __entry->prio = p->prio; 103 __entry->prio = p->prio;
103 __entry->success = success; 104 __entry->success = success;
105 __entry->cpu = task_cpu(p);
104 ), 106 ),
105 107
106 TP_printk("task %s:%d [%d] success=%d", 108 TP_printk("task %s:%d [%d] success=%d [%03d]",
107 __entry->comm, __entry->pid, __entry->prio, 109 __entry->comm, __entry->pid, __entry->prio,
108 __entry->success) 110 __entry->success, __entry->cpu)
109); 111);
110 112
111/* 113/*
@@ -125,6 +127,7 @@ TRACE_EVENT(sched_wakeup_new,
125 __field( pid_t, pid ) 127 __field( pid_t, pid )
126 __field( int, prio ) 128 __field( int, prio )
127 __field( int, success ) 129 __field( int, success )
130 __field( int, cpu )
128 ), 131 ),
129 132
130 TP_fast_assign( 133 TP_fast_assign(
@@ -132,11 +135,12 @@ TRACE_EVENT(sched_wakeup_new,
132 __entry->pid = p->pid; 135 __entry->pid = p->pid;
133 __entry->prio = p->prio; 136 __entry->prio = p->prio;
134 __entry->success = success; 137 __entry->success = success;
138 __entry->cpu = task_cpu(p);
135 ), 139 ),
136 140
137 TP_printk("task %s:%d [%d] success=%d", 141 TP_printk("task %s:%d [%d] success=%d [%03d]",
138 __entry->comm, __entry->pid, __entry->prio, 142 __entry->comm, __entry->pid, __entry->prio,
139 __entry->success) 143 __entry->success, __entry->cpu)
140); 144);
141 145
142/* 146/*
@@ -340,6 +344,134 @@ TRACE_EVENT(sched_signal_send,
340 __entry->sig, __entry->comm, __entry->pid) 344 __entry->sig, __entry->comm, __entry->pid)
341); 345);
342 346
347/*
348 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
349 * adding sched_stat support to SCHED_FIFO/RR would be welcome.
350 */
351
352/*
353 * Tracepoint for accounting wait time (time the task is runnable
354 * but not actually running due to scheduler contention).
355 */
356TRACE_EVENT(sched_stat_wait,
357
358 TP_PROTO(struct task_struct *tsk, u64 delay),
359
360 TP_ARGS(tsk, delay),
361
362 TP_STRUCT__entry(
363 __array( char, comm, TASK_COMM_LEN )
364 __field( pid_t, pid )
365 __field( u64, delay )
366 ),
367
368 TP_fast_assign(
369 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
370 __entry->pid = tsk->pid;
371 __entry->delay = delay;
372 )
373 TP_perf_assign(
374 __perf_count(delay);
375 ),
376
377 TP_printk("task: %s:%d wait: %Lu [ns]",
378 __entry->comm, __entry->pid,
379 (unsigned long long)__entry->delay)
380);
381
382/*
383 * Tracepoint for accounting runtime (time the task is executing
384 * on a CPU).
385 */
386TRACE_EVENT(sched_stat_runtime,
387
388 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
389
390 TP_ARGS(tsk, runtime, vruntime),
391
392 TP_STRUCT__entry(
393 __array( char, comm, TASK_COMM_LEN )
394 __field( pid_t, pid )
395 __field( u64, runtime )
396 __field( u64, vruntime )
397 ),
398
399 TP_fast_assign(
400 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
401 __entry->pid = tsk->pid;
402 __entry->runtime = runtime;
403 __entry->vruntime = vruntime;
404 )
405 TP_perf_assign(
406 __perf_count(runtime);
407 ),
408
409 TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]",
410 __entry->comm, __entry->pid,
411 (unsigned long long)__entry->runtime,
412 (unsigned long long)__entry->vruntime)
413);
414
415/*
416 * Tracepoint for accounting sleep time (time the task is not runnable,
417 * including iowait, see below).
418 */
419TRACE_EVENT(sched_stat_sleep,
420
421 TP_PROTO(struct task_struct *tsk, u64 delay),
422
423 TP_ARGS(tsk, delay),
424
425 TP_STRUCT__entry(
426 __array( char, comm, TASK_COMM_LEN )
427 __field( pid_t, pid )
428 __field( u64, delay )
429 ),
430
431 TP_fast_assign(
432 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
433 __entry->pid = tsk->pid;
434 __entry->delay = delay;
435 )
436 TP_perf_assign(
437 __perf_count(delay);
438 ),
439
440 TP_printk("task: %s:%d sleep: %Lu [ns]",
441 __entry->comm, __entry->pid,
442 (unsigned long long)__entry->delay)
443);
444
445/*
446 * Tracepoint for accounting iowait time (time the task is not runnable
447 * due to waiting on IO to complete).
448 */
449TRACE_EVENT(sched_stat_iowait,
450
451 TP_PROTO(struct task_struct *tsk, u64 delay),
452
453 TP_ARGS(tsk, delay),
454
455 TP_STRUCT__entry(
456 __array( char, comm, TASK_COMM_LEN )
457 __field( pid_t, pid )
458 __field( u64, delay )
459 ),
460
461 TP_fast_assign(
462 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
463 __entry->pid = tsk->pid;
464 __entry->delay = delay;
465 )
466 TP_perf_assign(
467 __perf_count(delay);
468 ),
469
470 TP_printk("task: %s:%d iowait: %Lu [ns]",
471 __entry->comm, __entry->pid,
472 (unsigned long long)__entry->delay)
473);
474
343#endif /* _TRACE_SCHED_H */ 475#endif /* _TRACE_SCHED_H */
344 476
345/* This part must be outside protection */ 477/* This part must be outside protection */
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index e499863b9669..4b2be6dc76f0 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -5,6 +5,7 @@
5#define _TRACE_SKB_H 5#define _TRACE_SKB_H
6 6
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/netdevice.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9 10
10/* 11/*
@@ -34,6 +35,25 @@ TRACE_EVENT(kfree_skb,
34 __entry->skbaddr, __entry->protocol, __entry->location) 35 __entry->skbaddr, __entry->protocol, __entry->location)
35); 36);
36 37
38TRACE_EVENT(skb_copy_datagram_iovec,
39
40 TP_PROTO(const struct sk_buff *skb, int len),
41
42 TP_ARGS(skb, len),
43
44 TP_STRUCT__entry(
45 __field( const void *, skbaddr )
46 __field( int, len )
47 ),
48
49 TP_fast_assign(
50 __entry->skbaddr = skb;
51 __entry->len = len;
52 ),
53
54 TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len)
55);
56
37#endif /* _TRACE_SKB_H */ 57#endif /* _TRACE_SKB_H */
38 58
39/* This part must be outside protection */ 59/* This part must be outside protection */
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
new file mode 100644
index 000000000000..397dff2dbd5a
--- /dev/null
+++ b/include/trace/events/syscalls.h
@@ -0,0 +1,70 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM syscalls
3
4#if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_EVENTS_SYSCALLS_H
6
7#include <linux/tracepoint.h>
8
9#include <asm/ptrace.h>
10#include <asm/syscall.h>
11
12
13#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
14
15extern void syscall_regfunc(void);
16extern void syscall_unregfunc(void);
17
18TRACE_EVENT_FN(sys_enter,
19
20 TP_PROTO(struct pt_regs *regs, long id),
21
22 TP_ARGS(regs, id),
23
24 TP_STRUCT__entry(
25 __field( long, id )
26 __array( unsigned long, args, 6 )
27 ),
28
29 TP_fast_assign(
30 __entry->id = id;
31 syscall_get_arguments(current, regs, 0, 6, __entry->args);
32 ),
33
34 TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
35 __entry->id,
36 __entry->args[0], __entry->args[1], __entry->args[2],
37 __entry->args[3], __entry->args[4], __entry->args[5]),
38
39 syscall_regfunc, syscall_unregfunc
40);
41
42TRACE_EVENT_FN(sys_exit,
43
44 TP_PROTO(struct pt_regs *regs, long ret),
45
46 TP_ARGS(regs, ret),
47
48 TP_STRUCT__entry(
49 __field( long, id )
50 __field( long, ret )
51 ),
52
53 TP_fast_assign(
54 __entry->id = syscall_get_nr(current, regs);
55 __entry->ret = ret;
56 ),
57
58 TP_printk("NR %ld = %ld",
59 __entry->id, __entry->ret),
60
61 syscall_regfunc, syscall_unregfunc
62);
63
64#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
65
66#endif /* _TRACE_EVENTS_SYSCALLS_H */
67
68/* This part must be outside protection */
69#include <trace/define_trace.h>
70
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
new file mode 100644
index 000000000000..1844c48d640e
--- /dev/null
+++ b/include/trace/events/timer.h
@@ -0,0 +1,342 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM timer
3
4#if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TIMER_H
6
7#include <linux/tracepoint.h>
8#include <linux/hrtimer.h>
9#include <linux/timer.h>
10
11/**
12 * timer_init - called when the timer is initialized
13 * @timer: pointer to struct timer_list
14 */
15TRACE_EVENT(timer_init,
16
17 TP_PROTO(struct timer_list *timer),
18
19 TP_ARGS(timer),
20
21 TP_STRUCT__entry(
22 __field( void *, timer )
23 ),
24
25 TP_fast_assign(
26 __entry->timer = timer;
27 ),
28
29 TP_printk("timer %p", __entry->timer)
30);
31
32/**
33 * timer_start - called when the timer is started
34 * @timer: pointer to struct timer_list
35 * @expires: the timers expiry time
36 */
37TRACE_EVENT(timer_start,
38
39 TP_PROTO(struct timer_list *timer, unsigned long expires),
40
41 TP_ARGS(timer, expires),
42
43 TP_STRUCT__entry(
44 __field( void *, timer )
45 __field( void *, function )
46 __field( unsigned long, expires )
47 __field( unsigned long, now )
48 ),
49
50 TP_fast_assign(
51 __entry->timer = timer;
52 __entry->function = timer->function;
53 __entry->expires = expires;
54 __entry->now = jiffies;
55 ),
56
57 TP_printk("timer %p: func %pf, expires %lu, timeout %ld",
58 __entry->timer, __entry->function, __entry->expires,
59 (long)__entry->expires - __entry->now)
60);
61
62/**
63 * timer_expire_entry - called immediately before the timer callback
64 * @timer: pointer to struct timer_list
65 *
66 * Allows to determine the timer latency.
67 */
68TRACE_EVENT(timer_expire_entry,
69
70 TP_PROTO(struct timer_list *timer),
71
72 TP_ARGS(timer),
73
74 TP_STRUCT__entry(
75 __field( void *, timer )
76 __field( unsigned long, now )
77 ),
78
79 TP_fast_assign(
80 __entry->timer = timer;
81 __entry->now = jiffies;
82 ),
83
84 TP_printk("timer %p: now %lu", __entry->timer, __entry->now)
85);
86
87/**
88 * timer_expire_exit - called immediately after the timer callback returns
89 * @timer: pointer to struct timer_list
90 *
91 * When used in combination with the timer_expire_entry tracepoint we can
92 * determine the runtime of the timer callback function.
93 *
94 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
95 * be invalid. We solely track the pointer.
96 */
97TRACE_EVENT(timer_expire_exit,
98
99 TP_PROTO(struct timer_list *timer),
100
101 TP_ARGS(timer),
102
103 TP_STRUCT__entry(
104 __field(void *, timer )
105 ),
106
107 TP_fast_assign(
108 __entry->timer = timer;
109 ),
110
111 TP_printk("timer %p", __entry->timer)
112);
113
114/**
115 * timer_cancel - called when the timer is canceled
116 * @timer: pointer to struct timer_list
117 */
118TRACE_EVENT(timer_cancel,
119
120 TP_PROTO(struct timer_list *timer),
121
122 TP_ARGS(timer),
123
124 TP_STRUCT__entry(
125 __field( void *, timer )
126 ),
127
128 TP_fast_assign(
129 __entry->timer = timer;
130 ),
131
132 TP_printk("timer %p", __entry->timer)
133);
134
135/**
136 * hrtimer_init - called when the hrtimer is initialized
137 * @timer: pointer to struct hrtimer
138 * @clockid: the hrtimers clock
139 * @mode: the hrtimers mode
140 */
141TRACE_EVENT(hrtimer_init,
142
143 TP_PROTO(struct hrtimer *timer, clockid_t clockid,
144 enum hrtimer_mode mode),
145
146 TP_ARGS(timer, clockid, mode),
147
148 TP_STRUCT__entry(
149 __field( void *, timer )
150 __field( clockid_t, clockid )
151 __field( enum hrtimer_mode, mode )
152 ),
153
154 TP_fast_assign(
155 __entry->timer = timer;
156 __entry->clockid = clockid;
157 __entry->mode = mode;
158 ),
159
160 TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer,
161 __entry->clockid == CLOCK_REALTIME ?
162 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
163 __entry->mode == HRTIMER_MODE_ABS ?
164 "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
165);
166
167/**
168 * hrtimer_start - called when the hrtimer is started
169 * @timer: pointer to struct hrtimer
170 */
171TRACE_EVENT(hrtimer_start,
172
173 TP_PROTO(struct hrtimer *timer),
174
175 TP_ARGS(timer),
176
177 TP_STRUCT__entry(
178 __field( void *, timer )
179 __field( void *, function )
180 __field( s64, expires )
181 __field( s64, softexpires )
182 ),
183
184 TP_fast_assign(
185 __entry->timer = timer;
186 __entry->function = timer->function;
187 __entry->expires = hrtimer_get_expires(timer).tv64;
188 __entry->softexpires = hrtimer_get_softexpires(timer).tv64;
189 ),
190
191 TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu",
192 __entry->timer, __entry->function,
193 (unsigned long long)ktime_to_ns((ktime_t) {
194 .tv64 = __entry->expires }),
195 (unsigned long long)ktime_to_ns((ktime_t) {
196 .tv64 = __entry->softexpires }))
197);
198
199/**
200 * htimmer_expire_entry - called immediately before the hrtimer callback
201 * @timer: pointer to struct hrtimer
202 * @now: pointer to variable which contains current time of the
203 * timers base.
204 *
205 * Allows to determine the timer latency.
206 */
207TRACE_EVENT(hrtimer_expire_entry,
208
209 TP_PROTO(struct hrtimer *timer, ktime_t *now),
210
211 TP_ARGS(timer, now),
212
213 TP_STRUCT__entry(
214 __field( void *, timer )
215 __field( s64, now )
216 ),
217
218 TP_fast_assign(
219 __entry->timer = timer;
220 __entry->now = now->tv64;
221 ),
222
223 TP_printk("hrtimer %p, now %llu", __entry->timer,
224 (unsigned long long)ktime_to_ns((ktime_t) {
225 .tv64 = __entry->now }))
226 );
227
228/**
229 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
230 * @timer: pointer to struct hrtimer
231 *
232 * When used in combination with the hrtimer_expire_entry tracepoint we can
233 * determine the runtime of the callback function.
234 */
235TRACE_EVENT(hrtimer_expire_exit,
236
237 TP_PROTO(struct hrtimer *timer),
238
239 TP_ARGS(timer),
240
241 TP_STRUCT__entry(
242 __field( void *, timer )
243 ),
244
245 TP_fast_assign(
246 __entry->timer = timer;
247 ),
248
249 TP_printk("hrtimer %p", __entry->timer)
250);
251
252/**
253 * hrtimer_cancel - called when the hrtimer is canceled
254 * @timer: pointer to struct hrtimer
255 */
256TRACE_EVENT(hrtimer_cancel,
257
258 TP_PROTO(struct hrtimer *timer),
259
260 TP_ARGS(timer),
261
262 TP_STRUCT__entry(
263 __field( void *, timer )
264 ),
265
266 TP_fast_assign(
267 __entry->timer = timer;
268 ),
269
270 TP_printk("hrtimer %p", __entry->timer)
271);
272
273/**
274 * itimer_state - called when itimer is started or canceled
275 * @which: name of the interval timer
276 * @value: the itimers value, itimer is canceled if value->it_value is
277 * zero, otherwise it is started
278 * @expires: the itimers expiry time
279 */
280TRACE_EVENT(itimer_state,
281
282 TP_PROTO(int which, const struct itimerval *const value,
283 cputime_t expires),
284
285 TP_ARGS(which, value, expires),
286
287 TP_STRUCT__entry(
288 __field( int, which )
289 __field( cputime_t, expires )
290 __field( long, value_sec )
291 __field( long, value_usec )
292 __field( long, interval_sec )
293 __field( long, interval_usec )
294 ),
295
296 TP_fast_assign(
297 __entry->which = which;
298 __entry->expires = expires;
299 __entry->value_sec = value->it_value.tv_sec;
300 __entry->value_usec = value->it_value.tv_usec;
301 __entry->interval_sec = value->it_interval.tv_sec;
302 __entry->interval_usec = value->it_interval.tv_usec;
303 ),
304
305 TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu",
306 __entry->which, __entry->expires,
307 __entry->value_sec, __entry->value_usec,
308 __entry->interval_sec, __entry->interval_usec)
309);
310
311/**
312 * itimer_expire - called when itimer expires
313 * @which: type of the interval timer
314 * @pid: pid of the process which owns the timer
315 * @now: current time, used to calculate the latency of itimer
316 */
317TRACE_EVENT(itimer_expire,
318
319 TP_PROTO(int which, struct pid *pid, cputime_t now),
320
321 TP_ARGS(which, pid, now),
322
323 TP_STRUCT__entry(
324 __field( int , which )
325 __field( pid_t, pid )
326 __field( cputime_t, now )
327 ),
328
329 TP_fast_assign(
330 __entry->which = which;
331 __entry->now = now;
332 __entry->pid = pid_nr(pid);
333 ),
334
335 TP_printk("which %d, pid %d, now %lu", __entry->which,
336 (int) __entry->pid, __entry->now)
337);
338
339#endif /* _TRACE_TIMER_H */
340
341/* This part must be outside protection */
342#include <trace/define_trace.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index fcfd9a1e4b96..e4612dbd7ba6 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -26,7 +26,7 @@ TRACE_EVENT(workqueue_insertion,
26 __entry->func = work->func; 26 __entry->func = work->func;
27 ), 27 ),
28 28
29 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, 29 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
30 __entry->thread_pid, __entry->func) 30 __entry->thread_pid, __entry->func)
31); 31);
32 32
@@ -48,7 +48,7 @@ TRACE_EVENT(workqueue_execution,
48 __entry->func = work->func; 48 __entry->func = work->func;
49 ), 49 ),
50 50
51 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, 51 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
52 __entry->thread_pid, __entry->func) 52 __entry->thread_pid, __entry->func)
53); 53);
54 54
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index f64fbaae781a..cc0d9667e182 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -21,11 +21,14 @@
21#undef __field 21#undef __field
22#define __field(type, item) type item; 22#define __field(type, item) type item;
23 23
24#undef __field_ext
25#define __field_ext(type, item, filter_type) type item;
26
24#undef __array 27#undef __array
25#define __array(type, item, len) type item[len]; 28#define __array(type, item, len) type item[len];
26 29
27#undef __dynamic_array 30#undef __dynamic_array
28#define __dynamic_array(type, item, len) unsigned short __data_loc_##item; 31#define __dynamic_array(type, item, len) u32 __data_loc_##item;
29 32
30#undef __string 33#undef __string
31#define __string(item, src) __dynamic_array(char, item, -1) 34#define __string(item, src) __dynamic_array(char, item, -1)
@@ -42,6 +45,16 @@
42 }; \ 45 }; \
43 static struct ftrace_event_call event_##name 46 static struct ftrace_event_call event_##name
44 47
48#undef __cpparg
49#define __cpparg(arg...) arg
50
51/* Callbacks are meaningless to ftrace. */
52#undef TRACE_EVENT_FN
53#define TRACE_EVENT_FN(name, proto, args, tstruct, \
54 assign, print, reg, unreg) \
55 TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \
56 __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \
57
45#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 58#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
46 59
47 60
@@ -51,23 +64,27 @@
51 * Include the following: 64 * Include the following:
52 * 65 *
53 * struct ftrace_data_offsets_<call> { 66 * struct ftrace_data_offsets_<call> {
54 * int <item1>; 67 * u32 <item1>;
55 * int <item2>; 68 * u32 <item2>;
56 * [...] 69 * [...]
57 * }; 70 * };
58 * 71 *
59 * The __dynamic_array() macro will create each int <item>, this is 72 * The __dynamic_array() macro will create each u32 <item>, this is
60 * to keep the offset of each array from the beginning of the event. 73 * to keep the offset of each array from the beginning of the event.
74 * The size of an array is also encoded, in the higher 16 bits of <item>.
61 */ 75 */
62 76
63#undef __field 77#undef __field
64#define __field(type, item); 78#define __field(type, item)
79
80#undef __field_ext
81#define __field_ext(type, item, filter_type)
65 82
66#undef __array 83#undef __array
67#define __array(type, item, len) 84#define __array(type, item, len)
68 85
69#undef __dynamic_array 86#undef __dynamic_array
70#define __dynamic_array(type, item, len) int item; 87#define __dynamic_array(type, item, len) u32 item;
71 88
72#undef __string 89#undef __string
73#define __string(item, src) __dynamic_array(char, item, -1) 90#define __string(item, src) __dynamic_array(char, item, -1)
@@ -109,6 +126,9 @@
109 if (!ret) \ 126 if (!ret) \
110 return 0; 127 return 0;
111 128
129#undef __field_ext
130#define __field_ext(type, item, filter_type) __field(type, item)
131
112#undef __array 132#undef __array
113#define __array(type, item, len) \ 133#define __array(type, item, len) \
114 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ 134 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
@@ -120,7 +140,7 @@
120 140
121#undef __dynamic_array 141#undef __dynamic_array
122#define __dynamic_array(type, item, len) \ 142#define __dynamic_array(type, item, len) \
123 ret = trace_seq_printf(s, "\tfield:__data_loc " #item ";\t" \ 143 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
124 "offset:%u;\tsize:%u;\n", \ 144 "offset:%u;\tsize:%u;\n", \
125 (unsigned int)offsetof(typeof(field), \ 145 (unsigned int)offsetof(typeof(field), \
126 __data_loc_##item), \ 146 __data_loc_##item), \
@@ -150,7 +170,8 @@
150#undef TRACE_EVENT 170#undef TRACE_EVENT
151#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 171#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
152static int \ 172static int \
153ftrace_format_##call(struct trace_seq *s) \ 173ftrace_format_##call(struct ftrace_event_call *unused, \
174 struct trace_seq *s) \
154{ \ 175{ \
155 struct ftrace_raw_##call field __attribute__((unused)); \ 176 struct ftrace_raw_##call field __attribute__((unused)); \
156 int ret = 0; \ 177 int ret = 0; \
@@ -210,7 +231,7 @@ ftrace_format_##call(struct trace_seq *s) \
210 231
211#undef __get_dynamic_array 232#undef __get_dynamic_array
212#define __get_dynamic_array(field) \ 233#define __get_dynamic_array(field) \
213 ((void *)__entry + __entry->__data_loc_##field) 234 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
214 235
215#undef __get_str 236#undef __get_str
216#define __get_str(field) (char *)__get_dynamic_array(field) 237#define __get_str(field) (char *)__get_dynamic_array(field)
@@ -218,9 +239,9 @@ ftrace_format_##call(struct trace_seq *s) \
218#undef __print_flags 239#undef __print_flags
219#define __print_flags(flag, delim, flag_array...) \ 240#define __print_flags(flag, delim, flag_array...) \
220 ({ \ 241 ({ \
221 static const struct trace_print_flags flags[] = \ 242 static const struct trace_print_flags __flags[] = \
222 { flag_array, { -1, NULL }}; \ 243 { flag_array, { -1, NULL }}; \
223 ftrace_print_flags_seq(p, delim, flag, flags); \ 244 ftrace_print_flags_seq(p, delim, flag, __flags); \
224 }) 245 })
225 246
226#undef __print_symbolic 247#undef __print_symbolic
@@ -233,7 +254,7 @@ ftrace_format_##call(struct trace_seq *s) \
233 254
234#undef TRACE_EVENT 255#undef TRACE_EVENT
235#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 256#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
236enum print_line_t \ 257static enum print_line_t \
237ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ 258ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
238{ \ 259{ \
239 struct trace_seq *s = &iter->seq; \ 260 struct trace_seq *s = &iter->seq; \
@@ -263,46 +284,48 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
263 284
264#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 285#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
265 286
266#undef __field 287#undef __field_ext
267#define __field(type, item) \ 288#define __field_ext(type, item, filter_type) \
268 ret = trace_define_field(event_call, #type, #item, \ 289 ret = trace_define_field(event_call, #type, #item, \
269 offsetof(typeof(field), item), \ 290 offsetof(typeof(field), item), \
270 sizeof(field.item), is_signed_type(type)); \ 291 sizeof(field.item), \
292 is_signed_type(type), filter_type); \
271 if (ret) \ 293 if (ret) \
272 return ret; 294 return ret;
273 295
296#undef __field
297#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
298
274#undef __array 299#undef __array
275#define __array(type, item, len) \ 300#define __array(type, item, len) \
276 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 301 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
277 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 302 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
278 offsetof(typeof(field), item), \ 303 offsetof(typeof(field), item), \
279 sizeof(field.item), 0); \ 304 sizeof(field.item), 0, FILTER_OTHER); \
280 if (ret) \ 305 if (ret) \
281 return ret; 306 return ret;
282 307
283#undef __dynamic_array 308#undef __dynamic_array
284#define __dynamic_array(type, item, len) \ 309#define __dynamic_array(type, item, len) \
285 ret = trace_define_field(event_call, "__data_loc" "[" #type "]", #item,\ 310 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \
286 offsetof(typeof(field), __data_loc_##item), \ 311 offsetof(typeof(field), __data_loc_##item), \
287 sizeof(field.__data_loc_##item), 0); 312 sizeof(field.__data_loc_##item), 0, \
313 FILTER_OTHER);
288 314
289#undef __string 315#undef __string
290#define __string(item, src) __dynamic_array(char, item, -1) 316#define __string(item, src) __dynamic_array(char, item, -1)
291 317
292#undef TRACE_EVENT 318#undef TRACE_EVENT
293#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 319#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
294int \ 320static int \
295ftrace_define_fields_##call(void) \ 321ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
296{ \ 322{ \
297 struct ftrace_raw_##call field; \ 323 struct ftrace_raw_##call field; \
298 struct ftrace_event_call *event_call = &event_##call; \
299 int ret; \ 324 int ret; \
300 \ 325 \
301 __common_field(int, type, 1); \ 326 ret = trace_define_common_fields(event_call); \
302 __common_field(unsigned char, flags, 0); \ 327 if (ret) \
303 __common_field(unsigned char, preempt_count, 0); \ 328 return ret; \
304 __common_field(int, pid, 1); \
305 __common_field(int, tgid, 1); \
306 \ 329 \
307 tstruct; \ 330 tstruct; \
308 \ 331 \
@@ -321,6 +344,9 @@ ftrace_define_fields_##call(void) \
321#undef __field 344#undef __field
322#define __field(type, item) 345#define __field(type, item)
323 346
347#undef __field_ext
348#define __field_ext(type, item, filter_type)
349
324#undef __array 350#undef __array
325#define __array(type, item, len) 351#define __array(type, item, len)
326 352
@@ -328,6 +354,7 @@ ftrace_define_fields_##call(void) \
328#define __dynamic_array(type, item, len) \ 354#define __dynamic_array(type, item, len) \
329 __data_offsets->item = __data_size + \ 355 __data_offsets->item = __data_size + \
330 offsetof(typeof(*entry), __data); \ 356 offsetof(typeof(*entry), __data); \
357 __data_offsets->item |= (len * sizeof(type)) << 16; \
331 __data_size += (len) * sizeof(type); 358 __data_size += (len) * sizeof(type);
332 359
333#undef __string 360#undef __string
@@ -351,24 +378,18 @@ static inline int ftrace_get_offsets_##call( \
351#ifdef CONFIG_EVENT_PROFILE 378#ifdef CONFIG_EVENT_PROFILE
352 379
353/* 380/*
354 * Generate the functions needed for tracepoint perf_counter support. 381 * Generate the functions needed for tracepoint perf_event support.
355 * 382 *
356 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later 383 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later
357 * 384 *
358 * static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call) 385 * static int ftrace_profile_enable_<call>(void)
359 * { 386 * {
360 * int ret = 0; 387 * return register_trace_<call>(ftrace_profile_<call>);
361 *
362 * if (!atomic_inc_return(&event_call->profile_count))
363 * ret = register_trace_<call>(ftrace_profile_<call>);
364 *
365 * return ret;
366 * } 388 * }
367 * 389 *
368 * static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call) 390 * static void ftrace_profile_disable_<call>(void)
369 * { 391 * {
370 * if (atomic_add_negative(-1, &event->call->profile_count)) 392 * unregister_trace_<call>(ftrace_profile_<call>);
371 * unregister_trace_<call>(ftrace_profile_<call>);
372 * } 393 * }
373 * 394 *
374 */ 395 */
@@ -378,20 +399,14 @@ static inline int ftrace_get_offsets_##call( \
378 \ 399 \
379static void ftrace_profile_##call(proto); \ 400static void ftrace_profile_##call(proto); \
380 \ 401 \
381static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \ 402static int ftrace_profile_enable_##call(void) \
382{ \ 403{ \
383 int ret = 0; \ 404 return register_trace_##call(ftrace_profile_##call); \
384 \
385 if (!atomic_inc_return(&event_call->profile_count)) \
386 ret = register_trace_##call(ftrace_profile_##call); \
387 \
388 return ret; \
389} \ 405} \
390 \ 406 \
391static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ 407static void ftrace_profile_disable_##call(void) \
392{ \ 408{ \
393 if (atomic_add_negative(-1, &event_call->profile_count)) \ 409 unregister_trace_##call(ftrace_profile_##call); \
394 unregister_trace_##call(ftrace_profile_##call); \
395} 410}
396 411
397#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 412#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
@@ -433,13 +448,15 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
433 * { 448 * {
434 * struct ring_buffer_event *event; 449 * struct ring_buffer_event *event;
435 * struct ftrace_raw_<call> *entry; <-- defined in stage 1 450 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
451 * struct ring_buffer *buffer;
436 * unsigned long irq_flags; 452 * unsigned long irq_flags;
437 * int pc; 453 * int pc;
438 * 454 *
439 * local_save_flags(irq_flags); 455 * local_save_flags(irq_flags);
440 * pc = preempt_count(); 456 * pc = preempt_count();
441 * 457 *
442 * event = trace_current_buffer_lock_reserve(event_<call>.id, 458 * event = trace_current_buffer_lock_reserve(&buffer,
459 * event_<call>.id,
443 * sizeof(struct ftrace_raw_<call>), 460 * sizeof(struct ftrace_raw_<call>),
444 * irq_flags, pc); 461 * irq_flags, pc);
445 * if (!event) 462 * if (!event)
@@ -449,7 +466,7 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
449 * <assign>; <-- Here we assign the entries by the __field and 466 * <assign>; <-- Here we assign the entries by the __field and
450 * __array macros. 467 * __array macros.
451 * 468 *
452 * trace_current_buffer_unlock_commit(event, irq_flags, pc); 469 * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc);
453 * } 470 * }
454 * 471 *
455 * static int ftrace_raw_reg_event_<call>(void) 472 * static int ftrace_raw_reg_event_<call>(void)
@@ -541,6 +558,7 @@ static void ftrace_raw_event_##call(proto) \
541 struct ftrace_event_call *event_call = &event_##call; \ 558 struct ftrace_event_call *event_call = &event_##call; \
542 struct ring_buffer_event *event; \ 559 struct ring_buffer_event *event; \
543 struct ftrace_raw_##call *entry; \ 560 struct ftrace_raw_##call *entry; \
561 struct ring_buffer *buffer; \
544 unsigned long irq_flags; \ 562 unsigned long irq_flags; \
545 int __data_size; \ 563 int __data_size; \
546 int pc; \ 564 int pc; \
@@ -550,7 +568,8 @@ static void ftrace_raw_event_##call(proto) \
550 \ 568 \
551 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 569 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
552 \ 570 \
553 event = trace_current_buffer_lock_reserve(event_##call.id, \ 571 event = trace_current_buffer_lock_reserve(&buffer, \
572 event_##call.id, \
554 sizeof(*entry) + __data_size, \ 573 sizeof(*entry) + __data_size, \
555 irq_flags, pc); \ 574 irq_flags, pc); \
556 if (!event) \ 575 if (!event) \
@@ -562,11 +581,12 @@ static void ftrace_raw_event_##call(proto) \
562 \ 581 \
563 { assign; } \ 582 { assign; } \
564 \ 583 \
565 if (!filter_current_check_discard(event_call, entry, event)) \ 584 if (!filter_current_check_discard(buffer, event_call, entry, event)) \
566 trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \ 585 trace_nowake_buffer_unlock_commit(buffer, \
586 event, irq_flags, pc); \
567} \ 587} \
568 \ 588 \
569static int ftrace_raw_reg_event_##call(void) \ 589static int ftrace_raw_reg_event_##call(void *ptr) \
570{ \ 590{ \
571 int ret; \ 591 int ret; \
572 \ 592 \
@@ -577,7 +597,7 @@ static int ftrace_raw_reg_event_##call(void) \
577 return ret; \ 597 return ret; \
578} \ 598} \
579 \ 599 \
580static void ftrace_raw_unreg_event_##call(void) \ 600static void ftrace_raw_unreg_event_##call(void *ptr) \
581{ \ 601{ \
582 unregister_trace_##call(ftrace_raw_event_##call); \ 602 unregister_trace_##call(ftrace_raw_event_##call); \
583} \ 603} \
@@ -595,7 +615,6 @@ static int ftrace_raw_init_event_##call(void) \
595 return -ENODEV; \ 615 return -ENODEV; \
596 event_##call.id = id; \ 616 event_##call.id = id; \
597 INIT_LIST_HEAD(&event_##call.fields); \ 617 INIT_LIST_HEAD(&event_##call.fields); \
598 init_preds(&event_##call); \
599 return 0; \ 618 return 0; \
600} \ 619} \
601 \ 620 \
@@ -625,15 +644,16 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
625 * { 644 * {
626 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; 645 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
627 * struct ftrace_event_call *event_call = &event_<call>; 646 * struct ftrace_event_call *event_call = &event_<call>;
628 * extern void perf_tpcounter_event(int, u64, u64, void *, int); 647 * extern void perf_tp_event(int, u64, u64, void *, int);
629 * struct ftrace_raw_##call *entry; 648 * struct ftrace_raw_##call *entry;
630 * u64 __addr = 0, __count = 1; 649 * u64 __addr = 0, __count = 1;
631 * unsigned long irq_flags; 650 * unsigned long irq_flags;
651 * struct trace_entry *ent;
632 * int __entry_size; 652 * int __entry_size;
633 * int __data_size; 653 * int __data_size;
654 * int __cpu
634 * int pc; 655 * int pc;
635 * 656 *
636 * local_save_flags(irq_flags);
637 * pc = preempt_count(); 657 * pc = preempt_count();
638 * 658 *
639 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); 659 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
@@ -644,25 +664,34 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
644 * sizeof(u64)); 664 * sizeof(u64));
645 * __entry_size -= sizeof(u32); 665 * __entry_size -= sizeof(u32);
646 * 666 *
647 * do { 667 * // Protect the non nmi buffer
648 * char raw_data[__entry_size]; <- allocate our sample in the stack 668 * // This also protects the rcu read side
649 * struct trace_entry *ent; 669 * local_irq_save(irq_flags);
670 * __cpu = smp_processor_id();
650 * 671 *
651 * zero dead bytes from alignment to avoid stack leak to userspace: 672 * if (in_nmi())
673 * raw_data = rcu_dereference(trace_profile_buf_nmi);
674 * else
675 * raw_data = rcu_dereference(trace_profile_buf);
652 * 676 *
653 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; 677 * if (!raw_data)
654 * entry = (struct ftrace_raw_<call> *)raw_data; 678 * goto end;
655 * ent = &entry->ent;
656 * tracing_generic_entry_update(ent, irq_flags, pc);
657 * ent->type = event_call->id;
658 * 679 *
659 * <tstruct> <- do some jobs with dynamic arrays 680 * raw_data = per_cpu_ptr(raw_data, __cpu);
660 * 681 *
661 * <assign> <- affect our values 682 * //zero dead bytes from alignment to avoid stack leak to userspace:
683 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
684 * entry = (struct ftrace_raw_<call> *)raw_data;
685 * ent = &entry->ent;
686 * tracing_generic_entry_update(ent, irq_flags, pc);
687 * ent->type = event_call->id;
662 * 688 *
663 * perf_tpcounter_event(event_call->id, __addr, __count, entry, 689 * <tstruct> <- do some jobs with dynamic arrays
664 * __entry_size); <- submit them to perf counter 690 *
665 * } while (0); 691 * <assign> <- affect our values
692 *
693 * perf_tp_event(event_call->id, __addr, __count, entry,
694 * __entry_size); <- submit them to perf counter
666 * 695 *
667 * } 696 * }
668 */ 697 */
@@ -681,15 +710,17 @@ static void ftrace_profile_##call(proto) \
681{ \ 710{ \
682 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 711 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
683 struct ftrace_event_call *event_call = &event_##call; \ 712 struct ftrace_event_call *event_call = &event_##call; \
684 extern void perf_tpcounter_event(int, u64, u64, void *, int); \ 713 extern void perf_tp_event(int, u64, u64, void *, int); \
685 struct ftrace_raw_##call *entry; \ 714 struct ftrace_raw_##call *entry; \
686 u64 __addr = 0, __count = 1; \ 715 u64 __addr = 0, __count = 1; \
687 unsigned long irq_flags; \ 716 unsigned long irq_flags; \
717 struct trace_entry *ent; \
688 int __entry_size; \ 718 int __entry_size; \
689 int __data_size; \ 719 int __data_size; \
720 char *raw_data; \
721 int __cpu; \
690 int pc; \ 722 int pc; \
691 \ 723 \
692 local_save_flags(irq_flags); \
693 pc = preempt_count(); \ 724 pc = preempt_count(); \
694 \ 725 \
695 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 726 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
@@ -697,23 +728,38 @@ static void ftrace_profile_##call(proto) \
697 sizeof(u64)); \ 728 sizeof(u64)); \
698 __entry_size -= sizeof(u32); \ 729 __entry_size -= sizeof(u32); \
699 \ 730 \
700 do { \ 731 if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \
701 char raw_data[__entry_size]; \ 732 "profile buffer not large enough")) \
702 struct trace_entry *ent; \ 733 return; \
703 \ 734 \
704 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ 735 local_irq_save(irq_flags); \
705 entry = (struct ftrace_raw_##call *)raw_data; \ 736 __cpu = smp_processor_id(); \
706 ent = &entry->ent; \
707 tracing_generic_entry_update(ent, irq_flags, pc); \
708 ent->type = event_call->id; \
709 \ 737 \
710 tstruct \ 738 if (in_nmi()) \
739 raw_data = rcu_dereference(trace_profile_buf_nmi); \
740 else \
741 raw_data = rcu_dereference(trace_profile_buf); \
711 \ 742 \
712 { assign; } \ 743 if (!raw_data) \
744 goto end; \
713 \ 745 \
714 perf_tpcounter_event(event_call->id, __addr, __count, entry,\ 746 raw_data = per_cpu_ptr(raw_data, __cpu); \
747 \
748 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \
749 entry = (struct ftrace_raw_##call *)raw_data; \
750 ent = &entry->ent; \
751 tracing_generic_entry_update(ent, irq_flags, pc); \
752 ent->type = event_call->id; \
753 \
754 tstruct \
755 \
756 { assign; } \
757 \
758 perf_tp_event(event_call->id, __addr, __count, entry, \
715 __entry_size); \ 759 __entry_size); \
716 } while (0); \ 760 \
761end: \
762 local_irq_restore(irq_flags); \
717 \ 763 \
718} 764}
719 765
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 8cfe515cbc47..5dc283ba5ae0 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -1,8 +1,13 @@
1#ifndef _TRACE_SYSCALL_H 1#ifndef _TRACE_SYSCALL_H
2#define _TRACE_SYSCALL_H 2#define _TRACE_SYSCALL_H
3 3
4#include <linux/tracepoint.h>
5#include <linux/unistd.h>
6#include <linux/ftrace_event.h>
7
4#include <asm/ptrace.h> 8#include <asm/ptrace.h>
5 9
10
6/* 11/*
7 * A syscall entry in the ftrace syscalls array. 12 * A syscall entry in the ftrace syscalls array.
8 * 13 *
@@ -10,26 +15,49 @@
10 * @nb_args: number of parameters it takes 15 * @nb_args: number of parameters it takes
11 * @types: list of types as strings 16 * @types: list of types as strings
12 * @args: list of args as strings (args[i] matches types[i]) 17 * @args: list of args as strings (args[i] matches types[i])
18 * @enter_id: associated ftrace enter event id
19 * @exit_id: associated ftrace exit event id
20 * @enter_event: associated syscall_enter trace event
21 * @exit_event: associated syscall_exit trace event
13 */ 22 */
14struct syscall_metadata { 23struct syscall_metadata {
15 const char *name; 24 const char *name;
16 int nb_args; 25 int nb_args;
17 const char **types; 26 const char **types;
18 const char **args; 27 const char **args;
28 int enter_id;
29 int exit_id;
30
31 struct ftrace_event_call *enter_event;
32 struct ftrace_event_call *exit_event;
19}; 33};
20 34
21#ifdef CONFIG_FTRACE_SYSCALLS 35#ifdef CONFIG_FTRACE_SYSCALLS
22extern void arch_init_ftrace_syscalls(void);
23extern struct syscall_metadata *syscall_nr_to_meta(int nr); 36extern struct syscall_metadata *syscall_nr_to_meta(int nr);
24extern void start_ftrace_syscalls(void); 37extern int syscall_name_to_nr(char *name);
25extern void stop_ftrace_syscalls(void); 38void set_syscall_enter_id(int num, int id);
26extern void ftrace_syscall_enter(struct pt_regs *regs); 39void set_syscall_exit_id(int num, int id);
27extern void ftrace_syscall_exit(struct pt_regs *regs); 40extern struct trace_event event_syscall_enter;
28#else 41extern struct trace_event event_syscall_exit;
29static inline void start_ftrace_syscalls(void) { } 42extern int reg_event_syscall_enter(void *ptr);
30static inline void stop_ftrace_syscalls(void) { } 43extern void unreg_event_syscall_enter(void *ptr);
31static inline void ftrace_syscall_enter(struct pt_regs *regs) { } 44extern int reg_event_syscall_exit(void *ptr);
32static inline void ftrace_syscall_exit(struct pt_regs *regs) { } 45extern void unreg_event_syscall_exit(void *ptr);
46extern int syscall_enter_format(struct ftrace_event_call *call,
47 struct trace_seq *s);
48extern int syscall_exit_format(struct ftrace_event_call *call,
49 struct trace_seq *s);
50extern int syscall_enter_define_fields(struct ftrace_event_call *call);
51extern int syscall_exit_define_fields(struct ftrace_event_call *call);
52enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
53enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
54#endif
55#ifdef CONFIG_EVENT_PROFILE
56int reg_prof_syscall_enter(char *name);
57void unreg_prof_syscall_enter(char *name);
58int reg_prof_syscall_exit(char *name);
59void unreg_prof_syscall_exit(char *name);
60
33#endif 61#endif
34 62
35#endif /* _TRACE_SYSCALL_H */ 63#endif /* _TRACE_SYSCALL_H */
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h
new file mode 100644
index 000000000000..c051a50ed528
--- /dev/null
+++ b/include/video/da8xx-fb.h
@@ -0,0 +1,103 @@
1/*
2 * Header file for TI DA8XX LCD controller platform data.
3 *
4 * Copyright (C) 2008-2009 MontaVista Software Inc.
5 * Copyright (C) 2008-2009 Texas Instruments Inc
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef DA8XX_FB_H
13#define DA8XX_FB_H
14
15enum panel_type {
16 QVGA = 0
17};
18
19enum panel_shade {
20 MONOCHROME = 0,
21 COLOR_ACTIVE,
22 COLOR_PASSIVE,
23};
24
25enum raster_load_mode {
26 LOAD_DATA = 1,
27 LOAD_PALETTE,
28};
29
30struct display_panel {
31 enum panel_type panel_type; /* QVGA */
32 int max_bpp;
33 int min_bpp;
34 enum panel_shade panel_shade;
35};
36
37struct da8xx_lcdc_platform_data {
38 const char manu_name[10];
39 void *controller_data;
40 const char type[25];
41};
42
43struct lcd_ctrl_config {
44 const struct display_panel *p_disp_panel;
45
46 /* AC Bias Pin Frequency */
47 int ac_bias;
48
49 /* AC Bias Pin Transitions per Interrupt */
50 int ac_bias_intrpt;
51
52 /* DMA burst size */
53 int dma_burst_sz;
54
55 /* Bits per pixel */
56 int bpp;
57
58 /* FIFO DMA Request Delay */
59 int fdd;
60
61 /* TFT Alternative Signal Mapping (Only for active) */
62 unsigned char tft_alt_mode;
63
64 /* 12 Bit Per Pixel (5-6-5) Mode (Only for passive) */
65 unsigned char stn_565_mode;
66
67 /* Mono 8-bit Mode: 1=D0-D7 or 0=D0-D3 */
68 unsigned char mono_8bit_mode;
69
70 /* Invert line clock */
71 unsigned char invert_line_clock;
72
73 /* Invert frame clock */
74 unsigned char invert_frm_clock;
75
76 /* Horizontal and Vertical Sync Edge: 0=rising 1=falling */
77 unsigned char sync_edge;
78
79 /* Horizontal and Vertical Sync: Control: 0=ignore */
80 unsigned char sync_ctrl;
81
82 /* Raster Data Order Select: 1=Most-to-least 0=Least-to-most */
83 unsigned char raster_order;
84};
85
86struct lcd_sync_arg {
87 int back_porch;
88 int front_porch;
89 int pulse_width;
90};
91
92/* ioctls */
93#define FBIOGET_CONTRAST _IOR('F', 1, int)
94#define FBIOPUT_CONTRAST _IOW('F', 2, int)
95#define FBIGET_BRIGHTNESS _IOR('F', 3, int)
96#define FBIPUT_BRIGHTNESS _IOW('F', 3, int)
97#define FBIGET_COLOR _IOR('F', 5, int)
98#define FBIPUT_COLOR _IOW('F', 6, int)
99#define FBIPUT_HSYNC _IOW('F', 9, int)
100#define FBIPUT_VSYNC _IOW('F', 10, int)
101
102#endif /* ifndef DA8XX_FB_H */
103