aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild22
-rw-r--r--include/linux/acpi.h20
-rw-r--r--include/linux/acpi_io.h15
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/agp_backend.h2
-rw-r--r--include/linux/alarmtimer.h40
-rw-r--r--include/linux/amba/bus.h16
-rw-r--r--include/linux/amba/clcd.h92
-rw-r--r--include/linux/amba/mmci.h17
-rw-r--r--include/linux/amba/pl08x.h223
-rw-r--r--include/linux/amba/serial.h22
-rw-r--r--include/linux/ata.h163
-rw-r--r--include/linux/ath9k_platform.h7
-rw-r--r--include/linux/atmdev.h7
-rw-r--r--include/linux/atomic.h37
-rw-r--r--include/linux/audit.h12
-rw-r--r--include/linux/auto_fs4.h2
-rw-r--r--include/linux/average.h30
-rw-r--r--include/linux/backing-dev.h19
-rw-r--r--include/linux/backlight.h9
-rw-r--r--include/linux/basic_mmio_gpio.h20
-rw-r--r--include/linux/bch.h79
-rw-r--r--include/linux/bcma/bcma.h224
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h302
-rw-r--r--include/linux/bcma/bcma_driver_pci.h89
-rw-r--r--include/linux/bcma/bcma_regs.h34
-rw-r--r--include/linux/bfin_mac.h1
-rw-r--r--include/linux/binfmts.h10
-rw-r--r--include/linux/bio.h5
-rw-r--r--include/linux/bit_spinlock.h12
-rw-r--r--include/linux/bitops.h11
-rw-r--r--include/linux/blk_types.h12
-rw-r--r--include/linux/blkdev.h164
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/bootmem.h8
-rw-r--r--include/linux/bsearch.h9
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/caif/Kbuild2
-rw-r--r--include/linux/can/core.h13
-rw-r--r--include/linux/can/error.h2
-rw-r--r--include/linux/can/netlink.h2
-rw-r--r--include/linux/can/platform/mcp251x.h2
-rw-r--r--include/linux/capability.h61
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/cdk.h2
-rw-r--r--include/linux/cdrom.h6
-rw-r--r--include/linux/ceph/auth.h4
-rw-r--r--include/linux/ceph/ceph_fs.h35
-rw-r--r--include/linux/ceph/libceph.h10
-rw-r--r--include/linux/ceph/messenger.h8
-rw-r--r--include/linux/ceph/osd_client.h64
-rw-r--r--include/linux/ceph/rados.h39
-rw-r--r--include/linux/cfag12864b.h2
-rw-r--r--include/linux/cgroup.h12
-rw-r--r--include/linux/cgroup_subsys.h4
-rw-r--r--include/linux/clkdev.h36
-rw-r--r--include/linux/clockchips.h56
-rw-r--r--include/linux/clocksource.h34
-rw-r--r--include/linux/cm4000_cs.h2
-rw-r--r--include/linux/cnt32_to_63.h20
-rw-r--r--include/linux/coda_cache.h22
-rw-r--r--include/linux/coda_fs_i.h58
-rw-r--r--include/linux/coda_linux.h99
-rw-r--r--include/linux/compaction.h20
-rw-r--r--include/linux/compiler-gcc.h8
-rw-r--r--include/linux/compiler-gcc3.h8
-rw-r--r--include/linux/compiler-gcc4.h8
-rw-r--r--include/linux/completion.h18
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/connector.h36
-rw-r--r--include/linux/console.h14
-rw-r--r--include/linux/cper.h90
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpu_rmap.h73
-rw-r--r--include/linux/cpufreq.h63
-rw-r--r--include/linux/cpuidle.h6
-rw-r--r--include/linux/cramfs_fs.h2
-rw-r--r--include/linux/crash_dump.h9
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/cred.h10
-rw-r--r--include/linux/cs5535.h6
-rw-r--r--include/linux/davinci_emac.h1
-rw-r--r--include/linux/dcache.h258
-rw-r--r--include/linux/dcbnl.h295
-rw-r--r--include/linux/dccp.h29
-rw-r--r--include/linux/dcookies.h2
-rw-r--r--include/linux/debugobjects.h5
-rw-r--r--include/linux/decompress/inflate.h3
-rw-r--r--include/linux/decompress/mm.h8
-rw-r--r--include/linux/decompress/unxz.h19
-rw-r--r--include/linux/device-mapper.h14
-rw-r--r--include/linux/device.h187
-rw-r--r--include/linux/dm-ioctl.h18
-rw-r--r--include/linux/dm-log-userspace.h13
-rw-r--r--include/linux/dmaengine.h75
-rw-r--r--include/linux/dmar.h17
-rw-r--r--include/linux/dmi.h47
-rw-r--r--include/linux/drbd.h27
-rw-r--r--include/linux/drbd_limits.h18
-rw-r--r--include/linux/drbd_nl.h13
-rw-r--r--include/linux/drbd_tag_magic.h1
-rw-r--r--include/linux/dw_dmac.h44
-rw-r--r--include/linux/dynamic_debug.h26
-rw-r--r--include/linux/efi.h37
-rw-r--r--include/linux/elevator.h23
-rw-r--r--include/linux/err.h8
-rw-r--r--include/linux/etherdevice.h15
-rw-r--r--include/linux/ethtool.h430
-rw-r--r--include/linux/eventpoll.h2
-rw-r--r--include/linux/exportfs.h11
-rw-r--r--include/linux/ext3_fs.h23
-rw-r--r--include/linux/falloc.h1
-rw-r--r--include/linux/fanotify.h46
-rw-r--r--include/linux/fb.h21
-rw-r--r--include/linux/fcntl.h2
-rw-r--r--include/linux/fec.h3
-rw-r--r--include/linux/file.h4
-rw-r--r--include/linux/filter.h132
-rw-r--r--include/linux/firewire-cdev.h4
-rw-r--r--include/linux/firewire.h15
-rw-r--r--include/linux/firmware-map.h1
-rw-r--r--include/linux/firmware.h4
-rw-r--r--include/linux/flex_array.h4
-rw-r--r--include/linux/freezer.h2
-rw-r--r--include/linux/fs.h310
-rw-r--r--include/linux/fs_struct.h3
-rw-r--r--include/linux/fscache-cache.h2
-rw-r--r--include/linux/fscache.h6
-rw-r--r--include/linux/fsl-diu-fb.h1
-rw-r--r--include/linux/fsnotify.h37
-rw-r--r--include/linux/fsnotify_backend.h39
-rw-r--r--include/linux/ftrace.h37
-rw-r--r--include/linux/ftrace_event.h17
-rw-r--r--include/linux/fuse.h26
-rw-r--r--include/linux/generic_acl.h2
-rw-r--r--include/linux/genhd.h57
-rw-r--r--include/linux/gfp.h135
-rw-r--r--include/linux/gpio-i2cmux.h38
-rw-r--r--include/linux/gpio.h20
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/hardirq.h7
-rw-r--r--include/linux/hid-roccat.h29
-rw-r--r--include/linux/hid.h86
-rw-r--r--include/linux/hidraw.h3
-rw-r--r--include/linux/highmem.h78
-rw-r--r--include/linux/hp_sdc.h2
-rw-r--r--include/linux/hrtimer.h58
-rw-r--r--include/linux/huge_mm.h180
-rw-r--r--include/linux/hugetlb.h17
-rw-r--r--include/linux/hw_breakpoint.h4
-rw-r--r--include/linux/hwspinlock.h292
-rw-r--r--include/linux/i2c-id.h59
-rw-r--r--include/linux/i2c-omap.h5
-rw-r--r--include/linux/i2c-tegra.h25
-rw-r--r--include/linux/i2c.h49
-rw-r--r--include/linux/i2c/adp5588.h36
-rw-r--r--include/linux/i2c/ads1015.h36
-rw-r--r--include/linux/i2c/apds990x.h79
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h (renamed from include/linux/i2c/qt602240_ts.h)34
-rw-r--r--include/linux/i2c/bh1770glc.h53
-rw-r--r--include/linux/i2c/ds620.h21
-rw-r--r--include/linux/i2c/max6639.h14
-rw-r--r--include/linux/i2c/mcs.h1
-rw-r--r--include/linux/i2c/pmbus.h45
-rw-r--r--include/linux/i2c/pxa-i2c.h82
-rw-r--r--include/linux/i2c/twl.h90
-rw-r--r--include/linux/i2c/twl4030-madc.h141
-rw-r--r--include/linux/i2o.h2
-rw-r--r--include/linux/icmpv6.h4
-rw-r--r--include/linux/idr.h1
-rw-r--r--include/linux/ieee80211.h55
-rw-r--r--include/linux/if.h9
-rw-r--r--include/linux/if_alg.h40
-rw-r--r--include/linux/if_bridge.h4
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/if_link.h29
-rw-r--r--include/linux/if_macvlan.h34
-rw-r--r--include/linux/if_ppp.h16
-rw-r--r--include/linux/if_vlan.h36
-rw-r--r--include/linux/igmp.h20
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/inetdevice.h16
-rw-r--r--include/linux/init.h14
-rw-r--r--include/linux/init_task.h23
-rw-r--r--include/linux/input-polldev.h4
-rw-r--r--include/linux/input.h101
-rw-r--r--include/linux/input/as5011.h20
-rw-r--r--include/linux/input/bu21013.h4
-rw-r--r--include/linux/input/cma3000.h59
-rw-r--r--include/linux/input/matrix_keypad.h6
-rw-r--r--include/linux/input/mt.h63
-rw-r--r--include/linux/intel-gtt.h20
-rw-r--r--include/linux/intel_mid_dma.h16
-rw-r--r--include/linux/interrupt.h90
-rw-r--r--include/linux/io-mapping.h14
-rw-r--r--include/linux/iocontext.h1
-rw-r--r--include/linux/ioport.h1
-rw-r--r--include/linux/ip_vs.h8
-rw-r--r--include/linux/ipc_namespace.h10
-rw-r--r--include/linux/ipmi.h42
-rw-r--r--include/linux/ipmi_smi.h8
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/irq.h536
-rw-r--r--include/linux/irqdesc.h134
-rw-r--r--include/linux/irqnr.h2
-rw-r--r--include/linux/isdn/hdlc.h2
-rw-r--r--include/linux/ixjuser.h2
-rw-r--r--include/linux/jbd2.h50
-rw-r--r--include/linux/jhash.h183
-rw-r--r--include/linux/jiffies.h3
-rw-r--r--include/linux/journal-head.h7
-rw-r--r--include/linux/jump_label.h96
-rw-r--r--include/linux/jump_label_ref.h44
-rw-r--r--include/linux/kallsyms.h7
-rw-r--r--include/linux/kbd_kern.h5
-rw-r--r--include/linux/kd.h1
-rw-r--r--include/linux/kernel.h396
-rw-r--r--include/linux/kernel_stat.h29
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/key-type.h14
-rw-r--r--include/linux/key.h5
-rw-r--r--include/linux/keyctl.h2
-rw-r--r--include/linux/kfifo.h28
-rw-r--r--include/linux/kgdb.h14
-rw-r--r--include/linux/khugepaged.h67
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kmemcheck.h2
-rw-r--r--include/linux/kmod.h1
-rw-r--r--include/linux/kmsg_dump.h4
-rw-r--r--include/linux/kobject.h10
-rw-r--r--include/linux/kprobes.h8
-rw-r--r--include/linux/kref.h2
-rw-r--r--include/linux/kthread.h61
-rw-r--r--include/linux/ktime.h4
-rw-r--r--include/linux/kvm.h1
-rw-r--r--include/linux/kvm_host.h132
-rw-r--r--include/linux/kvm_types.h7
-rw-r--r--include/linux/led-lm3530.h107
-rw-r--r--include/linux/leds-lp5521.h48
-rw-r--r--include/linux/leds-lp5523.h48
-rw-r--r--include/linux/leds.h54
-rw-r--r--include/linux/libata.h24
-rw-r--r--include/linux/list.h53
-rw-r--r--include/linux/list_bl.h156
-rw-r--r--include/linux/lockd/debug.h10
-rw-r--r--include/linux/lockd/lockd.h7
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/lru_cache.h2
-rw-r--r--include/linux/magic.h4
-rw-r--r--include/linux/marvell_phy.h3
-rw-r--r--include/linux/math64.h12
-rw-r--r--include/linux/mbcache.h11
-rw-r--r--include/linux/mdio.h5
-rw-r--r--include/linux/media.h132
-rw-r--r--include/linux/memcontrol.h72
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/memory_hotplug.h30
-rw-r--r--include/linux/mfd/88pm860x.h22
-rw-r--r--include/linux/mfd/ab8500.h137
-rw-r--r--include/linux/mfd/ab8500/gpadc.h32
-rw-r--r--include/linux/mfd/ab8500/gpio.h21
-rw-r--r--include/linux/mfd/ab8500/sysctrl.h254
-rw-r--r--include/linux/mfd/abx500.h5
-rw-r--r--include/linux/mfd/core.h81
-rw-r--r--include/linux/mfd/max8997-private.h368
-rw-r--r--include/linux/mfd/max8997.h117
-rw-r--r--include/linux/mfd/max8998-private.h131
-rw-r--r--include/linux/mfd/max8998.h42
-rw-r--r--include/linux/mfd/mc13783.h308
-rw-r--r--include/linux/mfd/mc13892.h39
-rw-r--r--include/linux/mfd/mc13xxx.h153
-rw-r--r--include/linux/mfd/pcf50633/core.h7
-rw-r--r--include/linux/mfd/stmpe.h6
-rw-r--r--include/linux/mfd/tc35892.h136
-rw-r--r--include/linux/mfd/tc3589x.h195
-rw-r--r--include/linux/mfd/ti_ssp.h93
-rw-r--r--include/linux/mfd/tmio.h11
-rw-r--r--include/linux/mfd/tps6105x.h101
-rw-r--r--include/linux/mfd/tps6586x.h31
-rw-r--r--include/linux/mfd/wl1273-core.h290
-rw-r--r--include/linux/mfd/wm831x/core.h13
-rw-r--r--include/linux/mfd/wm831x/pdata.h11
-rw-r--r--include/linux/mfd/wm8350/audio.h3
-rw-r--r--include/linux/mfd/wm8350/pmic.h2
-rw-r--r--include/linux/mfd/wm8994/core.h13
-rw-r--r--include/linux/mfd/wm8994/pdata.h31
-rw-r--r--include/linux/mfd/wm8994/registers.h304
-rw-r--r--include/linux/micrel_phy.h16
-rw-r--r--include/linux/migrate.h24
-rw-r--r--include/linux/mlx4/cmd.h2
-rw-r--r--include/linux/mlx4/device.h96
-rw-r--r--include/linux/mlx4/driver.h5
-rw-r--r--include/linux/mlx4/qp.h10
-rw-r--r--include/linux/mm.h249
-rw-r--r--include/linux/mm_inline.h19
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/boot.h7
-rw-r--r--include/linux/mmc/card.h12
-rw-r--r--include/linux/mmc/core.h3
-rw-r--r--include/linux/mmc/dw_mmc.h222
-rw-r--r--include/linux/mmc/host.h68
-rw-r--r--include/linux/mmc/mmc.h15
-rw-r--r--include/linux/mmc/sdhci-pltfm.h (renamed from include/linux/sdhci-pltfm.h)2
-rw-r--r--include/linux/mmc/sdhci.h150
-rw-r--r--include/linux/mmc/sh_mmcif.h109
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h (renamed from include/linux/mfd/sh_mobile_sdhi.h)2
-rw-r--r--include/linux/mmc/tmio.h63
-rw-r--r--include/linux/mmu_notifier.h68
-rw-r--r--include/linux/mmzone.h26
-rw-r--r--include/linux/mod_devicetable.h17
-rw-r--r--include/linux/module.h65
-rw-r--r--include/linux/moduleparam.h17
-rw-r--r--include/linux/mount.h58
-rw-r--r--include/linux/mroute.h2
-rw-r--r--include/linux/mroute6.h3
-rw-r--r--include/linux/msm_mdp.h1
-rw-r--r--include/linux/mtd/bbm.h4
-rw-r--r--include/linux/mtd/blktrans.h3
-rw-r--r--include/linux/mtd/cfi.h7
-rw-r--r--include/linux/mtd/fsmc.h163
-rw-r--r--include/linux/mtd/inftl.h14
-rw-r--r--include/linux/mtd/latch-addr-flash.h29
-rw-r--r--include/linux/mtd/mtd.h26
-rw-r--r--include/linux/mtd/nand.h433
-rw-r--r--include/linux/mtd/nand_bch.h72
-rw-r--r--include/linux/mtd/onenand.h15
-rw-r--r--include/linux/mtd/onenand_regs.h1
-rw-r--r--include/linux/mtd/partitions.h7
-rw-r--r--include/linux/mtd/super.h5
-rw-r--r--include/linux/mtd/ubi.h22
-rw-r--r--include/linux/mtd/xip.h2
-rw-r--r--include/linux/mutex.h6
-rw-r--r--include/linux/namei.h24
-rw-r--r--include/linux/ncp_fs.h100
-rw-r--r--include/linux/ncp_fs_i.h29
-rw-r--r--include/linux/ncp_fs_sb.h164
-rw-r--r--include/linux/ncp_mount.h22
-rw-r--r--include/linux/net.h6
-rw-r--r--include/linux/netdevice.h473
-rw-r--r--include/linux/netfilter.h32
-rw-r--r--include/linux/netfilter/Kbuild7
-rw-r--r--include/linux/netfilter/ipset/Kbuild4
-rw-r--r--include/linux/netfilter/ipset/ip_set.h452
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h1073
-rw-r--r--include/linux/netfilter/ipset/ip_set_bitmap.h31
-rw-r--r--include/linux/netfilter/ipset/ip_set_getport.h33
-rw-r--r--include/linux/netfilter/ipset/ip_set_hash.h26
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h27
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h127
-rw-r--r--include/linux/netfilter/ipset/pfxlen.h35
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_snmp.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h9
-rw-r--r--include/linux/netfilter/nfnetlink_log.h4
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h4
-rw-r--r--include/linux/netfilter/x_tables.h99
-rw-r--r--include/linux/netfilter/xt_AUDIT.h30
-rw-r--r--include/linux/netfilter/xt_CT.h12
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h6
-rw-r--r--include/linux/netfilter/xt_TCPOPTSTRIP.h4
-rw-r--r--include/linux/netfilter/xt_TPROXY.h10
-rw-r--r--include/linux/netfilter/xt_addrtype.h44
-rw-r--r--include/linux/netfilter/xt_cluster.h10
-rw-r--r--include/linux/netfilter/xt_comment.h2
-rw-r--r--include/linux/netfilter/xt_connbytes.h4
-rw-r--r--include/linux/netfilter/xt_connlimit.h16
-rw-r--r--include/linux/netfilter/xt_conntrack.h15
-rw-r--r--include/linux/netfilter/xt_devgroup.h21
-rw-r--r--include/linux/netfilter/xt_quota.h8
-rw-r--r--include/linux/netfilter/xt_set.h56
-rw-r--r--include/linux/netfilter/xt_socket.h2
-rw-r--r--include/linux/netfilter/xt_time.h16
-rw-r--r--include/linux/netfilter/xt_u32.h18
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h14
-rw-r--r--include/linux/netfilter_bridge/ebt_ip6.h25
-rw-r--r--include/linux/netfilter_bridge/ebt_limit.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_log.h8
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_m.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h12
-rw-r--r--include/linux/netfilter_bridge/ebt_pkttype.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_stp.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_ulog.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h10
-rw-r--r--include/linux/netfilter_bridge/ebtables.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ECN.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_TTL.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_addrtype.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ah.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_ttl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_HL.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_REJECT.h4
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ah.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_frag.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_hl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ipv6header.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mh.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_opts.h12
-rw-r--r--include/linux/netfilter_ipv6/ip6t_rt.h13
-rw-r--r--include/linux/netlink.h6
-rw-r--r--include/linux/nfc/pn544.h97
-rw-r--r--include/linux/nfs3.h3
-rw-r--r--include/linux/nfs4.h83
-rw-r--r--include/linux/nfs4_acl.h61
-rw-r--r--include/linux/nfs_fs.h27
-rw-r--r--include/linux/nfs_fs_sb.h31
-rw-r--r--include/linux/nfs_idmap.h9
-rw-r--r--include/linux/nfs_iostat.h2
-rw-r--r--include/linux/nfs_page.h15
-rw-r--r--include/linux/nfs_xdr.h140
-rw-r--r--include/linux/nfsacl.h4
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/nfsd/nfsfh.h2
-rw-r--r--include/linux/nfsd_idmap.h64
-rw-r--r--include/linux/nilfs2_fs.h32
-rw-r--r--include/linux/nl80211.h578
-rw-r--r--include/linux/nmi.h10
-rw-r--r--include/linux/node.h11
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/of.h18
-rw-r--r--include/linux/of_address.h6
-rw-r--r--include/linux/of_device.h7
-rw-r--r--include/linux/of_fdt.h20
-rw-r--r--include/linux/of_irq.h1
-rw-r--r--include/linux/of_net.h15
-rw-r--r--include/linux/of_pci.h9
-rw-r--r--include/linux/of_platform.h21
-rw-r--r--include/linux/omap3isp.h646
-rw-r--r--include/linux/oprofile.h20
-rw-r--r--include/linux/page-flags.h73
-rw-r--r--include/linux/page_cgroup.h102
-rw-r--r--include/linux/pageblock-flags.h5
-rw-r--r--include/linux/pagemap.h22
-rw-r--r--include/linux/pata_arasan_cf_data.h49
-rw-r--r--include/linux/pci-acpi.h7
-rw-r--r--include/linux/pci-aspm.h9
-rw-r--r--include/linux/pci-ats.h52
-rw-r--r--include/linux/pci.h37
-rw-r--r--include/linux/pci_ids.h49
-rw-r--r--include/linux/pci_regs.h20
-rw-r--r--include/linux/percpu-defs.h12
-rw-r--r--include/linux/percpu.h333
-rw-r--r--include/linux/percpu_counter.h10
-rw-r--r--include/linux/perf_event.h216
-rw-r--r--include/linux/phonet.h4
-rw-r--r--include/linux/phy.h12
-rw-r--r--include/linux/pid.h15
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pkt_sched.h124
-rw-r--r--include/linux/platform_data/msm_serial_hs.h49
-rw-r--r--include/linux/platform_data/tegra_usb.h31
-rw-r--r--include/linux/platform_data/uio_pruss.h25
-rw-r--r--include/linux/platform_device.h79
-rw-r--r--include/linux/plist.h47
-rw-r--r--include/linux/pm.h91
-rw-r--r--include/linux/pm_runtime.h64
-rw-r--r--include/linux/pm_wakeup.h33
-rw-r--r--include/linux/poll.h6
-rw-r--r--include/linux/posix-clock.h151
-rw-r--r--include/linux/posix-timers.h46
-rw-r--r--include/linux/posix_acl.h20
-rw-r--r--include/linux/power/bq20z75.h39
-rw-r--r--include/linux/power/bq27x00_battery.h19
-rw-r--r--include/linux/power/gpio-charger.h41
-rw-r--r--include/linux/power/max17042_battery.h30
-rw-r--r--include/linux/power_supply.h53
-rw-r--r--include/linux/pps.h7
-rw-r--r--include/linux/pps_kernel.h61
-rw-r--r--include/linux/prefetch.h2
-rw-r--r--include/linux/printk.h302
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/pstore.h62
-rw-r--r--include/linux/ptrace.h28
-rw-r--r--include/linux/pwm_backlight.h4
-rw-r--r--include/linux/pxa2xx_ssp.h209
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h11
-rw-r--r--include/linux/radix-tree.h55
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/ramfs.h4
-rw-r--r--include/linux/ramoops.h15
-rw-r--r--include/linux/rar_register.h16
-rw-r--r--include/linux/ratelimit.h2
-rw-r--r--include/linux/rbtree.h8
-rw-r--r--include/linux/rculist.h21
-rw-r--r--include/linux/rculist_bl.h128
-rw-r--r--include/linux/rcupdate.h94
-rw-r--r--include/linux/rcutiny.h21
-rw-r--r--include/linux/rcutree.h15
-rw-r--r--include/linux/regulator/ab8500.h73
-rw-r--r--include/linux/regulator/consumer.h3
-rw-r--r--include/linux/regulator/driver.h30
-rw-r--r--include/linux/regulator/lp3972.h48
-rw-r--r--include/linux/regulator/machine.h6
-rw-r--r--include/linux/regulator/max8952.h135
-rw-r--r--include/linux/reiserfs_fs.h32
-rw-r--r--include/linux/reiserfs_xattr.h4
-rw-r--r--include/linux/res_counter.h52
-rw-r--r--include/linux/resource.h1
-rw-r--r--include/linux/rfkill-regulator.h48
-rw-r--r--include/linux/rfkill.h31
-rw-r--r--include/linux/ring_buffer.h14
-rw-r--r--include/linux/rio.h130
-rw-r--r--include/linux/rio_drv.h79
-rw-r--r--include/linux/rio_ids.h5
-rw-r--r--include/linux/rio_regs.h22
-rw-r--r--include/linux/rmap.h77
-rw-r--r--include/linux/romfs_fs.h3
-rw-r--r--include/linux/rtc.h49
-rw-r--r--include/linux/rtnetlink.h2
-rw-r--r--include/linux/rwlock_types.h8
-rw-r--r--include/linux/rwsem-spinlock.h31
-rw-r--r--include/linux/rwsem.h53
-rw-r--r--include/linux/s3c_adc_battery.h1
-rw-r--r--include/linux/sched.h209
-rw-r--r--include/linux/security.h116
-rw-r--r--include/linux/semaphore.h6
-rw-r--r--include/linux/seqlock.h84
-rw-r--r--include/linux/serial_core.h12
-rw-r--r--include/linux/serial_reg.h19
-rw-r--r--include/linux/serial_sci.h38
-rw-r--r--include/linux/sfi.h32
-rw-r--r--include/linux/sh_clk.h38
-rw-r--r--include/linux/sh_intc.h5
-rw-r--r--include/linux/sh_timer.h1
-rw-r--r--include/linux/sigma.h60
-rw-r--r--include/linux/signal.h15
-rw-r--r--include/linux/signalfd.h3
-rw-r--r--include/linux/skbuff.h62
-rw-r--r--include/linux/slab.h3
-rw-r--r--include/linux/slab_def.h33
-rw-r--r--include/linux/slub_def.h64
-rw-r--r--include/linux/sm501.h8
-rw-r--r--include/linux/smb.h118
-rw-r--r--include/linux/smb_fs.h153
-rw-r--r--include/linux/smb_fs_i.h37
-rw-r--r--include/linux/smb_fs_sb.h100
-rw-r--r--include/linux/smb_mount.h65
-rw-r--r--include/linux/smbno.h363
-rw-r--r--include/linux/smc91x.h2
-rw-r--r--include/linux/smp.h22
-rw-r--r--include/linux/smp_lock.h68
-rw-r--r--include/linux/smsc911x.h1
-rw-r--r--include/linux/snmp.h1
-rw-r--r--include/linux/socket.h19
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/sonypi.h2
-rw-r--r--include/linux/soundcard.h2
-rw-r--r--include/linux/spi/74x164.h11
-rw-r--r--include/linux/spi/dw_spi.h219
-rw-r--r--include/linux/spi/ifx_modem.h19
-rw-r--r--include/linux/spi/mcp23s08.h15
-rw-r--r--include/linux/spi/pxa2xx_spi.h152
-rw-r--r--include/linux/spi/spi.h3
-rw-r--r--include/linux/spi/spi_oc_tiny.h20
-rw-r--r--include/linux/spi/spidev.h2
-rw-r--r--include/linux/spi/tsc2005.h41
-rw-r--r--include/linux/spinlock.h2
-rw-r--r--include/linux/spinlock_types.h8
-rw-r--r--include/linux/spinlock_up.h2
-rw-r--r--include/linux/ssb/ssb.h11
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h11
-rw-r--r--include/linux/ssb/ssb_driver_gige.h17
-rw-r--r--include/linux/ssb/ssb_regs.h49
-rw-r--r--include/linux/stacktrace.h4
-rw-r--r--include/linux/stmmac.h10
-rw-r--r--include/linux/stop_machine.h2
-rw-r--r--include/linux/string.h1
-rw-r--r--include/linux/sunrpc/auth.h12
-rw-r--r--include/linux/sunrpc/bc_xprt.h2
-rw-r--r--include/linux/sunrpc/cache.h45
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/gss_api.h3
-rw-r--r--include/linux/sunrpc/gss_spkm3.h55
-rw-r--r--include/linux/sunrpc/sched.h6
-rw-r--r--include/linux/sunrpc/stats.h23
-rw-r--r--include/linux/sunrpc/svc.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h44
-rw-r--r--include/linux/sunrpc/svcauth.h17
-rw-r--r--include/linux/sunrpc/svcauth_gss.h2
-rw-r--r--include/linux/sunrpc/svcsock.h1
-rw-r--r--include/linux/sunrpc/xdr.h21
-rw-r--r--include/linux/sunrpc/xprt.h8
-rw-r--r--include/linux/suspend.h40
-rw-r--r--include/linux/svga.h34
-rw-r--r--include/linux/swap.h24
-rw-r--r--include/linux/synclink.h5
-rw-r--r--include/linux/syscalls.h56
-rw-r--r--include/linux/syscore_ops.h29
-rw-r--r--include/linux/sysctl.h14
-rw-r--r--include/linux/sysdev.h14
-rw-r--r--include/linux/sysfs.h5
-rw-r--r--include/linux/sysrq.h3
-rw-r--r--include/linux/taskstats.h3
-rw-r--r--include/linux/thermal.h55
-rw-r--r--include/linux/thread_info.h3
-rw-r--r--include/linux/ti_wilink_st.h423
-rw-r--r--include/linux/time.h19
-rw-r--r--include/linux/timer.h32
-rw-r--r--include/linux/timerqueue.h50
-rw-r--r--include/linux/timex.h4
-rw-r--r--include/linux/tipc.h28
-rw-r--r--include/linux/tipc_config.h114
-rw-r--r--include/linux/toshiba.h2
-rw-r--r--include/linux/tpm.h4
-rw-r--r--include/linux/tpm_command.h28
-rw-r--r--include/linux/tracehook.h33
-rw-r--r--include/linux/tracepoint.h86
-rw-r--r--include/linux/tty.h19
-rw-r--r--include/linux/tty_driver.h22
-rw-r--r--include/linux/tty_ldisc.h7
-rw-r--r--include/linux/types.h26
-rw-r--r--include/linux/u64_stats_sync.h12
-rw-r--r--include/linux/ucb1400.h2
-rw-r--r--include/linux/uinput.h1
-rw-r--r--include/linux/uio_driver.h2
-rw-r--r--include/linux/unaligned/packed_struct.h6
-rw-r--r--include/linux/usb.h18
-rw-r--r--include/linux/usb/Kbuild1
-rw-r--r--include/linux/usb/cdc.h23
-rw-r--r--include/linux/usb/ch11.h93
-rw-r--r--include/linux/usb/ch9.h14
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/functionfs.h4
-rw-r--r--include/linux/usb/gadget.h4
-rw-r--r--include/linux/usb/hcd.h48
-rw-r--r--include/linux/usb/midi.h2
-rw-r--r--include/linux/usb/msm_hsusb.h112
-rw-r--r--include/linux/usb/msm_hsusb_hw.h55
-rw-r--r--include/linux/usb/musb.h10
-rw-r--r--include/linux/usb/otg.h9
-rw-r--r--include/linux/usb/rndis_host.h2
-rw-r--r--include/linux/usb/serial.h12
-rw-r--r--include/linux/usb/ulpi.h5
-rw-r--r--include/linux/usb/usbnet.h12
-rw-r--r--include/linux/usb/wusb.h2
-rw-r--r--include/linux/user_namespace.h2
-rw-r--r--include/linux/utsname.h10
-rw-r--r--include/linux/uwb.h6
-rw-r--r--include/linux/uwb/umc.h2
-rw-r--r--include/linux/v4l2-mediabus.h111
-rw-r--r--include/linux/v4l2-subdev.h141
-rw-r--r--include/linux/vga_switcheroo.h2
-rw-r--r--include/linux/vgaarb.h4
-rw-r--r--include/linux/via-core.h19
-rw-r--r--include/linux/video_output.h15
-rw-r--r--include/linux/videodev.h340
-rw-r--r--include/linux/videodev2.h159
-rw-r--r--include/linux/videotext.h125
-rw-r--r--include/linux/virtio_9p.h1
-rw-r--r--include/linux/virtio_config.h5
-rw-r--r--include/linux/virtio_console.h3
-rw-r--r--include/linux/vmalloc.h46
-rw-r--r--include/linux/vmstat.h18
-rw-r--r--include/linux/vt_kern.h8
-rw-r--r--include/linux/wimax.h2
-rw-r--r--include/linux/wl12xx.h27
-rw-r--r--include/linux/workqueue.h30
-rw-r--r--include/linux/writeback.h10
-rw-r--r--include/linux/xattr.h6
-rw-r--r--include/linux/xfrm.h14
-rw-r--r--include/linux/xilinxfb.h2
-rw-r--r--include/linux/xz.h264
-rw-r--r--include/linux/zlib.h11
671 files changed, 23261 insertions, 7131 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 831c4634162c..75cf611641e6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,5 +1,6 @@
1header-y += byteorder/ 1header-y += byteorder/
2header-y += can/ 2header-y += can/
3header-y += caif/
3header-y += dvb/ 4header-y += dvb/
4header-y += hdlc/ 5header-y += hdlc/
5header-y += isdn/ 6header-y += isdn/
@@ -20,15 +21,18 @@ header-y += wimax/
20objhdr-y += version.h 21objhdr-y += version.h
21 22
22ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 23ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
23 $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 24 $(srctree)/include/asm-$(SRCARCH)/a.out.h \
25 $(INSTALL_HDR_PATH)/include/asm-*/a.out.h),)
24header-y += a.out.h 26header-y += a.out.h
25endif 27endif
26ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ 28ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
27 $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 29 $(srctree)/include/asm-$(SRCARCH)/kvm.h \
30 $(INSTALL_HDR_PATH)/include/asm-*/kvm.h),)
28header-y += kvm.h 31header-y += kvm.h
29endif 32endif
30ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \ 33ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
31 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),) 34 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h \
35 $(INSTALL_HDR_PATH)/include/asm-*/kvm_para.h),)
32header-y += kvm_para.h 36header-y += kvm_para.h
33endif 37endif
34 38
@@ -118,6 +122,7 @@ header-y += eventpoll.h
118header-y += ext2_fs.h 122header-y += ext2_fs.h
119header-y += fadvise.h 123header-y += fadvise.h
120header-y += falloc.h 124header-y += falloc.h
125header-y += fanotify.h
121header-y += fb.h 126header-y += fb.h
122header-y += fcntl.h 127header-y += fcntl.h
123header-y += fd.h 128header-y += fd.h
@@ -154,6 +159,7 @@ header-y += icmpv6.h
154header-y += if.h 159header-y += if.h
155header-y += if_addr.h 160header-y += if_addr.h
156header-y += if_addrlabel.h 161header-y += if_addrlabel.h
162header-y += if_alg.h
157header-y += if_arcnet.h 163header-y += if_arcnet.h
158header-y += if_arp.h 164header-y += if_arp.h
159header-y += if_bonding.h 165header-y += if_bonding.h
@@ -227,6 +233,7 @@ header-y += magic.h
227header-y += major.h 233header-y += major.h
228header-y += map_to_7segment.h 234header-y += map_to_7segment.h
229header-y += matroxfb.h 235header-y += matroxfb.h
236header-y += media.h
230header-y += mempolicy.h 237header-y += mempolicy.h
231header-y += meye.h 238header-y += meye.h
232header-y += mii.h 239header-y += mii.h
@@ -270,6 +277,7 @@ header-y += nfsacl.h
270header-y += nl80211.h 277header-y += nl80211.h
271header-y += nubus.h 278header-y += nubus.h
272header-y += nvram.h 279header-y += nvram.h
280header-y += omap3isp.h
273header-y += omapfb.h 281header-y += omapfb.h
274header-y += oom.h 282header-y += oom.h
275header-y += param.h 283header-y += param.h
@@ -326,10 +334,6 @@ header-y += serio.h
326header-y += shm.h 334header-y += shm.h
327header-y += signal.h 335header-y += signal.h
328header-y += signalfd.h 336header-y += signalfd.h
329header-y += smb.h
330header-y += smb_fs.h
331header-y += smb_mount.h
332header-y += smbno.h
333header-y += snmp.h 337header-y += snmp.h
334header-y += socket.h 338header-y += socket.h
335header-y += sockios.h 339header-y += sockios.h
@@ -368,11 +372,11 @@ header-y += unistd.h
368header-y += usbdevice_fs.h 372header-y += usbdevice_fs.h
369header-y += utime.h 373header-y += utime.h
370header-y += utsname.h 374header-y += utsname.h
375header-y += v4l2-mediabus.h
376header-y += v4l2-subdev.h
371header-y += veth.h 377header-y += veth.h
372header-y += vhost.h 378header-y += vhost.h
373header-y += videodev.h
374header-y += videodev2.h 379header-y += videodev2.h
375header-y += videotext.h
376header-y += virtio_9p.h 380header-y += virtio_9p.h
377header-y += virtio_balloon.h 381header-y += virtio_balloon.h
378header-y += virtio_blk.h 382header-y += virtio_blk.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index c227757feb06..a2e910e01293 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -219,7 +219,7 @@ static inline int acpi_video_display_switch_support(void)
219 219
220extern int acpi_blacklisted(void); 220extern int acpi_blacklisted(void);
221extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 221extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
222extern int acpi_osi_setup(char *str); 222extern void acpi_osi_setup(char *str);
223 223
224#ifdef CONFIG_ACPI_NUMA 224#ifdef CONFIG_ACPI_NUMA
225int acpi_get_pxm(acpi_handle handle); 225int acpi_get_pxm(acpi_handle handle);
@@ -245,8 +245,6 @@ int acpi_check_resource_conflict(const struct resource *res);
245 245
246int acpi_check_region(resource_size_t start, resource_size_t n, 246int acpi_check_region(resource_size_t start, resource_size_t n,
247 const char *name); 247 const char *name);
248int acpi_check_mem_region(resource_size_t start, resource_size_t n,
249 const char *name);
250 248
251int acpi_resources_are_enforced(void); 249int acpi_resources_are_enforced(void);
252 250
@@ -344,12 +342,6 @@ static inline int acpi_check_region(resource_size_t start, resource_size_t n,
344 return 0; 342 return 0;
345} 343}
346 344
347static inline int acpi_check_mem_region(resource_size_t start,
348 resource_size_t n, const char *name)
349{
350 return 0;
351}
352
353struct acpi_table_header; 345struct acpi_table_header;
354static inline int acpi_table_parse(char *id, 346static inline int acpi_table_parse(char *id,
355 int (*handler)(struct acpi_table_header *)) 347 int (*handler)(struct acpi_table_header *))
@@ -357,4 +349,14 @@ static inline int acpi_table_parse(char *id,
357 return -1; 349 return -1;
358} 350}
359#endif /* !CONFIG_ACPI */ 351#endif /* !CONFIG_ACPI */
352
353#ifdef CONFIG_ACPI_SLEEP
354int suspend_nvs_register(unsigned long start, unsigned long size);
355#else
356static inline int suspend_nvs_register(unsigned long a, unsigned long b)
357{
358 return 0;
359}
360#endif
361
360#endif /*_LINUX_ACPI_H*/ 362#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
new file mode 100644
index 000000000000..4afd7102459d
--- /dev/null
+++ b/include/linux/acpi_io.h
@@ -0,0 +1,15 @@
1#ifndef _ACPI_IO_H_
2#define _ACPI_IO_H_
3
4#include <linux/io.h>
5#include <acpi/acpi.h>
6
7static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
8 acpi_size size)
9{
10 return ioremap_cache(phys, size);
11}
12
13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14
15#endif
diff --git a/include/linux/aer.h b/include/linux/aer.h
index f7df1eefc107..8414de22a779 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,28 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10struct aer_header_log_regs {
11 unsigned int dw0;
12 unsigned int dw1;
13 unsigned int dw2;
14 unsigned int dw3;
15};
16
17struct aer_capability_regs {
18 u32 header;
19 u32 uncor_status;
20 u32 uncor_mask;
21 u32 uncor_severity;
22 u32 cor_status;
23 u32 cor_mask;
24 u32 cap_control;
25 struct aer_header_log_regs header_log;
26 u32 root_command;
27 u32 root_status;
28 u16 cor_err_source;
29 u16 uncor_err_source;
30};
31
10#if defined(CONFIG_PCIEAER) 32#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */ 33/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 34extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
@@ -27,5 +49,7 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
27} 49}
28#endif 50#endif
29 51
52extern void cper_print_aer(const char *prefix, int cper_severity,
53 struct aer_capability_regs *aer);
30#endif //_AER_H_ 54#endif //_AER_H_
31 55
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 09ea4a1e9505..eaf6cd75a1b1 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -102,10 +102,8 @@ extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t,
102extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); 102extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
103extern int agp_bind_memory(struct agp_memory *, off_t); 103extern int agp_bind_memory(struct agp_memory *, off_t);
104extern int agp_unbind_memory(struct agp_memory *); 104extern int agp_unbind_memory(struct agp_memory *);
105extern int agp_rebind_memory(void);
106extern void agp_enable(struct agp_bridge_data *, u32); 105extern void agp_enable(struct agp_bridge_data *, u32);
107extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); 106extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
108extern void agp_backend_release(struct agp_bridge_data *); 107extern void agp_backend_release(struct agp_bridge_data *);
109extern void agp_flush_chipset(struct agp_bridge_data *);
110 108
111#endif /* _AGP_BACKEND_H */ 109#endif /* _AGP_BACKEND_H */
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
new file mode 100644
index 000000000000..c5d6095b46f8
--- /dev/null
+++ b/include/linux/alarmtimer.h
@@ -0,0 +1,40 @@
1#ifndef _LINUX_ALARMTIMER_H
2#define _LINUX_ALARMTIMER_H
3
4#include <linux/time.h>
5#include <linux/hrtimer.h>
6#include <linux/timerqueue.h>
7#include <linux/rtc.h>
8
9enum alarmtimer_type {
10 ALARM_REALTIME,
11 ALARM_BOOTTIME,
12
13 ALARM_NUMTYPE,
14};
15
16/**
17 * struct alarm - Alarm timer structure
18 * @node: timerqueue node for adding to the event list this value
19 * also includes the expiration time.
20 * @period: Period for recuring alarms
21 * @function: Function pointer to be executed when the timer fires.
22 * @type: Alarm type (BOOTTIME/REALTIME)
23 * @enabled: Flag that represents if the alarm is set to fire or not
24 * @data: Internal data value.
25 */
26struct alarm {
27 struct timerqueue_node node;
28 ktime_t period;
29 void (*function)(struct alarm *);
30 enum alarmtimer_type type;
31 bool enabled;
32 void *data;
33};
34
35void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
36 void (*function)(struct alarm *));
37void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period);
38void alarm_cancel(struct alarm *alarm);
39
40#endif
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index c6454cca0447..fcbbe71a3cc1 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -18,6 +18,7 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/resource.h> 20#include <linux/resource.h>
21#include <linux/regulator/consumer.h>
21 22
22#define AMBA_NR_IRQS 2 23#define AMBA_NR_IRQS 2
23#define AMBA_CID 0xb105f00d 24#define AMBA_CID 0xb105f00d
@@ -28,6 +29,7 @@ struct amba_device {
28 struct device dev; 29 struct device dev;
29 struct resource res; 30 struct resource res;
30 struct clk *pclk; 31 struct clk *pclk;
32 struct regulator *vcore;
31 u64 dma_mask; 33 u64 dma_mask;
32 unsigned int periphid; 34 unsigned int periphid;
33 unsigned int irq[AMBA_NR_IRQS]; 35 unsigned int irq[AMBA_NR_IRQS];
@@ -41,12 +43,12 @@ struct amba_id {
41 43
42struct amba_driver { 44struct amba_driver {
43 struct device_driver drv; 45 struct device_driver drv;
44 int (*probe)(struct amba_device *, struct amba_id *); 46 int (*probe)(struct amba_device *, const struct amba_id *);
45 int (*remove)(struct amba_device *); 47 int (*remove)(struct amba_device *);
46 void (*shutdown)(struct amba_device *); 48 void (*shutdown)(struct amba_device *);
47 int (*suspend)(struct amba_device *, pm_message_t); 49 int (*suspend)(struct amba_device *, pm_message_t);
48 int (*resume)(struct amba_device *); 50 int (*resume)(struct amba_device *);
49 struct amba_id *id_table; 51 const struct amba_id *id_table;
50}; 52};
51 53
52enum amba_vendor { 54enum amba_vendor {
@@ -54,6 +56,10 @@ enum amba_vendor {
54 AMBA_VENDOR_ST = 0x80, 56 AMBA_VENDOR_ST = 0x80,
55}; 57};
56 58
59extern struct bus_type amba_bustype;
60
61#define to_amba_device(d) container_of(d, struct amba_device, dev)
62
57#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) 63#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
58#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) 64#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
59 65
@@ -71,6 +77,12 @@ void amba_release_regions(struct amba_device *);
71#define amba_pclk_disable(d) \ 77#define amba_pclk_disable(d) \
72 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0) 78 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
73 79
80#define amba_vcore_enable(d) \
81 (IS_ERR((d)->vcore) ? 0 : regulator_enable((d)->vcore))
82
83#define amba_vcore_disable(d) \
84 do { if (!IS_ERR((d)->vcore)) regulator_disable((d)->vcore); } while (0)
85
74/* Some drivers don't use the struct amba_device */ 86/* Some drivers don't use the struct amba_device */
75#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff) 87#define AMBA_CONFIG_BITS(a) (((a) >> 24) & 0xff)
76#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f) 88#define AMBA_REV_BITS(a) (((a) >> 20) & 0x0f)
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index be33b3affc8a..e82e3ee2c54a 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -53,6 +53,7 @@
53#define CNTL_LCDBPP8 (3 << 1) 53#define CNTL_LCDBPP8 (3 << 1)
54#define CNTL_LCDBPP16 (4 << 1) 54#define CNTL_LCDBPP16 (4 << 1)
55#define CNTL_LCDBPP16_565 (6 << 1) 55#define CNTL_LCDBPP16_565 (6 << 1)
56#define CNTL_LCDBPP16_444 (7 << 1)
56#define CNTL_LCDBPP24 (5 << 1) 57#define CNTL_LCDBPP24 (5 << 1)
57#define CNTL_LCDBW (1 << 4) 58#define CNTL_LCDBW (1 << 4)
58#define CNTL_LCDTFT (1 << 5) 59#define CNTL_LCDTFT (1 << 5)
@@ -66,6 +67,32 @@
66#define CNTL_LDMAFIFOTIME (1 << 15) 67#define CNTL_LDMAFIFOTIME (1 << 15)
67#define CNTL_WATERMARK (1 << 16) 68#define CNTL_WATERMARK (1 << 16)
68 69
70enum {
71 /* individual formats */
72 CLCD_CAP_RGB444 = (1 << 0),
73 CLCD_CAP_RGB5551 = (1 << 1),
74 CLCD_CAP_RGB565 = (1 << 2),
75 CLCD_CAP_RGB888 = (1 << 3),
76 CLCD_CAP_BGR444 = (1 << 4),
77 CLCD_CAP_BGR5551 = (1 << 5),
78 CLCD_CAP_BGR565 = (1 << 6),
79 CLCD_CAP_BGR888 = (1 << 7),
80
81 /* connection layouts */
82 CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444,
83 CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551,
84 CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565,
85 CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888,
86
87 /* red/blue ordering */
88 CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 |
89 CLCD_CAP_RGB565 | CLCD_CAP_RGB888,
90 CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 |
91 CLCD_CAP_BGR565 | CLCD_CAP_BGR888,
92
93 CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB,
94};
95
69struct clcd_panel { 96struct clcd_panel {
70 struct fb_videomode mode; 97 struct fb_videomode mode;
71 signed short width; /* width in mm */ 98 signed short width; /* width in mm */
@@ -73,6 +100,7 @@ struct clcd_panel {
73 u32 tim2; 100 u32 tim2;
74 u32 tim3; 101 u32 tim3;
75 u32 cntl; 102 u32 cntl;
103 u32 caps;
76 unsigned int bpp:8, 104 unsigned int bpp:8,
77 fixedtimings:1, 105 fixedtimings:1,
78 grayscale:1; 106 grayscale:1;
@@ -97,13 +125,18 @@ struct clcd_board {
97 const char *name; 125 const char *name;
98 126
99 /* 127 /*
128 * Optional. Hardware capability flags.
129 */
130 u32 caps;
131
132 /*
100 * Optional. Check whether the var structure is acceptable 133 * Optional. Check whether the var structure is acceptable
101 * for this display. 134 * for this display.
102 */ 135 */
103 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var); 136 int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);
104 137
105 /* 138 /*
106 * Compulsary. Decode fb->fb.var into regs->*. In the case of 139 * Compulsory. Decode fb->fb.var into regs->*. In the case of
107 * fixed timing, set regs->* to the register values required. 140 * fixed timing, set regs->* to the register values required.
108 */ 141 */
109 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs); 142 void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);
@@ -155,34 +188,35 @@ struct clcd_fb {
155 188
156static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 189static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
157{ 190{
191 struct fb_var_screeninfo *var = &fb->fb.var;
158 u32 val, cpl; 192 u32 val, cpl;
159 193
160 /* 194 /*
161 * Program the CLCD controller registers and start the CLCD 195 * Program the CLCD controller registers and start the CLCD
162 */ 196 */
163 val = ((fb->fb.var.xres / 16) - 1) << 2; 197 val = ((var->xres / 16) - 1) << 2;
164 val |= (fb->fb.var.hsync_len - 1) << 8; 198 val |= (var->hsync_len - 1) << 8;
165 val |= (fb->fb.var.right_margin - 1) << 16; 199 val |= (var->right_margin - 1) << 16;
166 val |= (fb->fb.var.left_margin - 1) << 24; 200 val |= (var->left_margin - 1) << 24;
167 regs->tim0 = val; 201 regs->tim0 = val;
168 202
169 val = fb->fb.var.yres; 203 val = var->yres;
170 if (fb->panel->cntl & CNTL_LCDDUAL) 204 if (fb->panel->cntl & CNTL_LCDDUAL)
171 val /= 2; 205 val /= 2;
172 val -= 1; 206 val -= 1;
173 val |= (fb->fb.var.vsync_len - 1) << 10; 207 val |= (var->vsync_len - 1) << 10;
174 val |= fb->fb.var.lower_margin << 16; 208 val |= var->lower_margin << 16;
175 val |= fb->fb.var.upper_margin << 24; 209 val |= var->upper_margin << 24;
176 regs->tim1 = val; 210 regs->tim1 = val;
177 211
178 val = fb->panel->tim2; 212 val = fb->panel->tim2;
179 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS; 213 val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
180 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS; 214 val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
181 215
182 cpl = fb->fb.var.xres_virtual; 216 cpl = var->xres_virtual;
183 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */ 217 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
184 /* / 1 */; 218 /* / 1 */;
185 else if (!fb->fb.var.grayscale) /* STN color */ 219 else if (!var->grayscale) /* STN color */
186 cpl = cpl * 8 / 3; 220 cpl = cpl * 8 / 3;
187 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */ 221 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
188 cpl /= 8; 222 cpl /= 8;
@@ -194,10 +228,22 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
194 regs->tim3 = fb->panel->tim3; 228 regs->tim3 = fb->panel->tim3;
195 229
196 val = fb->panel->cntl; 230 val = fb->panel->cntl;
197 if (fb->fb.var.grayscale) 231 if (var->grayscale)
198 val |= CNTL_LCDBW; 232 val |= CNTL_LCDBW;
199 233
200 switch (fb->fb.var.bits_per_pixel) { 234 if (fb->panel->caps && fb->board->caps &&
235 var->bits_per_pixel >= 16) {
236 /*
237 * if board and panel supply capabilities, we can support
238 * changing BGR/RGB depending on supplied parameters
239 */
240 if (var->red.offset == 0)
241 val &= ~CNTL_BGR;
242 else
243 val |= CNTL_BGR;
244 }
245
246 switch (var->bits_per_pixel) {
201 case 1: 247 case 1:
202 val |= CNTL_LCDBPP1; 248 val |= CNTL_LCDBPP1;
203 break; 249 break;
@@ -212,15 +258,17 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
212 break; 258 break;
213 case 16: 259 case 16:
214 /* 260 /*
215 * PL110 cannot choose between 5551 and 565 modes in 261 * PL110 cannot choose between 5551 and 565 modes in its
216 * its control register 262 * control register. It is possible to use 565 with
263 * custom external wiring.
217 */ 264 */
218 if ((fb->dev->periphid & 0x000fffff) == 0x00041110) 265 if (amba_part(fb->dev) == 0x110 ||
266 var->green.length == 5)
219 val |= CNTL_LCDBPP16; 267 val |= CNTL_LCDBPP16;
220 else if (fb->fb.var.green.length == 5) 268 else if (var->green.length == 6)
221 val |= CNTL_LCDBPP16;
222 else
223 val |= CNTL_LCDBPP16_565; 269 val |= CNTL_LCDBPP16_565;
270 else
271 val |= CNTL_LCDBPP16_444;
224 break; 272 break;
225 case 32: 273 case 32:
226 val |= CNTL_LCDBPP24; 274 val |= CNTL_LCDBPP24;
@@ -228,7 +276,7 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
228 } 276 }
229 277
230 regs->cntl = val; 278 regs->cntl = val;
231 regs->pixclock = fb->fb.var.pixclock; 279 regs->pixclock = var->pixclock;
232} 280}
233 281
234static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) 282static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index f4ee9acc9721..21114810c7c0 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,6 +6,9 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/* Just some dummy forwarding */
10struct dma_chan;
11
9/** 12/**
10 * struct mmci_platform_data - platform configuration for the MMCI 13 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block. 14 * (also known as PL180) block.
@@ -27,6 +30,17 @@
27 * @cd_invert: true if the gpio_cd pin value is active low 30 * @cd_invert: true if the gpio_cd pin value is active low
28 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
29 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @dma_filter: function used to select an appropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine
36 * @dma_rx_param: parameter passed to the DMA allocation
37 * filter in order to select an appropriate RX channel. If
38 * there is a bidirectional RX+TX channel, then just specify
39 * this and leave dma_tx_param set to NULL
40 * @dma_tx_param: parameter passed to the DMA allocation
41 * filter in order to select an appropriate TX channel. If this
42 * is NULL the driver will attempt to use the RX channel as a
43 * bidirectional channel
30 */ 44 */
31struct mmci_platform_data { 45struct mmci_platform_data {
32 unsigned int f_max; 46 unsigned int f_max;
@@ -38,6 +52,9 @@ struct mmci_platform_data {
38 int gpio_cd; 52 int gpio_cd;
39 bool cd_invert; 53 bool cd_invert;
40 unsigned long capabilities; 54 unsigned long capabilities;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param;
57 void *dma_tx_param;
41}; 58};
42 59
43#endif 60#endif
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
new file mode 100644
index 000000000000..3111385b8ca7
--- /dev/null
+++ b/include/linux/amba/pl08x.h
@@ -0,0 +1,223 @@
1/*
2 * linux/amba/pl08x.h - ARM PrimeCell DMA Controller driver
3 *
4 * Copyright (C) 2005 ARM Ltd
5 * Copyright (C) 2010 ST-Ericsson SA
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * pl08x information required by platform code
12 *
13 * Please credit ARM.com
14 * Documentation: ARM DDI 0196D
15 */
16
17#ifndef AMBA_PL08X_H
18#define AMBA_PL08X_H
19
20/* We need sizes of structs from this header */
21#include <linux/dmaengine.h>
22#include <linux/interrupt.h>
23
24struct pl08x_lli;
25struct pl08x_driver_data;
26
27/* Bitmasks for selecting AHB ports for DMA transfers */
28enum {
29 PL08X_AHB1 = (1 << 0),
30 PL08X_AHB2 = (1 << 1)
31};
32
33/**
34 * struct pl08x_channel_data - data structure to pass info between
35 * platform and PL08x driver regarding channel configuration
36 * @bus_id: name of this device channel, not just a device name since
37 * devices may have more than one channel e.g. "foo_tx"
38 * @min_signal: the minimum DMA signal number to be muxed in for this
39 * channel (for platforms supporting muxed signals). If you have
40 * static assignments, make sure this is set to the assigned signal
41 * number, PL08x have 16 possible signals in number 0 thru 15 so
42 * when these are not enough they often get muxed (in hardware)
43 * disabling simultaneous use of the same channel for two devices.
44 * @max_signal: the maximum DMA signal number to be muxed in for
45 * the channel. Set to the same as min_signal for
46 * devices with static assignments
47 * @muxval: a number usually used to poke into some mux regiser to
48 * mux in the signal to this channel
49 * @cctl_opt: default options for the channel control register
50 * @addr: source/target address in physical memory for this DMA channel,
51 * can be the address of a FIFO register for burst requests for example.
52 * This can be left undefined if the PrimeCell API is used for configuring
53 * this.
54 * @circular_buffer: whether the buffer passed in is circular and
55 * shall simply be looped round round (like a record baby round
56 * round round round)
57 * @single: the device connected to this channel will request single DMA
58 * transfers, not bursts. (Bursts are default.)
59 * @periph_buses: the device connected to this channel is accessible via
60 * these buses (use PL08X_AHB1 | PL08X_AHB2).
61 */
62struct pl08x_channel_data {
63 char *bus_id;
64 int min_signal;
65 int max_signal;
66 u32 muxval;
67 u32 cctl;
68 dma_addr_t addr;
69 bool circular_buffer;
70 bool single;
71 u8 periph_buses;
72};
73
74/**
75 * Struct pl08x_bus_data - information of source or destination
76 * busses for a transfer
77 * @addr: current address
78 * @maxwidth: the maximum width of a transfer on this bus
79 * @buswidth: the width of this bus in bytes: 1, 2 or 4
80 * @fill_bytes: bytes required to fill to the next bus memory boundary
81 */
82struct pl08x_bus_data {
83 dma_addr_t addr;
84 u8 maxwidth;
85 u8 buswidth;
86 size_t fill_bytes;
87};
88
89/**
90 * struct pl08x_phy_chan - holder for the physical channels
91 * @id: physical index to this channel
92 * @lock: a lock to use when altering an instance of this struct
93 * @signal: the physical signal (aka channel) serving this physical channel
94 * right now
95 * @serving: the virtual channel currently being served by this physical
96 * channel
97 */
98struct pl08x_phy_chan {
99 unsigned int id;
100 void __iomem *base;
101 spinlock_t lock;
102 int signal;
103 struct pl08x_dma_chan *serving;
104};
105
106/**
107 * struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
108 * @llis_bus: DMA memory address (physical) start for the LLIs
109 * @llis_va: virtual memory address start for the LLIs
110 */
111struct pl08x_txd {
112 struct dma_async_tx_descriptor tx;
113 struct list_head node;
114 enum dma_data_direction direction;
115 dma_addr_t src_addr;
116 dma_addr_t dst_addr;
117 size_t len;
118 dma_addr_t llis_bus;
119 struct pl08x_lli *llis_va;
120 /* Default cctl value for LLIs */
121 u32 cctl;
122 /*
123 * Settings to be put into the physical channel when we
124 * trigger this txd. Other registers are in llis_va[0].
125 */
126 u32 ccfg;
127};
128
129/**
130 * struct pl08x_dma_chan_state - holds the PL08x specific virtual channel
131 * states
132 * @PL08X_CHAN_IDLE: the channel is idle
133 * @PL08X_CHAN_RUNNING: the channel has allocated a physical transport
134 * channel and is running a transfer on it
135 * @PL08X_CHAN_PAUSED: the channel has allocated a physical transport
136 * channel, but the transfer is currently paused
137 * @PL08X_CHAN_WAITING: the channel is waiting for a physical transport
138 * channel to become available (only pertains to memcpy channels)
139 */
140enum pl08x_dma_chan_state {
141 PL08X_CHAN_IDLE,
142 PL08X_CHAN_RUNNING,
143 PL08X_CHAN_PAUSED,
144 PL08X_CHAN_WAITING,
145};
146
147/**
148 * struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
149 * @chan: wrappped abstract channel
150 * @phychan: the physical channel utilized by this channel, if there is one
151 * @phychan_hold: if non-zero, hold on to the physical channel even if we
152 * have no pending entries
153 * @tasklet: tasklet scheduled by the IRQ to handle actual work etc
154 * @name: name of channel
155 * @cd: channel platform data
156 * @runtime_addr: address for RX/TX according to the runtime config
157 * @runtime_direction: current direction of this channel according to
158 * runtime config
159 * @lc: last completed transaction on this channel
160 * @pend_list: queued transactions pending on this channel
161 * @at: active transaction on this channel
162 * @lock: a lock for this channel data
163 * @host: a pointer to the host (internal use)
164 * @state: whether the channel is idle, paused, running etc
165 * @slave: whether this channel is a device (slave) or for memcpy
166 * @waiting: a TX descriptor on this channel which is waiting for a physical
167 * channel to become available
168 */
169struct pl08x_dma_chan {
170 struct dma_chan chan;
171 struct pl08x_phy_chan *phychan;
172 int phychan_hold;
173 struct tasklet_struct tasklet;
174 char *name;
175 struct pl08x_channel_data *cd;
176 dma_addr_t runtime_addr;
177 enum dma_data_direction runtime_direction;
178 dma_cookie_t lc;
179 struct list_head pend_list;
180 struct pl08x_txd *at;
181 spinlock_t lock;
182 struct pl08x_driver_data *host;
183 enum pl08x_dma_chan_state state;
184 bool slave;
185 struct pl08x_txd *waiting;
186};
187
188/**
189 * struct pl08x_platform_data - the platform configuration for the PL08x
190 * PrimeCells.
191 * @slave_channels: the channels defined for the different devices on the
192 * platform, all inclusive, including multiplexed channels. The available
193 * physical channels will be multiplexed around these signals as they are
194 * requested, just enumerate all possible channels.
195 * @get_signal: request a physical signal to be used for a DMA transfer
196 * immediately: if there is some multiplexing or similar blocking the use
197 * of the channel the transfer can be denied by returning less than zero,
198 * else it returns the allocated signal number
199 * @put_signal: indicate to the platform that this physical signal is not
200 * running any DMA transfer and multiplexing can be recycled
201 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
202 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
203 */
204struct pl08x_platform_data {
205 struct pl08x_channel_data *slave_channels;
206 unsigned int num_slave_channels;
207 struct pl08x_channel_data memcpy_channel;
208 int (*get_signal)(struct pl08x_dma_chan *);
209 void (*put_signal)(struct pl08x_dma_chan *);
210 u8 lli_buses;
211 u8 mem_buses;
212};
213
214#ifdef CONFIG_AMBA_PL08X
215bool pl08x_filter_id(struct dma_chan *chan, void *chan_id);
216#else
217static inline bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
218{
219 return false;
220}
221#endif
222
223#endif /* AMBA_PL08X_H */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 6021588ba0a8..5479fdc849e9 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -113,6 +113,21 @@
113#define UART01x_LCRH_PEN 0x02 113#define UART01x_LCRH_PEN 0x02
114#define UART01x_LCRH_BRK 0x01 114#define UART01x_LCRH_BRK 0x01
115 115
116#define ST_UART011_DMAWM_RX_1 (0 << 3)
117#define ST_UART011_DMAWM_RX_2 (1 << 3)
118#define ST_UART011_DMAWM_RX_4 (2 << 3)
119#define ST_UART011_DMAWM_RX_8 (3 << 3)
120#define ST_UART011_DMAWM_RX_16 (4 << 3)
121#define ST_UART011_DMAWM_RX_32 (5 << 3)
122#define ST_UART011_DMAWM_RX_48 (6 << 3)
123#define ST_UART011_DMAWM_TX_1 0
124#define ST_UART011_DMAWM_TX_2 1
125#define ST_UART011_DMAWM_TX_4 2
126#define ST_UART011_DMAWM_TX_8 3
127#define ST_UART011_DMAWM_TX_16 4
128#define ST_UART011_DMAWM_TX_32 5
129#define ST_UART011_DMAWM_TX_48 6
130
116#define UART010_IIR_RTIS 0x08 131#define UART010_IIR_RTIS 0x08
117#define UART010_IIR_TIS 0x04 132#define UART010_IIR_TIS 0x04
118#define UART010_IIR_RIS 0x02 133#define UART010_IIR_RIS 0x02
@@ -180,6 +195,13 @@ struct amba_device; /* in uncompress this is included but amba/bus.h is not */
180struct amba_pl010_data { 195struct amba_pl010_data {
181 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl); 196 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl);
182}; 197};
198
199struct dma_chan;
200struct amba_pl011_data {
201 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
202 void *dma_rx_param;
203 void *dma_tx_param;
204};
183#endif 205#endif
184 206
185#endif 207#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 0c4929fa34d3..32df2b6ef0e0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -89,6 +89,7 @@ enum {
89 ATA_ID_SPG = 98, 89 ATA_ID_SPG = 98,
90 ATA_ID_LBA_CAPACITY_2 = 100, 90 ATA_ID_LBA_CAPACITY_2 = 100,
91 ATA_ID_SECTOR_SIZE = 106, 91 ATA_ID_SECTOR_SIZE = 106,
92 ATA_ID_WWN = 108,
92 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ 93 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
93 ATA_ID_LAST_LUN = 126, 94 ATA_ID_LAST_LUN = 126,
94 ATA_ID_DLF = 128, 95 ATA_ID_DLF = 128,
@@ -103,6 +104,7 @@ enum {
103 ATA_ID_SERNO_LEN = 20, 104 ATA_ID_SERNO_LEN = 20,
104 ATA_ID_FW_REV_LEN = 8, 105 ATA_ID_FW_REV_LEN = 8,
105 ATA_ID_PROD_LEN = 40, 106 ATA_ID_PROD_LEN = 40,
107 ATA_ID_WWN_LEN = 8,
106 108
107 ATA_PCI_CTL_OFS = 2, 109 ATA_PCI_CTL_OFS = 2,
108 110
@@ -598,42 +600,42 @@ static inline bool ata_id_has_dipm(const u16 *id)
598} 600}
599 601
600 602
601static inline int ata_id_has_fua(const u16 *id) 603static inline bool ata_id_has_fua(const u16 *id)
602{ 604{
603 if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) 605 if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000)
604 return 0; 606 return false;
605 return id[ATA_ID_CFSSE] & (1 << 6); 607 return id[ATA_ID_CFSSE] & (1 << 6);
606} 608}
607 609
608static inline int ata_id_has_flush(const u16 *id) 610static inline bool ata_id_has_flush(const u16 *id)
609{ 611{
610 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 612 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
611 return 0; 613 return false;
612 return id[ATA_ID_COMMAND_SET_2] & (1 << 12); 614 return id[ATA_ID_COMMAND_SET_2] & (1 << 12);
613} 615}
614 616
615static inline int ata_id_flush_enabled(const u16 *id) 617static inline bool ata_id_flush_enabled(const u16 *id)
616{ 618{
617 if (ata_id_has_flush(id) == 0) 619 if (ata_id_has_flush(id) == 0)
618 return 0; 620 return false;
619 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 621 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
620 return 0; 622 return false;
621 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); 623 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12);
622} 624}
623 625
624static inline int ata_id_has_flush_ext(const u16 *id) 626static inline bool ata_id_has_flush_ext(const u16 *id)
625{ 627{
626 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 628 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
627 return 0; 629 return false;
628 return id[ATA_ID_COMMAND_SET_2] & (1 << 13); 630 return id[ATA_ID_COMMAND_SET_2] & (1 << 13);
629} 631}
630 632
631static inline int ata_id_flush_ext_enabled(const u16 *id) 633static inline bool ata_id_flush_ext_enabled(const u16 *id)
632{ 634{
633 if (ata_id_has_flush_ext(id) == 0) 635 if (ata_id_has_flush_ext(id) == 0)
634 return 0; 636 return false;
635 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 637 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
636 return 0; 638 return false;
637 /* 639 /*
638 * some Maxtor disks have bit 13 defined incorrectly 640 * some Maxtor disks have bit 13 defined incorrectly
639 * so check bit 10 too 641 * so check bit 10 too
@@ -686,64 +688,64 @@ static inline u16 ata_id_logical_sector_offset(const u16 *id,
686 return 0; 688 return 0;
687} 689}
688 690
689static inline int ata_id_has_lba48(const u16 *id) 691static inline bool ata_id_has_lba48(const u16 *id)
690{ 692{
691 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 693 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
692 return 0; 694 return false;
693 if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) 695 if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2))
694 return 0; 696 return false;
695 return id[ATA_ID_COMMAND_SET_2] & (1 << 10); 697 return id[ATA_ID_COMMAND_SET_2] & (1 << 10);
696} 698}
697 699
698static inline int ata_id_lba48_enabled(const u16 *id) 700static inline bool ata_id_lba48_enabled(const u16 *id)
699{ 701{
700 if (ata_id_has_lba48(id) == 0) 702 if (ata_id_has_lba48(id) == 0)
701 return 0; 703 return false;
702 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 704 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
703 return 0; 705 return false;
704 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); 706 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10);
705} 707}
706 708
707static inline int ata_id_hpa_enabled(const u16 *id) 709static inline bool ata_id_hpa_enabled(const u16 *id)
708{ 710{
709 /* Yes children, word 83 valid bits cover word 82 data */ 711 /* Yes children, word 83 valid bits cover word 82 data */
710 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 712 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
711 return 0; 713 return false;
712 /* And 87 covers 85-87 */ 714 /* And 87 covers 85-87 */
713 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 715 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
714 return 0; 716 return false;
715 /* Check command sets enabled as well as supported */ 717 /* Check command sets enabled as well as supported */
716 if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) 718 if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0)
717 return 0; 719 return false;
718 return id[ATA_ID_COMMAND_SET_1] & (1 << 10); 720 return id[ATA_ID_COMMAND_SET_1] & (1 << 10);
719} 721}
720 722
721static inline int ata_id_has_wcache(const u16 *id) 723static inline bool ata_id_has_wcache(const u16 *id)
722{ 724{
723 /* Yes children, word 83 valid bits cover word 82 data */ 725 /* Yes children, word 83 valid bits cover word 82 data */
724 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 726 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
725 return 0; 727 return false;
726 return id[ATA_ID_COMMAND_SET_1] & (1 << 5); 728 return id[ATA_ID_COMMAND_SET_1] & (1 << 5);
727} 729}
728 730
729static inline int ata_id_has_pm(const u16 *id) 731static inline bool ata_id_has_pm(const u16 *id)
730{ 732{
731 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 733 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
732 return 0; 734 return false;
733 return id[ATA_ID_COMMAND_SET_1] & (1 << 3); 735 return id[ATA_ID_COMMAND_SET_1] & (1 << 3);
734} 736}
735 737
736static inline int ata_id_rahead_enabled(const u16 *id) 738static inline bool ata_id_rahead_enabled(const u16 *id)
737{ 739{
738 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 740 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
739 return 0; 741 return false;
740 return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); 742 return id[ATA_ID_CFS_ENABLE_1] & (1 << 6);
741} 743}
742 744
743static inline int ata_id_wcache_enabled(const u16 *id) 745static inline bool ata_id_wcache_enabled(const u16 *id)
744{ 746{
745 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 747 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
746 return 0; 748 return false;
747 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); 749 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
748} 750}
749 751
@@ -773,7 +775,7 @@ static inline unsigned int ata_id_major_version(const u16 *id)
773 return mver; 775 return mver;
774} 776}
775 777
776static inline int ata_id_is_sata(const u16 *id) 778static inline bool ata_id_is_sata(const u16 *id)
777{ 779{
778 /* 780 /*
779 * See if word 93 is 0 AND drive is at least ATA-5 compatible 781 * See if word 93 is 0 AND drive is at least ATA-5 compatible
@@ -782,37 +784,40 @@ static inline int ata_id_is_sata(const u16 *id)
782 * 0x0000 and 0xffff along with the earlier ATA revisions... 784 * 0x0000 and 0xffff along with the earlier ATA revisions...
783 */ 785 */
784 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) 786 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
785 return 1; 787 return true;
786 return 0; 788 return false;
787} 789}
788 790
789static inline int ata_id_has_tpm(const u16 *id) 791static inline bool ata_id_has_tpm(const u16 *id)
790{ 792{
791 /* The TPM bits are only valid on ATA8 */ 793 /* The TPM bits are only valid on ATA8 */
792 if (ata_id_major_version(id) < 8) 794 if (ata_id_major_version(id) < 8)
793 return 0; 795 return false;
794 if ((id[48] & 0xC000) != 0x4000) 796 if ((id[48] & 0xC000) != 0x4000)
795 return 0; 797 return false;
796 return id[48] & (1 << 0); 798 return id[48] & (1 << 0);
797} 799}
798 800
799static inline int ata_id_has_dword_io(const u16 *id) 801static inline bool ata_id_has_dword_io(const u16 *id)
800{ 802{
801 /* ATA 8 reuses this flag for "trusted" computing */ 803 /* ATA 8 reuses this flag for "trusted" computing */
802 if (ata_id_major_version(id) > 7) 804 if (ata_id_major_version(id) > 7)
803 return 0; 805 return false;
804 if (id[ATA_ID_DWORD_IO] & (1 << 0)) 806 return id[ATA_ID_DWORD_IO] & (1 << 0);
805 return 1;
806 return 0;
807} 807}
808 808
809static inline int ata_id_has_unload(const u16 *id) 809static inline bool ata_id_has_unload(const u16 *id)
810{ 810{
811 if (ata_id_major_version(id) >= 7 && 811 if (ata_id_major_version(id) >= 7 &&
812 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && 812 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
813 id[ATA_ID_CFSSE] & (1 << 13)) 813 id[ATA_ID_CFSSE] & (1 << 13))
814 return 1; 814 return true;
815 return 0; 815 return false;
816}
817
818static inline bool ata_id_has_wwn(const u16 *id)
819{
820 return (id[ATA_ID_CSF_DEFAULT] & 0xC100) == 0x4100;
816} 821}
817 822
818static inline int ata_id_form_factor(const u16 *id) 823static inline int ata_id_form_factor(const u16 *id)
@@ -843,25 +848,25 @@ static inline int ata_id_rotation_rate(const u16 *id)
843 return val; 848 return val;
844} 849}
845 850
846static inline int ata_id_has_trim(const u16 *id) 851static inline bool ata_id_has_trim(const u16 *id)
847{ 852{
848 if (ata_id_major_version(id) >= 7 && 853 if (ata_id_major_version(id) >= 7 &&
849 (id[ATA_ID_DATA_SET_MGMT] & 1)) 854 (id[ATA_ID_DATA_SET_MGMT] & 1))
850 return 1; 855 return true;
851 return 0; 856 return false;
852} 857}
853 858
854static inline int ata_id_has_zero_after_trim(const u16 *id) 859static inline bool ata_id_has_zero_after_trim(const u16 *id)
855{ 860{
856 /* DSM supported, deterministic read, and read zero after trim set */ 861 /* DSM supported, deterministic read, and read zero after trim set */
857 if (ata_id_has_trim(id) && 862 if (ata_id_has_trim(id) &&
858 (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) 863 (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020)
859 return 1; 864 return true;
860 865
861 return 0; 866 return false;
862} 867}
863 868
864static inline int ata_id_current_chs_valid(const u16 *id) 869static inline bool ata_id_current_chs_valid(const u16 *id)
865{ 870{
866 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 871 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
867 has not been issued to the device then the values of 872 has not been issued to the device then the values of
@@ -873,11 +878,11 @@ static inline int ata_id_current_chs_valid(const u16 *id)
873 id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ 878 id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */
874} 879}
875 880
876static inline int ata_id_is_cfa(const u16 *id) 881static inline bool ata_id_is_cfa(const u16 *id)
877{ 882{
878 if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ 883 if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */
879 (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ 884 (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */
880 return 1; 885 return true;
881 /* 886 /*
882 * CF specs don't require specific value in the word 0 anymore and yet 887 * CF specs don't require specific value in the word 0 anymore and yet
883 * they forbid to report the ATA version in the word 80 and require the 888 * they forbid to report the ATA version in the word 80 and require the
@@ -886,44 +891,40 @@ static inline int ata_id_is_cfa(const u16 *id)
886 * and while those that don't indicate CFA feature support need some 891 * and while those that don't indicate CFA feature support need some
887 * sort of quirk list, it seems impractical for the ones that do... 892 * sort of quirk list, it seems impractical for the ones that do...
888 */ 893 */
889 if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004) 894 return (id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004;
890 return 1;
891 return 0;
892} 895}
893 896
894static inline int ata_id_is_ssd(const u16 *id) 897static inline bool ata_id_is_ssd(const u16 *id)
895{ 898{
896 return id[ATA_ID_ROT_SPEED] == 0x01; 899 return id[ATA_ID_ROT_SPEED] == 0x01;
897} 900}
898 901
899static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio) 902static inline bool ata_id_pio_need_iordy(const u16 *id, const u8 pio)
900{ 903{
901 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ 904 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
902 if (pio > 4 && ata_id_is_cfa(id)) 905 if (pio > 4 && ata_id_is_cfa(id))
903 return 0; 906 return false;
904 /* For PIO3 and higher it is mandatory. */ 907 /* For PIO3 and higher it is mandatory. */
905 if (pio > 2) 908 if (pio > 2)
906 return 1; 909 return true;
907 /* Turn it on when possible. */ 910 /* Turn it on when possible. */
908 if (ata_id_has_iordy(id)) 911 return ata_id_has_iordy(id);
909 return 1;
910 return 0;
911} 912}
912 913
913static inline int ata_drive_40wire(const u16 *dev_id) 914static inline bool ata_drive_40wire(const u16 *dev_id)
914{ 915{
915 if (ata_id_is_sata(dev_id)) 916 if (ata_id_is_sata(dev_id))
916 return 0; /* SATA */ 917 return false; /* SATA */
917 if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) 918 if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000)
918 return 0; /* 80 wire */ 919 return false; /* 80 wire */
919 return 1; 920 return true;
920} 921}
921 922
922static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 923static inline bool ata_drive_40wire_relaxed(const u16 *dev_id)
923{ 924{
924 if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) 925 if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000)
925 return 0; /* 80 wire */ 926 return false; /* 80 wire */
926 return 1; 927 return true;
927} 928}
928 929
929static inline int atapi_cdb_len(const u16 *dev_id) 930static inline int atapi_cdb_len(const u16 *dev_id)
@@ -936,12 +937,12 @@ static inline int atapi_cdb_len(const u16 *dev_id)
936 } 937 }
937} 938}
938 939
939static inline int atapi_command_packet_set(const u16 *dev_id) 940static inline bool atapi_command_packet_set(const u16 *dev_id)
940{ 941{
941 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; 942 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;
942} 943}
943 944
944static inline int atapi_id_dmadir(const u16 *dev_id) 945static inline bool atapi_id_dmadir(const u16 *dev_id)
945{ 946{
946 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); 947 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
947} 948}
@@ -954,13 +955,13 @@ static inline int atapi_id_dmadir(const u16 *dev_id)
954 * 955 *
955 * It is called only once for each device. 956 * It is called only once for each device.
956 */ 957 */
957static inline int ata_id_is_lba_capacity_ok(u16 *id) 958static inline bool ata_id_is_lba_capacity_ok(u16 *id)
958{ 959{
959 unsigned long lba_sects, chs_sects, head, tail; 960 unsigned long lba_sects, chs_sects, head, tail;
960 961
961 /* No non-LBA info .. so valid! */ 962 /* No non-LBA info .. so valid! */
962 if (id[ATA_ID_CYLS] == 0) 963 if (id[ATA_ID_CYLS] == 0)
963 return 1; 964 return true;
964 965
965 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); 966 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
966 967
@@ -975,13 +976,13 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id)
975 id[ATA_ID_SECTORS] == 63 && 976 id[ATA_ID_SECTORS] == 63 &&
976 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && 977 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
977 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) 978 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS]))
978 return 1; 979 return true;
979 980
980 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; 981 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
981 982
982 /* perform a rough sanity check on lba_sects: within 10% is OK */ 983 /* perform a rough sanity check on lba_sects: within 10% is OK */
983 if (lba_sects - chs_sects < chs_sects/10) 984 if (lba_sects - chs_sects < chs_sects/10)
984 return 1; 985 return true;
985 986
986 /* some drives have the word order reversed */ 987 /* some drives have the word order reversed */
987 head = (lba_sects >> 16) & 0xffff; 988 head = (lba_sects >> 16) & 0xffff;
@@ -990,10 +991,10 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id)
990 991
991 if (lba_sects - chs_sects < chs_sects/10) { 992 if (lba_sects - chs_sects < chs_sects/10) {
992 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); 993 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects);
993 return 1; /* LBA capacity is (now) good */ 994 return true; /* LBA capacity is (now) good */
994 } 995 }
995 996
996 return 0; /* LBA capacity value may be bad */ 997 return false; /* LBA capacity value may be bad */
997} 998}
998 999
999static inline void ata_id_to_hd_driveid(u16 *id) 1000static inline void ata_id_to_hd_driveid(u16 *id)
@@ -1051,19 +1052,19 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf)
1051 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); 1052 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1052} 1053}
1053 1054
1054static inline int ata_ok(u8 status) 1055static inline bool ata_ok(u8 status)
1055{ 1056{
1056 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 1057 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
1057 == ATA_DRDY); 1058 == ATA_DRDY);
1058} 1059}
1059 1060
1060static inline int lba_28_ok(u64 block, u32 n_block) 1061static inline bool lba_28_ok(u64 block, u32 n_block)
1061{ 1062{
1062 /* check the ending block number: must be LESS THAN 0x0fffffff */ 1063 /* check the ending block number: must be LESS THAN 0x0fffffff */
1063 return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); 1064 return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
1064} 1065}
1065 1066
1066static inline int lba_48_ok(u64 block, u32 n_block) 1067static inline bool lba_48_ok(u64 block, u32 n_block)
1067{ 1068{
1068 /* check the ending block number */ 1069 /* check the ending block number */
1069 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); 1070 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index b847fc7b93f9..60a7c49dcb49 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -23,6 +23,13 @@
23 23
24struct ath9k_platform_data { 24struct ath9k_platform_data {
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; 25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26 u8 *macaddr;
27
28 int led_pin;
29 u32 gpio_mask;
30 u32 gpio_val;
31
32 bool is_clk_25mhz;
26}; 33};
27 34
28#endif /* _LINUX_ATH9K_PLATFORM_H */ 35#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index a8e4e832cdbb..381f4cec8260 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -427,8 +427,10 @@ extern rwlock_t vcc_sklist_lock;
427 427
428#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb)) 428#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
429 429
430struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, 430struct atm_dev *atm_dev_register(const char *type, struct device *parent,
431 int number,unsigned long *flags); /* number == -1: pick first available */ 431 const struct atmdev_ops *ops,
432 int number, /* -1 == pick first available */
433 unsigned long *flags);
432struct atm_dev *atm_dev_lookup(int number); 434struct atm_dev *atm_dev_lookup(int number);
433void atm_dev_deregister(struct atm_dev *dev); 435void atm_dev_deregister(struct atm_dev *dev);
434 436
@@ -441,6 +443,7 @@ void atm_dev_signal_change(struct atm_dev *dev, char signal);
441 443
442void vcc_insert_socket(struct sock *sk); 444void vcc_insert_socket(struct sock *sk);
443 445
446void atm_dev_release_vccs(struct atm_dev *dev);
444 447
445/* 448/*
446 * This is approximately the algorithm used by alloc_skb. 449 * This is approximately the algorithm used by alloc_skb.
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
new file mode 100644
index 000000000000..96c038e43d66
--- /dev/null
+++ b/include/linux/atomic.h
@@ -0,0 +1,37 @@
1#ifndef _LINUX_ATOMIC_H
2#define _LINUX_ATOMIC_H
3#include <asm/atomic.h>
4
5/**
6 * atomic_inc_not_zero_hint - increment if not null
7 * @v: pointer of type atomic_t
8 * @hint: probable value of the atomic before the increment
9 *
10 * This version of atomic_inc_not_zero() gives a hint of probable
11 * value of the atomic. This helps processor to not read the memory
12 * before doing the atomic read/modify/write cycle, lowering
13 * number of bus transactions on some arches.
14 *
15 * Returns: 0 if increment was not done, 1 otherwise.
16 */
17#ifndef atomic_inc_not_zero_hint
18static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint)
19{
20 int val, c = hint;
21
22 /* sanity test, should be removed by compiler if hint is a constant */
23 if (!hint)
24 return atomic_inc_not_zero(v);
25
26 do {
27 val = atomic_cmpxchg(v, c, c + 1);
28 if (val == c)
29 return 1;
30 c = val;
31 } while (c);
32
33 return 0;
34}
35#endif
36
37#endif /* _LINUX_ATOMIC_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index e24afabc548f..9d339eb27881 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -102,6 +102,9 @@
102#define AUDIT_EOE 1320 /* End of multi-record event */ 102#define AUDIT_EOE 1320 /* End of multi-record event */
103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ 103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ 104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
106#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
107#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
105 108
106#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 109#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
107#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 110#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -371,6 +374,7 @@ struct audit_buffer;
371struct audit_context; 374struct audit_context;
372struct inode; 375struct inode;
373struct netlink_skb_parms; 376struct netlink_skb_parms;
377struct path;
374struct linux_binprm; 378struct linux_binprm;
375struct mq_attr; 379struct mq_attr;
376struct mqstat; 380struct mqstat;
@@ -478,6 +482,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
478 const struct cred *new, 482 const struct cred *new,
479 const struct cred *old); 483 const struct cred *old);
480extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old); 484extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
485extern void __audit_mmap_fd(int fd, int flags);
481 486
482static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) 487static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
483{ 488{
@@ -531,6 +536,12 @@ static inline void audit_log_capset(pid_t pid, const struct cred *new,
531 __audit_log_capset(pid, new, old); 536 __audit_log_capset(pid, new, old);
532} 537}
533 538
539static inline void audit_mmap_fd(int fd, int flags)
540{
541 if (unlikely(!audit_dummy_context()))
542 __audit_mmap_fd(fd, flags);
543}
544
534extern int audit_n_rules; 545extern int audit_n_rules;
535extern int audit_signals; 546extern int audit_signals;
536#else 547#else
@@ -564,6 +575,7 @@ extern int audit_signals;
564#define audit_mq_getsetattr(d,s) ((void)0) 575#define audit_mq_getsetattr(d,s) ((void)0)
565#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; }) 576#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
566#define audit_log_capset(pid, ncr, ocr) ((void)0) 577#define audit_log_capset(pid, ncr, ocr) ((void)0)
578#define audit_mmap_fd(fd, flags) ((void)0)
567#define audit_ptrace(t) ((void)0) 579#define audit_ptrace(t) ((void)0)
568#define audit_n_rules 0 580#define audit_n_rules 0
569#define audit_signals 0 581#define audit_signals 0
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 8b49ac48a5b7..e02982fa2953 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -24,7 +24,7 @@
24#define AUTOFS_MIN_PROTO_VERSION 3 24#define AUTOFS_MIN_PROTO_VERSION 3
25#define AUTOFS_MAX_PROTO_VERSION 5 25#define AUTOFS_MAX_PROTO_VERSION 5
26 26
27#define AUTOFS_PROTO_SUBVERSION 1 27#define AUTOFS_PROTO_SUBVERSION 2
28 28
29/* Mask for expire behaviour */ 29/* Mask for expire behaviour */
30#define AUTOFS_EXP_IMMEDIATE 1 30#define AUTOFS_EXP_IMMEDIATE 1
diff --git a/include/linux/average.h b/include/linux/average.h
new file mode 100644
index 000000000000..c6028fd742c1
--- /dev/null
+++ b/include/linux/average.h
@@ -0,0 +1,30 @@
1#ifndef _LINUX_AVERAGE_H
2#define _LINUX_AVERAGE_H
3
4/* Exponentially weighted moving average (EWMA) */
5
6/* For more documentation see lib/average.c */
7
8struct ewma {
9 unsigned long internal;
10 unsigned long factor;
11 unsigned long weight;
12};
13
14extern void ewma_init(struct ewma *avg, unsigned long factor,
15 unsigned long weight);
16
17extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);
18
19/**
20 * ewma_read() - Get average value
21 * @avg: Average structure
22 *
23 * Returns the average value held in @avg.
24 */
25static inline unsigned long ewma_read(const struct ewma *avg)
26{
27 return avg->internal >> avg->factor;
28}
29
30#endif /* _LINUX_AVERAGE_H */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 35b00746c712..96f4094b706d 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -66,8 +66,6 @@ struct backing_dev_info {
66 unsigned int capabilities; /* Device capabilities */ 66 unsigned int capabilities; /* Device capabilities */
67 congested_fn *congested_fn; /* Function pointer if device is md/dm */ 67 congested_fn *congested_fn; /* Function pointer if device is md/dm */
68 void *congested_data; /* Pointer to aux data for congested func */ 68 void *congested_data; /* Pointer to aux data for congested func */
69 void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
70 void *unplug_io_data;
71 69
72 char *name; 70 char *name;
73 71
@@ -111,6 +109,7 @@ void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
111 109
112extern spinlock_t bdi_lock; 110extern spinlock_t bdi_lock;
113extern struct list_head bdi_list; 111extern struct list_head bdi_list;
112extern struct list_head bdi_pending_list;
114 113
115static inline int wb_has_dirty_io(struct bdi_writeback *wb) 114static inline int wb_has_dirty_io(struct bdi_writeback *wb)
116{ 115{
@@ -250,7 +249,6 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
250 249
251extern struct backing_dev_info default_backing_dev_info; 250extern struct backing_dev_info default_backing_dev_info;
252extern struct backing_dev_info noop_backing_dev_info; 251extern struct backing_dev_info noop_backing_dev_info;
253void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
254 252
255int writeback_in_progress(struct backing_dev_info *bdi); 253int writeback_in_progress(struct backing_dev_info *bdi);
256 254
@@ -285,7 +283,7 @@ enum {
285void clear_bdi_congested(struct backing_dev_info *bdi, int sync); 283void clear_bdi_congested(struct backing_dev_info *bdi, int sync);
286void set_bdi_congested(struct backing_dev_info *bdi, int sync); 284void set_bdi_congested(struct backing_dev_info *bdi, int sync);
287long congestion_wait(int sync, long timeout); 285long congestion_wait(int sync, long timeout);
288 286long wait_iff_congested(struct zone *zone, int sync, long timeout);
289 287
290static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) 288static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
291{ 289{
@@ -335,17 +333,4 @@ static inline int bdi_sched_wait(void *word)
335 return 0; 333 return 0;
336} 334}
337 335
338static inline void blk_run_backing_dev(struct backing_dev_info *bdi,
339 struct page *page)
340{
341 if (bdi && bdi->unplug_io_fn)
342 bdi->unplug_io_fn(bdi, page);
343}
344
345static inline void blk_run_address_space(struct address_space *mapping)
346{
347 if (mapping)
348 blk_run_backing_dev(mapping->backing_dev_info, NULL);
349}
350
351#endif /* _LINUX_BACKING_DEV_H */ 336#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 4a3d52e545e1..5ffc6dda4675 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -32,6 +32,13 @@ enum backlight_update_reason {
32 BACKLIGHT_UPDATE_SYSFS, 32 BACKLIGHT_UPDATE_SYSFS,
33}; 33};
34 34
35enum backlight_type {
36 BACKLIGHT_RAW = 1,
37 BACKLIGHT_PLATFORM,
38 BACKLIGHT_FIRMWARE,
39 BACKLIGHT_TYPE_MAX,
40};
41
35struct backlight_device; 42struct backlight_device;
36struct fb_info; 43struct fb_info;
37 44
@@ -62,6 +69,8 @@ struct backlight_properties {
62 /* FB Blanking active? (values as for power) */ 69 /* FB Blanking active? (values as for power) */
63 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ 70 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
64 int fb_blank; 71 int fb_blank;
72 /* Backlight type */
73 enum backlight_type type;
65 /* Flags used to signal drivers of state changes */ 74 /* Flags used to signal drivers of state changes */
66 /* Upper 4 bits are reserved for driver internal use */ 75 /* Upper 4 bits are reserved for driver internal use */
67 unsigned int state; 76 unsigned int state;
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
new file mode 100644
index 000000000000..198087a16fc4
--- /dev/null
+++ b/include/linux/basic_mmio_gpio.h
@@ -0,0 +1,20 @@
1/*
2 * Basic memory-mapped GPIO controllers.
3 *
4 * Copyright 2008 MontaVista Software, Inc.
5 * Copyright 2008,2010 Anton Vorontsov <cbouatmailru@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __BASIC_MMIO_GPIO_H
14#define __BASIC_MMIO_GPIO_H
15
16struct bgpio_pdata {
17 int base;
18};
19
20#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/bch.h b/include/linux/bch.h
new file mode 100644
index 000000000000..295b4ef153bb
--- /dev/null
+++ b/include/linux/bch.h
@@ -0,0 +1,79 @@
1/*
2 * Generic binary BCH encoding/decoding library
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Copyright © 2011 Parrot S.A.
18 *
19 * Author: Ivan Djelic <ivan.djelic@parrot.com>
20 *
21 * Description:
22 *
23 * This library provides runtime configurable encoding/decoding of binary
24 * Bose-Chaudhuri-Hocquenghem (BCH) codes.
25*/
26#ifndef _BCH_H
27#define _BCH_H
28
29#include <linux/types.h>
30
31/**
32 * struct bch_control - BCH control structure
33 * @m: Galois field order
34 * @n: maximum codeword size in bits (= 2^m-1)
35 * @t: error correction capability in bits
36 * @ecc_bits: ecc exact size in bits, i.e. generator polynomial degree (<=m*t)
37 * @ecc_bytes: ecc max size (m*t bits) in bytes
38 * @a_pow_tab: Galois field GF(2^m) exponentiation lookup table
39 * @a_log_tab: Galois field GF(2^m) log lookup table
40 * @mod8_tab: remainder generator polynomial lookup tables
41 * @ecc_buf: ecc parity words buffer
42 * @ecc_buf2: ecc parity words buffer
43 * @xi_tab: GF(2^m) base for solving degree 2 polynomial roots
44 * @syn: syndrome buffer
45 * @cache: log-based polynomial representation buffer
46 * @elp: error locator polynomial
47 * @poly_2t: temporary polynomials of degree 2t
48 */
49struct bch_control {
50 unsigned int m;
51 unsigned int n;
52 unsigned int t;
53 unsigned int ecc_bits;
54 unsigned int ecc_bytes;
55/* private: */
56 uint16_t *a_pow_tab;
57 uint16_t *a_log_tab;
58 uint32_t *mod8_tab;
59 uint32_t *ecc_buf;
60 uint32_t *ecc_buf2;
61 unsigned int *xi_tab;
62 unsigned int *syn;
63 int *cache;
64 struct gf_poly *elp;
65 struct gf_poly *poly_2t[4];
66};
67
68struct bch_control *init_bch(int m, int t, unsigned int prim_poly);
69
70void free_bch(struct bch_control *bch);
71
72void encode_bch(struct bch_control *bch, const uint8_t *data,
73 unsigned int len, uint8_t *ecc);
74
75int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
76 const uint8_t *recv_ecc, const uint8_t *calc_ecc,
77 const unsigned int *syn, unsigned int *errloc);
78
79#endif /* _BCH_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
new file mode 100644
index 000000000000..08763e4e848f
--- /dev/null
+++ b/include/linux/bcma/bcma.h
@@ -0,0 +1,224 @@
1#ifndef LINUX_BCMA_H_
2#define LINUX_BCMA_H_
3
4#include <linux/pci.h>
5#include <linux/mod_devicetable.h>
6
7#include <linux/bcma/bcma_driver_chipcommon.h>
8#include <linux/bcma/bcma_driver_pci.h>
9
10#include "bcma_regs.h"
11
12struct bcma_device;
13struct bcma_bus;
14
15enum bcma_hosttype {
16 BCMA_HOSTTYPE_NONE,
17 BCMA_HOSTTYPE_PCI,
18 BCMA_HOSTTYPE_SDIO,
19};
20
21struct bcma_chipinfo {
22 u16 id;
23 u8 rev;
24 u8 pkg;
25};
26
27struct bcma_host_ops {
28 u8 (*read8)(struct bcma_device *core, u16 offset);
29 u16 (*read16)(struct bcma_device *core, u16 offset);
30 u32 (*read32)(struct bcma_device *core, u16 offset);
31 void (*write8)(struct bcma_device *core, u16 offset, u8 value);
32 void (*write16)(struct bcma_device *core, u16 offset, u16 value);
33 void (*write32)(struct bcma_device *core, u16 offset, u32 value);
34 /* Agent ops */
35 u32 (*aread32)(struct bcma_device *core, u16 offset);
36 void (*awrite32)(struct bcma_device *core, u16 offset, u32 value);
37};
38
39/* Core manufacturers */
40#define BCMA_MANUF_ARM 0x43B
41#define BCMA_MANUF_MIPS 0x4A7
42#define BCMA_MANUF_BCM 0x4BF
43
44/* Core class values. */
45#define BCMA_CL_SIM 0x0
46#define BCMA_CL_EROM 0x1
47#define BCMA_CL_CORESIGHT 0x9
48#define BCMA_CL_VERIF 0xB
49#define BCMA_CL_OPTIMO 0xD
50#define BCMA_CL_GEN 0xE
51#define BCMA_CL_PRIMECELL 0xF
52
53/* Core-ID values. */
54#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
55#define BCMA_CORE_INVALID 0x700
56#define BCMA_CORE_CHIPCOMMON 0x800
57#define BCMA_CORE_ILINE20 0x801
58#define BCMA_CORE_SRAM 0x802
59#define BCMA_CORE_SDRAM 0x803
60#define BCMA_CORE_PCI 0x804
61#define BCMA_CORE_MIPS 0x805
62#define BCMA_CORE_ETHERNET 0x806
63#define BCMA_CORE_V90 0x807
64#define BCMA_CORE_USB11_HOSTDEV 0x808
65#define BCMA_CORE_ADSL 0x809
66#define BCMA_CORE_ILINE100 0x80A
67#define BCMA_CORE_IPSEC 0x80B
68#define BCMA_CORE_UTOPIA 0x80C
69#define BCMA_CORE_PCMCIA 0x80D
70#define BCMA_CORE_INTERNAL_MEM 0x80E
71#define BCMA_CORE_MEMC_SDRAM 0x80F
72#define BCMA_CORE_OFDM 0x810
73#define BCMA_CORE_EXTIF 0x811
74#define BCMA_CORE_80211 0x812
75#define BCMA_CORE_PHY_A 0x813
76#define BCMA_CORE_PHY_B 0x814
77#define BCMA_CORE_PHY_G 0x815
78#define BCMA_CORE_MIPS_3302 0x816
79#define BCMA_CORE_USB11_HOST 0x817
80#define BCMA_CORE_USB11_DEV 0x818
81#define BCMA_CORE_USB20_HOST 0x819
82#define BCMA_CORE_USB20_DEV 0x81A
83#define BCMA_CORE_SDIO_HOST 0x81B
84#define BCMA_CORE_ROBOSWITCH 0x81C
85#define BCMA_CORE_PARA_ATA 0x81D
86#define BCMA_CORE_SATA_XORDMA 0x81E
87#define BCMA_CORE_ETHERNET_GBIT 0x81F
88#define BCMA_CORE_PCIE 0x820
89#define BCMA_CORE_PHY_N 0x821
90#define BCMA_CORE_SRAM_CTL 0x822
91#define BCMA_CORE_MINI_MACPHY 0x823
92#define BCMA_CORE_ARM_1176 0x824
93#define BCMA_CORE_ARM_7TDMI 0x825
94#define BCMA_CORE_PHY_LP 0x826
95#define BCMA_CORE_PMU 0x827
96#define BCMA_CORE_PHY_SSN 0x828
97#define BCMA_CORE_SDIO_DEV 0x829
98#define BCMA_CORE_ARM_CM3 0x82A
99#define BCMA_CORE_PHY_HT 0x82B
100#define BCMA_CORE_MIPS_74K 0x82C
101#define BCMA_CORE_MAC_GBIT 0x82D
102#define BCMA_CORE_DDR12_MEM_CTL 0x82E
103#define BCMA_CORE_PCIE_RC 0x82F /* PCIe Root Complex */
104#define BCMA_CORE_OCP_OCP_BRIDGE 0x830
105#define BCMA_CORE_SHARED_COMMON 0x831
106#define BCMA_CORE_OCP_AHB_BRIDGE 0x832
107#define BCMA_CORE_SPI_HOST 0x833
108#define BCMA_CORE_I2S 0x834
109#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */
110#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */
111#define BCMA_CORE_DEFAULT 0xFFF
112
113#define BCMA_MAX_NR_CORES 16
114
115struct bcma_device {
116 struct bcma_bus *bus;
117 struct bcma_device_id id;
118
119 struct device dev;
120 bool dev_registered;
121
122 u8 core_index;
123
124 u32 addr;
125 u32 wrap;
126
127 void *drvdata;
128 struct list_head list;
129};
130
131static inline void *bcma_get_drvdata(struct bcma_device *core)
132{
133 return core->drvdata;
134}
135static inline void bcma_set_drvdata(struct bcma_device *core, void *drvdata)
136{
137 core->drvdata = drvdata;
138}
139
140struct bcma_driver {
141 const char *name;
142 const struct bcma_device_id *id_table;
143
144 int (*probe)(struct bcma_device *dev);
145 void (*remove)(struct bcma_device *dev);
146 int (*suspend)(struct bcma_device *dev, pm_message_t state);
147 int (*resume)(struct bcma_device *dev);
148 void (*shutdown)(struct bcma_device *dev);
149
150 struct device_driver drv;
151};
152extern
153int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
154static inline int bcma_driver_register(struct bcma_driver *drv)
155{
156 return __bcma_driver_register(drv, THIS_MODULE);
157}
158extern void bcma_driver_unregister(struct bcma_driver *drv);
159
160struct bcma_bus {
161 /* The MMIO area. */
162 void __iomem *mmio;
163
164 const struct bcma_host_ops *ops;
165
166 enum bcma_hosttype hosttype;
167 union {
168 /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */
169 struct pci_dev *host_pci;
170 /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */
171 struct sdio_func *host_sdio;
172 };
173
174 struct bcma_chipinfo chipinfo;
175
176 struct bcma_device *mapped_core;
177 struct list_head cores;
178 u8 nr_cores;
179
180 struct bcma_drv_cc drv_cc;
181 struct bcma_drv_pci drv_pci;
182};
183
184extern inline u32 bcma_read8(struct bcma_device *core, u16 offset)
185{
186 return core->bus->ops->read8(core, offset);
187}
188extern inline u32 bcma_read16(struct bcma_device *core, u16 offset)
189{
190 return core->bus->ops->read16(core, offset);
191}
192extern inline u32 bcma_read32(struct bcma_device *core, u16 offset)
193{
194 return core->bus->ops->read32(core, offset);
195}
196extern inline
197void bcma_write8(struct bcma_device *core, u16 offset, u32 value)
198{
199 core->bus->ops->write8(core, offset, value);
200}
201extern inline
202void bcma_write16(struct bcma_device *core, u16 offset, u32 value)
203{
204 core->bus->ops->write16(core, offset, value);
205}
206extern inline
207void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
208{
209 core->bus->ops->write32(core, offset, value);
210}
211extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
212{
213 return core->bus->ops->aread32(core, offset);
214}
215extern inline
216void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
217{
218 core->bus->ops->awrite32(core, offset, value);
219}
220
221extern bool bcma_core_is_enabled(struct bcma_device *core);
222extern int bcma_core_enable(struct bcma_device *core, u32 flags);
223
224#endif /* LINUX_BCMA_H_ */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
new file mode 100644
index 000000000000..083c3b6cd5ce
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -0,0 +1,302 @@
1#ifndef LINUX_BCMA_DRIVER_CC_H_
2#define LINUX_BCMA_DRIVER_CC_H_
3
4/** ChipCommon core registers. **/
5#define BCMA_CC_ID 0x0000
6#define BCMA_CC_ID_ID 0x0000FFFF
7#define BCMA_CC_ID_ID_SHIFT 0
8#define BCMA_CC_ID_REV 0x000F0000
9#define BCMA_CC_ID_REV_SHIFT 16
10#define BCMA_CC_ID_PKG 0x00F00000
11#define BCMA_CC_ID_PKG_SHIFT 20
12#define BCMA_CC_ID_NRCORES 0x0F000000
13#define BCMA_CC_ID_NRCORES_SHIFT 24
14#define BCMA_CC_ID_TYPE 0xF0000000
15#define BCMA_CC_ID_TYPE_SHIFT 28
16#define BCMA_CC_CAP 0x0004 /* Capabilities */
17#define BCMA_CC_CAP_NRUART 0x00000003 /* # of UARTs */
18#define BCMA_CC_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */
19#define BCMA_CC_CAP_UARTCLK 0x00000018 /* UART clock select */
20#define BCMA_CC_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */
21#define BCMA_CC_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */
22#define BCMA_CC_CAP_EXTBUS 0x000000C0 /* External buses present */
23#define BCMA_CC_CAP_FLASHT 0x00000700 /* Flash Type */
24#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */
25#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */
26#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */
27#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */
28#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */
29#define BCMA_PLLTYPE_NONE 0x00000000
30#define BCMA_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */
31#define BCMA_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */
32#define BCMA_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */
33#define BCMA_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */
34#define BCMA_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */
35#define BCMA_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */
36#define BCMA_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */
37#define BCMA_CC_CAP_PCTL 0x00040000 /* Power Control */
38#define BCMA_CC_CAP_OTPS 0x00380000 /* OTP size */
39#define BCMA_CC_CAP_OTPS_SHIFT 19
40#define BCMA_CC_CAP_OTPS_BASE 5
41#define BCMA_CC_CAP_JTAGM 0x00400000 /* JTAG master present */
42#define BCMA_CC_CAP_BROM 0x00800000 /* Internal boot ROM active */
43#define BCMA_CC_CAP_64BIT 0x08000000 /* 64-bit Backplane */
44#define BCMA_CC_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */
45#define BCMA_CC_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */
46#define BCMA_CC_CAP_SPROM 0x40000000 /* SPROM present */
47#define BCMA_CC_CORECTL 0x0008
48#define BCMA_CC_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
49#define BCMA_CC_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
50#define BCMA_CC_CORECTL_UARTCLKEN 0x00000008 /* UART clock enable (rev >= 21) */
51#define BCMA_CC_BIST 0x000C
52#define BCMA_CC_OTPS 0x0010 /* OTP status */
53#define BCMA_CC_OTPS_PROGFAIL 0x80000000
54#define BCMA_CC_OTPS_PROTECT 0x00000007
55#define BCMA_CC_OTPS_HW_PROTECT 0x00000001
56#define BCMA_CC_OTPS_SW_PROTECT 0x00000002
57#define BCMA_CC_OTPS_CID_PROTECT 0x00000004
58#define BCMA_CC_OTPC 0x0014 /* OTP control */
59#define BCMA_CC_OTPC_RECWAIT 0xFF000000
60#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00
61#define BCMA_CC_OTPC_PRW_SHIFT 8
62#define BCMA_CC_OTPC_MAXFAIL 0x00000038
63#define BCMA_CC_OTPC_VSEL 0x00000006
64#define BCMA_CC_OTPC_SELVL 0x00000001
65#define BCMA_CC_OTPP 0x0018 /* OTP prog */
66#define BCMA_CC_OTPP_COL 0x000000FF
67#define BCMA_CC_OTPP_ROW 0x0000FF00
68#define BCMA_CC_OTPP_ROW_SHIFT 8
69#define BCMA_CC_OTPP_READERR 0x10000000
70#define BCMA_CC_OTPP_VALUE 0x20000000
71#define BCMA_CC_OTPP_READ 0x40000000
72#define BCMA_CC_OTPP_START 0x80000000
73#define BCMA_CC_OTPP_BUSY 0x80000000
74#define BCMA_CC_IRQSTAT 0x0020
75#define BCMA_CC_IRQMASK 0x0024
76#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */
77#define BCMA_CC_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */
78#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */
79#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */
80#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */
81#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
82#define BCMA_CC_JCMD_START 0x80000000
83#define BCMA_CC_JCMD_BUSY 0x80000000
84#define BCMA_CC_JCMD_PAUSE 0x40000000
85#define BCMA_CC_JCMD0_ACC_MASK 0x0000F000
86#define BCMA_CC_JCMD0_ACC_IRDR 0x00000000
87#define BCMA_CC_JCMD0_ACC_DR 0x00001000
88#define BCMA_CC_JCMD0_ACC_IR 0x00002000
89#define BCMA_CC_JCMD0_ACC_RESET 0x00003000
90#define BCMA_CC_JCMD0_ACC_IRPDR 0x00004000
91#define BCMA_CC_JCMD0_ACC_PDR 0x00005000
92#define BCMA_CC_JCMD0_IRW_MASK 0x00000F00
93#define BCMA_CC_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */
94#define BCMA_CC_JCMD_ACC_IRDR 0x00000000
95#define BCMA_CC_JCMD_ACC_DR 0x00010000
96#define BCMA_CC_JCMD_ACC_IR 0x00020000
97#define BCMA_CC_JCMD_ACC_RESET 0x00030000
98#define BCMA_CC_JCMD_ACC_IRPDR 0x00040000
99#define BCMA_CC_JCMD_ACC_PDR 0x00050000
100#define BCMA_CC_JCMD_IRW_MASK 0x00001F00
101#define BCMA_CC_JCMD_IRW_SHIFT 8
102#define BCMA_CC_JCMD_DRW_MASK 0x0000003F
103#define BCMA_CC_JIR 0x0034 /* Rev >= 10 only */
104#define BCMA_CC_JDR 0x0038 /* Rev >= 10 only */
105#define BCMA_CC_JCTL 0x003C /* Rev >= 10 only */
106#define BCMA_CC_JCTL_FORCE_CLK 4 /* Force clock */
107#define BCMA_CC_JCTL_EXT_EN 2 /* Enable external targets */
108#define BCMA_CC_JCTL_EN 1 /* Enable Jtag master */
109#define BCMA_CC_FLASHCTL 0x0040
110#define BCMA_CC_FLASHCTL_START 0x80000000
111#define BCMA_CC_FLASHCTL_BUSY BCMA_CC_FLASHCTL_START
112#define BCMA_CC_FLASHADDR 0x0044
113#define BCMA_CC_FLASHDATA 0x0048
114#define BCMA_CC_BCAST_ADDR 0x0050
115#define BCMA_CC_BCAST_DATA 0x0054
116#define BCMA_CC_GPIOPULLUP 0x0058 /* Rev >= 20 only */
117#define BCMA_CC_GPIOPULLDOWN 0x005C /* Rev >= 20 only */
118#define BCMA_CC_GPIOIN 0x0060
119#define BCMA_CC_GPIOOUT 0x0064
120#define BCMA_CC_GPIOOUTEN 0x0068
121#define BCMA_CC_GPIOCTL 0x006C
122#define BCMA_CC_GPIOPOL 0x0070
123#define BCMA_CC_GPIOIRQ 0x0074
124#define BCMA_CC_WATCHDOG 0x0080
125#define BCMA_CC_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
126#define BCMA_CC_GPIOTIMER_OFFTIME 0x0000FFFF
127#define BCMA_CC_GPIOTIMER_OFFTIME_SHIFT 0
128#define BCMA_CC_GPIOTIMER_ONTIME 0xFFFF0000
129#define BCMA_CC_GPIOTIMER_ONTIME_SHIFT 16
130#define BCMA_CC_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
131#define BCMA_CC_CLOCK_N 0x0090
132#define BCMA_CC_CLOCK_SB 0x0094
133#define BCMA_CC_CLOCK_PCI 0x0098
134#define BCMA_CC_CLOCK_M2 0x009C
135#define BCMA_CC_CLOCK_MIPS 0x00A0
136#define BCMA_CC_CLKDIV 0x00A4 /* Rev >= 3 only */
137#define BCMA_CC_CLKDIV_SFLASH 0x0F000000
138#define BCMA_CC_CLKDIV_SFLASH_SHIFT 24
139#define BCMA_CC_CLKDIV_OTP 0x000F0000
140#define BCMA_CC_CLKDIV_OTP_SHIFT 16
141#define BCMA_CC_CLKDIV_JTAG 0x00000F00
142#define BCMA_CC_CLKDIV_JTAG_SHIFT 8
143#define BCMA_CC_CLKDIV_UART 0x000000FF
144#define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */
145#define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */
146#define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
147#define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
148#define BCMA_CC_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */
149#define BCMA_CC_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */
150#define BCMA_CC_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */
151#define BCMA_CC_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */
152#define BCMA_CC_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */
153#define BCMA_CC_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */
154#define BCMA_CC_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */
155#define BCMA_CC_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */
156#define BCMA_CC_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */
157#define BCMA_CC_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */
158#define BCMA_CC_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */
159#define BCMA_CC_SLOWCLKCTL_CLKDIV_SHIFT 16
160#define BCMA_CC_SYSCLKCTL 0x00C0 /* Rev >= 3 only */
161#define BCMA_CC_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */
162#define BCMA_CC_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */
163#define BCMA_CC_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */
164#define BCMA_CC_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */
165#define BCMA_CC_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */
166#define BCMA_CC_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */
167#define BCMA_CC_SYSCLKCTL_CLKDIV_SHIFT 16
168#define BCMA_CC_CLKSTSTR 0x00C4 /* Rev >= 3 only */
169#define BCMA_CC_EROM 0x00FC
170#define BCMA_CC_PCMCIA_CFG 0x0100
171#define BCMA_CC_PCMCIA_MEMWAIT 0x0104
172#define BCMA_CC_PCMCIA_ATTRWAIT 0x0108
173#define BCMA_CC_PCMCIA_IOWAIT 0x010C
174#define BCMA_CC_IDE_CFG 0x0110
175#define BCMA_CC_IDE_MEMWAIT 0x0114
176#define BCMA_CC_IDE_ATTRWAIT 0x0118
177#define BCMA_CC_IDE_IOWAIT 0x011C
178#define BCMA_CC_PROG_CFG 0x0120
179#define BCMA_CC_PROG_WAITCNT 0x0124
180#define BCMA_CC_FLASH_CFG 0x0128
181#define BCMA_CC_FLASH_WAITCNT 0x012C
182#define BCMA_CC_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */
183#define BCMA_CC_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
184#define BCMA_CC_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
185#define BCMA_CC_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
186#define BCMA_CC_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
187#define BCMA_CC_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
188#define BCMA_CC_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
189#define BCMA_CC_CLKCTLST_HAVEHT 0x00010000 /* HT available */
190#define BCMA_CC_CLKCTLST_HAVEALP 0x00020000 /* APL available */
191#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
192#define BCMA_CC_UART0_DATA 0x0300
193#define BCMA_CC_UART0_IMR 0x0304
194#define BCMA_CC_UART0_FCR 0x0308
195#define BCMA_CC_UART0_LCR 0x030C
196#define BCMA_CC_UART0_MCR 0x0310
197#define BCMA_CC_UART0_LSR 0x0314
198#define BCMA_CC_UART0_MSR 0x0318
199#define BCMA_CC_UART0_SCRATCH 0x031C
200#define BCMA_CC_UART1_DATA 0x0400
201#define BCMA_CC_UART1_IMR 0x0404
202#define BCMA_CC_UART1_FCR 0x0408
203#define BCMA_CC_UART1_LCR 0x040C
204#define BCMA_CC_UART1_MCR 0x0410
205#define BCMA_CC_UART1_LSR 0x0414
206#define BCMA_CC_UART1_MSR 0x0418
207#define BCMA_CC_UART1_SCRATCH 0x041C
208/* PMU registers (rev >= 20) */
209#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */
210#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
211#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16
212#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
213#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
214#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
215#define BCMA_CC_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */
216#define BCMA_CC_PMU_CTL_XTALFREQ_SHIFT 2
217#define BCMA_CC_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */
218#define BCMA_CC_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */
219#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
220#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
221#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
222#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
223#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
224#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
225#define BCMA_CC_PMU_STAT_HAVEHT 0x00000004 /* HT available */
226#define BCMA_CC_PMU_STAT_RESINIT 0x00000003 /* Res init */
227#define BCMA_CC_PMU_RES_STAT 0x060C /* PMU res status */
228#define BCMA_CC_PMU_RES_PEND 0x0610 /* PMU res pending */
229#define BCMA_CC_PMU_TIMER 0x0614 /* PMU timer */
230#define BCMA_CC_PMU_MINRES_MSK 0x0618 /* PMU min res mask */
231#define BCMA_CC_PMU_MAXRES_MSK 0x061C /* PMU max res mask */
232#define BCMA_CC_PMU_RES_TABSEL 0x0620 /* PMU res table sel */
233#define BCMA_CC_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */
234#define BCMA_CC_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */
235#define BCMA_CC_PMU_RES_TIMER 0x062C /* PMU res timer */
236#define BCMA_CC_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */
237#define BCMA_CC_PMU_WATCHDOG 0x0634 /* PMU watchdog */
238#define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
239#define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */
240#define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */
241#define BCMA_CC_CHIPCTL_ADDR 0x0650
242#define BCMA_CC_CHIPCTL_DATA 0x0654
243#define BCMA_CC_REGCTL_ADDR 0x0658
244#define BCMA_CC_REGCTL_DATA 0x065C
245#define BCMA_CC_PLLCTL_ADDR 0x0660
246#define BCMA_CC_PLLCTL_DATA 0x0664
247
248/* Data for the PMU, if available.
249 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
250 */
251struct bcma_chipcommon_pmu {
252 u8 rev; /* PMU revision */
253 u32 crystalfreq; /* The active crystal frequency (in kHz) */
254};
255
256struct bcma_drv_cc {
257 struct bcma_device *core;
258 u32 status;
259 u32 capabilities;
260 u32 capabilities_ext;
261 /* Fast Powerup Delay constant */
262 u16 fast_pwrup_delay;
263 struct bcma_chipcommon_pmu pmu;
264};
265
266/* Register access */
267#define bcma_cc_read32(cc, offset) \
268 bcma_read32((cc)->core, offset)
269#define bcma_cc_write32(cc, offset, val) \
270 bcma_write32((cc)->core, offset, val)
271
272#define bcma_cc_mask32(cc, offset, mask) \
273 bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) & (mask))
274#define bcma_cc_set32(cc, offset, set) \
275 bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) | (set))
276#define bcma_cc_maskset32(cc, offset, mask, set) \
277 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
278
279extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
280
281extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
282extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
283
284extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc,
285 u32 ticks);
286
287void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
288
289u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask);
290
291/* Chipcommon GPIO pin access. */
292u32 bcma_chipco_gpio_in(struct bcma_drv_cc *cc, u32 mask);
293u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value);
294u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value);
295u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
296u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
297u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
298
299/* PMU support */
300extern void bcma_pmu_init(struct bcma_drv_cc *cc);
301
302#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
new file mode 100644
index 000000000000..b7e191cf00ec
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -0,0 +1,89 @@
1#ifndef LINUX_BCMA_DRIVER_PCI_H_
2#define LINUX_BCMA_DRIVER_PCI_H_
3
4#include <linux/types.h>
5
6struct pci_dev;
7
8/** PCI core registers. **/
9#define BCMA_CORE_PCI_CTL 0x0000 /* PCI Control */
10#define BCMA_CORE_PCI_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */
11#define BCMA_CORE_PCI_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */
12#define BCMA_CORE_PCI_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */
13#define BCMA_CORE_PCI_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */
14#define BCMA_CORE_PCI_ARBCTL 0x0010 /* PCI Arbiter Control */
15#define BCMA_CORE_PCI_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */
16#define BCMA_CORE_PCI_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */
17#define BCMA_CORE_PCI_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */
18#define BCMA_CORE_PCI_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */
19#define BCMA_CORE_PCI_ARBCTL_PARKID_4710 0x00000002 /* 4710 */
20#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */
21#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */
22#define BCMA_CORE_PCI_ISTAT 0x0020 /* Interrupt status */
23#define BCMA_CORE_PCI_ISTAT_INTA 0x00000001 /* PCI INTA# */
24#define BCMA_CORE_PCI_ISTAT_INTB 0x00000002 /* PCI INTB# */
25#define BCMA_CORE_PCI_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */
26#define BCMA_CORE_PCI_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */
27#define BCMA_CORE_PCI_ISTAT_PME 0x00000010 /* PCI PME# */
28#define BCMA_CORE_PCI_IMASK 0x0024 /* Interrupt mask */
29#define BCMA_CORE_PCI_IMASK_INTA 0x00000001 /* PCI INTA# */
30#define BCMA_CORE_PCI_IMASK_INTB 0x00000002 /* PCI INTB# */
31#define BCMA_CORE_PCI_IMASK_SERR 0x00000004 /* PCI SERR# */
32#define BCMA_CORE_PCI_IMASK_PERR 0x00000008 /* PCI PERR# */
33#define BCMA_CORE_PCI_IMASK_PME 0x00000010 /* PCI PME# */
34#define BCMA_CORE_PCI_MBOX 0x0028 /* Backplane to PCI Mailbox */
35#define BCMA_CORE_PCI_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */
36#define BCMA_CORE_PCI_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */
37#define BCMA_CORE_PCI_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */
38#define BCMA_CORE_PCI_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */
39#define BCMA_CORE_PCI_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */
40#define BCMA_CORE_PCI_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */
41#define BCMA_CORE_PCI_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */
42#define BCMA_CORE_PCI_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */
43#define BCMA_CORE_PCI_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */
44#define BCMA_CORE_PCI_BCAST_ADDR_MASK 0x000000FF
45#define BCMA_CORE_PCI_BCAST_DATA 0x0054 /* Backplane Broadcast Data */
46#define BCMA_CORE_PCI_GPIO_IN 0x0060 /* rev >= 2 only */
47#define BCMA_CORE_PCI_GPIO_OUT 0x0064 /* rev >= 2 only */
48#define BCMA_CORE_PCI_GPIO_ENABLE 0x0068 /* rev >= 2 only */
49#define BCMA_CORE_PCI_GPIO_CTL 0x006C /* rev >= 2 only */
50#define BCMA_CORE_PCI_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */
51#define BCMA_CORE_PCI_SBTOPCI0_MASK 0xFC000000
52#define BCMA_CORE_PCI_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */
53#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000
54#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
55#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000
56#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
57#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
58#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
59#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
60#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
61
62/* SBtoPCIx */
63#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
64#define BCMA_CORE_PCI_SBTOPCI_IO 0x00000001
65#define BCMA_CORE_PCI_SBTOPCI_CFG0 0x00000002
66#define BCMA_CORE_PCI_SBTOPCI_CFG1 0x00000003
67#define BCMA_CORE_PCI_SBTOPCI_PREF 0x00000004 /* Prefetch enable */
68#define BCMA_CORE_PCI_SBTOPCI_BURST 0x00000008 /* Burst enable */
69#define BCMA_CORE_PCI_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */
70#define BCMA_CORE_PCI_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */
71#define BCMA_CORE_PCI_SBTOPCI_RC_READ 0x00000000 /* Memory read */
72#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */
73#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */
74
75/* PCIcore specific boardflags */
76#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
77
78struct bcma_drv_pci {
79 struct bcma_device *core;
80 u8 setup_done:1;
81};
82
83/* Register access */
84#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
85#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
86
87extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
88
89#endif /* LINUX_BCMA_DRIVER_PCI_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
new file mode 100644
index 000000000000..f82d88a960ce
--- /dev/null
+++ b/include/linux/bcma/bcma_regs.h
@@ -0,0 +1,34 @@
1#ifndef LINUX_BCMA_REGS_H_
2#define LINUX_BCMA_REGS_H_
3
4/* Agent registers (common for every core) */
5#define BCMA_IOCTL 0x0408
6#define BCMA_IOCTL_CLK 0x0001
7#define BCMA_IOCTL_FGC 0x0002
8#define BCMA_IOCTL_CORE_BITS 0x3FFC
9#define BCMA_IOCTL_PME_EN 0x4000
10#define BCMA_IOCTL_BIST_EN 0x8000
11#define BCMA_RESET_CTL 0x0800
12#define BCMA_RESET_CTL_RESET 0x0001
13
14/* BCMA PCI config space registers. */
15#define BCMA_PCI_PMCSR 0x44
16#define BCMA_PCI_PE 0x100
17#define BCMA_PCI_BAR0_WIN 0x80 /* Backplane address space 0 */
18#define BCMA_PCI_BAR1_WIN 0x84 /* Backplane address space 1 */
19#define BCMA_PCI_SPROMCTL 0x88 /* SPROM control */
20#define BCMA_PCI_SPROMCTL_WE 0x10 /* SPROM write enable */
21#define BCMA_PCI_BAR1_CONTROL 0x8c /* Address space 1 burst control */
22#define BCMA_PCI_IRQS 0x90 /* PCI interrupts */
23#define BCMA_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */
24#define BCMA_PCI_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */
25#define BCMA_PCI_BAR0_WIN2 0xAC
26#define BCMA_PCI_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */
27#define BCMA_PCI_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */
28#define BCMA_PCI_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */
29#define BCMA_PCI_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */
30#define BCMA_PCI_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */
31#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
32#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
33
34#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/bfin_mac.h b/include/linux/bfin_mac.h
index 904dec7d03a1..a69554ef8476 100644
--- a/include/linux/bfin_mac.h
+++ b/include/linux/bfin_mac.h
@@ -24,6 +24,7 @@ struct bfin_mii_bus_platform_data {
24 const unsigned short *mac_peripherals; 24 const unsigned short *mac_peripherals;
25 int phy_mode; 25 int phy_mode;
26 unsigned int phy_mask; 26 unsigned int phy_mask;
27 unsigned short vlan1_mask, vlan2_mask;
27}; 28};
28 29
29#endif 30#endif
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index a065612fc928..c3d6512eded1 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -25,10 +25,11 @@ struct pt_regs;
25/* 25/*
26 * This structure is used to hold the arguments that are used when loading binaries. 26 * This structure is used to hold the arguments that are used when loading binaries.
27 */ 27 */
28struct linux_binprm{ 28struct linux_binprm {
29 char buf[BINPRM_BUF_SIZE]; 29 char buf[BINPRM_BUF_SIZE];
30#ifdef CONFIG_MMU 30#ifdef CONFIG_MMU
31 struct vm_area_struct *vma; 31 struct vm_area_struct *vma;
32 unsigned long vma_pages;
32#else 33#else
33# define MAX_ARG_PAGES 32 34# define MAX_ARG_PAGES 32
34 struct page *page[MAX_ARG_PAGES]; 35 struct page *page[MAX_ARG_PAGES];
@@ -59,6 +60,10 @@ struct linux_binprm{
59 unsigned long loader, exec; 60 unsigned long loader, exec;
60}; 61};
61 62
63extern void acct_arg_size(struct linux_binprm *bprm, unsigned long pages);
64extern struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
65 int write);
66
62#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 67#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
63#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) 68#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
64 69
@@ -88,7 +93,6 @@ struct linux_binfmt {
88 int (*load_shlib)(struct file *); 93 int (*load_shlib)(struct file *);
89 int (*core_dump)(struct coredump_params *cprm); 94 int (*core_dump)(struct coredump_params *cprm);
90 unsigned long min_coredump; /* minimal dump size */ 95 unsigned long min_coredump; /* minimal dump size */
91 int hasvdso;
92}; 96};
93 97
94extern int __register_binfmt(struct linux_binfmt *fmt, int insert); 98extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
@@ -108,7 +112,7 @@ extern void unregister_binfmt(struct linux_binfmt *);
108 112
109extern int prepare_binprm(struct linux_binprm *); 113extern int prepare_binprm(struct linux_binprm *);
110extern int __must_check remove_arg_zero(struct linux_binprm *); 114extern int __must_check remove_arg_zero(struct linux_binprm *);
111extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); 115extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
112extern int flush_old_exec(struct linux_binprm * bprm); 116extern int flush_old_exec(struct linux_binprm * bprm);
113extern void setup_new_exec(struct linux_binprm * bprm); 117extern void setup_new_exec(struct linux_binprm * bprm);
114 118
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ba679992d39b..ce33e6868a2f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -66,10 +66,6 @@
66#define bio_offset(bio) bio_iovec((bio))->bv_offset 66#define bio_offset(bio) bio_iovec((bio))->bv_offset
67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
68#define bio_sectors(bio) ((bio)->bi_size >> 9) 68#define bio_sectors(bio) ((bio)->bi_size >> 9)
69#define bio_empty_barrier(bio) \
70 ((bio->bi_rw & REQ_HARDBARRIER) && \
71 !bio_has_data(bio) && \
72 !(bio->bi_rw & REQ_DISCARD))
73 69
74static inline unsigned int bio_cur_bytes(struct bio *bio) 70static inline unsigned int bio_cur_bytes(struct bio *bio)
75{ 71{
@@ -308,7 +304,6 @@ struct biovec_slab {
308}; 304};
309 305
310extern struct bio_set *fs_bio_set; 306extern struct bio_set *fs_bio_set;
311extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
312 307
313/* 308/*
314 * a small number of entries is fine, not going to be performance critical. 309 * a small number of entries is fine, not going to be performance critical.
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index 7113a32a86ea..b4326bfa684f 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -1,6 +1,10 @@
1#ifndef __LINUX_BIT_SPINLOCK_H 1#ifndef __LINUX_BIT_SPINLOCK_H
2#define __LINUX_BIT_SPINLOCK_H 2#define __LINUX_BIT_SPINLOCK_H
3 3
4#include <linux/kernel.h>
5#include <linux/preempt.h>
6#include <asm/atomic.h>
7
4/* 8/*
5 * bit-based spin_lock() 9 * bit-based spin_lock()
6 * 10 *
@@ -19,11 +23,11 @@ static inline void bit_spin_lock(int bitnum, unsigned long *addr)
19 preempt_disable(); 23 preempt_disable();
20#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 24#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
21 while (unlikely(test_and_set_bit_lock(bitnum, addr))) { 25 while (unlikely(test_and_set_bit_lock(bitnum, addr))) {
22 while (test_bit(bitnum, addr)) { 26 preempt_enable();
23 preempt_enable(); 27 do {
24 cpu_relax(); 28 cpu_relax();
25 preempt_disable(); 29 } while (test_bit(bitnum, addr));
26 } 30 preempt_disable();
27 } 31 }
28#endif 32#endif
29 __acquire(bitlock); 33 __acquire(bitlock);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 827cc95711ef..2184c6b97aeb 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -109,6 +109,17 @@ static inline __u8 ror8(__u8 word, unsigned int shift)
109 return (word >> shift) | (word << (8 - shift)); 109 return (word >> shift) | (word << (8 - shift));
110} 110}
111 111
112/**
113 * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
114 * @value: value to sign extend
115 * @index: 0 based bit index (0<=index<32) to sign bit
116 */
117static inline __s32 sign_extend32(__u32 value, int index)
118{
119 __u8 shift = 31 - index;
120 return (__s32)(value << shift) >> shift;
121}
122
112static inline unsigned fls_long(unsigned long l) 123static inline unsigned fls_long(unsigned long l)
113{ 124{
114 if (sizeof(l) == 4) 125 if (sizeof(l) == 4)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 0437ab6bb54c..be50d9e70a7d 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -122,14 +122,12 @@ enum rq_flag_bits {
122 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ 122 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
123 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ 123 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
124 124
125 __REQ_HARDBARRIER, /* may not be passed by drive either */
126 __REQ_SYNC, /* request is sync (sync write or read) */ 125 __REQ_SYNC, /* request is sync (sync write or read) */
127 __REQ_META, /* metadata io request */ 126 __REQ_META, /* metadata io request */
128 __REQ_DISCARD, /* request to discard sectors */ 127 __REQ_DISCARD, /* request to discard sectors */
129 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
130 129
131 /* bio only flags */ 130 /* bio only flags */
132 __REQ_UNPLUG, /* unplug the immediately after submission */
133 __REQ_RAHEAD, /* read ahead, can fail anytime */ 131 __REQ_RAHEAD, /* read ahead, can fail anytime */
134 __REQ_THROTTLED, /* This bio has already been subjected to 132 __REQ_THROTTLED, /* This bio has already been subjected to
135 * throttling rules. Don't do it again. */ 133 * throttling rules. Don't do it again. */
@@ -149,9 +147,11 @@ enum rq_flag_bits {
149 __REQ_ALLOCED, /* request came from our alloc pool */ 147 __REQ_ALLOCED, /* request came from our alloc pool */
150 __REQ_COPY_USER, /* contains copies of user pages */ 148 __REQ_COPY_USER, /* contains copies of user pages */
151 __REQ_FLUSH, /* request for cache flush */ 149 __REQ_FLUSH, /* request for cache flush */
150 __REQ_FLUSH_SEQ, /* request for flush sequence */
152 __REQ_IO_STAT, /* account I/O stat */ 151 __REQ_IO_STAT, /* account I/O stat */
153 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
154 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ 153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
154 __REQ_ON_PLUG, /* on plug list */
155 __REQ_NR_BITS, /* stops here */ 155 __REQ_NR_BITS, /* stops here */
156}; 156};
157 157
@@ -159,7 +159,6 @@ enum rq_flag_bits {
159#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) 159#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
160#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) 160#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
161#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) 161#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
162#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
163#define REQ_SYNC (1 << __REQ_SYNC) 162#define REQ_SYNC (1 << __REQ_SYNC)
164#define REQ_META (1 << __REQ_META) 163#define REQ_META (1 << __REQ_META)
165#define REQ_DISCARD (1 << __REQ_DISCARD) 164#define REQ_DISCARD (1 << __REQ_DISCARD)
@@ -168,11 +167,10 @@ enum rq_flag_bits {
168#define REQ_FAILFAST_MASK \ 167#define REQ_FAILFAST_MASK \
169 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 168 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
170#define REQ_COMMON_MASK \ 169#define REQ_COMMON_MASK \
171 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \ 170 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_DISCARD | \
172 REQ_META | REQ_DISCARD | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 171 REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
173#define REQ_CLONE_MASK REQ_COMMON_MASK 172#define REQ_CLONE_MASK REQ_COMMON_MASK
174 173
175#define REQ_UNPLUG (1 << __REQ_UNPLUG)
176#define REQ_RAHEAD (1 << __REQ_RAHEAD) 174#define REQ_RAHEAD (1 << __REQ_RAHEAD)
177#define REQ_THROTTLED (1 << __REQ_THROTTLED) 175#define REQ_THROTTLED (1 << __REQ_THROTTLED)
178 176
@@ -190,8 +188,10 @@ enum rq_flag_bits {
190#define REQ_ALLOCED (1 << __REQ_ALLOCED) 188#define REQ_ALLOCED (1 << __REQ_ALLOCED)
191#define REQ_COPY_USER (1 << __REQ_COPY_USER) 189#define REQ_COPY_USER (1 << __REQ_COPY_USER)
192#define REQ_FLUSH (1 << __REQ_FLUSH) 190#define REQ_FLUSH (1 << __REQ_FLUSH)
191#define REQ_FLUSH_SEQ (1 << __REQ_FLUSH_SEQ)
193#define REQ_IO_STAT (1 << __REQ_IO_STAT) 192#define REQ_IO_STAT (1 << __REQ_IO_STAT)
194#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 193#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
195#define REQ_SECURE (1 << __REQ_SECURE) 194#define REQ_SECURE (1 << __REQ_SECURE)
195#define REQ_ON_PLUG (1 << __REQ_ON_PLUG)
196 196
197#endif /* __LINUX_BLK_TYPES_H */ 197#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 646b462d04df..2ad95fa1d130 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -108,13 +108,20 @@ struct request {
108 108
109 /* 109 /*
110 * Three pointers are available for the IO schedulers, if they need 110 * Three pointers are available for the IO schedulers, if they need
111 * more they have to dynamically allocate it. 111 * more they have to dynamically allocate it. Flush requests are
112 * never put on the IO scheduler. So let the flush fields share
113 * space with the three elevator_private pointers.
112 */ 114 */
113 void *elevator_private; 115 union {
114 void *elevator_private2; 116 void *elevator_private[3];
115 void *elevator_private3; 117 struct {
118 unsigned int seq;
119 struct list_head list;
120 } flush;
121 };
116 122
117 struct gendisk *rq_disk; 123 struct gendisk *rq_disk;
124 struct hd_struct *part;
118 unsigned long start_time; 125 unsigned long start_time;
119#ifdef CONFIG_BLK_CGROUP 126#ifdef CONFIG_BLK_CGROUP
120 unsigned long long start_time_ns; 127 unsigned long long start_time_ns;
@@ -189,7 +196,6 @@ typedef void (request_fn_proc) (struct request_queue *q);
189typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 196typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
190typedef int (prep_rq_fn) (struct request_queue *, struct request *); 197typedef int (prep_rq_fn) (struct request_queue *, struct request *);
191typedef void (unprep_rq_fn) (struct request_queue *, struct request *); 198typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
192typedef void (unplug_fn) (struct request_queue *);
193 199
194struct bio_vec; 200struct bio_vec;
195struct bvec_merge_data { 201struct bvec_merge_data {
@@ -250,7 +256,7 @@ struct queue_limits {
250 256
251 unsigned char misaligned; 257 unsigned char misaligned;
252 unsigned char discard_misaligned; 258 unsigned char discard_misaligned;
253 unsigned char no_cluster; 259 unsigned char cluster;
254 signed char discard_zeroes_data; 260 signed char discard_zeroes_data;
255}; 261};
256 262
@@ -272,7 +278,6 @@ struct request_queue
272 make_request_fn *make_request_fn; 278 make_request_fn *make_request_fn;
273 prep_rq_fn *prep_rq_fn; 279 prep_rq_fn *prep_rq_fn;
274 unprep_rq_fn *unprep_rq_fn; 280 unprep_rq_fn *unprep_rq_fn;
275 unplug_fn *unplug_fn;
276 merge_bvec_fn *merge_bvec_fn; 281 merge_bvec_fn *merge_bvec_fn;
277 softirq_done_fn *softirq_done_fn; 282 softirq_done_fn *softirq_done_fn;
278 rq_timed_out_fn *rq_timed_out_fn; 283 rq_timed_out_fn *rq_timed_out_fn;
@@ -286,12 +291,9 @@ struct request_queue
286 struct request *boundary_rq; 291 struct request *boundary_rq;
287 292
288 /* 293 /*
289 * Auto-unplugging state 294 * Delayed queue handling
290 */ 295 */
291 struct timer_list unplug_timer; 296 struct delayed_work delay_work;
292 int unplug_thresh; /* After this many requests */
293 unsigned long unplug_delay; /* After this many jiffies */
294 struct work_struct unplug_work;
295 297
296 struct backing_dev_info backing_dev_info; 298 struct backing_dev_info backing_dev_info;
297 299
@@ -362,11 +364,12 @@ struct request_queue
362 * for flush operations 364 * for flush operations
363 */ 365 */
364 unsigned int flush_flags; 366 unsigned int flush_flags;
365 unsigned int flush_seq; 367 unsigned int flush_pending_idx:1;
366 int flush_err; 368 unsigned int flush_running_idx:1;
369 unsigned long flush_pending_since;
370 struct list_head flush_queue[2];
371 struct list_head flush_data_in_flight;
367 struct request flush_rq; 372 struct request flush_rq;
368 struct request *orig_flush_rq;
369 struct list_head pending_flushes;
370 373
371 struct mutex sysfs_lock; 374 struct mutex sysfs_lock;
372 375
@@ -380,30 +383,26 @@ struct request_queue
380#endif 383#endif
381}; 384};
382 385
383#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
384#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 386#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
385#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 387#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
386#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ 388#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
387#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ 389#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
388#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 390#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
389#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 391#define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */
390#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 392#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */
391#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 393#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */
392#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 394#define QUEUE_FLAG_SAME_COMP 9 /* force complete on same CPU */
393#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ 395#define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */
394#define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */ 396#define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */
395#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ 397#define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */
396#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
397#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
398#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 398#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
399#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 399#define QUEUE_FLAG_IO_STAT 13 /* do IO stats */
400#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 400#define QUEUE_FLAG_DISCARD 14 /* supports DISCARD */
401#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ 401#define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */
402#define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ 402#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */
403#define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ 403#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
404 404
405#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 405#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
406 (1 << QUEUE_FLAG_CLUSTER) | \
407 (1 << QUEUE_FLAG_STACKABLE) | \ 406 (1 << QUEUE_FLAG_STACKABLE) | \
408 (1 << QUEUE_FLAG_SAME_COMP) | \ 407 (1 << QUEUE_FLAG_SAME_COMP) | \
409 (1 << QUEUE_FLAG_ADD_RANDOM)) 408 (1 << QUEUE_FLAG_ADD_RANDOM))
@@ -473,7 +472,6 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
473 __clear_bit(flag, &q->queue_flags); 472 __clear_bit(flag, &q->queue_flags);
474} 473}
475 474
476#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
477#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 475#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
478#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 476#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
479#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 477#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
@@ -510,6 +508,11 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
510 508
511#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 509#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
512 510
511static inline unsigned int blk_queue_cluster(struct request_queue *q)
512{
513 return q->limits.cluster;
514}
515
513/* 516/*
514 * We regard a request as sync, if either a read or a sync write 517 * We regard a request as sync, if either a read or a sync write
515 */ 518 */
@@ -552,8 +555,7 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
552 * it already be started by driver. 555 * it already be started by driver.
553 */ 556 */
554#define RQ_NOMERGE_FLAGS \ 557#define RQ_NOMERGE_FLAGS \
555 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER | \ 558 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA)
556 REQ_FLUSH | REQ_FUA)
557#define rq_mergeable(rq) \ 559#define rq_mergeable(rq) \
558 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 560 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
559 (((rq)->cmd_flags & REQ_DISCARD) || \ 561 (((rq)->cmd_flags & REQ_DISCARD) || \
@@ -644,7 +646,6 @@ static inline void rq_flush_dcache_pages(struct request *rq)
644 646
645extern int blk_register_queue(struct gendisk *disk); 647extern int blk_register_queue(struct gendisk *disk);
646extern void blk_unregister_queue(struct gendisk *disk); 648extern void blk_unregister_queue(struct gendisk *disk);
647extern void register_disk(struct gendisk *dev);
648extern void generic_make_request(struct bio *bio); 649extern void generic_make_request(struct bio *bio);
649extern void blk_rq_init(struct request_queue *q, struct request *rq); 650extern void blk_rq_init(struct request_queue *q, struct request *rq);
650extern void blk_put_request(struct request *); 651extern void blk_put_request(struct request *);
@@ -665,9 +666,7 @@ extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
665extern void blk_rq_unprep_clone(struct request *rq); 666extern void blk_rq_unprep_clone(struct request *rq);
666extern int blk_insert_cloned_request(struct request_queue *q, 667extern int blk_insert_cloned_request(struct request_queue *q,
667 struct request *rq); 668 struct request *rq);
668extern void blk_plug_device(struct request_queue *); 669extern void blk_delay_queue(struct request_queue *, unsigned long);
669extern void blk_plug_device_unlocked(struct request_queue *);
670extern int blk_remove_plug(struct request_queue *);
671extern void blk_recount_segments(struct request_queue *, struct bio *); 670extern void blk_recount_segments(struct request_queue *, struct bio *);
672extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, 671extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
673 unsigned int, void __user *); 672 unsigned int, void __user *);
@@ -697,8 +696,9 @@ extern void blk_start_queue(struct request_queue *q);
697extern void blk_stop_queue(struct request_queue *q); 696extern void blk_stop_queue(struct request_queue *q);
698extern void blk_sync_queue(struct request_queue *q); 697extern void blk_sync_queue(struct request_queue *q);
699extern void __blk_stop_queue(struct request_queue *q); 698extern void __blk_stop_queue(struct request_queue *q);
700extern void __blk_run_queue(struct request_queue *); 699extern void __blk_run_queue(struct request_queue *q);
701extern void blk_run_queue(struct request_queue *); 700extern void blk_run_queue(struct request_queue *);
701extern void blk_run_queue_async(struct request_queue *q);
702extern int blk_rq_map_user(struct request_queue *, struct request *, 702extern int blk_rq_map_user(struct request_queue *, struct request *,
703 struct rq_map_data *, void __user *, unsigned long, 703 struct rq_map_data *, void __user *, unsigned long,
704 gfp_t); 704 gfp_t);
@@ -711,7 +711,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
711 struct request *, int); 711 struct request *, int);
712extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 712extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
713 struct request *, int, rq_end_io_fn *); 713 struct request *, int, rq_end_io_fn *);
714extern void blk_unplug(struct request_queue *q);
715 714
716static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 715static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
717{ 716{
@@ -806,6 +805,7 @@ extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
806extern void blk_cleanup_queue(struct request_queue *); 805extern void blk_cleanup_queue(struct request_queue *);
807extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 806extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
808extern void blk_queue_bounce_limit(struct request_queue *, u64); 807extern void blk_queue_bounce_limit(struct request_queue *, u64);
808extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int);
809extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); 809extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
810extern void blk_queue_max_segments(struct request_queue *, unsigned short); 810extern void blk_queue_max_segments(struct request_queue *, unsigned short);
811extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 811extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
@@ -847,7 +847,6 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd
847 847
848extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 848extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
849extern void blk_dump_rq_flags(struct request *, char *); 849extern void blk_dump_rq_flags(struct request *, char *);
850extern void generic_unplug_device(struct request_queue *);
851extern long nr_blockdev_pages(void); 850extern long nr_blockdev_pages(void);
852 851
853int blk_get_queue(struct request_queue *); 852int blk_get_queue(struct request_queue *);
@@ -855,6 +854,44 @@ struct request_queue *blk_alloc_queue(gfp_t);
855struct request_queue *blk_alloc_queue_node(gfp_t, int); 854struct request_queue *blk_alloc_queue_node(gfp_t, int);
856extern void blk_put_queue(struct request_queue *); 855extern void blk_put_queue(struct request_queue *);
857 856
857struct blk_plug {
858 unsigned long magic;
859 struct list_head list;
860 struct list_head cb_list;
861 unsigned int should_sort;
862};
863struct blk_plug_cb {
864 struct list_head list;
865 void (*callback)(struct blk_plug_cb *);
866};
867
868extern void blk_start_plug(struct blk_plug *);
869extern void blk_finish_plug(struct blk_plug *);
870extern void blk_flush_plug_list(struct blk_plug *, bool);
871
872static inline void blk_flush_plug(struct task_struct *tsk)
873{
874 struct blk_plug *plug = tsk->plug;
875
876 if (plug)
877 blk_flush_plug_list(plug, false);
878}
879
880static inline void blk_schedule_flush_plug(struct task_struct *tsk)
881{
882 struct blk_plug *plug = tsk->plug;
883
884 if (plug)
885 blk_flush_plug_list(plug, true);
886}
887
888static inline bool blk_needs_flush_plug(struct task_struct *tsk)
889{
890 struct blk_plug *plug = tsk->plug;
891
892 return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list));
893}
894
858/* 895/*
859 * tag stuff 896 * tag stuff
860 */ 897 */
@@ -891,6 +928,14 @@ static inline int sb_issue_discard(struct super_block *sb, sector_t block,
891 nr_blocks << (sb->s_blocksize_bits - 9), 928 nr_blocks << (sb->s_blocksize_bits - 9),
892 gfp_mask, flags); 929 gfp_mask, flags);
893} 930}
931static inline int sb_issue_zeroout(struct super_block *sb, sector_t block,
932 sector_t nr_blocks, gfp_t gfp_mask)
933{
934 return blkdev_issue_zeroout(sb->s_bdev,
935 block << (sb->s_blocksize_bits - 9),
936 nr_blocks << (sb->s_blocksize_bits - 9),
937 gfp_mask);
938}
894 939
895extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 940extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
896 941
@@ -1077,7 +1122,6 @@ static inline void put_dev_sector(Sector p)
1077 1122
1078struct work_struct; 1123struct work_struct;
1079int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1124int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1080int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
1081 1125
1082#ifdef CONFIG_BLK_CGROUP 1126#ifdef CONFIG_BLK_CGROUP
1083/* 1127/*
@@ -1125,8 +1169,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1125extern int blk_throtl_init(struct request_queue *q); 1169extern int blk_throtl_init(struct request_queue *q);
1126extern void blk_throtl_exit(struct request_queue *q); 1170extern void blk_throtl_exit(struct request_queue *q);
1127extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); 1171extern int blk_throtl_bio(struct request_queue *q, struct bio **bio);
1128extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay);
1129extern void throtl_shutdown_timer_wq(struct request_queue *q);
1130#else /* CONFIG_BLK_DEV_THROTTLING */ 1172#else /* CONFIG_BLK_DEV_THROTTLING */
1131static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) 1173static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1132{ 1174{
@@ -1135,8 +1177,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1135 1177
1136static inline int blk_throtl_init(struct request_queue *q) { return 0; } 1178static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1137static inline int blk_throtl_exit(struct request_queue *q) { return 0; } 1179static inline int blk_throtl_exit(struct request_queue *q) { return 0; }
1138static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {}
1139static inline void throtl_shutdown_timer_wq(struct request_queue *q) {}
1140#endif /* CONFIG_BLK_DEV_THROTTLING */ 1180#endif /* CONFIG_BLK_DEV_THROTTLING */
1141 1181
1142#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1182#define MODULE_ALIAS_BLOCKDEV(major,minor) \
@@ -1179,6 +1219,7 @@ struct blk_integrity {
1179 struct kobject kobj; 1219 struct kobject kobj;
1180}; 1220};
1181 1221
1222extern bool blk_integrity_is_initialized(struct gendisk *);
1182extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); 1223extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
1183extern void blk_integrity_unregister(struct gendisk *); 1224extern void blk_integrity_unregister(struct gendisk *);
1184extern int blk_integrity_compare(struct gendisk *, struct gendisk *); 1225extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
@@ -1235,6 +1276,7 @@ queue_max_integrity_segments(struct request_queue *q)
1235#define queue_max_integrity_segments(a) (0) 1276#define queue_max_integrity_segments(a) (0)
1236#define blk_integrity_merge_rq(a, b, c) (0) 1277#define blk_integrity_merge_rq(a, b, c) (0)
1237#define blk_integrity_merge_bio(a, b, c) (0) 1278#define blk_integrity_merge_bio(a, b, c) (0)
1279#define blk_integrity_is_initialized(a) (0)
1238 1280
1239#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1281#endif /* CONFIG_BLK_DEV_INTEGRITY */
1240 1282
@@ -1245,6 +1287,9 @@ struct block_device_operations {
1245 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1287 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1246 int (*direct_access) (struct block_device *, sector_t, 1288 int (*direct_access) (struct block_device *, sector_t,
1247 void **, unsigned long *); 1289 void **, unsigned long *);
1290 unsigned int (*check_events) (struct gendisk *disk,
1291 unsigned int clearing);
1292 /* ->media_changed() is DEPRECATED, use ->check_events() instead */
1248 int (*media_changed) (struct gendisk *); 1293 int (*media_changed) (struct gendisk *);
1249 void (*unlock_native_capacity) (struct gendisk *); 1294 void (*unlock_native_capacity) (struct gendisk *);
1250 int (*revalidate_disk) (struct gendisk *); 1295 int (*revalidate_disk) (struct gendisk *);
@@ -1267,6 +1312,31 @@ static inline long nr_blockdev_pages(void)
1267 return 0; 1312 return 0;
1268} 1313}
1269 1314
1315struct blk_plug {
1316};
1317
1318static inline void blk_start_plug(struct blk_plug *plug)
1319{
1320}
1321
1322static inline void blk_finish_plug(struct blk_plug *plug)
1323{
1324}
1325
1326static inline void blk_flush_plug(struct task_struct *task)
1327{
1328}
1329
1330static inline void blk_schedule_flush_plug(struct task_struct *task)
1331{
1332}
1333
1334
1335static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1336{
1337 return false;
1338}
1339
1270#endif /* CONFIG_BLOCK */ 1340#endif /* CONFIG_BLOCK */
1271 1341
1272#endif 1342#endif
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 3395cf7130f5..b22fb0d3db0f 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -245,7 +245,6 @@ static inline int blk_cmd_buf_len(struct request *rq)
245 245
246extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
247extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); 247extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes);
248extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq);
249 248
250#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ 249#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */
251 250
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 266ab9291232..01eca1794e14 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -19,10 +19,6 @@ extern unsigned long min_low_pfn;
19 */ 19 */
20extern unsigned long max_pfn; 20extern unsigned long max_pfn;
21 21
22#ifdef CONFIG_CRASH_DUMP
23extern unsigned long saved_max_pfn;
24#endif
25
26#ifndef CONFIG_NO_BOOTMEM 22#ifndef CONFIG_NO_BOOTMEM
27/* 23/*
28 * node_bootmem_map is a map pointer - the bits represent all physical 24 * node_bootmem_map is a map pointer - the bits represent all physical
@@ -105,6 +101,8 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
105 101
106#define alloc_bootmem(x) \ 102#define alloc_bootmem(x) \
107 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 103 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
104#define alloc_bootmem_align(x, align) \
105 __alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS))
108#define alloc_bootmem_nopanic(x) \ 106#define alloc_bootmem_nopanic(x) \
109 __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 107 __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
110#define alloc_bootmem_pages(x) \ 108#define alloc_bootmem_pages(x) \
@@ -113,6 +111,8 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
113 __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 111 __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
114#define alloc_bootmem_node(pgdat, x) \ 112#define alloc_bootmem_node(pgdat, x) \
115 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 113 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
114#define alloc_bootmem_node_nopanic(pgdat, x) \
115 __alloc_bootmem_node_nopanic(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
116#define alloc_bootmem_pages_node(pgdat, x) \ 116#define alloc_bootmem_pages_node(pgdat, x) \
117 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 117 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
118#define alloc_bootmem_pages_node_nopanic(pgdat, x) \ 118#define alloc_bootmem_pages_node_nopanic(pgdat, x) \
diff --git a/include/linux/bsearch.h b/include/linux/bsearch.h
new file mode 100644
index 000000000000..90b1aa867224
--- /dev/null
+++ b/include/linux/bsearch.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_BSEARCH_H
2#define _LINUX_BSEARCH_H
3
4#include <linux/types.h>
5
6void *bsearch(const void *key, const void *base, size_t num, size_t size,
7 int (*cmp)(const void *key, const void *elt));
8
9#endif /* _LINUX_BSEARCH_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index dd1b25b2641c..f5df23561b96 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -212,7 +212,6 @@ int generic_write_end(struct file *, struct address_space *,
212 loff_t, unsigned, unsigned, 212 loff_t, unsigned, unsigned,
213 struct page *, void *); 213 struct page *, void *);
214void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); 214void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
215int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
216int cont_write_begin(struct file *, struct address_space *, loff_t, 215int cont_write_begin(struct file *, struct address_space *, loff_t,
217 unsigned, unsigned, struct page **, void **, 216 unsigned, unsigned, struct page **, void **,
218 get_block_t *, loff_t *); 217 get_block_t *, loff_t *);
@@ -220,7 +219,6 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size);
220int block_commit_write(struct page *page, unsigned from, unsigned to); 219int block_commit_write(struct page *page, unsigned from, unsigned to);
221int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, 220int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
222 get_block_t get_block); 221 get_block_t get_block);
223void block_sync_page(struct page *);
224sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 222sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
225int block_truncate_page(struct address_space *, loff_t, get_block_t *); 223int block_truncate_page(struct address_space *, loff_t, get_block_t *);
226int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, 224int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild
new file mode 100644
index 000000000000..a9cf250689dc
--- /dev/null
+++ b/include/linux/caif/Kbuild
@@ -0,0 +1,2 @@
1header-y += caif_socket.h
2header-y += if_caif.h
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 6c507bea275f..5ce6b5d62ecc 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -36,16 +36,16 @@
36 * @prot: pointer to struct proto structure. 36 * @prot: pointer to struct proto structure.
37 */ 37 */
38struct can_proto { 38struct can_proto {
39 int type; 39 int type;
40 int protocol; 40 int protocol;
41 struct proto_ops *ops; 41 const struct proto_ops *ops;
42 struct proto *prot; 42 struct proto *prot;
43}; 43};
44 44
45/* function prototypes for the CAN networklayer core (af_can.c) */ 45/* function prototypes for the CAN networklayer core (af_can.c) */
46 46
47extern int can_proto_register(struct can_proto *cp); 47extern int can_proto_register(const struct can_proto *cp);
48extern void can_proto_unregister(struct can_proto *cp); 48extern void can_proto_unregister(const struct can_proto *cp);
49 49
50extern int can_rx_register(struct net_device *dev, canid_t can_id, 50extern int can_rx_register(struct net_device *dev, canid_t can_id,
51 canid_t mask, 51 canid_t mask,
@@ -58,5 +58,6 @@ extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58 void *data); 58 void *data);
59 59
60extern int can_send(struct sk_buff *skb, int loop); 60extern int can_send(struct sk_buff *skb, int loop);
61extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
61 62
62#endif /* CAN_CORE_H */ 63#endif /* CAN_CORE_H */
diff --git a/include/linux/can/error.h b/include/linux/can/error.h
index d4127fd9e681..5958074302a4 100644
--- a/include/linux/can/error.h
+++ b/include/linux/can/error.h
@@ -51,7 +51,7 @@
51#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ 51#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
52#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ 52#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
53#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ 53#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
54#define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */ 54#define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */
55 55
56/* error in CAN protocol (location) / data[3] */ 56/* error in CAN protocol (location) / data[3] */
57#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ 57#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
index 3250de935e1a..34542d374dd8 100644
--- a/include/linux/can/netlink.h
+++ b/include/linux/can/netlink.h
@@ -17,7 +17,7 @@
17/* 17/*
18 * CAN bit-timing parameters 18 * CAN bit-timing parameters
19 * 19 *
20 * For futher information, please read chapter "8 BIT TIMING 20 * For further information, please read chapter "8 BIT TIMING
21 * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" 21 * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
22 * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. 22 * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
23 */ 23 */
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 8e20540043f5..089fe43211a4 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -12,6 +12,7 @@
12/** 12/**
13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data 13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
14 * @oscillator_frequency: - oscillator frequency in Hz 14 * @oscillator_frequency: - oscillator frequency in Hz
15 * @irq_flags: - IRQF configuration flags
15 * @board_specific_setup: - called before probing the chip (power,reset) 16 * @board_specific_setup: - called before probing the chip (power,reset)
16 * @transceiver_enable: - called to power on/off the transceiver 17 * @transceiver_enable: - called to power on/off the transceiver
17 * @power_enable: - called to power on/off the mcp *and* the 18 * @power_enable: - called to power on/off the mcp *and* the
@@ -24,6 +25,7 @@
24 25
25struct mcp251x_platform_data { 26struct mcp251x_platform_data {
26 unsigned long oscillator_frequency; 27 unsigned long oscillator_frequency;
28 unsigned long irq_flags;
27 int (*board_specific_setup)(struct spi_device *spi); 29 int (*board_specific_setup)(struct spi_device *spi);
28 int (*transceiver_enable)(int enable); 30 int (*transceiver_enable)(int enable);
29 int (*power_enable) (int enable); 31 int (*power_enable) (int enable);
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 90012b9ddbf3..4554db0cde86 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -246,7 +246,6 @@ struct cpu_vfs_cap_data {
246/* Allow configuration of the secure attention key */ 246/* Allow configuration of the secure attention key */
247/* Allow administration of the random device */ 247/* Allow administration of the random device */
248/* Allow examination and configuration of disk quotas */ 248/* Allow examination and configuration of disk quotas */
249/* Allow configuring the kernel's syslog (printk behaviour) */
250/* Allow setting the domainname */ 249/* Allow setting the domainname */
251/* Allow setting the hostname */ 250/* Allow setting the hostname */
252/* Allow calling bdflush() */ 251/* Allow calling bdflush() */
@@ -352,7 +351,16 @@ struct cpu_vfs_cap_data {
352 351
353#define CAP_MAC_ADMIN 33 352#define CAP_MAC_ADMIN 33
354 353
355#define CAP_LAST_CAP CAP_MAC_ADMIN 354/* Allow configuring the kernel's syslog (printk behaviour) */
355
356#define CAP_SYSLOG 34
357
358/* Allow triggering something that will wake the system */
359
360#define CAP_WAKE_ALARM 35
361
362
363#define CAP_LAST_CAP CAP_WAKE_ALARM
356 364
357#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 365#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
358 366
@@ -365,6 +373,15 @@ struct cpu_vfs_cap_data {
365 373
366#ifdef __KERNEL__ 374#ifdef __KERNEL__
367 375
376struct dentry;
377struct user_namespace;
378
379struct user_namespace *current_user_ns(void);
380
381extern const kernel_cap_t __cap_empty_set;
382extern const kernel_cap_t __cap_full_set;
383extern const kernel_cap_t __cap_init_eff_set;
384
368/* 385/*
369 * Internal kernel functions only 386 * Internal kernel functions only
370 */ 387 */
@@ -527,40 +544,16 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
527 cap_intersect(permitted, __cap_nfsd_set)); 544 cap_intersect(permitted, __cap_nfsd_set));
528} 545}
529 546
530extern const kernel_cap_t __cap_empty_set; 547extern bool has_capability(struct task_struct *t, int cap);
531extern const kernel_cap_t __cap_full_set; 548extern bool has_ns_capability(struct task_struct *t,
532extern const kernel_cap_t __cap_init_eff_set; 549 struct user_namespace *ns, int cap);
533 550extern bool has_capability_noaudit(struct task_struct *t, int cap);
534/** 551extern bool capable(int cap);
535 * has_capability - Determine if a task has a superior capability available 552extern bool ns_capable(struct user_namespace *ns, int cap);
536 * @t: The task in question 553extern bool task_ns_capable(struct task_struct *t, int cap);
537 * @cap: The capability to be tested for 554extern bool nsown_capable(int cap);
538 *
539 * Return true if the specified task has the given superior capability
540 * currently in effect, false if not.
541 *
542 * Note that this does not set PF_SUPERPRIV on the task.
543 */
544#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
545
546/**
547 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited)
548 * @t: The task in question
549 * @cap: The capability to be tested for
550 *
551 * Return true if the specified task has the given superior capability
552 * currently in effect, false if not, but don't write an audit message for the
553 * check.
554 *
555 * Note that this does not set PF_SUPERPRIV on the task.
556 */
557#define has_capability_noaudit(t, cap) \
558 (security_real_capable_noaudit((t), (cap)) == 0)
559
560extern int capable(int cap);
561 555
562/* audit system wants to get cap info from files as well */ 556/* audit system wants to get cap info from files as well */
563struct dentry;
564extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 557extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
565 558
566#endif /* __KERNEL__ */ 559#endif /* __KERNEL__ */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index f389e319a454..fb4591977b03 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -28,8 +28,6 @@ int cdev_add(struct cdev *, dev_t, unsigned);
28 28
29void cdev_del(struct cdev *); 29void cdev_del(struct cdev *);
30 30
31int cdev_index(struct inode *inode);
32
33void cd_forget(struct inode *); 31void cd_forget(struct inode *);
34 32
35extern struct backing_dev_info directly_mappable_cdev_bdi; 33extern struct backing_dev_info directly_mappable_cdev_bdi;
diff --git a/include/linux/cdk.h b/include/linux/cdk.h
index 0908daf7bf56..80093a8d4f64 100644
--- a/include/linux/cdk.h
+++ b/include/linux/cdk.h
@@ -149,7 +149,7 @@ typedef struct cdkhdr {
149/* 149/*
150 * Define the memory mapping structure. This structure is pointed to by 150 * Define the memory mapping structure. This structure is pointed to by
151 * the memp field in the stlcdkhdr struct. As many as these structures 151 * the memp field in the stlcdkhdr struct. As many as these structures
152 * as required are layed out in shared memory to define how the rest of 152 * as required are laid out in shared memory to define how the rest of
153 * shared memory is divided up. There will be one for each port. 153 * shared memory is divided up. There will be one for each port.
154 */ 154 */
155typedef struct cdkmem { 155typedef struct cdkmem {
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 78e904796622..35eae4b67503 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -946,6 +946,8 @@ struct cdrom_device_info {
946/* device-related storage */ 946/* device-related storage */
947 unsigned int options : 30; /* options flags */ 947 unsigned int options : 30; /* options flags */
948 unsigned mc_flags : 2; /* media change buffer flags */ 948 unsigned mc_flags : 2; /* media change buffer flags */
949 unsigned int vfs_events; /* cached events for vfs path */
950 unsigned int ioctl_events; /* cached events for ioctl path */
949 int use_count; /* number of times device opened */ 951 int use_count; /* number of times device opened */
950 char name[20]; /* name of the device type */ 952 char name[20]; /* name of the device type */
951/* per-device flags */ 953/* per-device flags */
@@ -965,6 +967,8 @@ struct cdrom_device_ops {
965 int (*open) (struct cdrom_device_info *, int); 967 int (*open) (struct cdrom_device_info *, int);
966 void (*release) (struct cdrom_device_info *); 968 void (*release) (struct cdrom_device_info *);
967 int (*drive_status) (struct cdrom_device_info *, int); 969 int (*drive_status) (struct cdrom_device_info *, int);
970 unsigned int (*check_events) (struct cdrom_device_info *cdi,
971 unsigned int clearing, int slot);
968 int (*media_changed) (struct cdrom_device_info *, int); 972 int (*media_changed) (struct cdrom_device_info *, int);
969 int (*tray_move) (struct cdrom_device_info *, int); 973 int (*tray_move) (struct cdrom_device_info *, int);
970 int (*lock_door) (struct cdrom_device_info *, int); 974 int (*lock_door) (struct cdrom_device_info *, int);
@@ -993,6 +997,8 @@ extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
993extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode); 997extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode);
994extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, 998extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
995 fmode_t mode, unsigned int cmd, unsigned long arg); 999 fmode_t mode, unsigned int cmd, unsigned long arg);
1000extern unsigned int cdrom_check_events(struct cdrom_device_info *cdi,
1001 unsigned int clearing);
996extern int cdrom_media_changed(struct cdrom_device_info *); 1002extern int cdrom_media_changed(struct cdrom_device_info *);
997 1003
998extern int register_cdrom(struct cdrom_device_info *cdi); 1004extern int register_cdrom(struct cdrom_device_info *cdi);
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index 7fff521d7eb5..aa13392a7efb 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -67,12 +67,12 @@ struct ceph_auth_client {
67 bool negotiating; /* true if negotiating protocol */ 67 bool negotiating; /* true if negotiating protocol */
68 const char *name; /* entity name */ 68 const char *name; /* entity name */
69 u64 global_id; /* our unique id in system */ 69 u64 global_id; /* our unique id in system */
70 const char *secret; /* our secret key */ 70 const struct ceph_crypto_key *key; /* our secret key */
71 unsigned want_keys; /* which services we want */ 71 unsigned want_keys; /* which services we want */
72}; 72};
73 73
74extern struct ceph_auth_client *ceph_auth_init(const char *name, 74extern struct ceph_auth_client *ceph_auth_init(const char *name,
75 const char *secret); 75 const struct ceph_crypto_key *key);
76extern void ceph_auth_destroy(struct ceph_auth_client *ac); 76extern void ceph_auth_destroy(struct ceph_auth_client *ac);
77 77
78extern void ceph_auth_reset(struct ceph_auth_client *ac); 78extern void ceph_auth_reset(struct ceph_auth_client *ac);
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index c3c74aef289d..b8e995fbd867 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -43,6 +43,10 @@
43#define CEPH_FEATURE_NOSRCADDR (1<<1) 43#define CEPH_FEATURE_NOSRCADDR (1<<1)
44#define CEPH_FEATURE_MONCLOCKCHECK (1<<2) 44#define CEPH_FEATURE_MONCLOCKCHECK (1<<2)
45#define CEPH_FEATURE_FLOCK (1<<3) 45#define CEPH_FEATURE_FLOCK (1<<3)
46#define CEPH_FEATURE_SUBSCRIBE2 (1<<4)
47#define CEPH_FEATURE_MONNAMES (1<<5)
48#define CEPH_FEATURE_RECONNECT_SEQ (1<<6)
49#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
46 50
47 51
48/* 52/*
@@ -55,10 +59,10 @@ struct ceph_file_layout {
55 __le32 fl_stripe_count; /* over this many objects */ 59 __le32 fl_stripe_count; /* over this many objects */
56 __le32 fl_object_size; /* until objects are this big, then move to 60 __le32 fl_object_size; /* until objects are this big, then move to
57 new objects */ 61 new objects */
58 __le32 fl_cas_hash; /* 0 = none; 1 = sha256 */ 62 __le32 fl_cas_hash; /* UNUSED. 0 = none; 1 = sha256 */
59 63
60 /* pg -> disk layout */ 64 /* pg -> disk layout */
61 __le32 fl_object_stripe_unit; /* for per-object parity, if any */ 65 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
62 66
63 /* object -> pg layout */ 67 /* object -> pg layout */
64 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */ 68 __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
@@ -69,6 +73,12 @@ struct ceph_file_layout {
69 73
70int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); 74int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
71 75
76struct ceph_dir_layout {
77 __u8 dl_dir_hash; /* see ceph_hash.h for ids */
78 __u8 dl_unused1;
79 __u16 dl_unused2;
80 __u32 dl_unused3;
81} __attribute__ ((packed));
72 82
73/* crypto algorithms */ 83/* crypto algorithms */
74#define CEPH_CRYPTO_NONE 0x0 84#define CEPH_CRYPTO_NONE 0x0
@@ -126,9 +136,18 @@ int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
126 136
127 137
128/* osd */ 138/* osd */
129#define CEPH_MSG_OSD_MAP 41 139#define CEPH_MSG_OSD_MAP 41
130#define CEPH_MSG_OSD_OP 42 140#define CEPH_MSG_OSD_OP 42
131#define CEPH_MSG_OSD_OPREPLY 43 141#define CEPH_MSG_OSD_OPREPLY 43
142#define CEPH_MSG_WATCH_NOTIFY 44
143
144
145/* watch-notify operations */
146enum {
147 WATCH_NOTIFY = 1, /* notifying watcher */
148 WATCH_NOTIFY_COMPLETE = 2, /* notifier notified when done */
149};
150
132 151
133/* pool operations */ 152/* pool operations */
134enum { 153enum {
@@ -203,8 +222,10 @@ struct ceph_client_mount {
203 struct ceph_mon_request_header monhdr; 222 struct ceph_mon_request_header monhdr;
204} __attribute__ ((packed)); 223} __attribute__ ((packed));
205 224
225#define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */
226
206struct ceph_mon_subscribe_item { 227struct ceph_mon_subscribe_item {
207 __le64 have_version; __le64 have; 228 __le64 have_version; __le64 have;
208 __u8 onetime; 229 __u8 onetime;
209} __attribute__ ((packed)); 230} __attribute__ ((packed));
210 231
@@ -457,7 +478,7 @@ struct ceph_mds_reply_inode {
457 struct ceph_timespec rctime; 478 struct ceph_timespec rctime;
458 struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */ 479 struct ceph_frag_tree_head fragtree; /* (must be at end of struct) */
459} __attribute__ ((packed)); 480} __attribute__ ((packed));
460/* followed by frag array, then symlink string, then xattr blob */ 481/* followed by frag array, symlink string, dir layout, xattr blob */
461 482
462/* reply_lease follows dname, and reply_inode */ 483/* reply_lease follows dname, and reply_inode */
463struct ceph_mds_reply_lease { 484struct ceph_mds_reply_lease {
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index f22b2e941686..6365f041745b 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -61,7 +61,7 @@ struct ceph_options {
61 pointer type of args */ 61 pointer type of args */
62 int num_mon; 62 int num_mon;
63 char *name; 63 char *name;
64 char *secret; 64 struct ceph_crypto_key *key;
65}; 65};
66 66
67/* 67/*
@@ -71,7 +71,6 @@ struct ceph_options {
71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ 71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
72#define CEPH_OSD_KEEPALIVE_DEFAULT 5 72#define CEPH_OSD_KEEPALIVE_DEFAULT 5
73#define CEPH_OSD_IDLE_TTL_DEFAULT 60 73#define CEPH_OSD_IDLE_TTL_DEFAULT 60
74#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
75 74
76#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 75#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
77#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 76#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
@@ -227,9 +226,10 @@ extern int ceph_open_session(struct ceph_client *client);
227extern void ceph_release_page_vector(struct page **pages, int num_pages); 226extern void ceph_release_page_vector(struct page **pages, int num_pages);
228 227
229extern struct page **ceph_get_direct_page_vector(const char __user *data, 228extern struct page **ceph_get_direct_page_vector(const char __user *data,
230 int num_pages, 229 int num_pages,
231 loff_t off, size_t len); 230 bool write_page);
232extern void ceph_put_page_vector(struct page **pages, int num_pages); 231extern void ceph_put_page_vector(struct page **pages, int num_pages,
232 bool dirty);
233extern void ceph_release_page_vector(struct page **pages, int num_pages); 233extern void ceph_release_page_vector(struct page **pages, int num_pages);
234extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 234extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
235extern int ceph_copy_user_to_page_vector(struct page **pages, 235extern int ceph_copy_user_to_page_vector(struct page **pages,
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 5956d62c3057..31d91a64838b 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -82,6 +82,7 @@ struct ceph_msg {
82 struct ceph_buffer *middle; 82 struct ceph_buffer *middle;
83 struct page **pages; /* data payload. NOT OWNER. */ 83 struct page **pages; /* data payload. NOT OWNER. */
84 unsigned nr_pages; /* size of page array */ 84 unsigned nr_pages; /* size of page array */
85 unsigned page_alignment; /* io offset in first page */
85 struct ceph_pagelist *pagelist; /* instead of pages */ 86 struct ceph_pagelist *pagelist; /* instead of pages */
86 struct list_head list_head; 87 struct list_head list_head;
87 struct kref kref; 88 struct kref kref;
@@ -109,17 +110,12 @@ struct ceph_msg_pos {
109 110
110/* 111/*
111 * ceph_connection state bit flags 112 * ceph_connection state bit flags
112 *
113 * QUEUED and BUSY are used together to ensure that only a single
114 * thread is currently opening, reading or writing data to the socket.
115 */ 113 */
116#define LOSSYTX 0 /* we can close channel or drop messages on errors */ 114#define LOSSYTX 0 /* we can close channel or drop messages on errors */
117#define CONNECTING 1 115#define CONNECTING 1
118#define NEGOTIATING 2 116#define NEGOTIATING 2
119#define KEEPALIVE_PENDING 3 117#define KEEPALIVE_PENDING 3
120#define WRITE_PENDING 4 /* we have data ready to send */ 118#define WRITE_PENDING 4 /* we have data ready to send */
121#define QUEUED 5 /* there is work queued on this connection */
122#define BUSY 6 /* work is being done */
123#define STANDBY 8 /* no outgoing messages, socket closed. we keep 119#define STANDBY 8 /* no outgoing messages, socket closed. we keep
124 * the ceph_connection around to maintain shared 120 * the ceph_connection around to maintain shared
125 * state with the peer. */ 121 * state with the peer. */
@@ -127,6 +123,7 @@ struct ceph_msg_pos {
127#define SOCK_CLOSED 11 /* socket state changed to closed */ 123#define SOCK_CLOSED 11 /* socket state changed to closed */
128#define OPENING 13 /* open connection w/ (possibly new) peer */ 124#define OPENING 13 /* open connection w/ (possibly new) peer */
129#define DEAD 14 /* dead, about to kfree */ 125#define DEAD 14 /* dead, about to kfree */
126#define BACKOFF 15
130 127
131/* 128/*
132 * A single connection with another host. 129 * A single connection with another host.
@@ -164,7 +161,6 @@ struct ceph_connection {
164 struct list_head out_queue; 161 struct list_head out_queue;
165 struct list_head out_sent; /* sending or sent but unacked */ 162 struct list_head out_sent; /* sending or sent but unacked */
166 u64 out_seq; /* last message queued for send */ 163 u64 out_seq; /* last message queued for send */
167 bool out_keepalive_pending;
168 164
169 u64 in_seq, in_seq_acked; /* last message received, acked */ 165 u64 in_seq, in_seq_acked; /* last message received, acked */
170 166
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 6c91fb032c39..f88eacb111d4 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -32,6 +32,7 @@ struct ceph_osd {
32 struct rb_node o_node; 32 struct rb_node o_node;
33 struct ceph_connection o_con; 33 struct ceph_connection o_con;
34 struct list_head o_requests; 34 struct list_head o_requests;
35 struct list_head o_linger_requests;
35 struct list_head o_osd_lru; 36 struct list_head o_osd_lru;
36 struct ceph_authorizer *o_authorizer; 37 struct ceph_authorizer *o_authorizer;
37 void *o_authorizer_buf, *o_authorizer_reply_buf; 38 void *o_authorizer_buf, *o_authorizer_reply_buf;
@@ -47,6 +48,8 @@ struct ceph_osd_request {
47 struct rb_node r_node; 48 struct rb_node r_node;
48 struct list_head r_req_lru_item; 49 struct list_head r_req_lru_item;
49 struct list_head r_osd_item; 50 struct list_head r_osd_item;
51 struct list_head r_linger_item;
52 struct list_head r_linger_osd;
50 struct ceph_osd *r_osd; 53 struct ceph_osd *r_osd;
51 struct ceph_pg r_pgid; 54 struct ceph_pg r_pgid;
52 int r_pg_osds[CEPH_PG_MAX_SIZE]; 55 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -59,6 +62,7 @@ struct ceph_osd_request {
59 int r_flags; /* any additional flags for the osd */ 62 int r_flags; /* any additional flags for the osd */
60 u32 r_sent; /* >0 if r_request is sending/sent */ 63 u32 r_sent; /* >0 if r_request is sending/sent */
61 int r_got_reply; 64 int r_got_reply;
65 int r_linger;
62 66
63 struct ceph_osd_client *r_osdc; 67 struct ceph_osd_client *r_osdc;
64 struct kref r_kref; 68 struct kref r_kref;
@@ -74,11 +78,11 @@ struct ceph_osd_request {
74 char r_oid[40]; /* object name */ 78 char r_oid[40]; /* object name */
75 int r_oid_len; 79 int r_oid_len;
76 unsigned long r_stamp; /* send OR check time */ 80 unsigned long r_stamp; /* send OR check time */
77 bool r_resend; /* msg send failed, needs retry */
78 81
79 struct ceph_file_layout r_file_layout; 82 struct ceph_file_layout r_file_layout;
80 struct ceph_snap_context *r_snapc; /* snap context for writes */ 83 struct ceph_snap_context *r_snapc; /* snap context for writes */
81 unsigned r_num_pages; /* size of page array (follows) */ 84 unsigned r_num_pages; /* size of page array (follows) */
85 unsigned r_page_alignment; /* io offset in first page */
82 struct page **r_pages; /* pages for data payload */ 86 struct page **r_pages; /* pages for data payload */
83 int r_pages_from_pool; 87 int r_pages_from_pool;
84 int r_own_pages; /* if true, i own page list */ 88 int r_own_pages; /* if true, i own page list */
@@ -89,6 +93,26 @@ struct ceph_osd_request {
89 struct ceph_pagelist *r_trail; /* trailing part of the data */ 93 struct ceph_pagelist *r_trail; /* trailing part of the data */
90}; 94};
91 95
96struct ceph_osd_event {
97 u64 cookie;
98 int one_shot;
99 struct ceph_osd_client *osdc;
100 void (*cb)(u64, u64, u8, void *);
101 void *data;
102 struct rb_node node;
103 struct list_head osd_node;
104 struct kref kref;
105 struct completion completion;
106};
107
108struct ceph_osd_event_work {
109 struct work_struct work;
110 struct ceph_osd_event *event;
111 u64 ver;
112 u64 notify_id;
113 u8 opcode;
114};
115
92struct ceph_osd_client { 116struct ceph_osd_client {
93 struct ceph_client *client; 117 struct ceph_client *client;
94 118
@@ -103,7 +127,10 @@ struct ceph_osd_client {
103 u64 timeout_tid; /* tid of timeout triggering rq */ 127 u64 timeout_tid; /* tid of timeout triggering rq */
104 u64 last_tid; /* tid of last request */ 128 u64 last_tid; /* tid of last request */
105 struct rb_root requests; /* pending requests */ 129 struct rb_root requests; /* pending requests */
106 struct list_head req_lru; /* pending requests lru */ 130 struct list_head req_lru; /* in-flight lru */
131 struct list_head req_unsent; /* unsent/need-resend queue */
132 struct list_head req_notarget; /* map to no osd */
133 struct list_head req_linger; /* lingering requests */
107 int num_requests; 134 int num_requests;
108 struct delayed_work timeout_work; 135 struct delayed_work timeout_work;
109 struct delayed_work osds_timeout_work; 136 struct delayed_work osds_timeout_work;
@@ -115,6 +142,12 @@ struct ceph_osd_client {
115 142
116 struct ceph_msgpool msgpool_op; 143 struct ceph_msgpool msgpool_op;
117 struct ceph_msgpool msgpool_op_reply; 144 struct ceph_msgpool msgpool_op_reply;
145
146 spinlock_t event_lock;
147 struct rb_root event_tree;
148 u64 event_count;
149
150 struct workqueue_struct *notify_wq;
118}; 151};
119 152
120struct ceph_osd_req_op { 153struct ceph_osd_req_op {
@@ -149,6 +182,13 @@ struct ceph_osd_req_op {
149 struct { 182 struct {
150 u64 snapid; 183 u64 snapid;
151 } snap; 184 } snap;
185 struct {
186 u64 cookie;
187 u64 ver;
188 __u8 flag;
189 u32 prot_ver;
190 u32 timeout;
191 } watch;
152 }; 192 };
153 u32 payload_len; 193 u32 payload_len;
154}; 194};
@@ -194,7 +234,13 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
194 int do_sync, u32 truncate_seq, 234 int do_sync, u32 truncate_seq,
195 u64 truncate_size, 235 u64 truncate_size,
196 struct timespec *mtime, 236 struct timespec *mtime,
197 bool use_mempool, int num_reply); 237 bool use_mempool, int num_reply,
238 int page_align);
239
240extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
241 struct ceph_osd_request *req);
242extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc,
243 struct ceph_osd_request *req);
198 244
199static inline void ceph_osdc_get_request(struct ceph_osd_request *req) 245static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
200{ 246{
@@ -218,7 +264,8 @@ extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
218 struct ceph_file_layout *layout, 264 struct ceph_file_layout *layout,
219 u64 off, u64 *plen, 265 u64 off, u64 *plen,
220 u32 truncate_seq, u64 truncate_size, 266 u32 truncate_seq, u64 truncate_size,
221 struct page **pages, int nr_pages); 267 struct page **pages, int nr_pages,
268 int page_align);
222 269
223extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, 270extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
224 struct ceph_vino vino, 271 struct ceph_vino vino,
@@ -230,5 +277,14 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
230 struct page **pages, int nr_pages, 277 struct page **pages, int nr_pages,
231 int flags, int do_sync, bool nofail); 278 int flags, int do_sync, bool nofail);
232 279
280/* watch/notify events */
281extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
282 void (*event_cb)(u64, u64, u8, void *),
283 int one_shot, void *data,
284 struct ceph_osd_event **pevent);
285extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
286extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
287 unsigned long timeout);
288extern void ceph_osdc_put_event(struct ceph_osd_event *event);
233#endif 289#endif
234 290
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 6d5247f2e81b..0a99099801a4 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -12,9 +12,9 @@
12 * osdmap encoding versions 12 * osdmap encoding versions
13 */ 13 */
14#define CEPH_OSDMAP_INC_VERSION 5 14#define CEPH_OSDMAP_INC_VERSION 5
15#define CEPH_OSDMAP_INC_VERSION_EXT 5 15#define CEPH_OSDMAP_INC_VERSION_EXT 6
16#define CEPH_OSDMAP_VERSION 5 16#define CEPH_OSDMAP_VERSION 5
17#define CEPH_OSDMAP_VERSION_EXT 5 17#define CEPH_OSDMAP_VERSION_EXT 6
18 18
19/* 19/*
20 * fs id 20 * fs id
@@ -181,9 +181,17 @@ enum {
181 /* read */ 181 /* read */
182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, 183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
184 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
184 185
185 /* fancy read */ 186 /* fancy read */
186 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, 187 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
188 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
189
190 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
191 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
192
193 /* versioning */
194 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
187 195
188 /* write */ 196 /* write */
189 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, 197 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
@@ -205,6 +213,8 @@ enum {
205 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, 213 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
206 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, 214 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
207 215
216 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
217
208 /** attrs **/ 218 /** attrs **/
209 /* read */ 219 /* read */
210 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 220 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -218,11 +228,14 @@ enum {
218 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, 228 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
219 229
220 /** subop **/ 230 /** subop **/
221 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, 231 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
222 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, 232 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
223 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, 233 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
224 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, 234 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
225 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, 235 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
236 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
237 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
238 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
226 239
227 /** lock **/ 240 /** lock **/
228 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, 241 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
@@ -328,6 +341,8 @@ enum {
328 CEPH_OSD_CMPXATTR_MODE_U64 = 2 341 CEPH_OSD_CMPXATTR_MODE_U64 = 2
329}; 342};
330 343
344#define RADOS_NOTIFY_VER 1
345
331/* 346/*
332 * an individual object operation. each may be accompanied by some data 347 * an individual object operation. each may be accompanied by some data
333 * payload 348 * payload
@@ -359,7 +374,12 @@ struct ceph_osd_op {
359 struct { 374 struct {
360 __le64 snapid; 375 __le64 snapid;
361 } __attribute__ ((packed)) snap; 376 } __attribute__ ((packed)) snap;
362 }; 377 struct {
378 __le64 cookie;
379 __le64 ver;
380 __u8 flag; /* 0 = unwatch, 1 = watch */
381 } __attribute__ ((packed)) watch;
382};
363 __le32 payload_len; 383 __le32 payload_len;
364} __attribute__ ((packed)); 384} __attribute__ ((packed));
365 385
@@ -402,4 +422,5 @@ struct ceph_osd_reply_head {
402} __attribute__ ((packed)); 422} __attribute__ ((packed));
403 423
404 424
425
405#endif 426#endif
diff --git a/include/linux/cfag12864b.h b/include/linux/cfag12864b.h
index 6f9f19d66591..b454dfce60d9 100644
--- a/include/linux/cfag12864b.h
+++ b/include/linux/cfag12864b.h
@@ -44,7 +44,7 @@ extern unsigned char * cfag12864b_buffer;
44/* 44/*
45 * Get the refresh rate of the LCD 45 * Get the refresh rate of the LCD
46 * 46 *
47 * Returns the refresh rate (hertzs). 47 * Returns the refresh rate (hertz).
48 */ 48 */
49extern unsigned int cfag12864b_getrate(void); 49extern unsigned int cfag12864b_getrate(void);
50 50
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 709dfb901d11..5ac7ebc36dbb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -154,6 +154,10 @@ enum {
154 * A thread in rmdir() is wating for this cgroup. 154 * A thread in rmdir() is wating for this cgroup.
155 */ 155 */
156 CGRP_WAIT_ON_RMDIR, 156 CGRP_WAIT_ON_RMDIR,
157 /*
158 * Clone cgroup values when creating a new child cgroup
159 */
160 CGRP_CLONE_CHILDREN,
157}; 161};
158 162
159/* which pidlist file are we talking about? */ 163/* which pidlist file are we talking about? */
@@ -236,7 +240,7 @@ struct cgroup {
236 /* For RCU-protected deletion */ 240 /* For RCU-protected deletion */
237 struct rcu_head rcu_head; 241 struct rcu_head rcu_head;
238 242
239 /* List of events which userspace want to recieve */ 243 /* List of events which userspace want to receive */
240 struct list_head event_list; 244 struct list_head event_list;
241 spinlock_t event_list_lock; 245 spinlock_t event_list_lock;
242}; 246};
@@ -470,7 +474,8 @@ struct cgroup_subsys {
470 struct cgroup *old_cgrp, struct task_struct *tsk, 474 struct cgroup *old_cgrp, struct task_struct *tsk,
471 bool threadgroup); 475 bool threadgroup);
472 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 476 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
473 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 477 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
478 struct cgroup *old_cgrp, struct task_struct *task);
474 int (*populate)(struct cgroup_subsys *ss, 479 int (*populate)(struct cgroup_subsys *ss,
475 struct cgroup *cgrp); 480 struct cgroup *cgrp);
476 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 481 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
@@ -560,7 +565,7 @@ struct cgroup_iter {
560/* 565/*
561 * To iterate across the tasks in a cgroup: 566 * To iterate across the tasks in a cgroup:
562 * 567 *
563 * 1) call cgroup_iter_start to intialize an iterator 568 * 1) call cgroup_iter_start to initialize an iterator
564 * 569 *
565 * 2) call cgroup_iter_next() to retrieve member tasks until it 570 * 2) call cgroup_iter_next() to retrieve member tasks until it
566 * returns NULL or until you want to end the iteration 571 * returns NULL or until you want to end the iteration
@@ -622,6 +627,7 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
622/* Get id and depth of css */ 627/* Get id and depth of css */
623unsigned short css_id(struct cgroup_subsys_state *css); 628unsigned short css_id(struct cgroup_subsys_state *css);
624unsigned short css_depth(struct cgroup_subsys_state *css); 629unsigned short css_depth(struct cgroup_subsys_state *css);
630struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
625 631
626#else /* !CONFIG_CGROUPS */ 632#else /* !CONFIG_CGROUPS */
627 633
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ccefff02b6cb..cdbfcb8780ec 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -65,4 +65,8 @@ SUBSYS(net_cls)
65SUBSYS(blkio) 65SUBSYS(blkio)
66#endif 66#endif
67 67
68#ifdef CONFIG_CGROUP_PERF
69SUBSYS(perf)
70#endif
71
68/* */ 72/* */
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
new file mode 100644
index 000000000000..457bcb0a310a
--- /dev/null
+++ b/include/linux/clkdev.h
@@ -0,0 +1,36 @@
1/*
2 * include/linux/clkdev.h
3 *
4 * Copyright (C) 2008 Russell King.
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 * Helper for the clk API to assist looking up a struct clk.
11 */
12#ifndef __CLKDEV_H
13#define __CLKDEV_H
14
15#include <asm/clkdev.h>
16
17struct clk;
18struct device;
19
20struct clk_lookup {
21 struct list_head node;
22 const char *dev_id;
23 const char *con_id;
24 struct clk *clk;
25};
26
27struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
28 const char *dev_fmt, ...);
29
30void clkdev_add(struct clk_lookup *cl);
31void clkdev_drop(struct clk_lookup *cl);
32
33void clkdev_add_table(struct clk_lookup *, size_t);
34int clk_add_alias(const char *, const char *, char *, struct device *);
35
36#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index fc53492b6ad7..d6733e27af34 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -56,46 +56,52 @@ enum clock_event_nofitiers {
56 56
57/** 57/**
58 * struct clock_event_device - clock event device descriptor 58 * struct clock_event_device - clock event device descriptor
59 * @name: ptr to clock event name 59 * @event_handler: Assigned by the framework to be called by the low
60 * @features: features 60 * level handler of the event source
61 * @set_next_event: set next event function
62 * @next_event: local storage for the next event in oneshot mode
61 * @max_delta_ns: maximum delta value in ns 63 * @max_delta_ns: maximum delta value in ns
62 * @min_delta_ns: minimum delta value in ns 64 * @min_delta_ns: minimum delta value in ns
63 * @mult: nanosecond to cycles multiplier 65 * @mult: nanosecond to cycles multiplier
64 * @shift: nanoseconds to cycles divisor (power of two) 66 * @shift: nanoseconds to cycles divisor (power of two)
67 * @mode: operating mode assigned by the management code
68 * @features: features
69 * @retries: number of forced programming retries
70 * @set_mode: set mode function
71 * @broadcast: function to broadcast events
72 * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration
73 * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration
74 * @name: ptr to clock event name
65 * @rating: variable to rate clock event devices 75 * @rating: variable to rate clock event devices
66 * @irq: IRQ number (only for non CPU local devices) 76 * @irq: IRQ number (only for non CPU local devices)
67 * @cpumask: cpumask to indicate for which CPUs this device works 77 * @cpumask: cpumask to indicate for which CPUs this device works
68 * @set_next_event: set next event function
69 * @set_mode: set mode function
70 * @event_handler: Assigned by the framework to be called by the low
71 * level handler of the event source
72 * @broadcast: function to broadcast events
73 * @list: list head for the management code 78 * @list: list head for the management code
74 * @mode: operating mode assigned by the management code
75 * @next_event: local storage for the next event in oneshot mode
76 * @retries: number of forced programming retries
77 */ 79 */
78struct clock_event_device { 80struct clock_event_device {
79 const char *name; 81 void (*event_handler)(struct clock_event_device *);
80 unsigned int features; 82 int (*set_next_event)(unsigned long evt,
83 struct clock_event_device *);
84 ktime_t next_event;
81 u64 max_delta_ns; 85 u64 max_delta_ns;
82 u64 min_delta_ns; 86 u64 min_delta_ns;
83 u32 mult; 87 u32 mult;
84 u32 shift; 88 u32 shift;
89 enum clock_event_mode mode;
90 unsigned int features;
91 unsigned long retries;
92
93 void (*broadcast)(const struct cpumask *mask);
94 void (*set_mode)(enum clock_event_mode mode,
95 struct clock_event_device *);
96 unsigned long min_delta_ticks;
97 unsigned long max_delta_ticks;
98
99 const char *name;
85 int rating; 100 int rating;
86 int irq; 101 int irq;
87 const struct cpumask *cpumask; 102 const struct cpumask *cpumask;
88 int (*set_next_event)(unsigned long evt,
89 struct clock_event_device *);
90 void (*set_mode)(enum clock_event_mode mode,
91 struct clock_event_device *);
92 void (*event_handler)(struct clock_event_device *);
93 void (*broadcast)(const struct cpumask *mask);
94 struct list_head list; 103 struct list_head list;
95 enum clock_event_mode mode; 104} ____cacheline_aligned;
96 ktime_t next_event;
97 unsigned long retries;
98};
99 105
100/* 106/*
101 * Calculate a multiplication factor for scaled math, which is used to convert 107 * Calculate a multiplication factor for scaled math, which is used to convert
@@ -122,6 +128,12 @@ extern u64 clockevent_delta2ns(unsigned long latch,
122 struct clock_event_device *evt); 128 struct clock_event_device *evt);
123extern void clockevents_register_device(struct clock_event_device *dev); 129extern void clockevents_register_device(struct clock_event_device *dev);
124 130
131extern void clockevents_config_and_register(struct clock_event_device *dev,
132 u32 freq, unsigned long min_delta,
133 unsigned long max_delta);
134
135extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
136
125extern void clockevents_exchange_device(struct clock_event_device *old, 137extern void clockevents_exchange_device(struct clock_event_device *old,
126 struct clock_event_device *new); 138 struct clock_event_device *new);
127extern void clockevents_set_mode(struct clock_event_device *dev, 139extern void clockevents_set_mode(struct clock_event_device *dev,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c37b21ad5a3b..c918fbd33ee5 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -159,42 +159,38 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
159 */ 159 */
160struct clocksource { 160struct clocksource {
161 /* 161 /*
162 * First part of structure is read mostly 162 * Hotpath data, fits in a single cache line when the
163 * clocksource itself is cacheline aligned.
163 */ 164 */
164 char *name;
165 struct list_head list;
166 int rating;
167 cycle_t (*read)(struct clocksource *cs); 165 cycle_t (*read)(struct clocksource *cs);
168 int (*enable)(struct clocksource *cs); 166 cycle_t cycle_last;
169 void (*disable)(struct clocksource *cs);
170 cycle_t mask; 167 cycle_t mask;
171 u32 mult; 168 u32 mult;
172 u32 shift; 169 u32 shift;
173 u64 max_idle_ns; 170 u64 max_idle_ns;
174 unsigned long flags; 171
175 cycle_t (*vread)(void);
176 void (*suspend)(struct clocksource *cs);
177 void (*resume)(struct clocksource *cs);
178#ifdef CONFIG_IA64 172#ifdef CONFIG_IA64
179 void *fsys_mmio; /* used by fsyscall asm code */ 173 void *fsys_mmio; /* used by fsyscall asm code */
180#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) 174#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
181#else 175#else
182#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) 176#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
183#endif 177#endif
184 178 const char *name;
185 /* 179 struct list_head list;
186 * Second part is written at each timer interrupt 180 int rating;
187 * Keep it in a different cache line to dirty no 181 cycle_t (*vread)(void);
188 * more than one cache line. 182 int (*enable)(struct clocksource *cs);
189 */ 183 void (*disable)(struct clocksource *cs);
190 cycle_t cycle_last ____cacheline_aligned_in_smp; 184 unsigned long flags;
185 void (*suspend)(struct clocksource *cs);
186 void (*resume)(struct clocksource *cs);
191 187
192#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 188#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
193 /* Watchdog related data, used by the framework */ 189 /* Watchdog related data, used by the framework */
194 struct list_head wd_list; 190 struct list_head wd_list;
195 cycle_t wd_last; 191 cycle_t wd_last;
196#endif 192#endif
197}; 193} ____cacheline_aligned;
198 194
199/* 195/*
200 * Clock source flags bits:: 196 * Clock source flags bits::
@@ -341,4 +337,6 @@ static inline void update_vsyscall_tz(void)
341 337
342extern void timekeeping_notify(struct clocksource *clock); 338extern void timekeeping_notify(struct clocksource *clock);
343 339
340extern int clocksource_i8253_init(void);
341
344#endif /* _LINUX_CLOCKSOURCE_H */ 342#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h
index 72bfefdbd767..3c4aac406175 100644
--- a/include/linux/cm4000_cs.h
+++ b/include/linux/cm4000_cs.h
@@ -20,7 +20,7 @@ typedef struct atreq {
20} atreq_t; 20} atreq_t;
21 21
22 22
23/* what is particularly stupid in the original driver is the arch-dependant 23/* what is particularly stupid in the original driver is the arch-dependent
24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace 24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
25 * will lay out the structure members differently than the 64bit kernel. 25 * will lay out the structure members differently than the 64bit kernel.
26 * 26 *
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h
index 7605fdd1eb65..e3d8bf26e5eb 100644
--- a/include/linux/cnt32_to_63.h
+++ b/include/linux/cnt32_to_63.h
@@ -61,13 +61,31 @@ union cnt32_to_63 {
61 * 61 *
62 * 2) this code must not be preempted for a duration longer than the 62 * 2) this code must not be preempted for a duration longer than the
63 * 32-bit counter half period minus the longest period between two 63 * 32-bit counter half period minus the longest period between two
64 * calls to this code. 64 * calls to this code;
65 * 65 *
66 * Those requirements ensure proper update to the state bit in memory. 66 * Those requirements ensure proper update to the state bit in memory.
67 * This is usually not a problem in practice, but if it is then a kernel 67 * This is usually not a problem in practice, but if it is then a kernel
68 * timer should be scheduled to manage for this code to be executed often 68 * timer should be scheduled to manage for this code to be executed often
69 * enough. 69 * enough.
70 * 70 *
71 * And finally:
72 *
73 * 3) the cnt_lo argument must be seen as a globally incrementing value,
74 * meaning that it should be a direct reference to the counter data which
75 * can be evaluated according to a specific ordering within the macro,
76 * and not the result of a previous evaluation stored in a variable.
77 *
78 * For example, this is wrong:
79 *
80 * u32 partial = get_hw_count();
81 * u64 full = cnt32_to_63(partial);
82 * return full;
83 *
84 * This is fine:
85 *
86 * u64 full = cnt32_to_63(get_hw_count());
87 * return full;
88 *
71 * Note that the top bit (bit 63) in the returned value should be considered 89 * Note that the top bit (bit 63) in the returned value should be considered
72 * as garbage. It is not cleared here because callers are likely to use a 90 * as garbage. It is not cleared here because callers are likely to use a
73 * multiplier on the returned value which can get rid of the top bit 91 * multiplier on the returned value which can get rid of the top bit
diff --git a/include/linux/coda_cache.h b/include/linux/coda_cache.h
deleted file mode 100644
index c910b5eb1ceb..000000000000
--- a/include/linux/coda_cache.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* Coda filesystem -- Linux Minicache
2 *
3 * Copyright (C) 1989 - 1997 Carnegie Mellon University
4 *
5 * Carnegie Mellon University encourages users of this software to
6 * contribute improvements to the Coda project. Contact Peter Braam
7 * <coda@cs.cmu.edu>
8 */
9
10#ifndef _CFSNC_HEADER_
11#define _CFSNC_HEADER_
12
13/* credential cache */
14void coda_cache_enter(struct inode *inode, int mask);
15void coda_cache_clear_inode(struct inode *);
16void coda_cache_clear_all(struct super_block *sb);
17int coda_cache_check(struct inode *inode, int mask);
18
19/* for downcalls and attributes and lookups */
20void coda_flag_inode_children(struct inode *inode, int flag);
21
22#endif /* _CFSNC_HEADER_ */
diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h
deleted file mode 100644
index e35071b1de0e..000000000000
--- a/include/linux/coda_fs_i.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * coda_fs_i.h
3 *
4 * Copyright (C) 1998 Carnegie Mellon University
5 *
6 */
7
8#ifndef _LINUX_CODA_FS_I
9#define _LINUX_CODA_FS_I
10
11#include <linux/types.h>
12#include <linux/list.h>
13#include <linux/spinlock.h>
14#include <linux/coda.h>
15
16/*
17 * coda fs inode data
18 * c_lock protects accesses to c_flags, c_mapcount, c_cached_epoch, c_uid and
19 * c_cached_perm.
20 * vfs_inode is set only when the inode is created and never changes.
21 * c_fid is set when the inode is created and should be considered immutable.
22 */
23struct coda_inode_info {
24 struct CodaFid c_fid; /* Coda identifier */
25 u_short c_flags; /* flags (see below) */
26 unsigned int c_mapcount; /* nr of times this inode is mapped */
27 unsigned int c_cached_epoch; /* epoch for cached permissions */
28 vuid_t c_uid; /* fsuid for cached permissions */
29 unsigned int c_cached_perm; /* cached access permissions */
30 spinlock_t c_lock;
31 struct inode vfs_inode;
32};
33
34/*
35 * coda fs file private data
36 */
37#define CODA_MAGIC 0xC0DAC0DA
38struct coda_file_info {
39 int cfi_magic; /* magic number */
40 struct file *cfi_container; /* container file for this cnode */
41 unsigned int cfi_mapcount; /* nr of times this file is mapped */
42};
43
44#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data))
45
46/* flags */
47#define C_VATTR 0x1 /* Validity of vattr in inode */
48#define C_FLUSH 0x2 /* used after a flush */
49#define C_DYING 0x4 /* from venus (which died) */
50#define C_PURGE 0x8
51
52int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *);
53struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
54int coda_cnode_makectl(struct inode **inode, struct super_block *sb);
55struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
56void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
57
58#endif
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
deleted file mode 100644
index 2e914d0771b9..000000000000
--- a/include/linux/coda_linux.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Coda File System, Linux Kernel module
3 *
4 * Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University
5 * Linux modifications (C) 1996, Peter J. Braam
6 * Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University
7 *
8 * Carnegie Mellon University encourages users of this software to
9 * contribute improvements to the Coda project.
10 */
11
12#ifndef _LINUX_CODA_FS
13#define _LINUX_CODA_FS
14
15#include <linux/kernel.h>
16#include <linux/param.h>
17#include <linux/mm.h>
18#include <linux/vmalloc.h>
19#include <linux/slab.h>
20#include <linux/wait.h>
21#include <linux/types.h>
22#include <linux/fs.h>
23#include <linux/coda_fs_i.h>
24
25/* operations */
26extern const struct inode_operations coda_dir_inode_operations;
27extern const struct inode_operations coda_file_inode_operations;
28extern const struct inode_operations coda_ioctl_inode_operations;
29
30extern const struct address_space_operations coda_file_aops;
31extern const struct address_space_operations coda_symlink_aops;
32
33extern const struct file_operations coda_dir_operations;
34extern const struct file_operations coda_file_operations;
35extern const struct file_operations coda_ioctl_operations;
36
37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f);
39int coda_release(struct inode *i, struct file *f);
40int coda_permission(struct inode *inode, int mask);
41int coda_revalidate_inode(struct dentry *);
42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
43int coda_setattr(struct dentry *, struct iattr *);
44
45/* this file: heloers */
46char *coda_f2s(struct CodaFid *f);
47int coda_isroot(struct inode *i);
48int coda_iscontrol(const char *name, size_t length);
49
50void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
51void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
52unsigned short coda_flags_to_cflags(unsigned short);
53
54/* sysctl.h */
55void coda_sysctl_init(void);
56void coda_sysctl_clean(void);
57
58#define CODA_ALLOC(ptr, cast, size) do { \
59 if (size < PAGE_SIZE) \
60 ptr = kmalloc((unsigned long) size, GFP_KERNEL); \
61 else \
62 ptr = (cast)vmalloc((unsigned long) size); \
63 if (!ptr) \
64 printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
65 else memset( ptr, 0, size ); \
66} while (0)
67
68
69#define CODA_FREE(ptr,size) \
70 do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0)
71
72/* inode to cnode access functions */
73
74static inline struct coda_inode_info *ITOC(struct inode *inode)
75{
76 return list_entry(inode, struct coda_inode_info, vfs_inode);
77}
78
79static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
80{
81 return &(ITOC(inode)->c_fid);
82}
83
84static __inline__ char *coda_i2s(struct inode *inode)
85{
86 return coda_f2s(&(ITOC(inode)->c_fid));
87}
88
89/* this will not zap the inode away */
90static __inline__ void coda_flag_inode(struct inode *inode, int flag)
91{
92 struct coda_inode_info *cii = ITOC(inode);
93
94 spin_lock(&cii->c_lock);
95 cii->c_flags |= flag;
96 spin_unlock(&cii->c_lock);
97}
98
99#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 5ac51552d908..cc9f7a428649 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -21,7 +21,11 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
21 21
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask); 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync);
26extern unsigned long compaction_suitable(struct zone *zone, int order);
27extern unsigned long compact_zone_order(struct zone *zone, int order,
28 gfp_t gfp_mask, bool sync);
25 29
26/* Do not skip compaction more than 64 times */ 30/* Do not skip compaction more than 64 times */
27#define COMPACT_MAX_DEFER_SHIFT 6 31#define COMPACT_MAX_DEFER_SHIFT 6
@@ -54,7 +58,19 @@ static inline bool compaction_deferred(struct zone *zone)
54 58
55#else 59#else
56static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 60static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
57 int order, gfp_t gfp_mask, nodemask_t *nodemask) 61 int order, gfp_t gfp_mask, nodemask_t *nodemask,
62 bool sync)
63{
64 return COMPACT_CONTINUE;
65}
66
67static inline unsigned long compaction_suitable(struct zone *zone, int order)
68{
69 return COMPACT_SKIPPED;
70}
71
72static inline unsigned long compact_zone_order(struct zone *zone, int order,
73 gfp_t gfp_mask, bool sync)
58{ 74{
59 return COMPACT_CONTINUE; 75 return COMPACT_CONTINUE;
60} 76}
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 16508bcddacc..cb4c1eb7778e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -92,3 +92,11 @@
92#if !defined(__noclone) 92#if !defined(__noclone)
93#define __noclone /* not needed */ 93#define __noclone /* not needed */
94#endif 94#endif
95
96/*
97 * A trick to suppress uninitialized variable warning without generating any
98 * code
99 */
100#define uninitialized_var(x) x = x
101
102#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index b721129e0469..37d412436d0f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -21,11 +21,3 @@
21# error "GCOV profiling support for gcc versions below 3.4 not included" 21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */ 22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */ 23#endif /* CONFIG_GCOV_KERNEL */
24
25/*
26 * A trick to suppress uninitialized variable warning without generating any
27 * code
28 */
29#define uninitialized_var(x) x = x
30
31#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index fcfa5b9a4317..64b7c003fd7a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -12,13 +12,6 @@
12#define __used __attribute__((__used__)) 12#define __used __attribute__((__used__))
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15#define __always_inline inline __attribute__((always_inline))
16
17/*
18 * A trick to suppress uninitialized variable warning without generating any
19 * code
20 */
21#define uninitialized_var(x) x = x
22 15
23#if __GNUC_MINOR__ >= 3 16#if __GNUC_MINOR__ >= 3
24/* Mark functions as cold. gcc will assume any path leading to a call 17/* Mark functions as cold. gcc will assume any path leading to a call
@@ -53,7 +46,6 @@
53#define __noclone __attribute__((__noclone__)) 46#define __noclone __attribute__((__noclone__))
54 47
55#endif 48#endif
56
57#endif 49#endif
58 50
59#if __GNUC_MINOR__ > 0 51#if __GNUC_MINOR__ > 0
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 51e3145196f6..51494e6b5548 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
12 12
13/** 13/*
14 * struct completion - structure used to maintain state for a "completion" 14 * struct completion - structure used to maintain state for a "completion"
15 * 15 *
16 * This is the opaque structure used to maintain the state for a "completion". 16 * This is the opaque structure used to maintain the state for a "completion".
@@ -34,7 +34,7 @@ struct completion {
34 ({ init_completion(&work); work; }) 34 ({ init_completion(&work); work; })
35 35
36/** 36/**
37 * DECLARE_COMPLETION: - declare and initialize a completion structure 37 * DECLARE_COMPLETION - declare and initialize a completion structure
38 * @work: identifier for the completion structure 38 * @work: identifier for the completion structure
39 * 39 *
40 * This macro declares and initializes a completion structure. Generally used 40 * This macro declares and initializes a completion structure. Generally used
@@ -50,7 +50,7 @@ struct completion {
50 * are on the kernel stack: 50 * are on the kernel stack:
51 */ 51 */
52/** 52/**
53 * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure 53 * DECLARE_COMPLETION_ONSTACK - declare and initialize a completion structure
54 * @work: identifier for the completion structure 54 * @work: identifier for the completion structure
55 * 55 *
56 * This macro declares and initializes a completion structure on the kernel 56 * This macro declares and initializes a completion structure on the kernel
@@ -64,7 +64,7 @@ struct completion {
64#endif 64#endif
65 65
66/** 66/**
67 * init_completion: - Initialize a dynamically allocated completion 67 * init_completion - Initialize a dynamically allocated completion
68 * @x: completion structure that is to be initialized 68 * @x: completion structure that is to be initialized
69 * 69 *
70 * This inline function will initialize a dynamically created completion 70 * This inline function will initialize a dynamically created completion
@@ -81,10 +81,10 @@ extern int wait_for_completion_interruptible(struct completion *x);
81extern int wait_for_completion_killable(struct completion *x); 81extern int wait_for_completion_killable(struct completion *x);
82extern unsigned long wait_for_completion_timeout(struct completion *x, 82extern unsigned long wait_for_completion_timeout(struct completion *x,
83 unsigned long timeout); 83 unsigned long timeout);
84extern unsigned long wait_for_completion_interruptible_timeout( 84extern long wait_for_completion_interruptible_timeout(
85 struct completion *x, unsigned long timeout); 85 struct completion *x, unsigned long timeout);
86extern unsigned long wait_for_completion_killable_timeout( 86extern long wait_for_completion_killable_timeout(
87 struct completion *x, unsigned long timeout); 87 struct completion *x, unsigned long timeout);
88extern bool try_wait_for_completion(struct completion *x); 88extern bool try_wait_for_completion(struct completion *x);
89extern bool completion_done(struct completion *x); 89extern bool completion_done(struct completion *x);
90 90
@@ -92,7 +92,7 @@ extern void complete(struct completion *);
92extern void complete_all(struct completion *); 92extern void complete_all(struct completion *);
93 93
94/** 94/**
95 * INIT_COMPLETION: - reinitialize a completion structure 95 * INIT_COMPLETION - reinitialize a completion structure
96 * @x: completion structure to be reinitialized 96 * @x: completion structure to be reinitialized
97 * 97 *
98 * This macro should be used to reinitialize a completion structure so it can 98 * This macro should be used to reinitialize a completion structure so it can
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index ddb7a97c78c2..645778ad899b 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -218,7 +218,7 @@ static ssize_t _item##_attr_store(struct config_item *item, \
218 * group children. default_groups may coexist alongsize make_group() or 218 * group children. default_groups may coexist alongsize make_group() or
219 * make_item(), but if the group wishes to have only default_groups 219 * make_item(), but if the group wishes to have only default_groups
220 * children (disallowing mkdir(2)), it need not provide either function. 220 * children (disallowing mkdir(2)), it need not provide either function.
221 * If the group has commit(), it supports pending and commited (active) 221 * If the group has commit(), it supports pending and committed (active)
222 * items. 222 * items.
223 */ 223 */
224struct configfs_item_operations { 224struct configfs_item_operations {
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 3a779ffba60b..7c60d0942adb 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -42,8 +42,9 @@
42#define CN_VAL_DM_USERSPACE_LOG 0x1 42#define CN_VAL_DM_USERSPACE_LOG 0x1
43#define CN_IDX_DRBD 0x8 43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1 44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */
45 46
46#define CN_NETLINK_USERS 8 47#define CN_NETLINK_USERS 9
47 48
48/* 49/*
49 * Maximum connector's message size. 50 * Maximum connector's message size.
@@ -87,14 +88,6 @@ struct cn_queue_dev {
87 atomic_t refcnt; 88 atomic_t refcnt;
88 unsigned char name[CN_CBQ_NAMELEN]; 89 unsigned char name[CN_CBQ_NAMELEN];
89 90
90 struct workqueue_struct *cn_queue;
91 /* Sent to kevent to create cn_queue only when needed */
92 struct work_struct wq_creation;
93 /* Tell if the wq_creation job is pending/completed */
94 atomic_t wq_requested;
95 /* Wait for cn_queue to be created */
96 wait_queue_head_t wq_created;
97
98 struct list_head queue_list; 91 struct list_head queue_list;
99 spinlock_t queue_lock; 92 spinlock_t queue_lock;
100 93
@@ -106,20 +99,13 @@ struct cn_callback_id {
106 struct cb_id id; 99 struct cb_id id;
107}; 100};
108 101
109struct cn_callback_data {
110 struct sk_buff *skb;
111 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
112
113 void *free;
114};
115
116struct cn_callback_entry { 102struct cn_callback_entry {
117 struct list_head callback_entry; 103 struct list_head callback_entry;
118 struct work_struct work; 104 atomic_t refcnt;
119 struct cn_queue_dev *pdev; 105 struct cn_queue_dev *pdev;
120 106
121 struct cn_callback_id id; 107 struct cn_callback_id id;
122 struct cn_callback_data data; 108 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
123 109
124 u32 seq, group; 110 u32 seq, group;
125}; 111};
@@ -134,21 +120,21 @@ struct cn_dev {
134 struct cn_queue_dev *cbdev; 120 struct cn_queue_dev *cbdev;
135}; 121};
136 122
137int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); 123int cn_add_callback(struct cb_id *id, const char *name,
124 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
138void cn_del_callback(struct cb_id *); 125void cn_del_callback(struct cb_id *);
139int cn_netlink_send(struct cn_msg *, u32, gfp_t); 126int cn_netlink_send(struct cn_msg *, u32, gfp_t);
140 127
141int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 128int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
129 struct cb_id *id,
130 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
142void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 131void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
132void cn_queue_release_callback(struct cn_callback_entry *);
143 133
144int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); 134struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *);
145
146struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
147void cn_queue_free_dev(struct cn_queue_dev *dev); 135void cn_queue_free_dev(struct cn_queue_dev *dev);
148 136
149int cn_cb_equal(struct cb_id *, struct cb_id *); 137int cn_cb_equal(struct cb_id *, struct cb_id *);
150 138
151void cn_queue_wrapper(struct work_struct *work);
152
153#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
154#endif /* __CONNECTOR_H */ 140#endif /* __CONNECTOR_H */
diff --git a/include/linux/console.h b/include/linux/console.h
index 95cf6f08a59d..7453cfd593c8 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -126,6 +126,12 @@ struct console {
126 struct console *next; 126 struct console *next;
127}; 127};
128 128
129/*
130 * for_each_console() allows you to iterate on each console
131 */
132#define for_each_console(con) \
133 for (con = console_drivers; con != NULL; con = con->next)
134
129extern int console_set_on_cmdline; 135extern int console_set_on_cmdline;
130 136
131extern int add_preferred_console(char *name, int idx, char *options); 137extern int add_preferred_console(char *name, int idx, char *options);
@@ -133,9 +139,9 @@ extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_n
133extern void register_console(struct console *); 139extern void register_console(struct console *);
134extern int unregister_console(struct console *); 140extern int unregister_console(struct console *);
135extern struct console *console_drivers; 141extern struct console *console_drivers;
136extern void acquire_console_sem(void); 142extern void console_lock(void);
137extern int try_acquire_console_sem(void); 143extern int console_trylock(void);
138extern void release_console_sem(void); 144extern void console_unlock(void);
139extern void console_conditional_schedule(void); 145extern void console_conditional_schedule(void);
140extern void console_unblank(void); 146extern void console_unblank(void);
141extern struct tty_driver *console_device(int *); 147extern struct tty_driver *console_device(int *);
@@ -145,7 +151,7 @@ extern int is_console_locked(void);
145extern int braille_register_console(struct console *, int index, 151extern int braille_register_console(struct console *, int index,
146 char *console_options, char *braille_options); 152 char *console_options, char *braille_options);
147extern int braille_unregister_console(struct console *); 153extern int braille_unregister_console(struct console *);
148 154extern void console_sysfs_notify(void);
149extern int console_suspend_enabled; 155extern int console_suspend_enabled;
150 156
151/* Suspend and resume console messages over PM events */ 157/* Suspend and resume console messages over PM events */
diff --git a/include/linux/cper.h b/include/linux/cper.h
index bf972f81e2a7..c23049496531 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -39,10 +39,12 @@
39 * Severity difinition for error_severity in struct cper_record_header 39 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor 40 * and section_severity in struct cper_section_descriptor
41 */ 41 */
42#define CPER_SEV_RECOVERABLE 0x0 42enum {
43#define CPER_SEV_FATAL 0x1 43 CPER_SEV_RECOVERABLE,
44#define CPER_SEV_CORRECTED 0x2 44 CPER_SEV_FATAL,
45#define CPER_SEV_INFORMATIONAL 0x3 45 CPER_SEV_CORRECTED,
46 CPER_SEV_INFORMATIONAL,
47};
46 48
47/* 49/*
48 * Validation bits difinition for validation_bits in struct 50 * Validation bits difinition for validation_bits in struct
@@ -201,6 +203,47 @@
201 UUID_LE(0x036F84E1, 0x7F37, 0x428c, 0xA7, 0x9E, 0x57, 0x5F, \ 203 UUID_LE(0x036F84E1, 0x7F37, 0x428c, 0xA7, 0x9E, 0x57, 0x5F, \
202 0xDF, 0xAA, 0x84, 0xEC) 204 0xDF, 0xAA, 0x84, 0xEC)
203 205
206#define CPER_PROC_VALID_TYPE 0x0001
207#define CPER_PROC_VALID_ISA 0x0002
208#define CPER_PROC_VALID_ERROR_TYPE 0x0004
209#define CPER_PROC_VALID_OPERATION 0x0008
210#define CPER_PROC_VALID_FLAGS 0x0010
211#define CPER_PROC_VALID_LEVEL 0x0020
212#define CPER_PROC_VALID_VERSION 0x0040
213#define CPER_PROC_VALID_BRAND_INFO 0x0080
214#define CPER_PROC_VALID_ID 0x0100
215#define CPER_PROC_VALID_TARGET_ADDRESS 0x0200
216#define CPER_PROC_VALID_REQUESTOR_ID 0x0400
217#define CPER_PROC_VALID_RESPONDER_ID 0x0800
218#define CPER_PROC_VALID_IP 0x1000
219
220#define CPER_MEM_VALID_ERROR_STATUS 0x0001
221#define CPER_MEM_VALID_PHYSICAL_ADDRESS 0x0002
222#define CPER_MEM_VALID_PHYSICAL_ADDRESS_MASK 0x0004
223#define CPER_MEM_VALID_NODE 0x0008
224#define CPER_MEM_VALID_CARD 0x0010
225#define CPER_MEM_VALID_MODULE 0x0020
226#define CPER_MEM_VALID_BANK 0x0040
227#define CPER_MEM_VALID_DEVICE 0x0080
228#define CPER_MEM_VALID_ROW 0x0100
229#define CPER_MEM_VALID_COLUMN 0x0200
230#define CPER_MEM_VALID_BIT_POSITION 0x0400
231#define CPER_MEM_VALID_REQUESTOR_ID 0x0800
232#define CPER_MEM_VALID_RESPONDER_ID 0x1000
233#define CPER_MEM_VALID_TARGET_ID 0x2000
234#define CPER_MEM_VALID_ERROR_TYPE 0x4000
235
236#define CPER_PCIE_VALID_PORT_TYPE 0x0001
237#define CPER_PCIE_VALID_VERSION 0x0002
238#define CPER_PCIE_VALID_COMMAND_STATUS 0x0004
239#define CPER_PCIE_VALID_DEVICE_ID 0x0008
240#define CPER_PCIE_VALID_SERIAL_NUMBER 0x0010
241#define CPER_PCIE_VALID_BRIDGE_CONTROL_STATUS 0x0020
242#define CPER_PCIE_VALID_CAPABILITY 0x0040
243#define CPER_PCIE_VALID_AER_INFO 0x0080
244
245#define CPER_PCIE_SLOT_SHIFT 3
246
204/* 247/*
205 * All tables and structs must be byte-packed to match CPER 248 * All tables and structs must be byte-packed to match CPER
206 * specification, since the tables are provided by the system BIOS 249 * specification, since the tables are provided by the system BIOS
@@ -267,7 +310,7 @@ struct cper_sec_proc_ia {
267 __u8 cpuid[48]; 310 __u8 cpuid[48];
268}; 311};
269 312
270/* IA32/X64 Processor Error Infomation Structure */ 313/* IA32/X64 Processor Error Information Structure */
271struct cper_ia_err_info { 314struct cper_ia_err_info {
272 uuid_le err_type; 315 uuid_le err_type;
273 __u64 validation_bits; 316 __u64 validation_bits;
@@ -306,9 +349,46 @@ struct cper_sec_mem_err {
306 __u8 error_type; 349 __u8 error_type;
307}; 350};
308 351
352struct cper_sec_pcie {
353 __u64 validation_bits;
354 __u32 port_type;
355 struct {
356 __u8 minor;
357 __u8 major;
358 __u8 reserved[2];
359 } version;
360 __u16 command;
361 __u16 status;
362 __u32 reserved;
363 struct {
364 __u16 vendor_id;
365 __u16 device_id;
366 __u8 class_code[3];
367 __u8 function;
368 __u8 device;
369 __u16 segment;
370 __u8 bus;
371 __u8 secondary_bus;
372 __u16 slot;
373 __u8 reserved;
374 } device_id;
375 struct {
376 __u32 lower;
377 __u32 upper;
378 } serial_number;
379 struct {
380 __u16 secondary_status;
381 __u16 control;
382 } bridge;
383 __u8 capability[60];
384 __u8 aer_info[96];
385};
386
309/* Reset to default packing */ 387/* Reset to default packing */
310#pragma pack() 388#pragma pack()
311 389
312u64 cper_next_record_id(void); 390u64 cper_next_record_id(void);
391void cper_print_bits(const char *prefix, unsigned int bits,
392 const char *strs[], unsigned int strs_size);
313 393
314#endif 394#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4823af64e9db..5f09323ee880 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -10,11 +10,6 @@
10 * 10 *
11 * CPUs are exported via sysfs in the class/cpu/devices/ 11 * CPUs are exported via sysfs in the class/cpu/devices/
12 * directory. 12 * directory.
13 *
14 * Per-cpu interfaces can be implemented using a struct device_interface.
15 * See the following for how to do this:
16 * - drivers/base/intf.c
17 * - Documentation/driver-model/interface.txt
18 */ 13 */
19#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
20#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
new file mode 100644
index 000000000000..473771a528c0
--- /dev/null
+++ b/include/linux/cpu_rmap.h
@@ -0,0 +1,73 @@
1/*
2 * cpu_rmap.c: CPU affinity reverse-map support
3 * Copyright 2011 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#include <linux/cpumask.h>
11#include <linux/gfp.h>
12#include <linux/slab.h>
13
14/**
15 * struct cpu_rmap - CPU affinity reverse-map
16 * @size: Number of objects to be reverse-mapped
17 * @used: Number of objects added
18 * @obj: Pointer to array of object pointers
19 * @near: For each CPU, the index and distance to the nearest object,
20 * based on affinity masks
21 */
22struct cpu_rmap {
23 u16 size, used;
24 void **obj;
25 struct {
26 u16 index;
27 u16 dist;
28 } near[0];
29};
30#define CPU_RMAP_DIST_INF 0xffff
31
32extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
33
34/**
35 * free_cpu_rmap - free CPU affinity reverse-map
36 * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL
37 */
38static inline void free_cpu_rmap(struct cpu_rmap *rmap)
39{
40 kfree(rmap);
41}
42
43extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
44extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
45 const struct cpumask *affinity);
46
47static inline u16 cpu_rmap_lookup_index(struct cpu_rmap *rmap, unsigned int cpu)
48{
49 return rmap->near[cpu].index;
50}
51
52static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
53{
54 return rmap->obj[rmap->near[cpu].index];
55}
56
57#ifdef CONFIG_GENERIC_HARDIRQS
58
59/**
60 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
61 * @size: Number of objects to be mapped
62 *
63 * Must be called in process context.
64 */
65static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size)
66{
67 return alloc_cpu_rmap(size, GFP_KERNEL);
68}
69extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
70
71extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
72
73#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index c3e9de8321c6..11be48e0d168 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
@@ -56,9 +56,9 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
56#define CPUFREQ_POLICY_POWERSAVE (1) 56#define CPUFREQ_POLICY_POWERSAVE (1)
57#define CPUFREQ_POLICY_PERFORMANCE (2) 57#define CPUFREQ_POLICY_PERFORMANCE (2)
58 58
59/* Frequency values here are CPU kHz so that hardware which doesn't run 59/* Frequency values here are CPU kHz so that hardware which doesn't run
60 * with some frequencies can complain without having to guess what per 60 * with some frequencies can complain without having to guess what per
61 * cent / per mille means. 61 * cent / per mille means.
62 * Maximum transition latency is in nanoseconds - if it's unknown, 62 * Maximum transition latency is in nanoseconds - if it's unknown,
63 * CPUFREQ_ETERNAL shall be used. 63 * CPUFREQ_ETERNAL shall be used.
64 */ 64 */
@@ -72,13 +72,15 @@ extern struct kobject *cpufreq_global_kobject;
72struct cpufreq_cpuinfo { 72struct cpufreq_cpuinfo {
73 unsigned int max_freq; 73 unsigned int max_freq;
74 unsigned int min_freq; 74 unsigned int min_freq;
75 unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */ 75
76 /* in 10^(-9) s = nanoseconds */
77 unsigned int transition_latency;
76}; 78};
77 79
78struct cpufreq_real_policy { 80struct cpufreq_real_policy {
79 unsigned int min; /* in kHz */ 81 unsigned int min; /* in kHz */
80 unsigned int max; /* in kHz */ 82 unsigned int max; /* in kHz */
81 unsigned int policy; /* see above */ 83 unsigned int policy; /* see above */
82 struct cpufreq_governor *governor; /* see below */ 84 struct cpufreq_governor *governor; /* see below */
83}; 85};
84 86
@@ -94,7 +96,7 @@ struct cpufreq_policy {
94 unsigned int max; /* in kHz */ 96 unsigned int max; /* in kHz */
95 unsigned int cur; /* in kHz, only needed if cpufreq 97 unsigned int cur; /* in kHz, only needed if cpufreq
96 * governors are used */ 98 * governors are used */
97 unsigned int policy; /* see above */ 99 unsigned int policy; /* see above */
98 struct cpufreq_governor *governor; /* see below */ 100 struct cpufreq_governor *governor; /* see below */
99 101
100 struct work_struct update; /* if update_policy() needs to be 102 struct work_struct update; /* if update_policy() needs to be
@@ -167,11 +169,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
167 169
168struct cpufreq_governor { 170struct cpufreq_governor {
169 char name[CPUFREQ_NAME_LEN]; 171 char name[CPUFREQ_NAME_LEN];
170 int (*governor) (struct cpufreq_policy *policy, 172 int (*governor) (struct cpufreq_policy *policy,
171 unsigned int event); 173 unsigned int event);
172 ssize_t (*show_setspeed) (struct cpufreq_policy *policy, 174 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
173 char *buf); 175 char *buf);
174 int (*store_setspeed) (struct cpufreq_policy *policy, 176 int (*store_setspeed) (struct cpufreq_policy *policy,
175 unsigned int freq); 177 unsigned int freq);
176 unsigned int max_transition_latency; /* HW must be able to switch to 178 unsigned int max_transition_latency; /* HW must be able to switch to
177 next freq faster than this value in nano secs or we 179 next freq faster than this value in nano secs or we
@@ -180,7 +182,8 @@ struct cpufreq_governor {
180 struct module *owner; 182 struct module *owner;
181}; 183};
182 184
183/* pass a target to the cpufreq driver 185/*
186 * Pass a target to the cpufreq driver.
184 */ 187 */
185extern int cpufreq_driver_target(struct cpufreq_policy *policy, 188extern int cpufreq_driver_target(struct cpufreq_policy *policy,
186 unsigned int target_freq, 189 unsigned int target_freq,
@@ -230,16 +233,16 @@ struct cpufreq_driver {
230 int (*bios_limit) (int cpu, unsigned int *limit); 233 int (*bios_limit) (int cpu, unsigned int *limit);
231 234
232 int (*exit) (struct cpufreq_policy *policy); 235 int (*exit) (struct cpufreq_policy *policy);
233 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 236 int (*suspend) (struct cpufreq_policy *policy);
234 int (*resume) (struct cpufreq_policy *policy); 237 int (*resume) (struct cpufreq_policy *policy);
235 struct freq_attr **attr; 238 struct freq_attr **attr;
236}; 239};
237 240
238/* flags */ 241/* flags */
239 242
240#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 243#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if
241 * all ->init() calls failed */ 244 * all ->init() calls failed */
242#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 245#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel
243 * "constants" aren't affected by 246 * "constants" aren't affected by
244 * frequency transitions */ 247 * frequency transitions */
245#define CPUFREQ_PM_NO_WARN 0x04 /* don't warn on suspend/resume speed 248#define CPUFREQ_PM_NO_WARN 0x04 /* don't warn on suspend/resume speed
@@ -252,7 +255,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
252void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); 255void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state);
253 256
254 257
255static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 258static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max)
256{ 259{
257 if (policy->min < min) 260 if (policy->min < min)
258 policy->min = min; 261 policy->min = min;
@@ -281,19 +284,10 @@ __ATTR(_name, 0444, show_##_name, NULL)
281static struct freq_attr _name = \ 284static struct freq_attr _name = \
282__ATTR(_name, _perm, show_##_name, NULL) 285__ATTR(_name, _perm, show_##_name, NULL)
283 286
284#define cpufreq_freq_attr_ro_old(_name) \
285static struct freq_attr _name##_old = \
286__ATTR(_name, 0444, show_##_name##_old, NULL)
287
288#define cpufreq_freq_attr_rw(_name) \ 287#define cpufreq_freq_attr_rw(_name) \
289static struct freq_attr _name = \ 288static struct freq_attr _name = \
290__ATTR(_name, 0644, show_##_name, store_##_name) 289__ATTR(_name, 0644, show_##_name, store_##_name)
291 290
292#define cpufreq_freq_attr_rw_old(_name) \
293static struct freq_attr _name##_old = \
294__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
295
296
297struct global_attr { 291struct global_attr {
298 struct attribute attr; 292 struct attribute attr;
299 ssize_t (*show)(struct kobject *kobj, 293 ssize_t (*show)(struct kobject *kobj,
@@ -395,34 +389,15 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
395/* the following 3 funtions are for cpufreq core use only */ 389/* the following 3 funtions are for cpufreq core use only */
396struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 390struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
397struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 391struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
398void cpufreq_cpu_put (struct cpufreq_policy *data); 392void cpufreq_cpu_put(struct cpufreq_policy *data);
399 393
400/* the following are really really optional */ 394/* the following are really really optional */
401extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 395extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
402 396
403void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 397void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
404 unsigned int cpu); 398 unsigned int cpu);
405 399
406void cpufreq_frequency_table_put_attr(unsigned int cpu); 400void cpufreq_frequency_table_put_attr(unsigned int cpu);
407 401
408 402
409/*********************************************************************
410 * UNIFIED DEBUG HELPERS *
411 *********************************************************************/
412
413#define CPUFREQ_DEBUG_CORE 1
414#define CPUFREQ_DEBUG_DRIVER 2
415#define CPUFREQ_DEBUG_GOVERNOR 4
416
417#ifdef CONFIG_CPU_FREQ_DEBUG
418
419extern void cpufreq_debug_printk(unsigned int type, const char *prefix,
420 const char *fmt, ...);
421
422#else
423
424#define cpufreq_debug_printk(msg...) do { } while(0)
425
426#endif /* CONFIG_CPU_FREQ_DEBUG */
427
428#endif /* _LINUX_CPUFREQ_H */ 403#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 1be416bbbb82..36719ead50e8 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -47,13 +47,7 @@ struct cpuidle_state {
47 47
48/* Idle State Flags */ 48/* Idle State Flags */
49#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 49#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
50#define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */
51#define CPUIDLE_FLAG_POLL (0x10) /* no latency, no savings */
52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */
53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */ 50#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
56#define CPUIDLE_FLAG_TLB_FLUSHED (0x200) /* tlb will be flushed */
57 51
58#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 52#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
59 53
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index 6fc2bed368b8..0e7bf272ec2f 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -84,9 +84,11 @@ struct cramfs_super {
84 | CRAMFS_FLAG_WRONG_SIGNATURE \ 84 | CRAMFS_FLAG_WRONG_SIGNATURE \
85 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET ) 85 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
86 86
87#ifdef __KERNEL__
87/* Uncompression interfaces to the underlying zlib */ 88/* Uncompression interfaces to the underlying zlib */
88int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); 89int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
89int cramfs_uncompress_init(void); 90int cramfs_uncompress_init(void);
90void cramfs_uncompress_exit(void); 91void cramfs_uncompress_exit(void);
92#endif /* __KERNEL__ */
91 93
92#endif 94#endif
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 0026f267da20..088cd4ace4ef 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -20,7 +20,14 @@ extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
20#define vmcore_elf_check_arch_cross(x) 0 20#define vmcore_elf_check_arch_cross(x) 0
21#endif 21#endif
22 22
23#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) 23/*
24 * Architecture code can redefine this if there are any special checks
25 * needed for 64-bit ELF vmcores. In case of 32-bit only architecture,
26 * this can be set to zero.
27 */
28#ifndef vmcore_elf64_check_arch
29#define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
30#endif
24 31
25/* 32/*
26 * is_kdump_kernel() checks whether this kernel is booting after a panic of 33 * is_kdump_kernel() checks whether this kernel is booting after a panic of
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index e20dd1f9b40a..391a259b2cc9 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,7 +11,7 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)data, length) 14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 15
16/* 16/*
17 * Helpers for hash table generation of ethernet nics: 17 * Helpers for hash table generation of ethernet nics:
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4aaeab376446..be16b61283cc 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -146,6 +146,7 @@ struct cred {
146 void *security; /* subjective LSM security */ 146 void *security; /* subjective LSM security */
147#endif 147#endif
148 struct user_struct *user; /* real user ID subscription */ 148 struct user_struct *user; /* real user ID subscription */
149 struct user_namespace *user_ns; /* cached user->user_ns */
149 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 150 struct group_info *group_info; /* supplementary groups for euid/fsgid */
150 struct rcu_head rcu; /* RCU deletion hook */ 151 struct rcu_head rcu; /* RCU deletion hook */
151}; 152};
@@ -354,9 +355,16 @@ static inline void put_cred(const struct cred *_cred)
354#define current_fsgid() (current_cred_xxx(fsgid)) 355#define current_fsgid() (current_cred_xxx(fsgid))
355#define current_cap() (current_cred_xxx(cap_effective)) 356#define current_cap() (current_cred_xxx(cap_effective))
356#define current_user() (current_cred_xxx(user)) 357#define current_user() (current_cred_xxx(user))
357#define current_user_ns() (current_cred_xxx(user)->user_ns)
358#define current_security() (current_cred_xxx(security)) 358#define current_security() (current_cred_xxx(security))
359 359
360#ifdef CONFIG_USER_NS
361#define current_user_ns() (current_cred_xxx(user_ns))
362#else
363extern struct user_namespace init_user_ns;
364#define current_user_ns() (&init_user_ns)
365#endif
366
367
360#define current_uid_gid(_uid, _gid) \ 368#define current_uid_gid(_uid, _gid) \
361do { \ 369do { \
362 const struct cred *__cred; \ 370 const struct cred *__cred; \
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index d5a1d4810b80..6fe2114f8ad2 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -103,14 +103,20 @@ static inline int cs5535_has_vsa2(void)
103#define GPIO_POSITIVE_EDGE_STS 0x48 103#define GPIO_POSITIVE_EDGE_STS 0x48
104#define GPIO_NEGATIVE_EDGE_STS 0x4C 104#define GPIO_NEGATIVE_EDGE_STS 0x4C
105 105
106#define GPIO_FLTR7_AMOUNT 0xD8
107
106#define GPIO_MAP_X 0xE0 108#define GPIO_MAP_X 0xE0
107#define GPIO_MAP_Y 0xE4 109#define GPIO_MAP_Y 0xE4
108#define GPIO_MAP_Z 0xE8 110#define GPIO_MAP_Z 0xE8
109#define GPIO_MAP_W 0xEC 111#define GPIO_MAP_W 0xEC
110 112
113#define GPIO_FE7_SEL 0xF7
114
111void cs5535_gpio_set(unsigned offset, unsigned int reg); 115void cs5535_gpio_set(unsigned offset, unsigned int reg);
112void cs5535_gpio_clear(unsigned offset, unsigned int reg); 116void cs5535_gpio_clear(unsigned offset, unsigned int reg);
113int cs5535_gpio_isset(unsigned offset, unsigned int reg); 117int cs5535_gpio_isset(unsigned offset, unsigned int reg);
118int cs5535_gpio_set_irq(unsigned group, unsigned irq);
119void cs5535_gpio_setup_event(unsigned offset, int pair, int pme);
114 120
115/* MFGPTs */ 121/* MFGPTs */
116 122
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index 5dd428532f79..542888504994 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -36,6 +36,7 @@ struct emac_platform_data {
36 36
37 u8 rmii_en; 37 u8 rmii_en;
38 u8 version; 38 u8 version;
39 bool no_bd_ram;
39 void (*interrupt_enable) (void); 40 void (*interrupt_enable) (void);
40 void (*interrupt_disable) (void); 41 void (*interrupt_disable) (void);
41}; 42};
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 6a4aea30aa09..19d90a55541d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -4,7 +4,9 @@
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/rculist.h> 6#include <linux/rculist.h>
7#include <linux/rculist_bl.h>
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/seqlock.h>
8#include <linux/cache.h> 10#include <linux/cache.h>
9#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
10 12
@@ -45,6 +47,27 @@ struct dentry_stat_t {
45}; 47};
46extern struct dentry_stat_t dentry_stat; 48extern struct dentry_stat_t dentry_stat;
47 49
50/*
51 * Compare 2 name strings, return 0 if they match, otherwise non-zero.
52 * The strings are both count bytes long, and count is non-zero.
53 */
54static inline int dentry_cmp(const unsigned char *cs, size_t scount,
55 const unsigned char *ct, size_t tcount)
56{
57 int ret;
58 if (scount != tcount)
59 return 1;
60 do {
61 ret = (*cs != *ct);
62 if (ret)
63 break;
64 cs++;
65 ct++;
66 tcount--;
67 } while (tcount);
68 return ret;
69}
70
48/* Name hashing routines. Initial hash value */ 71/* Name hashing routines. Initial hash value */
49/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ 72/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
50#define init_name_hash() 0 73#define init_name_hash() 0
@@ -81,25 +104,33 @@ full_name_hash(const unsigned char *name, unsigned int len)
81 * large memory footprint increase). 104 * large memory footprint increase).
82 */ 105 */
83#ifdef CONFIG_64BIT 106#ifdef CONFIG_64BIT
84#define DNAME_INLINE_LEN_MIN 32 /* 192 bytes */ 107# define DNAME_INLINE_LEN 32 /* 192 bytes */
85#else 108#else
86#define DNAME_INLINE_LEN_MIN 40 /* 128 bytes */ 109# ifdef CONFIG_SMP
110# define DNAME_INLINE_LEN 36 /* 128 bytes */
111# else
112# define DNAME_INLINE_LEN 40 /* 128 bytes */
113# endif
87#endif 114#endif
88 115
89struct dentry { 116struct dentry {
90 atomic_t d_count; 117 /* RCU lookup touched fields */
91 unsigned int d_flags; /* protected by d_lock */ 118 unsigned int d_flags; /* protected by d_lock */
92 spinlock_t d_lock; /* per dentry lock */ 119 seqcount_t d_seq; /* per dentry seqlock */
93 int d_mounted; 120 struct hlist_bl_node d_hash; /* lookup hash list */
94 struct inode *d_inode; /* Where the name belongs to - NULL is
95 * negative */
96 /*
97 * The next three fields are touched by __d_lookup. Place them here
98 * so they all fit in a cache line.
99 */
100 struct hlist_node d_hash; /* lookup hash list */
101 struct dentry *d_parent; /* parent directory */ 121 struct dentry *d_parent; /* parent directory */
102 struct qstr d_name; 122 struct qstr d_name;
123 struct inode *d_inode; /* Where the name belongs to - NULL is
124 * negative */
125 unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */
126
127 /* Ref lookup also touches following */
128 unsigned int d_count; /* protected by d_lock */
129 spinlock_t d_lock; /* per dentry lock */
130 const struct dentry_operations *d_op;
131 struct super_block *d_sb; /* The root of the dentry tree */
132 unsigned long d_time; /* used by d_revalidate */
133 void *d_fsdata; /* fs-specific data */
103 134
104 struct list_head d_lru; /* LRU list */ 135 struct list_head d_lru; /* LRU list */
105 /* 136 /*
@@ -111,12 +142,6 @@ struct dentry {
111 } d_u; 142 } d_u;
112 struct list_head d_subdirs; /* our children */ 143 struct list_head d_subdirs; /* our children */
113 struct list_head d_alias; /* inode alias list */ 144 struct list_head d_alias; /* inode alias list */
114 unsigned long d_time; /* used by d_revalidate */
115 const struct dentry_operations *d_op;
116 struct super_block *d_sb; /* The root of the dentry tree */
117 void *d_fsdata; /* fs-specific data */
118
119 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
120}; 145};
121 146
122/* 147/*
@@ -133,96 +158,68 @@ enum dentry_d_lock_class
133 158
134struct dentry_operations { 159struct dentry_operations {
135 int (*d_revalidate)(struct dentry *, struct nameidata *); 160 int (*d_revalidate)(struct dentry *, struct nameidata *);
136 int (*d_hash) (struct dentry *, struct qstr *); 161 int (*d_hash)(const struct dentry *, const struct inode *,
137 int (*d_compare) (struct dentry *, struct qstr *, struct qstr *); 162 struct qstr *);
138 int (*d_delete)(struct dentry *); 163 int (*d_compare)(const struct dentry *, const struct inode *,
164 const struct dentry *, const struct inode *,
165 unsigned int, const char *, const struct qstr *);
166 int (*d_delete)(const struct dentry *);
139 void (*d_release)(struct dentry *); 167 void (*d_release)(struct dentry *);
140 void (*d_iput)(struct dentry *, struct inode *); 168 void (*d_iput)(struct dentry *, struct inode *);
141 char *(*d_dname)(struct dentry *, char *, int); 169 char *(*d_dname)(struct dentry *, char *, int);
142}; 170 struct vfsmount *(*d_automount)(struct path *);
143 171 int (*d_manage)(struct dentry *, bool);
144/* the dentry parameter passed to d_hash and d_compare is the parent 172} ____cacheline_aligned;
145 * directory of the entries to be compared. It is used in case these
146 * functions need any directory specific information for determining
147 * equivalency classes. Using the dentry itself might not work, as it
148 * might be a negative dentry which has no information associated with
149 * it */
150 173
151/* 174/*
152locking rules: 175 * Locking rules for dentry_operations callbacks are to be found in
153 big lock dcache_lock d_lock may block 176 * Documentation/filesystems/Locking. Keep it updated!
154d_revalidate: no no no yes 177 *
155d_hash no no no yes 178 * FUrther descriptions are found in Documentation/filesystems/vfs.txt.
156d_compare: no yes yes no 179 * Keep it updated too!
157d_delete: no yes no no
158d_release: no no no yes
159d_iput: no no no yes
160 */ 180 */
161 181
162/* d_flags entries */ 182/* d_flags entries */
163#define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */ 183#define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */
164#define DCACHE_NFSFS_RENAMED 0x0002 /* this dentry has been "silly 184#define DCACHE_NFSFS_RENAMED 0x0002
165 * renamed" and has to be 185 /* this dentry has been "silly renamed" and has to be deleted on the last
166 * deleted on the last dput() 186 * dput() */
167 */ 187
168#define DCACHE_DISCONNECTED 0x0004 188#define DCACHE_DISCONNECTED 0x0004
169 /* This dentry is possibly not currently connected to the dcache tree, 189 /* This dentry is possibly not currently connected to the dcache tree, in
170 * in which case its parent will either be itself, or will have this 190 * which case its parent will either be itself, or will have this flag as
171 * flag as well. nfsd will not use a dentry with this bit set, but will 191 * well. nfsd will not use a dentry with this bit set, but will first
172 * first endeavour to clear the bit either by discovering that it is 192 * endeavour to clear the bit either by discovering that it is connected,
173 * connected, or by performing lookup operations. Any filesystem which 193 * or by performing lookup operations. Any filesystem which supports
174 * supports nfsd_operations MUST have a lookup function which, if it finds 194 * nfsd_operations MUST have a lookup function which, if it finds a
175 * a directory inode with a DCACHE_DISCONNECTED dentry, will d_move 195 * directory inode with a DCACHE_DISCONNECTED dentry, will d_move that
176 * that dentry into place and return that dentry rather than the passed one, 196 * dentry into place and return that dentry rather than the passed one,
177 * typically using d_splice_alias. 197 * typically using d_splice_alias. */
178 */
179 198
180#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ 199#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
181#define DCACHE_UNHASHED 0x0010 200#define DCACHE_RCUACCESS 0x0010 /* Entry has ever been RCU-visible */
182 201#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020
183#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched by inotify */ 202 /* Parent inode is watched by inotify */
184 203
185#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */ 204#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */
186 205#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080
187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ 206 /* Parent inode is watched by some fsnotify listener */
188 207
189#define DCACHE_CANT_MOUNT 0x0100 208#define DCACHE_CANT_MOUNT 0x0100
209#define DCACHE_GENOCIDE 0x0200
190 210
191extern spinlock_t dcache_lock; 211#define DCACHE_OP_HASH 0x1000
192extern seqlock_t rename_lock; 212#define DCACHE_OP_COMPARE 0x2000
193 213#define DCACHE_OP_REVALIDATE 0x4000
194/** 214#define DCACHE_OP_DELETE 0x8000
195 * d_drop - drop a dentry
196 * @dentry: dentry to drop
197 *
198 * d_drop() unhashes the entry from the parent dentry hashes, so that it won't
199 * be found through a VFS lookup any more. Note that this is different from
200 * deleting the dentry - d_delete will try to mark the dentry negative if
201 * possible, giving a successful _negative_ lookup, while d_drop will
202 * just make the cache lookup fail.
203 *
204 * d_drop() is used mainly for stuff that wants to invalidate a dentry for some
205 * reason (NFS timeouts or autofs deletes).
206 *
207 * __d_drop requires dentry->d_lock.
208 */
209 215
210static inline void __d_drop(struct dentry *dentry) 216#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
211{ 217#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
212 if (!(dentry->d_flags & DCACHE_UNHASHED)) { 218#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
213 dentry->d_flags |= DCACHE_UNHASHED; 219#define DCACHE_MANAGED_DENTRY \
214 hlist_del_rcu(&dentry->d_hash); 220 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
215 }
216}
217 221
218static inline void d_drop(struct dentry *dentry) 222extern seqlock_t rename_lock;
219{
220 spin_lock(&dcache_lock);
221 spin_lock(&dentry->d_lock);
222 __d_drop(dentry);
223 spin_unlock(&dentry->d_lock);
224 spin_unlock(&dcache_lock);
225}
226 223
227static inline int dname_external(struct dentry *dentry) 224static inline int dname_external(struct dentry *dentry)
228{ 225{
@@ -235,10 +232,14 @@ static inline int dname_external(struct dentry *dentry)
235extern void d_instantiate(struct dentry *, struct inode *); 232extern void d_instantiate(struct dentry *, struct inode *);
236extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 233extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
237extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 234extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
235extern void __d_drop(struct dentry *dentry);
236extern void d_drop(struct dentry *dentry);
238extern void d_delete(struct dentry *); 237extern void d_delete(struct dentry *);
238extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op);
239 239
240/* allocate/de-allocate */ 240/* allocate/de-allocate */
241extern struct dentry * d_alloc(struct dentry *, const struct qstr *); 241extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
242extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
242extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 243extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
243extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 244extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
244extern struct dentry * d_obtain_alias(struct inode *); 245extern struct dentry * d_obtain_alias(struct inode *);
@@ -296,14 +297,40 @@ static inline struct dentry *d_add_unique(struct dentry *entry, struct inode *in
296 return res; 297 return res;
297} 298}
298 299
300extern void dentry_update_name_case(struct dentry *, struct qstr *);
301
299/* used for rename() and baskets */ 302/* used for rename() and baskets */
300extern void d_move(struct dentry *, struct dentry *); 303extern void d_move(struct dentry *, struct dentry *);
301extern struct dentry *d_ancestor(struct dentry *, struct dentry *); 304extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
302 305
303/* appendix may either be NULL or be used for transname suffixes */ 306/* appendix may either be NULL or be used for transname suffixes */
304extern struct dentry * d_lookup(struct dentry *, struct qstr *); 307extern struct dentry *d_lookup(struct dentry *, struct qstr *);
305extern struct dentry * __d_lookup(struct dentry *, struct qstr *); 308extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
306extern struct dentry * d_hash_and_lookup(struct dentry *, struct qstr *); 309extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
310extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
311 unsigned *seq, struct inode **inode);
312
313/**
314 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
315 * @dentry: dentry to take a ref on
316 * @seq: seqcount to verify against
317 * Returns: 0 on failure, else 1.
318 *
319 * __d_rcu_to_refcount operates on a dentry,seq pair that was returned
320 * by __d_lookup_rcu, to get a reference on an rcu-walk dentry.
321 */
322static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
323{
324 int ret = 0;
325
326 assert_spin_locked(&dentry->d_lock);
327 if (!read_seqcount_retry(&dentry->d_seq, seq)) {
328 ret = 1;
329 dentry->d_count++;
330 }
331
332 return ret;
333}
307 334
308/* validate "insecure" dentry pointer */ 335/* validate "insecure" dentry pointer */
309extern int d_validate(struct dentry *, struct dentry *); 336extern int d_validate(struct dentry *, struct dentry *);
@@ -316,34 +343,37 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
316extern char *__d_path(const struct path *path, struct path *root, char *, int); 343extern char *__d_path(const struct path *path, struct path *root, char *, int);
317extern char *d_path(const struct path *, char *, int); 344extern char *d_path(const struct path *, char *, int);
318extern char *d_path_with_unreachable(const struct path *, char *, int); 345extern char *d_path_with_unreachable(const struct path *, char *, int);
319extern char *__dentry_path(struct dentry *, char *, int); 346extern char *dentry_path_raw(struct dentry *, char *, int);
320extern char *dentry_path(struct dentry *, char *, int); 347extern char *dentry_path(struct dentry *, char *, int);
321 348
322/* Allocation counts.. */ 349/* Allocation counts.. */
323 350
324/** 351/**
325 * dget, dget_locked - get a reference to a dentry 352 * dget, dget_dlock - get a reference to a dentry
326 * @dentry: dentry to get a reference to 353 * @dentry: dentry to get a reference to
327 * 354 *
328 * Given a dentry or %NULL pointer increment the reference count 355 * Given a dentry or %NULL pointer increment the reference count
329 * if appropriate and return the dentry. A dentry will not be 356 * if appropriate and return the dentry. A dentry will not be
330 * destroyed when it has references. dget() should never be 357 * destroyed when it has references.
331 * called for dentries with zero reference counter. For these cases
332 * (preferably none, functions in dcache.c are sufficient for normal
333 * needs and they take necessary precautions) you should hold dcache_lock
334 * and call dget_locked() instead of dget().
335 */ 358 */
336 359static inline struct dentry *dget_dlock(struct dentry *dentry)
360{
361 if (dentry)
362 dentry->d_count++;
363 return dentry;
364}
365
337static inline struct dentry *dget(struct dentry *dentry) 366static inline struct dentry *dget(struct dentry *dentry)
338{ 367{
339 if (dentry) { 368 if (dentry) {
340 BUG_ON(!atomic_read(&dentry->d_count)); 369 spin_lock(&dentry->d_lock);
341 atomic_inc(&dentry->d_count); 370 dget_dlock(dentry);
371 spin_unlock(&dentry->d_lock);
342 } 372 }
343 return dentry; 373 return dentry;
344} 374}
345 375
346extern struct dentry * dget_locked(struct dentry *); 376extern struct dentry *dget_parent(struct dentry *dentry);
347 377
348/** 378/**
349 * d_unhashed - is dentry hashed 379 * d_unhashed - is dentry hashed
@@ -354,7 +384,7 @@ extern struct dentry * dget_locked(struct dentry *);
354 384
355static inline int d_unhashed(struct dentry *dentry) 385static inline int d_unhashed(struct dentry *dentry)
356{ 386{
357 return (dentry->d_flags & DCACHE_UNHASHED); 387 return hlist_bl_unhashed(&dentry->d_hash);
358} 388}
359 389
360static inline int d_unlinked(struct dentry *dentry) 390static inline int d_unlinked(struct dentry *dentry)
@@ -374,24 +404,18 @@ static inline void dont_mount(struct dentry *dentry)
374 spin_unlock(&dentry->d_lock); 404 spin_unlock(&dentry->d_lock);
375} 405}
376 406
377static inline struct dentry *dget_parent(struct dentry *dentry) 407extern void dput(struct dentry *);
378{
379 struct dentry *ret;
380 408
381 spin_lock(&dentry->d_lock); 409static inline bool d_managed(struct dentry *dentry)
382 ret = dget(dentry->d_parent); 410{
383 spin_unlock(&dentry->d_lock); 411 return dentry->d_flags & DCACHE_MANAGED_DENTRY;
384 return ret;
385} 412}
386 413
387extern void dput(struct dentry *); 414static inline bool d_mountpoint(struct dentry *dentry)
388
389static inline int d_mountpoint(struct dentry *dentry)
390{ 415{
391 return dentry->d_mounted; 416 return dentry->d_flags & DCACHE_MOUNTED;
392} 417}
393 418
394extern struct vfsmount *lookup_mnt(struct path *);
395extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 419extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
396 420
397extern int sysctl_vfs_cache_pressure; 421extern int sysctl_vfs_cache_pressure;
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 8723491f7dfd..c52280047e2c 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2008, Intel Corporation. 2 * Copyright (c) 2008-2011, Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -22,6 +22,152 @@
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25/* IEEE 802.1Qaz std supported values */
26#define IEEE_8021QAZ_MAX_TCS 8
27
28#define IEEE_8021QAZ_TSA_STRICT 0
29#define IEEE_8021QAZ_TSA_CB_SHAPER 1
30#define IEEE_8021QAZ_TSA_ETS 2
31#define IEEE_8021QAZ_TSA_VENDOR 255
32
33/* This structure contains the IEEE 802.1Qaz ETS managed object
34 *
35 * @willing: willing bit in ETS configuration TLV
36 * @ets_cap: indicates supported capacity of ets feature
37 * @cbs: credit based shaper ets algorithm supported
38 * @tc_tx_bw: tc tx bandwidth indexed by traffic class
39 * @tc_rx_bw: tc rx bandwidth indexed by traffic class
40 * @tc_tsa: TSA Assignment table, indexed by traffic class
41 * @prio_tc: priority assignment table mapping 8021Qp to traffic class
42 * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV
43 * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV
44 * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV
45 *
46 * Recommended values are used to set fields in the ETS recommendation TLV
47 * with hardware offloaded LLDP.
48 *
49 * ----
50 * TSA Assignment 8 bit identifiers
51 * 0 strict priority
52 * 1 credit-based shaper
53 * 2 enhanced transmission selection
54 * 3-254 reserved
55 * 255 vendor specific
56 */
57struct ieee_ets {
58 __u8 willing;
59 __u8 ets_cap;
60 __u8 cbs;
61 __u8 tc_tx_bw[IEEE_8021QAZ_MAX_TCS];
62 __u8 tc_rx_bw[IEEE_8021QAZ_MAX_TCS];
63 __u8 tc_tsa[IEEE_8021QAZ_MAX_TCS];
64 __u8 prio_tc[IEEE_8021QAZ_MAX_TCS];
65 __u8 tc_reco_bw[IEEE_8021QAZ_MAX_TCS];
66 __u8 tc_reco_tsa[IEEE_8021QAZ_MAX_TCS];
67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
68};
69
70/* This structure contains the IEEE 802.1Qaz PFC managed object
71 *
72 * @pfc_cap: Indicates the number of traffic classes on the local device
73 * that may simultaneously have PFC enabled.
74 * @pfc_en: bitmap indicating pfc enabled traffic classes
75 * @mbc: enable macsec bypass capability
76 * @delay: the allowance made for a round-trip propagation delay of the
77 * link in bits.
78 * @requests: count of the sent pfc frames
79 * @indications: count of the received pfc frames
80 */
81struct ieee_pfc {
82 __u8 pfc_cap;
83 __u8 pfc_en;
84 __u8 mbc;
85 __u16 delay;
86 __u64 requests[IEEE_8021QAZ_MAX_TCS];
87 __u64 indications[IEEE_8021QAZ_MAX_TCS];
88};
89
90/* CEE DCBX std supported values */
91#define CEE_DCBX_MAX_PGS 8
92#define CEE_DCBX_MAX_PRIO 8
93
94/**
95 * struct cee_pg - CEE Priority-Group managed object
96 *
97 * @willing: willing bit in the PG tlv
98 * @error: error bit in the PG tlv
99 * @pg_en: enable bit of the PG feature
100 * @tcs_supported: number of traffic classes supported
101 * @pg_bw: bandwidth percentage for each priority group
102 * @prio_pg: priority to PG mapping indexed by priority
103 */
104struct cee_pg {
105 __u8 willing;
106 __u8 error;
107 __u8 pg_en;
108 __u8 tcs_supported;
109 __u8 pg_bw[CEE_DCBX_MAX_PGS];
110 __u8 prio_pg[CEE_DCBX_MAX_PGS];
111};
112
113/**
114 * struct cee_pfc - CEE PFC managed object
115 *
116 * @willing: willing bit in the PFC tlv
117 * @error: error bit in the PFC tlv
118 * @pfc_en: bitmap indicating pfc enabled traffic classes
119 * @tcs_supported: number of traffic classes supported
120 */
121struct cee_pfc {
122 __u8 willing;
123 __u8 error;
124 __u8 pfc_en;
125 __u8 tcs_supported;
126};
127
128/* IEEE 802.1Qaz std supported values */
129#define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1
130#define IEEE_8021QAZ_APP_SEL_STREAM 2
131#define IEEE_8021QAZ_APP_SEL_DGRAM 3
132#define IEEE_8021QAZ_APP_SEL_ANY 4
133
134/* This structure contains the IEEE 802.1Qaz APP managed object. This
135 * object is also used for the CEE std as well. There is no difference
136 * between the objects.
137 *
138 * @selector: protocol identifier type
139 * @protocol: protocol of type indicated
140 * @priority: 3-bit unsigned integer indicating priority
141 *
142 * ----
143 * Selector field values
144 * 0 Reserved
145 * 1 Ethertype
146 * 2 Well known port number over TCP or SCTP
147 * 3 Well known port number over UDP or DCCP
148 * 4 Well known port number over TCP, SCTP, UDP, or DCCP
149 * 5-7 Reserved
150 */
151struct dcb_app {
152 __u8 selector;
153 __u8 priority;
154 __u16 protocol;
155};
156
157/**
158 * struct dcb_peer_app_info - APP feature information sent by the peer
159 *
160 * @willing: willing bit in the peer APP tlv
161 * @error: error bit in the peer APP tlv
162 *
163 * In addition to this information the full peer APP tlv also contains
164 * a table of 'app_count' APP objects defined above.
165 */
166struct dcb_peer_app_info {
167 __u8 willing;
168 __u8 error;
169};
170
25struct dcbmsg { 171struct dcbmsg {
26 __u8 dcb_family; 172 __u8 dcb_family;
27 __u8 cmd; 173 __u8 cmd;
@@ -50,6 +196,13 @@ struct dcbmsg {
50 * @DCB_CMD_SBCN: get backward congestion notification configration. 196 * @DCB_CMD_SBCN: get backward congestion notification configration.
51 * @DCB_CMD_GAPP: get application protocol configuration 197 * @DCB_CMD_GAPP: get application protocol configuration
52 * @DCB_CMD_SAPP: set application protocol configuration 198 * @DCB_CMD_SAPP: set application protocol configuration
199 * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration
200 * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration
201 * @DCB_CMD_GDCBX: get DCBX engine configuration
202 * @DCB_CMD_SDCBX: set DCBX engine configuration
203 * @DCB_CMD_GFEATCFG: get DCBX features flags
204 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
205 * @DCB_CMD_CEE_GET: get CEE aggregated configuration
53 */ 206 */
54enum dcbnl_commands { 207enum dcbnl_commands {
55 DCB_CMD_UNDEFINED, 208 DCB_CMD_UNDEFINED,
@@ -83,6 +236,17 @@ enum dcbnl_commands {
83 DCB_CMD_GAPP, 236 DCB_CMD_GAPP,
84 DCB_CMD_SAPP, 237 DCB_CMD_SAPP,
85 238
239 DCB_CMD_IEEE_SET,
240 DCB_CMD_IEEE_GET,
241
242 DCB_CMD_GDCBX,
243 DCB_CMD_SDCBX,
244
245 DCB_CMD_GFEATCFG,
246 DCB_CMD_SFEATCFG,
247
248 DCB_CMD_CEE_GET,
249
86 __DCB_CMD_ENUM_MAX, 250 __DCB_CMD_ENUM_MAX,
87 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 251 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
88}; 252};
@@ -102,6 +266,10 @@ enum dcbnl_commands {
102 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED) 266 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
103 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED) 267 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
104 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED) 268 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
269 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
270 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
271 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
272 * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED)
105 */ 273 */
106enum dcbnl_attrs { 274enum dcbnl_attrs {
107 DCB_ATTR_UNDEFINED, 275 DCB_ATTR_UNDEFINED,
@@ -119,11 +287,75 @@ enum dcbnl_attrs {
119 DCB_ATTR_BCN, 287 DCB_ATTR_BCN,
120 DCB_ATTR_APP, 288 DCB_ATTR_APP,
121 289
290 /* IEEE std attributes */
291 DCB_ATTR_IEEE,
292
293 DCB_ATTR_DCBX,
294 DCB_ATTR_FEATCFG,
295
296 /* CEE nested attributes */
297 DCB_ATTR_CEE,
298
122 __DCB_ATTR_ENUM_MAX, 299 __DCB_ATTR_ENUM_MAX,
123 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 300 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
124}; 301};
125 302
126/** 303/**
304 * enum ieee_attrs - IEEE 802.1Qaz get/set attributes
305 *
306 * @DCB_ATTR_IEEE_UNSPEC: unspecified
307 * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration
308 * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration
309 * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration
310 * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only
311 * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only
312 * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only
313 */
314enum ieee_attrs {
315 DCB_ATTR_IEEE_UNSPEC,
316 DCB_ATTR_IEEE_ETS,
317 DCB_ATTR_IEEE_PFC,
318 DCB_ATTR_IEEE_APP_TABLE,
319 DCB_ATTR_IEEE_PEER_ETS,
320 DCB_ATTR_IEEE_PEER_PFC,
321 DCB_ATTR_IEEE_PEER_APP,
322 __DCB_ATTR_IEEE_MAX
323};
324#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
325
326enum ieee_attrs_app {
327 DCB_ATTR_IEEE_APP_UNSPEC,
328 DCB_ATTR_IEEE_APP,
329 __DCB_ATTR_IEEE_APP_MAX
330};
331#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
332
333/**
334 * enum cee_attrs - CEE DCBX get attributes
335 *
336 * @DCB_ATTR_CEE_UNSPEC: unspecified
337 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
338 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
339 * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only
340 */
341enum cee_attrs {
342 DCB_ATTR_CEE_UNSPEC,
343 DCB_ATTR_CEE_PEER_PG,
344 DCB_ATTR_CEE_PEER_PFC,
345 DCB_ATTR_CEE_PEER_APP_TABLE,
346 __DCB_ATTR_CEE_MAX
347};
348#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
349
350enum peer_app_attr {
351 DCB_ATTR_CEE_PEER_APP_UNSPEC,
352 DCB_ATTR_CEE_PEER_APP_INFO,
353 DCB_ATTR_CEE_PEER_APP,
354 __DCB_ATTR_CEE_PEER_APP_MAX
355};
356#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
357
358/**
127 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs 359 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
128 * 360 *
129 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors 361 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
@@ -262,6 +494,8 @@ enum dcbnl_tc_attrs {
262 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority 494 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
263 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion 495 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
264 * Notification 496 * Notification
497 * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine
498 *
265 */ 499 */
266enum dcbnl_cap_attrs { 500enum dcbnl_cap_attrs {
267 DCB_CAP_ATTR_UNDEFINED, 501 DCB_CAP_ATTR_UNDEFINED,
@@ -273,12 +507,45 @@ enum dcbnl_cap_attrs {
273 DCB_CAP_ATTR_PFC_TCS, 507 DCB_CAP_ATTR_PFC_TCS,
274 DCB_CAP_ATTR_GSP, 508 DCB_CAP_ATTR_GSP,
275 DCB_CAP_ATTR_BCN, 509 DCB_CAP_ATTR_BCN,
510 DCB_CAP_ATTR_DCBX,
276 511
277 __DCB_CAP_ATTR_ENUM_MAX, 512 __DCB_CAP_ATTR_ENUM_MAX,
278 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1, 513 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
279}; 514};
280 515
281/** 516/**
517 * DCBX capability flags
518 *
519 * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent.
520 * 'set' routines are used to configure the device with
521 * the negotiated parameters
522 *
523 * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but
524 * by another entity
525 * 'get' routines are used to retrieve the
526 * negotiated parameters
527 * 'set' routines can be used to set the initial
528 * negotiation configuration
529 *
530 * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine
531 * supports the CEE protocol flavor
532 *
533 * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine
534 * supports the IEEE protocol flavor
535 *
536 * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine
537 * supports static configuration (i.e no actual
538 * negotiation is performed negotiated parameters equal
539 * the initial configuration)
540 *
541 */
542#define DCB_CAP_DCBX_HOST 0x01
543#define DCB_CAP_DCBX_LLD_MANAGED 0x02
544#define DCB_CAP_DCBX_VER_CEE 0x04
545#define DCB_CAP_DCBX_VER_IEEE 0x08
546#define DCB_CAP_DCBX_STATIC 0x10
547
548/**
282 * enum dcbnl_numtcs_attrs - number of traffic classes 549 * enum dcbnl_numtcs_attrs - number of traffic classes
283 * 550 *
284 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors 551 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
@@ -355,4 +622,30 @@ enum dcbnl_app_attrs {
355 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1, 622 DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
356}; 623};
357 624
625/**
626 * enum dcbnl_featcfg_attrs - features conifiguration flags
627 *
628 * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors
629 * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes
630 * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups
631 * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority
632 * flow control
633 * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV
634 *
635 */
636#define DCB_FEATCFG_ERROR 0x01 /* error in feature resolution */
637#define DCB_FEATCFG_ENABLE 0x02 /* enable feature */
638#define DCB_FEATCFG_WILLING 0x04 /* feature is willing */
639#define DCB_FEATCFG_ADVERTISE 0x08 /* advertise feature */
640enum dcbnl_featcfg_attrs {
641 DCB_FEATCFG_ATTR_UNDEFINED,
642 DCB_FEATCFG_ATTR_ALL,
643 DCB_FEATCFG_ATTR_PG,
644 DCB_FEATCFG_ATTR_PFC,
645 DCB_FEATCFG_ATTR_APP,
646
647 __DCB_FEATCFG_ATTR_ENUM_MAX,
648 DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1,
649};
650
358#endif /* __LINUX_DCBNL_H__ */ 651#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 7187bd8a75f6..d638e85dc501 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -197,6 +197,21 @@ enum dccp_feature_numbers {
197 DCCPF_MAX_CCID_SPECIFIC = 255, 197 DCCPF_MAX_CCID_SPECIFIC = 255,
198}; 198};
199 199
200/* DCCP socket control message types for cmsg */
201enum dccp_cmsg_type {
202 DCCP_SCM_PRIORITY = 1,
203 DCCP_SCM_QPOLICY_MAX = 0xFFFF,
204 /* ^-- Up to here reserved exclusively for qpolicy parameters */
205 DCCP_SCM_MAX
206};
207
208/* DCCP priorities for outgoing/queued packets */
209enum dccp_packet_dequeueing_policy {
210 DCCPQ_POLICY_SIMPLE,
211 DCCPQ_POLICY_PRIO,
212 DCCPQ_POLICY_MAX
213};
214
200/* DCCP socket options */ 215/* DCCP socket options */
201#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ 216#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
202#define DCCP_SOCKOPT_SERVICE 2 217#define DCCP_SOCKOPT_SERVICE 2
@@ -210,6 +225,8 @@ enum dccp_feature_numbers {
210#define DCCP_SOCKOPT_CCID 13 225#define DCCP_SOCKOPT_CCID 13
211#define DCCP_SOCKOPT_TX_CCID 14 226#define DCCP_SOCKOPT_TX_CCID 14
212#define DCCP_SOCKOPT_RX_CCID 15 227#define DCCP_SOCKOPT_RX_CCID 15
228#define DCCP_SOCKOPT_QPOLICY_ID 16
229#define DCCP_SOCKOPT_QPOLICY_TXQLEN 17
213#define DCCP_SOCKOPT_CCID_RX_INFO 128 230#define DCCP_SOCKOPT_CCID_RX_INFO 128
214#define DCCP_SOCKOPT_CCID_TX_INFO 192 231#define DCCP_SOCKOPT_CCID_TX_INFO 192
215 232
@@ -262,8 +279,6 @@ enum dccp_state {
262 DCCP_MAX_STATES 279 DCCP_MAX_STATES
263}; 280};
264 281
265#define DCCP_STATE_MASK 0x1f
266
267enum { 282enum {
268 DCCPF_OPEN = TCPF_ESTABLISHED, 283 DCCPF_OPEN = TCPF_ESTABLISHED,
269 DCCPF_REQUESTING = TCPF_SYN_SENT, 284 DCCPF_REQUESTING = TCPF_SYN_SENT,
@@ -458,11 +473,15 @@ struct dccp_ackvec;
458 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 473 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
459 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) 474 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
460 * @dccps_options_received - parsed set of retrieved options 475 * @dccps_options_received - parsed set of retrieved options
476 * @dccps_qpolicy - TX dequeueing policy, one of %dccp_packet_dequeueing_policy
477 * @dccps_tx_qlen - maximum length of the TX queue
461 * @dccps_role - role of this sock, one of %dccp_role 478 * @dccps_role - role of this sock, one of %dccp_role
462 * @dccps_hc_rx_insert_options - receiver wants to add options when acking 479 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
463 * @dccps_hc_tx_insert_options - sender wants to add options when sending 480 * @dccps_hc_tx_insert_options - sender wants to add options when sending
464 * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3) 481 * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3)
465 * @dccps_xmit_timer - timer for when CCID is not ready to send 482 * @dccps_sync_scheduled - flag which signals "send out-of-band message soon"
483 * @dccps_xmitlet - tasklet scheduled by the TX CCID to dequeue data packets
484 * @dccps_xmit_timer - used by the TX CCID to delay sending (rate-based pacing)
466 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) 485 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
467 */ 486 */
468struct dccp_sock { 487struct dccp_sock {
@@ -498,10 +517,14 @@ struct dccp_sock {
498 struct ccid *dccps_hc_rx_ccid; 517 struct ccid *dccps_hc_rx_ccid;
499 struct ccid *dccps_hc_tx_ccid; 518 struct ccid *dccps_hc_tx_ccid;
500 struct dccp_options_received dccps_options_received; 519 struct dccp_options_received dccps_options_received;
520 __u8 dccps_qpolicy;
521 __u32 dccps_tx_qlen;
501 enum dccp_role dccps_role:2; 522 enum dccp_role dccps_role:2;
502 __u8 dccps_hc_rx_insert_options:1; 523 __u8 dccps_hc_rx_insert_options:1;
503 __u8 dccps_hc_tx_insert_options:1; 524 __u8 dccps_hc_tx_insert_options:1;
504 __u8 dccps_server_timewait:1; 525 __u8 dccps_server_timewait:1;
526 __u8 dccps_sync_scheduled:1;
527 struct tasklet_struct dccps_xmitlet;
505 struct timer_list dccps_xmit_timer; 528 struct timer_list dccps_xmit_timer;
506}; 529};
507 530
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index 24c806f12a6c..5ac3bdd5cee6 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -13,10 +13,10 @@
13#ifdef CONFIG_PROFILING 13#ifdef CONFIG_PROFILING
14 14
15#include <linux/dcache.h> 15#include <linux/dcache.h>
16#include <linux/path.h>
17#include <linux/types.h> 16#include <linux/types.h>
18 17
19struct dcookie_user; 18struct dcookie_user;
19struct path;
20 20
21/** 21/**
22 * dcookie_register - register a user of dcookies 22 * dcookie_register - register a user of dcookies
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 597692f1fc8d..65970b811e22 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -34,7 +34,10 @@ struct debug_obj {
34 34
35/** 35/**
36 * struct debug_obj_descr - object type specific debug description structure 36 * struct debug_obj_descr - object type specific debug description structure
37 *
37 * @name: name of the object typee 38 * @name: name of the object typee
39 * @debug_hint: function returning address, which have associated
40 * kernel symbol, to allow identify the object
38 * @fixup_init: fixup function, which is called when the init check 41 * @fixup_init: fixup function, which is called when the init check
39 * fails 42 * fails
40 * @fixup_activate: fixup function, which is called when the activate check 43 * @fixup_activate: fixup function, which is called when the activate check
@@ -46,7 +49,7 @@ struct debug_obj {
46 */ 49 */
47struct debug_obj_descr { 50struct debug_obj_descr {
48 const char *name; 51 const char *name;
49 52 void *(*debug_hint) (void *addr);
50 int (*fixup_init) (void *addr, enum debug_obj_state state); 53 int (*fixup_init) (void *addr, enum debug_obj_state state);
51 int (*fixup_activate) (void *addr, enum debug_obj_state state); 54 int (*fixup_activate) (void *addr, enum debug_obj_state state);
52 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 55 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index f9b06ccc3e5c..8c0aef1ba5f5 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,9 +1,6 @@
1#ifndef INFLATE_H 1#ifndef INFLATE_H
2#define INFLATE_H 2#define INFLATE_H
3 3
4/* Other housekeeping constants */
5#define INBUFSIZ 4096
6
7int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, int len,
8 int(*fill)(void*, unsigned int), 5 int(*fill)(void*, unsigned int),
9 int(*flush)(void*, unsigned int), 6 int(*flush)(void*, unsigned int),
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index ad5ec1d0475e..7925bf0ee836 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -16,7 +16,7 @@
16 16
17/* 17/*
18 * Some architectures want to ensure there is no local data in their 18 * Some architectures want to ensure there is no local data in their
19 * pre-boot environment, so that data can arbitarily relocated (via 19 * pre-boot environment, so that data can arbitrarily relocated (via
20 * GOT references). This is achieved by defining STATIC_RW_DATA to 20 * GOT references). This is achieved by defining STATIC_RW_DATA to
21 * be null. 21 * be null.
22 */ 22 */
@@ -61,8 +61,6 @@ static void free(void *where)
61#define large_malloc(a) malloc(a) 61#define large_malloc(a) malloc(a)
62#define large_free(a) free(a) 62#define large_free(a) free(a)
63 63
64#define set_error_fn(x)
65
66#define INIT 64#define INIT
67 65
68#else /* STATIC */ 66#else /* STATIC */
@@ -72,6 +70,7 @@ static void free(void *where)
72#include <linux/kernel.h> 70#include <linux/kernel.h>
73#include <linux/fs.h> 71#include <linux/fs.h>
74#include <linux/string.h> 72#include <linux/string.h>
73#include <linux/slab.h>
75#include <linux/vmalloc.h> 74#include <linux/vmalloc.h>
76 75
77/* Use defines rather than static inline in order to avoid spurious 76/* Use defines rather than static inline in order to avoid spurious
@@ -84,9 +83,6 @@ static void free(void *where)
84#define large_malloc(a) vmalloc(a) 83#define large_malloc(a) vmalloc(a)
85#define large_free(a) vfree(a) 84#define large_free(a) vfree(a)
86 85
87static void(*error)(char *m);
88#define set_error_fn(x) error = x;
89
90#define INIT __init 86#define INIT __init
91#define STATIC 87#define STATIC
92 88
diff --git a/include/linux/decompress/unxz.h b/include/linux/decompress/unxz.h
new file mode 100644
index 000000000000..41728fc6c8a1
--- /dev/null
+++ b/include/linux/decompress/unxz.h
@@ -0,0 +1,19 @@
1/*
2 * Wrapper for decompressing XZ-compressed kernel, initramfs, and initrd
3 *
4 * Author: Lasse Collin <lasse.collin@tukaani.org>
5 *
6 * This file has been put into the public domain.
7 * You can do whatever you want with this file.
8 */
9
10#ifndef DECOMPRESS_UNXZ_H
11#define DECOMPRESS_UNXZ_H
12
13int unxz(unsigned char *in, int in_size,
14 int (*fill)(void *dest, unsigned int size),
15 int (*flush)(void *src, unsigned int size),
16 unsigned char *out, int *in_used,
17 void (*error)(char *x));
18
19#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 2970022faa63..32a4423710f5 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -193,6 +193,12 @@ struct dm_target {
193 char *error; 193 char *error;
194}; 194};
195 195
196/* Each target can link one of these into the table */
197struct dm_target_callbacks {
198 struct list_head list;
199 int (*congested_fn) (struct dm_target_callbacks *, int);
200};
201
196int dm_register_target(struct target_type *t); 202int dm_register_target(struct target_type *t);
197void dm_unregister_target(struct target_type *t); 203void dm_unregister_target(struct target_type *t);
198 204
@@ -269,14 +275,14 @@ int dm_table_add_target(struct dm_table *t, const char *type,
269 sector_t start, sector_t len, char *params); 275 sector_t start, sector_t len, char *params);
270 276
271/* 277/*
272 * Finally call this to make the table ready for use. 278 * Target_ctr should call this if it needs to add any callbacks.
273 */ 279 */
274int dm_table_complete(struct dm_table *t); 280void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callbacks *cb);
275 281
276/* 282/*
277 * Unplug all devices in a table. 283 * Finally call this to make the table ready for use.
278 */ 284 */
279void dm_table_unplug_all(struct dm_table *t); 285int dm_table_complete(struct dm_table *t);
280 286
281/* 287/*
282 * Table reference counting. 288 * Table reference counting.
diff --git a/include/linux/device.h b/include/linux/device.h
index dd4895313468..c66111affca9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -30,9 +30,8 @@ struct device_private;
30struct device_driver; 30struct device_driver;
31struct driver_private; 31struct driver_private;
32struct class; 32struct class;
33struct class_private; 33struct subsys_private;
34struct bus_type; 34struct bus_type;
35struct bus_type_private;
36struct device_node; 35struct device_node;
37 36
38struct bus_attribute { 37struct bus_attribute {
@@ -48,6 +47,38 @@ extern int __must_check bus_create_file(struct bus_type *,
48 struct bus_attribute *); 47 struct bus_attribute *);
49extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 48extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
50 49
50/**
51 * struct bus_type - The bus type of the device
52 *
53 * @name: The name of the bus.
54 * @bus_attrs: Default attributes of the bus.
55 * @dev_attrs: Default attributes of the devices on the bus.
56 * @drv_attrs: Default attributes of the device drivers on the bus.
57 * @match: Called, perhaps multiple times, whenever a new device or driver
58 * is added for this bus. It should return a nonzero value if the
59 * given device can be handled by the given driver.
60 * @uevent: Called when a device is added, removed, or a few other things
61 * that generate uevents to add the environment variables.
62 * @probe: Called when a new device or driver add to this bus, and callback
63 * the specific driver's probe to initial the matched device.
64 * @remove: Called when a device removed from this bus.
65 * @shutdown: Called at shut-down time to quiesce the device.
66 * @suspend: Called when a device on this bus wants to go to sleep mode.
67 * @resume: Called to bring a device on this bus out of sleep mode.
68 * @pm: Power management operations of this bus, callback the specific
69 * device driver's pm-ops.
70 * @p: The private data of the driver core, only the driver core can
71 * touch this.
72 *
73 * A bus is a channel between the processor and one or more devices. For the
74 * purposes of the device model, all devices are connected via a bus, even if
75 * it is an internal, virtual, "platform" bus. Buses can plug into each other.
76 * A USB controller is usually a PCI device, for example. The device model
77 * represents the actual connections between buses and the devices they control.
78 * A bus is represented by the bus_type structure. It contains the name, the
79 * default attributes, the bus' methods, PM operations, and the driver core's
80 * private data.
81 */
51struct bus_type { 82struct bus_type {
52 const char *name; 83 const char *name;
53 struct bus_attribute *bus_attrs; 84 struct bus_attribute *bus_attrs;
@@ -65,7 +96,7 @@ struct bus_type {
65 96
66 const struct dev_pm_ops *pm; 97 const struct dev_pm_ops *pm;
67 98
68 struct bus_type_private *p; 99 struct subsys_private *p;
69}; 100};
70 101
71extern int __must_check bus_register(struct bus_type *bus); 102extern int __must_check bus_register(struct bus_type *bus);
@@ -120,6 +151,37 @@ extern int bus_unregister_notifier(struct bus_type *bus,
120extern struct kset *bus_get_kset(struct bus_type *bus); 151extern struct kset *bus_get_kset(struct bus_type *bus);
121extern struct klist *bus_get_device_klist(struct bus_type *bus); 152extern struct klist *bus_get_device_klist(struct bus_type *bus);
122 153
154/**
155 * struct device_driver - The basic device driver structure
156 * @name: Name of the device driver.
157 * @bus: The bus which the device of this driver belongs to.
158 * @owner: The module owner.
159 * @mod_name: Used for built-in modules.
160 * @suppress_bind_attrs: Disables bind/unbind via sysfs.
161 * @of_match_table: The open firmware table.
162 * @probe: Called to query the existence of a specific device,
163 * whether this driver can work with it, and bind the driver
164 * to a specific device.
165 * @remove: Called when the device is removed from the system to
166 * unbind a device from this driver.
167 * @shutdown: Called at shut-down time to quiesce the device.
168 * @suspend: Called to put the device to sleep mode. Usually to a
169 * low power state.
170 * @resume: Called to bring a device from sleep mode.
171 * @groups: Default attributes that get created by the driver core
172 * automatically.
173 * @pm: Power management operations of the device which matched
174 * this driver.
175 * @p: Driver core's private data, no one other than the driver
176 * core can touch this.
177 *
178 * The device driver-model tracks all of the drivers known to the system.
179 * The main reason for this tracking is to enable the driver core to match
180 * up drivers with new devices. Once drivers are known objects within the
181 * system, however, a number of other things become possible. Device drivers
182 * can export information and configuration variables that are independent
183 * of any specific device.
184 */
123struct device_driver { 185struct device_driver {
124 const char *name; 186 const char *name;
125 struct bus_type *bus; 187 struct bus_type *bus;
@@ -129,9 +191,7 @@ struct device_driver {
129 191
130 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 192 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
131 193
132#if defined(CONFIG_OF)
133 const struct of_device_id *of_match_table; 194 const struct of_device_id *of_match_table;
134#endif
135 195
136 int (*probe) (struct device *dev); 196 int (*probe) (struct device *dev);
137 int (*remove) (struct device *dev); 197 int (*remove) (struct device *dev);
@@ -188,8 +248,34 @@ struct device *driver_find_device(struct device_driver *drv,
188 struct device *start, void *data, 248 struct device *start, void *data,
189 int (*match)(struct device *dev, void *data)); 249 int (*match)(struct device *dev, void *data));
190 250
191/* 251/**
192 * device classes 252 * struct class - device classes
253 * @name: Name of the class.
254 * @owner: The module owner.
255 * @class_attrs: Default attributes of this class.
256 * @dev_attrs: Default attributes of the devices belong to the class.
257 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
258 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
259 * @dev_uevent: Called when a device is added, removed from this class, or a
260 * few other things that generate uevents to add the environment
261 * variables.
262 * @devnode: Callback to provide the devtmpfs.
263 * @class_release: Called to release this class.
264 * @dev_release: Called to release the device.
265 * @suspend: Used to put the device to sleep mode, usually to a low power
266 * state.
267 * @resume: Used to bring the device from the sleep mode.
268 * @ns_type: Callbacks so sysfs can detemine namespaces.
269 * @namespace: Namespace of the device belongs to this class.
270 * @pm: The default device power management operations of this class.
271 * @p: The private data of the driver core, no one other than the
272 * driver core can touch this.
273 *
274 * A class is a higher-level view of a device that abstracts out low-level
275 * implementation details. Drivers may see a SCSI disk or an ATA disk, but,
276 * at the class level, they are all simply disks. Classes allow user space
277 * to work with devices based on what they do, rather than how they are
278 * connected or how they work.
193 */ 279 */
194struct class { 280struct class {
195 const char *name; 281 const char *name;
@@ -197,6 +283,7 @@ struct class {
197 283
198 struct class_attribute *class_attrs; 284 struct class_attribute *class_attrs;
199 struct device_attribute *dev_attrs; 285 struct device_attribute *dev_attrs;
286 struct bin_attribute *dev_bin_attrs;
200 struct kobject *dev_kobj; 287 struct kobject *dev_kobj;
201 288
202 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 289 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -213,7 +300,7 @@ struct class {
213 300
214 const struct dev_pm_ops *pm; 301 const struct dev_pm_ops *pm;
215 302
216 struct class_private *p; 303 struct subsys_private *p;
217}; 304};
218 305
219struct class_dev_iter { 306struct class_dev_iter {
@@ -403,6 +490,65 @@ struct device_dma_parameters {
403 unsigned long segment_boundary_mask; 490 unsigned long segment_boundary_mask;
404}; 491};
405 492
493/**
494 * struct device - The basic device structure
495 * @parent: The device's "parent" device, the device to which it is attached.
496 * In most cases, a parent device is some sort of bus or host
497 * controller. If parent is NULL, the device, is a top-level device,
498 * which is not usually what you want.
499 * @p: Holds the private data of the driver core portions of the device.
500 * See the comment of the struct device_private for detail.
501 * @kobj: A top-level, abstract class from which other classes are derived.
502 * @init_name: Initial name of the device.
503 * @type: The type of device.
504 * This identifies the device type and carries type-specific
505 * information.
506 * @mutex: Mutex to synchronize calls to its driver.
507 * @bus: Type of bus device is on.
508 * @driver: Which driver has allocated this
509 * @platform_data: Platform data specific to the device.
510 * Example: For devices on custom boards, as typical of embedded
511 * and SOC based hardware, Linux often uses platform_data to point
512 * to board-specific structures describing devices and how they
513 * are wired. That can include what ports are available, chip
514 * variants, which GPIO pins act in what additional roles, and so
515 * on. This shrinks the "Board Support Packages" (BSPs) and
516 * minimizes board-specific #ifdefs in drivers.
517 * @power: For device power management.
518 * See Documentation/power/devices.txt for details.
519 * @pwr_domain: Provide callbacks that are executed during system suspend,
520 * hibernation, system resume and during runtime PM transitions
521 * along with subsystem-level and driver-level callbacks.
522 * @numa_node: NUMA node this device is close to.
523 * @dma_mask: Dma mask (if dma'ble device).
524 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
525 * hardware supports 64-bit addresses for consistent allocations
526 * such descriptors.
527 * @dma_parms: A low level driver may set these to teach IOMMU code about
528 * segment limitations.
529 * @dma_pools: Dma pools (if dma'ble device).
530 * @dma_mem: Internal for coherent mem override.
531 * @archdata: For arch-specific additions.
532 * @of_node: Associated device tree node.
533 * @of_match: Matching of_device_id from driver.
534 * @devt: For creating the sysfs "dev".
535 * @devres_lock: Spinlock to protect the resource of the device.
536 * @devres_head: The resources list of the device.
537 * @knode_class: The node used to add the device to the class list.
538 * @class: The class of the device.
539 * @groups: Optional attribute groups.
540 * @release: Callback to free the device after all references have
541 * gone away. This should be set by the allocator of the
542 * device (i.e. the bus driver that discovered the device).
543 *
544 * At the lowest level, every device in a Linux system is represented by an
545 * instance of struct device. The device structure contains the information
546 * that the device model core needs to model the system. Most subsystems,
547 * however, track additional information about the devices they host. As a
548 * result, it is rare for devices to be represented by bare device structures;
549 * instead, that structure, like kobject structures, is usually embedded within
550 * a higher-level representation of the device.
551 */
406struct device { 552struct device {
407 struct device *parent; 553 struct device *parent;
408 554
@@ -410,7 +556,7 @@ struct device {
410 556
411 struct kobject kobj; 557 struct kobject kobj;
412 const char *init_name; /* initial name of the device */ 558 const char *init_name; /* initial name of the device */
413 struct device_type *type; 559 const struct device_type *type;
414 560
415 struct mutex mutex; /* mutex to synchronize calls to 561 struct mutex mutex; /* mutex to synchronize calls to
416 * its driver. 562 * its driver.
@@ -422,6 +568,7 @@ struct device {
422 void *platform_data; /* Platform specific data, device 568 void *platform_data; /* Platform specific data, device
423 core doesn't touch it */ 569 core doesn't touch it */
424 struct dev_pm_info power; 570 struct dev_pm_info power;
571 struct dev_power_domain *pwr_domain;
425 572
426#ifdef CONFIG_NUMA 573#ifdef CONFIG_NUMA
427 int numa_node; /* NUMA node this device is close to */ 574 int numa_node; /* NUMA node this device is close to */
@@ -441,9 +588,8 @@ struct device {
441 override */ 588 override */
442 /* arch specific additions */ 589 /* arch specific additions */
443 struct dev_archdata archdata; 590 struct dev_archdata archdata;
444#ifdef CONFIG_OF 591
445 struct device_node *of_node; 592 struct device_node *of_node; /* associated device tree node */
446#endif
447 593
448 dev_t devt; /* dev_t, creates the sysfs "dev" */ 594 dev_t devt; /* dev_t, creates the sysfs "dev" */
449 595
@@ -508,13 +654,13 @@ static inline int device_is_registered(struct device *dev)
508 654
509static inline void device_enable_async_suspend(struct device *dev) 655static inline void device_enable_async_suspend(struct device *dev)
510{ 656{
511 if (dev->power.status == DPM_ON) 657 if (!dev->power.in_suspend)
512 dev->power.async_suspend = true; 658 dev->power.async_suspend = true;
513} 659}
514 660
515static inline void device_disable_async_suspend(struct device *dev) 661static inline void device_disable_async_suspend(struct device *dev)
516{ 662{
517 if (dev->power.status == DPM_ON) 663 if (!dev->power.in_suspend)
518 dev->power.async_suspend = false; 664 dev->power.async_suspend = false;
519} 665}
520 666
@@ -558,7 +704,7 @@ extern int device_move(struct device *dev, struct device *new_parent,
558extern const char *device_get_devnode(struct device *dev, 704extern const char *device_get_devnode(struct device *dev,
559 mode_t *mode, const char **tmp); 705 mode_t *mode, const char **tmp);
560extern void *dev_get_drvdata(const struct device *dev); 706extern void *dev_get_drvdata(const struct device *dev);
561extern void dev_set_drvdata(struct device *dev, void *data); 707extern int dev_set_drvdata(struct device *dev, void *data);
562 708
563/* 709/*
564 * Root device objects for grouping under /sys/devices 710 * Root device objects for grouping under /sys/devices
@@ -612,7 +758,7 @@ extern int (*platform_notify)(struct device *dev);
612extern int (*platform_notify_remove)(struct device *dev); 758extern int (*platform_notify_remove)(struct device *dev);
613 759
614 760
615/** 761/*
616 * get_device - atomically increment the reference count for the device. 762 * get_device - atomically increment the reference count for the device.
617 * 763 *
618 */ 764 */
@@ -634,9 +780,6 @@ static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
634/* drivers/base/power/shutdown.c */ 780/* drivers/base/power/shutdown.c */
635extern void device_shutdown(void); 781extern void device_shutdown(void);
636 782
637/* drivers/base/sys.c */
638extern void sysdev_shutdown(void);
639
640/* debugging and troubleshooting/diagnostic helpers. */ 783/* debugging and troubleshooting/diagnostic helpers. */
641extern const char *dev_driver_string(const struct device *dev); 784extern const char *dev_driver_string(const struct device *dev);
642 785
@@ -739,13 +882,17 @@ do { \
739#endif 882#endif
740 883
741/* 884/*
742 * dev_WARN() acts like dev_printk(), but with the key difference 885 * dev_WARN*() acts like dev_printk(), but with the key difference
743 * of using a WARN/WARN_ON to get the message out, including the 886 * of using a WARN/WARN_ON to get the message out, including the
744 * file/line information and a backtrace. 887 * file/line information and a backtrace.
745 */ 888 */
746#define dev_WARN(dev, format, arg...) \ 889#define dev_WARN(dev, format, arg...) \
747 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); 890 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
748 891
892#define dev_WARN_ONCE(dev, condition, format, arg...) \
893 WARN_ONCE(condition, "Device %s\n" format, \
894 dev_driver_string(dev), ## arg)
895
749/* Create alias, so I can be autoloaded. */ 896/* Create alias, so I can be autoloaded. */
750#define MODULE_ALIAS_CHARDEV(major,minor) \ 897#define MODULE_ALIAS_CHARDEV(major,minor) \
751 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 898 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 49eab360d5d4..3708455ee6c3 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -44,7 +44,7 @@
44 * Remove a device, destroy any tables. 44 * Remove a device, destroy any tables.
45 * 45 *
46 * DM_DEV_RENAME: 46 * DM_DEV_RENAME:
47 * Rename a device. 47 * Rename a device or set its uuid if none was previously supplied.
48 * 48 *
49 * DM_SUSPEND: 49 * DM_SUSPEND:
50 * This performs both suspend and resume, depending which flag is 50 * This performs both suspend and resume, depending which flag is
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 18 270#define DM_VERSION_MINOR 20
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2010-06-29)" 272#define DM_VERSION_EXTRA "-ioctl (2011-02-02)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -322,4 +322,16 @@ enum {
322 */ 322 */
323#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */ 323#define DM_UEVENT_GENERATED_FLAG (1 << 13) /* Out */
324 324
325/*
326 * If set, rename changes the uuid not the name. Only permitted
327 * if no uuid was previously supplied: an existing uuid cannot be changed.
328 */
329#define DM_UUID_FLAG (1 << 14) /* In */
330
331/*
332 * If set, all buffers are wiped after use. Use when sending
333 * or requesting sensitive data such as an encryption key.
334 */
335#define DM_SECURE_DATA_FLAG (1 << 15) /* In */
336
325#endif /* _LINUX_DM_IOCTL_H */ 337#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h
index 0c3c3a2110c4..eeace7d3ff15 100644
--- a/include/linux/dm-log-userspace.h
+++ b/include/linux/dm-log-userspace.h
@@ -370,6 +370,16 @@
370#define DM_ULOG_REQUEST_TYPE(request_type) \ 370#define DM_ULOG_REQUEST_TYPE(request_type) \
371 (DM_ULOG_REQUEST_MASK & (request_type)) 371 (DM_ULOG_REQUEST_MASK & (request_type))
372 372
373/*
374 * DM_ULOG_REQUEST_VERSION is incremented when there is a
375 * change to the way information is passed between kernel
376 * and userspace. This could be a structure change of
377 * dm_ulog_request or a change in the way requests are
378 * issued/handled. Changes are outlined here:
379 * version 1: Initial implementation
380 */
381#define DM_ULOG_REQUEST_VERSION 1
382
373struct dm_ulog_request { 383struct dm_ulog_request {
374 /* 384 /*
375 * The local unique identifier (luid) and the universally unique 385 * The local unique identifier (luid) and the universally unique
@@ -383,8 +393,9 @@ struct dm_ulog_request {
383 */ 393 */
384 uint64_t luid; 394 uint64_t luid;
385 char uuid[DM_UUID_LEN]; 395 char uuid[DM_UUID_LEN];
386 char padding[7]; /* Padding because DM_UUID_LEN = 129 */ 396 char padding[3]; /* Padding because DM_UUID_LEN = 129 */
387 397
398 uint32_t version; /* See DM_ULOG_REQUEST_VERSION */
388 int32_t error; /* Used to report back processing errors */ 399 int32_t error; /* Used to report back processing errors */
389 400
390 uint32_t seq; /* Sequence number for request */ 401 uint32_t seq; /* Sequence number for request */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index e2106495cc11..eee7addec282 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -64,13 +64,15 @@ enum dma_transaction_type {
64 DMA_PQ_VAL, 64 DMA_PQ_VAL,
65 DMA_MEMSET, 65 DMA_MEMSET,
66 DMA_INTERRUPT, 66 DMA_INTERRUPT,
67 DMA_SG,
67 DMA_PRIVATE, 68 DMA_PRIVATE,
68 DMA_ASYNC_TX, 69 DMA_ASYNC_TX,
69 DMA_SLAVE, 70 DMA_SLAVE,
71 DMA_CYCLIC,
70}; 72};
71 73
72/* last transaction type for creation of the capabilities mask */ 74/* last transaction type for creation of the capabilities mask */
73#define DMA_TX_TYPE_END (DMA_SLAVE + 1) 75#define DMA_TX_TYPE_END (DMA_CYCLIC + 1)
74 76
75 77
76/** 78/**
@@ -119,12 +121,15 @@ enum dma_ctrl_flags {
119 * configuration data in statically from the platform). An additional 121 * configuration data in statically from the platform). An additional
120 * argument of struct dma_slave_config must be passed in with this 122 * argument of struct dma_slave_config must be passed in with this
121 * command. 123 * command.
124 * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller
125 * into external start mode.
122 */ 126 */
123enum dma_ctrl_cmd { 127enum dma_ctrl_cmd {
124 DMA_TERMINATE_ALL, 128 DMA_TERMINATE_ALL,
125 DMA_PAUSE, 129 DMA_PAUSE,
126 DMA_RESUME, 130 DMA_RESUME,
127 DMA_SLAVE_CONFIG, 131 DMA_SLAVE_CONFIG,
132 FSLDMA_EXTERNAL_START,
128}; 133};
129 134
130/** 135/**
@@ -316,14 +321,14 @@ struct dma_async_tx_descriptor {
316 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 321 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
317 dma_async_tx_callback callback; 322 dma_async_tx_callback callback;
318 void *callback_param; 323 void *callback_param;
319#ifndef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH 324#ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
320 struct dma_async_tx_descriptor *next; 325 struct dma_async_tx_descriptor *next;
321 struct dma_async_tx_descriptor *parent; 326 struct dma_async_tx_descriptor *parent;
322 spinlock_t lock; 327 spinlock_t lock;
323#endif 328#endif
324}; 329};
325 330
326#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH 331#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
327static inline void txd_lock(struct dma_async_tx_descriptor *txd) 332static inline void txd_lock(struct dma_async_tx_descriptor *txd)
328{ 333{
329} 334}
@@ -422,11 +427,14 @@ struct dma_tx_state {
422 * @device_prep_dma_memset: prepares a memset operation 427 * @device_prep_dma_memset: prepares a memset operation
423 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 428 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
424 * @device_prep_slave_sg: prepares a slave dma operation 429 * @device_prep_slave_sg: prepares a slave dma operation
430 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
431 * The function takes a buffer of size buf_len. The callback function will
432 * be called after period_len bytes have been transferred.
425 * @device_control: manipulate all pending operations on a channel, returns 433 * @device_control: manipulate all pending operations on a channel, returns
426 * zero or error code 434 * zero or error code
427 * @device_tx_status: poll for transaction completion, the optional 435 * @device_tx_status: poll for transaction completion, the optional
428 * txstate parameter can be supplied with a pointer to get a 436 * txstate parameter can be supplied with a pointer to get a
429 * struct with auxilary transfer status information, otherwise the call 437 * struct with auxiliary transfer status information, otherwise the call
430 * will just return a simple status code 438 * will just return a simple status code
431 * @device_issue_pending: push pending transactions to hardware 439 * @device_issue_pending: push pending transactions to hardware
432 */ 440 */
@@ -473,11 +481,19 @@ struct dma_device {
473 unsigned long flags); 481 unsigned long flags);
474 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)( 482 struct dma_async_tx_descriptor *(*device_prep_dma_interrupt)(
475 struct dma_chan *chan, unsigned long flags); 483 struct dma_chan *chan, unsigned long flags);
484 struct dma_async_tx_descriptor *(*device_prep_dma_sg)(
485 struct dma_chan *chan,
486 struct scatterlist *dst_sg, unsigned int dst_nents,
487 struct scatterlist *src_sg, unsigned int src_nents,
488 unsigned long flags);
476 489
477 struct dma_async_tx_descriptor *(*device_prep_slave_sg)( 490 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
478 struct dma_chan *chan, struct scatterlist *sgl, 491 struct dma_chan *chan, struct scatterlist *sgl,
479 unsigned int sg_len, enum dma_data_direction direction, 492 unsigned int sg_len, enum dma_data_direction direction,
480 unsigned long flags); 493 unsigned long flags);
494 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
495 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
496 size_t period_len, enum dma_data_direction direction);
481 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd, 497 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
482 unsigned long arg); 498 unsigned long arg);
483 499
@@ -487,6 +503,40 @@ struct dma_device {
487 void (*device_issue_pending)(struct dma_chan *chan); 503 void (*device_issue_pending)(struct dma_chan *chan);
488}; 504};
489 505
506static inline int dmaengine_device_control(struct dma_chan *chan,
507 enum dma_ctrl_cmd cmd,
508 unsigned long arg)
509{
510 return chan->device->device_control(chan, cmd, arg);
511}
512
513static inline int dmaengine_slave_config(struct dma_chan *chan,
514 struct dma_slave_config *config)
515{
516 return dmaengine_device_control(chan, DMA_SLAVE_CONFIG,
517 (unsigned long)config);
518}
519
520static inline int dmaengine_terminate_all(struct dma_chan *chan)
521{
522 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
523}
524
525static inline int dmaengine_pause(struct dma_chan *chan)
526{
527 return dmaengine_device_control(chan, DMA_PAUSE, 0);
528}
529
530static inline int dmaengine_resume(struct dma_chan *chan)
531{
532 return dmaengine_device_control(chan, DMA_RESUME, 0);
533}
534
535static inline dma_cookie_t dmaengine_submit(struct dma_async_tx_descriptor *desc)
536{
537 return desc->tx_submit(desc);
538}
539
490static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len) 540static inline bool dmaengine_check_align(u8 align, size_t off1, size_t off2, size_t len)
491{ 541{
492 size_t mask; 542 size_t mask;
@@ -606,11 +656,11 @@ static inline void net_dmaengine_put(void)
606#ifdef CONFIG_ASYNC_TX_DMA 656#ifdef CONFIG_ASYNC_TX_DMA
607#define async_dmaengine_get() dmaengine_get() 657#define async_dmaengine_get() dmaengine_get()
608#define async_dmaengine_put() dmaengine_put() 658#define async_dmaengine_put() dmaengine_put()
609#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH 659#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
610#define async_dma_find_channel(type) dma_find_channel(DMA_ASYNC_TX) 660#define async_dma_find_channel(type) dma_find_channel(DMA_ASYNC_TX)
611#else 661#else
612#define async_dma_find_channel(type) dma_find_channel(type) 662#define async_dma_find_channel(type) dma_find_channel(type)
613#endif /* CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH */ 663#endif /* CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH */
614#else 664#else
615static inline void async_dmaengine_get(void) 665static inline void async_dmaengine_get(void)
616{ 666{
@@ -774,6 +824,8 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
774#ifdef CONFIG_DMA_ENGINE 824#ifdef CONFIG_DMA_ENGINE
775enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 825enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
776void dma_issue_pending_all(void); 826void dma_issue_pending_all(void);
827struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
828void dma_release_channel(struct dma_chan *chan);
777#else 829#else
778static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 830static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
779{ 831{
@@ -781,7 +833,14 @@ static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descript
781} 833}
782static inline void dma_issue_pending_all(void) 834static inline void dma_issue_pending_all(void)
783{ 835{
784 do { } while (0); 836}
837static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask,
838 dma_filter_fn fn, void *fn_param)
839{
840 return NULL;
841}
842static inline void dma_release_channel(struct dma_chan *chan)
843{
785} 844}
786#endif 845#endif
787 846
@@ -792,8 +851,6 @@ void dma_async_device_unregister(struct dma_device *device);
792void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 851void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
793struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 852struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
794#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 853#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
795struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
796void dma_release_channel(struct dma_chan *chan);
797 854
798/* --- Helper iov-locking functions --- */ 855/* --- Helper iov-locking functions --- */
799 856
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index a7d9dc21391d..7b776d71d36d 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -175,10 +175,21 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
175 return 0; 175 return 0;
176} 176}
177 177
178#define enable_intr_remapping(mode) (-1)
179#define disable_intr_remapping() (0)
180#define reenable_intr_remapping(mode) (0)
181#define intr_remapping_enabled (0) 178#define intr_remapping_enabled (0)
179
180static inline int enable_intr_remapping(int eim)
181{
182 return -1;
183}
184
185static inline void disable_intr_remapping(void)
186{
187}
188
189static inline int reenable_intr_remapping(int eim)
190{
191 return 0;
192}
182#endif 193#endif
183 194
184/* Can't use the common MSI interrupt functions 195/* Can't use the common MSI interrupt functions
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 90e087f8d951..f156cca25ad0 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -23,6 +23,53 @@ enum dmi_device_type {
23 DMI_DEV_TYPE_DEV_ONBOARD = -3, 23 DMI_DEV_TYPE_DEV_ONBOARD = -3,
24}; 24};
25 25
26enum dmi_entry_type {
27 DMI_ENTRY_BIOS = 0,
28 DMI_ENTRY_SYSTEM,
29 DMI_ENTRY_BASEBOARD,
30 DMI_ENTRY_CHASSIS,
31 DMI_ENTRY_PROCESSOR,
32 DMI_ENTRY_MEM_CONTROLLER,
33 DMI_ENTRY_MEM_MODULE,
34 DMI_ENTRY_CACHE,
35 DMI_ENTRY_PORT_CONNECTOR,
36 DMI_ENTRY_SYSTEM_SLOT,
37 DMI_ENTRY_ONBOARD_DEVICE,
38 DMI_ENTRY_OEMSTRINGS,
39 DMI_ENTRY_SYSCONF,
40 DMI_ENTRY_BIOS_LANG,
41 DMI_ENTRY_GROUP_ASSOC,
42 DMI_ENTRY_SYSTEM_EVENT_LOG,
43 DMI_ENTRY_PHYS_MEM_ARRAY,
44 DMI_ENTRY_MEM_DEVICE,
45 DMI_ENTRY_32_MEM_ERROR,
46 DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
47 DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
48 DMI_ENTRY_BUILTIN_POINTING_DEV,
49 DMI_ENTRY_PORTABLE_BATTERY,
50 DMI_ENTRY_SYSTEM_RESET,
51 DMI_ENTRY_HW_SECURITY,
52 DMI_ENTRY_SYSTEM_POWER_CONTROLS,
53 DMI_ENTRY_VOLTAGE_PROBE,
54 DMI_ENTRY_COOLING_DEV,
55 DMI_ENTRY_TEMP_PROBE,
56 DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
57 DMI_ENTRY_OOB_REMOTE_ACCESS,
58 DMI_ENTRY_BIS_ENTRY,
59 DMI_ENTRY_SYSTEM_BOOT,
60 DMI_ENTRY_MGMT_DEV,
61 DMI_ENTRY_MGMT_DEV_COMPONENT,
62 DMI_ENTRY_MGMT_DEV_THRES,
63 DMI_ENTRY_MEM_CHANNEL,
64 DMI_ENTRY_IPMI_DEV,
65 DMI_ENTRY_SYS_POWER_SUPPLY,
66 DMI_ENTRY_ADDITIONAL,
67 DMI_ENTRY_ONBOARD_DEV_EXT,
68 DMI_ENTRY_MGMT_CONTROLLER_HOST,
69 DMI_ENTRY_INACTIVE = 126,
70 DMI_ENTRY_END_OF_TABLE = 127,
71};
72
26struct dmi_header { 73struct dmi_header {
27 u8 type; 74 u8 type;
28 u8 length; 75 u8 length;
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 9b2a0158f399..cec467f5d676 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -36,7 +36,7 @@
36#include <sys/wait.h> 36#include <sys/wait.h>
37#include <limits.h> 37#include <limits.h>
38 38
39/* Altough the Linux source code makes a difference between 39/* Although the Linux source code makes a difference between
40 generic endianness and the bitfields' endianness, there is no 40 generic endianness and the bitfields' endianness, there is no
41 architecture as of Linux-2.6.24-rc4 where the bitfileds' endianness 41 architecture as of Linux-2.6.24-rc4 where the bitfileds' endianness
42 does not match the generic endianness. */ 42 does not match the generic endianness. */
@@ -53,10 +53,10 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.9rc2" 56#define REL_VERSION "8.3.10"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 95 59#define PRO_VERSION_MAX 96
60 60
61 61
62enum drbd_io_error_p { 62enum drbd_io_error_p {
@@ -96,8 +96,14 @@ enum drbd_on_no_data {
96 OND_SUSPEND_IO 96 OND_SUSPEND_IO
97}; 97};
98 98
99enum drbd_on_congestion {
100 OC_BLOCK,
101 OC_PULL_AHEAD,
102 OC_DISCONNECT,
103};
104
99/* KEEP the order, do not delete or insert. Only append. */ 105/* KEEP the order, do not delete or insert. Only append. */
100enum drbd_ret_codes { 106enum drbd_ret_code {
101 ERR_CODE_BASE = 100, 107 ERR_CODE_BASE = 100,
102 NO_ERROR = 101, 108 NO_ERROR = 101,
103 ERR_LOCAL_ADDR = 102, 109 ERR_LOCAL_ADDR = 102,
@@ -146,6 +152,9 @@ enum drbd_ret_codes {
146 ERR_PERM = 152, 152 ERR_PERM = 152,
147 ERR_NEED_APV_93 = 153, 153 ERR_NEED_APV_93 = 153,
148 ERR_STONITH_AND_PROT_A = 154, 154 ERR_STONITH_AND_PROT_A = 154,
155 ERR_CONG_NOT_PROTO_A = 155,
156 ERR_PIC_AFTER_DEP = 156,
157 ERR_PIC_PEER_DEP = 157,
149 158
150 /* insert new ones above this line */ 159 /* insert new ones above this line */
151 AFTER_LAST_ERR_CODE 160 AFTER_LAST_ERR_CODE
@@ -175,7 +184,7 @@ enum drbd_conns {
175 /* These temporal states are all used on the way 184 /* These temporal states are all used on the way
176 * from >= C_CONNECTED to Unconnected. 185 * from >= C_CONNECTED to Unconnected.
177 * The 'disconnect reason' states 186 * The 'disconnect reason' states
178 * I do not allow to change beween them. */ 187 * I do not allow to change between them. */
179 C_TIMEOUT, 188 C_TIMEOUT,
180 C_BROKEN_PIPE, 189 C_BROKEN_PIPE,
181 C_NETWORK_FAILURE, 190 C_NETWORK_FAILURE,
@@ -199,6 +208,10 @@ enum drbd_conns {
199 C_VERIFY_T, 208 C_VERIFY_T,
200 C_PAUSED_SYNC_S, 209 C_PAUSED_SYNC_S,
201 C_PAUSED_SYNC_T, 210 C_PAUSED_SYNC_T,
211
212 C_AHEAD,
213 C_BEHIND,
214
202 C_MASK = 31 215 C_MASK = 31
203}; 216};
204 217
@@ -259,7 +272,7 @@ union drbd_state {
259 unsigned int i; 272 unsigned int i;
260}; 273};
261 274
262enum drbd_state_ret_codes { 275enum drbd_state_rv {
263 SS_CW_NO_NEED = 4, 276 SS_CW_NO_NEED = 4,
264 SS_CW_SUCCESS = 3, 277 SS_CW_SUCCESS = 3,
265 SS_NOTHING_TO_DO = 2, 278 SS_NOTHING_TO_DO = 2,
@@ -290,7 +303,7 @@ enum drbd_state_ret_codes {
290extern const char *drbd_conn_str(enum drbd_conns); 303extern const char *drbd_conn_str(enum drbd_conns);
291extern const char *drbd_role_str(enum drbd_role); 304extern const char *drbd_role_str(enum drbd_role);
292extern const char *drbd_disk_str(enum drbd_disk_state); 305extern const char *drbd_disk_str(enum drbd_disk_state);
293extern const char *drbd_set_st_err_str(enum drbd_state_ret_codes); 306extern const char *drbd_set_st_err_str(enum drbd_state_rv);
294 307
295#define SHARED_SECRET_MAX 64 308#define SHARED_SECRET_MAX 64
296 309
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 4ac33f34b77e..246f576c981d 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -16,7 +16,8 @@
16#define DEBUG_RANGE_CHECK 0 16#define DEBUG_RANGE_CHECK 0
17 17
18#define DRBD_MINOR_COUNT_MIN 1 18#define DRBD_MINOR_COUNT_MIN 1
19#define DRBD_MINOR_COUNT_MAX 255 19#define DRBD_MINOR_COUNT_MAX 256
20#define DRBD_MINOR_COUNT_DEF 32
20 21
21#define DRBD_DIALOG_REFRESH_MIN 0 22#define DRBD_DIALOG_REFRESH_MIN 0
22#define DRBD_DIALOG_REFRESH_MAX 600 23#define DRBD_DIALOG_REFRESH_MAX 600
@@ -42,7 +43,7 @@
42 43
43/* net { */ 44/* net { */
44 /* timeout, unit centi seconds 45 /* timeout, unit centi seconds
45 * more than one minute timeout is not usefull */ 46 * more than one minute timeout is not useful */
46#define DRBD_TIMEOUT_MIN 1 47#define DRBD_TIMEOUT_MIN 1
47#define DRBD_TIMEOUT_MAX 600 48#define DRBD_TIMEOUT_MAX 600
48#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */ 49#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */
@@ -67,7 +68,7 @@
67#define DRBD_MAX_EPOCH_SIZE_MAX 20000 68#define DRBD_MAX_EPOCH_SIZE_MAX 20000
68#define DRBD_MAX_EPOCH_SIZE_DEF 2048 69#define DRBD_MAX_EPOCH_SIZE_DEF 2048
69 70
70 /* I don't think that a tcp send buffer of more than 10M is usefull */ 71 /* I don't think that a tcp send buffer of more than 10M is useful */
71#define DRBD_SNDBUF_SIZE_MIN 0 72#define DRBD_SNDBUF_SIZE_MIN 0
72#define DRBD_SNDBUF_SIZE_MAX (10<<20) 73#define DRBD_SNDBUF_SIZE_MAX (10<<20)
73#define DRBD_SNDBUF_SIZE_DEF 0 74#define DRBD_SNDBUF_SIZE_DEF 0
@@ -100,7 +101,7 @@
100#define DRBD_RATE_MAX (4 << 20) 101#define DRBD_RATE_MAX (4 << 20)
101#define DRBD_RATE_DEF 250 /* kb/second */ 102#define DRBD_RATE_DEF 250 /* kb/second */
102 103
103 /* less than 7 would hit performance unneccessarily. 104 /* less than 7 would hit performance unnecessarily.
104 * 3833 is the largest prime that still does fit 105 * 3833 is the largest prime that still does fit
105 * into 64 sectors of activity log */ 106 * into 64 sectors of activity log */
106#define DRBD_AL_EXTENTS_MIN 7 107#define DRBD_AL_EXTENTS_MIN 7
@@ -129,6 +130,7 @@
129#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT 130#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT
130#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT 131#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
131#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR 132#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
133#define DRBD_ON_CONGESTION_DEF OC_BLOCK
132 134
133#define DRBD_MAX_BIO_BVECS_MIN 0 135#define DRBD_MAX_BIO_BVECS_MIN 0
134#define DRBD_MAX_BIO_BVECS_MAX 128 136#define DRBD_MAX_BIO_BVECS_MAX 128
@@ -154,5 +156,13 @@
154#define DRBD_C_MIN_RATE_MAX (4 << 20) 156#define DRBD_C_MIN_RATE_MAX (4 << 20)
155#define DRBD_C_MIN_RATE_DEF 4096 157#define DRBD_C_MIN_RATE_DEF 4096
156 158
159#define DRBD_CONG_FILL_MIN 0
160#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
161#define DRBD_CONG_FILL_DEF 0
162
163#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN
164#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX
165#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF
166
157#undef RANGE 167#undef RANGE
158#endif 168#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index ade91107c9a5..ab6159e4fcf0 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -56,6 +56,9 @@ NL_PACKET(net_conf, 5,
56 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict) 56 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict)
57 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo) 57 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo)
58 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size) 58 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size)
59 NL_INTEGER( 81, T_MAY_IGNORE, on_congestion)
60 NL_INTEGER( 82, T_MAY_IGNORE, cong_fill)
61 NL_INTEGER( 83, T_MAY_IGNORE, cong_extents)
59 /* 59 addr_family was available in GIT, never released */ 62 /* 59 addr_family was available in GIT, never released */
60 NL_BIT( 60, T_MANDATORY, mind_af) 63 NL_BIT( 60, T_MANDATORY, mind_af)
61 NL_BIT( 27, T_MAY_IGNORE, want_lose) 64 NL_BIT( 27, T_MAY_IGNORE, want_lose)
@@ -66,7 +69,9 @@ NL_PACKET(net_conf, 5,
66 NL_BIT( 70, T_MANDATORY, dry_run) 69 NL_BIT( 70, T_MANDATORY, dry_run)
67) 70)
68 71
69NL_PACKET(disconnect, 6, ) 72NL_PACKET(disconnect, 6,
73 NL_BIT( 84, T_MAY_IGNORE, force)
74)
70 75
71NL_PACKET(resize, 7, 76NL_PACKET(resize, 7,
72 NL_INT64( 29, T_MAY_IGNORE, resize_size) 77 NL_INT64( 29, T_MAY_IGNORE, resize_size)
@@ -143,9 +148,13 @@ NL_PACKET(new_c_uuid, 26,
143 NL_BIT( 63, T_MANDATORY, clear_bm) 148 NL_BIT( 63, T_MANDATORY, clear_bm)
144) 149)
145 150
151#ifdef NL_RESPONSE
152NL_RESPONSE(return_code_only, 27)
153#endif
154
146#undef NL_PACKET 155#undef NL_PACKET
147#undef NL_INTEGER 156#undef NL_INTEGER
148#undef NL_INT64 157#undef NL_INT64
149#undef NL_BIT 158#undef NL_BIT
150#undef NL_STRING 159#undef NL_STRING
151 160#undef NL_RESPONSE
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
index fcdff8410e99..f14a165e82dc 100644
--- a/include/linux/drbd_tag_magic.h
+++ b/include/linux/drbd_tag_magic.h
@@ -7,6 +7,7 @@
7/* declare packet_type enums */ 7/* declare packet_type enums */
8enum packet_types { 8enum packet_types {
9#define NL_PACKET(name, number, fields) P_ ## name = number, 9#define NL_PACKET(name, number, fields) P_ ## name = number,
10#define NL_RESPONSE(name, number) P_ ## name = number,
10#define NL_INTEGER(pn, pr, member) 11#define NL_INTEGER(pn, pr, member)
11#define NL_INT64(pn, pr, member) 12#define NL_INT64(pn, pr, member)
12#define NL_BIT(pn, pr, member) 13#define NL_BIT(pn, pr, member)
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index c8aad713a046..6998d9376ef9 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -16,9 +16,18 @@
16/** 16/**
17 * struct dw_dma_platform_data - Controller configuration parameters 17 * struct dw_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8) 18 * @nr_channels: Number of channels supported by hardware (max 8)
19 * @is_private: The device channels should be marked as private and not for
20 * by the general purpose DMA channel allocator.
19 */ 21 */
20struct dw_dma_platform_data { 22struct dw_dma_platform_data {
21 unsigned int nr_channels; 23 unsigned int nr_channels;
24 bool is_private;
25#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
26#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
27 unsigned char chan_allocation_order;
28#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
29#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
30 unsigned char chan_priority;
22}; 31};
23 32
24/** 33/**
@@ -33,6 +42,30 @@ enum dw_dma_slave_width {
33 DW_DMA_SLAVE_WIDTH_32BIT, 42 DW_DMA_SLAVE_WIDTH_32BIT,
34}; 43};
35 44
45/* bursts size */
46enum dw_dma_msize {
47 DW_DMA_MSIZE_1,
48 DW_DMA_MSIZE_4,
49 DW_DMA_MSIZE_8,
50 DW_DMA_MSIZE_16,
51 DW_DMA_MSIZE_32,
52 DW_DMA_MSIZE_64,
53 DW_DMA_MSIZE_128,
54 DW_DMA_MSIZE_256,
55};
56
57/* flow controller */
58enum dw_dma_fc {
59 DW_DMA_FC_D_M2M,
60 DW_DMA_FC_D_M2P,
61 DW_DMA_FC_D_P2M,
62 DW_DMA_FC_D_P2P,
63 DW_DMA_FC_P_P2M,
64 DW_DMA_FC_SP_P2P,
65 DW_DMA_FC_P_M2P,
66 DW_DMA_FC_DP_P2P,
67};
68
36/** 69/**
37 * struct dw_dma_slave - Controller-specific information about a slave 70 * struct dw_dma_slave - Controller-specific information about a slave
38 * 71 *
@@ -44,6 +77,11 @@ enum dw_dma_slave_width {
44 * @reg_width: peripheral register width 77 * @reg_width: peripheral register width
45 * @cfg_hi: Platform-specific initializer for the CFG_HI register 78 * @cfg_hi: Platform-specific initializer for the CFG_HI register
46 * @cfg_lo: Platform-specific initializer for the CFG_LO register 79 * @cfg_lo: Platform-specific initializer for the CFG_LO register
80 * @src_master: src master for transfers on allocated channel.
81 * @dst_master: dest master for transfers on allocated channel.
82 * @src_msize: src burst size.
83 * @dst_msize: dest burst size.
84 * @fc: flow controller for DMA transfer
47 */ 85 */
48struct dw_dma_slave { 86struct dw_dma_slave {
49 struct device *dma_dev; 87 struct device *dma_dev;
@@ -52,6 +90,11 @@ struct dw_dma_slave {
52 enum dw_dma_slave_width reg_width; 90 enum dw_dma_slave_width reg_width;
53 u32 cfg_hi; 91 u32 cfg_hi;
54 u32 cfg_lo; 92 u32 cfg_lo;
93 u8 src_master;
94 u8 dst_master;
95 u8 src_msize;
96 u8 dst_msize;
97 u8 fc;
55}; 98};
56 99
57/* Platform-configurable bits in CFG_HI */ 100/* Platform-configurable bits in CFG_HI */
@@ -62,7 +105,6 @@ struct dw_dma_slave {
62#define DWC_CFGH_DST_PER(x) ((x) << 11) 105#define DWC_CFGH_DST_PER(x) ((x) << 11)
63 106
64/* Platform-configurable bits in CFG_LO */ 107/* Platform-configurable bits in CFG_LO */
65#define DWC_CFGL_PRIO(x) ((x) << 5) /* priority */
66#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */ 108#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
67#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12) 109#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
68#define DWC_CFGL_LOCK_CH_XACT (2 << 12) 110#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index a90b3892074a..e747ecd48e1c 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -1,8 +1,6 @@
1#ifndef _DYNAMIC_DEBUG_H 1#ifndef _DYNAMIC_DEBUG_H
2#define _DYNAMIC_DEBUG_H 2#define _DYNAMIC_DEBUG_H
3 3
4#include <linux/jump_label.h>
5
6/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which 4/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
7 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They 5 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
8 * use independent hash functions, to reduce the chance of false positives. 6 * use independent hash functions, to reduce the chance of false positives.
@@ -31,6 +29,10 @@ struct _ddebug {
31 * writes commands to <debugfs>/dynamic_debug/control 29 * writes commands to <debugfs>/dynamic_debug/control
32 */ 30 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 31#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
32#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
33#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
34#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
35#define _DPRINTK_FLAGS_INCL_TID (1<<4)
34#define _DPRINTK_FLAGS_DEFAULT 0 36#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8; 37 unsigned int flags:8;
36 char enabled; 38 char enabled;
@@ -42,36 +44,28 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42 44
43#if defined(CONFIG_DYNAMIC_DEBUG) 45#if defined(CONFIG_DYNAMIC_DEBUG)
44extern int ddebug_remove_module(const char *mod_name); 46extern int ddebug_remove_module(const char *mod_name);
47extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
48 __attribute__ ((format (printf, 2, 3)));
45 49
46#define dynamic_pr_debug(fmt, ...) do { \ 50#define dynamic_pr_debug(fmt, ...) do { \
47 __label__ do_printk; \
48 __label__ out; \
49 static struct _ddebug descriptor \ 51 static struct _ddebug descriptor \
50 __used \ 52 __used \
51 __attribute__((section("__verbose"), aligned(8))) = \ 53 __attribute__((section("__verbose"), aligned(8))) = \
52 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 54 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
53 _DPRINTK_FLAGS_DEFAULT }; \ 55 _DPRINTK_FLAGS_DEFAULT }; \
54 JUMP_LABEL(&descriptor.enabled, do_printk); \ 56 if (unlikely(descriptor.enabled)) \
55 goto out; \ 57 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
56do_printk: \
57 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
58out: ; \
59 } while (0) 58 } while (0)
60 59
61 60
62#define dynamic_dev_dbg(dev, fmt, ...) do { \ 61#define dynamic_dev_dbg(dev, fmt, ...) do { \
63 __label__ do_printk; \
64 __label__ out; \
65 static struct _ddebug descriptor \ 62 static struct _ddebug descriptor \
66 __used \ 63 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \ 64 __attribute__((section("__verbose"), aligned(8))) = \
68 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 65 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
69 _DPRINTK_FLAGS_DEFAULT }; \ 66 _DPRINTK_FLAGS_DEFAULT }; \
70 JUMP_LABEL(&descriptor.enabled, do_printk); \ 67 if (unlikely(descriptor.enabled)) \
71 goto out; \ 68 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
72do_printk: \
73 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
74out: ; \
75 } while (0) 69 } while (0)
76 70
77#else 71#else
diff --git a/include/linux/efi.h b/include/linux/efi.h
index fb737bc19a8c..33fa1203024e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -397,4 +397,41 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
397 *addr &= PAGE_MASK; 397 *addr &= PAGE_MASK;
398} 398}
399 399
400#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
401/*
402 * EFI Variable support.
403 *
404 * Different firmware drivers can expose their EFI-like variables using
405 * the following.
406 */
407
408struct efivar_operations {
409 efi_get_variable_t *get_variable;
410 efi_get_next_variable_t *get_next_variable;
411 efi_set_variable_t *set_variable;
412};
413
414struct efivars {
415 /*
416 * ->lock protects two things:
417 * 1) ->list - adds, removals, reads, writes
418 * 2) ops.[gs]et_variable() calls.
419 * It must not be held when creating sysfs entries or calling kmalloc.
420 * ops.get_next_variable() is only called from register_efivars(),
421 * which is protected by the BKL, so that path is safe.
422 */
423 spinlock_t lock;
424 struct list_head list;
425 struct kset *kset;
426 struct bin_attribute *new_var, *del_var;
427 const struct efivar_operations *ops;
428};
429
430int register_efivars(struct efivars *efivars,
431 const struct efivar_operations *ops,
432 struct kobject *parent_kobj);
433void unregister_efivars(struct efivars *efivars);
434
435#endif /* CONFIG_EFI_VARS */
436
400#endif /* _LINUX_EFI_H */ 437#endif /* _LINUX_EFI_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 4fd978e7eb83..21a8ebf2dc3a 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -20,7 +20,6 @@ typedef void (elevator_bio_merged_fn) (struct request_queue *,
20typedef int (elevator_dispatch_fn) (struct request_queue *, int); 20typedef int (elevator_dispatch_fn) (struct request_queue *, int);
21 21
22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); 22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
23typedef int (elevator_queue_empty_fn) (struct request_queue *);
24typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *); 23typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
25typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *); 24typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
26typedef int (elevator_may_queue_fn) (struct request_queue *, int); 25typedef int (elevator_may_queue_fn) (struct request_queue *, int);
@@ -46,7 +45,6 @@ struct elevator_ops
46 elevator_activate_req_fn *elevator_activate_req_fn; 45 elevator_activate_req_fn *elevator_activate_req_fn;
47 elevator_deactivate_req_fn *elevator_deactivate_req_fn; 46 elevator_deactivate_req_fn *elevator_deactivate_req_fn;
48 47
49 elevator_queue_empty_fn *elevator_queue_empty_fn;
50 elevator_completed_req_fn *elevator_completed_req_fn; 48 elevator_completed_req_fn *elevator_completed_req_fn;
51 49
52 elevator_request_list_fn *elevator_former_req_fn; 50 elevator_request_list_fn *elevator_former_req_fn;
@@ -101,17 +99,16 @@ struct elevator_queue
101 */ 99 */
102extern void elv_dispatch_sort(struct request_queue *, struct request *); 100extern void elv_dispatch_sort(struct request_queue *, struct request *);
103extern void elv_dispatch_add_tail(struct request_queue *, struct request *); 101extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
104extern void elv_add_request(struct request_queue *, struct request *, int, int); 102extern void elv_add_request(struct request_queue *, struct request *, int);
105extern void __elv_add_request(struct request_queue *, struct request *, int, int); 103extern void __elv_add_request(struct request_queue *, struct request *, int);
106extern void elv_insert(struct request_queue *, struct request *, int);
107extern int elv_merge(struct request_queue *, struct request **, struct bio *); 104extern int elv_merge(struct request_queue *, struct request **, struct bio *);
105extern int elv_try_merge(struct request *, struct bio *);
108extern void elv_merge_requests(struct request_queue *, struct request *, 106extern void elv_merge_requests(struct request_queue *, struct request *,
109 struct request *); 107 struct request *);
110extern void elv_merged_request(struct request_queue *, struct request *, int); 108extern void elv_merged_request(struct request_queue *, struct request *, int);
111extern void elv_bio_merged(struct request_queue *q, struct request *, 109extern void elv_bio_merged(struct request_queue *q, struct request *,
112 struct bio *); 110 struct bio *);
113extern void elv_requeue_request(struct request_queue *, struct request *); 111extern void elv_requeue_request(struct request_queue *, struct request *);
114extern int elv_queue_empty(struct request_queue *);
115extern struct request *elv_former_request(struct request_queue *, struct request *); 112extern struct request *elv_former_request(struct request_queue *, struct request *);
116extern struct request *elv_latter_request(struct request_queue *, struct request *); 113extern struct request *elv_latter_request(struct request_queue *, struct request *);
117extern int elv_register_queue(struct request_queue *q); 114extern int elv_register_queue(struct request_queue *q);
@@ -167,6 +164,8 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t);
167#define ELEVATOR_INSERT_BACK 2 164#define ELEVATOR_INSERT_BACK 2
168#define ELEVATOR_INSERT_SORT 3 165#define ELEVATOR_INSERT_SORT 3
169#define ELEVATOR_INSERT_REQUEUE 4 166#define ELEVATOR_INSERT_REQUEUE 4
167#define ELEVATOR_INSERT_FLUSH 5
168#define ELEVATOR_INSERT_SORT_MERGE 6
170 169
171/* 170/*
172 * return values from elevator_may_queue_fn 171 * return values from elevator_may_queue_fn
@@ -195,15 +194,9 @@ enum {
195/* 194/*
196 * io context count accounting 195 * io context count accounting
197 */ 196 */
198#define elv_ioc_count_mod(name, __val) \ 197#define elv_ioc_count_mod(name, __val) this_cpu_add(name, __val)
199 do { \ 198#define elv_ioc_count_inc(name) this_cpu_inc(name)
200 preempt_disable(); \ 199#define elv_ioc_count_dec(name) this_cpu_dec(name)
201 __get_cpu_var(name) += (__val); \
202 preempt_enable(); \
203 } while (0)
204
205#define elv_ioc_count_inc(name) elv_ioc_count_mod(name, 1)
206#define elv_ioc_count_dec(name) elv_ioc_count_mod(name, -1)
207 200
208#define elv_ioc_count_read(name) \ 201#define elv_ioc_count_read(name) \
209({ \ 202({ \
diff --git a/include/linux/err.h b/include/linux/err.h
index 448afc12c78a..f2edce25a76b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,6 +52,14 @@ static inline void * __must_check ERR_CAST(const void *ptr)
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(const void *ptr)
56{
57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr);
59 else
60 return 0;
61}
62
55#endif 63#endif
56 64
57#endif /* _LINUX_ERR_H */ 65#endif /* _LINUX_ERR_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index f16a01081e15..ab68f785fd19 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -48,8 +48,10 @@ extern int eth_validate_addr(struct net_device *dev);
48 48
49 49
50 50
51extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 51extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
52 unsigned int rxqs);
52#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 53#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
54#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
53 55
54/** 56/**
55 * is_zero_ether_addr - Determine if give Ethernet address is all zeros. 57 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
@@ -97,6 +99,17 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
97} 99}
98 100
99/** 101/**
102 * is_unicast_ether_addr - Determine if the Ethernet address is unicast
103 * @addr: Pointer to a six-byte array containing the Ethernet address
104 *
105 * Return true if the address is a unicast address.
106 */
107static inline int is_unicast_ether_addr(const u8 *addr)
108{
109 return !is_multicast_ether_addr(addr);
110}
111
112/**
100 * is_valid_ether_addr - Determine if the given Ethernet address is valid 113 * is_valid_ether_addr - Determine if the given Ethernet address is valid
101 * @addr: Pointer to a six-byte array containing the Ethernet address 114 * @addr: Pointer to a six-byte array containing the Ethernet address
102 * 115 *
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 6628a507fd3b..c6a850ab2ec5 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -13,6 +13,9 @@
13#ifndef _LINUX_ETHTOOL_H 13#ifndef _LINUX_ETHTOOL_H
14#define _LINUX_ETHTOOL_H 14#define _LINUX_ETHTOOL_H
15 15
16#ifdef __KERNEL__
17#include <linux/compat.h>
18#endif
16#include <linux/types.h> 19#include <linux/types.h>
17#include <linux/if_ether.h> 20#include <linux/if_ether.h>
18 21
@@ -21,7 +24,10 @@ struct ethtool_cmd {
21 __u32 cmd; 24 __u32 cmd;
22 __u32 supported; /* Features this interface supports */ 25 __u32 supported; /* Features this interface supports */
23 __u32 advertising; /* Features this interface advertises */ 26 __u32 advertising; /* Features this interface advertises */
24 __u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ 27 __u16 speed; /* The forced speed (lower bits) in
28 * Mbps. Please use
29 * ethtool_cmd_speed()/_set() to
30 * access it */
25 __u8 duplex; /* Duplex, half or full */ 31 __u8 duplex; /* Duplex, half or full */
26 __u8 port; /* Which connector port */ 32 __u8 port; /* Which connector port */
27 __u8 phy_address; 33 __u8 phy_address;
@@ -30,7 +36,10 @@ struct ethtool_cmd {
30 __u8 mdio_support; 36 __u8 mdio_support;
31 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 37 __u32 maxtxpkt; /* Tx pkts before generating tx int */
32 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 38 __u32 maxrxpkt; /* Rx pkts before generating rx int */
33 __u16 speed_hi; 39 __u16 speed_hi; /* The forced speed (upper
40 * bits) in Mbps. Please use
41 * ethtool_cmd_speed()/_set() to
42 * access it */
34 __u8 eth_tp_mdix; 43 __u8 eth_tp_mdix;
35 __u8 reserved2; 44 __u8 reserved2;
36 __u32 lp_advertising; /* Features the link partner advertises */ 45 __u32 lp_advertising; /* Features the link partner advertises */
@@ -38,14 +47,14 @@ struct ethtool_cmd {
38}; 47};
39 48
40static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 49static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
41 __u32 speed) 50 __u32 speed)
42{ 51{
43 52
44 ep->speed = (__u16)speed; 53 ep->speed = (__u16)speed;
45 ep->speed_hi = (__u16)(speed >> 16); 54 ep->speed_hi = (__u16)(speed >> 16);
46} 55}
47 56
48static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) 57static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
49{ 58{
50 return (ep->speed_hi << 16) | ep->speed; 59 return (ep->speed_hi << 16) | ep->speed;
51} 60}
@@ -226,6 +235,34 @@ struct ethtool_ringparam {
226 __u32 tx_pending; 235 __u32 tx_pending;
227}; 236};
228 237
238/**
239 * struct ethtool_channels - configuring number of network channel
240 * @cmd: ETHTOOL_{G,S}CHANNELS
241 * @max_rx: Read only. Maximum number of receive channel the driver support.
242 * @max_tx: Read only. Maximum number of transmit channel the driver support.
243 * @max_other: Read only. Maximum number of other channel the driver support.
244 * @max_combined: Read only. Maximum number of combined channel the driver
245 * support. Set of queues RX, TX or other.
246 * @rx_count: Valid values are in the range 1 to the max_rx.
247 * @tx_count: Valid values are in the range 1 to the max_tx.
248 * @other_count: Valid values are in the range 1 to the max_other.
249 * @combined_count: Valid values are in the range 1 to the max_combined.
250 *
251 * This can be used to configure RX, TX and other channels.
252 */
253
254struct ethtool_channels {
255 __u32 cmd;
256 __u32 max_rx;
257 __u32 max_tx;
258 __u32 max_other;
259 __u32 max_combined;
260 __u32 rx_count;
261 __u32 tx_count;
262 __u32 other_count;
263 __u32 combined_count;
264};
265
229/* for configuring link flow control parameters */ 266/* for configuring link flow control parameters */
230struct ethtool_pauseparam { 267struct ethtool_pauseparam {
231 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ 268 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
@@ -251,6 +288,7 @@ enum ethtool_stringset {
251 ETH_SS_STATS, 288 ETH_SS_STATS,
252 ETH_SS_PRIV_FLAGS, 289 ETH_SS_PRIV_FLAGS,
253 ETH_SS_NTUPLE_FILTERS, 290 ETH_SS_NTUPLE_FILTERS,
291 ETH_SS_FEATURES,
254}; 292};
255 293
256/* for passing string sets for data tagging */ 294/* for passing string sets for data tagging */
@@ -376,27 +414,42 @@ struct ethtool_usrip4_spec {
376 __u8 proto; 414 __u8 proto;
377}; 415};
378 416
417union ethtool_flow_union {
418 struct ethtool_tcpip4_spec tcp_ip4_spec;
419 struct ethtool_tcpip4_spec udp_ip4_spec;
420 struct ethtool_tcpip4_spec sctp_ip4_spec;
421 struct ethtool_ah_espip4_spec ah_ip4_spec;
422 struct ethtool_ah_espip4_spec esp_ip4_spec;
423 struct ethtool_usrip4_spec usr_ip4_spec;
424 struct ethhdr ether_spec;
425 __u8 hdata[60];
426};
427
428struct ethtool_flow_ext {
429 __be16 vlan_etype;
430 __be16 vlan_tci;
431 __be32 data[2];
432};
433
379/** 434/**
380 * struct ethtool_rx_flow_spec - specification for RX flow filter 435 * struct ethtool_rx_flow_spec - specification for RX flow filter
381 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 436 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
382 * @h_u: Flow fields to match (dependent on @flow_type) 437 * @h_u: Flow fields to match (dependent on @flow_type)
383 * @m_u: Masks for flow field bits to be ignored 438 * @h_ext: Additional fields to match
439 * @m_u: Masks for flow field bits to be matched
440 * @m_ext: Masks for additional field bits to be matched
441 * Note, all additional fields must be ignored unless @flow_type
442 * includes the %FLOW_EXT flag.
384 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC 443 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
385 * if packets should be discarded 444 * if packets should be discarded
386 * @location: Index of filter in hardware table 445 * @location: Index of filter in hardware table
387 */ 446 */
388struct ethtool_rx_flow_spec { 447struct ethtool_rx_flow_spec {
389 __u32 flow_type; 448 __u32 flow_type;
390 union { 449 union ethtool_flow_union h_u;
391 struct ethtool_tcpip4_spec tcp_ip4_spec; 450 struct ethtool_flow_ext h_ext;
392 struct ethtool_tcpip4_spec udp_ip4_spec; 451 union ethtool_flow_union m_u;
393 struct ethtool_tcpip4_spec sctp_ip4_spec; 452 struct ethtool_flow_ext m_ext;
394 struct ethtool_ah_espip4_spec ah_ip4_spec;
395 struct ethtool_ah_espip4_spec esp_ip4_spec;
396 struct ethtool_usrip4_spec usr_ip4_spec;
397 struct ethhdr ether_spec;
398 __u8 hdata[72];
399 } h_u, m_u;
400 __u64 ring_cookie; 453 __u64 ring_cookie;
401 __u32 location; 454 __u32 location;
402}; 455};
@@ -449,6 +502,31 @@ struct ethtool_rxnfc {
449 __u32 rule_locs[0]; 502 __u32 rule_locs[0];
450}; 503};
451 504
505#ifdef __KERNEL__
506#ifdef CONFIG_COMPAT
507
508struct compat_ethtool_rx_flow_spec {
509 u32 flow_type;
510 union ethtool_flow_union h_u;
511 struct ethtool_flow_ext h_ext;
512 union ethtool_flow_union m_u;
513 struct ethtool_flow_ext m_ext;
514 compat_u64 ring_cookie;
515 u32 location;
516};
517
518struct compat_ethtool_rxnfc {
519 u32 cmd;
520 u32 flow_type;
521 compat_u64 data;
522 struct compat_ethtool_rx_flow_spec fs;
523 u32 rule_cnt;
524 u32 rule_locs[0];
525};
526
527#endif /* CONFIG_COMPAT */
528#endif /* __KERNEL__ */
529
452/** 530/**
453 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 531 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
454 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 532 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
@@ -523,10 +601,119 @@ struct ethtool_flash {
523 char data[ETHTOOL_FLASH_MAX_FILENAME]; 601 char data[ETHTOOL_FLASH_MAX_FILENAME];
524}; 602};
525 603
604/**
605 * struct ethtool_dump - used for retrieving, setting device dump
606 * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
607 * %ETHTOOL_SET_DUMP
608 * @version: FW version of the dump, filled in by driver
609 * @flag: driver dependent flag for dump setting, filled in by driver during
610 * get and filled in by ethtool for set operation
611 * @len: length of dump data, used as the length of the user buffer on entry to
612 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
613 * for %ETHTOOL_GET_DUMP_FLAG command
614 * @data: data collected for get dump data operation
615 */
616struct ethtool_dump {
617 __u32 cmd;
618 __u32 version;
619 __u32 flag;
620 __u32 len;
621 __u8 data[0];
622};
623
624/* for returning and changing feature sets */
625
626/**
627 * struct ethtool_get_features_block - block with state of 32 features
628 * @available: mask of changeable features
629 * @requested: mask of features requested to be enabled if possible
630 * @active: mask of currently enabled features
631 * @never_changed: mask of features not changeable for any device
632 */
633struct ethtool_get_features_block {
634 __u32 available;
635 __u32 requested;
636 __u32 active;
637 __u32 never_changed;
638};
639
640/**
641 * struct ethtool_gfeatures - command to get state of device's features
642 * @cmd: command number = %ETHTOOL_GFEATURES
643 * @size: in: number of elements in the features[] array;
644 * out: number of elements in features[] needed to hold all features
645 * @features: state of features
646 */
647struct ethtool_gfeatures {
648 __u32 cmd;
649 __u32 size;
650 struct ethtool_get_features_block features[0];
651};
652
653/**
654 * struct ethtool_set_features_block - block with request for 32 features
655 * @valid: mask of features to be changed
656 * @requested: values of features to be changed
657 */
658struct ethtool_set_features_block {
659 __u32 valid;
660 __u32 requested;
661};
662
663/**
664 * struct ethtool_sfeatures - command to request change in device's features
665 * @cmd: command number = %ETHTOOL_SFEATURES
666 * @size: array size of the features[] array
667 * @features: feature change masks
668 */
669struct ethtool_sfeatures {
670 __u32 cmd;
671 __u32 size;
672 struct ethtool_set_features_block features[0];
673};
674
675/*
676 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
677 * values of corresponding bits in features[].requested. Bits in .requested
678 * not set in .valid or not changeable are ignored.
679 *
680 * Returns %EINVAL when .valid contains undefined or never-changeable bits
681 * or size is not equal to required number of features words (32-bit blocks).
682 * Returns >= 0 if request was completed; bits set in the value mean:
683 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
684 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
685 * those bits were ignored.
686 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
687 * resulting state of bits masked by .valid is not equal to .requested.
688 * Probably there are other device-specific constraints on some features
689 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
690 * here as though ignored bits were cleared.
691 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
692 * compatibility functions. Requested offload state cannot be properly
693 * managed by kernel.
694 *
695 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
696 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
697 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
698 * significant bit in features[0] fields. Empty strings mark undefined features.
699 */
700enum ethtool_sfeatures_retval_bits {
701 ETHTOOL_F_UNSUPPORTED__BIT,
702 ETHTOOL_F_WISH__BIT,
703 ETHTOOL_F_COMPAT__BIT,
704};
705
706#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
707#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
708#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
709
526#ifdef __KERNEL__ 710#ifdef __KERNEL__
527 711
528#include <linux/rculist.h> 712#include <linux/rculist.h>
529 713
714/* needed by dev_disable_lro() */
715extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
716
530struct ethtool_rx_ntuple_flow_spec_container { 717struct ethtool_rx_ntuple_flow_spec_container {
531 struct ethtool_rx_ntuple_flow_spec fs; 718 struct ethtool_rx_ntuple_flow_spec fs;
532 struct list_head list; 719 struct list_head list;
@@ -539,11 +726,26 @@ struct ethtool_rx_ntuple_list {
539 unsigned int count; 726 unsigned int count;
540}; 727};
541 728
729/**
730 * enum ethtool_phys_id_state - indicator state for physical identification
731 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
732 * @ETHTOOL_ID_ACTIVE: Physical ID indicator should be activated
733 * @ETHTOOL_ID_ON: LED should be turned on (used iff %ETHTOOL_ID_ACTIVE
734 * is not supported)
735 * @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
736 * is not supported)
737 */
738enum ethtool_phys_id_state {
739 ETHTOOL_ID_INACTIVE,
740 ETHTOOL_ID_ACTIVE,
741 ETHTOOL_ID_ON,
742 ETHTOOL_ID_OFF
743};
744
542struct net_device; 745struct net_device;
543 746
544/* Some generic methods drivers may use in their ethtool_ops */ 747/* Some generic methods drivers may use in their ethtool_ops */
545u32 ethtool_op_get_link(struct net_device *dev); 748u32 ethtool_op_get_link(struct net_device *dev);
546u32 ethtool_op_get_rx_csum(struct net_device *dev);
547u32 ethtool_op_get_tx_csum(struct net_device *dev); 749u32 ethtool_op_get_tx_csum(struct net_device *dev);
548int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 750int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
549int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 751int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
@@ -557,65 +759,134 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
557u32 ethtool_op_get_flags(struct net_device *dev); 759u32 ethtool_op_get_flags(struct net_device *dev);
558int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 760int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
559void ethtool_ntuple_flush(struct net_device *dev); 761void ethtool_ntuple_flush(struct net_device *dev);
762bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
560 763
561/** 764/**
562 * &ethtool_ops - Alter and report network device settings 765 * struct ethtool_ops - optional netdev operations
563 * get_settings: Get device-specific settings 766 * @get_settings: Get various device settings including Ethernet link
564 * set_settings: Set device-specific settings 767 * settings. The @cmd parameter is expected to have been cleared
565 * get_drvinfo: Report driver information 768 * before get_settings is called. Returns a negative error code or
566 * get_regs: Get device registers 769 * zero.
567 * get_wol: Report whether Wake-on-Lan is enabled 770 * @set_settings: Set various device settings including Ethernet link
568 * set_wol: Turn Wake-on-Lan on or off 771 * settings. Returns a negative error code or zero.
569 * get_msglevel: Report driver message level 772 * @get_drvinfo: Report driver/device information. Should only set the
570 * set_msglevel: Set driver message level 773 * @driver, @version, @fw_version and @bus_info fields. If not
571 * nway_reset: Restart autonegotiation 774 * implemented, the @driver and @bus_info fields will be filled in
572 * get_link: Get link status 775 * according to the netdev's parent device.
573 * get_eeprom: Read data from the device EEPROM 776 * @get_regs_len: Get buffer length required for @get_regs
574 * set_eeprom: Write data to the device EEPROM 777 * @get_regs: Get device registers
575 * get_coalesce: Get interrupt coalescing parameters 778 * @get_wol: Report whether Wake-on-Lan is enabled
576 * set_coalesce: Set interrupt coalescing parameters 779 * @set_wol: Turn Wake-on-Lan on or off. Returns a negative error code
577 * get_ringparam: Report ring sizes 780 * or zero.
578 * set_ringparam: Set ring sizes 781 * @get_msglevel: Report driver message level. This should be the value
579 * get_pauseparam: Report pause parameters 782 * of the @msg_enable field used by netif logging functions.
580 * set_pauseparam: Set pause parameters 783 * @set_msglevel: Set driver message level
581 * get_rx_csum: Report whether receive checksums are turned on or off 784 * @nway_reset: Restart autonegotiation. Returns a negative error code
582 * set_rx_csum: Turn receive checksum on or off 785 * or zero.
583 * get_tx_csum: Report whether transmit checksums are turned on or off 786 * @get_link: Report whether physical link is up. Will only be called if
584 * set_tx_csum: Turn transmit checksums on or off 787 * the netdev is up. Should usually be set to ethtool_op_get_link(),
585 * get_sg: Report whether scatter-gather is enabled 788 * which uses netif_carrier_ok().
586 * set_sg: Turn scatter-gather on or off 789 * @get_eeprom: Read data from the device EEPROM.
587 * get_tso: Report whether TCP segmentation offload is enabled
588 * set_tso: Turn TCP segmentation offload on or off
589 * get_ufo: Report whether UDP fragmentation offload is enabled
590 * set_ufo: Turn UDP fragmentation offload on or off
591 * self_test: Run specified self-tests
592 * get_strings: Return a set of strings that describe the requested objects
593 * phys_id: Identify the device
594 * get_stats: Return statistics about the device
595 * get_flags: get 32-bit flags bitmap
596 * set_flags: set 32-bit flags bitmap
597 *
598 * Description:
599 *
600 * get_settings:
601 * @get_settings is passed an &ethtool_cmd to fill in. It returns
602 * an negative errno or zero.
603 *
604 * set_settings:
605 * @set_settings is passed an &ethtool_cmd and should attempt to set
606 * all the settings this device supports. It may return an error value
607 * if something goes wrong (otherwise 0).
608 *
609 * get_eeprom:
610 * Should fill in the magic field. Don't need to check len for zero 790 * Should fill in the magic field. Don't need to check len for zero
611 * or wraparound. Fill in the data argument with the eeprom values 791 * or wraparound. Fill in the data argument with the eeprom values
612 * from offset to offset + len. Update len to the amount read. 792 * from offset to offset + len. Update len to the amount read.
613 * Returns an error or zero. 793 * Returns an error or zero.
614 * 794 * @set_eeprom: Write data to the device EEPROM.
615 * set_eeprom:
616 * Should validate the magic field. Don't need to check len for zero 795 * Should validate the magic field. Don't need to check len for zero
617 * or wraparound. Update len to the amount written. Returns an error 796 * or wraparound. Update len to the amount written. Returns an error
618 * or zero. 797 * or zero.
798 * @get_coalesce: Get interrupt coalescing parameters. Returns a negative
799 * error code or zero.
800 * @set_coalesce: Set interrupt coalescing parameters. Returns a negative
801 * error code or zero.
802 * @get_ringparam: Report ring sizes
803 * @set_ringparam: Set ring sizes. Returns a negative error code or zero.
804 * @get_pauseparam: Report pause parameters
805 * @set_pauseparam: Set pause parameters. Returns a negative error code
806 * or zero.
807 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
808 * Report whether receive checksums are turned on or off.
809 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
810 * receive checksum on or off. Returns a negative error code or zero.
811 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
812 * are turned on or off.
813 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
814 * transmit checksums on or off. Returns a egative error code or zero.
815 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
816 * enabled.
817 * @set_sg: Deprecated in favour of generic netdev features. Turn
818 * scatter-gather on or off. Returns a negative error code or zero.
819 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
820 * offload is enabled.
821 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
822 * segmentation offload on or off. Returns a negative error code or zero.
823 * @self_test: Run specified self-tests
824 * @get_strings: Return a set of strings that describe the requested objects
825 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
826 * attached to it. The implementation may update the indicator
827 * asynchronously or synchronously, but in either case it must return
828 * quickly. It is initially called with the argument %ETHTOOL_ID_ACTIVE,
829 * and must either activate asynchronous updates and return zero, return
830 * a negative error or return a positive frequency for synchronous
831 * indication (e.g. 1 for one on/off cycle per second). If it returns
832 * a frequency then it will be called again at intervals with the
833 * argument %ETHTOOL_ID_ON or %ETHTOOL_ID_OFF and should set the state of
834 * the indicator accordingly. Finally, it is called with the argument
835 * %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
836 * negative error code or zero.
837 * @get_ethtool_stats: Return extended statistics about the device.
838 * This is only useful if the device maintains statistics not
839 * included in &struct rtnl_link_stats64.
840 * @begin: Function to be called before any other operation. Returns a
841 * negative error code or zero.
842 * @complete: Function to be called after any other operation except
843 * @begin. Will be called even if the other operation failed.
844 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
845 * offload is enabled.
846 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
847 * fragmentation offload on or off. Returns a negative error code or zero.
848 * @get_flags: Deprecated as redundant. Report features included in
849 * &enum ethtool_flags that are enabled.
850 * @set_flags: Deprecated in favour of generic netdev features. Turn
851 * features included in &enum ethtool_flags on or off. Returns a
852 * negative error code or zero.
853 * @get_priv_flags: Report driver-specific feature flags.
854 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
855 * error code or zero.
856 * @get_sset_count: Get number of strings that @get_strings will write.
857 * @get_rxnfc: Get RX flow classification rules. Returns a negative
858 * error code or zero.
859 * @set_rxnfc: Set RX flow classification rules. Returns a negative
860 * error code or zero.
861 * @flash_device: Write a firmware image to device's flash memory.
862 * Returns a negative error code or zero.
863 * @reset: Reset (part of) the device, as specified by a bitmask of
864 * flags from &enum ethtool_reset_flags. Returns a negative
865 * error code or zero.
866 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code
867 * or zero.
868 * @get_rx_ntuple: Deprecated.
869 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
870 * Returns a negative error code or zero.
871 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
872 * Returns a negative error code or zero.
873 * @get_channels: Get number of channels.
874 * @set_channels: Set number of channels. Returns a negative error code or
875 * zero.
876 * @get_dump_flag: Get dump flag indicating current dump length, version,
877 * and flag of the device.
878 * @get_dump_data: Get dump data.
879 * @set_dump: Set dump specific flags to the device.
880 *
881 * All operations are optional (i.e. the function pointer may be set
882 * to %NULL) and callers must take this into account. Callers must
883 * hold the RTNL, except that for @get_drvinfo the caller may or may
884 * not hold the RTNL.
885 *
886 * See the structures used by these operations for further documentation.
887 *
888 * See &struct net_device and &struct net_device_ops for documentation
889 * of the generic netdev features interface.
619 */ 890 */
620struct ethtool_ops { 891struct ethtool_ops {
621 int (*get_settings)(struct net_device *, struct ethtool_cmd *); 892 int (*get_settings)(struct net_device *, struct ethtool_cmd *);
@@ -654,7 +925,7 @@ struct ethtool_ops {
654 int (*set_tso)(struct net_device *, u32); 925 int (*set_tso)(struct net_device *, u32);
655 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 926 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
656 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 927 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
657 int (*phys_id)(struct net_device *, u32); 928 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
658 void (*get_ethtool_stats)(struct net_device *, 929 void (*get_ethtool_stats)(struct net_device *,
659 struct ethtool_stats *, u64 *); 930 struct ethtool_stats *, u64 *);
660 int (*begin)(struct net_device *); 931 int (*begin)(struct net_device *);
@@ -678,6 +949,13 @@ struct ethtool_ops {
678 struct ethtool_rxfh_indir *); 949 struct ethtool_rxfh_indir *);
679 int (*set_rxfh_indir)(struct net_device *, 950 int (*set_rxfh_indir)(struct net_device *,
680 const struct ethtool_rxfh_indir *); 951 const struct ethtool_rxfh_indir *);
952 void (*get_channels)(struct net_device *, struct ethtool_channels *);
953 int (*set_channels)(struct net_device *, struct ethtool_channels *);
954 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
955 int (*get_dump_data)(struct net_device *,
956 struct ethtool_dump *, void *);
957 int (*set_dump)(struct net_device *, struct ethtool_dump *);
958
681}; 959};
682#endif /* __KERNEL__ */ 960#endif /* __KERNEL__ */
683 961
@@ -691,7 +969,9 @@ struct ethtool_ops {
691#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 969#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
692#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 970#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
693#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 971#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
694#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ 972/* Get link status for host, i.e. whether the interface *and* the
973 * physical port (if there is one) are up (ethtool_value). */
974#define ETHTOOL_GLINK 0x0000000a
695#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 975#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
696#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 976#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
697#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 977#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
@@ -742,6 +1022,14 @@ struct ethtool_ops {
742#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 1022#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
743#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 1023#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
744 1024
1025#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
1026#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
1027#define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
1028#define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
1029#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1030#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1031#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1032
745/* compatibility with older code */ 1033/* compatibility with older code */
746#define SPARC_ETH_GSET ETHTOOL_GSET 1034#define SPARC_ETH_GSET ETHTOOL_GSET
747#define SPARC_ETH_SSET ETHTOOL_SSET 1035#define SPARC_ETH_SSET ETHTOOL_SSET
@@ -768,6 +1056,8 @@ struct ethtool_ops {
768#define SUPPORTED_10000baseKX4_Full (1 << 18) 1056#define SUPPORTED_10000baseKX4_Full (1 << 18)
769#define SUPPORTED_10000baseKR_Full (1 << 19) 1057#define SUPPORTED_10000baseKR_Full (1 << 19)
770#define SUPPORTED_10000baseR_FEC (1 << 20) 1058#define SUPPORTED_10000baseR_FEC (1 << 20)
1059#define SUPPORTED_20000baseMLD2_Full (1 << 21)
1060#define SUPPORTED_20000baseKR2_Full (1 << 22)
771 1061
772/* Indicates what features are advertised by the interface. */ 1062/* Indicates what features are advertised by the interface. */
773#define ADVERTISED_10baseT_Half (1 << 0) 1063#define ADVERTISED_10baseT_Half (1 << 0)
@@ -791,6 +1081,8 @@ struct ethtool_ops {
791#define ADVERTISED_10000baseKX4_Full (1 << 18) 1081#define ADVERTISED_10000baseKX4_Full (1 << 18)
792#define ADVERTISED_10000baseKR_Full (1 << 19) 1082#define ADVERTISED_10000baseKR_Full (1 << 19)
793#define ADVERTISED_10000baseR_FEC (1 << 20) 1083#define ADVERTISED_10000baseR_FEC (1 << 20)
1084#define ADVERTISED_20000baseMLD2_Full (1 << 21)
1085#define ADVERTISED_20000baseKR2_Full (1 << 22)
794 1086
795/* The following are all involved in forcing a particular link 1087/* The following are all involved in forcing a particular link
796 * mode for the device for setting things. When getting the 1088 * mode for the device for setting things. When getting the
@@ -863,6 +1155,8 @@ struct ethtool_ops {
863#define IPV4_FLOW 0x10 /* hash only */ 1155#define IPV4_FLOW 0x10 /* hash only */
864#define IPV6_FLOW 0x11 /* hash only */ 1156#define IPV6_FLOW 0x11 /* hash only */
865#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1157#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1158/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1159#define FLOW_EXT 0x80000000
866 1160
867/* L3-L4 network traffic flow hash options */ 1161/* L3-L4 network traffic flow hash options */
868#define RXH_L2DA (1 << 1) 1162#define RXH_L2DA (1 << 1)
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f6856a5a1d4b..f362733186a5 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/linux/eventpoll.h ( Efficent event polling implementation ) 2 * include/linux/eventpoll.h ( Efficient event polling implementation )
3 * Copyright (C) 2001,...,2006 Davide Libenzi 3 * Copyright (C) 2001,...,2006 Davide Libenzi
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 28028988c862..3a4cef5322dc 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -8,6 +8,9 @@ struct inode;
8struct super_block; 8struct super_block;
9struct vfsmount; 9struct vfsmount;
10 10
11/* limit the handle size to NFSv4 handle size now */
12#define MAX_HANDLE_SZ 128
13
11/* 14/*
12 * The fileid_type identifies how the file within the filesystem is encoded. 15 * The fileid_type identifies how the file within the filesystem is encoded.
13 * In theory this is freely set and parsed by the filesystem, but we try to 16 * In theory this is freely set and parsed by the filesystem, but we try to
@@ -117,12 +120,14 @@ struct fid {
117 * encode_fh: 120 * encode_fh:
118 * @encode_fh should store in the file handle fragment @fh (using at most 121 * @encode_fh should store in the file handle fragment @fh (using at most
119 * @max_len bytes) information that can be used by @decode_fh to recover the 122 * @max_len bytes) information that can be used by @decode_fh to recover the
120 * file refered to by the &struct dentry @de. If the @connectable flag is 123 * file referred to by the &struct dentry @de. If the @connectable flag is
121 * set, the encode_fh() should store sufficient information so that a good 124 * set, the encode_fh() should store sufficient information so that a good
122 * attempt can be made to find not only the file but also it's place in the 125 * attempt can be made to find not only the file but also it's place in the
123 * filesystem. This typically means storing a reference to de->d_parent in 126 * filesystem. This typically means storing a reference to de->d_parent in
124 * the filehandle fragment. encode_fh() should return the number of bytes 127 * the filehandle fragment. encode_fh() should return the fileid_type on
125 * stored or a negative error code such as %-ENOSPC 128 * success and on error returns 255 (if the space needed to encode fh is
129 * greater than @max_len*4 bytes). On error @max_len contains the minimum
130 * size(in 4 byte unit) needed to encode the file handle.
126 * 131 *
127 * fh_to_dentry: 132 * fh_to_dentry:
128 * @fh_to_dentry is given a &struct super_block (@sb) and a file handle 133 * @fh_to_dentry is given a &struct super_block (@sb) and a file handle
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 6ce1bca01724..85c1d302c12e 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -418,13 +418,13 @@ struct ext3_inode {
418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
419#endif 419#endif
420 420
421#define ext3_set_bit ext2_set_bit 421#define ext3_set_bit __test_and_set_bit_le
422#define ext3_set_bit_atomic ext2_set_bit_atomic 422#define ext3_set_bit_atomic ext2_set_bit_atomic
423#define ext3_clear_bit ext2_clear_bit 423#define ext3_clear_bit __test_and_clear_bit_le
424#define ext3_clear_bit_atomic ext2_clear_bit_atomic 424#define ext3_clear_bit_atomic ext2_clear_bit_atomic
425#define ext3_test_bit ext2_test_bit 425#define ext3_test_bit test_bit_le
426#define ext3_find_first_zero_bit ext2_find_first_zero_bit 426#define ext3_find_first_zero_bit find_first_zero_bit_le
427#define ext3_find_next_zero_bit ext2_find_next_zero_bit 427#define ext3_find_next_zero_bit find_next_zero_bit_le
428 428
429/* 429/*
430 * Maximal mount counts between two filesystem checks 430 * Maximal mount counts between two filesystem checks
@@ -724,21 +724,30 @@ struct ext3_dir_entry_2 {
724 ~EXT3_DIR_ROUND) 724 ~EXT3_DIR_ROUND)
725#define EXT3_MAX_REC_LEN ((1<<16)-1) 725#define EXT3_MAX_REC_LEN ((1<<16)-1)
726 726
727/*
728 * Tests against MAX_REC_LEN etc were put in place for 64k block
729 * sizes; if that is not possible on this arch, we can skip
730 * those tests and speed things up.
731 */
727static inline unsigned ext3_rec_len_from_disk(__le16 dlen) 732static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
728{ 733{
729 unsigned len = le16_to_cpu(dlen); 734 unsigned len = le16_to_cpu(dlen);
730 735
736#if (PAGE_CACHE_SIZE >= 65536)
731 if (len == EXT3_MAX_REC_LEN) 737 if (len == EXT3_MAX_REC_LEN)
732 return 1 << 16; 738 return 1 << 16;
739#endif
733 return len; 740 return len;
734} 741}
735 742
736static inline __le16 ext3_rec_len_to_disk(unsigned len) 743static inline __le16 ext3_rec_len_to_disk(unsigned len)
737{ 744{
745#if (PAGE_CACHE_SIZE >= 65536)
738 if (len == (1 << 16)) 746 if (len == (1 << 16))
739 return cpu_to_le16(EXT3_MAX_REC_LEN); 747 return cpu_to_le16(EXT3_MAX_REC_LEN);
740 else if (len > (1 << 16)) 748 else if (len > (1 << 16))
741 BUG(); 749 BUG();
750#endif
742 return cpu_to_le16(len); 751 return cpu_to_le16(len);
743} 752}
744 753
@@ -856,6 +865,7 @@ extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
856extern int ext3_should_retry_alloc(struct super_block *sb, int *retries); 865extern int ext3_should_retry_alloc(struct super_block *sb, int *retries);
857extern void ext3_init_block_alloc_info(struct inode *); 866extern void ext3_init_block_alloc_info(struct inode *);
858extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv); 867extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv);
868extern int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range);
859 869
860/* dir.c */ 870/* dir.c */
861extern int ext3_check_dir_entry(const char *, struct inode *, 871extern int ext3_check_dir_entry(const char *, struct inode *,
@@ -874,7 +884,8 @@ extern int ext3fs_dirhash(const char *name, int len, struct
874 dx_hash_info *hinfo); 884 dx_hash_info *hinfo);
875 885
876/* ialloc.c */ 886/* ialloc.c */
877extern struct inode * ext3_new_inode (handle_t *, struct inode *, int); 887extern struct inode * ext3_new_inode (handle_t *, struct inode *,
888 const struct qstr *, int);
878extern void ext3_free_inode (handle_t *, struct inode *); 889extern void ext3_free_inode (handle_t *, struct inode *);
879extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 890extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
880extern unsigned long ext3_count_free_inodes (struct super_block *); 891extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index 3c155107d61f..73e0b628e058 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -2,6 +2,7 @@
2#define _FALLOC_H_ 2#define _FALLOC_H_
3 3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ 4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
5#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
5 6
6#ifdef __KERNEL__ 7#ifdef __KERNEL__
7 8
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 63531a6b4d2a..6c6133f76e16 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -6,18 +6,19 @@
6/* the following events that user-space can register for */ 6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */ 7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */ 8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */ 9#define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */ 10#define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */ 11#define FAN_OPEN 0x00000020 /* File was opened */
12 12
13#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
14
15/* FIXME currently Q's have no limit.... */
16#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ 13#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
17 14
18#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ 15#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
19#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ 16#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
20 17
18#define FAN_ONDIR 0x40000000 /* event occurred against dir */
19
20#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
21
21/* helper events */ 22/* helper events */
22#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ 23#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
23 24
@@ -25,7 +26,19 @@
25#define FAN_CLOEXEC 0x00000001 26#define FAN_CLOEXEC 0x00000001
26#define FAN_NONBLOCK 0x00000002 27#define FAN_NONBLOCK 0x00000002
27 28
28#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK) 29/* These are NOT bitwise flags. Both bits are used togther. */
30#define FAN_CLASS_NOTIF 0x00000000
31#define FAN_CLASS_CONTENT 0x00000004
32#define FAN_CLASS_PRE_CONTENT 0x00000008
33#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
34 FAN_CLASS_PRE_CONTENT)
35
36#define FAN_UNLIMITED_QUEUE 0x00000010
37#define FAN_UNLIMITED_MARKS 0x00000020
38
39#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
40 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
41 FAN_UNLIMITED_MARKS)
29 42
30/* flags used for fanotify_modify_mark() */ 43/* flags used for fanotify_modify_mark() */
31#define FAN_MARK_ADD 0x00000001 44#define FAN_MARK_ADD 0x00000001
@@ -36,6 +49,10 @@
36#define FAN_MARK_IGNORED_MASK 0x00000020 49#define FAN_MARK_IGNORED_MASK 0x00000020
37#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 50#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
38#define FAN_MARK_FLUSH 0x00000080 51#define FAN_MARK_FLUSH 0x00000080
52#ifdef __KERNEL__
53/* not valid from userspace, only kernel internal */
54#define FAN_MARK_ONDIR 0x00000100
55#endif
39 56
40#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ 57#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
41 FAN_MARK_REMOVE |\ 58 FAN_MARK_REMOVE |\
@@ -43,7 +60,8 @@
43 FAN_MARK_ONLYDIR |\ 60 FAN_MARK_ONLYDIR |\
44 FAN_MARK_MOUNT |\ 61 FAN_MARK_MOUNT |\
45 FAN_MARK_IGNORED_MASK |\ 62 FAN_MARK_IGNORED_MASK |\
46 FAN_MARK_IGNORED_SURV_MODIFY) 63 FAN_MARK_IGNORED_SURV_MODIFY |\
64 FAN_MARK_FLUSH)
47 65
48/* 66/*
49 * All of the events - we build the list by hand so that we can add flags in 67 * All of the events - we build the list by hand so that we can add flags in
@@ -65,24 +83,28 @@
65 FAN_ALL_PERM_EVENTS |\ 83 FAN_ALL_PERM_EVENTS |\
66 FAN_Q_OVERFLOW) 84 FAN_Q_OVERFLOW)
67 85
68#define FANOTIFY_METADATA_VERSION 2 86#define FANOTIFY_METADATA_VERSION 3
69 87
70struct fanotify_event_metadata { 88struct fanotify_event_metadata {
71 __u32 event_len; 89 __u32 event_len;
72 __u32 vers; 90 __u8 vers;
73 __u64 mask; 91 __u8 reserved;
92 __u16 metadata_len;
93 __aligned_u64 mask;
74 __s32 fd; 94 __s32 fd;
75 __s32 pid; 95 __s32 pid;
76} __attribute__ ((packed)); 96};
77 97
78struct fanotify_response { 98struct fanotify_response {
79 __s32 fd; 99 __s32 fd;
80 __u32 response; 100 __u32 response;
81} __attribute__ ((packed)); 101};
82 102
83/* Legit userspace responses to a _PERM event */ 103/* Legit userspace responses to a _PERM event */
84#define FAN_ALLOW 0x01 104#define FAN_ALLOW 0x01
85#define FAN_DENY 0x02 105#define FAN_DENY 0x02
106/* No fd set in event */
107#define FAN_NOFD -1
86 108
87/* Helper functions to deal with fanotify_event_metadata buffers */ 109/* Helper functions to deal with fanotify_event_metadata buffers */
88#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata)) 110#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f0268deca658..6a8274877171 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -152,6 +152,8 @@
152#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ 152#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
153#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ 153#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
154 154
155#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
156
155struct fb_fix_screeninfo { 157struct fb_fix_screeninfo {
156 char id[16]; /* identification string eg "TT Builtin" */ 158 char id[16]; /* identification string eg "TT Builtin" */
157 unsigned long smem_start; /* Start of frame buffer mem */ 159 unsigned long smem_start; /* Start of frame buffer mem */
@@ -532,14 +534,14 @@ struct fb_cursor_user {
532#define FB_EVENT_GET_CONSOLE_MAP 0x07 534#define FB_EVENT_GET_CONSOLE_MAP 0x07
533/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 535/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
534#define FB_EVENT_SET_CONSOLE_MAP 0x08 536#define FB_EVENT_SET_CONSOLE_MAP 0x08
535/* A hardware display blank change occured */ 537/* A hardware display blank change occurred */
536#define FB_EVENT_BLANK 0x09 538#define FB_EVENT_BLANK 0x09
537/* Private modelist is to be replaced */ 539/* Private modelist is to be replaced */
538#define FB_EVENT_NEW_MODELIST 0x0A 540#define FB_EVENT_NEW_MODELIST 0x0A
539/* The resolution of the passed in fb_info about to change and 541/* The resolution of the passed in fb_info about to change and
540 all vc's should be changed */ 542 all vc's should be changed */
541#define FB_EVENT_MODE_CHANGE_ALL 0x0B 543#define FB_EVENT_MODE_CHANGE_ALL 0x0B
542/* A software display blank change occured */ 544/* A software display blank change occurred */
543#define FB_EVENT_CONBLANK 0x0C 545#define FB_EVENT_CONBLANK 0x0C
544/* Get drawing requirements */ 546/* Get drawing requirements */
545#define FB_EVENT_GET_REQ 0x0D 547#define FB_EVENT_GET_REQ 0x0D
@@ -803,7 +805,7 @@ struct fb_tile_ops {
803/* A driver may set this flag to indicate that it does want a set_par to be 805/* A driver may set this flag to indicate that it does want a set_par to be
804 * called every time when fbcon_switch is executed. The advantage is that with 806 * called every time when fbcon_switch is executed. The advantage is that with
805 * this flag set you can really be sure that set_par is always called before 807 * this flag set you can really be sure that set_par is always called before
806 * any of the functions dependant on the correct hardware state or altering 808 * any of the functions dependent on the correct hardware state or altering
807 * that state, even if you are using some broken X releases. The disadvantage 809 * that state, even if you are using some broken X releases. The disadvantage
808 * is that it introduces unwanted delays to every console switch if set_par 810 * is that it introduces unwanted delays to every console switch if set_par
809 * is slow. It is a good idea to try this flag in the drivers initialization 811 * is slow. It is a good idea to try this flag in the drivers initialization
@@ -830,6 +832,7 @@ struct fb_tile_ops {
830#define FBINFO_CAN_FORCE_OUTPUT 0x200000 832#define FBINFO_CAN_FORCE_OUTPUT 0x200000
831 833
832struct fb_info { 834struct fb_info {
835 atomic_t count;
833 int node; 836 int node;
834 int flags; 837 int flags;
835 struct mutex lock; /* Lock for open/release/ioctl funcs */ 838 struct mutex lock; /* Lock for open/release/ioctl funcs */
@@ -875,7 +878,7 @@ struct fb_info {
875 void *fbcon_par; /* fbcon use-only private area */ 878 void *fbcon_par; /* fbcon use-only private area */
876 /* From here on everything is device dependent */ 879 /* From here on everything is device dependent */
877 void *par; 880 void *par;
878 /* we need the PCI or similiar aperture base/size not 881 /* we need the PCI or similar aperture base/size not
879 smem_start/size as smem_start may just be an object 882 smem_start/size as smem_start may just be an object
880 allocated inside the aperture so may not actually overlap */ 883 allocated inside the aperture so may not actually overlap */
881 struct apertures_struct { 884 struct apertures_struct {
@@ -931,6 +934,8 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
931#define fb_writel sbus_writel 934#define fb_writel sbus_writel
932#define fb_writeq sbus_writeq 935#define fb_writeq sbus_writeq
933#define fb_memset sbus_memset_io 936#define fb_memset sbus_memset_io
937#define fb_memcpy_fromfb sbus_memcpy_fromio
938#define fb_memcpy_tofb sbus_memcpy_toio
934 939
935#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) 940#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
936 941
@@ -943,6 +948,8 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
943#define fb_writel __raw_writel 948#define fb_writel __raw_writel
944#define fb_writeq __raw_writeq 949#define fb_writeq __raw_writeq
945#define fb_memset memset_io 950#define fb_memset memset_io
951#define fb_memcpy_fromfb memcpy_fromio
952#define fb_memcpy_tofb memcpy_toio
946 953
947#else 954#else
948 955
@@ -955,6 +962,8 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
955#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) 962#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
956#define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b)) 963#define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
957#define fb_memset memset 964#define fb_memset memset
965#define fb_memcpy_fromfb memcpy
966#define fb_memcpy_tofb memcpy
958 967
959#endif 968#endif
960 969
@@ -1086,6 +1095,8 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
1086extern const unsigned char *fb_firmware_edid(struct device *device); 1095extern const unsigned char *fb_firmware_edid(struct device *device);
1087extern void fb_edid_to_monspecs(unsigned char *edid, 1096extern void fb_edid_to_monspecs(unsigned char *edid,
1088 struct fb_monspecs *specs); 1097 struct fb_monspecs *specs);
1098extern void fb_edid_add_monspecs(unsigned char *edid,
1099 struct fb_monspecs *specs);
1089extern void fb_destroy_modedb(struct fb_videomode *modedb); 1100extern void fb_destroy_modedb(struct fb_videomode *modedb);
1090extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); 1101extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
1091extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); 1102extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
@@ -1116,6 +1127,7 @@ extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs
1116 1127
1117/* drivers/video/fbcmap.c */ 1128/* drivers/video/fbcmap.c */
1118extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); 1129extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
1130extern int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags);
1119extern void fb_dealloc_cmap(struct fb_cmap *cmap); 1131extern void fb_dealloc_cmap(struct fb_cmap *cmap);
1120extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to); 1132extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to);
1121extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to); 1133extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to);
@@ -1143,6 +1155,7 @@ struct fb_videomode {
1143 1155
1144extern const char *fb_mode_option; 1156extern const char *fb_mode_option;
1145extern const struct fb_videomode vesa_modes[]; 1157extern const struct fb_videomode vesa_modes[];
1158extern const struct fb_videomode cea_modes[64];
1146 1159
1147struct fb_modelist { 1160struct fb_modelist {
1148 struct list_head list; 1161 struct list_head list;
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index afc00af3229b..f550f894ba15 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -45,6 +45,8 @@
45#define AT_REMOVEDIR 0x200 /* Remove directory instead of 45#define AT_REMOVEDIR 0x200 /* Remove directory instead of
46 unlinking file. */ 46 unlinking file. */
47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ 47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
49#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
48 50
49#ifdef __KERNEL__ 51#ifdef __KERNEL__
50 52
diff --git a/include/linux/fec.h b/include/linux/fec.h
index 5d3523d8dd0c..bcff455d1d53 100644
--- a/include/linux/fec.h
+++ b/include/linux/fec.h
@@ -3,6 +3,8 @@
3 * Copyright (c) 2009 Orex Computed Radiography 3 * Copyright (c) 2009 Orex Computed Radiography
4 * Baruch Siach <baruch@tkos.co.il> 4 * Baruch Siach <baruch@tkos.co.il>
5 * 5 *
6 * Copyright (C) 2010 Freescale Semiconductor, Inc.
7 *
6 * Header file for the FEC platform data 8 * Header file for the FEC platform data
7 * 9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
@@ -16,6 +18,7 @@
16 18
17struct fec_platform_data { 19struct fec_platform_data {
18 phy_interface_t phy; 20 phy_interface_t phy;
21 unsigned char mac[ETH_ALEN];
19}; 22};
20 23
21#endif 24#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index b1e12970f617..21a79958541c 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -23,12 +23,14 @@ extern struct file *alloc_file(struct path *, fmode_t mode,
23 23
24static inline void fput_light(struct file *file, int fput_needed) 24static inline void fput_light(struct file *file, int fput_needed)
25{ 25{
26 if (unlikely(fput_needed)) 26 if (fput_needed)
27 fput(file); 27 fput(file);
28} 28}
29 29
30extern struct file *fget(unsigned int fd); 30extern struct file *fget(unsigned int fd);
31extern struct file *fget_light(unsigned int fd, int *fput_needed); 31extern struct file *fget_light(unsigned int fd, int *fput_needed);
32extern struct file *fget_raw(unsigned int fd);
33extern struct file *fget_raw_light(unsigned int fd, int *fput_needed);
32extern void set_close_on_exec(unsigned int fd, int flag); 34extern void set_close_on_exec(unsigned int fd, int flag);
33extern void put_filp(struct file *); 35extern void put_filp(struct file *);
34extern int alloc_fd(unsigned start, unsigned flags); 36extern int alloc_fd(unsigned start, unsigned flags);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 69b43dbea6c6..4609b85e559d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -91,54 +91,6 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
91#define BPF_TAX 0x00 91#define BPF_TAX 0x00
92#define BPF_TXA 0x80 92#define BPF_TXA 0x80
93 93
94enum {
95 BPF_S_RET_K = 0,
96 BPF_S_RET_A,
97 BPF_S_ALU_ADD_K,
98 BPF_S_ALU_ADD_X,
99 BPF_S_ALU_SUB_K,
100 BPF_S_ALU_SUB_X,
101 BPF_S_ALU_MUL_K,
102 BPF_S_ALU_MUL_X,
103 BPF_S_ALU_DIV_X,
104 BPF_S_ALU_AND_K,
105 BPF_S_ALU_AND_X,
106 BPF_S_ALU_OR_K,
107 BPF_S_ALU_OR_X,
108 BPF_S_ALU_LSH_K,
109 BPF_S_ALU_LSH_X,
110 BPF_S_ALU_RSH_K,
111 BPF_S_ALU_RSH_X,
112 BPF_S_ALU_NEG,
113 BPF_S_LD_W_ABS,
114 BPF_S_LD_H_ABS,
115 BPF_S_LD_B_ABS,
116 BPF_S_LD_W_LEN,
117 BPF_S_LD_W_IND,
118 BPF_S_LD_H_IND,
119 BPF_S_LD_B_IND,
120 BPF_S_LD_IMM,
121 BPF_S_LDX_W_LEN,
122 BPF_S_LDX_B_MSH,
123 BPF_S_LDX_IMM,
124 BPF_S_MISC_TAX,
125 BPF_S_MISC_TXA,
126 BPF_S_ALU_DIV_K,
127 BPF_S_LD_MEM,
128 BPF_S_LDX_MEM,
129 BPF_S_ST,
130 BPF_S_STX,
131 BPF_S_JMP_JA,
132 BPF_S_JMP_JEQ_K,
133 BPF_S_JMP_JEQ_X,
134 BPF_S_JMP_JGE_K,
135 BPF_S_JMP_JGE_X,
136 BPF_S_JMP_JGT_K,
137 BPF_S_JMP_JGT_X,
138 BPF_S_JMP_JSET_K,
139 BPF_S_JMP_JSET_X,
140};
141
142#ifndef BPF_MAXINSNS 94#ifndef BPF_MAXINSNS
143#define BPF_MAXINSNS 4096 95#define BPF_MAXINSNS 4096
144#endif 96#endif
@@ -172,7 +124,9 @@ enum {
172#define SKF_AD_MARK 20 124#define SKF_AD_MARK 20
173#define SKF_AD_QUEUE 24 125#define SKF_AD_QUEUE 24
174#define SKF_AD_HATYPE 28 126#define SKF_AD_HATYPE 28
175#define SKF_AD_MAX 32 127#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36
129#define SKF_AD_MAX 40
176#define SKF_NET_OFF (-0x100000) 130#define SKF_NET_OFF (-0x100000)
177#define SKF_LL_OFF (-0x200000) 131#define SKF_LL_OFF (-0x200000)
178 132
@@ -181,6 +135,8 @@ struct sk_filter
181{ 135{
182 atomic_t refcnt; 136 atomic_t refcnt;
183 unsigned int len; /* Number of filter blocks */ 137 unsigned int len; /* Number of filter blocks */
138 unsigned int (*bpf_func)(const struct sk_buff *skb,
139 const struct sock_filter *filter);
184 struct rcu_head rcu; 140 struct rcu_head rcu;
185 struct sock_filter insns[0]; 141 struct sock_filter insns[0];
186}; 142};
@@ -194,11 +150,85 @@ struct sk_buff;
194struct sock; 150struct sock;
195 151
196extern int sk_filter(struct sock *sk, struct sk_buff *skb); 152extern int sk_filter(struct sock *sk, struct sk_buff *skb);
197extern unsigned int sk_run_filter(struct sk_buff *skb, 153extern unsigned int sk_run_filter(const struct sk_buff *skb,
198 struct sock_filter *filter, int flen); 154 const struct sock_filter *filter);
199extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 155extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
200extern int sk_detach_filter(struct sock *sk); 156extern int sk_detach_filter(struct sock *sk);
201extern int sk_chk_filter(struct sock_filter *filter, int flen); 157extern int sk_chk_filter(struct sock_filter *filter, int flen);
158
159#ifdef CONFIG_BPF_JIT
160extern void bpf_jit_compile(struct sk_filter *fp);
161extern void bpf_jit_free(struct sk_filter *fp);
162#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
163#else
164static inline void bpf_jit_compile(struct sk_filter *fp)
165{
166}
167static inline void bpf_jit_free(struct sk_filter *fp)
168{
169}
170#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
171#endif
172
173enum {
174 BPF_S_RET_K = 1,
175 BPF_S_RET_A,
176 BPF_S_ALU_ADD_K,
177 BPF_S_ALU_ADD_X,
178 BPF_S_ALU_SUB_K,
179 BPF_S_ALU_SUB_X,
180 BPF_S_ALU_MUL_K,
181 BPF_S_ALU_MUL_X,
182 BPF_S_ALU_DIV_X,
183 BPF_S_ALU_AND_K,
184 BPF_S_ALU_AND_X,
185 BPF_S_ALU_OR_K,
186 BPF_S_ALU_OR_X,
187 BPF_S_ALU_LSH_K,
188 BPF_S_ALU_LSH_X,
189 BPF_S_ALU_RSH_K,
190 BPF_S_ALU_RSH_X,
191 BPF_S_ALU_NEG,
192 BPF_S_LD_W_ABS,
193 BPF_S_LD_H_ABS,
194 BPF_S_LD_B_ABS,
195 BPF_S_LD_W_LEN,
196 BPF_S_LD_W_IND,
197 BPF_S_LD_H_IND,
198 BPF_S_LD_B_IND,
199 BPF_S_LD_IMM,
200 BPF_S_LDX_W_LEN,
201 BPF_S_LDX_B_MSH,
202 BPF_S_LDX_IMM,
203 BPF_S_MISC_TAX,
204 BPF_S_MISC_TXA,
205 BPF_S_ALU_DIV_K,
206 BPF_S_LD_MEM,
207 BPF_S_LDX_MEM,
208 BPF_S_ST,
209 BPF_S_STX,
210 BPF_S_JMP_JA,
211 BPF_S_JMP_JEQ_K,
212 BPF_S_JMP_JEQ_X,
213 BPF_S_JMP_JGE_K,
214 BPF_S_JMP_JGE_X,
215 BPF_S_JMP_JGT_K,
216 BPF_S_JMP_JGT_X,
217 BPF_S_JMP_JSET_K,
218 BPF_S_JMP_JSET_X,
219 /* Ancillary data */
220 BPF_S_ANC_PROTOCOL,
221 BPF_S_ANC_PKTTYPE,
222 BPF_S_ANC_IFINDEX,
223 BPF_S_ANC_NLATTR,
224 BPF_S_ANC_NLATTR_NEST,
225 BPF_S_ANC_MARK,
226 BPF_S_ANC_QUEUE,
227 BPF_S_ANC_HATYPE,
228 BPF_S_ANC_RXHASH,
229 BPF_S_ANC_CPU,
230};
231
202#endif /* __KERNEL__ */ 232#endif /* __KERNEL__ */
203 233
204#endif /* __LINUX_FILTER_H__ */ 234#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 68c642d8843d..4ff09889c5c0 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -273,7 +273,7 @@ struct fw_cdev_event_iso_interrupt {
273 * @closure: See &fw_cdev_event_common; 273 * @closure: See &fw_cdev_event_common;
274 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl 274 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
275 * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 275 * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
276 * @completed: Offset into the receive buffer; data before this offest is valid 276 * @completed: Offset into the receive buffer; data before this offset is valid
277 * 277 *
278 * This event is sent in multichannel contexts (context type 278 * This event is sent in multichannel contexts (context type
279 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer 279 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
@@ -900,7 +900,7 @@ struct fw_cdev_get_cycle_timer2 {
900 900
901/** 901/**
902 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth 902 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
903 * @closure: Passed back to userspace in correponding iso resource events 903 * @closure: Passed back to userspace in corresponding iso resource events
904 * @channels: Isochronous channels of which one is to be (de)allocated 904 * @channels: Isochronous channels of which one is to be (de)allocated
905 * @bandwidth: Isochronous bandwidth units to be (de)allocated 905 * @bandwidth: Isochronous bandwidth units to be (de)allocated
906 * @handle: Handle to the allocation, written by the kernel (only valid in 906 * @handle: Handle to the allocation, written by the kernel (only valid in
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 1cd637ef62d2..5e6f42789afe 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -42,6 +42,10 @@
42#define CSR_BROADCAST_CHANNEL 0x234 42#define CSR_BROADCAST_CHANNEL 0x234
43#define CSR_CONFIG_ROM 0x400 43#define CSR_CONFIG_ROM 0x400
44#define CSR_CONFIG_ROM_END 0x800 44#define CSR_CONFIG_ROM_END 0x800
45#define CSR_OMPR 0x900
46#define CSR_OPCR(i) (0x904 + (i) * 4)
47#define CSR_IMPR 0x980
48#define CSR_IPCR(i) (0x984 + (i) * 4)
45#define CSR_FCP_COMMAND 0xB00 49#define CSR_FCP_COMMAND 0xB00
46#define CSR_FCP_RESPONSE 0xD00 50#define CSR_FCP_RESPONSE 0xD00
47#define CSR_FCP_END 0xF00 51#define CSR_FCP_END 0xF00
@@ -89,7 +93,7 @@ struct fw_card {
89 int current_tlabel; 93 int current_tlabel;
90 u64 tlabel_mask; 94 u64 tlabel_mask;
91 struct list_head transaction_list; 95 struct list_head transaction_list;
92 unsigned long reset_jiffies; 96 u64 reset_jiffies;
93 97
94 u32 split_timeout_hi; 98 u32 split_timeout_hi;
95 u32 split_timeout_lo; 99 u32 split_timeout_lo;
@@ -121,7 +125,6 @@ struct fw_card {
121 struct delayed_work bm_work; /* bus manager job */ 125 struct delayed_work bm_work; /* bus manager job */
122 int bm_retries; 126 int bm_retries;
123 int bm_generation; 127 int bm_generation;
124 __be32 bm_transaction_data[2];
125 int bm_node_id; 128 int bm_node_id;
126 bool bm_abdicate; 129 bool bm_abdicate;
127 130
@@ -302,9 +305,9 @@ struct fw_packet {
302struct fw_transaction { 305struct fw_transaction {
303 int node_id; /* The generation is implied; it is always the current. */ 306 int node_id; /* The generation is implied; it is always the current. */
304 int tlabel; 307 int tlabel;
305 int timestamp;
306 struct list_head link; 308 struct list_head link;
307 struct fw_card *card; 309 struct fw_card *card;
310 bool is_split_transaction;
308 struct timer_list split_timeout_timer; 311 struct timer_list split_timeout_timer;
309 312
310 struct fw_packet packet; 313 struct fw_packet packet;
@@ -437,9 +440,15 @@ int fw_iso_context_queue(struct fw_iso_context *ctx,
437 struct fw_iso_packet *packet, 440 struct fw_iso_packet *packet,
438 struct fw_iso_buffer *buffer, 441 struct fw_iso_buffer *buffer,
439 unsigned long payload); 442 unsigned long payload);
443void fw_iso_context_queue_flush(struct fw_iso_context *ctx);
440int fw_iso_context_start(struct fw_iso_context *ctx, 444int fw_iso_context_start(struct fw_iso_context *ctx,
441 int cycle, int sync, int tags); 445 int cycle, int sync, int tags);
442int fw_iso_context_stop(struct fw_iso_context *ctx); 446int fw_iso_context_stop(struct fw_iso_context *ctx);
443void fw_iso_context_destroy(struct fw_iso_context *ctx); 447void fw_iso_context_destroy(struct fw_iso_context *ctx);
448void fw_iso_resource_manage(struct fw_card *card, int generation,
449 u64 channels_mask, int *channel, int *bandwidth,
450 bool allocate);
451
452extern struct workqueue_struct *fw_workqueue;
444 453
445#endif /* _LINUX_FIREWIRE_H */ 454#endif /* _LINUX_FIREWIRE_H */
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index c6dcc1dfe781..43fe52fcef0f 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -17,7 +17,6 @@
17#define _LINUX_FIRMWARE_MAP_H 17#define _LINUX_FIRMWARE_MAP_H
18 18
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/kobject.h>
21 20
22/* 21/*
23 * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled 22 * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 53d1e6c4f848..21b3e7588abd 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -39,7 +39,7 @@ struct builtin_fw {
39int request_firmware(const struct firmware **fw, const char *name, 39int request_firmware(const struct firmware **fw, const char *name,
40 struct device *device); 40 struct device *device);
41int request_firmware_nowait( 41int request_firmware_nowait(
42 struct module *module, int uevent, 42 struct module *module, bool uevent,
43 const char *name, struct device *device, gfp_t gfp, void *context, 43 const char *name, struct device *device, gfp_t gfp, void *context,
44 void (*cont)(const struct firmware *fw, void *context)); 44 void (*cont)(const struct firmware *fw, void *context));
45 45
@@ -52,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw,
52 return -EINVAL; 52 return -EINVAL;
53} 53}
54static inline int request_firmware_nowait( 54static inline int request_firmware_nowait(
55 struct module *module, int uevent, 55 struct module *module, bool uevent,
56 const char *name, struct device *device, gfp_t gfp, void *context, 56 const char *name, struct device *device, gfp_t gfp, void *context,
57 void (*cont)(const struct firmware *fw, void *context)) 57 void (*cont)(const struct firmware *fw, void *context))
58{ 58{
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 631b77f2ac70..ebeb2f3ad068 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -61,7 +61,7 @@ struct flex_array {
61struct flex_array *flex_array_alloc(int element_size, unsigned int total, 61struct flex_array *flex_array_alloc(int element_size, unsigned int total,
62 gfp_t flags); 62 gfp_t flags);
63int flex_array_prealloc(struct flex_array *fa, unsigned int start, 63int flex_array_prealloc(struct flex_array *fa, unsigned int start,
64 unsigned int end, gfp_t flags); 64 unsigned int nr_elements, gfp_t flags);
65void flex_array_free(struct flex_array *fa); 65void flex_array_free(struct flex_array *fa);
66void flex_array_free_parts(struct flex_array *fa); 66void flex_array_free_parts(struct flex_array *fa);
67int 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,
@@ -71,7 +71,7 @@ void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa); 71int flex_array_shrink(struct flex_array *fa);
72 72
73#define flex_array_put_ptr(fa, nr, src, gfp) \ 73#define flex_array_put_ptr(fa, nr, src, gfp) \
74 flex_array_put(fa, nr, &(void *)(src), gfp) 74 flex_array_put(fa, nr, (void *)&(src), gfp)
75 75
76void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr); 76void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr);
77 77
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index da7e52b099f3..1effc8b56b4e 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -109,7 +109,7 @@ static inline void freezer_count(void)
109} 109}
110 110
111/* 111/*
112 * Check if the task should be counted as freezeable by the freezer 112 * Check if the task should be counted as freezable by the freezer
113 */ 113 */
114static inline int freezer_should_skip(struct task_struct *p) 114static inline int freezer_should_skip(struct task_struct *p)
115{ 115{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f34ff6e5558..cdf9495df204 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,6 +9,7 @@
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h> 11#include <linux/blk_types.h>
12#include <linux/types.h>
12 13
13/* 14/*
14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -32,11 +33,17 @@
32#define SEEK_END 2 /* seek relative to end of file */ 33#define SEEK_END 2 /* seek relative to end of file */
33#define SEEK_MAX SEEK_END 34#define SEEK_MAX SEEK_END
34 35
36struct fstrim_range {
37 __u64 start;
38 __u64 len;
39 __u64 minlen;
40};
41
35/* And dynamically-tunable limits and defaults: */ 42/* And dynamically-tunable limits and defaults: */
36struct files_stat_struct { 43struct files_stat_struct {
37 int nr_files; /* read only */ 44 unsigned long nr_files; /* read only */
38 int nr_free_files; /* read only */ 45 unsigned long nr_free_files; /* read only */
39 int max_files; /* tunable */ 46 unsigned long max_files; /* tunable */
40}; 47};
41 48
42struct inodes_stat_t { 49struct inodes_stat_t {
@@ -92,6 +99,12 @@ struct inodes_stat_t {
92/* Expect random access pattern */ 99/* Expect random access pattern */
93#define FMODE_RANDOM ((__force fmode_t)0x1000) 100#define FMODE_RANDOM ((__force fmode_t)0x1000)
94 101
102/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
103#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000)
104
105/* File is opened with O_PATH; almost nothing can be done with it */
106#define FMODE_PATH ((__force fmode_t)0x4000)
107
95/* File was opened by fanotify and shouldn't generate fanotify events */ 108/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 109#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
97 110
@@ -125,16 +138,10 @@ struct inodes_stat_t {
125 * block layer could (in theory) choose to ignore this 138 * block layer could (in theory) choose to ignore this
126 * request if it runs into resource problems. 139 * request if it runs into resource problems.
127 * WRITE A normal async write. Device will be plugged. 140 * WRITE A normal async write. Device will be plugged.
128 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down 141 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down
129 * the hint that someone will be waiting on this IO 142 * the hint that someone will be waiting on this IO
130 * shortly. The device must still be unplugged explicitly, 143 * shortly. The write equivalent of READ_SYNC.
131 * WRITE_SYNC_PLUG does not do this as we could be 144 * WRITE_ODIRECT Special case write for O_DIRECT only.
132 * submitting more writes before we actually wait on any
133 * of them.
134 * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device
135 * immediately after submission. The write equivalent
136 * of READ_SYNC.
137 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
138 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. 145 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
139 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on 146 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
140 * non-volatile media on completion. 147 * non-volatile media on completion.
@@ -150,18 +157,14 @@ struct inodes_stat_t {
150#define WRITE RW_MASK 157#define WRITE RW_MASK
151#define READA RWA_MASK 158#define READA RWA_MASK
152 159
153#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) 160#define READ_SYNC (READ | REQ_SYNC)
154#define READ_META (READ | REQ_META) 161#define READ_META (READ | REQ_META)
155#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) 162#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
156#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) 163#define WRITE_ODIRECT (WRITE | REQ_SYNC)
157#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
158#define WRITE_META (WRITE | REQ_META) 164#define WRITE_META (WRITE | REQ_META)
159#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 165#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
160 REQ_FLUSH) 166#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
161#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 167#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
162 REQ_FUA)
163#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
164 REQ_FLUSH | REQ_FUA)
165 168
166#define SEL_IN 1 169#define SEL_IN 1
167#define SEL_OUT 2 170#define SEL_OUT 2
@@ -231,6 +234,8 @@ struct inodes_stat_t {
231#define S_NOCMTIME 128 /* Do not update file c/mtime */ 234#define S_NOCMTIME 128 /* Do not update file c/mtime */
232#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ 235#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
233#define S_PRIVATE 512 /* Inode is fs-internal */ 236#define S_PRIVATE 512 /* Inode is fs-internal */
237#define S_IMA 1024 /* Inode has an associated IMA struct */
238#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
234 239
235/* 240/*
236 * Note that nosuid etc flags are inode-specific: setting some file-system 241 * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -265,6 +270,8 @@ struct inodes_stat_t {
265#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) 270#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
266#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) 271#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
267#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) 272#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
273#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
274#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
268 275
269/* the read-only stuff doesn't really belong here, but any other place is 276/* the read-only stuff doesn't really belong here, but any other place is
270 probably as bad and I don't want to create yet another include file. */ 277 probably as bad and I don't want to create yet another include file. */
@@ -312,6 +319,7 @@ struct inodes_stat_t {
312#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ 319#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
313#define FIFREEZE _IOWR('X', 119, int) /* Freeze */ 320#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
314#define FITHAW _IOWR('X', 120, int) /* Thaw */ 321#define FITHAW _IOWR('X', 120, int) /* Thaw */
322#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
315 323
316#define FS_IOC_GETFLAGS _IOR('f', 1, long) 324#define FS_IOC_GETFLAGS _IOR('f', 1, long)
317#define FS_IOC_SETFLAGS _IOW('f', 2, long) 325#define FS_IOC_SETFLAGS _IOW('f', 2, long)
@@ -349,6 +357,7 @@ struct inodes_stat_t {
349#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 357#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
350#define FS_EXTENT_FL 0x00080000 /* Extents */ 358#define FS_EXTENT_FL 0x00080000 /* Extents */
351#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ 359#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
360#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
352#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 361#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
353 362
354#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 363#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
@@ -369,7 +378,6 @@ struct inodes_stat_t {
369#include <linux/path.h> 378#include <linux/path.h>
370#include <linux/stat.h> 379#include <linux/stat.h>
371#include <linux/cache.h> 380#include <linux/cache.h>
372#include <linux/kobject.h>
373#include <linux/list.h> 381#include <linux/list.h>
374#include <linux/radix-tree.h> 382#include <linux/radix-tree.h>
375#include <linux/prio_tree.h> 383#include <linux/prio_tree.h>
@@ -379,6 +387,7 @@ struct inodes_stat_t {
379#include <linux/capability.h> 387#include <linux/capability.h>
380#include <linux/semaphore.h> 388#include <linux/semaphore.h>
381#include <linux/fiemap.h> 389#include <linux/fiemap.h>
390#include <linux/rculist_bl.h>
382 391
383#include <asm/atomic.h> 392#include <asm/atomic.h>
384#include <asm/byteorder.h> 393#include <asm/byteorder.h>
@@ -388,6 +397,7 @@ struct hd_geometry;
388struct iovec; 397struct iovec;
389struct nameidata; 398struct nameidata;
390struct kiocb; 399struct kiocb;
400struct kobject;
391struct pipe_inode_info; 401struct pipe_inode_info;
392struct poll_table_struct; 402struct poll_table_struct;
393struct kstatfs; 403struct kstatfs;
@@ -400,7 +410,7 @@ extern void __init inode_init_early(void);
400extern void __init files_init(unsigned long); 410extern void __init files_init(unsigned long);
401 411
402extern struct files_stat_struct files_stat; 412extern struct files_stat_struct files_stat;
403extern int get_max_files(void); 413extern unsigned long get_max_files(void);
404extern int sysctl_nr_open; 414extern int sysctl_nr_open;
405extern struct inodes_stat_t inodes_stat; 415extern struct inodes_stat_t inodes_stat;
406extern int leases_enable, lease_break_time; 416extern int leases_enable, lease_break_time;
@@ -454,7 +464,7 @@ struct iattr {
454 struct timespec ia_ctime; 464 struct timespec ia_ctime;
455 465
456 /* 466 /*
457 * Not an attribute, but an auxilary info for filesystems wanting to 467 * Not an attribute, but an auxiliary info for filesystems wanting to
458 * implement an ftruncate() like method. NOTE: filesystem should 468 * implement an ftruncate() like method. NOTE: filesystem should
459 * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL). 469 * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL).
460 */ 470 */
@@ -567,7 +577,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
567struct address_space_operations { 577struct address_space_operations {
568 int (*writepage)(struct page *page, struct writeback_control *wbc); 578 int (*writepage)(struct page *page, struct writeback_control *wbc);
569 int (*readpage)(struct file *, struct page *); 579 int (*readpage)(struct file *, struct page *);
570 void (*sync_page)(struct page *);
571 580
572 /* Write back some dirty pages from this mapping. */ 581 /* Write back some dirty pages from this mapping. */
573 int (*writepages)(struct address_space *, struct writeback_control *); 582 int (*writepages)(struct address_space *, struct writeback_control *);
@@ -589,6 +598,7 @@ struct address_space_operations {
589 sector_t (*bmap)(struct address_space *, sector_t); 598 sector_t (*bmap)(struct address_space *, sector_t);
590 void (*invalidatepage) (struct page *, unsigned long); 599 void (*invalidatepage) (struct page *, unsigned long);
591 int (*releasepage) (struct page *, gfp_t); 600 int (*releasepage) (struct page *, gfp_t);
601 void (*freepage)(struct page *);
592 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 602 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
593 loff_t offset, unsigned long nr_segs); 603 loff_t offset, unsigned long nr_segs);
594 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 604 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
@@ -602,6 +612,8 @@ struct address_space_operations {
602 int (*error_remove_page)(struct address_space *, struct page *); 612 int (*error_remove_page)(struct address_space *, struct page *);
603}; 613};
604 614
615extern const struct address_space_operations empty_aops;
616
605/* 617/*
606 * pagecache_write_begin/pagecache_write_end must be used by general code 618 * pagecache_write_begin/pagecache_write_end must be used by general code
607 * to write into the pagecache. 619 * to write into the pagecache.
@@ -632,25 +644,27 @@ struct address_space {
632 spinlock_t private_lock; /* for use by the address_space */ 644 spinlock_t private_lock; /* for use by the address_space */
633 struct list_head private_list; /* ditto */ 645 struct list_head private_list; /* ditto */
634 struct address_space *assoc_mapping; /* ditto */ 646 struct address_space *assoc_mapping; /* ditto */
647 struct mutex unmap_mutex; /* to protect unmapping */
635} __attribute__((aligned(sizeof(long)))); 648} __attribute__((aligned(sizeof(long))));
636 /* 649 /*
637 * On most architectures that alignment is already the case; but 650 * On most architectures that alignment is already the case; but
638 * must be enforced here for CRIS, to let the least signficant bit 651 * must be enforced here for CRIS, to let the least significant bit
639 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. 652 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
640 */ 653 */
641 654
642struct block_device { 655struct block_device {
643 dev_t bd_dev; /* not a kdev_t - it's a search key */ 656 dev_t bd_dev; /* not a kdev_t - it's a search key */
657 int bd_openers;
644 struct inode * bd_inode; /* will die */ 658 struct inode * bd_inode; /* will die */
645 struct super_block * bd_super; 659 struct super_block * bd_super;
646 int bd_openers;
647 struct mutex bd_mutex; /* open/close mutex */ 660 struct mutex bd_mutex; /* open/close mutex */
648 struct list_head bd_inodes; 661 struct list_head bd_inodes;
649 void * bd_claiming; 662 void * bd_claiming;
650 void * bd_holder; 663 void * bd_holder;
651 int bd_holders; 664 int bd_holders;
665 bool bd_write_holder;
652#ifdef CONFIG_SYSFS 666#ifdef CONFIG_SYSFS
653 struct list_head bd_holder_list; 667 struct list_head bd_holder_disks;
654#endif 668#endif
655 struct block_device * bd_contains; 669 struct block_device * bd_contains;
656 unsigned bd_block_size; 670 unsigned bd_block_size;
@@ -719,15 +733,31 @@ struct posix_acl;
719#define ACL_NOT_CACHED ((void *)(-1)) 733#define ACL_NOT_CACHED ((void *)(-1))
720 734
721struct inode { 735struct inode {
736 /* RCU path lookup touches following: */
737 umode_t i_mode;
738 uid_t i_uid;
739 gid_t i_gid;
740 const struct inode_operations *i_op;
741 struct super_block *i_sb;
742
743 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
744 unsigned int i_flags;
745 struct mutex i_mutex;
746
747 unsigned long i_state;
748 unsigned long dirtied_when; /* jiffies of first dirtying */
749
722 struct hlist_node i_hash; 750 struct hlist_node i_hash;
723 struct list_head i_list; /* backing dev IO list */ 751 struct list_head i_wb_list; /* backing dev IO list */
752 struct list_head i_lru; /* inode LRU list */
724 struct list_head i_sb_list; 753 struct list_head i_sb_list;
725 struct list_head i_dentry; 754 union {
755 struct list_head i_dentry;
756 struct rcu_head i_rcu;
757 };
726 unsigned long i_ino; 758 unsigned long i_ino;
727 atomic_t i_count; 759 atomic_t i_count;
728 unsigned int i_nlink; 760 unsigned int i_nlink;
729 uid_t i_uid;
730 gid_t i_gid;
731 dev_t i_rdev; 761 dev_t i_rdev;
732 unsigned int i_blkbits; 762 unsigned int i_blkbits;
733 u64 i_version; 763 u64 i_version;
@@ -740,13 +770,8 @@ struct inode {
740 struct timespec i_ctime; 770 struct timespec i_ctime;
741 blkcnt_t i_blocks; 771 blkcnt_t i_blocks;
742 unsigned short i_bytes; 772 unsigned short i_bytes;
743 umode_t i_mode;
744 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
745 struct mutex i_mutex;
746 struct rw_semaphore i_alloc_sem; 773 struct rw_semaphore i_alloc_sem;
747 const struct inode_operations *i_op;
748 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 774 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
749 struct super_block *i_sb;
750 struct file_lock *i_flock; 775 struct file_lock *i_flock;
751 struct address_space *i_mapping; 776 struct address_space *i_mapping;
752 struct address_space i_data; 777 struct address_space i_data;
@@ -767,11 +792,9 @@ struct inode {
767 struct hlist_head i_fsnotify_marks; 792 struct hlist_head i_fsnotify_marks;
768#endif 793#endif
769 794
770 unsigned long i_state; 795#ifdef CONFIG_IMA
771 unsigned long dirtied_when; /* jiffies of first dirtying */ 796 atomic_t i_readcount; /* struct files open RO */
772 797#endif
773 unsigned int i_flags;
774
775 atomic_t i_writecount; 798 atomic_t i_writecount;
776#ifdef CONFIG_SECURITY 799#ifdef CONFIG_SECURITY
777 void *i_security; 800 void *i_security;
@@ -783,6 +806,11 @@ struct inode {
783 void *i_private; /* fs or device private pointer */ 806 void *i_private; /* fs or device private pointer */
784}; 807};
785 808
809static inline int inode_unhashed(struct inode *inode)
810{
811 return hlist_unhashed(&inode->i_hash);
812}
813
786/* 814/*
787 * inode->i_mutex nesting subclasses for the lock validator: 815 * inode->i_mutex nesting subclasses for the lock validator:
788 * 816 *
@@ -944,6 +972,13 @@ struct file {
944#endif 972#endif
945}; 973};
946 974
975struct file_handle {
976 __u32 handle_bytes;
977 int handle_type;
978 /* file identifier */
979 unsigned char f_handle[0];
980};
981
947#define get_file(x) atomic_long_inc(&(x)->f_count) 982#define get_file(x) atomic_long_inc(&(x)->f_count)
948#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 983#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
949#define file_count(x) atomic_long_read(&(x)->f_count) 984#define file_count(x) atomic_long_read(&(x)->f_count)
@@ -1033,10 +1068,8 @@ struct lock_manager_operations {
1033 int (*fl_compare_owner)(struct file_lock *, struct file_lock *); 1068 int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
1034 void (*fl_notify)(struct file_lock *); /* unblock callback */ 1069 void (*fl_notify)(struct file_lock *); /* unblock callback */
1035 int (*fl_grant)(struct file_lock *, struct file_lock *, int); 1070 int (*fl_grant)(struct file_lock *, struct file_lock *, int);
1036 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
1037 void (*fl_release_private)(struct file_lock *); 1071 void (*fl_release_private)(struct file_lock *);
1038 void (*fl_break)(struct file_lock *); 1072 void (*fl_break)(struct file_lock *);
1039 int (*fl_mylease)(struct file_lock *, struct file_lock *);
1040 int (*fl_change)(struct file_lock **, int); 1073 int (*fl_change)(struct file_lock **, int);
1041}; 1074};
1042 1075
@@ -1106,7 +1139,9 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
1106extern int fcntl_getlease(struct file *filp); 1139extern int fcntl_getlease(struct file *filp);
1107 1140
1108/* fs/locks.c */ 1141/* fs/locks.c */
1142void locks_free_lock(struct file_lock *fl);
1109extern void locks_init_lock(struct file_lock *); 1143extern void locks_init_lock(struct file_lock *);
1144extern struct file_lock * locks_alloc_lock(void);
1110extern void locks_copy_lock(struct file_lock *, struct file_lock *); 1145extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1111extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 1146extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
1112extern void locks_remove_posix(struct file *, fl_owner_t); 1147extern void locks_remove_posix(struct file *, fl_owner_t);
@@ -1295,6 +1330,11 @@ struct fasync_struct {
1295 1330
1296/* SMP safe fasync helpers: */ 1331/* SMP safe fasync helpers: */
1297extern int fasync_helper(int, struct file *, int, struct fasync_struct **); 1332extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1333extern struct fasync_struct *fasync_insert_entry(int, struct file *, struct fasync_struct **, struct fasync_struct *);
1334extern int fasync_remove_entry(struct file *, struct fasync_struct **);
1335extern struct fasync_struct *fasync_alloc(void);
1336extern void fasync_free(struct fasync_struct *);
1337
1298/* can be called from interrupts */ 1338/* can be called from interrupts */
1299extern void kill_fasync(struct fasync_struct **, int, int); 1339extern void kill_fasync(struct fasync_struct **, int, int);
1300 1340
@@ -1342,13 +1382,13 @@ struct super_block {
1342 const struct xattr_handler **s_xattr; 1382 const struct xattr_handler **s_xattr;
1343 1383
1344 struct list_head s_inodes; /* all inodes */ 1384 struct list_head s_inodes; /* all inodes */
1345 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1385 struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */
1346#ifdef CONFIG_SMP 1386#ifdef CONFIG_SMP
1347 struct list_head __percpu *s_files; 1387 struct list_head __percpu *s_files;
1348#else 1388#else
1349 struct list_head s_files; 1389 struct list_head s_files;
1350#endif 1390#endif
1351 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1391 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1352 struct list_head s_dentry_lru; /* unused dentry lru */ 1392 struct list_head s_dentry_lru; /* unused dentry lru */
1353 int s_nr_dentry_unused; /* # of dentry on lru */ 1393 int s_nr_dentry_unused; /* # of dentry on lru */
1354 1394
@@ -1362,6 +1402,7 @@ struct super_block {
1362 wait_queue_head_t s_wait_unfrozen; 1402 wait_queue_head_t s_wait_unfrozen;
1363 1403
1364 char s_id[32]; /* Informational name */ 1404 char s_id[32]; /* Informational name */
1405 u8 s_uuid[16]; /* UUID */
1365 1406
1366 void *s_fs_info; /* Filesystem private info */ 1407 void *s_fs_info; /* Filesystem private info */
1367 fmode_t s_mode; 1408 fmode_t s_mode;
@@ -1387,6 +1428,7 @@ struct super_block {
1387 * generic_show_options() 1428 * generic_show_options()
1388 */ 1429 */
1389 char __rcu *s_options; 1430 char __rcu *s_options;
1431 const struct dentry_operations *s_d_op; /* default d_op for dentries */
1390}; 1432};
1391 1433
1392extern struct timespec current_fs_time(struct super_block *sb); 1434extern struct timespec current_fs_time(struct super_block *sb);
@@ -1407,8 +1449,13 @@ enum {
1407#define put_fs_excl() atomic_dec(&current->fs_excl) 1449#define put_fs_excl() atomic_dec(&current->fs_excl)
1408#define has_fs_excl() atomic_read(&current->fs_excl) 1450#define has_fs_excl() atomic_read(&current->fs_excl)
1409 1451
1410#define is_owner_or_cap(inode) \ 1452/*
1411 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER)) 1453 * until VFS tracks user namespaces for inodes, just make all files
1454 * belong to init_user_ns
1455 */
1456extern struct user_namespace init_user_ns;
1457#define inode_userns(inode) (&init_user_ns)
1458extern bool inode_owner_or_capable(const struct inode *inode);
1412 1459
1413/* not quite ready to be deprecated, but... */ 1460/* not quite ready to be deprecated, but... */
1414extern void lock_super(struct super_block *); 1461extern void lock_super(struct super_block *);
@@ -1444,8 +1491,8 @@ struct fiemap_extent_info {
1444 unsigned int fi_flags; /* Flags as passed from user */ 1491 unsigned int fi_flags; /* Flags as passed from user */
1445 unsigned int fi_extents_mapped; /* Number of mapped extents */ 1492 unsigned int fi_extents_mapped; /* Number of mapped extents */
1446 unsigned int fi_extents_max; /* Size of fiemap_extent array */ 1493 unsigned int fi_extents_max; /* Size of fiemap_extent array */
1447 struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent 1494 struct fiemap_extent __user *fi_extents_start; /* Start of
1448 * array */ 1495 fiemap_extent array */
1449}; 1496};
1450int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, 1497int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
1451 u64 phys, u64 len, u32 flags); 1498 u64 phys, u64 len, u32 flags);
@@ -1513,11 +1560,22 @@ struct file_operations {
1513 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1560 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1514 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1561 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
1515 int (*setlease)(struct file *, long, struct file_lock **); 1562 int (*setlease)(struct file *, long, struct file_lock **);
1563 long (*fallocate)(struct file *file, int mode, loff_t offset,
1564 loff_t len);
1516}; 1565};
1517 1566
1567#define IPERM_FLAG_RCU 0x0001
1568
1518struct inode_operations { 1569struct inode_operations {
1519 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
1520 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1570 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1571 void * (*follow_link) (struct dentry *, struct nameidata *);
1572 int (*permission) (struct inode *, int, unsigned int);
1573 int (*check_acl)(struct inode *, int, unsigned int);
1574
1575 int (*readlink) (struct dentry *, char __user *,int);
1576 void (*put_link) (struct dentry *, struct nameidata *, void *);
1577
1578 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
1521 int (*link) (struct dentry *,struct inode *,struct dentry *); 1579 int (*link) (struct dentry *,struct inode *,struct dentry *);
1522 int (*unlink) (struct inode *,struct dentry *); 1580 int (*unlink) (struct inode *,struct dentry *);
1523 int (*symlink) (struct inode *,struct dentry *,const char *); 1581 int (*symlink) (struct inode *,struct dentry *,const char *);
@@ -1526,12 +1584,7 @@ struct inode_operations {
1526 int (*mknod) (struct inode *,struct dentry *,int,dev_t); 1584 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
1527 int (*rename) (struct inode *, struct dentry *, 1585 int (*rename) (struct inode *, struct dentry *,
1528 struct inode *, struct dentry *); 1586 struct inode *, struct dentry *);
1529 int (*readlink) (struct dentry *, char __user *,int);
1530 void * (*follow_link) (struct dentry *, struct nameidata *);
1531 void (*put_link) (struct dentry *, struct nameidata *, void *);
1532 void (*truncate) (struct inode *); 1587 void (*truncate) (struct inode *);
1533 int (*permission) (struct inode *, int);
1534 int (*check_acl)(struct inode *, int);
1535 int (*setattr) (struct dentry *, struct iattr *); 1588 int (*setattr) (struct dentry *, struct iattr *);
1536 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1589 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1537 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1590 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1539,11 +1592,9 @@ struct inode_operations {
1539 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1592 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1540 int (*removexattr) (struct dentry *, const char *); 1593 int (*removexattr) (struct dentry *, const char *);
1541 void (*truncate_range)(struct inode *, loff_t, loff_t); 1594 void (*truncate_range)(struct inode *, loff_t, loff_t);
1542 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1543 loff_t len);
1544 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, 1595 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1545 u64 len); 1596 u64 len);
1546}; 1597} ____cacheline_aligned;
1547 1598
1548struct seq_file; 1599struct seq_file;
1549 1600
@@ -1577,6 +1628,8 @@ struct super_operations {
1577 void (*umount_begin) (struct super_block *); 1628 void (*umount_begin) (struct super_block *);
1578 1629
1579 int (*show_options)(struct seq_file *, struct vfsmount *); 1630 int (*show_options)(struct seq_file *, struct vfsmount *);
1631 int (*show_devname)(struct seq_file *, struct vfsmount *);
1632 int (*show_path)(struct seq_file *, struct vfsmount *);
1580 int (*show_stats)(struct seq_file *, struct vfsmount *); 1633 int (*show_stats)(struct seq_file *, struct vfsmount *);
1581#ifdef CONFIG_QUOTA 1634#ifdef CONFIG_QUOTA
1582 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1635 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
@@ -1586,7 +1639,7 @@ struct super_operations {
1586}; 1639};
1587 1640
1588/* 1641/*
1589 * Inode state bits. Protected by inode_lock. 1642 * Inode state bits. Protected by inode->i_lock
1590 * 1643 *
1591 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1644 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1592 * I_DIRTY_DATASYNC and I_DIRTY_PAGES. 1645 * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
@@ -1633,16 +1686,17 @@ struct super_operations {
1633 * 1686 *
1634 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1687 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1635 */ 1688 */
1636#define I_DIRTY_SYNC 1 1689#define I_DIRTY_SYNC (1 << 0)
1637#define I_DIRTY_DATASYNC 2 1690#define I_DIRTY_DATASYNC (1 << 1)
1638#define I_DIRTY_PAGES 4 1691#define I_DIRTY_PAGES (1 << 2)
1639#define __I_NEW 3 1692#define __I_NEW 3
1640#define I_NEW (1 << __I_NEW) 1693#define I_NEW (1 << __I_NEW)
1641#define I_WILL_FREE 16 1694#define I_WILL_FREE (1 << 4)
1642#define I_FREEING 32 1695#define I_FREEING (1 << 5)
1643#define I_CLEAR 64 1696#define I_CLEAR (1 << 6)
1644#define __I_SYNC 7 1697#define __I_SYNC 7
1645#define I_SYNC (1 << __I_SYNC) 1698#define I_SYNC (1 << __I_SYNC)
1699#define I_REFERENCED (1 << 8)
1646 1700
1647#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1701#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1648 1702
@@ -1734,12 +1788,13 @@ static inline void file_accessed(struct file *file)
1734} 1788}
1735 1789
1736int sync_inode(struct inode *inode, struct writeback_control *wbc); 1790int sync_inode(struct inode *inode, struct writeback_control *wbc);
1791int sync_inode_metadata(struct inode *inode, int wait);
1737 1792
1738struct file_system_type { 1793struct file_system_type {
1739 const char *name; 1794 const char *name;
1740 int fs_flags; 1795 int fs_flags;
1741 int (*get_sb) (struct file_system_type *, int, 1796 struct dentry *(*mount) (struct file_system_type *, int,
1742 const char *, void *, struct vfsmount *); 1797 const char *, void *);
1743 void (*kill_sb) (struct super_block *); 1798 void (*kill_sb) (struct super_block *);
1744 struct module *owner; 1799 struct module *owner;
1745 struct file_system_type * next; 1800 struct file_system_type * next;
@@ -1755,21 +1810,17 @@ struct file_system_type {
1755 struct lock_class_key i_alloc_sem_key; 1810 struct lock_class_key i_alloc_sem_key;
1756}; 1811};
1757 1812
1758extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data, 1813extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
1759 int (*fill_super)(struct super_block *, void *, int), 1814 void *data, int (*fill_super)(struct super_block *, void *, int));
1760 struct vfsmount *mnt); 1815extern struct dentry *mount_bdev(struct file_system_type *fs_type,
1761extern int get_sb_bdev(struct file_system_type *fs_type,
1762 int flags, const char *dev_name, void *data, 1816 int flags, const char *dev_name, void *data,
1763 int (*fill_super)(struct super_block *, void *, int), 1817 int (*fill_super)(struct super_block *, void *, int));
1764 struct vfsmount *mnt); 1818extern struct dentry *mount_single(struct file_system_type *fs_type,
1765extern int get_sb_single(struct file_system_type *fs_type,
1766 int flags, void *data, 1819 int flags, void *data,
1767 int (*fill_super)(struct super_block *, void *, int), 1820 int (*fill_super)(struct super_block *, void *, int));
1768 struct vfsmount *mnt); 1821extern struct dentry *mount_nodev(struct file_system_type *fs_type,
1769extern int get_sb_nodev(struct file_system_type *fs_type,
1770 int flags, void *data, 1822 int flags, void *data,
1771 int (*fill_super)(struct super_block *, void *, int), 1823 int (*fill_super)(struct super_block *, void *, int));
1772 struct vfsmount *mnt);
1773void generic_shutdown_super(struct super_block *sb); 1824void generic_shutdown_super(struct super_block *sb);
1774void kill_block_super(struct super_block *sb); 1825void kill_block_super(struct super_block *sb);
1775void kill_anon_super(struct super_block *sb); 1826void kill_anon_super(struct super_block *sb);
@@ -1781,10 +1832,10 @@ struct super_block *sget(struct file_system_type *type,
1781 int (*test)(struct super_block *,void *), 1832 int (*test)(struct super_block *,void *),
1782 int (*set)(struct super_block *,void *), 1833 int (*set)(struct super_block *,void *),
1783 void *data); 1834 void *data);
1784extern int get_sb_pseudo(struct file_system_type *, char *, 1835extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1785 const struct super_operations *ops, unsigned long, 1836 const struct super_operations *ops,
1786 struct vfsmount *mnt); 1837 const struct dentry_operations *dops,
1787extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1838 unsigned long);
1788 1839
1789static inline void sb_mark_dirty(struct super_block *sb) 1840static inline void sb_mark_dirty(struct super_block *sb)
1790{ 1841{
@@ -1817,6 +1868,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1817extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1868extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1818 struct vfsmount *); 1869 struct vfsmount *);
1819extern int vfs_statfs(struct path *, struct kstatfs *); 1870extern int vfs_statfs(struct path *, struct kstatfs *);
1871extern int user_statfs(const char __user *, struct kstatfs *);
1872extern int fd_statfs(int, struct kstatfs *);
1820extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1873extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1821extern int freeze_super(struct super_block *super); 1874extern int freeze_super(struct super_block *super);
1822extern int thaw_super(struct super_block *super); 1875extern int thaw_super(struct super_block *super);
@@ -1826,6 +1879,7 @@ extern int current_umask(void);
1826/* /sys/fs */ 1879/* /sys/fs */
1827extern struct kobject *fs_kobj; 1880extern struct kobject *fs_kobj;
1828 1881
1882#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
1829extern int rw_verify_area(int, struct file *, loff_t *, size_t); 1883extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1830 1884
1831#define FLOCK_VERIFY_READ 1 1885#define FLOCK_VERIFY_READ 1
@@ -1932,6 +1986,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset,
1932extern long do_sys_open(int dfd, const char __user *filename, int flags, 1986extern long do_sys_open(int dfd, const char __user *filename, int flags,
1933 int mode); 1987 int mode);
1934extern struct file *filp_open(const char *, int, int); 1988extern struct file *filp_open(const char *, int, int);
1989extern struct file *file_open_root(struct dentry *, struct vfsmount *,
1990 const char *, int);
1935extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 1991extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1936 const struct cred *); 1992 const struct cred *);
1937extern int filp_close(struct file *, fl_owner_t id); 1993extern int filp_close(struct file *, fl_owner_t id);
@@ -1964,7 +2020,6 @@ extern struct block_device *bdgrab(struct block_device *bdev);
1964extern void bd_set_size(struct block_device *, loff_t size); 2020extern void bd_set_size(struct block_device *, loff_t size);
1965extern void bd_forget(struct inode *inode); 2021extern void bd_forget(struct inode *inode);
1966extern void bdput(struct block_device *); 2022extern void bdput(struct block_device *);
1967extern struct block_device *open_by_devnum(dev_t, fmode_t);
1968extern void invalidate_bdev(struct block_device *); 2023extern void invalidate_bdev(struct block_device *);
1969extern int sync_blockdev(struct block_device *bdev); 2024extern int sync_blockdev(struct block_device *bdev);
1970extern struct super_block *freeze_bdev(struct block_device *); 2025extern struct super_block *freeze_bdev(struct block_device *);
@@ -1995,16 +2050,26 @@ extern const struct file_operations def_fifo_fops;
1995extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 2050extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1996extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); 2051extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
1997extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 2052extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1998extern int blkdev_get(struct block_device *, fmode_t); 2053extern int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder);
1999extern int blkdev_put(struct block_device *, fmode_t); 2054extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
2000extern int bd_claim(struct block_device *, void *); 2055 void *holder);
2001extern void bd_release(struct block_device *); 2056extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
2057 void *holder);
2058extern int blkdev_put(struct block_device *bdev, fmode_t mode);
2002#ifdef CONFIG_SYSFS 2059#ifdef CONFIG_SYSFS
2003extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *); 2060extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
2004extern void bd_release_from_disk(struct block_device *, struct gendisk *); 2061extern void bd_unlink_disk_holder(struct block_device *bdev,
2062 struct gendisk *disk);
2005#else 2063#else
2006#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder) 2064static inline int bd_link_disk_holder(struct block_device *bdev,
2007#define bd_release_from_disk(bdev, disk) bd_release(bdev) 2065 struct gendisk *disk)
2066{
2067 return 0;
2068}
2069static inline void bd_unlink_disk_holder(struct block_device *bdev,
2070 struct gendisk *disk)
2071{
2072}
2008#endif 2073#endif
2009#endif 2074#endif
2010 2075
@@ -2040,8 +2105,6 @@ static inline void unregister_chrdev(unsigned int major, const char *name)
2040extern const char *__bdevname(dev_t, char *buffer); 2105extern const char *__bdevname(dev_t, char *buffer);
2041extern const char *bdevname(struct block_device *bdev, char *buffer); 2106extern const char *bdevname(struct block_device *bdev, char *buffer);
2042extern struct block_device *lookup_bdev(const char *); 2107extern struct block_device *lookup_bdev(const char *);
2043extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *);
2044extern void close_bdev_exclusive(struct block_device *, fmode_t);
2045extern void blkdev_show(struct seq_file *,off_t); 2108extern void blkdev_show(struct seq_file *,off_t);
2046 2109
2047#else 2110#else
@@ -2075,10 +2138,9 @@ extern void check_disk_size_change(struct gendisk *disk,
2075 struct block_device *bdev); 2138 struct block_device *bdev);
2076extern int revalidate_disk(struct gendisk *); 2139extern int revalidate_disk(struct gendisk *);
2077extern int check_disk_change(struct block_device *); 2140extern int check_disk_change(struct block_device *);
2078extern int __invalidate_device(struct block_device *); 2141extern int __invalidate_device(struct block_device *, bool);
2079extern int invalidate_partition(struct gendisk *, int); 2142extern int invalidate_partition(struct gendisk *, int);
2080#endif 2143#endif
2081extern int invalidate_inodes(struct super_block *);
2082unsigned long invalidate_mapping_pages(struct address_space *mapping, 2144unsigned long invalidate_mapping_pages(struct address_space *mapping,
2083 pgoff_t start, pgoff_t end); 2145 pgoff_t start, pgoff_t end);
2084 2146
@@ -2117,8 +2179,8 @@ extern sector_t bmap(struct inode *, sector_t);
2117#endif 2179#endif
2118extern int notify_change(struct dentry *, struct iattr *); 2180extern int notify_change(struct dentry *, struct iattr *);
2119extern int inode_permission(struct inode *, int); 2181extern int inode_permission(struct inode *, int);
2120extern int generic_permission(struct inode *, int, 2182extern int generic_permission(struct inode *, int, unsigned int,
2121 int (*check_acl)(struct inode *, int)); 2183 int (*check_acl)(struct inode *, int, unsigned int));
2122 2184
2123static inline bool execute_ok(struct inode *inode) 2185static inline bool execute_ok(struct inode *inode)
2124{ 2186{
@@ -2136,15 +2198,31 @@ static inline void allow_write_access(struct file *file)
2136 if (file) 2198 if (file)
2137 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2199 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
2138} 2200}
2201#ifdef CONFIG_IMA
2202static inline void i_readcount_dec(struct inode *inode)
2203{
2204 BUG_ON(!atomic_read(&inode->i_readcount));
2205 atomic_dec(&inode->i_readcount);
2206}
2207static inline void i_readcount_inc(struct inode *inode)
2208{
2209 atomic_inc(&inode->i_readcount);
2210}
2211#else
2212static inline void i_readcount_dec(struct inode *inode)
2213{
2214 return;
2215}
2216static inline void i_readcount_inc(struct inode *inode)
2217{
2218 return;
2219}
2220#endif
2139extern int do_pipe_flags(int *, int); 2221extern int do_pipe_flags(int *, int);
2140extern struct file *create_read_pipe(struct file *f, int flags); 2222extern struct file *create_read_pipe(struct file *f, int flags);
2141extern struct file *create_write_pipe(int flags); 2223extern struct file *create_write_pipe(int flags);
2142extern void free_write_pipe(struct file *); 2224extern void free_write_pipe(struct file *);
2143 2225
2144extern struct file *do_filp_open(int dfd, const char *pathname,
2145 int open_flag, int mode, int acc_mode);
2146extern int may_open(struct path *, int, int);
2147
2148extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2226extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2149extern struct file * open_exec(const char *); 2227extern struct file * open_exec(const char *);
2150 2228
@@ -2162,7 +2240,8 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
2162 2240
2163extern int inode_init_always(struct super_block *, struct inode *); 2241extern int inode_init_always(struct super_block *, struct inode *);
2164extern void inode_init_once(struct inode *); 2242extern void inode_init_once(struct inode *);
2165extern void inode_add_to_lists(struct super_block *, struct inode *); 2243extern void address_space_init_once(struct address_space *mapping);
2244extern void ihold(struct inode * inode);
2166extern void iput(struct inode *); 2245extern void iput(struct inode *);
2167extern struct inode * igrab(struct inode *); 2246extern struct inode * igrab(struct inode *);
2168extern ino_t iunique(struct super_block *, ino_t); 2247extern ino_t iunique(struct super_block *, ino_t);
@@ -2182,21 +2261,24 @@ extern struct inode * iget_locked(struct super_block *, unsigned long);
2182extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); 2261extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *);
2183extern int insert_inode_locked(struct inode *); 2262extern int insert_inode_locked(struct inode *);
2184extern void unlock_new_inode(struct inode *); 2263extern void unlock_new_inode(struct inode *);
2264extern unsigned int get_next_ino(void);
2185 2265
2186extern void __iget(struct inode * inode); 2266extern void __iget(struct inode * inode);
2187extern void iget_failed(struct inode *); 2267extern void iget_failed(struct inode *);
2188extern void end_writeback(struct inode *); 2268extern void end_writeback(struct inode *);
2189extern void destroy_inode(struct inode *);
2190extern void __destroy_inode(struct inode *); 2269extern void __destroy_inode(struct inode *);
2191extern struct inode *new_inode(struct super_block *); 2270extern struct inode *new_inode(struct super_block *);
2271extern void free_inode_nonrcu(struct inode *inode);
2192extern int should_remove_suid(struct dentry *); 2272extern int should_remove_suid(struct dentry *);
2193extern int file_remove_suid(struct file *); 2273extern int file_remove_suid(struct file *);
2194 2274
2195extern void __insert_inode_hash(struct inode *, unsigned long hashval); 2275extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2196extern void remove_inode_hash(struct inode *); 2276extern void remove_inode_hash(struct inode *);
2197static inline void insert_inode_hash(struct inode *inode) { 2277static inline void insert_inode_hash(struct inode *inode)
2278{
2198 __insert_inode_hash(inode, inode->i_ino); 2279 __insert_inode_hash(inode, inode->i_ino);
2199} 2280}
2281extern void inode_sb_list_add(struct inode *inode);
2200 2282
2201#ifdef CONFIG_BLOCK 2283#ifdef CONFIG_BLOCK
2202extern void submit_bio(int, struct bio *); 2284extern void submit_bio(int, struct bio *);
@@ -2403,6 +2485,10 @@ static inline ino_t parent_ino(struct dentry *dentry)
2403{ 2485{
2404 ino_t res; 2486 ino_t res;
2405 2487
2488 /*
2489 * Don't strictly need d_lock here? If the parent ino could change
2490 * then surely we'd have a deeper race in the caller?
2491 */
2406 spin_lock(&dentry->d_lock); 2492 spin_lock(&dentry->d_lock);
2407 res = dentry->d_parent->d_inode->i_ino; 2493 res = dentry->d_parent->d_inode->i_ino;
2408 spin_unlock(&dentry->d_lock); 2494 spin_unlock(&dentry->d_lock);
@@ -2479,12 +2565,18 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
2479struct ctl_table; 2565struct ctl_table;
2480int proc_nr_files(struct ctl_table *table, int write, 2566int proc_nr_files(struct ctl_table *table, int write,
2481 void __user *buffer, size_t *lenp, loff_t *ppos); 2567 void __user *buffer, size_t *lenp, loff_t *ppos);
2482 2568int proc_nr_dentry(struct ctl_table *table, int write,
2569 void __user *buffer, size_t *lenp, loff_t *ppos);
2570int proc_nr_inodes(struct ctl_table *table, int write,
2571 void __user *buffer, size_t *lenp, loff_t *ppos);
2483int __init get_filesystem_list(char *buf); 2572int __init get_filesystem_list(char *buf);
2484 2573
2574#define __FMODE_EXEC ((__force int) FMODE_EXEC)
2575#define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY)
2576
2485#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2577#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2486#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \ 2578#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2487 (flag & FMODE_NONOTIFY))) 2579 (flag & __FMODE_NONOTIFY)))
2488 2580
2489#endif /* __KERNEL__ */ 2581#endif /* __KERNEL__ */
2490#endif /* _LINUX_FS_H */ 2582#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index a42b5bf02f8b..003dc0fd7347 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -2,10 +2,13 @@
2#define _LINUX_FS_STRUCT_H 2#define _LINUX_FS_STRUCT_H
3 3
4#include <linux/path.h> 4#include <linux/path.h>
5#include <linux/spinlock.h>
6#include <linux/seqlock.h>
5 7
6struct fs_struct { 8struct fs_struct {
7 int users; 9 int users;
8 spinlock_t lock; 10 spinlock_t lock;
11 seqcount_t seq;
9 int umask; 12 int umask;
10 int in_exec; 13 int in_exec;
11 struct path root, pwd; 14 struct path root, pwd;
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index b8581c09d19f..76427e688d15 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -236,7 +236,7 @@ struct fscache_cache_ops {
236 /* unpin an object in the cache */ 236 /* unpin an object in the cache */
237 void (*unpin_object)(struct fscache_object *object); 237 void (*unpin_object)(struct fscache_object *object);
238 238
239 /* store the updated auxilliary data on an object */ 239 /* store the updated auxiliary data on an object */
240 void (*update_object)(struct fscache_object *object); 240 void (*update_object)(struct fscache_object *object);
241 241
242 /* discard the resources pinned by an object and effect retirement if 242 /* discard the resources pinned by an object and effect retirement if
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index ec0dad5ab90f..7c4d72f5581f 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -102,9 +102,9 @@ struct fscache_cookie_def {
102 */ 102 */
103 void (*get_attr)(const void *cookie_netfs_data, uint64_t *size); 103 void (*get_attr)(const void *cookie_netfs_data, uint64_t *size);
104 104
105 /* get the auxilliary data from netfs data 105 /* get the auxiliary data from netfs data
106 * - this function can be absent if the index carries no state data 106 * - this function can be absent if the index carries no state data
107 * - should store the auxilliary data in the buffer 107 * - should store the auxiliary data in the buffer
108 * - should return the amount of amount stored 108 * - should return the amount of amount stored
109 * - not permitted to return an error 109 * - not permitted to return an error
110 * - the netfs data from the cookie being used as the source is 110 * - the netfs data from the cookie being used as the source is
@@ -117,7 +117,7 @@ struct fscache_cookie_def {
117 /* consult the netfs about the state of an object 117 /* consult the netfs about the state of an object
118 * - this function can be absent if the index carries no state data 118 * - this function can be absent if the index carries no state data
119 * - the netfs data from the cookie being used as the target is 119 * - the netfs data from the cookie being used as the target is
120 * presented, as is the auxilliary data 120 * presented, as is the auxiliary data
121 */ 121 */
122 enum fscache_checkaux (*check_aux)(void *cookie_netfs_data, 122 enum fscache_checkaux (*check_aux)(void *cookie_netfs_data,
123 const void *data, 123 const void *data,
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
index fc295d7ea463..781d4671415f 100644
--- a/include/linux/fsl-diu-fb.h
+++ b/include/linux/fsl-diu-fb.h
@@ -54,7 +54,6 @@ struct aoi_display_offset {
54}; 54};
55 55
56#define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key) 56#define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
57#define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t)
58#define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8) 57#define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
59 58
60#define MFB_SET_ALPHA 0x80014d00 59#define MFB_SET_ALPHA 0x80014d00
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 59d0df43ff9d..2a53f10712b3 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -17,7 +17,6 @@
17 17
18/* 18/*
19 * fsnotify_d_instantiate - instantiate a dentry for inode 19 * fsnotify_d_instantiate - instantiate a dentry for inode
20 * Called with dcache_lock held.
21 */ 20 */
22static inline void fsnotify_d_instantiate(struct dentry *dentry, 21static inline void fsnotify_d_instantiate(struct dentry *dentry,
23 struct inode *inode) 22 struct inode *inode)
@@ -26,12 +25,12 @@ static inline void fsnotify_d_instantiate(struct dentry *dentry,
26} 25}
27 26
28/* Notify this dentry's parent about a child's events. */ 27/* Notify this dentry's parent about a child's events. */
29static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) 28static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
30{ 29{
31 if (!dentry) 30 if (!dentry)
32 dentry = path->dentry; 31 dentry = path->dentry;
33 32
34 __fsnotify_parent(path, dentry, mask); 33 return __fsnotify_parent(path, dentry, mask);
35} 34}
36 35
37/* simple call site for access decisions */ 36/* simple call site for access decisions */
@@ -40,6 +39,7 @@ static inline int fsnotify_perm(struct file *file, int mask)
40 struct path *path = &file->f_path; 39 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode; 40 struct inode *inode = path->dentry->d_inode;
42 __u32 fsnotify_mask = 0; 41 __u32 fsnotify_mask = 0;
42 int ret;
43 43
44 if (file->f_mode & FMODE_NONOTIFY) 44 if (file->f_mode & FMODE_NONOTIFY)
45 return 0; 45 return 0;
@@ -52,12 +52,15 @@ static inline int fsnotify_perm(struct file *file, int mask)
52 else 52 else
53 BUG(); 53 BUG();
54 54
55 ret = fsnotify_parent(path, NULL, fsnotify_mask);
56 if (ret)
57 return ret;
58
55 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0); 59 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
56} 60}
57 61
58/* 62/*
59 * fsnotify_d_move - dentry has been moved 63 * fsnotify_d_move - dentry has been moved
60 * Called with dcache_lock and dentry->d_lock held.
61 */ 64 */
62static inline void fsnotify_d_move(struct dentry *dentry) 65static inline void fsnotify_d_move(struct dentry *dentry)
63{ 66{
@@ -93,8 +96,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
93 old_dir_mask |= FS_DN_RENAME; 96 old_dir_mask |= FS_DN_RENAME;
94 97
95 if (isdir) { 98 if (isdir) {
96 old_dir_mask |= FS_IN_ISDIR; 99 old_dir_mask |= FS_ISDIR;
97 new_dir_mask |= FS_IN_ISDIR; 100 new_dir_mask |= FS_ISDIR;
98 } 101 }
99 102
100 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); 103 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
@@ -132,7 +135,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
132 __u32 mask = FS_DELETE; 135 __u32 mask = FS_DELETE;
133 136
134 if (isdir) 137 if (isdir)
135 mask |= FS_IN_ISDIR; 138 mask |= FS_ISDIR;
136 139
137 fsnotify_parent(NULL, dentry, mask); 140 fsnotify_parent(NULL, dentry, mask);
138} 141}
@@ -174,7 +177,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
174 */ 177 */
175static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) 178static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176{ 179{
177 __u32 mask = (FS_CREATE | FS_IN_ISDIR); 180 __u32 mask = (FS_CREATE | FS_ISDIR);
178 struct inode *d_inode = dentry->d_inode; 181 struct inode *d_inode = dentry->d_inode;
179 182
180 audit_inode_child(dentry, inode); 183 audit_inode_child(dentry, inode);
@@ -192,7 +195,7 @@ static inline void fsnotify_access(struct file *file)
192 __u32 mask = FS_ACCESS; 195 __u32 mask = FS_ACCESS;
193 196
194 if (S_ISDIR(inode->i_mode)) 197 if (S_ISDIR(inode->i_mode))
195 mask |= FS_IN_ISDIR; 198 mask |= FS_ISDIR;
196 199
197 if (!(file->f_mode & FMODE_NONOTIFY)) { 200 if (!(file->f_mode & FMODE_NONOTIFY)) {
198 fsnotify_parent(path, NULL, mask); 201 fsnotify_parent(path, NULL, mask);
@@ -210,7 +213,7 @@ static inline void fsnotify_modify(struct file *file)
210 __u32 mask = FS_MODIFY; 213 __u32 mask = FS_MODIFY;
211 214
212 if (S_ISDIR(inode->i_mode)) 215 if (S_ISDIR(inode->i_mode))
213 mask |= FS_IN_ISDIR; 216 mask |= FS_ISDIR;
214 217
215 if (!(file->f_mode & FMODE_NONOTIFY)) { 218 if (!(file->f_mode & FMODE_NONOTIFY)) {
216 fsnotify_parent(path, NULL, mask); 219 fsnotify_parent(path, NULL, mask);
@@ -228,12 +231,10 @@ static inline void fsnotify_open(struct file *file)
228 __u32 mask = FS_OPEN; 231 __u32 mask = FS_OPEN;
229 232
230 if (S_ISDIR(inode->i_mode)) 233 if (S_ISDIR(inode->i_mode))
231 mask |= FS_IN_ISDIR; 234 mask |= FS_ISDIR;
232 235
233 if (!(file->f_mode & FMODE_NONOTIFY)) { 236 fsnotify_parent(path, NULL, mask);
234 fsnotify_parent(path, NULL, mask); 237 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
235 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
236 }
237} 238}
238 239
239/* 240/*
@@ -247,7 +248,7 @@ static inline void fsnotify_close(struct file *file)
247 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 248 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
248 249
249 if (S_ISDIR(inode->i_mode)) 250 if (S_ISDIR(inode->i_mode))
250 mask |= FS_IN_ISDIR; 251 mask |= FS_ISDIR;
251 252
252 if (!(file->f_mode & FMODE_NONOTIFY)) { 253 if (!(file->f_mode & FMODE_NONOTIFY)) {
253 fsnotify_parent(path, NULL, mask); 254 fsnotify_parent(path, NULL, mask);
@@ -264,7 +265,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
264 __u32 mask = FS_ATTRIB; 265 __u32 mask = FS_ATTRIB;
265 266
266 if (S_ISDIR(inode->i_mode)) 267 if (S_ISDIR(inode->i_mode))
267 mask |= FS_IN_ISDIR; 268 mask |= FS_ISDIR;
268 269
269 fsnotify_parent(NULL, dentry, mask); 270 fsnotify_parent(NULL, dentry, mask);
270 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 271 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
@@ -299,7 +300,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
299 300
300 if (mask) { 301 if (mask) {
301 if (S_ISDIR(inode->i_mode)) 302 if (S_ISDIR(inode->i_mode))
302 mask |= FS_IN_ISDIR; 303 mask |= FS_ISDIR;
303 304
304 fsnotify_parent(NULL, dentry, mask); 305 fsnotify_parent(NULL, dentry, mask);
305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 306 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index e40190d16878..69ad89b50489 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -45,7 +45,7 @@
45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */ 45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
46 46
47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */ 47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
48#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */ 48#define FS_ISDIR 0x40000000 /* event occurred against dir */
49#define FS_IN_ONESHOT 0x80000000 /* only send event once */ 49#define FS_IN_ONESHOT 0x80000000 /* only send event once */
50 50
51#define FS_DN_RENAME 0x10000000 /* file renamed */ 51#define FS_DN_RENAME 0x10000000 /* file renamed */
@@ -64,13 +64,15 @@
64 64
65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) 65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
66 66
67#define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM)
68
67#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ 69#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
68 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \ 70 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
69 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \ 71 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
70 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \ 72 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
71 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ 73 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
72 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \ 74 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
73 FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \ 75 FS_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
74 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD) 76 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
75 77
76struct fsnotify_group; 78struct fsnotify_group;
@@ -129,6 +131,14 @@ struct fsnotify_group {
129 wait_queue_head_t notification_waitq; /* read() on the notification file blocks on this waitq */ 131 wait_queue_head_t notification_waitq; /* read() on the notification file blocks on this waitq */
130 unsigned int q_len; /* events on the queue */ 132 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */ 133 unsigned int max_events; /* maximum events allowed on the list */
134 /*
135 * Valid fsnotify group priorities. Events are send in order from highest
136 * priority to lowest priority. We default to the lowest priority.
137 */
138 #define FS_PRIO_0 0 /* normal notifiers, no permissions */
139 #define FS_PRIO_1 1 /* fanotify content based access control */
140 #define FS_PRIO_2 2 /* fanotify pre-content access */
141 unsigned int priority;
132 142
133 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ 143 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect marks_list */ 144 spinlock_t mark_lock; /* protect marks_list */
@@ -156,9 +166,11 @@ struct fsnotify_group {
156 struct mutex access_mutex; 166 struct mutex access_mutex;
157 struct list_head access_list; 167 struct list_head access_list;
158 wait_queue_head_t access_waitq; 168 wait_queue_head_t access_waitq;
159 bool bypass_perm; /* protected by access_mutex */ 169 atomic_t bypass_perm;
160#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ 170#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
161 int f_flags; 171 int f_flags;
172 unsigned int max_marks;
173 struct user_struct *user;
162 } fanotify_data; 174 } fanotify_data;
163#endif /* CONFIG_FANOTIFY */ 175#endif /* CONFIG_FANOTIFY */
164 }; 176 };
@@ -275,8 +287,8 @@ struct fsnotify_mark {
275 struct fsnotify_inode_mark i; 287 struct fsnotify_inode_mark i;
276 struct fsnotify_vfsmount_mark m; 288 struct fsnotify_vfsmount_mark m;
277 }; 289 };
278 __u32 ignored_mask; /* events types to ignore */
279 struct list_head free_g_list; /* tmp list used when freeing this mark */ 290 struct list_head free_g_list; /* tmp list used when freeing this mark */
291 __u32 ignored_mask; /* events types to ignore */
280#define FSNOTIFY_MARK_FLAG_INODE 0x01 292#define FSNOTIFY_MARK_FLAG_INODE 0x01
281#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02 293#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
282#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04 294#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
@@ -294,7 +306,7 @@ struct fsnotify_mark {
294/* main fsnotify call to send events */ 306/* main fsnotify call to send events */
295extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 307extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
296 const unsigned char *name, u32 cookie); 308 const unsigned char *name, u32 cookie);
297extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); 309extern int __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask);
298extern void __fsnotify_inode_delete(struct inode *inode); 310extern void __fsnotify_inode_delete(struct inode *inode);
299extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); 311extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
300extern u32 fsnotify_get_cookie(void); 312extern u32 fsnotify_get_cookie(void);
@@ -317,9 +329,15 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
317{ 329{
318 struct dentry *parent; 330 struct dentry *parent;
319 331
320 assert_spin_locked(&dcache_lock);
321 assert_spin_locked(&dentry->d_lock); 332 assert_spin_locked(&dentry->d_lock);
322 333
334 /*
335 * Serialisation of setting PARENT_WATCHED on the dentries is provided
336 * by d_lock. If inotify_inode_watched changes after we have taken
337 * d_lock, the following __fsnotify_update_child_dentry_flags call will
338 * find our entry, so it will spin until we complete here, and update
339 * us with the new state.
340 */
323 parent = dentry->d_parent; 341 parent = dentry->d_parent;
324 if (parent->d_inode && fsnotify_inode_watches_children(parent->d_inode)) 342 if (parent->d_inode && fsnotify_inode_watches_children(parent->d_inode))
325 dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; 343 dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED;
@@ -329,15 +347,12 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
329 347
330/* 348/*
331 * fsnotify_d_instantiate - instantiate a dentry for inode 349 * fsnotify_d_instantiate - instantiate a dentry for inode
332 * Called with dcache_lock held.
333 */ 350 */
334static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode) 351static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode)
335{ 352{
336 if (!inode) 353 if (!inode)
337 return; 354 return;
338 355
339 assert_spin_locked(&dcache_lock);
340
341 spin_lock(&dentry->d_lock); 356 spin_lock(&dentry->d_lock);
342 __fsnotify_update_dcache_flags(dentry); 357 __fsnotify_update_dcache_flags(dentry);
343 spin_unlock(&dentry->d_lock); 358 spin_unlock(&dentry->d_lock);
@@ -423,8 +438,10 @@ static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int da
423 return 0; 438 return 0;
424} 439}
425 440
426static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) 441static inline int __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
427{} 442{
443 return 0;
444}
428 445
429static inline void __fsnotify_inode_delete(struct inode *inode) 446static inline void __fsnotify_inode_delete(struct inode *inode)
430{} 447{}
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index dcd6a7c3a435..9d88e1cb5dbb 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -29,9 +29,22 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
29 29
30typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 30typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
31 31
32struct ftrace_hash;
33
34enum {
35 FTRACE_OPS_FL_ENABLED = 1 << 0,
36 FTRACE_OPS_FL_GLOBAL = 1 << 1,
37 FTRACE_OPS_FL_DYNAMIC = 1 << 2,
38};
39
32struct ftrace_ops { 40struct ftrace_ops {
33 ftrace_func_t func; 41 ftrace_func_t func;
34 struct ftrace_ops *next; 42 struct ftrace_ops *next;
43 unsigned long flags;
44#ifdef CONFIG_DYNAMIC_FTRACE
45 struct ftrace_hash *notrace_hash;
46 struct ftrace_hash *filter_hash;
47#endif
35}; 48};
36 49
37extern int function_trace_stop; 50extern int function_trace_stop;
@@ -146,14 +159,13 @@ extern void unregister_ftrace_function_probe_all(char *glob);
146extern int ftrace_text_reserved(void *start, void *end); 159extern int ftrace_text_reserved(void *start, void *end);
147 160
148enum { 161enum {
149 FTRACE_FL_FREE = (1 << 0), 162 FTRACE_FL_ENABLED = (1 << 30),
150 FTRACE_FL_FAILED = (1 << 1), 163 FTRACE_FL_FREE = (1 << 31),
151 FTRACE_FL_FILTER = (1 << 2),
152 FTRACE_FL_ENABLED = (1 << 3),
153 FTRACE_FL_NOTRACE = (1 << 4),
154 FTRACE_FL_CONVERTED = (1 << 5),
155}; 164};
156 165
166#define FTRACE_FL_MASK (0x3UL << 30)
167#define FTRACE_REF_MAX ((1 << 30) - 1)
168
157struct dyn_ftrace { 169struct dyn_ftrace {
158 union { 170 union {
159 unsigned long ip; /* address of mcount call-site */ 171 unsigned long ip; /* address of mcount call-site */
@@ -167,7 +179,12 @@ struct dyn_ftrace {
167}; 179};
168 180
169int ftrace_force_update(void); 181int ftrace_force_update(void);
170void ftrace_set_filter(unsigned char *buf, int len, int reset); 182void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
183 int len, int reset);
184void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
185 int len, int reset);
186void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
187void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
171 188
172int register_ftrace_command(struct ftrace_func_command *cmd); 189int register_ftrace_command(struct ftrace_func_command *cmd);
173int unregister_ftrace_command(struct ftrace_func_command *cmd); 190int unregister_ftrace_command(struct ftrace_func_command *cmd);
@@ -428,6 +445,7 @@ extern void unregister_ftrace_graph(void);
428 445
429extern void ftrace_graph_init_task(struct task_struct *t); 446extern void ftrace_graph_init_task(struct task_struct *t);
430extern void ftrace_graph_exit_task(struct task_struct *t); 447extern void ftrace_graph_exit_task(struct task_struct *t);
448extern void ftrace_graph_init_idle_task(struct task_struct *t, int cpu);
431 449
432static inline int task_curr_ret_stack(struct task_struct *t) 450static inline int task_curr_ret_stack(struct task_struct *t)
433{ 451{
@@ -451,6 +469,7 @@ static inline void unpause_graph_tracing(void)
451 469
452static inline void ftrace_graph_init_task(struct task_struct *t) { } 470static inline void ftrace_graph_init_task(struct task_struct *t) { }
453static inline void ftrace_graph_exit_task(struct task_struct *t) { } 471static inline void ftrace_graph_exit_task(struct task_struct *t) { }
472static inline void ftrace_graph_init_idle_task(struct task_struct *t, int cpu) { }
454 473
455static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, 474static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
456 trace_func_graph_ent_t entryfunc) 475 trace_func_graph_ent_t entryfunc)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 8beabb958f61..b5a550a39a70 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -37,7 +37,7 @@ struct trace_entry {
37 unsigned char flags; 37 unsigned char flags;
38 unsigned char preempt_count; 38 unsigned char preempt_count;
39 int pid; 39 int pid;
40 int lock_depth; 40 int padding;
41}; 41};
42 42
43#define FTRACE_MAX_EVENT \ 43#define FTRACE_MAX_EVENT \
@@ -154,12 +154,14 @@ enum {
154 TRACE_EVENT_FL_ENABLED_BIT, 154 TRACE_EVENT_FL_ENABLED_BIT,
155 TRACE_EVENT_FL_FILTERED_BIT, 155 TRACE_EVENT_FL_FILTERED_BIT,
156 TRACE_EVENT_FL_RECORDED_CMD_BIT, 156 TRACE_EVENT_FL_RECORDED_CMD_BIT,
157 TRACE_EVENT_FL_CAP_ANY_BIT,
157}; 158};
158 159
159enum { 160enum {
160 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT), 161 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
161 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 162 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
162 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 163 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
164 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
163}; 165};
164 166
165struct ftrace_event_call { 167struct ftrace_event_call {
@@ -196,9 +198,16 @@ struct ftrace_event_call {
196#endif 198#endif
197}; 199};
198 200
201#define __TRACE_EVENT_FLAGS(name, value) \
202 static int __init trace_init_flags_##name(void) \
203 { \
204 event_##name.flags = value; \
205 return 0; \
206 } \
207 early_initcall(trace_init_flags_##name);
208
199#define PERF_MAX_TRACE_SIZE 2048 209#define PERF_MAX_TRACE_SIZE 2048
200 210
201#define MAX_FILTER_PRED 32
202#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 211#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
203 212
204extern void destroy_preds(struct ftrace_event_call *call); 213extern void destroy_preds(struct ftrace_event_call *call);
@@ -215,6 +224,10 @@ enum {
215 FILTER_PTR_STRING, 224 FILTER_PTR_STRING,
216}; 225};
217 226
227#define EVENT_STORAGE_SIZE 128
228extern struct mutex event_storage_mutex;
229extern char event_storage[EVENT_STORAGE_SIZE];
230
218extern int trace_event_raw_init(struct ftrace_event_call *call); 231extern int trace_event_raw_init(struct ftrace_event_call *call);
219extern int trace_define_field(struct ftrace_event_call *call, const char *type, 232extern int trace_define_field(struct ftrace_event_call *call, const char *type,
220 const char *name, int offset, int size, 233 const char *name, int offset, int size,
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index c3c578e09833..d464de53db43 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -41,6 +41,12 @@
41 * 7.15 41 * 7.15
42 * - add store notify 42 * - add store notify
43 * - add retrieve notify 43 * - add retrieve notify
44 *
45 * 7.16
46 * - add BATCH_FORGET request
47 * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
48 * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
49 * - add FUSE_IOCTL_32BIT flag
44 */ 50 */
45 51
46#ifndef _LINUX_FUSE_H 52#ifndef _LINUX_FUSE_H
@@ -72,7 +78,7 @@
72#define FUSE_KERNEL_VERSION 7 78#define FUSE_KERNEL_VERSION 7
73 79
74/** Minor version number of this interface */ 80/** Minor version number of this interface */
75#define FUSE_KERNEL_MINOR_VERSION 15 81#define FUSE_KERNEL_MINOR_VERSION 16
76 82
77/** The node ID of the root inode */ 83/** The node ID of the root inode */
78#define FUSE_ROOT_ID 1 84#define FUSE_ROOT_ID 1
@@ -200,12 +206,14 @@ struct fuse_file_lock {
200 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine 206 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
201 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 207 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
202 * FUSE_IOCTL_RETRY: retry with new iovecs 208 * FUSE_IOCTL_RETRY: retry with new iovecs
209 * FUSE_IOCTL_32BIT: 32bit ioctl
203 * 210 *
204 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 211 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
205 */ 212 */
206#define FUSE_IOCTL_COMPAT (1 << 0) 213#define FUSE_IOCTL_COMPAT (1 << 0)
207#define FUSE_IOCTL_UNRESTRICTED (1 << 1) 214#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
208#define FUSE_IOCTL_RETRY (1 << 2) 215#define FUSE_IOCTL_RETRY (1 << 2)
216#define FUSE_IOCTL_32BIT (1 << 3)
209 217
210#define FUSE_IOCTL_MAX_IOV 256 218#define FUSE_IOCTL_MAX_IOV 256
211 219
@@ -256,6 +264,7 @@ enum fuse_opcode {
256 FUSE_IOCTL = 39, 264 FUSE_IOCTL = 39,
257 FUSE_POLL = 40, 265 FUSE_POLL = 40,
258 FUSE_NOTIFY_REPLY = 41, 266 FUSE_NOTIFY_REPLY = 41,
267 FUSE_BATCH_FORGET = 42,
259 268
260 /* CUSE specific operations */ 269 /* CUSE specific operations */
261 CUSE_INIT = 4096, 270 CUSE_INIT = 4096,
@@ -290,6 +299,16 @@ struct fuse_forget_in {
290 __u64 nlookup; 299 __u64 nlookup;
291}; 300};
292 301
302struct fuse_forget_one {
303 __u64 nodeid;
304 __u64 nlookup;
305};
306
307struct fuse_batch_forget_in {
308 __u32 count;
309 __u32 dummy;
310};
311
293struct fuse_getattr_in { 312struct fuse_getattr_in {
294 __u32 getattr_flags; 313 __u32 getattr_flags;
295 __u32 dummy; 314 __u32 dummy;
@@ -510,6 +529,11 @@ struct fuse_ioctl_in {
510 __u32 out_size; 529 __u32 out_size;
511}; 530};
512 531
532struct fuse_ioctl_iovec {
533 __u64 base;
534 __u64 len;
535};
536
513struct fuse_ioctl_out { 537struct fuse_ioctl_out {
514 __s32 result; 538 __s32 result;
515 __u32 flags; 539 __u32 flags;
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index 574bea4013b6..0437e377b555 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -10,6 +10,6 @@ extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
13int generic_check_acl(struct inode *inode, int mask); 13int generic_check_acl(struct inode *inode, int mask, unsigned int flags);
14 14
15#endif /* LINUX_GENERIC_ACL_H */ 15#endif /* LINUX_GENERIC_ACL_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7a7b9c1644e4..d764a426e9fd 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -109,12 +109,13 @@ struct hd_struct {
109 int make_it_fail; 109 int make_it_fail;
110#endif 110#endif
111 unsigned long stamp; 111 unsigned long stamp;
112 int in_flight[2]; 112 atomic_t in_flight[2];
113#ifdef CONFIG_SMP 113#ifdef CONFIG_SMP
114 struct disk_stats __percpu *dkstats; 114 struct disk_stats __percpu *dkstats;
115#else 115#else
116 struct disk_stats dkstats; 116 struct disk_stats dkstats;
117#endif 117#endif
118 atomic_t ref;
118 struct rcu_head rcu_head; 119 struct rcu_head rcu_head;
119}; 120};
120 121
@@ -127,6 +128,11 @@ struct hd_struct {
127#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ 128#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
128#define GENHD_FL_NATIVE_CAPACITY 128 129#define GENHD_FL_NATIVE_CAPACITY 128
129 130
131enum {
132 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
133 DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
134};
135
130#define BLK_SCSI_MAX_CMDS (256) 136#define BLK_SCSI_MAX_CMDS (256)
131#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) 137#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
132 138
@@ -143,6 +149,8 @@ struct disk_part_tbl {
143 struct hd_struct __rcu *part[]; 149 struct hd_struct __rcu *part[];
144}; 150};
145 151
152struct disk_events;
153
146struct gendisk { 154struct gendisk {
147 /* major, first_minor and minors are input parameters only, 155 /* major, first_minor and minors are input parameters only,
148 * don't use directly. Use disk_devt() and disk_max_parts(). 156 * don't use directly. Use disk_devt() and disk_max_parts().
@@ -154,6 +162,10 @@ struct gendisk {
154 162
155 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 163 char disk_name[DISK_NAME_LEN]; /* name of major driver */
156 char *(*devnode)(struct gendisk *gd, mode_t *mode); 164 char *(*devnode)(struct gendisk *gd, mode_t *mode);
165
166 unsigned int events; /* supported events */
167 unsigned int async_events; /* async events, subset of all */
168
157 /* Array of pointers to partitions indexed by partno. 169 /* Array of pointers to partitions indexed by partno.
158 * Protected with matching bdev lock but stat and other 170 * Protected with matching bdev lock but stat and other
159 * non-critical accesses use RCU. Always access through 171 * non-critical accesses use RCU. Always access through
@@ -171,9 +183,8 @@ struct gendisk {
171 struct kobject *slave_dir; 183 struct kobject *slave_dir;
172 184
173 struct timer_rand_state *random; 185 struct timer_rand_state *random;
174
175 atomic_t sync_io; /* RAID */ 186 atomic_t sync_io; /* RAID */
176 struct work_struct async_notify; 187 struct disk_events *ev;
177#ifdef CONFIG_BLK_DEV_INTEGRITY 188#ifdef CONFIG_BLK_DEV_INTEGRITY
178 struct blk_integrity *integrity; 189 struct blk_integrity *integrity;
179#endif 190#endif
@@ -359,21 +370,21 @@ static inline void free_part_stats(struct hd_struct *part)
359 370
360static inline void part_inc_in_flight(struct hd_struct *part, int rw) 371static inline void part_inc_in_flight(struct hd_struct *part, int rw)
361{ 372{
362 part->in_flight[rw]++; 373 atomic_inc(&part->in_flight[rw]);
363 if (part->partno) 374 if (part->partno)
364 part_to_disk(part)->part0.in_flight[rw]++; 375 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
365} 376}
366 377
367static inline void part_dec_in_flight(struct hd_struct *part, int rw) 378static inline void part_dec_in_flight(struct hd_struct *part, int rw)
368{ 379{
369 part->in_flight[rw]--; 380 atomic_dec(&part->in_flight[rw]);
370 if (part->partno) 381 if (part->partno)
371 part_to_disk(part)->part0.in_flight[rw]--; 382 atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
372} 383}
373 384
374static inline int part_in_flight(struct hd_struct *part) 385static inline int part_in_flight(struct hd_struct *part)
375{ 386{
376 return part->in_flight[0] + part->in_flight[1]; 387 return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
377} 388}
378 389
379static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) 390static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
@@ -395,7 +406,6 @@ extern void part_round_stats(int cpu, struct hd_struct *part);
395/* block/genhd.c */ 406/* block/genhd.c */
396extern void add_disk(struct gendisk *disk); 407extern void add_disk(struct gendisk *disk);
397extern void del_gendisk(struct gendisk *gp); 408extern void del_gendisk(struct gendisk *gp);
398extern void unlink_gendisk(struct gendisk *gp);
399extern struct gendisk *get_gendisk(dev_t dev, int *partno); 409extern struct gendisk *get_gendisk(dev_t dev, int *partno);
400extern struct block_device *bdget_disk(struct gendisk *disk, int partno); 410extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
401 411
@@ -407,6 +417,11 @@ static inline int get_disk_ro(struct gendisk *disk)
407 return disk->part0.policy; 417 return disk->part0.policy;
408} 418}
409 419
420extern void disk_block_events(struct gendisk *disk);
421extern void disk_unblock_events(struct gendisk *disk);
422extern void disk_check_events(struct gendisk *disk);
423extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
424
410/* drivers/char/random.c */ 425/* drivers/char/random.c */
411extern void add_disk_randomness(struct gendisk *disk); 426extern void add_disk_randomness(struct gendisk *disk);
412extern void rand_initialize_disk(struct gendisk *disk); 427extern void rand_initialize_disk(struct gendisk *disk);
@@ -583,6 +598,7 @@ extern struct hd_struct * __must_check add_partition(struct gendisk *disk,
583 sector_t len, int flags, 598 sector_t len, int flags,
584 struct partition_meta_info 599 struct partition_meta_info
585 *info); 600 *info);
601extern void __delete_partition(struct hd_struct *);
586extern void delete_partition(struct gendisk *, int); 602extern void delete_partition(struct gendisk *, int);
587extern void printk_all_partitions(void); 603extern void printk_all_partitions(void);
588 604
@@ -611,6 +627,29 @@ extern ssize_t part_fail_store(struct device *dev,
611 const char *buf, size_t count); 627 const char *buf, size_t count);
612#endif /* CONFIG_FAIL_MAKE_REQUEST */ 628#endif /* CONFIG_FAIL_MAKE_REQUEST */
613 629
630static inline void hd_ref_init(struct hd_struct *part)
631{
632 atomic_set(&part->ref, 1);
633 smp_mb();
634}
635
636static inline void hd_struct_get(struct hd_struct *part)
637{
638 atomic_inc(&part->ref);
639 smp_mb__after_atomic_inc();
640}
641
642static inline int hd_struct_try_get(struct hd_struct *part)
643{
644 return atomic_inc_not_zero(&part->ref);
645}
646
647static inline void hd_struct_put(struct hd_struct *part)
648{
649 if (atomic_dec_and_test(&part->ref))
650 __delete_partition(part);
651}
652
614#else /* CONFIG_BLOCK */ 653#else /* CONFIG_BLOCK */
615 654
616static inline void printk_all_partitions(void) { } 655static inline void printk_all_partitions(void) { }
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 975609cb8548..56d8fc87fbbc 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -9,6 +9,34 @@
9 9
10struct vm_area_struct; 10struct vm_area_struct;
11 11
12/* Plain integer GFP bitmasks. Do not use this directly. */
13#define ___GFP_DMA 0x01u
14#define ___GFP_HIGHMEM 0x02u
15#define ___GFP_DMA32 0x04u
16#define ___GFP_MOVABLE 0x08u
17#define ___GFP_WAIT 0x10u
18#define ___GFP_HIGH 0x20u
19#define ___GFP_IO 0x40u
20#define ___GFP_FS 0x80u
21#define ___GFP_COLD 0x100u
22#define ___GFP_NOWARN 0x200u
23#define ___GFP_REPEAT 0x400u
24#define ___GFP_NOFAIL 0x800u
25#define ___GFP_NORETRY 0x1000u
26#define ___GFP_COMP 0x4000u
27#define ___GFP_ZERO 0x8000u
28#define ___GFP_NOMEMALLOC 0x10000u
29#define ___GFP_HARDWALL 0x20000u
30#define ___GFP_THISNODE 0x40000u
31#define ___GFP_RECLAIMABLE 0x80000u
32#ifdef CONFIG_KMEMCHECK
33#define ___GFP_NOTRACK 0x200000u
34#else
35#define ___GFP_NOTRACK 0
36#endif
37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u
39
12/* 40/*
13 * GFP bitmasks.. 41 * GFP bitmasks..
14 * 42 *
@@ -18,10 +46,10 @@ struct vm_area_struct;
18 * without the underscores and use them consistently. The definitions here may 46 * without the underscores and use them consistently. The definitions here may
19 * be used in bit comparisons. 47 * be used in bit comparisons.
20 */ 48 */
21#define __GFP_DMA ((__force gfp_t)0x01u) 49#define __GFP_DMA ((__force gfp_t)___GFP_DMA)
22#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 50#define __GFP_HIGHMEM ((__force gfp_t)___GFP_HIGHMEM)
23#define __GFP_DMA32 ((__force gfp_t)0x04u) 51#define __GFP_DMA32 ((__force gfp_t)___GFP_DMA32)
24#define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */ 52#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* Page is movable */
25#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE) 53#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
26/* 54/*
27 * Action modifiers - doesn't change the zoning 55 * Action modifiers - doesn't change the zoning
@@ -38,27 +66,25 @@ struct vm_area_struct;
38 * __GFP_MOVABLE: Flag that this page will be movable by the page migration 66 * __GFP_MOVABLE: Flag that this page will be movable by the page migration
39 * mechanism or reclaimed 67 * mechanism or reclaimed
40 */ 68 */
41#define __GFP_WAIT ((__force gfp_t)0x10u) /* Can wait and reschedule? */ 69#define __GFP_WAIT ((__force gfp_t)___GFP_WAIT) /* Can wait and reschedule? */
42#define __GFP_HIGH ((__force gfp_t)0x20u) /* Should access emergency pools? */ 70#define __GFP_HIGH ((__force gfp_t)___GFP_HIGH) /* Should access emergency pools? */
43#define __GFP_IO ((__force gfp_t)0x40u) /* Can start physical IO? */ 71#define __GFP_IO ((__force gfp_t)___GFP_IO) /* Can start physical IO? */
44#define __GFP_FS ((__force gfp_t)0x80u) /* Can call down to low-level FS? */ 72#define __GFP_FS ((__force gfp_t)___GFP_FS) /* Can call down to low-level FS? */
45#define __GFP_COLD ((__force gfp_t)0x100u) /* Cache-cold page required */ 73#define __GFP_COLD ((__force gfp_t)___GFP_COLD) /* Cache-cold page required */
46#define __GFP_NOWARN ((__force gfp_t)0x200u) /* Suppress page allocation failure warning */ 74#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN) /* Suppress page allocation failure warning */
47#define __GFP_REPEAT ((__force gfp_t)0x400u) /* See above */ 75#define __GFP_REPEAT ((__force gfp_t)___GFP_REPEAT) /* See above */
48#define __GFP_NOFAIL ((__force gfp_t)0x800u) /* See above */ 76#define __GFP_NOFAIL ((__force gfp_t)___GFP_NOFAIL) /* See above */
49#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* See above */ 77#define __GFP_NORETRY ((__force gfp_t)___GFP_NORETRY) /* See above */
50#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ 78#define __GFP_COMP ((__force gfp_t)___GFP_COMP) /* Add compound page metadata */
51#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 79#define __GFP_ZERO ((__force gfp_t)___GFP_ZERO) /* Return zeroed page on success */
52#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 80#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC) /* Don't use emergency reserves */
53#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 81#define __GFP_HARDWALL ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */
54#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ 82#define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */
55#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ 83#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
56 84#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
57#ifdef CONFIG_KMEMCHECK 85
58#define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */ 86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
59#else 87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
60#define __GFP_NOTRACK ((__force gfp_t)0)
61#endif
62 88
63/* 89/*
64 * This may seem redundant, but it's a way of annotating false positives vs. 90 * This may seem redundant, but it's a way of annotating false positives vs.
@@ -66,7 +92,7 @@ struct vm_area_struct;
66 */ 92 */
67#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
68 94
69#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */ 95#define __GFP_BITS_SHIFT 23 /* Room for 23 __GFP_FOO bits */
70#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
71 97
72/* This equals 0, but use constants in case they ever change */ 98/* This equals 0, but use constants in case they ever change */
@@ -85,6 +111,9 @@ struct vm_area_struct;
85 __GFP_HARDWALL | __GFP_HIGHMEM | \ 111 __GFP_HARDWALL | __GFP_HIGHMEM | \
86 __GFP_MOVABLE) 112 __GFP_MOVABLE)
87#define GFP_IOFS (__GFP_IO | __GFP_FS) 113#define GFP_IOFS (__GFP_IO | __GFP_FS)
114#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
115 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
116 __GFP_NO_KSWAPD)
88 117
89#ifdef CONFIG_NUMA 118#ifdef CONFIG_NUMA
90#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 119#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
@@ -186,14 +215,14 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
186#endif 215#endif
187 216
188#define GFP_ZONE_TABLE ( \ 217#define GFP_ZONE_TABLE ( \
189 (ZONE_NORMAL << 0 * ZONES_SHIFT) \ 218 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \ 219 | (OPT_ZONE_DMA << ___GFP_DMA * ZONES_SHIFT) \
191 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \ 220 | (OPT_ZONE_HIGHMEM << ___GFP_HIGHMEM * ZONES_SHIFT) \
192 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \ 221 | (OPT_ZONE_DMA32 << ___GFP_DMA32 * ZONES_SHIFT) \
193 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \ 222 | (ZONE_NORMAL << ___GFP_MOVABLE * ZONES_SHIFT) \
194 | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \ 223 | (OPT_ZONE_DMA << (___GFP_MOVABLE | ___GFP_DMA) * ZONES_SHIFT) \
195 | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\ 224 | (ZONE_MOVABLE << (___GFP_MOVABLE | ___GFP_HIGHMEM) * ZONES_SHIFT) \
196 | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\ 225 | (OPT_ZONE_DMA32 << (___GFP_MOVABLE | ___GFP_DMA32) * ZONES_SHIFT) \
197) 226)
198 227
199/* 228/*
@@ -203,26 +232,26 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
203 * allowed. 232 * allowed.
204 */ 233 */
205#define GFP_ZONE_BAD ( \ 234#define GFP_ZONE_BAD ( \
206 1 << (__GFP_DMA | __GFP_HIGHMEM) \ 235 1 << (___GFP_DMA | ___GFP_HIGHMEM) \
207 | 1 << (__GFP_DMA | __GFP_DMA32) \ 236 | 1 << (___GFP_DMA | ___GFP_DMA32) \
208 | 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \ 237 | 1 << (___GFP_DMA32 | ___GFP_HIGHMEM) \
209 | 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \ 238 | 1 << (___GFP_DMA | ___GFP_DMA32 | ___GFP_HIGHMEM) \
210 | 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \ 239 | 1 << (___GFP_MOVABLE | ___GFP_HIGHMEM | ___GFP_DMA) \
211 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \ 240 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_DMA) \
212 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \ 241 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_HIGHMEM) \
213 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\ 242 | 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_DMA | ___GFP_HIGHMEM) \
214) 243)
215 244
216static inline enum zone_type gfp_zone(gfp_t flags) 245static inline enum zone_type gfp_zone(gfp_t flags)
217{ 246{
218 enum zone_type z; 247 enum zone_type z;
219 int bit = flags & GFP_ZONEMASK; 248 int bit = (__force int) (flags & GFP_ZONEMASK);
220 249
221 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) & 250 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
222 ((1 << ZONES_SHIFT) - 1); 251 ((1 << ZONES_SHIFT) - 1);
223 252
224 if (__builtin_constant_p(bit)) 253 if (__builtin_constant_p(bit))
225 MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 254 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
226 else { 255 else {
227#ifdef CONFIG_DEBUG_VM 256#ifdef CONFIG_DEBUG_VM
228 BUG_ON((GFP_ZONE_BAD >> bit) & 1); 257 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
@@ -304,20 +333,28 @@ alloc_pages(gfp_t gfp_mask, unsigned int order)
304{ 333{
305 return alloc_pages_current(gfp_mask, order); 334 return alloc_pages_current(gfp_mask, order);
306} 335}
307extern struct page *alloc_page_vma(gfp_t gfp_mask, 336extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
308 struct vm_area_struct *vma, unsigned long addr); 337 struct vm_area_struct *vma, unsigned long addr,
338 int node);
309#else 339#else
310#define alloc_pages(gfp_mask, order) \ 340#define alloc_pages(gfp_mask, order) \
311 alloc_pages_node(numa_node_id(), gfp_mask, order) 341 alloc_pages_node(numa_node_id(), gfp_mask, order)
312#define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0) 342#define alloc_pages_vma(gfp_mask, order, vma, addr, node) \
343 alloc_pages(gfp_mask, order)
313#endif 344#endif
314#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 345#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
346#define alloc_page_vma(gfp_mask, vma, addr) \
347 alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id())
348#define alloc_page_vma_node(gfp_mask, vma, addr, node) \
349 alloc_pages_vma(gfp_mask, 0, vma, addr, node)
315 350
316extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 351extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
317extern unsigned long get_zeroed_page(gfp_t gfp_mask); 352extern unsigned long get_zeroed_page(gfp_t gfp_mask);
318 353
319void *alloc_pages_exact(size_t size, gfp_t gfp_mask); 354void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
320void free_pages_exact(void *virt, size_t size); 355void free_pages_exact(void *virt, size_t size);
356/* This is different from alloc_pages_exact_node !!! */
357void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
321 358
322#define __get_free_page(gfp_mask) \ 359#define __get_free_page(gfp_mask) \
323 __get_free_pages((gfp_mask), 0) 360 __get_free_pages((gfp_mask), 0)
@@ -339,7 +376,7 @@ void drain_local_pages(void *dummy);
339 376
340extern gfp_t gfp_allowed_mask; 377extern gfp_t gfp_allowed_mask;
341 378
342extern void set_gfp_allowed_mask(gfp_t mask); 379extern void pm_restrict_gfp_mask(void);
343extern gfp_t clear_gfp_allowed_mask(gfp_t mask); 380extern void pm_restore_gfp_mask(void);
344 381
345#endif /* __LINUX_GFP_H */ 382#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gpio-i2cmux.h b/include/linux/gpio-i2cmux.h
new file mode 100644
index 000000000000..4a333bb0bd0d
--- /dev/null
+++ b/include/linux/gpio-i2cmux.h
@@ -0,0 +1,38 @@
1/*
2 * gpio-i2cmux interface to platform code
3 *
4 * Peter Korsgaard <peter.korsgaard@barco.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef _LINUX_GPIO_I2CMUX_H
12#define _LINUX_GPIO_I2CMUX_H
13
14/* MUX has no specific idle mode */
15#define GPIO_I2CMUX_NO_IDLE ((unsigned)-1)
16
17/**
18 * struct gpio_i2cmux_platform_data - Platform-dependent data for gpio-i2cmux
19 * @parent: Parent I2C bus adapter number
20 * @base_nr: Base I2C bus number to number adapters from or zero for dynamic
21 * @values: Array of bitmasks of GPIO settings (low/high) for each
22 * position
23 * @n_values: Number of multiplexer positions (busses to instantiate)
24 * @gpios: Array of GPIO numbers used to control MUX
25 * @n_gpios: Number of GPIOs used to control MUX
26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
27 */
28struct gpio_i2cmux_platform_data {
29 int parent;
30 int base_nr;
31 const unsigned *values;
32 int n_values;
33 const unsigned *gpios;
34 int n_gpios;
35 unsigned idle;
36};
37
38#endif /* _LINUX_GPIO_I2CMUX_H */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index e41f7dd1ae67..32720baf70f1 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -13,6 +13,7 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15struct device; 15struct device;
16struct gpio;
16struct gpio_chip; 17struct gpio_chip;
17 18
18/* 19/*
@@ -34,6 +35,17 @@ static inline int gpio_request(unsigned gpio, const char *label)
34 return -ENOSYS; 35 return -ENOSYS;
35} 36}
36 37
38static inline int gpio_request_one(unsigned gpio,
39 unsigned long flags, const char *label)
40{
41 return -ENOSYS;
42}
43
44static inline int gpio_request_array(struct gpio *array, size_t num)
45{
46 return -ENOSYS;
47}
48
37static inline void gpio_free(unsigned gpio) 49static inline void gpio_free(unsigned gpio)
38{ 50{
39 might_sleep(); 51 might_sleep();
@@ -42,6 +54,14 @@ static inline void gpio_free(unsigned gpio)
42 WARN_ON(1); 54 WARN_ON(1);
43} 55}
44 56
57static inline void gpio_free_array(struct gpio *array, size_t num)
58{
59 might_sleep();
60
61 /* GPIO can never have been requested */
62 WARN_ON(1);
63}
64
45static inline int gpio_direction_input(unsigned gpio) 65static inline int gpio_direction_input(unsigned gpio)
46{ 66{
47 return -ENOSYS; 67 return -ENOSYS;
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ce73a30113b4..dd1a56fbe924 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -16,6 +16,8 @@ struct gpio_keys_button {
16struct gpio_keys_platform_data { 16struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int poll_interval; /* polling interval in msecs -
20 for polling driver only */
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 21 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev); 22 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev); 23 void (*disable)(struct device *dev);
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8a389b608ce3..ba362171e8ae 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -2,9 +2,6 @@
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#ifdef CONFIG_PREEMPT
6#include <linux/smp_lock.h>
7#endif
8#include <linux/lockdep.h> 5#include <linux/lockdep.h>
9#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
10#include <asm/hardirq.h> 7#include <asm/hardirq.h>
@@ -97,10 +94,8 @@
97#define in_nmi() (preempt_count() & NMI_MASK) 94#define in_nmi() (preempt_count() & NMI_MASK)
98 95
99#if defined(CONFIG_PREEMPT) 96#if defined(CONFIG_PREEMPT)
100# define PREEMPT_INATOMIC_BASE kernel_locked()
101# define PREEMPT_CHECK_OFFSET 1 97# define PREEMPT_CHECK_OFFSET 1
102#else 98#else
103# define PREEMPT_INATOMIC_BASE 0
104# define PREEMPT_CHECK_OFFSET 0 99# define PREEMPT_CHECK_OFFSET 0
105#endif 100#endif
106 101
@@ -111,7 +106,7 @@
111 * used in the general case to determine whether sleeping is possible. 106 * used in the general case to determine whether sleeping is possible.
112 * Do not use in_atomic() in driver code. 107 * Do not use in_atomic() in driver code.
113 */ 108 */
114#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE) 109#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
115 110
116/* 111/*
117 * Check whether we were atomic before we did preempt_disable(): 112 * Check whether we were atomic before we did preempt_disable():
diff --git a/include/linux/hid-roccat.h b/include/linux/hid-roccat.h
new file mode 100644
index 000000000000..24e1ca01f9a0
--- /dev/null
+++ b/include/linux/hid-roccat.h
@@ -0,0 +1,29 @@
1#ifndef __HID_ROCCAT_H
2#define __HID_ROCCAT_H
3
4/*
5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 */
14
15#include <linux/hid.h>
16#include <linux/types.h>
17
18#define ROCCATIOCGREPSIZE _IOR('H', 0xf1, int)
19
20#ifdef __KERNEL__
21
22int roccat_connect(struct class *klass, struct hid_device *hid,
23 int report_size);
24void roccat_disconnect(int minor);
25int roccat_report_event(int minor, u8 const *data);
26
27#endif
28
29#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index bb0f56f5c01e..42f7e2fb501f 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -402,7 +402,7 @@ struct hid_field {
402 __u16 dpad; /* dpad input code */ 402 __u16 dpad; /* dpad input code */
403}; 403};
404 404
405#define HID_MAX_FIELDS 64 405#define HID_MAX_FIELDS 128
406 406
407struct hid_report { 407struct hid_report {
408 struct list_head list; 408 struct list_head list;
@@ -504,6 +504,9 @@ struct hid_device { /* device report descriptor */
504 struct hid_usage *, __s32); 504 struct hid_usage *, __s32);
505 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 505 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
506 506
507 /* handler for raw input (Get_Report) data, used by hidraw */
508 int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
509
507 /* handler for raw output data, used by hidraw */ 510 /* handler for raw output data, used by hidraw */
508 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); 511 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
509 512
@@ -593,6 +596,7 @@ struct hid_usage_id {
593 * @report_fixup: called before report descriptor parsing (NULL means nop) 596 * @report_fixup: called before report descriptor parsing (NULL means nop)
594 * @input_mapping: invoked on input registering before mapping an usage 597 * @input_mapping: invoked on input registering before mapping an usage
595 * @input_mapped: invoked on input registering after mapping an usage 598 * @input_mapped: invoked on input registering after mapping an usage
599 * @feature_mapping: invoked on feature registering
596 * @suspend: invoked on suspend (NULL means nop) 600 * @suspend: invoked on suspend (NULL means nop)
597 * @resume: invoked on resume if device was not reset (NULL means nop) 601 * @resume: invoked on resume if device was not reset (NULL means nop)
598 * @reset_resume: invoked on resume if device was reset (NULL means nop) 602 * @reset_resume: invoked on resume if device was reset (NULL means nop)
@@ -636,6 +640,9 @@ struct hid_driver {
636 int (*input_mapped)(struct hid_device *hdev, 640 int (*input_mapped)(struct hid_device *hdev,
637 struct hid_input *hidinput, struct hid_field *field, 641 struct hid_input *hidinput, struct hid_field *field,
638 struct hid_usage *usage, unsigned long **bit, int *max); 642 struct hid_usage *usage, unsigned long **bit, int *max);
643 void (*feature_mapping)(struct hid_device *hdev,
644 struct hid_field *field,
645 struct hid_usage *usage);
639#ifdef CONFIG_PM 646#ifdef CONFIG_PM
640 int (*suspend)(struct hid_device *hdev, pm_message_t message); 647 int (*suspend)(struct hid_device *hdev, pm_message_t message);
641 int (*resume)(struct hid_device *hdev); 648 int (*resume)(struct hid_device *hdev);
@@ -792,7 +799,7 @@ static inline int __must_check hid_parse(struct hid_device *hdev)
792 * 799 *
793 * Call this in probe function *after* hid_parse. This will setup HW buffers 800 * Call this in probe function *after* hid_parse. This will setup HW buffers
794 * and start the device (if not deffered to device open). hid_hw_stop must be 801 * and start the device (if not deffered to device open). hid_hw_stop must be
795 * called if this was successfull. 802 * called if this was successful.
796 */ 803 */
797static inline int __must_check hid_hw_start(struct hid_device *hdev, 804static inline int __must_check hid_hw_start(struct hid_device *hdev,
798 unsigned int connect_mask) 805 unsigned int connect_mask)
@@ -820,6 +827,49 @@ static inline void hid_hw_stop(struct hid_device *hdev)
820 hdev->ll_driver->stop(hdev); 827 hdev->ll_driver->stop(hdev);
821} 828}
822 829
830/**
831 * hid_hw_open - signal underlaying HW to start delivering events
832 *
833 * @hdev: hid device
834 *
835 * Tell underlying HW to start delivering events from the device.
836 * This function should be called sometime after successful call
837 * to hid_hiw_start().
838 */
839static inline int __must_check hid_hw_open(struct hid_device *hdev)
840{
841 return hdev->ll_driver->open(hdev);
842}
843
844/**
845 * hid_hw_close - signal underlaying HW to stop delivering events
846 *
847 * @hdev: hid device
848 *
849 * This function indicates that we are not interested in the events
850 * from this device anymore. Delivery of events may or may not stop,
851 * depending on the number of users still outstanding.
852 */
853static inline void hid_hw_close(struct hid_device *hdev)
854{
855 hdev->ll_driver->close(hdev);
856}
857
858/**
859 * hid_hw_power - requests underlying HW to go into given power mode
860 *
861 * @hdev: hid device
862 * @level: requested power level (one of %PM_HINT_* defines)
863 *
864 * This function requests underlying hardware to enter requested power
865 * mode.
866 */
867
868static inline int hid_hw_power(struct hid_device *hdev, int level)
869{
870 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
871}
872
823void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 873void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
824 int interrupt); 874 int interrupt);
825 875
@@ -838,12 +888,32 @@ int hid_pidff_init(struct hid_device *hid);
838#define hid_pidff_init NULL 888#define hid_pidff_init NULL
839#endif 889#endif
840 890
841#define dbg_hid(format, arg...) if (hid_debug) \ 891#define dbg_hid(format, arg...) \
842 printk(KERN_DEBUG "%s: " format ,\ 892do { \
843 __FILE__ , ## arg) 893 if (hid_debug) \
844#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 894 printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \
845 __FILE__ , ## arg) 895} while (0)
846#endif /* HID_FF */ 896
897#define hid_printk(level, hid, fmt, arg...) \
898 dev_printk(level, &(hid)->dev, fmt, ##arg)
899#define hid_emerg(hid, fmt, arg...) \
900 dev_emerg(&(hid)->dev, fmt, ##arg)
901#define hid_crit(hid, fmt, arg...) \
902 dev_crit(&(hid)->dev, fmt, ##arg)
903#define hid_alert(hid, fmt, arg...) \
904 dev_alert(&(hid)->dev, fmt, ##arg)
905#define hid_err(hid, fmt, arg...) \
906 dev_err(&(hid)->dev, fmt, ##arg)
907#define hid_notice(hid, fmt, arg...) \
908 dev_notice(&(hid)->dev, fmt, ##arg)
909#define hid_warn(hid, fmt, arg...) \
910 dev_warn(&(hid)->dev, fmt, ##arg)
911#define hid_info(hid, fmt, arg...) \
912 dev_info(&(hid)->dev, fmt, ##arg)
913#define hid_dbg(hid, fmt, arg...) \
914 dev_dbg(&(hid)->dev, fmt, ##arg)
915
916#endif /* __KERNEL__ */
847 917
848#endif 918#endif
849 919
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index dd8d69269176..4b88e697c4e9 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -35,6 +35,9 @@ struct hidraw_devinfo {
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) 35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) 36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) 37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
38/* The first byte of SFEATURE and GFEATURE is the report number */
39#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
40#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
38 41
39#define HIDRAW_FIRST_MINOR 0 42#define HIDRAW_FIRST_MINOR 0
40#define HIDRAW_MAX_DEVICES 64 43#define HIDRAW_MAX_DEVICES 64
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index e3060ef85b6d..3a93f73a8acc 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -5,6 +5,7 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <linux/hardirq.h>
8 9
9#include <asm/cacheflush.h> 10#include <asm/cacheflush.h>
10 11
@@ -28,18 +29,6 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
28 29
29#include <asm/kmap_types.h> 30#include <asm/kmap_types.h>
30 31
31#ifdef CONFIG_DEBUG_HIGHMEM
32
33void debug_kmap_atomic(enum km_type type);
34
35#else
36
37static inline void debug_kmap_atomic(enum km_type type)
38{
39}
40
41#endif
42
43#ifdef CONFIG_HIGHMEM 32#ifdef CONFIG_HIGHMEM
44#include <asm/highmem.h> 33#include <asm/highmem.h>
45 34
@@ -66,19 +55,19 @@ static inline void kunmap(struct page *page)
66{ 55{
67} 56}
68 57
69static inline void *kmap_atomic(struct page *page, enum km_type idx) 58static inline void *__kmap_atomic(struct page *page)
70{ 59{
71 pagefault_disable(); 60 pagefault_disable();
72 return page_address(page); 61 return page_address(page);
73} 62}
74#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 63#define kmap_atomic_prot(page, prot) __kmap_atomic(page)
75 64
76static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx) 65static inline void __kunmap_atomic(void *addr)
77{ 66{
78 pagefault_enable(); 67 pagefault_enable();
79} 68}
80 69
81#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 70#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
82#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 71#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
83 72
84#define kmap_flush_unused() do {} while(0) 73#define kmap_flush_unused() do {} while(0)
@@ -86,12 +75,53 @@ static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx)
86 75
87#endif /* CONFIG_HIGHMEM */ 76#endif /* CONFIG_HIGHMEM */
88 77
89/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */ 78#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
90/* kunmap_atomic() should get the return value of kmap_atomic, not the page. */ 79
91#define kunmap_atomic(addr, idx) do { \ 80DECLARE_PER_CPU(int, __kmap_atomic_idx);
92 BUILD_BUG_ON(__same_type((addr), struct page *)); \ 81
93 kunmap_atomic_notypecheck((addr), (idx)); \ 82static inline int kmap_atomic_idx_push(void)
94 } while (0) 83{
84 int idx = __this_cpu_inc_return(__kmap_atomic_idx) - 1;
85
86#ifdef CONFIG_DEBUG_HIGHMEM
87 WARN_ON_ONCE(in_irq() && !irqs_disabled());
88 BUG_ON(idx > KM_TYPE_NR);
89#endif
90 return idx;
91}
92
93static inline int kmap_atomic_idx(void)
94{
95 return __this_cpu_read(__kmap_atomic_idx) - 1;
96}
97
98static inline void kmap_atomic_idx_pop(void)
99{
100#ifdef CONFIG_DEBUG_HIGHMEM
101 int idx = __this_cpu_dec_return(__kmap_atomic_idx);
102
103 BUG_ON(idx < 0);
104#else
105 __this_cpu_dec(__kmap_atomic_idx);
106#endif
107}
108
109#endif
110
111/*
112 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work.
113 */
114#define kmap_atomic(page, args...) __kmap_atomic(page)
115
116/*
117 * Prevent people trying to call kunmap_atomic() as if it were kunmap()
118 * kunmap_atomic() should get the return value of kmap_atomic, not the page.
119 */
120#define kunmap_atomic(addr, args...) \
121do { \
122 BUILD_BUG_ON(__same_type((addr), struct page *)); \
123 __kunmap_atomic(addr); \
124} while (0)
95 125
96/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 126/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
97#ifndef clear_user_highpage 127#ifndef clear_user_highpage
@@ -201,8 +231,8 @@ static inline void copy_user_highpage(struct page *to, struct page *from,
201 vfrom = kmap_atomic(from, KM_USER0); 231 vfrom = kmap_atomic(from, KM_USER0);
202 vto = kmap_atomic(to, KM_USER1); 232 vto = kmap_atomic(to, KM_USER1);
203 copy_user_page(vto, vfrom, vaddr, to); 233 copy_user_page(vto, vfrom, vaddr, to);
204 kunmap_atomic(vfrom, KM_USER0);
205 kunmap_atomic(vto, KM_USER1); 234 kunmap_atomic(vto, KM_USER1);
235 kunmap_atomic(vfrom, KM_USER0);
206} 236}
207 237
208#endif 238#endif
@@ -214,8 +244,8 @@ static inline void copy_highpage(struct page *to, struct page *from)
214 vfrom = kmap_atomic(from, KM_USER0); 244 vfrom = kmap_atomic(from, KM_USER0);
215 vto = kmap_atomic(to, KM_USER1); 245 vto = kmap_atomic(to, KM_USER1);
216 copy_page(vto, vfrom); 246 copy_page(vto, vfrom);
217 kunmap_atomic(vfrom, KM_USER0);
218 kunmap_atomic(vto, KM_USER1); 247 kunmap_atomic(vto, KM_USER1);
248 kunmap_atomic(vfrom, KM_USER0);
219} 249}
220 250
221#endif /* _LINUX_HIGHMEM_H */ 251#endif /* _LINUX_HIGHMEM_H */
diff --git a/include/linux/hp_sdc.h b/include/linux/hp_sdc.h
index 9db3d454887f..d392975d8887 100644
--- a/include/linux/hp_sdc.h
+++ b/include/linux/hp_sdc.h
@@ -101,7 +101,7 @@ int hp_sdc_dequeue_transaction(hp_sdc_transaction *this);
101#define HP_SDC_STATUS_REG 0x40 /* Data from an i8042 register */ 101#define HP_SDC_STATUS_REG 0x40 /* Data from an i8042 register */
102#define HP_SDC_STATUS_HILCMD 0x50 /* Command from HIL MLC */ 102#define HP_SDC_STATUS_HILCMD 0x50 /* Command from HIL MLC */
103#define HP_SDC_STATUS_HILDATA 0x60 /* Data from HIL MLC */ 103#define HP_SDC_STATUS_HILDATA 0x60 /* Data from HIL MLC */
104#define HP_SDC_STATUS_PUP 0x70 /* Sucessful power-up self test */ 104#define HP_SDC_STATUS_PUP 0x70 /* Successful power-up self test */
105#define HP_SDC_STATUS_KCOOKED 0x80 /* Key from cooked kbd */ 105#define HP_SDC_STATUS_KCOOKED 0x80 /* Key from cooked kbd */
106#define HP_SDC_STATUS_KRPG 0xc0 /* Key from Repeat Gen */ 106#define HP_SDC_STATUS_KRPG 0xc0 /* Key from Repeat Gen */
107#define HP_SDC_STATUS_KMOD_SUP 0x10 /* Shift key is up */ 107#define HP_SDC_STATUS_KMOD_SUP 0x10 /* Shift key is up */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index fd0c1b857d3d..62f500c724f9 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -22,7 +22,7 @@
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/timer.h> 24#include <linux/timer.h>
25 25#include <linux/timerqueue.h>
26 26
27struct hrtimer_clock_base; 27struct hrtimer_clock_base;
28struct hrtimer_cpu_base; 28struct hrtimer_cpu_base;
@@ -54,11 +54,13 @@ enum hrtimer_restart {
54 * 0x00 inactive 54 * 0x00 inactive
55 * 0x01 enqueued into rbtree 55 * 0x01 enqueued into rbtree
56 * 0x02 callback function running 56 * 0x02 callback function running
57 * 0x04 timer is migrated to another cpu
57 * 58 *
58 * Special cases: 59 * Special cases:
59 * 0x03 callback function running and enqueued 60 * 0x03 callback function running and enqueued
60 * (was requeued on another CPU) 61 * (was requeued on another CPU)
61 * 0x09 timer was migrated on CPU hotunplug 62 * 0x05 timer was migrated on CPU hotunplug
63 *
62 * The "callback function running and enqueued" status is only possible on 64 * The "callback function running and enqueued" status is only possible on
63 * SMP. It happens for example when a posix timer expired and the callback 65 * SMP. It happens for example when a posix timer expired and the callback
64 * queued a signal. Between dropping the lock which protects the posix timer 66 * queued a signal. Between dropping the lock which protects the posix timer
@@ -67,8 +69,11 @@ enum hrtimer_restart {
67 * as otherwise the timer could be removed before the softirq code finishes the 69 * as otherwise the timer could be removed before the softirq code finishes the
68 * the handling of the timer. 70 * the handling of the timer.
69 * 71 *
70 * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state to 72 * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state
71 * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario. 73 * to preserve the HRTIMER_STATE_CALLBACK in the above scenario. This
74 * also affects HRTIMER_STATE_MIGRATE where the preservation is not
75 * necessary. HRTIMER_STATE_MIGRATE is cleared after the timer is
76 * enqueued on the new cpu.
72 * 77 *
73 * All state transitions are protected by cpu_base->lock. 78 * All state transitions are protected by cpu_base->lock.
74 */ 79 */
@@ -79,8 +84,8 @@ enum hrtimer_restart {
79 84
80/** 85/**
81 * struct hrtimer - the basic hrtimer structure 86 * struct hrtimer - the basic hrtimer structure
82 * @node: red black tree node for time ordered insertion 87 * @node: timerqueue node, which also manages node.expires,
83 * @_expires: the absolute expiry time in the hrtimers internal 88 * the absolute expiry time in the hrtimers internal
84 * representation. The time is related to the clock on 89 * representation. The time is related to the clock on
85 * which the timer is based. Is setup by adding 90 * which the timer is based. Is setup by adding
86 * slack to the _softexpires value. For non range timers 91 * slack to the _softexpires value. For non range timers
@@ -101,8 +106,7 @@ enum hrtimer_restart {
101 * The hrtimer structure must be initialized by hrtimer_init() 106 * The hrtimer structure must be initialized by hrtimer_init()
102 */ 107 */
103struct hrtimer { 108struct hrtimer {
104 struct rb_node node; 109 struct timerqueue_node node;
105 ktime_t _expires;
106 ktime_t _softexpires; 110 ktime_t _softexpires;
107 enum hrtimer_restart (*function)(struct hrtimer *); 111 enum hrtimer_restart (*function)(struct hrtimer *);
108 struct hrtimer_clock_base *base; 112 struct hrtimer_clock_base *base;
@@ -132,7 +136,6 @@ struct hrtimer_sleeper {
132 * @index: clock type index for per_cpu support when moving a 136 * @index: clock type index for per_cpu support when moving a
133 * timer to a base on another cpu. 137 * timer to a base on another cpu.
134 * @active: red black tree root node for the active timers 138 * @active: red black tree root node for the active timers
135 * @first: pointer to the timer node which expires first
136 * @resolution: the resolution of the clock, in nanoseconds 139 * @resolution: the resolution of the clock, in nanoseconds
137 * @get_time: function to retrieve the current time of the clock 140 * @get_time: function to retrieve the current time of the clock
138 * @softirq_time: the time when running the hrtimer queue in the softirq 141 * @softirq_time: the time when running the hrtimer queue in the softirq
@@ -141,8 +144,7 @@ struct hrtimer_sleeper {
141struct hrtimer_clock_base { 144struct hrtimer_clock_base {
142 struct hrtimer_cpu_base *cpu_base; 145 struct hrtimer_cpu_base *cpu_base;
143 clockid_t index; 146 clockid_t index;
144 struct rb_root active; 147 struct timerqueue_head active;
145 struct rb_node *first;
146 ktime_t resolution; 148 ktime_t resolution;
147 ktime_t (*get_time)(void); 149 ktime_t (*get_time)(void);
148 ktime_t softirq_time; 150 ktime_t softirq_time;
@@ -151,14 +153,18 @@ struct hrtimer_clock_base {
151#endif 153#endif
152}; 154};
153 155
154#define HRTIMER_MAX_CLOCK_BASES 2 156enum hrtimer_base_type {
157 HRTIMER_BASE_REALTIME,
158 HRTIMER_BASE_MONOTONIC,
159 HRTIMER_BASE_BOOTTIME,
160 HRTIMER_MAX_CLOCK_BASES,
161};
155 162
156/* 163/*
157 * struct hrtimer_cpu_base - the per cpu clock bases 164 * struct hrtimer_cpu_base - the per cpu clock bases
158 * @lock: lock protecting the base and associated clock bases 165 * @lock: lock protecting the base and associated clock bases
159 * and timers 166 * and timers
160 * @clock_base: array of clock bases for this cpu 167 * @clock_base: array of clock bases for this cpu
161 * @curr_timer: the timer which is executing a callback right now
162 * @expires_next: absolute time of the next event which was scheduled 168 * @expires_next: absolute time of the next event which was scheduled
163 * via clock_set_next_event() 169 * via clock_set_next_event()
164 * @hres_active: State of high resolution mode 170 * @hres_active: State of high resolution mode
@@ -184,43 +190,43 @@ struct hrtimer_cpu_base {
184 190
185static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) 191static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
186{ 192{
187 timer->_expires = time; 193 timer->node.expires = time;
188 timer->_softexpires = time; 194 timer->_softexpires = time;
189} 195}
190 196
191static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta) 197static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta)
192{ 198{
193 timer->_softexpires = time; 199 timer->_softexpires = time;
194 timer->_expires = ktime_add_safe(time, delta); 200 timer->node.expires = ktime_add_safe(time, delta);
195} 201}
196 202
197static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta) 203static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta)
198{ 204{
199 timer->_softexpires = time; 205 timer->_softexpires = time;
200 timer->_expires = ktime_add_safe(time, ns_to_ktime(delta)); 206 timer->node.expires = ktime_add_safe(time, ns_to_ktime(delta));
201} 207}
202 208
203static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) 209static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64)
204{ 210{
205 timer->_expires.tv64 = tv64; 211 timer->node.expires.tv64 = tv64;
206 timer->_softexpires.tv64 = tv64; 212 timer->_softexpires.tv64 = tv64;
207} 213}
208 214
209static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) 215static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time)
210{ 216{
211 timer->_expires = ktime_add_safe(timer->_expires, time); 217 timer->node.expires = ktime_add_safe(timer->node.expires, time);
212 timer->_softexpires = ktime_add_safe(timer->_softexpires, time); 218 timer->_softexpires = ktime_add_safe(timer->_softexpires, time);
213} 219}
214 220
215static inline void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns) 221static inline void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns)
216{ 222{
217 timer->_expires = ktime_add_ns(timer->_expires, ns); 223 timer->node.expires = ktime_add_ns(timer->node.expires, ns);
218 timer->_softexpires = ktime_add_ns(timer->_softexpires, ns); 224 timer->_softexpires = ktime_add_ns(timer->_softexpires, ns);
219} 225}
220 226
221static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) 227static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
222{ 228{
223 return timer->_expires; 229 return timer->node.expires;
224} 230}
225 231
226static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) 232static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
@@ -230,7 +236,7 @@ static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
230 236
231static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) 237static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer)
232{ 238{
233 return timer->_expires.tv64; 239 return timer->node.expires.tv64;
234} 240}
235static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) 241static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
236{ 242{
@@ -239,12 +245,12 @@ static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
239 245
240static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) 246static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer)
241{ 247{
242 return ktime_to_ns(timer->_expires); 248 return ktime_to_ns(timer->node.expires);
243} 249}
244 250
245static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) 251static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
246{ 252{
247 return ktime_sub(timer->_expires, timer->base->get_time()); 253 return ktime_sub(timer->node.expires, timer->base->get_time());
248} 254}
249 255
250#ifdef CONFIG_HIGH_RES_TIMERS 256#ifdef CONFIG_HIGH_RES_TIMERS
@@ -312,6 +318,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
312 318
313extern ktime_t ktime_get(void); 319extern ktime_t ktime_get(void);
314extern ktime_t ktime_get_real(void); 320extern ktime_t ktime_get_real(void);
321extern ktime_t ktime_get_boottime(void);
315 322
316 323
317DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 324DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
@@ -374,8 +381,9 @@ extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
374extern ktime_t hrtimer_get_next_event(void); 381extern ktime_t hrtimer_get_next_event(void);
375 382
376/* 383/*
377 * A timer is active, when it is enqueued into the rbtree or the callback 384 * A timer is active, when it is enqueued into the rbtree or the
378 * function is running. 385 * callback function is running or it's in the state of being migrated
386 * to another cpu.
379 */ 387 */
380static inline int hrtimer_active(const struct hrtimer *timer) 388static inline int hrtimer_active(const struct hrtimer *timer)
381{ 389{
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
new file mode 100644
index 000000000000..8847c8c29791
--- /dev/null
+++ b/include/linux/huge_mm.h
@@ -0,0 +1,180 @@
1#ifndef _LINUX_HUGE_MM_H
2#define _LINUX_HUGE_MM_H
3
4extern int do_huge_pmd_anonymous_page(struct mm_struct *mm,
5 struct vm_area_struct *vma,
6 unsigned long address, pmd_t *pmd,
7 unsigned int flags);
8extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
9 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
10 struct vm_area_struct *vma);
11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
12 unsigned long address, pmd_t *pmd,
13 pmd_t orig_pmd);
14extern pgtable_t get_pmd_huge_pte(struct mm_struct *mm);
15extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
16 unsigned long addr,
17 pmd_t *pmd,
18 unsigned int flags);
19extern int zap_huge_pmd(struct mmu_gather *tlb,
20 struct vm_area_struct *vma,
21 pmd_t *pmd);
22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
23 unsigned long addr, unsigned long end,
24 unsigned char *vec);
25extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
26 unsigned long addr, pgprot_t newprot);
27
28enum transparent_hugepage_flag {
29 TRANSPARENT_HUGEPAGE_FLAG,
30 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
31 TRANSPARENT_HUGEPAGE_DEFRAG_FLAG,
32 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG,
33 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG,
34#ifdef CONFIG_DEBUG_VM
35 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG,
36#endif
37};
38
39enum page_check_address_pmd_flag {
40 PAGE_CHECK_ADDRESS_PMD_FLAG,
41 PAGE_CHECK_ADDRESS_PMD_NOTSPLITTING_FLAG,
42 PAGE_CHECK_ADDRESS_PMD_SPLITTING_FLAG,
43};
44extern pmd_t *page_check_address_pmd(struct page *page,
45 struct mm_struct *mm,
46 unsigned long address,
47 enum page_check_address_pmd_flag flag);
48
49#ifdef CONFIG_TRANSPARENT_HUGEPAGE
50#define HPAGE_PMD_SHIFT HPAGE_SHIFT
51#define HPAGE_PMD_MASK HPAGE_MASK
52#define HPAGE_PMD_SIZE HPAGE_SIZE
53
54#define transparent_hugepage_enabled(__vma) \
55 ((transparent_hugepage_flags & \
56 (1<<TRANSPARENT_HUGEPAGE_FLAG) || \
57 (transparent_hugepage_flags & \
58 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \
59 ((__vma)->vm_flags & VM_HUGEPAGE))) && \
60 !((__vma)->vm_flags & VM_NOHUGEPAGE) && \
61 !is_vma_temporary_stack(__vma))
62#define transparent_hugepage_defrag(__vma) \
63 ((transparent_hugepage_flags & \
64 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_FLAG)) || \
65 (transparent_hugepage_flags & \
66 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG) && \
67 (__vma)->vm_flags & VM_HUGEPAGE))
68#ifdef CONFIG_DEBUG_VM
69#define transparent_hugepage_debug_cow() \
70 (transparent_hugepage_flags & \
71 (1<<TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG))
72#else /* CONFIG_DEBUG_VM */
73#define transparent_hugepage_debug_cow() 0
74#endif /* CONFIG_DEBUG_VM */
75
76extern unsigned long transparent_hugepage_flags;
77extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
78 pmd_t *dst_pmd, pmd_t *src_pmd,
79 struct vm_area_struct *vma,
80 unsigned long addr, unsigned long end);
81extern int handle_pte_fault(struct mm_struct *mm,
82 struct vm_area_struct *vma, unsigned long address,
83 pte_t *pte, pmd_t *pmd, unsigned int flags);
84extern int split_huge_page(struct page *page);
85extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd);
86#define split_huge_page_pmd(__mm, __pmd) \
87 do { \
88 pmd_t *____pmd = (__pmd); \
89 if (unlikely(pmd_trans_huge(*____pmd))) \
90 __split_huge_page_pmd(__mm, ____pmd); \
91 } while (0)
92#define wait_split_huge_page(__anon_vma, __pmd) \
93 do { \
94 pmd_t *____pmd = (__pmd); \
95 spin_unlock_wait(&(__anon_vma)->root->lock); \
96 /* \
97 * spin_unlock_wait() is just a loop in C and so the \
98 * CPU can reorder anything around it. \
99 */ \
100 smp_mb(); \
101 BUG_ON(pmd_trans_splitting(*____pmd) || \
102 pmd_trans_huge(*____pmd)); \
103 } while (0)
104#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
105#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
106#if HPAGE_PMD_ORDER > MAX_ORDER
107#error "hugepages can't be allocated by the buddy allocator"
108#endif
109extern int hugepage_madvise(struct vm_area_struct *vma,
110 unsigned long *vm_flags, int advice);
111extern void __vma_adjust_trans_huge(struct vm_area_struct *vma,
112 unsigned long start,
113 unsigned long end,
114 long adjust_next);
115static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
116 unsigned long start,
117 unsigned long end,
118 long adjust_next)
119{
120 if (!vma->anon_vma || vma->vm_ops)
121 return;
122 __vma_adjust_trans_huge(vma, start, end, adjust_next);
123}
124static inline int hpage_nr_pages(struct page *page)
125{
126 if (unlikely(PageTransHuge(page)))
127 return HPAGE_PMD_NR;
128 return 1;
129}
130static inline struct page *compound_trans_head(struct page *page)
131{
132 if (PageTail(page)) {
133 struct page *head;
134 head = page->first_page;
135 smp_rmb();
136 /*
137 * head may be a dangling pointer.
138 * __split_huge_page_refcount clears PageTail before
139 * overwriting first_page, so if PageTail is still
140 * there it means the head pointer isn't dangling.
141 */
142 if (PageTail(page))
143 return head;
144 }
145 return page;
146}
147#else /* CONFIG_TRANSPARENT_HUGEPAGE */
148#define HPAGE_PMD_SHIFT ({ BUG(); 0; })
149#define HPAGE_PMD_MASK ({ BUG(); 0; })
150#define HPAGE_PMD_SIZE ({ BUG(); 0; })
151
152#define hpage_nr_pages(x) 1
153
154#define transparent_hugepage_enabled(__vma) 0
155
156#define transparent_hugepage_flags 0UL
157static inline int split_huge_page(struct page *page)
158{
159 return 0;
160}
161#define split_huge_page_pmd(__mm, __pmd) \
162 do { } while (0)
163#define wait_split_huge_page(__anon_vma, __pmd) \
164 do { } while (0)
165#define compound_trans_head(page) compound_head(page)
166static inline int hugepage_madvise(struct vm_area_struct *vma,
167 unsigned long *vm_flags, int advice)
168{
169 BUG();
170 return 0;
171}
172static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
173 unsigned long start,
174 unsigned long end,
175 long adjust_next)
176{
177}
178#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
179
180#endif /* _LINUX_HUGE_MM_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index f479700df61b..943c76b3d4bb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -43,7 +43,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
43 struct vm_area_struct *vma, 43 struct vm_area_struct *vma,
44 int acctflags); 44 int acctflags);
45void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 45void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
46void __isolate_hwpoisoned_huge_page(struct page *page); 46int dequeue_hwpoisoned_huge_page(struct page *page);
47void copy_huge_page(struct page *dst, struct page *src);
47 48
48extern unsigned long hugepages_treat_as_movable; 49extern unsigned long hugepages_treat_as_movable;
49extern const unsigned long hugetlb_zero, hugetlb_infinity; 50extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -101,7 +102,10 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
101#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 102#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
102#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) 103#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
103#define huge_pte_offset(mm, address) 0 104#define huge_pte_offset(mm, address) 0
104#define __isolate_hwpoisoned_huge_page(page) 0 105#define dequeue_hwpoisoned_huge_page(page) 0
106static inline void copy_huge_page(struct page *dst, struct page *src)
107{
108}
105 109
106#define hugetlb_change_protection(vma, address, end, newprot) 110#define hugetlb_change_protection(vma, address, end, newprot)
107 111
@@ -228,6 +232,8 @@ struct huge_bootmem_page {
228 struct hstate *hstate; 232 struct hstate *hstate;
229}; 233};
230 234
235struct page *alloc_huge_page_node(struct hstate *h, int nid);
236
231/* arch callback */ 237/* arch callback */
232int __init alloc_bootmem_huge_page(struct hstate *h); 238int __init alloc_bootmem_huge_page(struct hstate *h);
233 239
@@ -301,8 +307,14 @@ static inline struct hstate *page_hstate(struct page *page)
301 return size_to_hstate(PAGE_SIZE << compound_order(page)); 307 return size_to_hstate(PAGE_SIZE << compound_order(page));
302} 308}
303 309
310static inline unsigned hstate_index_to_shift(unsigned index)
311{
312 return hstates[index].order + PAGE_SHIFT;
313}
314
304#else 315#else
305struct hstate {}; 316struct hstate {};
317#define alloc_huge_page_node(h, nid) NULL
306#define alloc_bootmem_huge_page(h) NULL 318#define alloc_bootmem_huge_page(h) NULL
307#define hstate_file(f) NULL 319#define hstate_file(f) NULL
308#define hstate_vma(v) NULL 320#define hstate_vma(v) NULL
@@ -317,6 +329,7 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
317{ 329{
318 return 1; 330 return 1;
319} 331}
332#define hstate_index_to_shift(index) 0
320#endif 333#endif
321 334
322#endif /* _LINUX_HUGETLB_H */ 335#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index a2d6ea49ec56..d1e55fed2c7d 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -33,6 +33,8 @@ enum bp_type_idx {
33 33
34#ifdef CONFIG_HAVE_HW_BREAKPOINT 34#ifdef CONFIG_HAVE_HW_BREAKPOINT
35 35
36extern int __init init_hw_breakpoint(void);
37
36static inline void hw_breakpoint_init(struct perf_event_attr *attr) 38static inline void hw_breakpoint_init(struct perf_event_attr *attr)
37{ 39{
38 memset(attr, 0, sizeof(*attr)); 40 memset(attr, 0, sizeof(*attr));
@@ -108,6 +110,8 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
108 110
109#else /* !CONFIG_HAVE_HW_BREAKPOINT */ 111#else /* !CONFIG_HAVE_HW_BREAKPOINT */
110 112
113static inline int __init init_hw_breakpoint(void) { return 0; }
114
111static inline struct perf_event * 115static inline struct perf_event *
112register_user_hw_breakpoint(struct perf_event_attr *attr, 116register_user_hw_breakpoint(struct perf_event_attr *attr,
113 perf_overflow_handler_t triggered, 117 perf_overflow_handler_t triggered,
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
new file mode 100644
index 000000000000..8390efc457eb
--- /dev/null
+++ b/include/linux/hwspinlock.h
@@ -0,0 +1,292 @@
1/*
2 * Hardware spinlock public header
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Contact: Ohad Ben-Cohen <ohad@wizery.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 version 2 as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_HWSPINLOCK_H
19#define __LINUX_HWSPINLOCK_H
20
21#include <linux/err.h>
22#include <linux/sched.h>
23
24/* hwspinlock mode argument */
25#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
26#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
27
28struct hwspinlock;
29
30#if defined(CONFIG_HWSPINLOCK) || defined(CONFIG_HWSPINLOCK_MODULE)
31
32int hwspin_lock_register(struct hwspinlock *lock);
33struct hwspinlock *hwspin_lock_unregister(unsigned int id);
34struct hwspinlock *hwspin_lock_request(void);
35struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
36int hwspin_lock_free(struct hwspinlock *hwlock);
37int hwspin_lock_get_id(struct hwspinlock *hwlock);
38int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
39 unsigned long *);
40int __hwspin_trylock(struct hwspinlock *, int, unsigned long *);
41void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
42
43#else /* !CONFIG_HWSPINLOCK */
44
45/*
46 * We don't want these functions to fail if CONFIG_HWSPINLOCK is not
47 * enabled. We prefer to silently succeed in this case, and let the
48 * code path get compiled away. This way, if CONFIG_HWSPINLOCK is not
49 * required on a given setup, users will still work.
50 *
51 * The only exception is hwspin_lock_register/hwspin_lock_unregister, with which
52 * we _do_ want users to fail (no point in registering hwspinlock instances if
53 * the framework is not available).
54 *
55 * Note: ERR_PTR(-ENODEV) will still be considered a success for NULL-checking
56 * users. Others, which care, can still check this with IS_ERR.
57 */
58static inline struct hwspinlock *hwspin_lock_request(void)
59{
60 return ERR_PTR(-ENODEV);
61}
62
63static inline struct hwspinlock *hwspin_lock_request_specific(unsigned int id)
64{
65 return ERR_PTR(-ENODEV);
66}
67
68static inline int hwspin_lock_free(struct hwspinlock *hwlock)
69{
70 return 0;
71}
72
73static inline
74int __hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to,
75 int mode, unsigned long *flags)
76{
77 return 0;
78}
79
80static inline
81int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
82{
83 return 0;
84}
85
86static inline
87void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
88{
89 return 0;
90}
91
92static inline int hwspin_lock_get_id(struct hwspinlock *hwlock)
93{
94 return 0;
95}
96
97static inline int hwspin_lock_register(struct hwspinlock *hwlock)
98{
99 return -ENODEV;
100}
101
102static inline struct hwspinlock *hwspin_lock_unregister(unsigned int id)
103{
104 return NULL;
105}
106
107#endif /* !CONFIG_HWSPINLOCK */
108
109/**
110 * hwspin_trylock_irqsave() - try to lock an hwspinlock, disable interrupts
111 * @hwlock: an hwspinlock which we want to trylock
112 * @flags: a pointer to where the caller's interrupt state will be saved at
113 *
114 * This function attempts to lock the underlying hwspinlock, and will
115 * immediately fail if the hwspinlock is already locked.
116 *
117 * Upon a successful return from this function, preemption and local
118 * interrupts are disabled (previous interrupts state is saved at @flags),
119 * so the caller must not sleep, and is advised to release the hwspinlock
120 * as soon as possible.
121 *
122 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
123 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
124 */
125static inline
126int hwspin_trylock_irqsave(struct hwspinlock *hwlock, unsigned long *flags)
127{
128 return __hwspin_trylock(hwlock, HWLOCK_IRQSTATE, flags);
129}
130
131/**
132 * hwspin_trylock_irq() - try to lock an hwspinlock, disable interrupts
133 * @hwlock: an hwspinlock which we want to trylock
134 *
135 * This function attempts to lock the underlying hwspinlock, and will
136 * immediately fail if the hwspinlock is already locked.
137 *
138 * Upon a successful return from this function, preemption and local
139 * interrupts are disabled, so the caller must not sleep, and is advised
140 * to release the hwspinlock as soon as possible.
141 *
142 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
143 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
144 */
145static inline int hwspin_trylock_irq(struct hwspinlock *hwlock)
146{
147 return __hwspin_trylock(hwlock, HWLOCK_IRQ, NULL);
148}
149
150/**
151 * hwspin_trylock() - attempt to lock a specific hwspinlock
152 * @hwlock: an hwspinlock which we want to trylock
153 *
154 * This function attempts to lock an hwspinlock, and will immediately fail
155 * if the hwspinlock is already taken.
156 *
157 * Upon a successful return from this function, preemption is disabled,
158 * so the caller must not sleep, and is advised to release the hwspinlock
159 * as soon as possible. This is required in order to minimize remote cores
160 * polling on the hardware interconnect.
161 *
162 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
163 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
164 */
165static inline int hwspin_trylock(struct hwspinlock *hwlock)
166{
167 return __hwspin_trylock(hwlock, 0, NULL);
168}
169
170/**
171 * hwspin_lock_timeout_irqsave() - lock hwspinlock, with timeout, disable irqs
172 * @hwlock: the hwspinlock to be locked
173 * @to: timeout value in msecs
174 * @flags: a pointer to where the caller's interrupt state will be saved at
175 *
176 * This function locks the underlying @hwlock. If the @hwlock
177 * is already taken, the function will busy loop waiting for it to
178 * be released, but give up when @timeout msecs have elapsed.
179 *
180 * Upon a successful return from this function, preemption and local interrupts
181 * are disabled (plus previous interrupt state is saved), so the caller must
182 * not sleep, and is advised to release the hwspinlock as soon as possible.
183 *
184 * Returns 0 when the @hwlock was successfully taken, and an appropriate
185 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
186 * busy after @timeout msecs). The function will never sleep.
187 */
188static inline int hwspin_lock_timeout_irqsave(struct hwspinlock *hwlock,
189 unsigned int to, unsigned long *flags)
190{
191 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQSTATE, flags);
192}
193
194/**
195 * hwspin_lock_timeout_irq() - lock hwspinlock, with timeout, disable irqs
196 * @hwlock: the hwspinlock to be locked
197 * @to: timeout value in msecs
198 *
199 * This function locks the underlying @hwlock. If the @hwlock
200 * is already taken, the function will busy loop waiting for it to
201 * be released, but give up when @timeout msecs have elapsed.
202 *
203 * Upon a successful return from this function, preemption and local interrupts
204 * are disabled so the caller must not sleep, and is advised to release the
205 * hwspinlock as soon as possible.
206 *
207 * Returns 0 when the @hwlock was successfully taken, and an appropriate
208 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
209 * busy after @timeout msecs). The function will never sleep.
210 */
211static inline
212int hwspin_lock_timeout_irq(struct hwspinlock *hwlock, unsigned int to)
213{
214 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQ, NULL);
215}
216
217/**
218 * hwspin_lock_timeout() - lock an hwspinlock with timeout limit
219 * @hwlock: the hwspinlock to be locked
220 * @to: timeout value in msecs
221 *
222 * This function locks the underlying @hwlock. If the @hwlock
223 * is already taken, the function will busy loop waiting for it to
224 * be released, but give up when @timeout msecs have elapsed.
225 *
226 * Upon a successful return from this function, preemption is disabled
227 * so the caller must not sleep, and is advised to release the hwspinlock
228 * as soon as possible.
229 * This is required in order to minimize remote cores polling on the
230 * hardware interconnect.
231 *
232 * Returns 0 when the @hwlock was successfully taken, and an appropriate
233 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
234 * busy after @timeout msecs). The function will never sleep.
235 */
236static inline
237int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to)
238{
239 return __hwspin_lock_timeout(hwlock, to, 0, NULL);
240}
241
242/**
243 * hwspin_unlock_irqrestore() - unlock hwspinlock, restore irq state
244 * @hwlock: a previously-acquired hwspinlock which we want to unlock
245 * @flags: previous caller's interrupt state to restore
246 *
247 * This function will unlock a specific hwspinlock, enable preemption and
248 * restore the previous state of the local interrupts. It should be used
249 * to undo, e.g., hwspin_trylock_irqsave().
250 *
251 * @hwlock must be already locked before calling this function: it is a bug
252 * to call unlock on a @hwlock that is already unlocked.
253 */
254static inline void hwspin_unlock_irqrestore(struct hwspinlock *hwlock,
255 unsigned long *flags)
256{
257 __hwspin_unlock(hwlock, HWLOCK_IRQSTATE, flags);
258}
259
260/**
261 * hwspin_unlock_irq() - unlock hwspinlock, enable interrupts
262 * @hwlock: a previously-acquired hwspinlock which we want to unlock
263 *
264 * This function will unlock a specific hwspinlock, enable preemption and
265 * enable local interrupts. Should be used to undo hwspin_lock_irq().
266 *
267 * @hwlock must be already locked (e.g. by hwspin_trylock_irq()) before
268 * calling this function: it is a bug to call unlock on a @hwlock that is
269 * already unlocked.
270 */
271static inline void hwspin_unlock_irq(struct hwspinlock *hwlock)
272{
273 __hwspin_unlock(hwlock, HWLOCK_IRQ, NULL);
274}
275
276/**
277 * hwspin_unlock() - unlock hwspinlock
278 * @hwlock: a previously-acquired hwspinlock which we want to unlock
279 *
280 * This function will unlock a specific hwspinlock and enable preemption
281 * back.
282 *
283 * @hwlock must be already locked (e.g. by hwspin_trylock()) before calling
284 * this function: it is a bug to call unlock on a @hwlock that is already
285 * unlocked.
286 */
287static inline void hwspin_unlock(struct hwspinlock *hwlock)
288{
289 __hwspin_unlock(hwlock, 0, NULL);
290}
291
292#endif /* __LINUX_HWSPINLOCK_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
deleted file mode 100644
index e844a0b18695..000000000000
--- a/include/linux/i2c-id.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/* ------------------------------------------------------------------------- */
2/* */
3/* i2c-id.h - identifier values for i2c drivers and adapters */
4/* */
5/* ------------------------------------------------------------------------- */
6/* Copyright (C) 1995-1999 Simon G. Vogl
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21/* ------------------------------------------------------------------------- */
22
23#ifndef LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H
25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
30/*
31 * ---- Adapter types ----------------------------------------------------
32 */
33
34/* --- Bit algorithm adapters */
35#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
36#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
37#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
38#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
39#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
40#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
41#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
42#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
43#define I2C_HW_B_CX231XX 0x010024 /* Conexant CX231XX USB based cards */
44#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
45
46/* --- SGI adapters */
47#define I2C_HW_SGI_VINO 0x160000
48
49/* --- SMBus only adapters */
50#define I2C_HW_SMBUS_W9968CF 0x04000d
51#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
52#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
53#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
54
55/* --- Miscellaneous adapters */
56#define I2C_HW_SAA7146 0x060000 /* SAA7146 video decoder bus */
57#define I2C_HW_SAA7134 0x090000 /* SAA7134 video decoder bus */
58
59#endif /* LINUX_I2C_ID_H */
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 78ebf507ce56..7472449cbb74 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -1,9 +1,14 @@
1#ifndef __I2C_OMAP_H__ 1#ifndef __I2C_OMAP_H__
2#define __I2C_OMAP_H__ 2#define __I2C_OMAP_H__
3 3
4#include <linux/platform_device.h>
5
4struct omap_i2c_bus_platform_data { 6struct omap_i2c_bus_platform_data {
5 u32 clkrate; 7 u32 clkrate;
6 void (*set_mpu_wkup_lat)(struct device *dev, long set); 8 void (*set_mpu_wkup_lat)(struct device *dev, long set);
9 int (*device_enable) (struct platform_device *pdev);
10 int (*device_shutdown) (struct platform_device *pdev);
11 int (*device_idle) (struct platform_device *pdev);
7}; 12};
8 13
9#endif 14#endif
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
new file mode 100644
index 000000000000..9c85da49857a
--- /dev/null
+++ b/include/linux/i2c-tegra.h
@@ -0,0 +1,25 @@
1/*
2 * drivers/i2c/busses/i2c-tegra.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _LINUX_I2C_TEGRA_H
19#define _LINUX_I2C_TEGRA_H
20
21struct tegra_i2c_platform_data {
22 unsigned long bus_clk_rate;
23};
24
25#endif /* _LINUX_I2C_TEGRA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 1f66fa06a97c..f1e3ff5880a9 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/i2c-id.h>
33#include <linux/mod_devicetable.h> 32#include <linux/mod_devicetable.h>
34#include <linux/device.h> /* for struct device */ 33#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 34#include <linux/sched.h> /* for completion */
@@ -57,9 +56,10 @@ struct i2c_board_info;
57 * transmit an arbitrary number of messages without interruption. 56 * transmit an arbitrary number of messages without interruption.
58 * @count must be be less than 64k since msg.len is u16. 57 * @count must be be less than 64k since msg.len is u16.
59 */ 58 */
60extern int i2c_master_send(struct i2c_client *client, const char *buf, 59extern int i2c_master_send(const struct i2c_client *client, const char *buf,
60 int count);
61extern int i2c_master_recv(const struct i2c_client *client, char *buf,
61 int count); 62 int count);
62extern int i2c_master_recv(struct i2c_client *client, char *buf, int count);
63 63
64/* Transfer num messages. 64/* Transfer num messages.
65 */ 65 */
@@ -78,23 +78,25 @@ extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
78/* Now follow the 'nice' access routines. These also document the calling 78/* Now follow the 'nice' access routines. These also document the calling
79 conventions of i2c_smbus_xfer. */ 79 conventions of i2c_smbus_xfer. */
80 80
81extern s32 i2c_smbus_read_byte(struct i2c_client *client); 81extern s32 i2c_smbus_read_byte(const struct i2c_client *client);
82extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value); 82extern s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value);
83extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command); 83extern s32 i2c_smbus_read_byte_data(const struct i2c_client *client,
84extern s32 i2c_smbus_write_byte_data(struct i2c_client *client, 84 u8 command);
85extern s32 i2c_smbus_write_byte_data(const struct i2c_client *client,
85 u8 command, u8 value); 86 u8 command, u8 value);
86extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command); 87extern s32 i2c_smbus_read_word_data(const struct i2c_client *client,
87extern s32 i2c_smbus_write_word_data(struct i2c_client *client, 88 u8 command);
89extern s32 i2c_smbus_write_word_data(const struct i2c_client *client,
88 u8 command, u16 value); 90 u8 command, u16 value);
89/* Returns the number of read bytes */ 91/* Returns the number of read bytes */
90extern s32 i2c_smbus_read_block_data(struct i2c_client *client, 92extern s32 i2c_smbus_read_block_data(const struct i2c_client *client,
91 u8 command, u8 *values); 93 u8 command, u8 *values);
92extern s32 i2c_smbus_write_block_data(struct i2c_client *client, 94extern s32 i2c_smbus_write_block_data(const struct i2c_client *client,
93 u8 command, u8 length, const u8 *values); 95 u8 command, u8 length, const u8 *values);
94/* Returns the number of read bytes */ 96/* Returns the number of read bytes */
95extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, 97extern s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client,
96 u8 command, u8 length, u8 *values); 98 u8 command, u8 length, u8 *values);
97extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, 99extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
98 u8 command, u8 length, 100 u8 command, u8 length,
99 const u8 *values); 101 const u8 *values);
100#endif /* I2C */ 102#endif /* I2C */
@@ -102,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
102/** 104/**
103 * struct i2c_driver - represent an I2C device driver 105 * struct i2c_driver - represent an I2C device driver
104 * @class: What kind of i2c device we instantiate (for detect) 106 * @class: What kind of i2c device we instantiate (for detect)
105 * @attach_adapter: Callback for bus addition (for legacy drivers) 107 * @attach_adapter: Callback for bus addition (deprecated)
106 * @detach_adapter: Callback for bus removal (for legacy drivers) 108 * @detach_adapter: Callback for bus removal (deprecated)
107 * @probe: Callback for device binding 109 * @probe: Callback for device binding
108 * @remove: Callback for device unbinding 110 * @remove: Callback for device unbinding
109 * @shutdown: Callback for device shutdown 111 * @shutdown: Callback for device shutdown
@@ -141,11 +143,11 @@ struct i2c_driver {
141 unsigned int class; 143 unsigned int class;
142 144
143 /* Notifies the driver that a new bus has appeared or is about to be 145 /* Notifies the driver that a new bus has appeared or is about to be
144 * removed. You should avoid using this if you can, it will probably 146 * removed. You should avoid using this, it will be removed in a
145 * be removed in a near future. 147 * near future.
146 */ 148 */
147 int (*attach_adapter)(struct i2c_adapter *); 149 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
148 int (*detach_adapter)(struct i2c_adapter *); 150 int (*detach_adapter)(struct i2c_adapter *) __deprecated;
149 151
150 /* Standard driver model interfaces */ 152 /* Standard driver model interfaces */
151 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 153 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
@@ -255,9 +257,7 @@ struct i2c_board_info {
255 unsigned short addr; 257 unsigned short addr;
256 void *platform_data; 258 void *platform_data;
257 struct dev_archdata *archdata; 259 struct dev_archdata *archdata;
258#ifdef CONFIG_OF
259 struct device_node *of_node; 260 struct device_node *of_node;
260#endif
261 int irq; 261 int irq;
262}; 262};
263 263
@@ -353,7 +353,6 @@ struct i2c_algorithm {
353 */ 353 */
354struct i2c_adapter { 354struct i2c_adapter {
355 struct module *owner; 355 struct module *owner;
356 unsigned int id;
357 unsigned int class; /* classes to allow probing for */ 356 unsigned int class; /* classes to allow probing for */
358 const struct i2c_algorithm *algo; /* the algorithm to access the bus */ 357 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
359 void *algo_data; 358 void *algo_data;
@@ -395,6 +394,8 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
395 return NULL; 394 return NULL;
396} 395}
397 396
397int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *));
398
398/* Adapter locking functions, exported for shared pin cases */ 399/* Adapter locking functions, exported for shared pin cases */
399void i2c_lock_adapter(struct i2c_adapter *); 400void i2c_lock_adapter(struct i2c_adapter *);
400void i2c_unlock_adapter(struct i2c_adapter *); 401void i2c_unlock_adapter(struct i2c_adapter *);
@@ -407,8 +408,6 @@ void i2c_unlock_adapter(struct i2c_adapter *);
407 408
408/* i2c adapter classes (bitmask) */ 409/* i2c adapter classes (bitmask) */
409#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 410#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
410#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
411#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
412#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 411#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
413#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 412#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
414 413
@@ -448,7 +447,7 @@ extern void i2c_release_client(struct i2c_client *client);
448extern void i2c_clients_command(struct i2c_adapter *adap, 447extern void i2c_clients_command(struct i2c_adapter *adap,
449 unsigned int cmd, void *arg); 448 unsigned int cmd, void *arg);
450 449
451extern struct i2c_adapter *i2c_get_adapter(int id); 450extern struct i2c_adapter *i2c_get_adapter(int nr);
452extern void i2c_put_adapter(struct i2c_adapter *adap); 451extern void i2c_put_adapter(struct i2c_adapter *adap);
453 452
454 453
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index 269181b8f623..cec17cf6cac2 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller 2 * Analog Devices ADP5588 I/O Expander and QWERTY Keypad Controller
3 * 3 *
4 * Copyright 2009 Analog Devices Inc. 4 * Copyright 2009-2010 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2 or later. 6 * Licensed under the GPL-2 or later.
7 */ 7 */
@@ -74,6 +74,33 @@
74 74
75#define ADP5588_DEVICE_ID_MASK 0xF 75#define ADP5588_DEVICE_ID_MASK 0xF
76 76
77 /* Configuration Register1 */
78#define ADP5588_AUTO_INC (1 << 7)
79#define ADP5588_GPIEM_CFG (1 << 6)
80#define ADP5588_OVR_FLOW_M (1 << 5)
81#define ADP5588_INT_CFG (1 << 4)
82#define ADP5588_OVR_FLOW_IEN (1 << 3)
83#define ADP5588_K_LCK_IM (1 << 2)
84#define ADP5588_GPI_IEN (1 << 1)
85#define ADP5588_KE_IEN (1 << 0)
86
87/* Interrupt Status Register */
88#define ADP5588_CMP2_INT (1 << 5)
89#define ADP5588_CMP1_INT (1 << 4)
90#define ADP5588_OVR_FLOW_INT (1 << 3)
91#define ADP5588_K_LCK_INT (1 << 2)
92#define ADP5588_GPI_INT (1 << 1)
93#define ADP5588_KE_INT (1 << 0)
94
95/* Key Lock and Event Counter Register */
96#define ADP5588_K_LCK_EN (1 << 6)
97#define ADP5588_LCK21 0x30
98#define ADP5588_KEC 0xF
99
100#define ADP5588_MAXGPIO 18
101#define ADP5588_BANK(offs) ((offs) >> 3)
102#define ADP5588_BIT(offs) (1u << ((offs) & 0x7))
103
77/* Put one of these structures in i2c_board_info platform_data */ 104/* Put one of these structures in i2c_board_info platform_data */
78 105
79#define ADP5588_KEYMAPSIZE 80 106#define ADP5588_KEYMAPSIZE 80
@@ -126,9 +153,12 @@ struct adp5588_kpad_platform_data {
126 const struct adp5588_gpio_platform_data *gpio_data; 153 const struct adp5588_gpio_platform_data *gpio_data;
127}; 154};
128 155
156struct i2c_client; /* forward declaration */
157
129struct adp5588_gpio_platform_data { 158struct adp5588_gpio_platform_data {
130 unsigned gpio_start; /* GPIO Chip base # */ 159 int gpio_start; /* GPIO Chip base # */
131 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 160 unsigned irq_base; /* interrupt base # */
161 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
132 int (*setup)(struct i2c_client *client, 162 int (*setup)(struct i2c_client *client,
133 int gpio, unsigned ngpio, 163 int gpio, unsigned ngpio,
134 void *context); 164 void *context);
diff --git a/include/linux/i2c/ads1015.h b/include/linux/i2c/ads1015.h
new file mode 100644
index 000000000000..d5aa2a045669
--- /dev/null
+++ b/include/linux/i2c/ads1015.h
@@ -0,0 +1,36 @@
1/*
2 * Platform Data for ADS1015 12-bit 4-input ADC
3 * (C) Copyright 2010
4 * Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef LINUX_ADS1015_H
22#define LINUX_ADS1015_H
23
24#define ADS1015_CHANNELS 8
25
26struct ads1015_channel_data {
27 bool enabled;
28 unsigned int pga;
29 unsigned int data_rate;
30};
31
32struct ads1015_platform_data {
33 struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
34};
35
36#endif /* LINUX_ADS1015_H */
diff --git a/include/linux/i2c/apds990x.h b/include/linux/i2c/apds990x.h
new file mode 100644
index 000000000000..d186fcc5d257
--- /dev/null
+++ b/include/linux/i2c/apds990x.h
@@ -0,0 +1,79 @@
1/*
2 * This file is part of the APDS990x sensor driver.
3 * Chip is combined proximity and ambient light sensor.
4 *
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 *
7 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __APDS990X_H__
26#define __APDS990X_H__
27
28
29#define APDS_IRLED_CURR_12mA 0x3
30#define APDS_IRLED_CURR_25mA 0x2
31#define APDS_IRLED_CURR_50mA 0x1
32#define APDS_IRLED_CURR_100mA 0x0
33
34/**
35 * struct apds990x_chip_factors - defines effect of the cover window
36 * @ga: Total glass attenuation
37 * @cf1: clear channel factor 1 for raw to lux conversion
38 * @irf1: IR channel factor 1 for raw to lux conversion
39 * @cf2: clear channel factor 2 for raw to lux conversion
40 * @irf2: IR channel factor 2 for raw to lux conversion
41 * @df: device factor for conversion formulas
42 *
43 * Structure for tuning ALS calculation to match with environment.
44 * Values depend on the material above the sensor and the sensor
45 * itself. If the GA is zero, driver will use uncovered sensor default values
46 * format: decimal value * APDS_PARAM_SCALE except df which is plain integer.
47 */
48#define APDS_PARAM_SCALE 4096
49struct apds990x_chip_factors {
50 int ga;
51 int cf1;
52 int irf1;
53 int cf2;
54 int irf2;
55 int df;
56};
57
58/**
59 * struct apds990x_platform_data - platform data for apsd990x.c driver
60 * @cf: chip factor data
61 * @pddrive: IR-led driving current
62 * @ppcount: number of IR pulses used for proximity estimation
63 * @setup_resources: interrupt line setup call back function
64 * @release_resources: interrupt line release call back function
65 *
66 * Proximity detection result depends heavily on correct ppcount, pdrive
67 * and cover window.
68 *
69 */
70
71struct apds990x_platform_data {
72 struct apds990x_chip_factors cf;
73 u8 pdrive;
74 u8 ppcount;
75 int (*setup_resources)(void);
76 int (*release_resources)(void);
77};
78
79#endif
diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index c5033e101094..f027f7a63511 100644
--- a/include/linux/i2c/qt602240_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * AT42QT602240/ATMXT224 Touchscreen driver 2 * Atmel maXTouch Touchscreen driver
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd 4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com> 5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
@@ -10,21 +10,26 @@
10 * option) any later version. 10 * option) any later version.
11 */ 11 */
12 12
13#ifndef __LINUX_QT602240_TS_H 13#ifndef __LINUX_ATMEL_MXT_TS_H
14#define __LINUX_QT602240_TS_H 14#define __LINUX_ATMEL_MXT_TS_H
15
16#include <linux/types.h>
15 17
16/* Orient */ 18/* Orient */
17#define QT602240_NORMAL 0x0 19#define MXT_NORMAL 0x0
18#define QT602240_DIAGONAL 0x1 20#define MXT_DIAGONAL 0x1
19#define QT602240_HORIZONTAL_FLIP 0x2 21#define MXT_HORIZONTAL_FLIP 0x2
20#define QT602240_ROTATED_90_COUNTER 0x3 22#define MXT_ROTATED_90_COUNTER 0x3
21#define QT602240_VERTICAL_FLIP 0x4 23#define MXT_VERTICAL_FLIP 0x4
22#define QT602240_ROTATED_90 0x5 24#define MXT_ROTATED_90 0x5
23#define QT602240_ROTATED_180 0x6 25#define MXT_ROTATED_180 0x6
24#define QT602240_DIAGONAL_COUNTER 0x7 26#define MXT_DIAGONAL_COUNTER 0x7
27
28/* The platform data for the Atmel maXTouch touchscreen driver */
29struct mxt_platform_data {
30 const u8 *config;
31 size_t config_length;
25 32
26/* The platform data for the AT42QT602240/ATMXT224 touchscreen driver */
27struct qt602240_platform_data {
28 unsigned int x_line; 33 unsigned int x_line;
29 unsigned int y_line; 34 unsigned int y_line;
30 unsigned int x_size; 35 unsigned int x_size;
@@ -33,6 +38,7 @@ struct qt602240_platform_data {
33 unsigned int threshold; 38 unsigned int threshold;
34 unsigned int voltage; 39 unsigned int voltage;
35 unsigned char orient; 40 unsigned char orient;
41 unsigned long irqflags;
36}; 42};
37 43
38#endif /* __LINUX_QT602240_TS_H */ 44#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/bh1770glc.h b/include/linux/i2c/bh1770glc.h
new file mode 100644
index 000000000000..8b5e2df36c72
--- /dev/null
+++ b/include/linux/i2c/bh1770glc.h
@@ -0,0 +1,53 @@
1/*
2 * This file is part of the ROHM BH1770GLC / OSRAM SFH7770 sensor driver.
3 * Chip is combined proximity and ambient light sensor.
4 *
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 *
7 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __BH1770_H__
26#define __BH1770_H__
27
28/**
29 * struct bh1770_platform_data - platform data for bh1770glc driver
30 * @led_def_curr: IR led driving current.
31 * @glass_attenuation: Attenuation factor for covering window.
32 * @setup_resources: Call back for interrupt line setup function
33 * @release_resources: Call back for interrupte line release function
34 *
35 * Example of glass attenuation: 16384 * 385 / 100 means attenuation factor
36 * of 3.85. i.e. light_above_sensor = light_above_cover_window / 3.85
37 */
38
39struct bh1770_platform_data {
40#define BH1770_LED_5mA 0
41#define BH1770_LED_10mA 1
42#define BH1770_LED_20mA 2
43#define BH1770_LED_50mA 3
44#define BH1770_LED_100mA 4
45#define BH1770_LED_150mA 5
46#define BH1770_LED_200mA 6
47 __u8 led_def_curr;
48#define BH1770_NEUTRAL_GA 16384 /* 16384 / 16384 = 1 */
49 __u32 glass_attenuation;
50 int (*setup_resources)(void);
51 int (*release_resources)(void);
52};
53#endif
diff --git a/include/linux/i2c/ds620.h b/include/linux/i2c/ds620.h
new file mode 100644
index 000000000000..736bb87ac0fc
--- /dev/null
+++ b/include/linux/i2c/ds620.h
@@ -0,0 +1,21 @@
1#ifndef _LINUX_DS620_H
2#define _LINUX_DS620_H
3
4#include <linux/types.h>
5#include <linux/i2c.h>
6
7/* platform data for the DS620 temperature sensor and thermostat */
8
9struct ds620_platform_data {
10 /*
11 * Thermostat output pin PO mode:
12 * 0 = always low (default)
13 * 1 = PO_LOW
14 * 2 = PO_HIGH
15 *
16 * (see Documentation/hwmon/ds620)
17 */
18 int pomode;
19};
20
21#endif /* _LINUX_DS620_H */
diff --git a/include/linux/i2c/max6639.h b/include/linux/i2c/max6639.h
new file mode 100644
index 000000000000..6011c42034da
--- /dev/null
+++ b/include/linux/i2c/max6639.h
@@ -0,0 +1,14 @@
1#ifndef _LINUX_MAX6639_H
2#define _LINUX_MAX6639_H
3
4#include <linux/types.h>
5
6/* platform data for the MAX6639 temperature sensor and fan control */
7
8struct max6639_platform_data {
9 bool pwm_polarity; /* Polarity low (0) or high (1, default) */
10 int ppr; /* Pulses per rotation 1..4 (default == 2) */
11 int rpm_range; /* 2000, 4000 (default), 8000 or 16000 */
12};
13
14#endif /* _LINUX_MAX6639_H */
diff --git a/include/linux/i2c/mcs.h b/include/linux/i2c/mcs.h
index 725ae7c313ff..61bb18a4fd3c 100644
--- a/include/linux/i2c/mcs.h
+++ b/include/linux/i2c/mcs.h
@@ -18,6 +18,7 @@
18#define MCS_KEY_CODE(v) ((v) & 0xffff) 18#define MCS_KEY_CODE(v) ((v) & 0xffff)
19 19
20struct mcs_platform_data { 20struct mcs_platform_data {
21 void (*poweron)(bool);
21 void (*cfg_pin)(void); 22 void (*cfg_pin)(void);
22 23
23 /* touchscreen */ 24 /* touchscreen */
diff --git a/include/linux/i2c/pmbus.h b/include/linux/i2c/pmbus.h
new file mode 100644
index 000000000000..69280db02c41
--- /dev/null
+++ b/include/linux/i2c/pmbus.h
@@ -0,0 +1,45 @@
1/*
2 * Hardware monitoring driver for PMBus devices
3 *
4 * Copyright (c) 2010, 2011 Ericsson AB.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _PMBUS_H_
22#define _PMBUS_H_
23
24/* flags */
25
26/*
27 * PMBUS_SKIP_STATUS_CHECK
28 *
29 * During register detection, skip checking the status register for
30 * communication or command errors.
31 *
32 * Some PMBus chips respond with valid data when trying to read an unsupported
33 * register. For such chips, checking the status register is mandatory when
34 * trying to determine if a chip register exists or not.
35 * Other PMBus chips don't support the STATUS_CML register, or report
36 * communication errors for no explicable reason. For such chips, checking
37 * the status register must be disabled.
38 */
39#define PMBUS_SKIP_STATUS_CHECK (1 << 0)
40
41struct pmbus_platform_data {
42 u32 flags; /* Device specific flags */
43};
44
45#endif /* _PMBUS_H_ */
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
new file mode 100644
index 000000000000..1a9f65e6ec0f
--- /dev/null
+++ b/include/linux/i2c/pxa-i2c.h
@@ -0,0 +1,82 @@
1/*
2 * i2c_pxa.h
3 *
4 * Copyright (C) 2002 Intrinsyc Software Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11#ifndef _I2C_PXA_H_
12#define _I2C_PXA_H_
13
14#if 0
15#define DEF_TIMEOUT 3
16#else
17/* need a longer timeout if we're dealing with the fact we may well be
18 * looking at a multi-master environment
19*/
20#define DEF_TIMEOUT 32
21#endif
22
23#define BUS_ERROR (-EREMOTEIO)
24#define XFER_NAKED (-ECONNREFUSED)
25#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
26
27/* ICR initialize bit values
28*
29* 15. FM 0 (100 Khz operation)
30* 14. UR 0 (No unit reset)
31* 13. SADIE 0 (Disables the unit from interrupting on slave addresses
32* matching its slave address)
33* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration
34* in master mode)
35* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode)
36* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent)
37* 9. IRFIE 1 (Enable interrupts from full buffer received)
38* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty)
39* 7. GCD 1 (Disables i2c unit response to general call messages as a slave)
40* 6. IUE 0 (Disable unit until we change settings)
41* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL)
42* 4. MA 0 (Only send stop with the ICR stop bit)
43* 3. TB 0 (We are not transmitting a byte initially)
44* 2. ACKNAK 0 (Send an ACK after the unit receives a byte)
45* 1. STOP 0 (Do not send a STOP)
46* 0. START 0 (Do not send a START)
47*
48*/
49#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
50
51/* I2C status register init values
52 *
53 * 10. BED 1 (Clear bus error detected)
54 * 9. SAD 1 (Clear slave address detected)
55 * 7. IRF 1 (Clear IDBR Receive Full)
56 * 6. ITE 1 (Clear IDBR Transmit Empty)
57 * 5. ALD 1 (Clear Arbitration Loss Detected)
58 * 4. SSD 1 (Clear Slave Stop Detected)
59 */
60#define I2C_ISR_INIT 0x7FF /* status register init */
61
62struct i2c_slave_client;
63
64struct i2c_pxa_platform_data {
65 unsigned int slave_addr;
66 struct i2c_slave_client *slave;
67 unsigned int class;
68 unsigned int use_pio :1;
69 unsigned int fast_mode :1;
70};
71
72extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
73
74#ifdef CONFIG_PXA27x
75extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info);
76#endif
77
78#ifdef CONFIG_PXA3xx
79extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info);
80#endif
81
82#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 4793d8a7f480..0c0d1ae79981 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -141,6 +141,16 @@
141#define TWL6030_CHARGER_CTRL_INT_MASK 0x10 141#define TWL6030_CHARGER_CTRL_INT_MASK 0x10
142#define TWL6030_CHARGER_FAULT_INT_MASK 0x60 142#define TWL6030_CHARGER_FAULT_INT_MASK 0x60
143 143
144#define TWL6030_MMCCTRL 0xEE
145#define VMMC_AUTO_OFF (0x1 << 3)
146#define SW_FC (0x1 << 2)
147#define STS_MMC 0x1
148
149#define TWL6030_CFG_INPUT_PUPD3 0xF2
150#define MMC_PU (0x1 << 3)
151#define MMC_PD (0x1 << 2)
152
153
144 154
145#define TWL4030_CLASS_ID 0x4030 155#define TWL4030_CLASS_ID 0x4030
146#define TWL6030_CLASS_ID 0x6030 156#define TWL6030_CLASS_ID 0x6030
@@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
173int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); 183int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
174int twl6030_interrupt_mask(u8 bit_mask, u8 offset); 184int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
175 185
186/* Card detect Configuration for MMC1 Controller on OMAP4 */
187#ifdef CONFIG_TWL4030_CORE
188int twl6030_mmc_card_detect_config(void);
189#else
190static inline int twl6030_mmc_card_detect_config(void)
191{
192 pr_debug("twl6030_mmc_card_detect_config not supported\n");
193 return 0;
194}
195#endif
196
197/* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */
198#ifdef CONFIG_TWL4030_CORE
199int twl6030_mmc_card_detect(struct device *dev, int slot);
200#else
201static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
202{
203 pr_debug("Call back twl6030_mmc_card_detect not supported\n");
204 return -EIO;
205}
206#endif
176/*----------------------------------------------------------------------*/ 207/*----------------------------------------------------------------------*/
177 208
178/* 209/*
@@ -357,6 +388,52 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
357 388
358/*----------------------------------------------------------------------*/ 389/*----------------------------------------------------------------------*/
359 390
391/*
392 * PM Master module register offsets (use TWL4030_MODULE_PM_MASTER)
393 */
394
395#define TWL4030_PM_MASTER_CFG_P1_TRANSITION 0x00
396#define TWL4030_PM_MASTER_CFG_P2_TRANSITION 0x01
397#define TWL4030_PM_MASTER_CFG_P3_TRANSITION 0x02
398#define TWL4030_PM_MASTER_CFG_P123_TRANSITION 0x03
399#define TWL4030_PM_MASTER_STS_BOOT 0x04
400#define TWL4030_PM_MASTER_CFG_BOOT 0x05
401#define TWL4030_PM_MASTER_SHUNDAN 0x06
402#define TWL4030_PM_MASTER_BOOT_BCI 0x07
403#define TWL4030_PM_MASTER_CFG_PWRANA1 0x08
404#define TWL4030_PM_MASTER_CFG_PWRANA2 0x09
405#define TWL4030_PM_MASTER_BACKUP_MISC_STS 0x0b
406#define TWL4030_PM_MASTER_BACKUP_MISC_CFG 0x0c
407#define TWL4030_PM_MASTER_BACKUP_MISC_TST 0x0d
408#define TWL4030_PM_MASTER_PROTECT_KEY 0x0e
409#define TWL4030_PM_MASTER_STS_HW_CONDITIONS 0x0f
410#define TWL4030_PM_MASTER_P1_SW_EVENTS 0x10
411#define TWL4030_PM_MASTER_P2_SW_EVENTS 0x11
412#define TWL4030_PM_MASTER_P3_SW_EVENTS 0x12
413#define TWL4030_PM_MASTER_STS_P123_STATE 0x13
414#define TWL4030_PM_MASTER_PB_CFG 0x14
415#define TWL4030_PM_MASTER_PB_WORD_MSB 0x15
416#define TWL4030_PM_MASTER_PB_WORD_LSB 0x16
417#define TWL4030_PM_MASTER_SEQ_ADD_W2P 0x1c
418#define TWL4030_PM_MASTER_SEQ_ADD_P2A 0x1d
419#define TWL4030_PM_MASTER_SEQ_ADD_A2W 0x1e
420#define TWL4030_PM_MASTER_SEQ_ADD_A2S 0x1f
421#define TWL4030_PM_MASTER_SEQ_ADD_S2A12 0x20
422#define TWL4030_PM_MASTER_SEQ_ADD_S2A3 0x21
423#define TWL4030_PM_MASTER_SEQ_ADD_WARM 0x22
424#define TWL4030_PM_MASTER_MEMORY_ADDRESS 0x23
425#define TWL4030_PM_MASTER_MEMORY_DATA 0x24
426
427#define TWL4030_PM_MASTER_KEY_CFG1 0xc0
428#define TWL4030_PM_MASTER_KEY_CFG2 0x0c
429
430#define TWL4030_PM_MASTER_KEY_TST1 0xe0
431#define TWL4030_PM_MASTER_KEY_TST2 0x0e
432
433#define TWL4030_PM_MASTER_GLOBAL_TST 0xb6
434
435/*----------------------------------------------------------------------*/
436
360/* Power bus message definitions */ 437/* Power bus message definitions */
361 438
362/* The TWL4030/5030 splits its power-management resources (the various 439/* The TWL4030/5030 splits its power-management resources (the various
@@ -516,6 +593,15 @@ enum twl4030_usb_mode {
516 593
517struct twl4030_usb_data { 594struct twl4030_usb_data {
518 enum twl4030_usb_mode usb_mode; 595 enum twl4030_usb_mode usb_mode;
596
597 int (*phy_init)(struct device *dev);
598 int (*phy_exit)(struct device *dev);
599 /* Power on/off the PHY */
600 int (*phy_power)(struct device *dev, int iD, int on);
601 /* enable/disable phy clocks */
602 int (*phy_set_clock)(struct device *dev, int on);
603 /* suspend/resume of phy */
604 int (*phy_suspend)(struct device *dev, int suspend);
519}; 605};
520 606
521struct twl4030_ins { 607struct twl4030_ins {
@@ -553,7 +639,6 @@ extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
553extern int twl4030_remove_script(u8 flags); 639extern int twl4030_remove_script(u8 flags);
554 640
555struct twl4030_codec_audio_data { 641struct twl4030_codec_audio_data {
556 unsigned int audio_mclk; /* not used, will be removed */
557 unsigned int digimic_delay; /* in ms */ 642 unsigned int digimic_delay; /* in ms */
558 unsigned int ramp_delay_value; 643 unsigned int ramp_delay_value;
559 unsigned int offset_cncl_path; 644 unsigned int offset_cncl_path;
@@ -564,7 +649,6 @@ struct twl4030_codec_audio_data {
564}; 649};
565 650
566struct twl4030_codec_vibra_data { 651struct twl4030_codec_vibra_data {
567 unsigned int audio_mclk;
568 unsigned int coexist; 652 unsigned int coexist;
569}; 653};
570 654
@@ -614,6 +698,7 @@ struct twl4030_platform_data {
614 struct regulator_init_data *vana; 698 struct regulator_init_data *vana;
615 struct regulator_init_data *vcxio; 699 struct regulator_init_data *vcxio;
616 struct regulator_init_data *vusb; 700 struct regulator_init_data *vusb;
701 struct regulator_init_data *clk32kg;
617}; 702};
618 703
619/*----------------------------------------------------------------------*/ 704/*----------------------------------------------------------------------*/
@@ -693,5 +778,6 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
693 778
694/* INTERNAL LDOs */ 779/* INTERNAL LDOs */
695#define TWL6030_REG_VRTC 47 780#define TWL6030_REG_VRTC 47
781#define TWL6030_REG_CLK32KG 48
696 782
697#endif /* End of __TWL4030_H */ 783#endif /* End of __TWL4030_H */
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
new file mode 100644
index 000000000000..6427d298fbfc
--- /dev/null
+++ b/include/linux/i2c/twl4030-madc.h
@@ -0,0 +1,141 @@
1/*
2 * twl4030_madc.h - Header for TWL4030 MADC
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 * J Keerthy <j-keerthy@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#ifndef _TWL4030_MADC_H
24#define _TWL4030_MADC_H
25
26struct twl4030_madc_conversion_method {
27 u8 sel;
28 u8 avg;
29 u8 rbase;
30 u8 ctrl;
31};
32
33#define TWL4030_MADC_MAX_CHANNELS 16
34
35
36/*
37 * twl4030_madc_request- madc request packet for channel conversion
38 * @channels: 16 bit bitmap for individual channels
39 * @do_avgP: sample the input channel for 4 consecutive cycles
40 * @method: RT, SW1, SW2
41 * @type: Polling or interrupt based method
42 */
43
44struct twl4030_madc_request {
45 unsigned long channels;
46 u16 do_avg;
47 u16 method;
48 u16 type;
49 bool active;
50 bool result_pending;
51 int rbuf[TWL4030_MADC_MAX_CHANNELS];
52 void (*func_cb)(int len, int channels, int *buf);
53};
54
55enum conversion_methods {
56 TWL4030_MADC_RT,
57 TWL4030_MADC_SW1,
58 TWL4030_MADC_SW2,
59 TWL4030_MADC_NUM_METHODS
60};
61
62enum sample_type {
63 TWL4030_MADC_WAIT,
64 TWL4030_MADC_IRQ_ONESHOT,
65 TWL4030_MADC_IRQ_REARM
66};
67
68#define TWL4030_MADC_CTRL1 0x00
69#define TWL4030_MADC_CTRL2 0x01
70
71#define TWL4030_MADC_RTSELECT_LSB 0x02
72#define TWL4030_MADC_SW1SELECT_LSB 0x06
73#define TWL4030_MADC_SW2SELECT_LSB 0x0A
74
75#define TWL4030_MADC_RTAVERAGE_LSB 0x04
76#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
77#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
78
79#define TWL4030_MADC_CTRL_SW1 0x12
80#define TWL4030_MADC_CTRL_SW2 0x13
81
82#define TWL4030_MADC_RTCH0_LSB 0x17
83#define TWL4030_MADC_GPCH0_LSB 0x37
84
85#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
86#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
87/* MADC conversion completion */
88#define TWL4030_MADC_EOC_SW (1 << 1)
89/* MADC SWx start conversion */
90#define TWL4030_MADC_SW_START (1 << 5)
91#define TWL4030_MADC_ADCIN0 (1 << 0)
92#define TWL4030_MADC_ADCIN1 (1 << 1)
93#define TWL4030_MADC_ADCIN2 (1 << 2)
94#define TWL4030_MADC_ADCIN3 (1 << 3)
95#define TWL4030_MADC_ADCIN4 (1 << 4)
96#define TWL4030_MADC_ADCIN5 (1 << 5)
97#define TWL4030_MADC_ADCIN6 (1 << 6)
98#define TWL4030_MADC_ADCIN7 (1 << 7)
99#define TWL4030_MADC_ADCIN8 (1 << 8)
100#define TWL4030_MADC_ADCIN9 (1 << 9)
101#define TWL4030_MADC_ADCIN10 (1 << 10)
102#define TWL4030_MADC_ADCIN11 (1 << 11)
103#define TWL4030_MADC_ADCIN12 (1 << 12)
104#define TWL4030_MADC_ADCIN13 (1 << 13)
105#define TWL4030_MADC_ADCIN14 (1 << 14)
106#define TWL4030_MADC_ADCIN15 (1 << 15)
107
108/* Fixed channels */
109#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
110#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
111#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
112#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
113#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
114#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
115
116/* Step size and prescaler ratio */
117#define TEMP_STEP_SIZE 147
118#define TEMP_PSR_R 100
119#define CURR_STEP_SIZE 147
120#define CURR_PSR_R1 44
121#define CURR_PSR_R2 88
122
123#define TWL4030_BCI_BCICTL1 0x23
124#define TWL4030_BCI_CGAIN 0x020
125#define TWL4030_BCI_MESBAT (1 << 1)
126#define TWL4030_BCI_TYPEN (1 << 4)
127#define TWL4030_BCI_ITHEN (1 << 3)
128
129#define REG_BCICTL2 0x024
130#define TWL4030_BCI_ITHSENS 0x007
131
132struct twl4030_madc_user_parms {
133 int channel;
134 int average;
135 int status;
136 u16 result;
137};
138
139int twl4030_madc_conversion(struct twl4030_madc_request *conv);
140int twl4030_get_madc_conversion(int channel_no);
141#endif
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 9e7a12d6385d..a6deef4f4f67 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -826,7 +826,7 @@ static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
826 * @c: I2O controller 826 * @c: I2O controller
827 * 827 *
828 * This function tries to get a message frame. If no message frame is 828 * This function tries to get a message frame. If no message frame is
829 * available do not wait until one is availabe (see also i2o_msg_get_wait). 829 * available do not wait until one is available (see also i2o_msg_get_wait).
830 * The returned pointer to the message frame is not in I/O memory, it is 830 * The returned pointer to the message frame is not in I/O memory, it is
831 * allocated from a mempool. But because a MFA is allocated from the 831 * allocated from a mempool. But because a MFA is allocated from the
832 * controller too it is guaranteed that i2o_msg_post() will never fail. 832 * controller too it is guaranteed that i2o_msg_post() will never fail.
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 4c4c74ec5987..ba45e6bc0764 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -183,10 +183,10 @@ extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 u8 code, int pos); 184 u8 code, int pos);
185 185
186struct flowi; 186struct flowi6;
187struct in6_addr; 187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk, 188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl, 189 struct flowi6 *fl6,
190 u8 type, 190 u8 type,
191 const struct in6_addr *saddr, 191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr, 192 const struct in6_addr *daddr,
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 928ae712709f..13a801f3d028 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -81,6 +81,7 @@ struct idr {
81#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC) 81#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC)
82 82
83/** 83/**
84 * DOC: idr sync
84 * idr synchronization (stolen from radix-tree.h) 85 * idr synchronization (stolen from radix-tree.h)
85 * 86 *
86 * idr_find() is able to be called locklessly, using RCU. The caller must 87 * idr_find() is able to be called locklessly, using RCU. The caller must
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index ed5a03cbe184..b2eee5879883 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -122,6 +122,7 @@
122 122
123/* U-APSD queue for WMM IEs sent by AP */ 123/* U-APSD queue for WMM IEs sent by AP */
124#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) 124#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
125#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f
125 126
126/* U-APSD queues for WMM IEs sent by STA */ 127/* U-APSD queues for WMM IEs sent by STA */
127#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0) 128#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0)
@@ -535,7 +536,6 @@ struct ieee80211s_hdr {
535 __le32 seqnum; 536 __le32 seqnum;
536 u8 eaddr1[6]; 537 u8 eaddr1[6];
537 u8 eaddr2[6]; 538 u8 eaddr2[6];
538 u8 eaddr3[6];
539} __attribute__ ((packed)); 539} __attribute__ ((packed));
540 540
541/* Mesh flags */ 541/* Mesh flags */
@@ -884,6 +884,15 @@ struct ieee80211_ht_cap {
884#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 884#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
885#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 885#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
886 886
887/* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */
888#define IEEE80211_HT_EXT_CAP_PCO 0x0001
889#define IEEE80211_HT_EXT_CAP_PCO_TIME 0x0006
890#define IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT 1
891#define IEEE80211_HT_EXT_CAP_MCS_FB 0x0300
892#define IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT 8
893#define IEEE80211_HT_EXT_CAP_HTC_SUP 0x0400
894#define IEEE80211_HT_EXT_CAP_RD_RESPONDER 0x0800
895
887/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ 896/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
888#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 897#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
889#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C 898#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
@@ -959,7 +968,7 @@ struct ieee80211_ht_info {
959/* block-ack parameters */ 968/* block-ack parameters */
960#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 969#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
961#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C 970#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
962#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 971#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
963#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 972#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
964#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 973#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
965 974
@@ -993,6 +1002,11 @@ struct ieee80211_ht_info {
993 1002
994#define WLAN_CAPABILITY_ESS (1<<0) 1003#define WLAN_CAPABILITY_ESS (1<<0)
995#define WLAN_CAPABILITY_IBSS (1<<1) 1004#define WLAN_CAPABILITY_IBSS (1<<1)
1005
1006/* A mesh STA sets the ESS and IBSS capability bits to zero */
1007#define WLAN_CAPABILITY_IS_MBSS(cap) \
1008 (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
1009
996#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) 1010#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
997#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) 1011#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
998#define WLAN_CAPABILITY_PRIVACY (1<<4) 1012#define WLAN_CAPABILITY_PRIVACY (1<<4)
@@ -1223,6 +1237,9 @@ enum ieee80211_eid {
1223 WLAN_EID_BSS_AC_ACCESS_DELAY = 68, 1237 WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1224 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1238 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1225 WLAN_EID_MULTIPLE_BSSID = 71, 1239 WLAN_EID_MULTIPLE_BSSID = 71,
1240 WLAN_EID_BSS_COEX_2040 = 72,
1241 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1242 WLAN_EID_EXT_CAPABILITY = 127,
1226 1243
1227 WLAN_EID_MOBILITY_DOMAIN = 54, 1244 WLAN_EID_MOBILITY_DOMAIN = 54,
1228 WLAN_EID_FAST_BSS_TRANSITION = 55, 1245 WLAN_EID_FAST_BSS_TRANSITION = 55,
@@ -1249,9 +1266,8 @@ enum ieee80211_category {
1249 WLAN_CATEGORY_MULTIHOP_ACTION = 14, 1266 WLAN_CATEGORY_MULTIHOP_ACTION = 14,
1250 WLAN_CATEGORY_SELF_PROTECTED = 15, 1267 WLAN_CATEGORY_SELF_PROTECTED = 15,
1251 WLAN_CATEGORY_WMM = 17, 1268 WLAN_CATEGORY_WMM = 17,
1252 /* TODO: remove MESH_PLINK and MESH_PATH_SEL after */ 1269 /* TODO: remove MESH_PATH_SEL after mesh is updated
1253 /* mesh is updated to current 802.11s draft */ 1270 * to current 802.11s draft */
1254 WLAN_CATEGORY_MESH_PLINK = 30,
1255 WLAN_CATEGORY_MESH_PATH_SEL = 32, 1271 WLAN_CATEGORY_MESH_PATH_SEL = 32,
1256 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1272 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1257 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1273 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
@@ -1287,6 +1303,31 @@ enum ieee80211_key_len {
1287 WLAN_KEY_LEN_AES_CMAC = 16, 1303 WLAN_KEY_LEN_AES_CMAC = 16,
1288}; 1304};
1289 1305
1306/**
1307 * enum - mesh path selection protocol identifier
1308 *
1309 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
1310 * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
1311 * be specified in a vendor specific information element
1312 */
1313enum {
1314 IEEE80211_PATH_PROTOCOL_HWMP = 0,
1315 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
1316};
1317
1318/**
1319 * enum - mesh path selection metric identifier
1320 *
1321 * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
1322 * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
1323 * specified in a vendor specific information element
1324 */
1325enum {
1326 IEEE80211_PATH_METRIC_AIRTIME = 0,
1327 IEEE80211_PATH_METRIC_VENDOR = 255,
1328};
1329
1330
1290/* 1331/*
1291 * IEEE 802.11-2007 7.3.2.9 Country information element 1332 * IEEE 802.11-2007 7.3.2.9 Country information element
1292 * 1333 *
@@ -1297,6 +1338,9 @@ enum ieee80211_key_len {
1297/* Although the spec says 8 I'm seeing 6 in practice */ 1338/* Although the spec says 8 I'm seeing 6 in practice */
1298#define IEEE80211_COUNTRY_IE_MIN_LEN 6 1339#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1299 1340
1341/* The Country String field of the element shall be 3 octets in length */
1342#define IEEE80211_COUNTRY_STRING_LEN 3
1343
1300/* 1344/*
1301 * For regulatory extension stuff see IEEE 802.11-2007 1345 * For regulatory extension stuff see IEEE 802.11-2007
1302 * Annex I (page 1141) and Annex J (page 1147). Also 1346 * Annex I (page 1141) and Annex J (page 1147). Also
@@ -1476,6 +1520,7 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1476 category = ((u8 *) hdr) + 24; 1520 category = ((u8 *) hdr) + 24;
1477 return *category != WLAN_CATEGORY_PUBLIC && 1521 return *category != WLAN_CATEGORY_PUBLIC &&
1478 *category != WLAN_CATEGORY_HT && 1522 *category != WLAN_CATEGORY_HT &&
1523 *category != WLAN_CATEGORY_SELF_PROTECTED &&
1479 *category != WLAN_CATEGORY_VENDOR_SPECIFIC; 1524 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1480 } 1525 }
1481 1526
diff --git a/include/linux/if.h b/include/linux/if.h
index 123959927745..3bc63e6a02f7 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,11 +71,10 @@
71 * release skb->dst 71 * release skb->dst
72 */ 72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */ 74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */ 75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
76#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */ 76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */ 77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
79 * datapath port */ 78 * datapath port */
80 79
81#define IF_GET_IFACE 0x0001 /* for querying only */ 80#define IF_GET_IFACE 0x0001 /* for querying only */
diff --git a/include/linux/if_alg.h b/include/linux/if_alg.h
new file mode 100644
index 000000000000..0f9acce5b1ff
--- /dev/null
+++ b/include/linux/if_alg.h
@@ -0,0 +1,40 @@
1/*
2 * if_alg: User-space algorithm interface
3 *
4 * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _LINUX_IF_ALG_H
14#define _LINUX_IF_ALG_H
15
16#include <linux/types.h>
17
18struct sockaddr_alg {
19 __u16 salg_family;
20 __u8 salg_type[14];
21 __u32 salg_feat;
22 __u32 salg_mask;
23 __u8 salg_name[64];
24};
25
26struct af_alg_iv {
27 __u32 ivlen;
28 __u8 iv[0];
29};
30
31/* Socket options */
32#define ALG_SET_KEY 1
33#define ALG_SET_IV 2
34#define ALG_SET_OP 3
35
36/* Operations */
37#define ALG_OP_DECRYPT 0
38#define ALG_OP_ENCRYPT 1
39
40#endif /* _LINUX_IF_ALG_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 0d241a5c4909..dd3f20139640 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -102,7 +102,9 @@ struct __fdb_entry {
102#include <linux/netdevice.h> 102#include <linux/netdevice.h>
103 103
104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
105extern int (*br_should_route_hook)(struct sk_buff *skb); 105
106typedef int br_should_route_hook_t(struct sk_buff *skb);
107extern br_should_route_hook_t __rcu *br_should_route_hook;
106 108
107#endif 109#endif
108 110
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index f9c3df03db0f..0f1325d98295 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -72,6 +72,7 @@
72#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ 72#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
73#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ 73#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
74#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ 74#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
75#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
75#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport 76#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
76 * over Ethernet 77 * over Ethernet
77 */ 78 */
@@ -135,6 +136,7 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
135extern struct ctl_table ether_table[]; 136extern struct ctl_table ether_table[];
136#endif 137#endif
137 138
139int mac_pton(const char *s, u8 *mac);
138extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 140extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
139 141
140#endif 142#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 2fc66dd783ee..f4a2e6b1b864 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -80,6 +80,24 @@ struct rtnl_link_ifmap {
80 __u8 port; 80 __u8 port;
81}; 81};
82 82
83/*
84 * IFLA_AF_SPEC
85 * Contains nested attributes for address family specific attributes.
86 * Each address family may create a attribute with the address family
87 * number as type and create its own attribute structure in it.
88 *
89 * Example:
90 * [IFLA_AF_SPEC] = {
91 * [AF_INET] = {
92 * [IFLA_INET_CONF] = ...,
93 * },
94 * [AF_INET6] = {
95 * [IFLA_INET6_FLAGS] = ...,
96 * [IFLA_INET6_CONF] = ...,
97 * }
98 * }
99 */
100
83enum { 101enum {
84 IFLA_UNSPEC, 102 IFLA_UNSPEC,
85 IFLA_ADDRESS, 103 IFLA_ADDRESS,
@@ -116,6 +134,8 @@ enum {
116 IFLA_STATS64, 134 IFLA_STATS64,
117 IFLA_VF_PORTS, 135 IFLA_VF_PORTS,
118 IFLA_PORT_SELF, 136 IFLA_PORT_SELF,
137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */
119 __IFLA_MAX 139 __IFLA_MAX
120}; 140};
121 141
@@ -128,6 +148,14 @@ enum {
128#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) 148#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
129#endif 149#endif
130 150
151enum {
152 IFLA_INET_UNSPEC,
153 IFLA_INET_CONF,
154 __IFLA_INET_MAX,
155};
156
157#define IFLA_INET_MAX (__IFLA_INET_MAX - 1)
158
131/* ifi_flags. 159/* ifi_flags.
132 160
133 IFF_* flags. 161 IFF_* flags.
@@ -232,6 +260,7 @@ enum macvlan_mode {
232 MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */ 260 MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
233 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */ 261 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
234 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ 262 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
263 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
235}; 264};
236 265
237/* SR-IOV virtual function management section */ 266/* SR-IOV virtual function management section */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 8a2fd66a8b5f..e28b2e4959d4 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -25,19 +25,25 @@ struct macvlan_port;
25struct macvtap_queue; 25struct macvtap_queue;
26 26
27/** 27/**
28 * struct macvlan_rx_stats - MACVLAN percpu rx stats 28 * struct macvlan_pcpu_stats - MACVLAN percpu stats
29 * @rx_packets: number of received packets 29 * @rx_packets: number of received packets
30 * @rx_bytes: number of received bytes 30 * @rx_bytes: number of received bytes
31 * @rx_multicast: number of received multicast packets 31 * @rx_multicast: number of received multicast packets
32 * @tx_packets: number of transmitted packets
33 * @tx_bytes: number of transmitted bytes
32 * @syncp: synchronization point for 64bit counters 34 * @syncp: synchronization point for 64bit counters
33 * @rx_errors: number of errors 35 * @rx_errors: number of rx errors
36 * @tx_dropped: number of tx dropped packets
34 */ 37 */
35struct macvlan_rx_stats { 38struct macvlan_pcpu_stats {
36 u64 rx_packets; 39 u64 rx_packets;
37 u64 rx_bytes; 40 u64 rx_bytes;
38 u64 rx_multicast; 41 u64 rx_multicast;
42 u64 tx_packets;
43 u64 tx_bytes;
39 struct u64_stats_sync syncp; 44 struct u64_stats_sync syncp;
40 unsigned long rx_errors; 45 u32 rx_errors;
46 u32 tx_dropped;
41}; 47};
42 48
43/* 49/*
@@ -52,7 +58,7 @@ struct macvlan_dev {
52 struct hlist_node hlist; 58 struct hlist_node hlist;
53 struct macvlan_port *port; 59 struct macvlan_port *port;
54 struct net_device *lowerdev; 60 struct net_device *lowerdev;
55 struct macvlan_rx_stats __percpu *rx_stats; 61 struct macvlan_pcpu_stats __percpu *pcpu_stats;
56 enum macvlan_mode mode; 62 enum macvlan_mode mode;
57 int (*receive)(struct sk_buff *skb); 63 int (*receive)(struct sk_buff *skb);
58 int (*forward)(struct net_device *dev, struct sk_buff *skb); 64 int (*forward)(struct net_device *dev, struct sk_buff *skb);
@@ -64,18 +70,18 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
64 unsigned int len, bool success, 70 unsigned int len, bool success,
65 bool multicast) 71 bool multicast)
66{ 72{
67 struct macvlan_rx_stats *rx_stats;
68
69 rx_stats = this_cpu_ptr(vlan->rx_stats);
70 if (likely(success)) { 73 if (likely(success)) {
71 u64_stats_update_begin(&rx_stats->syncp); 74 struct macvlan_pcpu_stats *pcpu_stats;
72 rx_stats->rx_packets++;; 75
73 rx_stats->rx_bytes += len; 76 pcpu_stats = this_cpu_ptr(vlan->pcpu_stats);
77 u64_stats_update_begin(&pcpu_stats->syncp);
78 pcpu_stats->rx_packets++;
79 pcpu_stats->rx_bytes += len;
74 if (multicast) 80 if (multicast)
75 rx_stats->rx_multicast++; 81 pcpu_stats->rx_multicast++;
76 u64_stats_update_end(&rx_stats->syncp); 82 u64_stats_update_end(&pcpu_stats->syncp);
77 } else { 83 } else {
78 rx_stats->rx_errors++; 84 this_cpu_inc(vlan->pcpu_stats->rx_errors);
79 } 85 }
80} 86}
81 87
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index fcef103aa3f6..c9ad38322576 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -114,14 +114,14 @@ struct pppol2tp_ioc_stats {
114 __u16 tunnel_id; /* redundant */ 114 __u16 tunnel_id; /* redundant */
115 __u16 session_id; /* if zero, get tunnel stats */ 115 __u16 session_id; /* if zero, get tunnel stats */
116 __u32 using_ipsec:1; /* valid only for session_id == 0 */ 116 __u32 using_ipsec:1; /* valid only for session_id == 0 */
117 aligned_u64 tx_packets; 117 __aligned_u64 tx_packets;
118 aligned_u64 tx_bytes; 118 __aligned_u64 tx_bytes;
119 aligned_u64 tx_errors; 119 __aligned_u64 tx_errors;
120 aligned_u64 rx_packets; 120 __aligned_u64 rx_packets;
121 aligned_u64 rx_bytes; 121 __aligned_u64 rx_bytes;
122 aligned_u64 rx_seq_discards; 122 __aligned_u64 rx_seq_discards;
123 aligned_u64 rx_oos_packets; 123 __aligned_u64 rx_oos_packets;
124 aligned_u64 rx_errors; 124 __aligned_u64 rx_errors;
125}; 125};
126 126
127#define ifr__name b.ifr_ifrn.ifrn_name 127#define ifr__name b.ifr_ifrn.ifrn_name
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index c2f3a72712ce..290bd8ac94cf 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -86,7 +86,6 @@ struct vlan_group {
86 * the vlan is attached to. 86 * the vlan is attached to.
87 */ 87 */
88 unsigned int nr_vlans; 88 unsigned int nr_vlans;
89 int killall;
90 struct hlist_node hlist; /* linked list */ 89 struct hlist_node hlist; /* linked list */
91 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 90 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
92 struct rcu_head rcu; 91 struct rcu_head rcu;
@@ -132,7 +131,8 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
132 131
133extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 132extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
134 u16 vlan_tci, int polling); 133 u16 vlan_tci, int polling);
135extern bool vlan_hwaccel_do_receive(struct sk_buff **skb); 134extern bool vlan_do_receive(struct sk_buff **skb);
135extern struct sk_buff *vlan_untag(struct sk_buff *skb);
136extern gro_result_t 136extern gro_result_t
137vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 137vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
138 unsigned int vlan_tci, struct sk_buff *skb); 138 unsigned int vlan_tci, struct sk_buff *skb);
@@ -166,13 +166,18 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
166 return NET_XMIT_SUCCESS; 166 return NET_XMIT_SUCCESS;
167} 167}
168 168
169static inline bool vlan_hwaccel_do_receive(struct sk_buff **skb) 169static inline bool vlan_do_receive(struct sk_buff **skb)
170{ 170{
171 if ((*skb)->vlan_tci & VLAN_VID_MASK) 171 if ((*skb)->vlan_tci & VLAN_VID_MASK)
172 (*skb)->pkt_type = PACKET_OTHERHOST; 172 (*skb)->pkt_type = PACKET_OTHERHOST;
173 return false; 173 return false;
174} 174}
175 175
176static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
177{
178 return skb;
179}
180
176static inline gro_result_t 181static inline gro_result_t
177vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 182vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
178 unsigned int vlan_tci, struct sk_buff *skb) 183 unsigned int vlan_tci, struct sk_buff *skb)
@@ -339,6 +344,31 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
339 } 344 }
340} 345}
341 346
347/**
348 * vlan_get_protocol - get protocol EtherType.
349 * @skb: skbuff to query
350 *
351 * Returns the EtherType of the packet, regardless of whether it is
352 * vlan encapsulated (normal or hardware accelerated) or not.
353 */
354static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
355{
356 __be16 protocol = 0;
357
358 if (vlan_tx_tag_present(skb) ||
359 skb->protocol != cpu_to_be16(ETH_P_8021Q))
360 protocol = skb->protocol;
361 else {
362 __be16 proto, *protop;
363 protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr,
364 h_vlan_encapsulated_proto),
365 sizeof(proto), &proto);
366 if (likely(protop))
367 protocol = *protop;
368 }
369
370 return protocol;
371}
342#endif /* __KERNEL__ */ 372#endif /* __KERNEL__ */
343 373
344/* VLAN IOCTLs are found in sockios.h */ 374/* VLAN IOCTLs are found in sockios.h */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 93fc2449af10..82de336b8155 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -85,9 +85,9 @@ struct igmpv3_query {
85#define IGMP_DVMRP 0x13 /* DVMRP routing */ 85#define IGMP_DVMRP 0x13 /* DVMRP routing */
86#define IGMP_PIM 0x14 /* PIM routing */ 86#define IGMP_PIM 0x14 /* PIM routing */
87#define IGMP_TRACE 0x15 87#define IGMP_TRACE 0x15
88#define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x11 */ 88#define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */
89#define IGMP_HOST_LEAVE_MESSAGE 0x17 89#define IGMP_HOST_LEAVE_MESSAGE 0x17
90#define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x11 */ 90#define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */
91 91
92#define IGMP_MTRACE_RESP 0x1e 92#define IGMP_MTRACE_RESP 0x1e
93#define IGMP_MTRACE 0x1f 93#define IGMP_MTRACE 0x1f
@@ -167,10 +167,10 @@ struct ip_sf_socklist {
167 */ 167 */
168 168
169struct ip_mc_socklist { 169struct ip_mc_socklist {
170 struct ip_mc_socklist *next; 170 struct ip_mc_socklist __rcu *next_rcu;
171 struct ip_mreqn multi; 171 struct ip_mreqn multi;
172 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */ 172 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
173 struct ip_sf_socklist *sflist; 173 struct ip_sf_socklist __rcu *sflist;
174 struct rcu_head rcu; 174 struct rcu_head rcu;
175}; 175};
176 176
@@ -186,11 +186,14 @@ struct ip_sf_list {
186struct ip_mc_list { 186struct ip_mc_list {
187 struct in_device *interface; 187 struct in_device *interface;
188 __be32 multiaddr; 188 __be32 multiaddr;
189 unsigned int sfmode;
189 struct ip_sf_list *sources; 190 struct ip_sf_list *sources;
190 struct ip_sf_list *tomb; 191 struct ip_sf_list *tomb;
191 unsigned int sfmode;
192 unsigned long sfcount[2]; 192 unsigned long sfcount[2];
193 struct ip_mc_list *next; 193 union {
194 struct ip_mc_list *next;
195 struct ip_mc_list __rcu *next_rcu;
196 };
194 struct timer_list timer; 197 struct timer_list timer;
195 int users; 198 int users;
196 atomic_t refcnt; 199 atomic_t refcnt;
@@ -201,6 +204,7 @@ struct ip_mc_list {
201 char loaded; 204 char loaded;
202 unsigned char gsquery; /* check source marks? */ 205 unsigned char gsquery; /* check source marks? */
203 unsigned char crcount; 206 unsigned char crcount;
207 struct rcu_head rcu;
204}; 208};
205 209
206/* V3 exponential field decoding */ 210/* V3 exponential field decoding */
@@ -213,7 +217,7 @@ struct ip_mc_list {
213#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 217#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
214#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) 218#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
215 219
216extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); 220extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
217extern int igmp_rcv(struct sk_buff *); 221extern int igmp_rcv(struct sk_buff *);
218extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); 222extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
219extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); 223extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
@@ -234,7 +238,7 @@ extern void ip_mc_unmap(struct in_device *);
234extern void ip_mc_remap(struct in_device *); 238extern void ip_mc_remap(struct in_device *);
235extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 239extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
236extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 240extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
237extern void ip_mc_rejoin_group(struct ip_mc_list *im); 241extern void ip_mc_rejoin_groups(struct in_device *in_dev);
238 242
239#endif 243#endif
240#endif 244#endif
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 975837e7d6c0..09e6e62f9953 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -20,7 +20,6 @@ extern void ima_inode_free(struct inode *inode);
20extern int ima_file_check(struct file *file, int mask); 20extern int ima_file_check(struct file *file, int mask);
21extern void ima_file_free(struct file *file); 21extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot); 22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_counts_get(struct file *file);
24 23
25#else 24#else
26static inline int ima_bprm_check(struct linux_binprm *bprm) 25static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -53,10 +52,5 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
53 return 0; 52 return 0;
54} 53}
55 54
56static inline void ima_counts_get(struct file *file)
57{
58 return;
59}
60
61#endif /* CONFIG_IMA_H */ 55#endif /* CONFIG_IMA_H */
62#endif /* _LINUX_IMA_H */ 56#endif /* _LINUX_IMA_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ccd5b07d678d..5f8146695b7f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -41,10 +41,12 @@ enum
41 __IPV4_DEVCONF_MAX 41 __IPV4_DEVCONF_MAX
42}; 42};
43 43
44#define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1)
45
44struct ipv4_devconf { 46struct ipv4_devconf {
45 void *sysctl; 47 void *sysctl;
46 int data[__IPV4_DEVCONF_MAX - 1]; 48 int data[IPV4_DEVCONF_MAX];
47 DECLARE_BITMAP(state, __IPV4_DEVCONF_MAX - 1); 49 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
48}; 50};
49 51
50struct in_device { 52struct in_device {
@@ -52,9 +54,8 @@ struct in_device {
52 atomic_t refcnt; 54 atomic_t refcnt;
53 int dead; 55 int dead;
54 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 56 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
55 rwlock_t mc_list_lock; 57 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
56 struct ip_mc_list *mc_list; /* IP multicast filter chain */ 58 int mc_count; /* Number of installed mcasts */
57 int mc_count; /* Number of installed mcasts */
58 spinlock_t mc_tomb_lock; 59 spinlock_t mc_tomb_lock;
59 struct ip_mc_list *mc_tomb; 60 struct ip_mc_list *mc_tomb;
60 unsigned long mr_v1_seen; 61 unsigned long mr_v1_seen;
@@ -91,7 +92,7 @@ static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
91 92
92static inline void ipv4_devconf_setall(struct in_device *in_dev) 93static inline void ipv4_devconf_setall(struct in_device *in_dev)
93{ 94{
94 bitmap_fill(in_dev->cnf.state, __IPV4_DEVCONF_MAX - 1); 95 bitmap_fill(in_dev->cnf.state, IPV4_DEVCONF_MAX);
95} 96}
96 97
97#define IN_DEV_CONF_GET(in_dev, attr) \ 98#define IN_DEV_CONF_GET(in_dev, attr) \
@@ -143,6 +144,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
143#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
144 145
145struct in_ifaddr { 146struct in_ifaddr {
147 struct hlist_node hash;
146 struct in_ifaddr *ifa_next; 148 struct in_ifaddr *ifa_next;
147 struct in_device *ifa_dev; 149 struct in_device *ifa_dev;
148 struct rcu_head rcu_head; 150 struct rcu_head rcu_head;
@@ -221,7 +223,7 @@ static inline struct in_device *in_dev_get(const struct net_device *dev)
221 223
222static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev) 224static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
223{ 225{
224 return rcu_dereference_check(dev->ip_ptr, lockdep_rtnl_is_held()); 226 return rtnl_dereference(dev->ip_ptr);
225} 227}
226 228
227extern void in_dev_finish_destroy(struct in_device *idev); 229extern void in_dev_finish_destroy(struct in_device *idev);
diff --git a/include/linux/init.h b/include/linux/init.h
index 577671c55153..9146f39cdddf 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -79,29 +79,29 @@
79#define __exitused __used 79#define __exitused __used
80#endif 80#endif
81 81
82#define __exit __section(.exit.text) __exitused __cold 82#define __exit __section(.exit.text) __exitused __cold notrace
83 83
84/* Used for HOTPLUG */ 84/* Used for HOTPLUG */
85#define __devinit __section(.devinit.text) __cold 85#define __devinit __section(.devinit.text) __cold notrace
86#define __devinitdata __section(.devinit.data) 86#define __devinitdata __section(.devinit.data)
87#define __devinitconst __section(.devinit.rodata) 87#define __devinitconst __section(.devinit.rodata)
88#define __devexit __section(.devexit.text) __exitused __cold 88#define __devexit __section(.devexit.text) __exitused __cold notrace
89#define __devexitdata __section(.devexit.data) 89#define __devexitdata __section(.devexit.data)
90#define __devexitconst __section(.devexit.rodata) 90#define __devexitconst __section(.devexit.rodata)
91 91
92/* Used for HOTPLUG_CPU */ 92/* Used for HOTPLUG_CPU */
93#define __cpuinit __section(.cpuinit.text) __cold 93#define __cpuinit __section(.cpuinit.text) __cold notrace
94#define __cpuinitdata __section(.cpuinit.data) 94#define __cpuinitdata __section(.cpuinit.data)
95#define __cpuinitconst __section(.cpuinit.rodata) 95#define __cpuinitconst __section(.cpuinit.rodata)
96#define __cpuexit __section(.cpuexit.text) __exitused __cold 96#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
97#define __cpuexitdata __section(.cpuexit.data) 97#define __cpuexitdata __section(.cpuexit.data)
98#define __cpuexitconst __section(.cpuexit.rodata) 98#define __cpuexitconst __section(.cpuexit.rodata)
99 99
100/* Used for MEMORY_HOTPLUG */ 100/* Used for MEMORY_HOTPLUG */
101#define __meminit __section(.meminit.text) __cold 101#define __meminit __section(.meminit.text) __cold notrace
102#define __meminitdata __section(.meminit.data) 102#define __meminitdata __section(.meminit.data)
103#define __meminitconst __section(.meminit.rodata) 103#define __meminitconst __section(.meminit.rodata)
104#define __memexit __section(.memexit.text) __exitused __cold 104#define __memexit __section(.memexit.text) __exitused __cold notrace
105#define __memexitdata __section(.memexit.data) 105#define __memexitdata __section(.memexit.data)
106#define __memexitconst __section(.memexit.rodata) 106#define __memexitconst __section(.memexit.rodata)
107 107
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 2fea6c8ef6ba..689496bb6654 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -12,6 +12,13 @@
12#include <linux/securebits.h> 12#include <linux/securebits.h>
13#include <net/net_namespace.h> 13#include <net/net_namespace.h>
14 14
15#ifdef CONFIG_SMP
16# define INIT_PUSHABLE_TASKS(tsk) \
17 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO),
18#else
19# define INIT_PUSHABLE_TASKS(tsk)
20#endif
21
15extern struct files_struct init_files; 22extern struct files_struct init_files;
16extern struct fs_struct init_fs; 23extern struct fs_struct init_fs;
17 24
@@ -29,6 +36,8 @@ extern struct fs_struct init_fs;
29 .running = 0, \ 36 .running = 0, \
30 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \ 37 .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock), \
31 }, \ 38 }, \
39 .cred_guard_mutex = \
40 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
32} 41}
33 42
34extern struct nsproxy init_nsproxy; 43extern struct nsproxy init_nsproxy;
@@ -81,6 +90,12 @@ extern struct group_info init_groups;
81 */ 90 */
82# define CAP_INIT_BSET CAP_FULL_SET 91# define CAP_INIT_BSET CAP_FULL_SET
83 92
93#ifdef CONFIG_RCU_BOOST
94#define INIT_TASK_RCU_BOOST() \
95 .rcu_boost_mutex = NULL,
96#else
97#define INIT_TASK_RCU_BOOST()
98#endif
84#ifdef CONFIG_TREE_PREEMPT_RCU 99#ifdef CONFIG_TREE_PREEMPT_RCU
85#define INIT_TASK_RCU_TREE_PREEMPT() \ 100#define INIT_TASK_RCU_TREE_PREEMPT() \
86 .rcu_blocked_node = NULL, 101 .rcu_blocked_node = NULL,
@@ -92,7 +107,8 @@ extern struct group_info init_groups;
92 .rcu_read_lock_nesting = 0, \ 107 .rcu_read_lock_nesting = 0, \
93 .rcu_read_unlock_special = 0, \ 108 .rcu_read_unlock_special = 0, \
94 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \ 109 .rcu_node_entry = LIST_HEAD_INIT(tsk.rcu_node_entry), \
95 INIT_TASK_RCU_TREE_PREEMPT() 110 INIT_TASK_RCU_TREE_PREEMPT() \
111 INIT_TASK_RCU_BOOST()
96#else 112#else
97#define INIT_TASK_RCU_PREEMPT(tsk) 113#define INIT_TASK_RCU_PREEMPT(tsk)
98#endif 114#endif
@@ -118,7 +134,6 @@ extern struct cred init_cred;
118 .stack = &init_thread_info, \ 134 .stack = &init_thread_info, \
119 .usage = ATOMIC_INIT(2), \ 135 .usage = ATOMIC_INIT(2), \
120 .flags = PF_KTHREAD, \ 136 .flags = PF_KTHREAD, \
121 .lock_depth = -1, \
122 .prio = MAX_PRIO-20, \ 137 .prio = MAX_PRIO-20, \
123 .static_prio = MAX_PRIO-20, \ 138 .static_prio = MAX_PRIO-20, \
124 .normal_prio = MAX_PRIO-20, \ 139 .normal_prio = MAX_PRIO-20, \
@@ -135,7 +150,7 @@ extern struct cred init_cred;
135 .nr_cpus_allowed = NR_CPUS, \ 150 .nr_cpus_allowed = NR_CPUS, \
136 }, \ 151 }, \
137 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 152 .tasks = LIST_HEAD_INIT(tsk.tasks), \
138 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \ 153 INIT_PUSHABLE_TASKS(tsk) \
139 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ 154 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
140 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ 155 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
141 .real_parent = &tsk, \ 156 .real_parent = &tsk, \
@@ -145,8 +160,6 @@ extern struct cred init_cred;
145 .group_leader = &tsk, \ 160 .group_leader = &tsk, \
146 RCU_INIT_POINTER(.real_cred, &init_cred), \ 161 RCU_INIT_POINTER(.real_cred, &init_cred), \
147 RCU_INIT_POINTER(.cred, &init_cred), \ 162 RCU_INIT_POINTER(.cred, &init_cred), \
148 .cred_guard_mutex = \
149 __MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
150 .comm = "swapper", \ 163 .comm = "swapper", \
151 .thread = INIT_THREAD, \ 164 .thread = INIT_THREAD, \
152 .fs = &init_fs, \ 165 .fs = &init_fs, \
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 5e3dddf8f562..ce0b72464eb8 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -22,12 +22,12 @@
22 * @poll: driver-supplied method that polls the device and posts 22 * @poll: driver-supplied method that polls the device and posts
23 * input events (mandatory). 23 * input events (mandatory).
24 * @poll_interval: specifies how often the poll() method should be called. 24 * @poll_interval: specifies how often the poll() method should be called.
25 * Defaults to 500 msec unless overriden when registering the device. 25 * Defaults to 500 msec unless overridden when registering the device.
26 * @poll_interval_max: specifies upper bound for the poll interval. 26 * @poll_interval_max: specifies upper bound for the poll interval.
27 * Defaults to the initial value of @poll_interval. 27 * Defaults to the initial value of @poll_interval.
28 * @poll_interval_min: specifies lower bound for the poll interval. 28 * @poll_interval_min: specifies lower bound for the poll interval.
29 * Defaults to 0. 29 * Defaults to 0.
30 * @input: input device structire associated with the polled device. 30 * @input: input device structure associated with the polled device.
31 * Must be properly initialized by the driver (id, name, phys, bits). 31 * Must be properly initialized by the driver (id, name, phys, bits).
32 * 32 *
33 * Polled input device provides a skeleton for supporting simple input 33 * Polled input device provides a skeleton for supporting simple input
diff --git a/include/linux/input.h b/include/linux/input.h
index 51af441f3a21..771d6d85667d 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -47,6 +47,25 @@ struct input_id {
47 __u16 version; 47 __u16 version;
48}; 48};
49 49
50/**
51 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
52 * @value: latest reported value for the axis.
53 * @minimum: specifies minimum value for the axis.
54 * @maximum: specifies maximum value for the axis.
55 * @fuzz: specifies fuzz value that is used to filter noise from
56 * the event stream.
57 * @flat: values that are within this value will be discarded by
58 * joydev interface and reported as 0 instead.
59 * @resolution: specifies resolution for the values reported for
60 * the axis.
61 *
62 * Note that input core does not clamp reported values to the
63 * [minimum, maximum] limits, such task is left to userspace.
64 *
65 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
66 * units per millimeter (units/mm), resolution for rotational axes
67 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
68 */
50struct input_absinfo { 69struct input_absinfo {
51 __s32 value; 70 __s32 value;
52 __s32 minimum; 71 __s32 minimum;
@@ -85,12 +104,15 @@ struct input_keymap_entry {
85#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ 104#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
86#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */ 105#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
87 106
88#define EVIOCGKEYCODE _IOR('E', 0x04, struct input_keymap_entry) /* get keycode */ 107#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
89#define EVIOCSKEYCODE _IOW('E', 0x04, struct input_keymap_entry) /* set keycode */ 108#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
109#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
110#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
90 111
91#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ 112#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
92#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ 113#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
93#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
94 116
95#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 117#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
96#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 118#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
@@ -108,6 +130,18 @@ struct input_keymap_entry {
108#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
109 131
110/* 132/*
133 * Device properties and quirks
134 */
135
136#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
137#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
138#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
139#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
140
141#define INPUT_PROP_MAX 0x1f
142#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
143
144/*
111 * Event types 145 * Event types
112 */ 146 */
113 147
@@ -133,6 +167,7 @@ struct input_keymap_entry {
133#define SYN_REPORT 0 167#define SYN_REPORT 0
134#define SYN_CONFIG 1 168#define SYN_CONFIG 1
135#define SYN_MT_REPORT 2 169#define SYN_MT_REPORT 2
170#define SYN_DROPPED 3
136 171
137/* 172/*
138 * Keys and buttons 173 * Keys and buttons
@@ -519,8 +554,8 @@ struct input_keymap_entry {
519#define KEY_DVD 0x185 /* Media Select DVD */ 554#define KEY_DVD 0x185 /* Media Select DVD */
520#define KEY_AUX 0x186 555#define KEY_AUX 0x186
521#define KEY_MP3 0x187 556#define KEY_MP3 0x187
522#define KEY_AUDIO 0x188 557#define KEY_AUDIO 0x188 /* AL Audio Browser */
523#define KEY_VIDEO 0x189 558#define KEY_VIDEO 0x189 /* AL Movie Browser */
524#define KEY_DIRECTORY 0x18a 559#define KEY_DIRECTORY 0x18a
525#define KEY_LIST 0x18b 560#define KEY_LIST 0x18b
526#define KEY_MEMO 0x18c /* Media Select Messages */ 561#define KEY_MEMO 0x18c /* Media Select Messages */
@@ -569,6 +604,9 @@ struct input_keymap_entry {
569#define KEY_FRAMEFORWARD 0x1b5 604#define KEY_FRAMEFORWARD 0x1b5
570#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ 605#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
571#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ 606#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
607#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
608#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
609#define KEY_IMAGES 0x1ba /* AL Image Browser */
572 610
573#define KEY_DEL_EOL 0x1c0 611#define KEY_DEL_EOL 0x1c0
574#define KEY_DEL_EOS 0x1c1 612#define KEY_DEL_EOS 0x1c1
@@ -624,6 +662,17 @@ struct input_keymap_entry {
624#define KEY_CAMERA_FOCUS 0x210 662#define KEY_CAMERA_FOCUS 0x210
625#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ 663#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
626 664
665#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
666#define KEY_TOUCHPAD_ON 0x213
667#define KEY_TOUCHPAD_OFF 0x214
668
669#define KEY_CAMERA_ZOOMIN 0x215
670#define KEY_CAMERA_ZOOMOUT 0x216
671#define KEY_CAMERA_UP 0x217
672#define KEY_CAMERA_DOWN 0x218
673#define KEY_CAMERA_LEFT 0x219
674#define KEY_CAMERA_RIGHT 0x21a
675
627#define BTN_TRIGGER_HAPPY 0x2c0 676#define BTN_TRIGGER_HAPPY 0x2c0
628#define BTN_TRIGGER_HAPPY1 0x2c0 677#define BTN_TRIGGER_HAPPY1 0x2c0
629#define BTN_TRIGGER_HAPPY2 0x2c1 678#define BTN_TRIGGER_HAPPY2 0x2c1
@@ -733,11 +782,12 @@ struct input_keymap_entry {
733#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 782#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
734#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 783#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
735#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 784#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
785#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
736 786
737#ifdef __KERNEL__ 787#ifdef __KERNEL__
738/* Implementation details, userspace should not care about these */ 788/* Implementation details, userspace should not care about these */
739#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR 789#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
740#define ABS_MT_LAST ABS_MT_PRESSURE 790#define ABS_MT_LAST ABS_MT_DISTANCE
741#endif 791#endif
742 792
743#define ABS_MAX 0x3f 793#define ABS_MAX 0x3f
@@ -761,6 +811,7 @@ struct input_keymap_entry {
761#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ 811#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
762#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ 812#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
763#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ 813#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
814#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
764#define SW_MAX 0x0f 815#define SW_MAX 0x0f
765#define SW_CNT (SW_MAX+1) 816#define SW_CNT (SW_MAX+1)
766 817
@@ -848,6 +899,7 @@ struct input_keymap_entry {
848 */ 899 */
849#define MT_TOOL_FINGER 0 900#define MT_TOOL_FINGER 0
850#define MT_TOOL_PEN 1 901#define MT_TOOL_PEN 1
902#define MT_TOOL_MAX 1
851 903
852/* 904/*
853 * Values describing the status of a force-feedback effect 905 * Values describing the status of a force-feedback effect
@@ -1083,19 +1135,12 @@ struct ff_effect {
1083#include <linux/mod_devicetable.h> 1135#include <linux/mod_devicetable.h>
1084 1136
1085/** 1137/**
1086 * struct input_mt_slot - represents the state of an input MT slot
1087 * @abs: holds current values of ABS_MT axes for this slot
1088 */
1089struct input_mt_slot {
1090 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
1091};
1092
1093/**
1094 * struct input_dev - represents an input device 1138 * struct input_dev - represents an input device
1095 * @name: name of the device 1139 * @name: name of the device
1096 * @phys: physical path to the device in the system hierarchy 1140 * @phys: physical path to the device in the system hierarchy
1097 * @uniq: unique identification code for the device (if device has it) 1141 * @uniq: unique identification code for the device (if device has it)
1098 * @id: id of the device (struct input_id) 1142 * @id: id of the device (struct input_id)
1143 * @propbit: bitmap of device properties and quirks
1099 * @evbit: bitmap of types of events supported by the device (EV_KEY, 1144 * @evbit: bitmap of types of events supported by the device (EV_KEY,
1100 * EV_REL, etc.) 1145 * EV_REL, etc.)
1101 * @keybit: bitmap of keys/buttons this device has 1146 * @keybit: bitmap of keys/buttons this device has
@@ -1118,8 +1163,6 @@ struct input_mt_slot {
1118 * sparse keymaps. If not supplied default mechanism will be used. 1163 * sparse keymaps. If not supplied default mechanism will be used.
1119 * The method is being called while holding event_lock and thus must 1164 * The method is being called while holding event_lock and thus must
1120 * not sleep 1165 * not sleep
1121 * @getkeycode_new: transition method
1122 * @setkeycode_new: transition method
1123 * @ff: force feedback structure associated with the device if device 1166 * @ff: force feedback structure associated with the device if device
1124 * supports force feedback effects 1167 * supports force feedback effects
1125 * @repeat_key: stores key code of the last key pressed; used to implement 1168 * @repeat_key: stores key code of the last key pressed; used to implement
@@ -1130,7 +1173,8 @@ struct input_mt_slot {
1130 * of tracked contacts 1173 * of tracked contacts
1131 * @mtsize: number of MT slots the device uses 1174 * @mtsize: number of MT slots the device uses
1132 * @slot: MT slot currently being transmitted 1175 * @slot: MT slot currently being transmitted
1133 * @absinfo: array of &struct absinfo elements holding information 1176 * @trkid: stores MT tracking ID for the current contact
1177 * @absinfo: array of &struct input_absinfo elements holding information
1134 * about absolute axes (current value, min, max, flat, fuzz, 1178 * about absolute axes (current value, min, max, flat, fuzz,
1135 * resolution) 1179 * resolution)
1136 * @key: reflects current state of device's keys/buttons 1180 * @key: reflects current state of device's keys/buttons
@@ -1178,6 +1222,8 @@ struct input_dev {
1178 const char *uniq; 1222 const char *uniq;
1179 struct input_id id; 1223 struct input_id id;
1180 1224
1225 unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];
1226
1181 unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; 1227 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
1182 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; 1228 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
1183 unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; 1229 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
@@ -1195,14 +1241,10 @@ struct input_dev {
1195 void *keycode; 1241 void *keycode;
1196 1242
1197 int (*setkeycode)(struct input_dev *dev, 1243 int (*setkeycode)(struct input_dev *dev,
1198 unsigned int scancode, unsigned int keycode); 1244 const struct input_keymap_entry *ke,
1245 unsigned int *old_keycode);
1199 int (*getkeycode)(struct input_dev *dev, 1246 int (*getkeycode)(struct input_dev *dev,
1200 unsigned int scancode, unsigned int *keycode); 1247 struct input_keymap_entry *ke);
1201 int (*setkeycode_new)(struct input_dev *dev,
1202 const struct input_keymap_entry *ke,
1203 unsigned int *old_keycode);
1204 int (*getkeycode_new)(struct input_dev *dev,
1205 struct input_keymap_entry *ke);
1206 1248
1207 struct ff_device *ff; 1249 struct ff_device *ff;
1208 1250
@@ -1214,6 +1256,7 @@ struct input_dev {
1214 struct input_mt_slot *mt; 1256 struct input_mt_slot *mt;
1215 int mtsize; 1257 int mtsize;
1216 int slot; 1258 int slot;
1259 int trkid;
1217 1260
1218 struct input_absinfo *absinfo; 1261 struct input_absinfo *absinfo;
1219 1262
@@ -1406,6 +1449,8 @@ static inline void input_set_drvdata(struct input_dev *dev, void *data)
1406int __must_check input_register_device(struct input_dev *); 1449int __must_check input_register_device(struct input_dev *);
1407void input_unregister_device(struct input_dev *); 1450void input_unregister_device(struct input_dev *);
1408 1451
1452void input_reset_device(struct input_dev *);
1453
1409int __must_check input_register_handler(struct input_handler *); 1454int __must_check input_register_handler(struct input_handler *);
1410void input_unregister_handler(struct input_handler *); 1455void input_unregister_handler(struct input_handler *);
1411 1456
@@ -1421,7 +1466,7 @@ void input_release_device(struct input_handle *);
1421int input_open_device(struct input_handle *); 1466int input_open_device(struct input_handle *);
1422void input_close_device(struct input_handle *); 1467void input_close_device(struct input_handle *);
1423 1468
1424int input_flush_device(struct input_handle* handle, struct file* file); 1469int input_flush_device(struct input_handle *handle, struct file *file);
1425 1470
1426void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); 1471void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
1427void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1472void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
@@ -1461,11 +1506,6 @@ static inline void input_mt_sync(struct input_dev *dev)
1461 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1506 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1462} 1507}
1463 1508
1464static inline void input_mt_slot(struct input_dev *dev, int slot)
1465{
1466 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
1467}
1468
1469void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1509void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1470 1510
1471/** 1511/**
@@ -1578,8 +1618,5 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1578int input_ff_create_memless(struct input_dev *dev, void *data, 1618int input_ff_create_memless(struct input_dev *dev, void *data,
1579 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1619 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1580 1620
1581int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
1582void input_mt_destroy_slots(struct input_dev *dev);
1583
1584#endif 1621#endif
1585#endif 1622#endif
diff --git a/include/linux/input/as5011.h b/include/linux/input/as5011.h
new file mode 100644
index 000000000000..1affd0ddfa9d
--- /dev/null
+++ b/include/linux/input/as5011.h
@@ -0,0 +1,20 @@
1#ifndef _AS5011_H
2#define _AS5011_H
3
4/*
5 * Copyright (c) 2010, 2011 Fabien Marteau <fabien.marteau@armadeus.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12struct as5011_platform_data {
13 unsigned int button_gpio;
14 unsigned int axis_irq; /* irq number */
15 unsigned long axis_irqflags;
16 char xp, xn; /* threshold for x axis */
17 char yp, yn; /* threshold for y axis */
18};
19
20#endif /* _AS5011_H */
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h
index e470d387dd49..05e03284b92a 100644
--- a/include/linux/input/bu21013.h
+++ b/include/linux/input/bu21013.h
@@ -12,8 +12,6 @@
12 * @cs_en: pointer to the cs enable function 12 * @cs_en: pointer to the cs enable function
13 * @cs_dis: pointer to the cs disable function 13 * @cs_dis: pointer to the cs disable function
14 * @irq_read_val: pointer to read the pen irq value function 14 * @irq_read_val: pointer to read the pen irq value function
15 * @x_max_res: xmax resolution
16 * @y_max_res: ymax resolution
17 * @touch_x_max: touch x max 15 * @touch_x_max: touch x max
18 * @touch_y_max: touch y max 16 * @touch_y_max: touch y max
19 * @cs_pin: chip select pin 17 * @cs_pin: chip select pin
@@ -29,8 +27,6 @@ struct bu21013_platform_device {
29 int (*cs_en)(int reset_pin); 27 int (*cs_en)(int reset_pin);
30 int (*cs_dis)(int reset_pin); 28 int (*cs_dis)(int reset_pin);
31 int (*irq_read_val)(void); 29 int (*irq_read_val)(void);
32 int x_max_res;
33 int y_max_res;
34 int touch_x_max; 30 int touch_x_max;
35 int touch_y_max; 31 int touch_y_max;
36 unsigned int cs_pin; 32 unsigned int cs_pin;
diff --git a/include/linux/input/cma3000.h b/include/linux/input/cma3000.h
new file mode 100644
index 000000000000..cbbaac27d311
--- /dev/null
+++ b/include/linux/input/cma3000.h
@@ -0,0 +1,59 @@
1/*
2 * VTI CMA3000_Dxx Accelerometer driver
3 *
4 * Copyright (C) 2010 Texas Instruments
5 * Author: Hemanth V <hemanthv@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _LINUX_CMA3000_H
21#define _LINUX_CMA3000_H
22
23#define CMAMODE_DEFAULT 0
24#define CMAMODE_MEAS100 1
25#define CMAMODE_MEAS400 2
26#define CMAMODE_MEAS40 3
27#define CMAMODE_MOTDET 4
28#define CMAMODE_FF100 5
29#define CMAMODE_FF400 6
30#define CMAMODE_POFF 7
31
32#define CMARANGE_2G 2000
33#define CMARANGE_8G 8000
34
35/**
36 * struct cma3000_i2c_platform_data - CMA3000 Platform data
37 * @fuzz_x: Noise on X Axis
38 * @fuzz_y: Noise on Y Axis
39 * @fuzz_z: Noise on Z Axis
40 * @g_range: G range in milli g i.e 2000 or 8000
41 * @mode: Operating mode
42 * @mdthr: Motion detect threshold value
43 * @mdfftmr: Motion detect and free fall time value
44 * @ffthr: Free fall threshold value
45 */
46
47struct cma3000_platform_data {
48 int fuzz_x;
49 int fuzz_y;
50 int fuzz_z;
51 int g_range;
52 uint8_t mode;
53 uint8_t mdthr;
54 uint8_t mdfftmr;
55 uint8_t ffthr;
56 unsigned long irqflags;
57};
58
59#endif
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 80352ad6581a..fe7c4b9ae270 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -4,12 +4,12 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/input.h> 5#include <linux/input.h>
6 6
7#define MATRIX_MAX_ROWS 16 7#define MATRIX_MAX_ROWS 32
8#define MATRIX_MAX_COLS 16 8#define MATRIX_MAX_COLS 32
9 9
10#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ 10#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ 11 (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
12 (val & 0xffff)) 12 ((val) & 0xffff))
13 13
14#define KEY_ROW(k) (((k) >> 24) & 0xff) 14#define KEY_ROW(k) (((k) >> 24) & 0xff)
15#define KEY_COL(k) (((k) >> 16) & 0xff) 15#define KEY_COL(k) (((k) >> 16) & 0xff)
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
new file mode 100644
index 000000000000..318bb82325a6
--- /dev/null
+++ b/include/linux/input/mt.h
@@ -0,0 +1,63 @@
1#ifndef _INPUT_MT_H
2#define _INPUT_MT_H
3
4/*
5 * Input Multitouch Library
6 *
7 * Copyright (c) 2010 Henrik Rydberg
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 */
13
14#include <linux/input.h>
15
16#define TRKID_MAX 0xffff
17
18/**
19 * struct input_mt_slot - represents the state of an input MT slot
20 * @abs: holds current values of ABS_MT axes for this slot
21 */
22struct input_mt_slot {
23 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
24};
25
26static inline void input_mt_set_value(struct input_mt_slot *slot,
27 unsigned code, int value)
28{
29 slot->abs[code - ABS_MT_FIRST] = value;
30}
31
32static inline int input_mt_get_value(const struct input_mt_slot *slot,
33 unsigned code)
34{
35 return slot->abs[code - ABS_MT_FIRST];
36}
37
38int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
39void input_mt_destroy_slots(struct input_dev *dev);
40
41static inline int input_mt_new_trkid(struct input_dev *dev)
42{
43 return dev->trkid++ & TRKID_MAX;
44}
45
46static inline void input_mt_slot(struct input_dev *dev, int slot)
47{
48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
49}
50
51static inline bool input_is_mt_axis(int axis)
52{
53 return axis == ABS_MT_SLOT ||
54 (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
55}
56
57void input_mt_report_slot_state(struct input_dev *dev,
58 unsigned int tool_type, bool active);
59
60void input_mt_report_finger_count(struct input_dev *dev, int count);
61void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
62
63#endif
diff --git a/include/linux/intel-gtt.h b/include/linux/intel-gtt.h
deleted file mode 100644
index 1d19ab2afa39..000000000000
--- a/include/linux/intel-gtt.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Common Intel AGPGART and GTT definitions.
3 */
4#ifndef _INTEL_GTT_H
5#define _INTEL_GTT_H
6
7#include <linux/agp_backend.h>
8
9/* This is for Intel only GTT controls.
10 *
11 * Sandybridge: AGP_USER_CACHED_MEMORY default to LLC only
12 */
13
14#define AGP_USER_CACHED_MEMORY_LLC_MLC (AGP_USER_TYPES + 2)
15#define AGP_USER_UNCACHED_MEMORY (AGP_USER_TYPES + 4)
16
17/* flag for GFDT type */
18#define AGP_USER_CACHED_MEMORY_GFDT (1 << 3)
19
20#endif
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
index d9d08b6269b6..10496bd24c5c 100644
--- a/include/linux/intel_mid_dma.h
+++ b/include/linux/intel_mid_dma.h
@@ -27,14 +27,7 @@
27 27
28#include <linux/dmaengine.h> 28#include <linux/dmaengine.h>
29 29
30/*DMA transaction width, src and dstn width would be same 30#define DMA_PREP_CIRCULAR_LIST (1 << 10)
31The DMA length must be width aligned,
32for 32 bit width the length must be 32 bit (4bytes) aligned only*/
33enum intel_mid_dma_width {
34 LNW_DMA_WIDTH_8BIT = 0x0,
35 LNW_DMA_WIDTH_16BIT = 0x1,
36 LNW_DMA_WIDTH_32BIT = 0x2,
37};
38 31
39/*DMA mode configurations*/ 32/*DMA mode configurations*/
40enum intel_mid_dma_mode { 33enum intel_mid_dma_mode {
@@ -69,18 +62,15 @@ enum intel_mid_dma_msize {
69 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem) 62 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
70 * @src_msize: Source DMA burst size 63 * @src_msize: Source DMA burst size
71 * @dst_msize: Dst DMA burst size 64 * @dst_msize: Dst DMA burst size
65 * @per_addr: Periphral address
72 * @device_instance: DMA peripheral device instance, we can have multiple 66 * @device_instance: DMA peripheral device instance, we can have multiple
73 * peripheral device connected to single DMAC 67 * peripheral device connected to single DMAC
74 */ 68 */
75struct intel_mid_dma_slave { 69struct intel_mid_dma_slave {
76 enum dma_data_direction dirn;
77 enum intel_mid_dma_width src_width; /*width of DMA src txn*/
78 enum intel_mid_dma_width dst_width; /*width of DMA dst txn*/
79 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/ 70 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
80 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/ 71 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
81 enum intel_mid_dma_msize src_msize; /*size if src burst*/
82 enum intel_mid_dma_msize dst_msize; /*size of dst burst*/
83 unsigned int device_instance; /*0, 1 for periphral instance*/ 72 unsigned int device_instance; /*0, 1 for periphral instance*/
73 struct dma_slave_config dma_slave;
84}; 74};
85 75
86#endif /*__INTEL_MID_DMA_H__*/ 76#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 01b281646251..6c12989839d9 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,6 +14,8 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/percpu.h> 15#include <linux/percpu.h>
16#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
17#include <linux/kref.h>
18#include <linux/workqueue.h>
17 19
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/ptrace.h> 21#include <asm/ptrace.h>
@@ -55,7 +57,8 @@
55 * Used by threaded interrupts which need to keep the 57 * Used by threaded interrupts which need to keep the
56 * irq line disabled until the threaded handler has been run. 58 * irq line disabled until the threaded handler has been run.
57 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend 59 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
58 * 60 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
61 * IRQF_NO_THREAD - Interrupt cannot be threaded
59 */ 62 */
60#define IRQF_DISABLED 0x00000020 63#define IRQF_DISABLED 0x00000020
61#define IRQF_SAMPLE_RANDOM 0x00000040 64#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -67,22 +70,10 @@
67#define IRQF_IRQPOLL 0x00001000 70#define IRQF_IRQPOLL 0x00001000
68#define IRQF_ONESHOT 0x00002000 71#define IRQF_ONESHOT 0x00002000
69#define IRQF_NO_SUSPEND 0x00004000 72#define IRQF_NO_SUSPEND 0x00004000
73#define IRQF_FORCE_RESUME 0x00008000
74#define IRQF_NO_THREAD 0x00010000
70 75
71#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) 76#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
72
73/*
74 * Bits used by threaded handlers:
75 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
76 * IRQTF_DIED - handler thread died
77 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
78 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
79 */
80enum {
81 IRQTF_RUNTHREAD,
82 IRQTF_DIED,
83 IRQTF_WARNED,
84 IRQTF_AFFINITY,
85};
86 77
87/* 78/*
88 * These values can be returned by request_any_context_irq() and 79 * These values can be returned by request_any_context_irq() and
@@ -107,22 +98,24 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
107 * @next: pointer to the next irqaction for shared interrupts 98 * @next: pointer to the next irqaction for shared interrupts
108 * @irq: interrupt number 99 * @irq: interrupt number
109 * @dir: pointer to the proc/irq/NN/name entry 100 * @dir: pointer to the proc/irq/NN/name entry
110 * @thread_fn: interupt handler function for threaded interrupts 101 * @thread_fn: interrupt handler function for threaded interrupts
111 * @thread: thread pointer for threaded interrupts 102 * @thread: thread pointer for threaded interrupts
112 * @thread_flags: flags related to @thread 103 * @thread_flags: flags related to @thread
104 * @thread_mask: bitmask for keeping track of @thread activity
113 */ 105 */
114struct irqaction { 106struct irqaction {
115 irq_handler_t handler; 107 irq_handler_t handler;
116 unsigned long flags; 108 unsigned long flags;
117 const char *name;
118 void *dev_id; 109 void *dev_id;
119 struct irqaction *next; 110 struct irqaction *next;
120 int irq; 111 int irq;
121 struct proc_dir_entry *dir;
122 irq_handler_t thread_fn; 112 irq_handler_t thread_fn;
123 struct task_struct *thread; 113 struct task_struct *thread;
124 unsigned long thread_flags; 114 unsigned long thread_flags;
125}; 115 unsigned long thread_mask;
116 const char *name;
117 struct proc_dir_entry *dir;
118} ____cacheline_internodealigned_in_smp;
126 119
127extern irqreturn_t no_action(int cpl, void *dev_id); 120extern irqreturn_t no_action(int cpl, void *dev_id);
128 121
@@ -240,6 +233,35 @@ extern int irq_can_set_affinity(unsigned int irq);
240extern int irq_select_affinity(unsigned int irq); 233extern int irq_select_affinity(unsigned int irq);
241 234
242extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 235extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
236
237/**
238 * struct irq_affinity_notify - context for notification of IRQ affinity changes
239 * @irq: Interrupt to which notification applies
240 * @kref: Reference count, for internal use
241 * @work: Work item, for internal use
242 * @notify: Function to be called on change. This will be
243 * called in process context.
244 * @release: Function to be called on release. This will be
245 * called in process context. Once registered, the
246 * structure must only be freed when this function is
247 * called or later.
248 */
249struct irq_affinity_notify {
250 unsigned int irq;
251 struct kref kref;
252 struct work_struct work;
253 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
254 void (*release)(struct kref *ref);
255};
256
257extern int
258irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
259
260static inline void irq_run_affinity_notifiers(void)
261{
262 flush_scheduled_work();
263}
264
243#else /* CONFIG_SMP */ 265#else /* CONFIG_SMP */
244 266
245static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 267static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -255,7 +277,7 @@ static inline int irq_can_set_affinity(unsigned int irq)
255static inline int irq_select_affinity(unsigned int irq) { return 0; } 277static inline int irq_select_affinity(unsigned int irq) { return 0; }
256 278
257static inline int irq_set_affinity_hint(unsigned int irq, 279static inline int irq_set_affinity_hint(unsigned int irq,
258 const struct cpumask *m) 280 const struct cpumask *m)
259{ 281{
260 return -EINVAL; 282 return -EINVAL;
261} 283}
@@ -314,16 +336,16 @@ static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long
314} 336}
315 337
316/* IRQ wakeup (PM) control: */ 338/* IRQ wakeup (PM) control: */
317extern int set_irq_wake(unsigned int irq, unsigned int on); 339extern int irq_set_irq_wake(unsigned int irq, unsigned int on);
318 340
319static inline int enable_irq_wake(unsigned int irq) 341static inline int enable_irq_wake(unsigned int irq)
320{ 342{
321 return set_irq_wake(irq, 1); 343 return irq_set_irq_wake(irq, 1);
322} 344}
323 345
324static inline int disable_irq_wake(unsigned int irq) 346static inline int disable_irq_wake(unsigned int irq)
325{ 347{
326 return set_irq_wake(irq, 0); 348 return irq_set_irq_wake(irq, 0);
327} 349}
328 350
329#else /* !CONFIG_GENERIC_HARDIRQS */ 351#else /* !CONFIG_GENERIC_HARDIRQS */
@@ -353,6 +375,13 @@ static inline int disable_irq_wake(unsigned int irq)
353} 375}
354#endif /* CONFIG_GENERIC_HARDIRQS */ 376#endif /* CONFIG_GENERIC_HARDIRQS */
355 377
378
379#ifdef CONFIG_IRQ_FORCED_THREADING
380extern bool force_irqthreads;
381#else
382#define force_irqthreads (0)
383#endif
384
356#ifndef __ARCH_SET_SOFTIRQ_PENDING 385#ifndef __ARCH_SET_SOFTIRQ_PENDING
357#define set_softirq_pending(x) (local_softirq_pending() = (x)) 386#define set_softirq_pending(x) (local_softirq_pending() = (x))
358#define or_softirq_pending(x) (local_softirq_pending() |= (x)) 387#define or_softirq_pending(x) (local_softirq_pending() |= (x))
@@ -385,7 +414,6 @@ enum
385 TASKLET_SOFTIRQ, 414 TASKLET_SOFTIRQ,
386 SCHED_SOFTIRQ, 415 SCHED_SOFTIRQ,
387 HRTIMER_SOFTIRQ, 416 HRTIMER_SOFTIRQ,
388 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
389 417
390 NR_SOFTIRQS 418 NR_SOFTIRQS
391}; 419};
@@ -410,7 +438,7 @@ extern void open_softirq(int nr, void (*action)(struct softirq_action *));
410extern void softirq_init(void); 438extern void softirq_init(void);
411static inline void __raise_softirq_irqoff(unsigned int nr) 439static inline void __raise_softirq_irqoff(unsigned int nr)
412{ 440{
413 trace_softirq_raise((struct softirq_action *)(unsigned long)nr, NULL); 441 trace_softirq_raise(nr);
414 or_softirq_pending(1UL << nr); 442 or_softirq_pending(1UL << nr);
415} 443}
416 444
@@ -426,6 +454,13 @@ extern void raise_softirq(unsigned int nr);
426 */ 454 */
427DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); 455DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
428 456
457DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
458
459static inline struct task_struct *this_cpu_ksoftirqd(void)
460{
461 return this_cpu_read(ksoftirqd);
462}
463
429/* Try to send a softirq to a remote cpu. If this cannot be done, the 464/* Try to send a softirq to a remote cpu. If this cannot be done, the
430 * work will be queued to the local cpu. 465 * work will be queued to the local cpu.
431 */ 466 */
@@ -448,7 +483,7 @@ extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
448 Properties: 483 Properties:
449 * If tasklet_schedule() is called, then tasklet is guaranteed 484 * If tasklet_schedule() is called, then tasklet is guaranteed
450 to be executed on some cpu at least once after this. 485 to be executed on some cpu at least once after this.
451 * If the tasklet is already scheduled, but its excecution is still not 486 * If the tasklet is already scheduled, but its execution is still not
452 started, it will be executed only once. 487 started, it will be executed only once.
453 * If this tasklet is already running on another CPU (or schedule is called 488 * If this tasklet is already running on another CPU (or schedule is called
454 from tasklet itself), it is rescheduled for later. 489 from tasklet itself), it is rescheduled for later.
@@ -645,6 +680,7 @@ static inline void init_irq_proc(void)
645 680
646struct seq_file; 681struct seq_file;
647int show_interrupts(struct seq_file *p, void *v); 682int show_interrupts(struct seq_file *p, void *v);
683int arch_show_interrupts(struct seq_file *p, int prec);
648 684
649extern int early_irq_init(void); 685extern int early_irq_init(void);
650extern int arch_probe_nr_irqs(void); 686extern int arch_probe_nr_irqs(void);
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 7fb592793738..8cdcc2a199ad 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -81,8 +81,7 @@ io_mapping_free(struct io_mapping *mapping)
81/* Atomic map/unmap */ 81/* Atomic map/unmap */
82static inline void __iomem * 82static inline void __iomem *
83io_mapping_map_atomic_wc(struct io_mapping *mapping, 83io_mapping_map_atomic_wc(struct io_mapping *mapping,
84 unsigned long offset, 84 unsigned long offset)
85 int slot)
86{ 85{
87 resource_size_t phys_addr; 86 resource_size_t phys_addr;
88 unsigned long pfn; 87 unsigned long pfn;
@@ -90,13 +89,13 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping,
90 BUG_ON(offset >= mapping->size); 89 BUG_ON(offset >= mapping->size);
91 phys_addr = mapping->base + offset; 90 phys_addr = mapping->base + offset;
92 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); 91 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
93 return iomap_atomic_prot_pfn(pfn, slot, mapping->prot); 92 return iomap_atomic_prot_pfn(pfn, mapping->prot);
94} 93}
95 94
96static inline void 95static inline void
97io_mapping_unmap_atomic(void __iomem *vaddr, int slot) 96io_mapping_unmap_atomic(void __iomem *vaddr)
98{ 97{
99 iounmap_atomic(vaddr, slot); 98 iounmap_atomic(vaddr);
100} 99}
101 100
102static inline void __iomem * 101static inline void __iomem *
@@ -137,14 +136,13 @@ io_mapping_free(struct io_mapping *mapping)
137/* Atomic map/unmap */ 136/* Atomic map/unmap */
138static inline void __iomem * 137static inline void __iomem *
139io_mapping_map_atomic_wc(struct io_mapping *mapping, 138io_mapping_map_atomic_wc(struct io_mapping *mapping,
140 unsigned long offset, 139 unsigned long offset)
141 int slot)
142{ 140{
143 return ((char __force __iomem *) mapping) + offset; 141 return ((char __force __iomem *) mapping) + offset;
144} 142}
145 143
146static inline void 144static inline void
147io_mapping_unmap_atomic(void __iomem *vaddr, int slot) 145io_mapping_unmap_atomic(void __iomem *vaddr)
148{ 146{
149} 147}
150 148
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 3e70b21884a9..b2eee896dcbc 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -76,7 +76,6 @@ int put_io_context(struct io_context *ioc);
76void exit_io_context(struct task_struct *task); 76void exit_io_context(struct task_struct *task);
77struct io_context *get_io_context(gfp_t gfp_flags, int node); 77struct io_context *get_io_context(gfp_t gfp_flags, int node);
78struct io_context *alloc_io_context(gfp_t gfp_flags, int node); 78struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
79void copy_io_context(struct io_context **pdst, struct io_context **psrc);
80#else 79#else
81static inline void exit_io_context(struct task_struct *task) 80static inline void exit_io_context(struct task_struct *task)
82{ 81{
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index b22790268b64..e9bb22cba764 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -123,6 +123,7 @@ extern void reserve_region_with_split(struct resource *root,
123extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); 123extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
124extern int insert_resource(struct resource *parent, struct resource *new); 124extern int insert_resource(struct resource *parent, struct resource *new);
125extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 125extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
126extern void arch_remove_reservations(struct resource *avail);
126extern int allocate_resource(struct resource *root, struct resource *new, 127extern int allocate_resource(struct resource *root, struct resource *new,
127 resource_size_t size, resource_size_t min, 128 resource_size_t size, resource_size_t min,
128 resource_size_t max, resource_size_t align, 129 resource_size_t max, resource_size_t align,
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 5f43a3b2e3ad..4deb3834d62c 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,14 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \
95 IP_VS_CONN_F_SEQ_MASK | \
96 IP_VS_CONN_F_NO_CPORT | \
97 IP_VS_CONN_F_TEMPLATE \
98 )
99
92/* Flags that are not sent to backup server start from bit 16 */ 100/* Flags that are not sent to backup server start from bit 16 */
93#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
94 102
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 51952989ad42..a6d1655f9607 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -5,6 +5,7 @@
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#include <linux/notifier.h> 7#include <linux/notifier.h>
8#include <linux/nsproxy.h>
8 9
9/* 10/*
10 * ipc namespace events 11 * ipc namespace events
@@ -15,6 +16,7 @@
15 16
16#define IPCNS_CALLBACK_PRI 0 17#define IPCNS_CALLBACK_PRI 0
17 18
19struct user_namespace;
18 20
19struct ipc_ids { 21struct ipc_ids {
20 int in_use; 22 int in_use;
@@ -56,6 +58,8 @@ struct ipc_namespace {
56 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ 58 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
57 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ 59 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
58 60
61 /* user_ns which owns the ipc ns */
62 struct user_namespace *user_ns;
59}; 63};
60 64
61extern struct ipc_namespace init_ipc_ns; 65extern struct ipc_namespace init_ipc_ns;
@@ -90,7 +94,7 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
90 94
91#if defined(CONFIG_IPC_NS) 95#if defined(CONFIG_IPC_NS)
92extern struct ipc_namespace *copy_ipcs(unsigned long flags, 96extern struct ipc_namespace *copy_ipcs(unsigned long flags,
93 struct ipc_namespace *ns); 97 struct task_struct *tsk);
94static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 98static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
95{ 99{
96 if (ns) 100 if (ns)
@@ -101,12 +105,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
101extern void put_ipc_ns(struct ipc_namespace *ns); 105extern void put_ipc_ns(struct ipc_namespace *ns);
102#else 106#else
103static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 107static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
104 struct ipc_namespace *ns) 108 struct task_struct *tsk)
105{ 109{
106 if (flags & CLONE_NEWIPC) 110 if (flags & CLONE_NEWIPC)
107 return ERR_PTR(-EINVAL); 111 return ERR_PTR(-EINVAL);
108 112
109 return ns; 113 return tsk->nsproxy->ipc_ns;
110} 114}
111 115
112static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 116static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 65aae34759de..ca85cf894e33 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -111,7 +111,7 @@ struct ipmi_ipmb_addr {
111 * A LAN Address. This is an address to/from a LAN interface bridged 111 * A LAN Address. This is an address to/from a LAN interface bridged
112 * by the BMC, not an address actually out on the LAN. 112 * by the BMC, not an address actually out on the LAN.
113 * 113 *
114 * A concious decision was made here to deviate slightly from the IPMI 114 * A conscious decision was made here to deviate slightly from the IPMI
115 * spec. We do not use rqSWID and rsSWID like it shows in the 115 * spec. We do not use rqSWID and rsSWID like it shows in the
116 * message. Instead, we use remote_SWID and local_SWID. This means 116 * message. Instead, we use remote_SWID and local_SWID. This means
117 * that any message (a request or response) from another device will 117 * that any message (a request or response) from another device will
@@ -259,7 +259,7 @@ struct ipmi_recv_msg {
259 void (*done)(struct ipmi_recv_msg *msg); 259 void (*done)(struct ipmi_recv_msg *msg);
260 260
261 /* Place-holder for the data, don't make any assumptions about 261 /* Place-holder for the data, don't make any assumptions about
262 the size or existance of this, since it may change. */ 262 the size or existence of this, since it may change. */
263 unsigned char msg_data[IPMI_MAX_MSG_LENGTH]; 263 unsigned char msg_data[IPMI_MAX_MSG_LENGTH];
264}; 264};
265 265
@@ -454,6 +454,44 @@ unsigned int ipmi_addr_length(int addr_type);
454/* Validate that the given IPMI address is valid. */ 454/* Validate that the given IPMI address is valid. */
455int ipmi_validate_addr(struct ipmi_addr *addr, int len); 455int ipmi_validate_addr(struct ipmi_addr *addr, int len);
456 456
457/*
458 * How did the IPMI driver find out about the device?
459 */
460enum ipmi_addr_src {
461 SI_INVALID = 0, SI_HOTMOD, SI_HARDCODED, SI_SPMI, SI_ACPI, SI_SMBIOS,
462 SI_PCI, SI_DEVICETREE, SI_DEFAULT
463};
464
465union ipmi_smi_info_union {
466 /*
467 * the acpi_info element is defined for the SI_ACPI
468 * address type
469 */
470 struct {
471 void *acpi_handle;
472 } acpi_info;
473};
474
475struct ipmi_smi_info {
476 enum ipmi_addr_src addr_src;
477
478 /*
479 * Base device for the interface. Don't forget to put this when
480 * you are done.
481 */
482 struct device *dev;
483
484 /*
485 * The addr_info provides more detailed info for some IPMI
486 * devices, depending on the addr_src. Currently only SI_ACPI
487 * info is provided.
488 */
489 union ipmi_smi_info_union addr_info;
490};
491
492/* This is to get the private info of ipmi_smi_t */
493extern int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data);
494
457#endif /* __KERNEL__ */ 495#endif /* __KERNEL__ */
458 496
459 497
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 4b48318ac542..906590aa6907 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -39,6 +39,7 @@
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/platform_device.h> 41#include <linux/platform_device.h>
42#include <linux/ipmi.h>
42 43
43/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
44 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
@@ -86,6 +87,13 @@ struct ipmi_smi_handlers {
86 int (*start_processing)(void *send_info, 87 int (*start_processing)(void *send_info,
87 ipmi_smi_t new_intf); 88 ipmi_smi_t new_intf);
88 89
90 /*
91 * Get the detailed private info of the low level interface and store
92 * it into the structure of ipmi_smi_data. For example: the
93 * ACPI device handle will be returned for the pnp_acpi IPMI device.
94 */
95 int (*get_smi_info)(void *send_info, struct ipmi_smi_info *data);
96
89 /* Called to enqueue an SMI message to be sent. This 97 /* Called to enqueue an SMI message to be sent. This
90 operation is not allowed to fail. If an error occurs, it 98 operation is not allowed to fail. If an error occurs, it
91 should report back the error in a received message. It may 99 should report back the error in a received message. It may
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 8e429d0e0405..0c997767429a 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -364,7 +364,7 @@ struct ipv6_pinfo {
364 364
365 __u32 dst_cookie; 365 __u32 dst_cookie;
366 366
367 struct ipv6_mc_socklist *ipv6_mc_list; 367 struct ipv6_mc_socklist __rcu *ipv6_mc_list;
368 struct ipv6_ac_socklist *ipv6_ac_list; 368 struct ipv6_ac_socklist *ipv6_ac_list;
369 struct ipv6_fl_socklist *ipv6_fl_list; 369 struct ipv6_fl_socklist *ipv6_fl_list;
370 370
diff --git a/include/linux/irq.h b/include/linux/irq.h
index e9639115dff1..8b4538446636 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -28,61 +28,89 @@
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
29#include <asm/irq_regs.h> 29#include <asm/irq_regs.h>
30 30
31struct seq_file;
31struct irq_desc; 32struct irq_desc;
33struct irq_data;
32typedef void (*irq_flow_handler_t)(unsigned int irq, 34typedef void (*irq_flow_handler_t)(unsigned int irq,
33 struct irq_desc *desc); 35 struct irq_desc *desc);
34 36typedef void (*irq_preflow_handler_t)(struct irq_data *data);
35 37
36/* 38/*
37 * IRQ line status. 39 * IRQ line status.
38 * 40 *
39 * Bits 0-7 are reserved for the IRQF_* bits in linux/interrupt.h 41 * Bits 0-7 are the same as the IRQF_* bits in linux/interrupt.h
42 *
43 * IRQ_TYPE_NONE - default, unspecified type
44 * IRQ_TYPE_EDGE_RISING - rising edge triggered
45 * IRQ_TYPE_EDGE_FALLING - falling edge triggered
46 * IRQ_TYPE_EDGE_BOTH - rising and falling edge triggered
47 * IRQ_TYPE_LEVEL_HIGH - high level triggered
48 * IRQ_TYPE_LEVEL_LOW - low level triggered
49 * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits
50 * IRQ_TYPE_SENSE_MASK - Mask for all the above bits
51 * IRQ_TYPE_PROBE - Special flag for probing in progress
40 * 52 *
41 * IRQ types 53 * Bits which can be modified via irq_set/clear/modify_status_flags()
54 * IRQ_LEVEL - Interrupt is level type. Will be also
55 * updated in the code when the above trigger
56 * bits are modified via irq_set_irq_type()
57 * IRQ_PER_CPU - Mark an interrupt PER_CPU. Will protect
58 * it from affinity setting
59 * IRQ_NOPROBE - Interrupt cannot be probed by autoprobing
60 * IRQ_NOREQUEST - Interrupt cannot be requested via
61 * request_irq()
62 * IRQ_NOTHREAD - Interrupt cannot be threaded
63 * IRQ_NOAUTOEN - Interrupt is not automatically enabled in
64 * request/setup_irq()
65 * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set)
66 * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context
67 * IRQ_NESTED_TRHEAD - Interrupt nests into another thread
42 */ 68 */
43#define IRQ_TYPE_NONE 0x00000000 /* Default, unspecified type */ 69enum {
44#define IRQ_TYPE_EDGE_RISING 0x00000001 /* Edge rising type */ 70 IRQ_TYPE_NONE = 0x00000000,
45#define IRQ_TYPE_EDGE_FALLING 0x00000002 /* Edge falling type */ 71 IRQ_TYPE_EDGE_RISING = 0x00000001,
46#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) 72 IRQ_TYPE_EDGE_FALLING = 0x00000002,
47#define IRQ_TYPE_LEVEL_HIGH 0x00000004 /* Level high type */ 73 IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING),
48#define IRQ_TYPE_LEVEL_LOW 0x00000008 /* Level low type */ 74 IRQ_TYPE_LEVEL_HIGH = 0x00000004,
49#define IRQ_TYPE_SENSE_MASK 0x0000000f /* Mask of the above */ 75 IRQ_TYPE_LEVEL_LOW = 0x00000008,
50#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */ 76 IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH),
51 77 IRQ_TYPE_SENSE_MASK = 0x0000000f,
52/* Internal flags */ 78
53#define IRQ_INPROGRESS 0x00000100 /* IRQ handler active - do not enter! */ 79 IRQ_TYPE_PROBE = 0x00000010,
54#define IRQ_DISABLED 0x00000200 /* IRQ disabled - do not enter! */ 80
55#define IRQ_PENDING 0x00000400 /* IRQ pending - replay on enable */ 81 IRQ_LEVEL = (1 << 8),
56#define IRQ_REPLAY 0x00000800 /* IRQ has been replayed but not acked yet */ 82 IRQ_PER_CPU = (1 << 9),
57#define IRQ_AUTODETECT 0x00001000 /* IRQ is being autodetected */ 83 IRQ_NOPROBE = (1 << 10),
58#define IRQ_WAITING 0x00002000 /* IRQ not yet seen - for autodetection */ 84 IRQ_NOREQUEST = (1 << 11),
59#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */ 85 IRQ_NOAUTOEN = (1 << 12),
60#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */ 86 IRQ_NO_BALANCING = (1 << 13),
61#define IRQ_PER_CPU 0x00010000 /* IRQ is per CPU */ 87 IRQ_MOVE_PCNTXT = (1 << 14),
62#define IRQ_NOPROBE 0x00020000 /* IRQ is not valid for probing */ 88 IRQ_NESTED_THREAD = (1 << 15),
63#define IRQ_NOREQUEST 0x00040000 /* IRQ cannot be requested */ 89 IRQ_NOTHREAD = (1 << 16),
64#define IRQ_NOAUTOEN 0x00080000 /* IRQ will not be enabled on request irq */ 90};
65#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */
66#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
67#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
68#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
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 */
74 91
75#define IRQF_MODIFY_MASK \ 92#define IRQF_MODIFY_MASK \
76 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ 93 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
77 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL) 94 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
95 IRQ_PER_CPU | IRQ_NESTED_THREAD)
78 96
79#ifdef CONFIG_IRQ_PER_CPU 97#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
80# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 98
81# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) 99static inline __deprecated bool CHECK_IRQ_PER_CPU(unsigned int status)
82#else 100{
83# define CHECK_IRQ_PER_CPU(var) 0 101 return status & IRQ_PER_CPU;
84# define IRQ_NO_BALANCING_MASK IRQ_NO_BALANCING 102}
85#endif 103
104/*
105 * Return value for chip->irq_set_affinity()
106 *
107 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity
108 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity
109 */
110enum {
111 IRQ_SET_MASK_OK = 0,
112 IRQ_SET_MASK_OK_NOCOPY,
113};
86 114
87struct msi_desc; 115struct msi_desc;
88 116
@@ -90,6 +118,8 @@ struct msi_desc;
90 * struct irq_data - per irq and irq chip data passed down to chip functions 118 * struct irq_data - per irq and irq chip data passed down to chip functions
91 * @irq: interrupt number 119 * @irq: interrupt number
92 * @node: node index useful for balancing 120 * @node: node index useful for balancing
121 * @state_use_accessors: status information for irq chip functions.
122 * Use accessor functions to deal with it
93 * @chip: low level interrupt hardware access 123 * @chip: low level interrupt hardware access
94 * @handler_data: per-IRQ data for the irq_chip methods 124 * @handler_data: per-IRQ data for the irq_chip methods
95 * @chip_data: platform-specific per-chip private data for the chip 125 * @chip_data: platform-specific per-chip private data for the chip
@@ -104,6 +134,7 @@ struct msi_desc;
104struct irq_data { 134struct irq_data {
105 unsigned int irq; 135 unsigned int irq;
106 unsigned int node; 136 unsigned int node;
137 unsigned int state_use_accessors;
107 struct irq_chip *chip; 138 struct irq_chip *chip;
108 void *handler_data; 139 void *handler_data;
109 void *chip_data; 140 void *chip_data;
@@ -113,27 +144,125 @@ struct irq_data {
113#endif 144#endif
114}; 145};
115 146
147/*
148 * Bit masks for irq_data.state
149 *
150 * IRQD_TRIGGER_MASK - Mask for the trigger type bits
151 * IRQD_SETAFFINITY_PENDING - Affinity setting is pending
152 * IRQD_NO_BALANCING - Balancing disabled for this IRQ
153 * IRQD_PER_CPU - Interrupt is per cpu
154 * IRQD_AFFINITY_SET - Interrupt affinity was set
155 * IRQD_LEVEL - Interrupt is level triggered
156 * IRQD_WAKEUP_STATE - Interrupt is configured for wakeup
157 * from suspend
158 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
159 * context
160 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
161 * IRQD_IRQ_MASKED - Masked state of the interrupt
162 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
163 */
164enum {
165 IRQD_TRIGGER_MASK = 0xf,
166 IRQD_SETAFFINITY_PENDING = (1 << 8),
167 IRQD_NO_BALANCING = (1 << 10),
168 IRQD_PER_CPU = (1 << 11),
169 IRQD_AFFINITY_SET = (1 << 12),
170 IRQD_LEVEL = (1 << 13),
171 IRQD_WAKEUP_STATE = (1 << 14),
172 IRQD_MOVE_PCNTXT = (1 << 15),
173 IRQD_IRQ_DISABLED = (1 << 16),
174 IRQD_IRQ_MASKED = (1 << 17),
175 IRQD_IRQ_INPROGRESS = (1 << 18),
176};
177
178static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
179{
180 return d->state_use_accessors & IRQD_SETAFFINITY_PENDING;
181}
182
183static inline bool irqd_is_per_cpu(struct irq_data *d)
184{
185 return d->state_use_accessors & IRQD_PER_CPU;
186}
187
188static inline bool irqd_can_balance(struct irq_data *d)
189{
190 return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING));
191}
192
193static inline bool irqd_affinity_was_set(struct irq_data *d)
194{
195 return d->state_use_accessors & IRQD_AFFINITY_SET;
196}
197
198static inline void irqd_mark_affinity_was_set(struct irq_data *d)
199{
200 d->state_use_accessors |= IRQD_AFFINITY_SET;
201}
202
203static inline u32 irqd_get_trigger_type(struct irq_data *d)
204{
205 return d->state_use_accessors & IRQD_TRIGGER_MASK;
206}
207
208/*
209 * Must only be called inside irq_chip.irq_set_type() functions.
210 */
211static inline void irqd_set_trigger_type(struct irq_data *d, u32 type)
212{
213 d->state_use_accessors &= ~IRQD_TRIGGER_MASK;
214 d->state_use_accessors |= type & IRQD_TRIGGER_MASK;
215}
216
217static inline bool irqd_is_level_type(struct irq_data *d)
218{
219 return d->state_use_accessors & IRQD_LEVEL;
220}
221
222static inline bool irqd_is_wakeup_set(struct irq_data *d)
223{
224 return d->state_use_accessors & IRQD_WAKEUP_STATE;
225}
226
227static inline bool irqd_can_move_in_process_context(struct irq_data *d)
228{
229 return d->state_use_accessors & IRQD_MOVE_PCNTXT;
230}
231
232static inline bool irqd_irq_disabled(struct irq_data *d)
233{
234 return d->state_use_accessors & IRQD_IRQ_DISABLED;
235}
236
237static inline bool irqd_irq_masked(struct irq_data *d)
238{
239 return d->state_use_accessors & IRQD_IRQ_MASKED;
240}
241
242static inline bool irqd_irq_inprogress(struct irq_data *d)
243{
244 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
245}
246
247/*
248 * Functions for chained handlers which can be enabled/disabled by the
249 * standard disable_irq/enable_irq calls. Must be called with
250 * irq_desc->lock held.
251 */
252static inline void irqd_set_chained_irq_inprogress(struct irq_data *d)
253{
254 d->state_use_accessors |= IRQD_IRQ_INPROGRESS;
255}
256
257static inline void irqd_clr_chained_irq_inprogress(struct irq_data *d)
258{
259 d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS;
260}
261
116/** 262/**
117 * struct irq_chip - hardware interrupt chip descriptor 263 * struct irq_chip - hardware interrupt chip descriptor
118 * 264 *
119 * @name: name for /proc/interrupts 265 * @name: name for /proc/interrupts
120 * @startup: deprecated, replaced by irq_startup
121 * @shutdown: deprecated, replaced by irq_shutdown
122 * @enable: deprecated, replaced by irq_enable
123 * @disable: deprecated, replaced by irq_disable
124 * @ack: deprecated, replaced by irq_ack
125 * @mask: deprecated, replaced by irq_mask
126 * @mask_ack: deprecated, replaced by irq_mask_ack
127 * @unmask: deprecated, replaced by irq_unmask
128 * @eoi: deprecated, replaced by irq_eoi
129 * @end: deprecated, will go away with __do_IRQ()
130 * @set_affinity: deprecated, replaced by irq_set_affinity
131 * @retrigger: deprecated, replaced by irq_retrigger
132 * @set_type: deprecated, replaced by irq_set_type
133 * @set_wake: deprecated, replaced by irq_wake
134 * @bus_lock: deprecated, replaced by irq_bus_lock
135 * @bus_sync_unlock: deprecated, replaced by irq_bus_sync_unlock
136 *
137 * @irq_startup: start up the interrupt (defaults to ->enable if NULL) 266 * @irq_startup: start up the interrupt (defaults to ->enable if NULL)
138 * @irq_shutdown: shut down the interrupt (defaults to ->disable if NULL) 267 * @irq_shutdown: shut down the interrupt (defaults to ->disable if NULL)
139 * @irq_enable: enable the interrupt (defaults to chip->unmask if NULL) 268 * @irq_enable: enable the interrupt (defaults to chip->unmask if NULL)
@@ -149,33 +278,18 @@ struct irq_data {
149 * @irq_set_wake: enable/disable power-management wake-on of an IRQ 278 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
150 * @irq_bus_lock: function to lock access to slow bus (i2c) chips 279 * @irq_bus_lock: function to lock access to slow bus (i2c) chips
151 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips 280 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
281 * @irq_cpu_online: configure an interrupt source for a secondary CPU
282 * @irq_cpu_offline: un-configure an interrupt source for a secondary CPU
283 * @irq_suspend: function called from core code on suspend once per chip
284 * @irq_resume: function called from core code on resume once per chip
285 * @irq_pm_shutdown: function called from core code on shutdown once per chip
286 * @irq_print_chip: optional to print special chip info in show_interrupts
287 * @flags: chip specific flags
152 * 288 *
153 * @release: release function solely used by UML 289 * @release: release function solely used by UML
154 */ 290 */
155struct irq_chip { 291struct irq_chip {
156 const char *name; 292 const char *name;
157#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
158 unsigned int (*startup)(unsigned int irq);
159 void (*shutdown)(unsigned int irq);
160 void (*enable)(unsigned int irq);
161 void (*disable)(unsigned int irq);
162
163 void (*ack)(unsigned int irq);
164 void (*mask)(unsigned int irq);
165 void (*mask_ack)(unsigned int irq);
166 void (*unmask)(unsigned int irq);
167 void (*eoi)(unsigned int irq);
168
169 void (*end)(unsigned int irq);
170 int (*set_affinity)(unsigned int irq,
171 const struct cpumask *dest);
172 int (*retrigger)(unsigned int irq);
173 int (*set_type)(unsigned int irq, unsigned int flow_type);
174 int (*set_wake)(unsigned int irq, unsigned int on);
175
176 void (*bus_lock)(unsigned int irq);
177 void (*bus_sync_unlock)(unsigned int irq);
178#endif
179 unsigned int (*irq_startup)(struct irq_data *data); 293 unsigned int (*irq_startup)(struct irq_data *data);
180 void (*irq_shutdown)(struct irq_data *data); 294 void (*irq_shutdown)(struct irq_data *data);
181 void (*irq_enable)(struct irq_data *data); 295 void (*irq_enable)(struct irq_data *data);
@@ -195,12 +309,39 @@ struct irq_chip {
195 void (*irq_bus_lock)(struct irq_data *data); 309 void (*irq_bus_lock)(struct irq_data *data);
196 void (*irq_bus_sync_unlock)(struct irq_data *data); 310 void (*irq_bus_sync_unlock)(struct irq_data *data);
197 311
312 void (*irq_cpu_online)(struct irq_data *data);
313 void (*irq_cpu_offline)(struct irq_data *data);
314
315 void (*irq_suspend)(struct irq_data *data);
316 void (*irq_resume)(struct irq_data *data);
317 void (*irq_pm_shutdown)(struct irq_data *data);
318
319 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
320
321 unsigned long flags;
322
198 /* Currently used only by UML, might disappear one day.*/ 323 /* Currently used only by UML, might disappear one day.*/
199#ifdef CONFIG_IRQ_RELEASE_METHOD 324#ifdef CONFIG_IRQ_RELEASE_METHOD
200 void (*release)(unsigned int irq, void *dev_id); 325 void (*release)(unsigned int irq, void *dev_id);
201#endif 326#endif
202}; 327};
203 328
329/*
330 * irq_chip specific flags
331 *
332 * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
333 * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
334 * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
335 * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
336 * when irq enabled
337 */
338enum {
339 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
340 IRQCHIP_EOI_IF_HANDLED = (1 << 1),
341 IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
342 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
343};
344
204/* This include will go away once we isolated irq_desc usage to core code */ 345/* This include will go away once we isolated irq_desc usage to core code */
205#include <linux/irqdesc.h> 346#include <linux/irqdesc.h>
206 347
@@ -217,27 +358,28 @@ struct irq_chip {
217# define ARCH_IRQ_INIT_FLAGS 0 358# define ARCH_IRQ_INIT_FLAGS 0
218#endif 359#endif
219 360
220#define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS) 361#define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
221 362
222struct irqaction; 363struct irqaction;
223extern int setup_irq(unsigned int irq, struct irqaction *new); 364extern int setup_irq(unsigned int irq, struct irqaction *new);
224extern void remove_irq(unsigned int irq, struct irqaction *act); 365extern void remove_irq(unsigned int irq, struct irqaction *act);
225 366
367extern void irq_cpu_online(void);
368extern void irq_cpu_offline(void);
369extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask);
370
226#ifdef CONFIG_GENERIC_HARDIRQS 371#ifdef CONFIG_GENERIC_HARDIRQS
227 372
228#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 373#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
229void move_native_irq(int irq); 374void irq_move_irq(struct irq_data *data);
230void move_masked_irq(int irq); 375void irq_move_masked_irq(struct irq_data *data);
231#else 376#else
232static inline void move_native_irq(int irq) { } 377static inline void irq_move_irq(struct irq_data *data) { }
233static inline void move_masked_irq(int irq) { } 378static inline void irq_move_masked_irq(struct irq_data *data) { }
234#endif 379#endif
235 380
236extern int no_irq_affinity; 381extern int no_irq_affinity;
237 382
238/* Handle irq action chains: */
239extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
240
241/* 383/*
242 * Built-in IRQ handlers for various IRQ types, 384 * Built-in IRQ handlers for various IRQ types,
243 * callable via desc->handle_irq() 385 * callable via desc->handle_irq()
@@ -245,6 +387,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
245extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); 387extern void handle_level_irq(unsigned int irq, struct irq_desc *desc);
246extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); 388extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
247extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc); 389extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
390extern void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc);
248extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); 391extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
249extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); 392extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
250extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 393extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
@@ -266,39 +409,36 @@ extern struct irq_chip no_irq_chip;
266extern struct irq_chip dummy_irq_chip; 409extern struct irq_chip dummy_irq_chip;
267 410
268extern void 411extern void
269set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, 412irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
270 irq_flow_handler_t handle);
271extern void
272set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
273 irq_flow_handler_t handle, const char *name); 413 irq_flow_handler_t handle, const char *name);
274 414
415static inline void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *chip,
416 irq_flow_handler_t handle)
417{
418 irq_set_chip_and_handler_name(irq, chip, handle, NULL);
419}
420
275extern void 421extern void
276__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 422__irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
277 const char *name); 423 const char *name);
278 424
279/*
280 * Set a highlevel flow handler for a given IRQ:
281 */
282static inline void 425static inline void
283set_irq_handler(unsigned int irq, irq_flow_handler_t handle) 426irq_set_handler(unsigned int irq, irq_flow_handler_t handle)
284{ 427{
285 __set_irq_handler(irq, handle, 0, NULL); 428 __irq_set_handler(irq, handle, 0, NULL);
286} 429}
287 430
288/* 431/*
289 * Set a highlevel chained flow handler for a given IRQ. 432 * Set a highlevel chained flow handler for a given IRQ.
290 * (a chained handler is automatically enabled and set to 433 * (a chained handler is automatically enabled and set to
291 * IRQ_NOREQUEST and IRQ_NOPROBE) 434 * IRQ_NOREQUEST, IRQ_NOPROBE, and IRQ_NOTHREAD)
292 */ 435 */
293static inline void 436static inline void
294set_irq_chained_handler(unsigned int irq, 437irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle)
295 irq_flow_handler_t handle)
296{ 438{
297 __set_irq_handler(irq, handle, 1, NULL); 439 __irq_set_handler(irq, handle, 1, NULL);
298} 440}
299 441
300extern void set_irq_nested_thread(unsigned int irq, int nest);
301
302void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set); 442void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
303 443
304static inline void irq_set_status_flags(unsigned int irq, unsigned long set) 444static inline void irq_set_status_flags(unsigned int irq, unsigned long set)
@@ -311,16 +451,34 @@ static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr)
311 irq_modify_status(irq, clr, 0); 451 irq_modify_status(irq, clr, 0);
312} 452}
313 453
314static inline void set_irq_noprobe(unsigned int irq) 454static inline void irq_set_noprobe(unsigned int irq)
315{ 455{
316 irq_modify_status(irq, 0, IRQ_NOPROBE); 456 irq_modify_status(irq, 0, IRQ_NOPROBE);
317} 457}
318 458
319static inline void set_irq_probe(unsigned int irq) 459static inline void irq_set_probe(unsigned int irq)
320{ 460{
321 irq_modify_status(irq, IRQ_NOPROBE, 0); 461 irq_modify_status(irq, IRQ_NOPROBE, 0);
322} 462}
323 463
464static inline void irq_set_nothread(unsigned int irq)
465{
466 irq_modify_status(irq, 0, IRQ_NOTHREAD);
467}
468
469static inline void irq_set_thread(unsigned int irq)
470{
471 irq_modify_status(irq, IRQ_NOTHREAD, 0);
472}
473
474static inline void irq_set_nested_thread(unsigned int irq, bool nest)
475{
476 if (nest)
477 irq_set_status_flags(irq, IRQ_NESTED_THREAD);
478 else
479 irq_clear_status_flags(irq, IRQ_NESTED_THREAD);
480}
481
324/* Handle dynamic irq creation and destruction */ 482/* Handle dynamic irq creation and destruction */
325extern unsigned int create_irq_nr(unsigned int irq_want, int node); 483extern unsigned int create_irq_nr(unsigned int irq_want, int node);
326extern int create_irq(void); 484extern int create_irq(void);
@@ -337,14 +495,14 @@ static inline void dynamic_irq_init(unsigned int irq)
337} 495}
338 496
339/* Set/get chip/data for an IRQ: */ 497/* Set/get chip/data for an IRQ: */
340extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); 498extern int irq_set_chip(unsigned int irq, struct irq_chip *chip);
341extern int set_irq_data(unsigned int irq, void *data); 499extern int irq_set_handler_data(unsigned int irq, void *data);
342extern int set_irq_chip_data(unsigned int irq, void *data); 500extern int irq_set_chip_data(unsigned int irq, void *data);
343extern int set_irq_type(unsigned int irq, unsigned int type); 501extern int irq_set_irq_type(unsigned int irq, unsigned int type);
344extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); 502extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
345extern struct irq_data *irq_get_irq_data(unsigned int irq); 503extern struct irq_data *irq_get_irq_data(unsigned int irq);
346 504
347static inline struct irq_chip *get_irq_chip(unsigned int irq) 505static inline struct irq_chip *irq_get_chip(unsigned int irq)
348{ 506{
349 struct irq_data *d = irq_get_irq_data(irq); 507 struct irq_data *d = irq_get_irq_data(irq);
350 return d ? d->chip : NULL; 508 return d ? d->chip : NULL;
@@ -355,7 +513,7 @@ static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d)
355 return d->chip; 513 return d->chip;
356} 514}
357 515
358static inline void *get_irq_chip_data(unsigned int irq) 516static inline void *irq_get_chip_data(unsigned int irq)
359{ 517{
360 struct irq_data *d = irq_get_irq_data(irq); 518 struct irq_data *d = irq_get_irq_data(irq);
361 return d ? d->chip_data : NULL; 519 return d ? d->chip_data : NULL;
@@ -366,18 +524,18 @@ static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
366 return d->chip_data; 524 return d->chip_data;
367} 525}
368 526
369static inline void *get_irq_data(unsigned int irq) 527static inline void *irq_get_handler_data(unsigned int irq)
370{ 528{
371 struct irq_data *d = irq_get_irq_data(irq); 529 struct irq_data *d = irq_get_irq_data(irq);
372 return d ? d->handler_data : NULL; 530 return d ? d->handler_data : NULL;
373} 531}
374 532
375static inline void *irq_data_get_irq_data(struct irq_data *d) 533static inline void *irq_data_get_irq_handler_data(struct irq_data *d)
376{ 534{
377 return d->handler_data; 535 return d->handler_data;
378} 536}
379 537
380static inline struct msi_desc *get_irq_msi(unsigned int irq) 538static inline struct msi_desc *irq_get_msi_desc(unsigned int irq)
381{ 539{
382 struct irq_data *d = irq_get_irq_data(irq); 540 struct irq_data *d = irq_get_irq_data(irq);
383 return d ? d->msi_desc : NULL; 541 return d ? d->msi_desc : NULL;
@@ -412,6 +570,150 @@ static inline void irq_free_desc(unsigned int irq)
412 irq_free_descs(irq, 1); 570 irq_free_descs(irq, 1);
413} 571}
414 572
573static inline int irq_reserve_irq(unsigned int irq)
574{
575 return irq_reserve_irqs(irq, 1);
576}
577
578#ifndef irq_reg_writel
579# define irq_reg_writel(val, addr) writel(val, addr)
580#endif
581#ifndef irq_reg_readl
582# define irq_reg_readl(addr) readl(addr)
583#endif
584
585/**
586 * struct irq_chip_regs - register offsets for struct irq_gci
587 * @enable: Enable register offset to reg_base
588 * @disable: Disable register offset to reg_base
589 * @mask: Mask register offset to reg_base
590 * @ack: Ack register offset to reg_base
591 * @eoi: Eoi register offset to reg_base
592 * @type: Type configuration register offset to reg_base
593 * @polarity: Polarity configuration register offset to reg_base
594 */
595struct irq_chip_regs {
596 unsigned long enable;
597 unsigned long disable;
598 unsigned long mask;
599 unsigned long ack;
600 unsigned long eoi;
601 unsigned long type;
602 unsigned long polarity;
603};
604
605/**
606 * struct irq_chip_type - Generic interrupt chip instance for a flow type
607 * @chip: The real interrupt chip which provides the callbacks
608 * @regs: Register offsets for this chip
609 * @handler: Flow handler associated with this chip
610 * @type: Chip can handle these flow types
611 *
612 * A irq_generic_chip can have several instances of irq_chip_type when
613 * it requires different functions and register offsets for different
614 * flow types.
615 */
616struct irq_chip_type {
617 struct irq_chip chip;
618 struct irq_chip_regs regs;
619 irq_flow_handler_t handler;
620 u32 type;
621};
622
623/**
624 * struct irq_chip_generic - Generic irq chip data structure
625 * @lock: Lock to protect register and cache data access
626 * @reg_base: Register base address (virtual)
627 * @irq_base: Interrupt base nr for this chip
628 * @irq_cnt: Number of interrupts handled by this chip
629 * @mask_cache: Cached mask register
630 * @type_cache: Cached type register
631 * @polarity_cache: Cached polarity register
632 * @wake_enabled: Interrupt can wakeup from suspend
633 * @wake_active: Interrupt is marked as an wakeup from suspend source
634 * @num_ct: Number of available irq_chip_type instances (usually 1)
635 * @private: Private data for non generic chip callbacks
636 * @list: List head for keeping track of instances
637 * @chip_types: Array of interrupt irq_chip_types
638 *
639 * Note, that irq_chip_generic can have multiple irq_chip_type
640 * implementations which can be associated to a particular irq line of
641 * an irq_chip_generic instance. That allows to share and protect
642 * state in an irq_chip_generic instance when we need to implement
643 * different flow mechanisms (level/edge) for it.
644 */
645struct irq_chip_generic {
646 raw_spinlock_t lock;
647 void __iomem *reg_base;
648 unsigned int irq_base;
649 unsigned int irq_cnt;
650 u32 mask_cache;
651 u32 type_cache;
652 u32 polarity_cache;
653 u32 wake_enabled;
654 u32 wake_active;
655 unsigned int num_ct;
656 void *private;
657 struct list_head list;
658 struct irq_chip_type chip_types[0];
659};
660
661/**
662 * enum irq_gc_flags - Initialization flags for generic irq chips
663 * @IRQ_GC_INIT_MASK_CACHE: Initialize the mask_cache by reading mask reg
664 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for
665 * irq chips which need to call irq_set_wake() on
666 * the parent irq. Usually GPIO implementations
667 */
668enum irq_gc_flags {
669 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
670 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
671};
672
673/* Generic chip callback functions */
674void irq_gc_noop(struct irq_data *d);
675void irq_gc_mask_disable_reg(struct irq_data *d);
676void irq_gc_mask_set_bit(struct irq_data *d);
677void irq_gc_mask_clr_bit(struct irq_data *d);
678void irq_gc_unmask_enable_reg(struct irq_data *d);
679void irq_gc_ack(struct irq_data *d);
680void irq_gc_mask_disable_reg_and_ack(struct irq_data *d);
681void irq_gc_eoi(struct irq_data *d);
682int irq_gc_set_wake(struct irq_data *d, unsigned int on);
683
684/* Setup functions for irq_chip_generic */
685struct irq_chip_generic *
686irq_alloc_generic_chip(const char *name, int nr_ct, unsigned int irq_base,
687 void __iomem *reg_base, irq_flow_handler_t handler);
688void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
689 enum irq_gc_flags flags, unsigned int clr,
690 unsigned int set);
691int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
692void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
693 unsigned int clr, unsigned int set);
694
695static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d)
696{
697 return container_of(d->chip, struct irq_chip_type, chip);
698}
699
700#define IRQ_MSK(n) (u32)((n) < 32 ? ((1 << (n)) - 1) : UINT_MAX)
701
702#ifdef CONFIG_SMP
703static inline void irq_gc_lock(struct irq_chip_generic *gc)
704{
705 raw_spin_lock(&gc->lock);
706}
707
708static inline void irq_gc_unlock(struct irq_chip_generic *gc)
709{
710 raw_spin_unlock(&gc->lock);
711}
712#else
713static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
714static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
715#endif
716
415#endif /* CONFIG_GENERIC_HARDIRQS */ 717#endif /* CONFIG_GENERIC_HARDIRQS */
416 718
417#endif /* !CONFIG_S390 */ 719#endif /* !CONFIG_S390 */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 979c68cc7458..2d921b35212c 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -8,6 +8,7 @@
8 * For now it's included from <linux/irq.h> 8 * For now it's included from <linux/irq.h>
9 */ 9 */
10 10
11struct irq_affinity_notify;
11struct proc_dir_entry; 12struct proc_dir_entry;
12struct timer_rand_state; 13struct timer_rand_state;
13/** 14/**
@@ -15,53 +16,37 @@ struct timer_rand_state;
15 * @irq_data: per irq and chip data passed down to chip functions 16 * @irq_data: per irq and chip data passed down to chip functions
16 * @timer_rand_state: pointer to timer rand state struct 17 * @timer_rand_state: pointer to timer rand state struct
17 * @kstat_irqs: irq stats per cpu 18 * @kstat_irqs: irq stats per cpu
18 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 19 * @handle_irq: highlevel irq-events handler
20 * @preflow_handler: handler called before the flow handler (currently used by sparc)
19 * @action: the irq action chain 21 * @action: the irq action chain
20 * @status: status information 22 * @status: status information
23 * @core_internal_state__do_not_mess_with_it: core internal status information
21 * @depth: disable-depth, for nested irq_disable() calls 24 * @depth: disable-depth, for nested irq_disable() calls
22 * @wake_depth: enable depth, for multiple set_irq_wake() callers 25 * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers
23 * @irq_count: stats field to detect stalled irqs 26 * @irq_count: stats field to detect stalled irqs
24 * @last_unhandled: aging timer for unhandled count 27 * @last_unhandled: aging timer for unhandled count
25 * @irqs_unhandled: stats field for spurious unhandled interrupts 28 * @irqs_unhandled: stats field for spurious unhandled interrupts
26 * @lock: locking for SMP 29 * @lock: locking for SMP
30 * @affinity_hint: hint to user space for preferred irq affinity
31 * @affinity_notify: context for notification of affinity changes
27 * @pending_mask: pending rebalanced interrupts 32 * @pending_mask: pending rebalanced interrupts
33 * @threads_oneshot: bitfield to handle shared oneshot threads
28 * @threads_active: number of irqaction threads currently running 34 * @threads_active: number of irqaction threads currently running
29 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 35 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
30 * @dir: /proc/irq/ procfs entry 36 * @dir: /proc/irq/ procfs entry
31 * @name: flow handler name for /proc/interrupts output 37 * @name: flow handler name for /proc/interrupts output
32 */ 38 */
33struct irq_desc { 39struct irq_desc {
34
35#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
36 struct irq_data irq_data; 40 struct irq_data irq_data;
37#else
38 /*
39 * This union will go away, once we fixed the direct access to
40 * irq_desc all over the place. The direct fields are a 1:1
41 * overlay of irq_data.
42 */
43 union {
44 struct irq_data irq_data;
45 struct {
46 unsigned int irq;
47 unsigned int node;
48 struct irq_chip *chip;
49 void *handler_data;
50 void *chip_data;
51 struct msi_desc *msi_desc;
52#ifdef CONFIG_SMP
53 cpumask_var_t affinity;
54#endif
55 };
56 };
57#endif
58
59 struct timer_rand_state *timer_rand_state; 41 struct timer_rand_state *timer_rand_state;
60 unsigned int *kstat_irqs; 42 unsigned int __percpu *kstat_irqs;
61 irq_flow_handler_t handle_irq; 43 irq_flow_handler_t handle_irq;
44#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
45 irq_preflow_handler_t preflow_handler;
46#endif
62 struct irqaction *action; /* IRQ action list */ 47 struct irqaction *action; /* IRQ action list */
63 unsigned int status; /* IRQ status */ 48 unsigned int status_use_accessors;
64 49 unsigned int core_internal_state__do_not_mess_with_it;
65 unsigned int depth; /* nested irq disables */ 50 unsigned int depth; /* nested irq disables */
66 unsigned int wake_depth; /* nested wake enables */ 51 unsigned int wake_depth; /* nested wake enables */
67 unsigned int irq_count; /* For detecting broken IRQs */ 52 unsigned int irq_count; /* For detecting broken IRQs */
@@ -70,10 +55,12 @@ struct irq_desc {
70 raw_spinlock_t lock; 55 raw_spinlock_t lock;
71#ifdef CONFIG_SMP 56#ifdef CONFIG_SMP
72 const struct cpumask *affinity_hint; 57 const struct cpumask *affinity_hint;
58 struct irq_affinity_notify *affinity_notify;
73#ifdef CONFIG_GENERIC_PENDING_IRQ 59#ifdef CONFIG_GENERIC_PENDING_IRQ
74 cpumask_var_t pending_mask; 60 cpumask_var_t pending_mask;
75#endif 61#endif
76#endif 62#endif
63 unsigned long threads_oneshot;
77 atomic_t threads_active; 64 atomic_t threads_active;
78 wait_queue_head_t wait_for_threads; 65 wait_queue_head_t wait_for_threads;
79#ifdef CONFIG_PROC_FS 66#ifdef CONFIG_PROC_FS
@@ -86,26 +73,32 @@ struct irq_desc {
86extern struct irq_desc irq_desc[NR_IRQS]; 73extern struct irq_desc irq_desc[NR_IRQS];
87#endif 74#endif
88 75
89/* Will be removed once the last users in power and sh are gone */ 76#ifdef CONFIG_GENERIC_HARDIRQS
90extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); 77
91static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node) 78static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
92{ 79{
93 return desc; 80 return &desc->irq_data;
94} 81}
95 82
96#ifdef CONFIG_GENERIC_HARDIRQS 83static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc)
84{
85 return desc->irq_data.chip;
86}
97 87
98#define get_irq_desc_chip(desc) ((desc)->irq_data.chip) 88static inline void *irq_desc_get_chip_data(struct irq_desc *desc)
99#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data) 89{
100#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data) 90 return desc->irq_data.chip_data;
101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) 91}
102 92
103/* 93static inline void *irq_desc_get_handler_data(struct irq_desc *desc)
104 * Monolithic do_IRQ implementation. 94{
105 */ 95 return desc->irq_data.handler_data;
106#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 96}
107extern unsigned int __do_IRQ(unsigned int irq); 97
108#endif 98static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
99{
100 return desc->irq_data.msi_desc;
101}
109 102
110/* 103/*
111 * Architectures call this to let the generic IRQ layer 104 * Architectures call this to let the generic IRQ layer
@@ -115,20 +108,10 @@ extern unsigned int __do_IRQ(unsigned int irq);
115 */ 108 */
116static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) 109static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
117{ 110{
118#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
119 desc->handle_irq(irq, desc); 111 desc->handle_irq(irq, desc);
120#else
121 if (likely(desc->handle_irq))
122 desc->handle_irq(irq, desc);
123 else
124 __do_IRQ(irq);
125#endif
126} 112}
127 113
128static inline void generic_handle_irq(unsigned int irq) 114int generic_handle_irq(unsigned int irq);
129{
130 generic_handle_irq_desc(irq, irq_to_desc(irq));
131}
132 115
133/* Test to see if a driver has successfully requested an irq */ 116/* Test to see if a driver has successfully requested an irq */
134static inline int irq_has_action(unsigned int irq) 117static inline int irq_has_action(unsigned int irq)
@@ -137,23 +120,56 @@ static inline int irq_has_action(unsigned int irq)
137 return desc->action != NULL; 120 return desc->action != NULL;
138} 121}
139 122
140static inline int irq_balancing_disabled(unsigned int irq) 123/* caller has locked the irq_desc and both params are valid */
124static inline void __irq_set_handler_locked(unsigned int irq,
125 irq_flow_handler_t handler)
141{ 126{
142 struct irq_desc *desc; 127 struct irq_desc *desc;
143 128
144 desc = irq_to_desc(irq); 129 desc = irq_to_desc(irq);
145 return desc->status & IRQ_NO_BALANCING_MASK; 130 desc->handle_irq = handler;
146} 131}
147 132
148/* caller has locked the irq_desc and both params are valid */ 133/* caller has locked the irq_desc and both params are valid */
149static inline void __set_irq_handler_unlocked(int irq, 134static inline void
150 irq_flow_handler_t handler) 135__irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip,
136 irq_flow_handler_t handler, const char *name)
151{ 137{
152 struct irq_desc *desc; 138 struct irq_desc *desc;
153 139
154 desc = irq_to_desc(irq); 140 desc = irq_to_desc(irq);
141 irq_desc_get_irq_data(desc)->chip = chip;
155 desc->handle_irq = handler; 142 desc->handle_irq = handler;
143 desc->name = name;
144}
145
146static inline int irq_balancing_disabled(unsigned int irq)
147{
148 struct irq_desc *desc;
149
150 desc = irq_to_desc(irq);
151 return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;
156} 152}
153
154static inline void
155irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
156{
157 struct irq_desc *desc = irq_to_desc(irq);
158
159 if (desc)
160 lockdep_set_class(&desc->lock, class);
161}
162
163#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
164static inline void
165__irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
166{
167 struct irq_desc *desc;
168
169 desc = irq_to_desc(irq);
170 desc->preflow_handler = handler;
171}
172#endif
157#endif 173#endif
158 174
159#endif 175#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 05aa8c23483f..3bc4dcab6e82 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -43,7 +43,7 @@ unsigned int irq_get_next_irq(unsigned int offset);
43 else 43 else
44 44
45#ifdef CONFIG_SMP 45#ifdef CONFIG_SMP
46#define irq_node(irq) (irq_to_desc(irq)->node) 46#define irq_node(irq) (irq_get_irq_data(irq)->node)
47#else 47#else
48#define irq_node(irq) 0 48#define irq_node(irq) 0
49#endif 49#endif
diff --git a/include/linux/isdn/hdlc.h b/include/linux/isdn/hdlc.h
index 4b3ecc40889a..96521370c782 100644
--- a/include/linux/isdn/hdlc.h
+++ b/include/linux/isdn/hdlc.h
@@ -2,7 +2,7 @@
2 * hdlc.h -- General purpose ISDN HDLC decoder. 2 * hdlc.h -- General purpose ISDN HDLC decoder.
3 * 3 *
4 * Implementation of a HDLC decoder/encoder in software. 4 * Implementation of a HDLC decoder/encoder in software.
5 * Neccessary because some ISDN devices don't have HDLC 5 * Necessary because some ISDN devices don't have HDLC
6 * controllers. 6 * controllers.
7 * 7 *
8 * Copyright (C) 8 * Copyright (C)
diff --git a/include/linux/ixjuser.h b/include/linux/ixjuser.h
index 88b45895746d..94ab5e942e53 100644
--- a/include/linux/ixjuser.h
+++ b/include/linux/ixjuser.h
@@ -50,7 +50,7 @@
50* IOCTL's used for the Quicknet Telephony Cards 50* IOCTL's used for the Quicknet Telephony Cards
51* 51*
52* If you use the IXJCTL_TESTRAM command, the card must be power cycled to 52* If you use the IXJCTL_TESTRAM command, the card must be power cycled to
53* reset the SRAM values before futher use. 53* reset the SRAM values before further use.
54* 54*
55******************************************************************************/ 55******************************************************************************/
56 56
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 0b52924a0cb6..a32dcaec04e1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -94,7 +94,7 @@ extern void jbd2_free(void *ptr, size_t size);
94 * 94 *
95 * This is an opaque datatype. 95 * This is an opaque datatype.
96 **/ 96 **/
97typedef struct handle_s handle_t; /* Atomic operation type */ 97typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */
98 98
99 99
100/** 100/**
@@ -395,7 +395,7 @@ struct jbd2_inode {
395 struct inode *i_vfs_inode; 395 struct inode *i_vfs_inode;
396 396
397 /* Flags of inode [j_list_lock] */ 397 /* Flags of inode [j_list_lock] */
398 unsigned int i_flags; 398 unsigned long i_flags;
399}; 399};
400 400
401struct jbd2_revoke_table_s; 401struct jbd2_revoke_table_s;
@@ -416,7 +416,7 @@ struct jbd2_revoke_table_s;
416 * in so it can be fixed later. 416 * in so it can be fixed later.
417 */ 417 */
418 418
419struct handle_s 419struct jbd2_journal_handle
420{ 420{
421 /* Which compound transaction is this update a part of? */ 421 /* Which compound transaction is this update a part of? */
422 transaction_t *h_transaction; 422 transaction_t *h_transaction;
@@ -432,13 +432,35 @@ struct handle_s
432 int h_err; 432 int h_err;
433 433
434 /* Flags [no locking] */ 434 /* Flags [no locking] */
435 unsigned int h_sync: 1; /* sync-on-close */ 435 unsigned int h_sync:1; /* sync-on-close */
436 unsigned int h_jdata: 1; /* force data journaling */ 436 unsigned int h_jdata:1; /* force data journaling */
437 unsigned int h_aborted: 1; /* fatal error on handle */ 437 unsigned int h_aborted:1; /* fatal error on handle */
438 unsigned int h_cowing:1; /* COWing block to snapshot */
439
440 /* Number of buffers requested by user:
441 * (before adding the COW credits factor) */
442 unsigned int h_base_credits:14;
443
444 /* Number of buffers the user is allowed to dirty:
445 * (counts only buffers dirtied when !h_cowing) */
446 unsigned int h_user_credits:14;
447
438 448
439#ifdef CONFIG_DEBUG_LOCK_ALLOC 449#ifdef CONFIG_DEBUG_LOCK_ALLOC
440 struct lockdep_map h_lockdep_map; 450 struct lockdep_map h_lockdep_map;
441#endif 451#endif
452
453#ifdef CONFIG_JBD2_DEBUG
454 /* COW debugging counters: */
455 unsigned int h_cow_moved; /* blocks moved to snapshot */
456 unsigned int h_cow_copied; /* blocks copied to snapshot */
457 unsigned int h_cow_ok_jh; /* blocks already COWed during current
458 transaction */
459 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
460 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
461 unsigned int h_cow_bitmaps; /* COW bitmaps created */
462 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
463#endif
442}; 464};
443 465
444 466
@@ -1158,6 +1180,22 @@ static inline void jbd2_free_handle(handle_t *handle)
1158 kmem_cache_free(jbd2_handle_cache, handle); 1180 kmem_cache_free(jbd2_handle_cache, handle);
1159} 1181}
1160 1182
1183/*
1184 * jbd2_inode management (optional, for those file systems that want to use
1185 * dynamically allocated jbd2_inode structures)
1186 */
1187extern struct kmem_cache *jbd2_inode_cache;
1188
1189static inline struct jbd2_inode *jbd2_alloc_inode(gfp_t gfp_flags)
1190{
1191 return kmem_cache_alloc(jbd2_inode_cache, gfp_flags);
1192}
1193
1194static inline void jbd2_free_inode(struct jbd2_inode *jinode)
1195{
1196 kmem_cache_free(jbd2_inode_cache, jinode);
1197}
1198
1161/* Primary revoke support */ 1199/* Primary revoke support */
1162#define JOURNAL_REVOKE_DEFAULT_HASH 256 1200#define JOURNAL_REVOKE_DEFAULT_HASH 256
1163extern int jbd2_journal_init_revoke(journal_t *, int); 1201extern int jbd2_journal_init_revoke(journal_t *, int);
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index ced1159fa4f2..47cb09edec1a 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -3,129 +3,156 @@
3 3
4/* jhash.h: Jenkins hash support. 4/* jhash.h: Jenkins hash support.
5 * 5 *
6 * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) 6 * Copyright (C) 2006. Bob Jenkins (bob_jenkins@burtleburtle.net)
7 * 7 *
8 * http://burtleburtle.net/bob/hash/ 8 * http://burtleburtle.net/bob/hash/
9 * 9 *
10 * These are the credits from Bob's sources: 10 * These are the credits from Bob's sources:
11 * 11 *
12 * lookup2.c, by Bob Jenkins, December 1996, Public Domain. 12 * lookup3.c, by Bob Jenkins, May 2006, Public Domain.
13 * hash(), hash2(), hash3, and mix() are externally useful functions.
14 * Routines to test the hash are included if SELF_TEST is defined.
15 * You can use this free for any purpose. It has no warranty.
16 * 13 *
17 * Copyright (C) 2003 David S. Miller (davem@redhat.com) 14 * These are functions for producing 32-bit hashes for hash table lookup.
15 * hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
16 * are externally useful functions. Routines to test the hash are included
17 * if SELF_TEST is defined. You can use this free for any purpose. It's in
18 * the public domain. It has no warranty.
19 *
20 * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu)
18 * 21 *
19 * I've modified Bob's hash to be useful in the Linux kernel, and 22 * I've modified Bob's hash to be useful in the Linux kernel, and
20 * any bugs present are surely my fault. -DaveM 23 * any bugs present are my fault.
24 * Jozsef
21 */ 25 */
26#include <linux/bitops.h>
27#include <linux/unaligned/packed_struct.h>
28
29/* Best hash sizes are of power of two */
30#define jhash_size(n) ((u32)1<<(n))
31/* Mask the hash value, i.e (value & jhash_mask(n)) instead of (value % n) */
32#define jhash_mask(n) (jhash_size(n)-1)
33
34/* __jhash_mix -- mix 3 32-bit values reversibly. */
35#define __jhash_mix(a, b, c) \
36{ \
37 a -= c; a ^= rol32(c, 4); c += b; \
38 b -= a; b ^= rol32(a, 6); a += c; \
39 c -= b; c ^= rol32(b, 8); b += a; \
40 a -= c; a ^= rol32(c, 16); c += b; \
41 b -= a; b ^= rol32(a, 19); a += c; \
42 c -= b; c ^= rol32(b, 4); b += a; \
43}
22 44
23/* NOTE: Arguments are modified. */ 45/* __jhash_final - final mixing of 3 32-bit values (a,b,c) into c */
24#define __jhash_mix(a, b, c) \ 46#define __jhash_final(a, b, c) \
25{ \ 47{ \
26 a -= b; a -= c; a ^= (c>>13); \ 48 c ^= b; c -= rol32(b, 14); \
27 b -= c; b -= a; b ^= (a<<8); \ 49 a ^= c; a -= rol32(c, 11); \
28 c -= a; c -= b; c ^= (b>>13); \ 50 b ^= a; b -= rol32(a, 25); \
29 a -= b; a -= c; a ^= (c>>12); \ 51 c ^= b; c -= rol32(b, 16); \
30 b -= c; b -= a; b ^= (a<<16); \ 52 a ^= c; a -= rol32(c, 4); \
31 c -= a; c -= b; c ^= (b>>5); \ 53 b ^= a; b -= rol32(a, 14); \
32 a -= b; a -= c; a ^= (c>>3); \ 54 c ^= b; c -= rol32(b, 24); \
33 b -= c; b -= a; b ^= (a<<10); \
34 c -= a; c -= b; c ^= (b>>15); \
35} 55}
36 56
37/* The golden ration: an arbitrary value */ 57/* An arbitrary initial parameter */
38#define JHASH_GOLDEN_RATIO 0x9e3779b9 58#define JHASH_INITVAL 0xdeadbeef
39 59
40/* The most generic version, hashes an arbitrary sequence 60/* jhash - hash an arbitrary key
41 * of bytes. No alignment or length assumptions are made about 61 * @k: sequence of bytes as key
42 * the input key. 62 * @length: the length of the key
63 * @initval: the previous hash, or an arbitray value
64 *
65 * The generic version, hashes an arbitrary sequence of bytes.
66 * No alignment or length assumptions are made about the input key.
67 *
68 * Returns the hash value of the key. The result depends on endianness.
43 */ 69 */
44static inline u32 jhash(const void *key, u32 length, u32 initval) 70static inline u32 jhash(const void *key, u32 length, u32 initval)
45{ 71{
46 u32 a, b, c, len; 72 u32 a, b, c;
47 const u8 *k = key; 73 const u8 *k = key;
48 74
49 len = length; 75 /* Set up the internal state */
50 a = b = JHASH_GOLDEN_RATIO; 76 a = b = c = JHASH_INITVAL + length + initval;
51 c = initval;
52
53 while (len >= 12) {
54 a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24));
55 b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24));
56 c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24));
57
58 __jhash_mix(a,b,c);
59 77
78 /* All but the last block: affect some 32 bits of (a,b,c) */
79 while (length > 12) {
80 a += __get_unaligned_cpu32(k);
81 b += __get_unaligned_cpu32(k + 4);
82 c += __get_unaligned_cpu32(k + 8);
83 __jhash_mix(a, b, c);
84 length -= 12;
60 k += 12; 85 k += 12;
61 len -= 12;
62 } 86 }
63 87 /* Last block: affect all 32 bits of (c) */
64 c += length; 88 /* All the case statements fall through */
65 switch (len) { 89 switch (length) {
66 case 11: c += ((u32)k[10]<<24); 90 case 12: c += (u32)k[11]<<24;
67 case 10: c += ((u32)k[9]<<16); 91 case 11: c += (u32)k[10]<<16;
68 case 9 : c += ((u32)k[8]<<8); 92 case 10: c += (u32)k[9]<<8;
69 case 8 : b += ((u32)k[7]<<24); 93 case 9: c += k[8];
70 case 7 : b += ((u32)k[6]<<16); 94 case 8: b += (u32)k[7]<<24;
71 case 6 : b += ((u32)k[5]<<8); 95 case 7: b += (u32)k[6]<<16;
72 case 5 : b += k[4]; 96 case 6: b += (u32)k[5]<<8;
73 case 4 : a += ((u32)k[3]<<24); 97 case 5: b += k[4];
74 case 3 : a += ((u32)k[2]<<16); 98 case 4: a += (u32)k[3]<<24;
75 case 2 : a += ((u32)k[1]<<8); 99 case 3: a += (u32)k[2]<<16;
76 case 1 : a += k[0]; 100 case 2: a += (u32)k[1]<<8;
77 }; 101 case 1: a += k[0];
78 102 __jhash_final(a, b, c);
79 __jhash_mix(a,b,c); 103 case 0: /* Nothing left to add */
104 break;
105 }
80 106
81 return c; 107 return c;
82} 108}
83 109
84/* A special optimized version that handles 1 or more of u32s. 110/* jhash2 - hash an array of u32's
85 * The length parameter here is the number of u32s in the key. 111 * @k: the key which must be an array of u32's
112 * @length: the number of u32's in the key
113 * @initval: the previous hash, or an arbitray value
114 *
115 * Returns the hash value of the key.
86 */ 116 */
87static inline u32 jhash2(const u32 *k, u32 length, u32 initval) 117static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
88{ 118{
89 u32 a, b, c, len; 119 u32 a, b, c;
90 120
91 a = b = JHASH_GOLDEN_RATIO; 121 /* Set up the internal state */
92 c = initval; 122 a = b = c = JHASH_INITVAL + (length<<2) + initval;
93 len = length;
94 123
95 while (len >= 3) { 124 /* Handle most of the key */
125 while (length > 3) {
96 a += k[0]; 126 a += k[0];
97 b += k[1]; 127 b += k[1];
98 c += k[2]; 128 c += k[2];
99 __jhash_mix(a, b, c); 129 __jhash_mix(a, b, c);
100 k += 3; len -= 3; 130 length -= 3;
131 k += 3;
101 } 132 }
102 133
103 c += length * 4; 134 /* Handle the last 3 u32's: all the case statements fall through */
104 135 switch (length) {
105 switch (len) { 136 case 3: c += k[2];
106 case 2 : b += k[1]; 137 case 2: b += k[1];
107 case 1 : a += k[0]; 138 case 1: a += k[0];
108 }; 139 __jhash_final(a, b, c);
109 140 case 0: /* Nothing left to add */
110 __jhash_mix(a,b,c); 141 break;
142 }
111 143
112 return c; 144 return c;
113} 145}
114 146
115 147
116/* A special ultra-optimized versions that knows they are hashing exactly 148/* jhash_3words - hash exactly 3, 2 or 1 word(s) */
117 * 3, 2 or 1 word(s).
118 *
119 * NOTE: In particular the "c += length; __jhash_mix(a,b,c);" normally
120 * done at the end is not done here.
121 */
122static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) 149static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
123{ 150{
124 a += JHASH_GOLDEN_RATIO; 151 a += JHASH_INITVAL;
125 b += JHASH_GOLDEN_RATIO; 152 b += JHASH_INITVAL;
126 c += initval; 153 c += initval;
127 154
128 __jhash_mix(a, b, c); 155 __jhash_final(a, b, c);
129 156
130 return c; 157 return c;
131} 158}
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6811f4bfc6e7..f97672a36fa8 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -42,7 +42,7 @@
42/* LATCH is used in the interval timer and ftape setup. */ 42/* LATCH is used in the interval timer and ftape setup. */
43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 43#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
44 44
45/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, then we can 45/* Suppose we want to divide two numbers NOM and DEN: NOM/DEN, then we can
46 * improve accuracy by shifting LSH bits, hence calculating: 46 * improve accuracy by shifting LSH bits, hence calculating:
47 * (NOM << LSH) / DEN 47 * (NOM << LSH) / DEN
48 * This however means trouble for large NOM, because (NOM << LSH) may no 48 * This however means trouble for large NOM, because (NOM << LSH) may no
@@ -307,6 +307,7 @@ extern clock_t jiffies_to_clock_t(long x);
307extern unsigned long clock_t_to_jiffies(unsigned long x); 307extern unsigned long clock_t_to_jiffies(unsigned long x);
308extern u64 jiffies_64_to_clock_t(u64 x); 308extern u64 jiffies_64_to_clock_t(u64 x);
309extern u64 nsec_to_clock_t(u64 x); 309extern u64 nsec_to_clock_t(u64 x);
310extern u64 nsecs_to_jiffies64(u64 n);
310extern unsigned long nsecs_to_jiffies(u64 n); 311extern unsigned long nsecs_to_jiffies(u64 n);
311 312
312#define TIMESTAMP_SIZE 30 313#define TIMESTAMP_SIZE 30
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 525aac3c97df..44e95d0a721f 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -41,6 +41,13 @@ struct journal_head {
41 unsigned b_modified; 41 unsigned b_modified;
42 42
43 /* 43 /*
44 * This feild tracks the last transaction id in which this buffer
45 * has been cowed
46 * [jbd_lock_bh_state()]
47 */
48 unsigned b_cow_tid;
49
50 /*
44 * Copy of the buffer data frozen for writing to the log. 51 * Copy of the buffer data frozen for writing to the log.
45 * [jbd_lock_bh_state()] 52 * [jbd_lock_bh_state()]
46 */ 53 */
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index b67cb180e6e9..83e745f3ead7 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -1,74 +1,102 @@
1#ifndef _LINUX_JUMP_LABEL_H 1#ifndef _LINUX_JUMP_LABEL_H
2#define _LINUX_JUMP_LABEL_H 2#define _LINUX_JUMP_LABEL_H
3 3
4#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_HAVE_ARCH_JUMP_LABEL) 4#include <linux/types.h>
5#include <linux/compiler.h>
6
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8
9struct jump_label_key {
10 atomic_t enabled;
11 struct jump_entry *entries;
12#ifdef CONFIG_MODULES
13 struct jump_label_mod *next;
14#endif
15};
16
5# include <asm/jump_label.h> 17# include <asm/jump_label.h>
6# define HAVE_JUMP_LABEL 18# define HAVE_JUMP_LABEL
7#endif 19#endif
8 20
9enum jump_label_type { 21enum jump_label_type {
22 JUMP_LABEL_DISABLE = 0,
10 JUMP_LABEL_ENABLE, 23 JUMP_LABEL_ENABLE,
11 JUMP_LABEL_DISABLE
12}; 24};
13 25
14struct module; 26struct module;
15 27
16#ifdef HAVE_JUMP_LABEL 28#ifdef HAVE_JUMP_LABEL
17 29
30#ifdef CONFIG_MODULES
31#define JUMP_LABEL_INIT {{ 0 }, NULL, NULL}
32#else
33#define JUMP_LABEL_INIT {{ 0 }, NULL}
34#endif
35
36static __always_inline bool static_branch(struct jump_label_key *key)
37{
38 return arch_static_branch(key);
39}
40
18extern struct jump_entry __start___jump_table[]; 41extern struct jump_entry __start___jump_table[];
19extern struct jump_entry __stop___jump_table[]; 42extern struct jump_entry __stop___jump_table[];
20 43
44extern void jump_label_lock(void);
45extern void jump_label_unlock(void);
21extern void arch_jump_label_transform(struct jump_entry *entry, 46extern void arch_jump_label_transform(struct jump_entry *entry,
22 enum jump_label_type type); 47 enum jump_label_type type);
23extern void arch_jump_label_text_poke_early(jump_label_t addr); 48extern void arch_jump_label_text_poke_early(jump_label_t addr);
24extern void jump_label_update(unsigned long key, enum jump_label_type type);
25extern void jump_label_apply_nops(struct module *mod);
26extern int jump_label_text_reserved(void *start, void *end); 49extern int jump_label_text_reserved(void *start, void *end);
50extern void jump_label_inc(struct jump_label_key *key);
51extern void jump_label_dec(struct jump_label_key *key);
52extern bool jump_label_enabled(struct jump_label_key *key);
53extern void jump_label_apply_nops(struct module *mod);
54
55#else
27 56
28#define jump_label_enable(key) \ 57#include <asm/atomic.h>
29 jump_label_update((unsigned long)key, JUMP_LABEL_ENABLE);
30 58
31#define jump_label_disable(key) \ 59#define JUMP_LABEL_INIT {ATOMIC_INIT(0)}
32 jump_label_update((unsigned long)key, JUMP_LABEL_DISABLE);
33 60
34#else 61struct jump_label_key {
62 atomic_t enabled;
63};
35 64
36#define JUMP_LABEL(key, label) \ 65static __always_inline bool static_branch(struct jump_label_key *key)
37do { \ 66{
38 if (unlikely(*key)) \ 67 if (unlikely(atomic_read(&key->enabled)))
39 goto label; \ 68 return true;
40} while (0) 69 return false;
70}
41 71
42#define jump_label_enable(cond_var) \ 72static inline void jump_label_inc(struct jump_label_key *key)
43do { \ 73{
44 *(cond_var) = 1; \ 74 atomic_inc(&key->enabled);
45} while (0) 75}
46 76
47#define jump_label_disable(cond_var) \ 77static inline void jump_label_dec(struct jump_label_key *key)
48do { \ 78{
49 *(cond_var) = 0; \ 79 atomic_dec(&key->enabled);
50} while (0) 80}
51 81
52static inline int jump_label_apply_nops(struct module *mod) 82static inline int jump_label_text_reserved(void *start, void *end)
53{ 83{
54 return 0; 84 return 0;
55} 85}
56 86
57static inline int jump_label_text_reserved(void *start, void *end) 87static inline void jump_label_lock(void) {}
88static inline void jump_label_unlock(void) {}
89
90static inline bool jump_label_enabled(struct jump_label_key *key)
91{
92 return !!atomic_read(&key->enabled);
93}
94
95static inline int jump_label_apply_nops(struct module *mod)
58{ 96{
59 return 0; 97 return 0;
60} 98}
61 99
62#endif 100#endif
63 101
64#define COND_STMT(key, stmt) \
65do { \
66 __label__ jl_enabled; \
67 JUMP_LABEL(key, jl_enabled); \
68 if (0) { \
69jl_enabled: \
70 stmt; \
71 } \
72} while (0)
73
74#endif 102#endif
diff --git a/include/linux/jump_label_ref.h b/include/linux/jump_label_ref.h
deleted file mode 100644
index e5d012ad92c6..000000000000
--- a/include/linux/jump_label_ref.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _LINUX_JUMP_LABEL_REF_H
2#define _LINUX_JUMP_LABEL_REF_H
3
4#include <linux/jump_label.h>
5#include <asm/atomic.h>
6
7#ifdef HAVE_JUMP_LABEL
8
9static inline void jump_label_inc(atomic_t *key)
10{
11 if (atomic_add_return(1, key) == 1)
12 jump_label_enable(key);
13}
14
15static inline void jump_label_dec(atomic_t *key)
16{
17 if (atomic_dec_and_test(key))
18 jump_label_disable(key);
19}
20
21#else /* !HAVE_JUMP_LABEL */
22
23static inline void jump_label_inc(atomic_t *key)
24{
25 atomic_inc(key);
26}
27
28static inline void jump_label_dec(atomic_t *key)
29{
30 atomic_dec(key);
31}
32
33#undef JUMP_LABEL
34#define JUMP_LABEL(key, label) \
35do { \
36 if (unlikely(__builtin_choose_expr( \
37 __builtin_types_compatible_p(typeof(key), atomic_t *), \
38 atomic_read((atomic_t *)(key)), *(key)))) \
39 goto label; \
40} while (0)
41
42#endif /* HAVE_JUMP_LABEL */
43
44#endif /* _LINUX_JUMP_LABEL_REF_H */
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index d8e9b3d1c23c..0df513b7a9f8 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -36,6 +36,7 @@ const char *kallsyms_lookup(unsigned long addr,
36 36
37/* Look up a kernel symbol and return it in a text buffer. */ 37/* Look up a kernel symbol and return it in a text buffer. */
38extern int sprint_symbol(char *buffer, unsigned long address); 38extern int sprint_symbol(char *buffer, unsigned long address);
39extern int sprint_backtrace(char *buffer, unsigned long address);
39 40
40/* Look up a kernel symbol and print it to the kernel messages. */ 41/* Look up a kernel symbol and print it to the kernel messages. */
41extern void __print_symbol(const char *fmt, unsigned long address); 42extern void __print_symbol(const char *fmt, unsigned long address);
@@ -79,6 +80,12 @@ static inline int sprint_symbol(char *buffer, unsigned long addr)
79 return 0; 80 return 0;
80} 81}
81 82
83static inline int sprint_backtrace(char *buffer, unsigned long addr)
84{
85 *buffer = '\0';
86 return 0;
87}
88
82static inline int lookup_symbol_name(unsigned long addr, char *symname) 89static inline int lookup_symbol_name(unsigned long addr, char *symname)
83{ 90{
84 return -ERANGE; 91 return -ERANGE;
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 506ad20c18f8..ec2d17bc1f1e 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -50,11 +50,12 @@ struct kbd_struct {
50#define VC_CAPSLOCK 2 /* capslock mode */ 50#define VC_CAPSLOCK 2 /* capslock mode */
51#define VC_KANALOCK 3 /* kanalock mode */ 51#define VC_KANALOCK 3 /* kanalock mode */
52 52
53 unsigned char kbdmode:2; /* one 2-bit value */ 53 unsigned char kbdmode:3; /* one 3-bit value */
54#define VC_XLATE 0 /* translate keycodes using keymap */ 54#define VC_XLATE 0 /* translate keycodes using keymap */
55#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ 55#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
56#define VC_RAW 2 /* raw (scancode) mode */ 56#define VC_RAW 2 /* raw (scancode) mode */
57#define VC_UNICODE 3 /* Unicode mode */ 57#define VC_UNICODE 3 /* Unicode mode */
58#define VC_OFF 4 /* disabled mode */
58 59
59 unsigned char modeflags:5; 60 unsigned char modeflags:5;
60#define VC_APPLIC 0 /* application key mode */ 61#define VC_APPLIC 0 /* application key mode */
@@ -158,7 +159,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
158 if (t->buf.tail != NULL) 159 if (t->buf.tail != NULL)
159 t->buf.tail->commit = t->buf.tail->used; 160 t->buf.tail->commit = t->buf.tail->used;
160 spin_unlock_irqrestore(&t->buf.lock, flags); 161 spin_unlock_irqrestore(&t->buf.lock, flags);
161 schedule_delayed_work(&t->buf.work, 0); 162 schedule_work(&t->buf.work);
162} 163}
163 164
164#endif 165#endif
diff --git a/include/linux/kd.h b/include/linux/kd.h
index 15f2853ea58f..c36d8476db55 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -81,6 +81,7 @@ struct unimapinit {
81#define K_XLATE 0x01 81#define K_XLATE 0x01
82#define K_MEDIUMRAW 0x02 82#define K_MEDIUMRAW 0x02
83#define K_UNICODE 0x03 83#define K_UNICODE 0x03
84#define K_OFF 0x04
84#define KDGKBMODE 0x4B44 /* gets current keyboard mode */ 85#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
85#define KDSKBMODE 0x4B45 /* sets current keyboard mode */ 86#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
86 87
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index edef168a0406..f37ba716ef8b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -17,13 +17,11 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/log2.h> 18#include <linux/log2.h>
19#include <linux/typecheck.h> 19#include <linux/typecheck.h>
20#include <linux/printk.h>
20#include <linux/dynamic_debug.h> 21#include <linux/dynamic_debug.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22#include <asm/bug.h> 23#include <asm/bug.h>
23 24
24extern const char linux_banner[];
25extern const char linux_proc_banner[];
26
27#define USHRT_MAX ((u16)(~0U)) 25#define USHRT_MAX ((u16)(~0U))
28#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 26#define SHRT_MAX ((s16)(USHRT_MAX>>1))
29#define SHRT_MIN ((s16)(-SHRT_MAX - 1)) 27#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
@@ -58,9 +56,11 @@ extern const char linux_proc_banner[];
58 56
59#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 57#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
60#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 58#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
59
60/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
61#define roundup(x, y) ( \ 61#define roundup(x, y) ( \
62{ \ 62{ \
63 typeof(y) __y = y; \ 63 const typeof(y) __y = y; \
64 (((x) + (__y - 1)) / __y) * __y; \ 64 (((x) + (__y - 1)) / __y) * __y; \
65} \ 65} \
66) 66)
@@ -110,31 +110,6 @@ extern const char linux_proc_banner[];
110 */ 110 */
111#define lower_32_bits(n) ((u32)(n)) 111#define lower_32_bits(n) ((u32)(n))
112 112
113#define KERN_EMERG "<0>" /* system is unusable */
114#define KERN_ALERT "<1>" /* action must be taken immediately */
115#define KERN_CRIT "<2>" /* critical conditions */
116#define KERN_ERR "<3>" /* error conditions */
117#define KERN_WARNING "<4>" /* warning conditions */
118#define KERN_NOTICE "<5>" /* normal but significant condition */
119#define KERN_INFO "<6>" /* informational */
120#define KERN_DEBUG "<7>" /* debug-level messages */
121
122/* Use the default kernel loglevel */
123#define KERN_DEFAULT "<d>"
124/*
125 * Annotation for a "continued" line of log printout (only done after a
126 * line that had no enclosing \n). Only to be used by core/arch code
127 * during early bootup (a continued line is not SMP-safe otherwise).
128 */
129#define KERN_CONT "<c>"
130
131extern int console_printk[];
132
133#define console_loglevel (console_printk[0])
134#define default_message_loglevel (console_printk[1])
135#define minimum_console_loglevel (console_printk[2])
136#define default_console_loglevel (console_printk[3])
137
138struct completion; 113struct completion;
139struct pt_regs; 114struct pt_regs;
140struct user; 115struct user;
@@ -168,8 +143,26 @@ extern int _cond_resched(void);
168 143
169#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) 144#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
170 145
171#define abs(x) ({ \ 146/*
172 long __x = (x); \ 147 * abs() handles unsigned and signed longs, ints, shorts and chars. For all
148 * input types abs() returns a signed long.
149 * abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()
150 * for those.
151 */
152#define abs(x) ({ \
153 long ret; \
154 if (sizeof(x) == sizeof(long)) { \
155 long __x = (x); \
156 ret = (__x < 0) ? -__x : __x; \
157 } else { \
158 int __x = (x); \
159 ret = (__x < 0) ? -__x : __x; \
160 } \
161 ret; \
162 })
163
164#define abs64(x) ({ \
165 s64 __x = (x); \
173 (__x < 0) ? -__x : __x; \ 166 (__x < 0) ? -__x : __x; \
174 }) 167 })
175 168
@@ -182,11 +175,6 @@ static inline void might_fault(void)
182} 175}
183#endif 176#endif
184 177
185struct va_format {
186 const char *fmt;
187 va_list *va;
188};
189
190extern struct atomic_notifier_head panic_notifier_list; 178extern struct atomic_notifier_head panic_notifier_list;
191extern long (*panic_blink)(int state); 179extern long (*panic_blink)(int state);
192NORET_TYPE void panic(const char * fmt, ...) 180NORET_TYPE void panic(const char * fmt, ...)
@@ -199,14 +187,76 @@ NORET_TYPE void do_exit(long error_code)
199 ATTRIB_NORET; 187 ATTRIB_NORET;
200NORET_TYPE void complete_and_exit(struct completion *, long) 188NORET_TYPE void complete_and_exit(struct completion *, long)
201 ATTRIB_NORET; 189 ATTRIB_NORET;
190
191/* Internal, do not use. */
192int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
193int __must_check _kstrtol(const char *s, unsigned int base, long *res);
194
195int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
196int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
197static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
198{
199 /*
200 * We want to shortcut function call, but
201 * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
202 */
203 if (sizeof(unsigned long) == sizeof(unsigned long long) &&
204 __alignof__(unsigned long) == __alignof__(unsigned long long))
205 return kstrtoull(s, base, (unsigned long long *)res);
206 else
207 return _kstrtoul(s, base, res);
208}
209
210static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
211{
212 /*
213 * We want to shortcut function call, but
214 * __builtin_types_compatible_p(long, long long) = 0.
215 */
216 if (sizeof(long) == sizeof(long long) &&
217 __alignof__(long) == __alignof__(long long))
218 return kstrtoll(s, base, (long long *)res);
219 else
220 return _kstrtol(s, base, res);
221}
222
223int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
224int __must_check kstrtoint(const char *s, unsigned int base, int *res);
225
226static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
227{
228 return kstrtoull(s, base, res);
229}
230
231static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
232{
233 return kstrtoll(s, base, res);
234}
235
236static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
237{
238 return kstrtouint(s, base, res);
239}
240
241static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
242{
243 return kstrtoint(s, base, res);
244}
245
246int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
247int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
248int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
249int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
250
202extern unsigned long simple_strtoul(const char *,char **,unsigned int); 251extern unsigned long simple_strtoul(const char *,char **,unsigned int);
203extern long simple_strtol(const char *,char **,unsigned int); 252extern long simple_strtol(const char *,char **,unsigned int);
204extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 253extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
205extern long long simple_strtoll(const char *,char **,unsigned int); 254extern long long simple_strtoll(const char *,char **,unsigned int);
206extern int strict_strtoul(const char *, unsigned int, unsigned long *); 255#define strict_strtoul kstrtoul
207extern int strict_strtol(const char *, unsigned int, long *); 256#define strict_strtol kstrtol
208extern int strict_strtoull(const char *, unsigned int, unsigned long long *); 257#define strict_strtoull kstrtoull
209extern int strict_strtoll(const char *, unsigned int, long long *); 258#define strict_strtoll kstrtoll
259
210extern int sprintf(char * buf, const char * fmt, ...) 260extern int sprintf(char * buf, const char * fmt, ...)
211 __attribute__ ((format (printf, 2, 3))); 261 __attribute__ ((format (printf, 2, 3)));
212extern int vsprintf(char *buf, const char *, va_list) 262extern int vsprintf(char *buf, const char *, va_list)
@@ -233,6 +283,7 @@ extern char *get_options(const char *str, int nints, int *ints);
233extern unsigned long long memparse(const char *ptr, char **retptr); 283extern unsigned long long memparse(const char *ptr, char **retptr);
234 284
235extern int core_kernel_text(unsigned long addr); 285extern int core_kernel_text(unsigned long addr);
286extern int core_kernel_data(unsigned long addr);
236extern int __kernel_text_address(unsigned long addr); 287extern int __kernel_text_address(unsigned long addr);
237extern int kernel_text_address(unsigned long addr); 288extern int kernel_text_address(unsigned long addr);
238extern int func_ptr_is_kernel_text(void *ptr); 289extern int func_ptr_is_kernel_text(void *ptr);
@@ -240,109 +291,8 @@ extern int func_ptr_is_kernel_text(void *ptr);
240struct pid; 291struct pid;
241extern struct pid *session_of_pgrp(struct pid *pgrp); 292extern struct pid *session_of_pgrp(struct pid *pgrp);
242 293
243/*
244 * FW_BUG
245 * Add this to a message where you are sure the firmware is buggy or behaves
246 * really stupid or out of spec. Be aware that the responsible BIOS developer
247 * should be able to fix this issue or at least get a concrete idea of the
248 * problem by reading your message without the need of looking at the kernel
249 * code.
250 *
251 * Use it for definite and high priority BIOS bugs.
252 *
253 * FW_WARN
254 * Use it for not that clear (e.g. could the kernel messed up things already?)
255 * and medium priority BIOS bugs.
256 *
257 * FW_INFO
258 * Use this one if you want to tell the user or vendor about something
259 * suspicious, but generally harmless related to the firmware.
260 *
261 * Use it for information or very low priority BIOS bugs.
262 */
263#define FW_BUG "[Firmware Bug]: "
264#define FW_WARN "[Firmware Warn]: "
265#define FW_INFO "[Firmware Info]: "
266
267/*
268 * HW_ERR
269 * Add this to a message for hardware errors, so that user can report
270 * it to hardware vendor instead of LKML or software vendor.
271 */
272#define HW_ERR "[Hardware Error]: "
273
274#ifdef CONFIG_PRINTK
275asmlinkage int vprintk(const char *fmt, va_list args)
276 __attribute__ ((format (printf, 1, 0)));
277asmlinkage int printk(const char * fmt, ...)
278 __attribute__ ((format (printf, 1, 2))) __cold;
279
280extern int __printk_ratelimit(const char *func);
281#define printk_ratelimit() __printk_ratelimit(__func__)
282extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
283 unsigned int interval_msec);
284
285extern int printk_delay_msec;
286
287/*
288 * Print a one-time message (analogous to WARN_ONCE() et al):
289 */
290#define printk_once(x...) ({ \
291 static bool __print_once; \
292 \
293 if (!__print_once) { \
294 __print_once = true; \
295 printk(x); \
296 } \
297})
298
299void log_buf_kexec_setup(void);
300#else
301static inline int vprintk(const char *s, va_list args)
302 __attribute__ ((format (printf, 1, 0)));
303static inline int vprintk(const char *s, va_list args) { return 0; }
304static inline int printk(const char *s, ...)
305 __attribute__ ((format (printf, 1, 2)));
306static inline int __cold printk(const char *s, ...) { return 0; }
307static inline int printk_ratelimit(void) { return 0; }
308static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
309 unsigned int interval_msec) \
310 { return false; }
311
312/* No effect, but we still get type checking even in the !PRINTK case: */
313#define printk_once(x...) printk(x)
314
315static inline void log_buf_kexec_setup(void)
316{
317}
318#endif
319
320/*
321 * Dummy printk for disabled debugging statements to use whilst maintaining
322 * gcc's format and side-effect checking.
323 */
324static inline __attribute__ ((format (printf, 1, 2)))
325int no_printk(const char *s, ...) { return 0; }
326
327extern int printk_needs_cpu(int cpu);
328extern void printk_tick(void);
329
330extern void asmlinkage __attribute__((format(printf, 1, 2)))
331 early_printk(const char *fmt, ...);
332
333unsigned long int_sqrt(unsigned long); 294unsigned long int_sqrt(unsigned long);
334 295
335static inline void console_silent(void)
336{
337 console_loglevel = 0;
338}
339
340static inline void console_verbose(void)
341{
342 if (console_loglevel)
343 console_loglevel = 15;
344}
345
346extern void bust_spinlocks(int yes); 296extern void bust_spinlocks(int yes);
347extern void wake_up_klogd(void); 297extern void wake_up_klogd(void);
348extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 298extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
@@ -356,6 +306,8 @@ extern int test_taint(unsigned flag);
356extern unsigned long get_taint(void); 306extern unsigned long get_taint(void);
357extern int root_mountflags; 307extern int root_mountflags;
358 308
309extern bool early_boot_irqs_disabled;
310
359/* Values used for system_state */ 311/* Values used for system_state */
360extern enum system_states { 312extern enum system_states {
361 SYSTEM_BOOTING, 313 SYSTEM_BOOTING,
@@ -379,22 +331,6 @@ extern enum system_states {
379#define TAINT_CRAP 10 331#define TAINT_CRAP 10
380#define TAINT_FIRMWARE_WORKAROUND 11 332#define TAINT_FIRMWARE_WORKAROUND 11
381 333
382extern void dump_stack(void) __cold;
383
384enum {
385 DUMP_PREFIX_NONE,
386 DUMP_PREFIX_ADDRESS,
387 DUMP_PREFIX_OFFSET
388};
389extern void hex_dump_to_buffer(const void *buf, size_t len,
390 int rowsize, int groupsize,
391 char *linebuf, size_t linebuflen, bool ascii);
392extern void print_hex_dump(const char *level, const char *prefix_str,
393 int prefix_type, int rowsize, int groupsize,
394 const void *buf, size_t len, bool ascii);
395extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
396 const void *buf, size_t len);
397
398extern const char hex_asc[]; 334extern const char hex_asc[];
399#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 335#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
400#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] 336#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
@@ -407,94 +343,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
407} 343}
408 344
409extern int hex_to_bin(char ch); 345extern int hex_to_bin(char ch);
410 346extern void hex2bin(u8 *dst, const char *src, size_t count);
411#ifndef pr_fmt
412#define pr_fmt(fmt) fmt
413#endif
414
415#define pr_emerg(fmt, ...) \
416 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
417#define pr_alert(fmt, ...) \
418 printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
419#define pr_crit(fmt, ...) \
420 printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
421#define pr_err(fmt, ...) \
422 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
423#define pr_warning(fmt, ...) \
424 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
425#define pr_warn pr_warning
426#define pr_notice(fmt, ...) \
427 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
428#define pr_info(fmt, ...) \
429 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
430#define pr_cont(fmt, ...) \
431 printk(KERN_CONT fmt, ##__VA_ARGS__)
432
433/* pr_devel() should produce zero code unless DEBUG is defined */
434#ifdef DEBUG
435#define pr_devel(fmt, ...) \
436 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
437#else
438#define pr_devel(fmt, ...) \
439 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
440#endif
441
442/* If you are writing a driver, please use dev_dbg instead */
443#if defined(DEBUG)
444#define pr_debug(fmt, ...) \
445 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
446#elif defined(CONFIG_DYNAMIC_DEBUG)
447/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
448#define pr_debug(fmt, ...) \
449 dynamic_pr_debug(fmt, ##__VA_ARGS__)
450#else
451#define pr_debug(fmt, ...) \
452 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
453#endif
454
455/*
456 * ratelimited messages with local ratelimit_state,
457 * no local ratelimit_state used in the !PRINTK case
458 */
459#ifdef CONFIG_PRINTK
460#define printk_ratelimited(fmt, ...) ({ \
461 static DEFINE_RATELIMIT_STATE(_rs, \
462 DEFAULT_RATELIMIT_INTERVAL, \
463 DEFAULT_RATELIMIT_BURST); \
464 \
465 if (__ratelimit(&_rs)) \
466 printk(fmt, ##__VA_ARGS__); \
467})
468#else
469/* No effect, but we still get type checking even in the !PRINTK case: */
470#define printk_ratelimited printk
471#endif
472
473#define pr_emerg_ratelimited(fmt, ...) \
474 printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
475#define pr_alert_ratelimited(fmt, ...) \
476 printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
477#define pr_crit_ratelimited(fmt, ...) \
478 printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
479#define pr_err_ratelimited(fmt, ...) \
480 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
481#define pr_warning_ratelimited(fmt, ...) \
482 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
483#define pr_warn_ratelimited pr_warning_ratelimited
484#define pr_notice_ratelimited(fmt, ...) \
485 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
486#define pr_info_ratelimited(fmt, ...) \
487 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
488/* no pr_cont_ratelimited, don't do that... */
489/* If you are writing a driver, please use dev_dbg instead */
490#if defined(DEBUG)
491#define pr_debug_ratelimited(fmt, ...) \
492 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
493#else
494#define pr_debug_ratelimited(fmt, ...) \
495 ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
496 ##__VA_ARGS__); 0; })
497#endif
498 347
499/* 348/*
500 * General tracing related utility functions - trace_printk(), 349 * General tracing related utility functions - trace_printk(),
@@ -651,6 +500,24 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
651 (void) (&_max1 == &_max2); \ 500 (void) (&_max1 == &_max2); \
652 _max1 > _max2 ? _max1 : _max2; }) 501 _max1 > _max2 ? _max1 : _max2; })
653 502
503#define min3(x, y, z) ({ \
504 typeof(x) _min1 = (x); \
505 typeof(y) _min2 = (y); \
506 typeof(z) _min3 = (z); \
507 (void) (&_min1 == &_min2); \
508 (void) (&_min1 == &_min3); \
509 _min1 < _min2 ? (_min1 < _min3 ? _min1 : _min3) : \
510 (_min2 < _min3 ? _min2 : _min3); })
511
512#define max3(x, y, z) ({ \
513 typeof(x) _max1 = (x); \
514 typeof(y) _max2 = (y); \
515 typeof(z) _max3 = (z); \
516 (void) (&_max1 == &_max2); \
517 (void) (&_max1 == &_max3); \
518 _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
519 (_max2 > _max3 ? _max2 : _max3); })
520
654/** 521/**
655 * min_not_zero - return the minimum that is _not_ zero, unless both are zero 522 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
656 * @x: value1 523 * @x: value1
@@ -771,12 +638,6 @@ struct sysinfo {
771 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 638 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
772}; 639};
773 640
774/* Force a compilation error if condition is true */
775#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
776
777/* Force a compilation error if condition is constant and true */
778#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
779
780/* Force a compilation error if a constant expression is not a power of 2 */ 641/* Force a compilation error if a constant expression is not a power of 2 */
781#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 642#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
782 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) 643 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
@@ -788,6 +649,32 @@ struct sysinfo {
788#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) 649#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
789#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) 650#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
790 651
652/**
653 * BUILD_BUG_ON - break compile if a condition is true.
654 * @condition: the condition which the compiler should know is false.
655 *
656 * If you have some code which relies on certain constants being equal, or
657 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
658 * detect if someone changes it.
659 *
660 * The implementation uses gcc's reluctance to create a negative array, but
661 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
662 * to inline functions). So as a fallback we use the optimizer; if it can't
663 * prove the condition is false, it will cause a link error on the undefined
664 * "__build_bug_on_failed". This error message can be harder to track down
665 * though, hence the two different methods.
666 */
667#ifndef __OPTIMIZE__
668#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
669#else
670extern int __build_bug_on_failed;
671#define BUILD_BUG_ON(condition) \
672 do { \
673 ((void)sizeof(char[1 - 2*!!(condition)])); \
674 if (condition) __build_bug_on_failed = 1; \
675 } while(0)
676#endif
677
791/* Trap pasters of __FUNCTION__ at compile-time */ 678/* Trap pasters of __FUNCTION__ at compile-time */
792#define __FUNCTION__ (__func__) 679#define __FUNCTION__ (__func__)
793 680
@@ -798,6 +685,13 @@ struct sysinfo {
798#define NUMA_BUILD 0 685#define NUMA_BUILD 0
799#endif 686#endif
800 687
688/* This helps us avoid #ifdef CONFIG_COMPACTION */
689#ifdef CONFIG_COMPACTION
690#define COMPACTION_BUILD 1
691#else
692#define COMPACTION_BUILD 0
693#endif
694
801/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ 695/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
802#ifdef CONFIG_FTRACE_MCOUNT_RECORD 696#ifdef CONFIG_FTRACE_MCOUNT_RECORD
803# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 697# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index c059044bc6dc..0cce2db580c3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -33,6 +33,7 @@ struct kernel_stat {
33#ifndef CONFIG_GENERIC_HARDIRQS 33#ifndef CONFIG_GENERIC_HARDIRQS
34 unsigned int irqs[NR_IRQS]; 34 unsigned int irqs[NR_IRQS];
35#endif 35#endif
36 unsigned long irqs_sum;
36 unsigned int softirqs[NR_SOFTIRQS]; 37 unsigned int softirqs[NR_SOFTIRQS];
37}; 38};
38 39
@@ -45,15 +46,14 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
45extern unsigned long long nr_context_switches(void); 46extern unsigned long long nr_context_switches(void);
46 47
47#ifndef CONFIG_GENERIC_HARDIRQS 48#ifndef CONFIG_GENERIC_HARDIRQS
48#define kstat_irqs_this_cpu(irq) \
49 (kstat_this_cpu.irqs[irq])
50 49
51struct irq_desc; 50struct irq_desc;
52 51
53static inline void kstat_incr_irqs_this_cpu(unsigned int irq, 52static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
54 struct irq_desc *desc) 53 struct irq_desc *desc)
55{ 54{
56 kstat_this_cpu.irqs[irq]++; 55 __this_cpu_inc(kstat.irqs[irq]);
56 __this_cpu_inc(kstat.irqs_sum);
57} 57}
58 58
59static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) 59static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
@@ -63,16 +63,18 @@ static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
63#else 63#else
64#include <linux/irq.h> 64#include <linux/irq.h>
65extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 65extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
66#define kstat_irqs_this_cpu(DESC) \ 66
67 ((DESC)->kstat_irqs[smp_processor_id()]) 67#define kstat_incr_irqs_this_cpu(irqno, DESC) \
68#define kstat_incr_irqs_this_cpu(irqno, DESC) \ 68do { \
69 ((DESC)->kstat_irqs[smp_processor_id()]++) 69 __this_cpu_inc(*(DESC)->kstat_irqs); \
70 __this_cpu_inc(kstat.irqs_sum); \
71} while (0)
70 72
71#endif 73#endif
72 74
73static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) 75static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
74{ 76{
75 kstat_this_cpu.softirqs[irq]++; 77 __this_cpu_inc(kstat.softirqs[irq]);
76} 78}
77 79
78static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu) 80static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
@@ -83,6 +85,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
83/* 85/*
84 * Number of interrupts per specific IRQ source, since bootup 86 * Number of interrupts per specific IRQ source, since bootup
85 */ 87 */
88#ifndef CONFIG_GENERIC_HARDIRQS
86static inline unsigned int kstat_irqs(unsigned int irq) 89static inline unsigned int kstat_irqs(unsigned int irq)
87{ 90{
88 unsigned int sum = 0; 91 unsigned int sum = 0;
@@ -93,7 +96,17 @@ static inline unsigned int kstat_irqs(unsigned int irq)
93 96
94 return sum; 97 return sum;
95} 98}
99#else
100extern unsigned int kstat_irqs(unsigned int irq);
101#endif
96 102
103/*
104 * Number of interrupts per cpu, since bootup
105 */
106static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu)
107{
108 return kstat_cpu(cpu).irqs_sum;
109}
97 110
98/* 111/*
99 * Lock/unlock the current runqueue - to extract task statistics: 112 * Lock/unlock the current runqueue - to extract task statistics:
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 03e8e8dbc577..c2478a342cd7 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -208,6 +208,7 @@ int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
208 unsigned long long *crash_size, unsigned long long *crash_base); 208 unsigned long long *crash_size, unsigned long long *crash_base);
209int crash_shrink_memory(unsigned long new_size); 209int crash_shrink_memory(unsigned long new_size);
210size_t crash_get_memory_size(void); 210size_t crash_get_memory_size(void);
211void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
211 212
212#else /* !CONFIG_KEXEC */ 213#else /* !CONFIG_KEXEC */
213struct pt_regs; 214struct pt_regs;
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 65833d4d5998..9efd081bb31e 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -41,6 +41,9 @@ struct key_type {
41 */ 41 */
42 size_t def_datalen; 42 size_t def_datalen;
43 43
44 /* vet a description */
45 int (*vet_description)(const char *description);
46
44 /* instantiate a key of this type 47 /* instantiate a key of this type
45 * - this method should call key_payload_reserve() to determine if the 48 * - this method should call key_payload_reserve() to determine if the
46 * user's quota will hold the payload 49 * user's quota will hold the payload
@@ -102,11 +105,20 @@ extern int key_instantiate_and_link(struct key *key,
102 size_t datalen, 105 size_t datalen,
103 struct key *keyring, 106 struct key *keyring,
104 struct key *instkey); 107 struct key *instkey);
105extern int key_negate_and_link(struct key *key, 108extern int key_reject_and_link(struct key *key,
106 unsigned timeout, 109 unsigned timeout,
110 unsigned error,
107 struct key *keyring, 111 struct key *keyring,
108 struct key *instkey); 112 struct key *instkey);
109extern void complete_request_key(struct key_construction *cons, int error); 113extern void complete_request_key(struct key_construction *cons, int error);
110 114
115static inline int key_negate_and_link(struct key *key,
116 unsigned timeout,
117 struct key *keyring,
118 struct key *instkey)
119{
120 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey);
121}
122
111#endif /* CONFIG_KEYS */ 123#endif /* CONFIG_KEYS */
112#endif /* _LINUX_KEY_TYPE_H */ 124#endif /* _LINUX_KEY_TYPE_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 3db0adce1fda..b2bb01719561 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -170,6 +170,7 @@ struct key {
170 struct list_head link; 170 struct list_head link;
171 unsigned long x[2]; 171 unsigned long x[2];
172 void *p[2]; 172 void *p[2];
173 int reject_error;
173 } type_data; 174 } type_data;
174 175
175 /* key data 176 /* key data
@@ -275,6 +276,10 @@ static inline key_serial_t key_serial(struct key *key)
275 return key ? key->serial : 0; 276 return key ? key->serial : 0;
276} 277}
277 278
279#define rcu_dereference_key(KEY) \
280 (rcu_dereference_protected((KEY)->payload.rcudata, \
281 rwsem_is_locked(&((struct key *)(KEY))->sem)))
282
278#ifdef CONFIG_SYSCTL 283#ifdef CONFIG_SYSCTL
279extern ctl_table key_sysctls[]; 284extern ctl_table key_sysctls[];
280#endif 285#endif
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index bd383f1944fb..9b0b865ce622 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -53,5 +53,7 @@
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#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
56 58
57#endif /* _LINUX_KEYCTL_H */ 59#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 62dbee554f60..10308c6a3d1c 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -172,7 +172,13 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
172 172
173 173
174static inline unsigned int __must_check 174static inline unsigned int __must_check
175__kfifo_must_check_helper(unsigned int val) 175__kfifo_uint_must_check_helper(unsigned int val)
176{
177 return val;
178}
179
180static inline int __must_check
181__kfifo_int_must_check_helper(int val)
176{ 182{
177 return val; 183 return val;
178} 184}
@@ -267,7 +273,7 @@ __kfifo_must_check_helper(unsigned int val)
267 * @fifo: address of the fifo to be used 273 * @fifo: address of the fifo to be used
268 */ 274 */
269#define kfifo_avail(fifo) \ 275#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \ 276__kfifo_uint_must_check_helper( \
271({ \ 277({ \
272 typeof((fifo) + 1) __tmpq = (fifo); \ 278 typeof((fifo) + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \ 279 const size_t __recsize = sizeof(*__tmpq->rectype); \
@@ -300,7 +306,7 @@ __kfifo_must_check_helper( \
300 * This function returns the size of the next fifo record in number of bytes. 306 * This function returns the size of the next fifo record in number of bytes.
301 */ 307 */
302#define kfifo_peek_len(fifo) \ 308#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \ 309__kfifo_uint_must_check_helper( \
304({ \ 310({ \
305 typeof((fifo) + 1) __tmp = (fifo); \ 311 typeof((fifo) + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \ 312 const size_t __recsize = sizeof(*__tmp->rectype); \
@@ -323,7 +329,7 @@ __kfifo_must_check_helper( \
323 * Return 0 if no error, otherwise an error code. 329 * Return 0 if no error, otherwise an error code.
324 */ 330 */
325#define kfifo_alloc(fifo, size, gfp_mask) \ 331#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \ 332__kfifo_int_must_check_helper( \
327({ \ 333({ \
328 typeof((fifo) + 1) __tmp = (fifo); \ 334 typeof((fifo) + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \ 335 struct __kfifo *__kfifo = &__tmp->kfifo; \
@@ -419,7 +425,7 @@ __kfifo_must_check_helper( \
419 * writer, you don't need extra locking to use these macro. 425 * writer, you don't need extra locking to use these macro.
420 */ 426 */
421#define kfifo_get(fifo, val) \ 427#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \ 428__kfifo_uint_must_check_helper( \
423({ \ 429({ \
424 typeof((fifo) + 1) __tmp = (fifo); \ 430 typeof((fifo) + 1) __tmp = (fifo); \
425 typeof((val) + 1) __val = (val); \ 431 typeof((val) + 1) __val = (val); \
@@ -460,7 +466,7 @@ __kfifo_must_check_helper( \
460 * writer, you don't need extra locking to use these macro. 466 * writer, you don't need extra locking to use these macro.
461 */ 467 */
462#define kfifo_peek(fifo, val) \ 468#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \ 469__kfifo_uint_must_check_helper( \
464({ \ 470({ \
465 typeof((fifo) + 1) __tmp = (fifo); \ 471 typeof((fifo) + 1) __tmp = (fifo); \
466 typeof((val) + 1) __val = (val); \ 472 typeof((val) + 1) __val = (val); \
@@ -552,7 +558,7 @@ __kfifo_must_check_helper( \
552 * writer, you don't need extra locking to use these macro. 558 * writer, you don't need extra locking to use these macro.
553 */ 559 */
554#define kfifo_out(fifo, buf, n) \ 560#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \ 561__kfifo_uint_must_check_helper( \
556({ \ 562({ \
557 typeof((fifo) + 1) __tmp = (fifo); \ 563 typeof((fifo) + 1) __tmp = (fifo); \
558 typeof((buf) + 1) __buf = (buf); \ 564 typeof((buf) + 1) __buf = (buf); \
@@ -580,7 +586,7 @@ __kfifo_must_check_helper( \
580 * copied. 586 * copied.
581 */ 587 */
582#define kfifo_out_spinlocked(fifo, buf, n, lock) \ 588#define kfifo_out_spinlocked(fifo, buf, n, lock) \
583__kfifo_must_check_helper( \ 589__kfifo_uint_must_check_helper( \
584({ \ 590({ \
585 unsigned long __flags; \ 591 unsigned long __flags; \
586 unsigned int __ret; \ 592 unsigned int __ret; \
@@ -609,7 +615,7 @@ __kfifo_must_check_helper( \
609 * writer, you don't need extra locking to use these macro. 615 * writer, you don't need extra locking to use these macro.
610 */ 616 */
611#define kfifo_from_user(fifo, from, len, copied) \ 617#define kfifo_from_user(fifo, from, len, copied) \
612__kfifo_must_check_helper( \ 618__kfifo_uint_must_check_helper( \
613({ \ 619({ \
614 typeof((fifo) + 1) __tmp = (fifo); \ 620 typeof((fifo) + 1) __tmp = (fifo); \
615 const void __user *__from = (from); \ 621 const void __user *__from = (from); \
@@ -637,7 +643,7 @@ __kfifo_must_check_helper( \
637 * writer, you don't need extra locking to use these macro. 643 * writer, you don't need extra locking to use these macro.
638 */ 644 */
639#define kfifo_to_user(fifo, to, len, copied) \ 645#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \ 646__kfifo_uint_must_check_helper( \
641({ \ 647({ \
642 typeof((fifo) + 1) __tmp = (fifo); \ 648 typeof((fifo) + 1) __tmp = (fifo); \
643 void __user *__to = (to); \ 649 void __user *__to = (to); \
@@ -764,7 +770,7 @@ __kfifo_must_check_helper( \
764 * writer, you don't need extra locking to use these macro. 770 * writer, you don't need extra locking to use these macro.
765 */ 771 */
766#define kfifo_out_peek(fifo, buf, n) \ 772#define kfifo_out_peek(fifo, buf, n) \
767__kfifo_must_check_helper( \ 773__kfifo_uint_must_check_helper( \
768({ \ 774({ \
769 typeof((fifo) + 1) __tmp = (fifo); \ 775 typeof((fifo) + 1) __tmp = (fifo); \
770 typeof((buf) + 1) __buf = (buf); \ 776 typeof((buf) + 1) __buf = (buf); \
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index cc96f0f23e04..10ca03d0a250 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -35,16 +35,6 @@ struct pt_regs;
35 */ 35 */
36extern int kgdb_skipexception(int exception, struct pt_regs *regs); 36extern int kgdb_skipexception(int exception, struct pt_regs *regs);
37 37
38/**
39 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
40 * @regs: Current &struct pt_regs.
41 *
42 * This function will be called if the particular architecture must
43 * disable hardware debugging while it is processing gdb packets or
44 * handling exception.
45 */
46extern void kgdb_disable_hw_debug(struct pt_regs *regs);
47
48struct tasklet_struct; 38struct tasklet_struct;
49struct task_struct; 39struct task_struct;
50struct uart_port; 40struct uart_port;
@@ -243,6 +233,8 @@ extern void kgdb_arch_late(void);
243 * breakpoint. 233 * breakpoint.
244 * @remove_hw_breakpoint: Allow an architecture to specify how to remove a 234 * @remove_hw_breakpoint: Allow an architecture to specify how to remove a
245 * hardware breakpoint. 235 * hardware breakpoint.
236 * @disable_hw_break: Allow an architecture to specify how to disable
237 * hardware breakpoints for a single cpu.
246 * @remove_all_hw_break: Allow an architecture to specify how to remove all 238 * @remove_all_hw_break: Allow an architecture to specify how to remove all
247 * hardware breakpoints. 239 * hardware breakpoints.
248 * @correct_hw_break: Allow an architecture to specify how to correct the 240 * @correct_hw_break: Allow an architecture to specify how to correct the
@@ -256,6 +248,7 @@ struct kgdb_arch {
256 int (*remove_breakpoint)(unsigned long, char *); 248 int (*remove_breakpoint)(unsigned long, char *);
257 int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype); 249 int (*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
258 int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype); 250 int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
251 void (*disable_hw_break)(struct pt_regs *regs);
259 void (*remove_all_hw_break)(void); 252 void (*remove_all_hw_break)(void);
260 void (*correct_hw_break)(void); 253 void (*correct_hw_break)(void);
261}; 254};
@@ -304,6 +297,7 @@ extern int
304kgdb_handle_exception(int ex_vector, int signo, int err_code, 297kgdb_handle_exception(int ex_vector, int signo, int err_code,
305 struct pt_regs *regs); 298 struct pt_regs *regs);
306extern int kgdb_nmicallback(int cpu, void *regs); 299extern int kgdb_nmicallback(int cpu, void *regs);
300extern void gdbstub_exit(int status);
307 301
308extern int kgdb_single_step; 302extern int kgdb_single_step;
309extern atomic_t kgdb_active; 303extern atomic_t kgdb_active;
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h
new file mode 100644
index 000000000000..6b394f0b5148
--- /dev/null
+++ b/include/linux/khugepaged.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_KHUGEPAGED_H
2#define _LINUX_KHUGEPAGED_H
3
4#include <linux/sched.h> /* MMF_VM_HUGEPAGE */
5
6#ifdef CONFIG_TRANSPARENT_HUGEPAGE
7extern int __khugepaged_enter(struct mm_struct *mm);
8extern void __khugepaged_exit(struct mm_struct *mm);
9extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma);
10
11#define khugepaged_enabled() \
12 (transparent_hugepage_flags & \
13 ((1<<TRANSPARENT_HUGEPAGE_FLAG) | \
14 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)))
15#define khugepaged_always() \
16 (transparent_hugepage_flags & \
17 (1<<TRANSPARENT_HUGEPAGE_FLAG))
18#define khugepaged_req_madv() \
19 (transparent_hugepage_flags & \
20 (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG))
21#define khugepaged_defrag() \
22 (transparent_hugepage_flags & \
23 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG))
24
25static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
26{
27 if (test_bit(MMF_VM_HUGEPAGE, &oldmm->flags))
28 return __khugepaged_enter(mm);
29 return 0;
30}
31
32static inline void khugepaged_exit(struct mm_struct *mm)
33{
34 if (test_bit(MMF_VM_HUGEPAGE, &mm->flags))
35 __khugepaged_exit(mm);
36}
37
38static inline int khugepaged_enter(struct vm_area_struct *vma)
39{
40 if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags))
41 if ((khugepaged_always() ||
42 (khugepaged_req_madv() &&
43 vma->vm_flags & VM_HUGEPAGE)) &&
44 !(vma->vm_flags & VM_NOHUGEPAGE))
45 if (__khugepaged_enter(vma->vm_mm))
46 return -ENOMEM;
47 return 0;
48}
49#else /* CONFIG_TRANSPARENT_HUGEPAGE */
50static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
51{
52 return 0;
53}
54static inline void khugepaged_exit(struct mm_struct *mm)
55{
56}
57static inline int khugepaged_enter(struct vm_area_struct *vma)
58{
59 return 0;
60}
61static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma)
62{
63 return 0;
64}
65#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
66
67#endif /* _LINUX_KHUGEPAGED_H */
diff --git a/include/linux/klist.h b/include/linux/klist.h
index e91a4e59b771..a370ce57cf1d 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -22,7 +22,7 @@ struct klist {
22 struct list_head k_list; 22 struct list_head k_list;
23 void (*get)(struct klist_node *); 23 void (*get)(struct klist_node *);
24 void (*put)(struct klist_node *); 24 void (*put)(struct klist_node *);
25} __attribute__ ((aligned (4))); 25} __attribute__ ((aligned (sizeof(void *))));
26 26
27#define KLIST_INIT(_name, _get, _put) \ 27#define KLIST_INIT(_name, _get, _put) \
28 { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ 28 { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 08d7dc4ddf40..39f8453239f7 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -76,7 +76,7 @@ bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size);
76 \ 76 \
77 _n = (long) &((ptr)->name##_end) \ 77 _n = (long) &((ptr)->name##_end) \
78 - (long) &((ptr)->name##_begin); \ 78 - (long) &((ptr)->name##_begin); \
79 MAYBE_BUILD_BUG_ON(_n < 0); \ 79 BUILD_BUG_ON(_n < 0); \
80 \ 80 \
81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
82 } while (0) 82 } while (0)
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 6efd7a78de6a..310231823852 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -113,5 +113,6 @@ extern void usermodehelper_init(void);
113 113
114extern int usermodehelper_disable(void); 114extern int usermodehelper_disable(void);
115extern void usermodehelper_enable(void); 115extern void usermodehelper_enable(void);
116extern bool usermodehelper_is_disabled(void);
116 117
117#endif /* __LINUX_KMOD_H__ */ 118#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 24b44145a886..2a0d7d651dc3 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -18,6 +18,10 @@ enum kmsg_dump_reason {
18 KMSG_DUMP_OOPS, 18 KMSG_DUMP_OOPS,
19 KMSG_DUMP_PANIC, 19 KMSG_DUMP_PANIC,
20 KMSG_DUMP_KEXEC, 20 KMSG_DUMP_KEXEC,
21 KMSG_DUMP_RESTART,
22 KMSG_DUMP_HALT,
23 KMSG_DUMP_POWEROFF,
24 KMSG_DUMP_EMERG,
21}; 25};
22 26
23/** 27/**
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 8f6d12151048..9229b64ee3aa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj)
85extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); 85extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
86extern int __must_check kobject_add(struct kobject *kobj, 86extern int __must_check kobject_add(struct kobject *kobj,
87 struct kobject *parent, 87 struct kobject *parent,
88 const char *fmt, ...); 88 const char *fmt, ...)
89 __attribute__((format(printf, 3, 4)));
89extern int __must_check kobject_init_and_add(struct kobject *kobj, 90extern int __must_check kobject_init_and_add(struct kobject *kobj,
90 struct kobj_type *ktype, 91 struct kobj_type *ktype,
91 struct kobject *parent, 92 struct kobject *parent,
92 const char *fmt, ...); 93 const char *fmt, ...)
94 __attribute__((format(printf, 4, 5)));
93 95
94extern void kobject_del(struct kobject *kobj); 96extern void kobject_del(struct kobject *kobj);
95 97
@@ -224,8 +226,8 @@ static inline int kobject_uevent_env(struct kobject *kobj,
224 char *envp[]) 226 char *envp[])
225{ return 0; } 227{ return 0; }
226 228
227static inline int add_uevent_var(struct kobj_uevent_env *env, 229static inline __attribute__((format(printf, 2, 3)))
228 const char *format, ...) 230int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
229{ return 0; } 231{ return 0; }
230 232
231static inline int kobject_action_type(const char *buf, size_t count, 233static inline int kobject_action_type(const char *buf, size_t count,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e7d1b2e0070d..dd7c12e875bc 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -275,7 +275,9 @@ extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn);
275extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); 275extern int arch_check_optimized_kprobe(struct optimized_kprobe *op);
276extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op); 276extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op);
277extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); 277extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op);
278extern int arch_optimize_kprobe(struct optimized_kprobe *op); 278extern void arch_optimize_kprobes(struct list_head *oplist);
279extern void arch_unoptimize_kprobes(struct list_head *oplist,
280 struct list_head *done_list);
279extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); 281extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
280extern kprobe_opcode_t *get_optinsn_slot(void); 282extern kprobe_opcode_t *get_optinsn_slot(void);
281extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty); 283extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
@@ -303,12 +305,12 @@ struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
303/* kprobe_running() will just return the current_kprobe on this CPU */ 305/* kprobe_running() will just return the current_kprobe on this CPU */
304static inline struct kprobe *kprobe_running(void) 306static inline struct kprobe *kprobe_running(void)
305{ 307{
306 return (__get_cpu_var(current_kprobe)); 308 return (__this_cpu_read(current_kprobe));
307} 309}
308 310
309static inline void reset_current_kprobe(void) 311static inline void reset_current_kprobe(void)
310{ 312{
311 __get_cpu_var(current_kprobe) = NULL; 313 __this_cpu_write(current_kprobe, NULL);
312} 314}
313 315
314static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) 316static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 6cc38fc07ab7..d4a62ab2ee5e 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -24,5 +24,7 @@ struct kref {
24void kref_init(struct kref *kref); 24void kref_init(struct kref *kref);
25void kref_get(struct kref *kref); 25void kref_get(struct kref *kref);
26int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 26int kref_put(struct kref *kref, void (*release) (struct kref *kref));
27int kref_sub(struct kref *kref, unsigned int count,
28 void (*release) (struct kref *kref));
27 29
28#endif /* _KREF_H_ */ 30#endif /* _KREF_H_ */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 685ea65eb803..1e923e5e88e8 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,10 +4,15 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
8 void *data, 8 void *data,
9 const char namefmt[], ...) 9 int node,
10 __attribute__((format(printf, 3, 4))); 10 const char namefmt[], ...)
11 __attribute__((format(printf, 4, 5)));
12
13#define kthread_create(threadfn, data, namefmt, arg...) \
14 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg)
15
11 16
12/** 17/**
13 * kthread_run - create and wake a thread. 18 * kthread_run - create and wake a thread.
@@ -34,6 +39,7 @@ void *kthread_data(struct task_struct *k);
34 39
35int kthreadd(void *unused); 40int kthreadd(void *unused);
36extern struct task_struct *kthreadd_task; 41extern struct task_struct *kthreadd_task;
42extern int tsk_fork_get_node(struct task_struct *tsk);
37 43
38/* 44/*
39 * Simple work processor based on kthread. 45 * Simple work processor based on kthread.
@@ -64,7 +70,7 @@ struct kthread_work {
64}; 70};
65 71
66#define KTHREAD_WORKER_INIT(worker) { \ 72#define KTHREAD_WORKER_INIT(worker) { \
67 .lock = SPIN_LOCK_UNLOCKED, \ 73 .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \
68 .work_list = LIST_HEAD_INIT((worker).work_list), \ 74 .work_list = LIST_HEAD_INIT((worker).work_list), \
69 } 75 }
70 76
@@ -81,16 +87,41 @@ struct kthread_work {
81#define DEFINE_KTHREAD_WORK(work, fn) \ 87#define DEFINE_KTHREAD_WORK(work, fn) \
82 struct kthread_work work = KTHREAD_WORK_INIT(work, fn) 88 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
83 89
84static inline void init_kthread_worker(struct kthread_worker *worker) 90/*
85{ 91 * kthread_worker.lock and kthread_work.done need their own lockdep class
86 *worker = (struct kthread_worker)KTHREAD_WORKER_INIT(*worker); 92 * keys if they are defined on stack with lockdep enabled. Use the
87} 93 * following macros when defining them on stack.
88 94 */
89static inline void init_kthread_work(struct kthread_work *work, 95#ifdef CONFIG_LOCKDEP
90 kthread_work_func_t fn) 96# define KTHREAD_WORKER_INIT_ONSTACK(worker) \
91{ 97 ({ init_kthread_worker(&worker); worker; })
92 *work = (struct kthread_work)KTHREAD_WORK_INIT(*work, fn); 98# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
93} 99 struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
100# define KTHREAD_WORK_INIT_ONSTACK(work, fn) \
101 ({ init_kthread_work((&work), fn); work; })
102# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) \
103 struct kthread_work work = KTHREAD_WORK_INIT_ONSTACK(work, fn)
104#else
105# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
106# define DEFINE_KTHREAD_WORK_ONSTACK(work, fn) DEFINE_KTHREAD_WORK(work, fn)
107#endif
108
109extern void __init_kthread_worker(struct kthread_worker *worker,
110 const char *name, struct lock_class_key *key);
111
112#define init_kthread_worker(worker) \
113 do { \
114 static struct lock_class_key __key; \
115 __init_kthread_worker((worker), "("#worker")->lock", &__key); \
116 } while (0)
117
118#define init_kthread_work(work, fn) \
119 do { \
120 memset((work), 0, sizeof(struct kthread_work)); \
121 INIT_LIST_HEAD(&(work)->node); \
122 (work)->func = (fn); \
123 init_waitqueue_head(&(work)->done); \
124 } while (0)
94 125
95int kthread_worker_fn(void *worker_ptr); 126int kthread_worker_fn(void *worker_ptr);
96 127
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index e1ceaa9b36bb..603bec2913b0 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -35,7 +35,7 @@
35 * 35 *
36 * On 32-bit CPUs an optimized representation of the timespec structure 36 * On 32-bit CPUs an optimized representation of the timespec structure
37 * is used to avoid expensive conversions from and to timespecs. The 37 * is used to avoid expensive conversions from and to timespecs. The
38 * endian-aware order of the tv struct members is choosen to allow 38 * endian-aware order of the tv struct members is chosen to allow
39 * mathematical operations on the tv64 member of the union too, which 39 * mathematical operations on the tv64 member of the union too, which
40 * for certain operations produces better code. 40 * for certain operations produces better code.
41 * 41 *
@@ -158,7 +158,7 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
158 * @lhs: minuend 158 * @lhs: minuend
159 * @rhs: subtrahend 159 * @rhs: subtrahend
160 * 160 *
161 * Returns the remainder of the substraction 161 * Returns the remainder of the subtraction
162 */ 162 */
163static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) 163static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
164{ 164{
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 919ae53adc5c..ea2dc1a2e13d 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -540,6 +540,7 @@ struct kvm_ppc_pvinfo {
540#endif 540#endif
541#define KVM_CAP_PPC_GET_PVINFO 57 541#define KVM_CAP_PPC_GET_PVINFO 57
542#define KVM_CAP_PPC_IRQ_LEVEL 58 542#define KVM_CAP_PPC_IRQ_LEVEL 58
543#define KVM_CAP_ASYNC_PF 59
543 544
544#ifdef KVM_CAP_IRQ_ROUTING 545#ifdef KVM_CAP_IRQ_ROUTING
545 546
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a0557422715e..ab428552af8e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -16,6 +16,8 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/msi.h> 18#include <linux/msi.h>
19#include <linux/slab.h>
20#include <linux/rcupdate.h>
19#include <asm/signal.h> 21#include <asm/signal.h>
20 22
21#include <linux/kvm.h> 23#include <linux/kvm.h>
@@ -40,6 +42,8 @@
40#define KVM_REQ_KICK 9 42#define KVM_REQ_KICK 9
41#define KVM_REQ_DEACTIVATE_FPU 10 43#define KVM_REQ_DEACTIVATE_FPU 10
42#define KVM_REQ_EVENT 11 44#define KVM_REQ_EVENT 11
45#define KVM_REQ_APF_HALT 12
46#define KVM_REQ_NMI 13
43 47
44#define KVM_USERSPACE_IRQ_SOURCE_ID 0 48#define KVM_USERSPACE_IRQ_SOURCE_ID 0
45 49
@@ -74,23 +78,52 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx,
74int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 78int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
75 struct kvm_io_device *dev); 79 struct kvm_io_device *dev);
76 80
81#ifdef CONFIG_KVM_ASYNC_PF
82struct kvm_async_pf {
83 struct work_struct work;
84 struct list_head link;
85 struct list_head queue;
86 struct kvm_vcpu *vcpu;
87 struct mm_struct *mm;
88 gva_t gva;
89 unsigned long addr;
90 struct kvm_arch_async_pf arch;
91 struct page *page;
92 bool done;
93};
94
95void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu);
96void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu);
97int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
98 struct kvm_arch_async_pf *arch);
99int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
100#endif
101
102enum {
103 OUTSIDE_GUEST_MODE,
104 IN_GUEST_MODE,
105 EXITING_GUEST_MODE
106};
107
77struct kvm_vcpu { 108struct kvm_vcpu {
78 struct kvm *kvm; 109 struct kvm *kvm;
79#ifdef CONFIG_PREEMPT_NOTIFIERS 110#ifdef CONFIG_PREEMPT_NOTIFIERS
80 struct preempt_notifier preempt_notifier; 111 struct preempt_notifier preempt_notifier;
81#endif 112#endif
113 int cpu;
82 int vcpu_id; 114 int vcpu_id;
83 struct mutex mutex; 115 int srcu_idx;
84 int cpu; 116 int mode;
85 atomic_t guest_mode;
86 struct kvm_run *run;
87 unsigned long requests; 117 unsigned long requests;
88 unsigned long guest_debug; 118 unsigned long guest_debug;
89 int srcu_idx; 119
120 struct mutex mutex;
121 struct kvm_run *run;
90 122
91 int fpu_active; 123 int fpu_active;
92 int guest_fpu_loaded, guest_xcr0_loaded; 124 int guest_fpu_loaded, guest_xcr0_loaded;
93 wait_queue_head_t wq; 125 wait_queue_head_t wq;
126 struct pid *pid;
94 int sigset_active; 127 int sigset_active;
95 sigset_t sigset; 128 sigset_t sigset;
96 struct kvm_vcpu_stat stat; 129 struct kvm_vcpu_stat stat;
@@ -104,25 +137,42 @@ struct kvm_vcpu {
104 gpa_t mmio_phys_addr; 137 gpa_t mmio_phys_addr;
105#endif 138#endif
106 139
140#ifdef CONFIG_KVM_ASYNC_PF
141 struct {
142 u32 queued;
143 struct list_head queue;
144 struct list_head done;
145 spinlock_t lock;
146 } async_pf;
147#endif
148
107 struct kvm_vcpu_arch arch; 149 struct kvm_vcpu_arch arch;
108}; 150};
109 151
152static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
153{
154 return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
155}
156
110/* 157/*
111 * Some of the bitops functions do not support too long bitmaps. 158 * Some of the bitops functions do not support too long bitmaps.
112 * This number must be determined not to exceed such limits. 159 * This number must be determined not to exceed such limits.
113 */ 160 */
114#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1) 161#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
115 162
163struct kvm_lpage_info {
164 unsigned long rmap_pde;
165 int write_count;
166};
167
116struct kvm_memory_slot { 168struct kvm_memory_slot {
117 gfn_t base_gfn; 169 gfn_t base_gfn;
118 unsigned long npages; 170 unsigned long npages;
119 unsigned long flags; 171 unsigned long flags;
120 unsigned long *rmap; 172 unsigned long *rmap;
121 unsigned long *dirty_bitmap; 173 unsigned long *dirty_bitmap;
122 struct { 174 unsigned long *dirty_bitmap_head;
123 unsigned long rmap_pde; 175 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
124 int write_count;
125 } *lpage_info[KVM_NR_PAGE_SIZES - 1];
126 unsigned long userspace_addr; 176 unsigned long userspace_addr;
127 int user_alloc; 177 int user_alloc;
128 int id; 178 int id;
@@ -169,13 +219,13 @@ struct kvm_irq_routing_table {};
169 219
170struct kvm_memslots { 220struct kvm_memslots {
171 int nmemslots; 221 int nmemslots;
222 u64 generation;
172 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 223 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
173 KVM_PRIVATE_MEM_SLOTS]; 224 KVM_PRIVATE_MEM_SLOTS];
174}; 225};
175 226
176struct kvm { 227struct kvm {
177 spinlock_t mmu_lock; 228 spinlock_t mmu_lock;
178 raw_spinlock_t requests_lock;
179 struct mutex slots_lock; 229 struct mutex slots_lock;
180 struct mm_struct *mm; /* userspace tied to this vm */ 230 struct mm_struct *mm; /* userspace tied to this vm */
181 struct kvm_memslots *memslots; 231 struct kvm_memslots *memslots;
@@ -186,6 +236,7 @@ struct kvm {
186#endif 236#endif
187 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 237 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
188 atomic_t online_vcpus; 238 atomic_t online_vcpus;
239 int last_boosted_vcpu;
189 struct list_head vm_list; 240 struct list_head vm_list;
190 struct mutex lock; 241 struct mutex lock;
191 struct kvm_io_bus *buses[KVM_NR_BUSES]; 242 struct kvm_io_bus *buses[KVM_NR_BUSES];
@@ -206,6 +257,10 @@ struct kvm {
206 257
207 struct mutex irq_lock; 258 struct mutex irq_lock;
208#ifdef CONFIG_HAVE_KVM_IRQCHIP 259#ifdef CONFIG_HAVE_KVM_IRQCHIP
260 /*
261 * Update side is protected by irq_lock and,
262 * if configured, irqfds.lock.
263 */
209 struct kvm_irq_routing_table __rcu *irq_routing; 264 struct kvm_irq_routing_table __rcu *irq_routing;
210 struct hlist_head mask_notifier_list; 265 struct hlist_head mask_notifier_list;
211 struct hlist_head irq_ack_notifier_list; 266 struct hlist_head irq_ack_notifier_list;
@@ -216,6 +271,7 @@ struct kvm {
216 unsigned long mmu_notifier_seq; 271 unsigned long mmu_notifier_seq;
217 long mmu_notifier_count; 272 long mmu_notifier_count;
218#endif 273#endif
274 long tlbs_dirty;
219}; 275};
220 276
221/* The guest did something we don't support. */ 277/* The guest did something we don't support. */
@@ -302,7 +358,11 @@ void kvm_set_page_accessed(struct page *page);
302 358
303pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr); 359pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr);
304pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); 360pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
361pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async,
362 bool write_fault, bool *writable);
305pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); 363pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
364pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
365 bool *writable);
306pfn_t gfn_to_pfn_memslot(struct kvm *kvm, 366pfn_t gfn_to_pfn_memslot(struct kvm *kvm,
307 struct kvm_memory_slot *slot, gfn_t gfn); 367 struct kvm_memory_slot *slot, gfn_t gfn);
308int memslot_id(struct kvm *kvm, gfn_t gfn); 368int memslot_id(struct kvm *kvm, gfn_t gfn);
@@ -321,18 +381,25 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
321 int offset, int len); 381 int offset, int len);
322int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, 382int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
323 unsigned long len); 383 unsigned long len);
384int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
385 void *data, unsigned long len);
386int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
387 gpa_t gpa);
324int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); 388int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
325int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); 389int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
326struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); 390struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
327int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); 391int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
328unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn); 392unsigned long kvm_host_page_size(struct kvm *kvm, gfn_t gfn);
329void mark_page_dirty(struct kvm *kvm, gfn_t gfn); 393void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
394void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
395 gfn_t gfn);
330 396
331void kvm_vcpu_block(struct kvm_vcpu *vcpu); 397void kvm_vcpu_block(struct kvm_vcpu *vcpu);
332void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 398void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
333void kvm_resched(struct kvm_vcpu *vcpu); 399void kvm_resched(struct kvm_vcpu *vcpu);
334void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); 400void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
335void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); 401void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
402
336void kvm_flush_remote_tlbs(struct kvm *kvm); 403void kvm_flush_remote_tlbs(struct kvm *kvm);
337void kvm_reload_remote_mmus(struct kvm *kvm); 404void kvm_reload_remote_mmus(struct kvm *kvm);
338 405
@@ -398,7 +465,19 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
398 465
399void kvm_free_physmem(struct kvm *kvm); 466void kvm_free_physmem(struct kvm *kvm);
400 467
401struct kvm *kvm_arch_create_vm(void); 468#ifndef __KVM_HAVE_ARCH_VM_ALLOC
469static inline struct kvm *kvm_arch_alloc_vm(void)
470{
471 return kzalloc(sizeof(struct kvm), GFP_KERNEL);
472}
473
474static inline void kvm_arch_free_vm(struct kvm *kvm)
475{
476 kfree(kvm);
477}
478#endif
479
480int kvm_arch_init_vm(struct kvm *kvm);
402void kvm_arch_destroy_vm(struct kvm *kvm); 481void kvm_arch_destroy_vm(struct kvm *kvm);
403void kvm_free_all_assigned_devices(struct kvm *kvm); 482void kvm_free_all_assigned_devices(struct kvm *kvm);
404void kvm_arch_sync_events(struct kvm *kvm); 483void kvm_arch_sync_events(struct kvm *kvm);
@@ -414,16 +493,8 @@ struct kvm_irq_ack_notifier {
414 void (*irq_acked)(struct kvm_irq_ack_notifier *kian); 493 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
415}; 494};
416 495
417#define KVM_ASSIGNED_MSIX_PENDING 0x1
418struct kvm_guest_msix_entry {
419 u32 vector;
420 u16 entry;
421 u16 flags;
422};
423
424struct kvm_assigned_dev_kernel { 496struct kvm_assigned_dev_kernel {
425 struct kvm_irq_ack_notifier ack_notifier; 497 struct kvm_irq_ack_notifier ack_notifier;
426 struct work_struct interrupt_work;
427 struct list_head list; 498 struct list_head list;
428 int assigned_dev_id; 499 int assigned_dev_id;
429 int host_segnr; 500 int host_segnr;
@@ -434,13 +505,14 @@ struct kvm_assigned_dev_kernel {
434 bool host_irq_disabled; 505 bool host_irq_disabled;
435 struct msix_entry *host_msix_entries; 506 struct msix_entry *host_msix_entries;
436 int guest_irq; 507 int guest_irq;
437 struct kvm_guest_msix_entry *guest_msix_entries; 508 struct msix_entry *guest_msix_entries;
438 unsigned long irq_requested_type; 509 unsigned long irq_requested_type;
439 int irq_source_id; 510 int irq_source_id;
440 int flags; 511 int flags;
441 struct pci_dev *dev; 512 struct pci_dev *dev;
442 struct kvm *kvm; 513 struct kvm *kvm;
443 spinlock_t assigned_dev_lock; 514 spinlock_t intx_lock;
515 char irq_name[32];
444}; 516};
445 517
446struct kvm_irq_mask_notifier { 518struct kvm_irq_mask_notifier {
@@ -462,6 +534,8 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
462 unsigned long *deliver_bitmask); 534 unsigned long *deliver_bitmask);
463#endif 535#endif
464int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level); 536int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
537int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
538 int irq_source_id, int level);
465void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 539void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
466void kvm_register_irq_ack_notifier(struct kvm *kvm, 540void kvm_register_irq_ack_notifier(struct kvm *kvm,
467 struct kvm_irq_ack_notifier *kian); 541 struct kvm_irq_ack_notifier *kian);
@@ -603,17 +677,28 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
603void kvm_eventfd_init(struct kvm *kvm); 677void kvm_eventfd_init(struct kvm *kvm);
604int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags); 678int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
605void kvm_irqfd_release(struct kvm *kvm); 679void kvm_irqfd_release(struct kvm *kvm);
680void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
606int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 681int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
607 682
608#else 683#else
609 684
610static inline void kvm_eventfd_init(struct kvm *kvm) {} 685static inline void kvm_eventfd_init(struct kvm *kvm) {}
686
611static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags) 687static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
612{ 688{
613 return -EINVAL; 689 return -EINVAL;
614} 690}
615 691
616static inline void kvm_irqfd_release(struct kvm *kvm) {} 692static inline void kvm_irqfd_release(struct kvm *kvm) {}
693
694#ifdef CONFIG_HAVE_KVM_IRQCHIP
695static inline void kvm_irq_routing_update(struct kvm *kvm,
696 struct kvm_irq_routing_table *irq_rt)
697{
698 rcu_assign_pointer(kvm->irq_routing, irq_rt);
699}
700#endif
701
617static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) 702static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
618{ 703{
619 return -ENOSYS; 704 return -ENOSYS;
@@ -648,11 +733,6 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
648 set_bit(req, &vcpu->requests); 733 set_bit(req, &vcpu->requests);
649} 734}
650 735
651static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu)
652{
653 return test_and_set_bit(req, &vcpu->requests);
654}
655
656static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) 736static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
657{ 737{
658 if (test_bit(req, &vcpu->requests)) { 738 if (test_bit(req, &vcpu->requests)) {
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 7ac0d4eee430..fa7cc7244cbd 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -67,4 +67,11 @@ struct kvm_lapic_irq {
67 u32 dest_id; 67 u32 dest_id;
68}; 68};
69 69
70struct gfn_to_hva_cache {
71 u64 generation;
72 gpa_t gpa;
73 unsigned long hva;
74 struct kvm_memory_slot *memslot;
75};
76
70#endif /* __KVM_TYPES_H__ */ 77#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
new file mode 100644
index 000000000000..58592fa67d24
--- /dev/null
+++ b/include/linux/led-lm3530.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA.
3 * Copyright (C) 2009 Motorola, Inc.
4 *
5 * License Terms: GNU General Public License v2
6 *
7 * Simple driver for National Semiconductor LM35330 Backlight driver chip
8 *
9 * Author: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
10 * based on leds-lm3530.c by Dan Murphy <D.Murphy@motorola.com>
11 */
12
13#ifndef _LINUX_LED_LM3530_H__
14#define _LINUX_LED_LM3530_H__
15
16#define LM3530_FS_CURR_5mA (0) /* Full Scale Current */
17#define LM3530_FS_CURR_8mA (1)
18#define LM3530_FS_CURR_12mA (2)
19#define LM3530_FS_CURR_15mA (3)
20#define LM3530_FS_CURR_19mA (4)
21#define LM3530_FS_CURR_22mA (5)
22#define LM3530_FS_CURR_26mA (6)
23#define LM3530_FS_CURR_29mA (7)
24
25#define LM3530_ALS_AVRG_TIME_32ms (0) /* ALS Averaging Time */
26#define LM3530_ALS_AVRG_TIME_64ms (1)
27#define LM3530_ALS_AVRG_TIME_128ms (2)
28#define LM3530_ALS_AVRG_TIME_256ms (3)
29#define LM3530_ALS_AVRG_TIME_512ms (4)
30#define LM3530_ALS_AVRG_TIME_1024ms (5)
31#define LM3530_ALS_AVRG_TIME_2048ms (6)
32#define LM3530_ALS_AVRG_TIME_4096ms (7)
33
34#define LM3530_RAMP_TIME_1ms (0) /* Brigtness Ramp Time */
35#define LM3530_RAMP_TIME_130ms (1) /* Max to 0 and vice versa */
36#define LM3530_RAMP_TIME_260ms (2)
37#define LM3530_RAMP_TIME_520ms (3)
38#define LM3530_RAMP_TIME_1s (4)
39#define LM3530_RAMP_TIME_2s (5)
40#define LM3530_RAMP_TIME_4s (6)
41#define LM3530_RAMP_TIME_8s (7)
42
43/* ALS Resistor Select */
44#define LM3530_ALS_IMPD_Z (0x00) /* ALS Impedance */
45#define LM3530_ALS_IMPD_13_53kOhm (0x01)
46#define LM3530_ALS_IMPD_9_01kOhm (0x02)
47#define LM3530_ALS_IMPD_5_41kOhm (0x03)
48#define LM3530_ALS_IMPD_2_27kOhm (0x04)
49#define LM3530_ALS_IMPD_1_94kOhm (0x05)
50#define LM3530_ALS_IMPD_1_81kOhm (0x06)
51#define LM3530_ALS_IMPD_1_6kOhm (0x07)
52#define LM3530_ALS_IMPD_1_138kOhm (0x08)
53#define LM3530_ALS_IMPD_1_05kOhm (0x09)
54#define LM3530_ALS_IMPD_1_011kOhm (0x0A)
55#define LM3530_ALS_IMPD_941Ohm (0x0B)
56#define LM3530_ALS_IMPD_759Ohm (0x0C)
57#define LM3530_ALS_IMPD_719Ohm (0x0D)
58#define LM3530_ALS_IMPD_700Ohm (0x0E)
59#define LM3530_ALS_IMPD_667Ohm (0x0F)
60
61enum lm3530_mode {
62 LM3530_BL_MODE_MANUAL = 0, /* "man" */
63 LM3530_BL_MODE_ALS, /* "als" */
64 LM3530_BL_MODE_PWM, /* "pwm" */
65};
66
67/* ALS input select */
68enum lm3530_als_mode {
69 LM3530_INPUT_AVRG = 0, /* ALS1 and ALS2 input average */
70 LM3530_INPUT_ALS1, /* ALS1 Input */
71 LM3530_INPUT_ALS2, /* ALS2 Input */
72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */
73};
74
75/**
76 * struct lm3530_platform_data
77 * @mode: mode of operation i.e. Manual, ALS or PWM
78 * @als_input_mode: select source of ALS input - ALS1/2 or average
79 * @max_current: full scale LED current
80 * @pwm_pol_hi: PWM input polarity - active high/active low
81 * @als_avrg_time: ALS input averaging time
82 * @brt_ramp_law: brightness mapping mode - exponential/linear
83 * @brt_ramp_fall: rate of fall of led current
84 * @brt_ramp_rise: rate of rise of led current
85 * @als1_resistor_sel: internal resistance from ALS1 input to ground
86 * @als2_resistor_sel: internal resistance from ALS2 input to ground
87 * @brt_val: brightness value (0-255)
88 */
89struct lm3530_platform_data {
90 enum lm3530_mode mode;
91 enum lm3530_als_mode als_input_mode;
92
93 u8 max_current;
94 bool pwm_pol_hi;
95 u8 als_avrg_time;
96
97 bool brt_ramp_law;
98 u8 brt_ramp_fall;
99 u8 brt_ramp_rise;
100
101 u8 als1_resistor_sel;
102 u8 als2_resistor_sel;
103
104 u8 brt_val;
105};
106
107#endif /* _LINUX_LED_LM3530_H__ */
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
new file mode 100644
index 000000000000..fd548d2a8775
--- /dev/null
+++ b/include/linux/leds-lp5521.h
@@ -0,0 +1,48 @@
1/*
2 * LP5521 LED chip driver.
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5521_H
24#define __LINUX_LP5521_H
25
26/* See Documentation/leds/leds-lp5521.txt */
27
28struct lp5521_led_config {
29 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current;
32};
33
34#define LP5521_CLOCK_AUTO 0
35#define LP5521_CLOCK_INT 1
36#define LP5521_CLOCK_EXT 2
37
38struct lp5521_platform_data {
39 struct lp5521_led_config *led_config;
40 u8 num_channels;
41 u8 clock_mode;
42 int (*setup_resources)(void);
43 void (*release_resources)(void);
44 void (*enable)(bool state);
45 const char *label;
46};
47
48#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
new file mode 100644
index 000000000000..2694289babd0
--- /dev/null
+++ b/include/linux/leds-lp5523.h
@@ -0,0 +1,48 @@
1/*
2 * LP5523 LED Driver
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * 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., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5523_H
24#define __LINUX_LP5523_H
25
26/* See Documentation/leds/leds-lp5523.txt */
27
28struct lp5523_led_config {
29 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current;
32};
33
34#define LP5523_CLOCK_AUTO 0
35#define LP5523_CLOCK_INT 1
36#define LP5523_CLOCK_EXT 2
37
38struct lp5523_platform_data {
39 struct lp5523_led_config *led_config;
40 u8 num_channels;
41 u8 clock_mode;
42 int (*setup_resources)(void);
43 void (*release_resources)(void);
44 void (*enable)(bool state);
45 const char *label;
46};
47
48#endif /* __LINUX_LP5523_H */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index ba6986a11663..61e0340a4b77 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -15,6 +15,7 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/timer.h>
18 19
19struct device; 20struct device;
20/* 21/*
@@ -45,10 +46,14 @@ struct led_classdev {
45 /* Get LED brightness level */ 46 /* Get LED brightness level */
46 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); 47 enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
47 48
48 /* Activate hardware accelerated blink, delays are in 49 /*
49 * miliseconds and if none is provided then a sensible default 50 * Activate hardware accelerated blink, delays are in milliseconds
50 * should be chosen. The call can adjust the timings if it can't 51 * and if both are zero then a sensible default should be chosen.
51 * match the values specified exactly. */ 52 * The call should adjust the timings in that case and if it can't
53 * match the values specified exactly.
54 * Deactivate blinking again when the brightness is set to a fixed
55 * value via the brightness_set() callback.
56 */
52 int (*blink_set)(struct led_classdev *led_cdev, 57 int (*blink_set)(struct led_classdev *led_cdev,
53 unsigned long *delay_on, 58 unsigned long *delay_on,
54 unsigned long *delay_off); 59 unsigned long *delay_off);
@@ -57,6 +62,10 @@ struct led_classdev {
57 struct list_head node; /* LED Device list */ 62 struct list_head node; /* LED Device list */
58 const char *default_trigger; /* Trigger to use */ 63 const char *default_trigger; /* Trigger to use */
59 64
65 unsigned long blink_delay_on, blink_delay_off;
66 struct timer_list blink_timer;
67 int blink_brightness;
68
60#ifdef CONFIG_LEDS_TRIGGERS 69#ifdef CONFIG_LEDS_TRIGGERS
61 /* Protects the trigger data below */ 70 /* Protects the trigger data below */
62 struct rw_semaphore trigger_lock; 71 struct rw_semaphore trigger_lock;
@@ -73,6 +82,36 @@ extern void led_classdev_unregister(struct led_classdev *led_cdev);
73extern void led_classdev_suspend(struct led_classdev *led_cdev); 82extern void led_classdev_suspend(struct led_classdev *led_cdev);
74extern void led_classdev_resume(struct led_classdev *led_cdev); 83extern void led_classdev_resume(struct led_classdev *led_cdev);
75 84
85/**
86 * led_blink_set - set blinking with software fallback
87 * @led_cdev: the LED to start blinking
88 * @delay_on: the time it should be on (in ms)
89 * @delay_off: the time it should ble off (in ms)
90 *
91 * This function makes the LED blink, attempting to use the
92 * hardware acceleration if possible, but falling back to
93 * software blinking if there is no hardware blinking or if
94 * the LED refuses the passed values.
95 *
96 * Note that if software blinking is active, simply calling
97 * led_cdev->brightness_set() will not stop the blinking,
98 * use led_classdev_brightness_set() instead.
99 */
100extern void led_blink_set(struct led_classdev *led_cdev,
101 unsigned long *delay_on,
102 unsigned long *delay_off);
103/**
104 * led_brightness_set - set LED brightness
105 * @led_cdev: the LED to set
106 * @brightness: the brightness to set it to
107 *
108 * Set an LED's brightness, and, if necessary, cancel the
109 * software blink timer that implements blinking when the
110 * hardware doesn't.
111 */
112extern void led_brightness_set(struct led_classdev *led_cdev,
113 enum led_brightness brightness);
114
76/* 115/*
77 * LED Triggers 116 * LED Triggers
78 */ 117 */
@@ -106,6 +145,9 @@ extern void led_trigger_register_simple(const char *name,
106extern void led_trigger_unregister_simple(struct led_trigger *trigger); 145extern void led_trigger_unregister_simple(struct led_trigger *trigger);
107extern void led_trigger_event(struct led_trigger *trigger, 146extern void led_trigger_event(struct led_trigger *trigger,
108 enum led_brightness event); 147 enum led_brightness event);
148extern void led_trigger_blink(struct led_trigger *trigger,
149 unsigned long *delay_on,
150 unsigned long *delay_off);
109 151
110#else 152#else
111 153
@@ -155,11 +197,11 @@ struct gpio_led {
155 197
156struct gpio_led_platform_data { 198struct gpio_led_platform_data {
157 int num_leds; 199 int num_leds;
158 struct gpio_led *leds; 200 const struct gpio_led *leds;
159 201
160#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ 202#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
161#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ 203#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
162#define GPIO_LED_BLINK 2 /* Plase, blink */ 204#define GPIO_LED_BLINK 2 /* Please, blink */
163 int (*gpio_blink_set)(unsigned gpio, int state, 205 int (*gpio_blink_set)(unsigned gpio, int state,
164 unsigned long *delay_on, 206 unsigned long *delay_on,
165 unsigned long *delay_off); 207 unsigned long *delay_off);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 15b77b8dc7e1..5a9926b34072 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -137,8 +137,6 @@ enum {
137 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 137 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
138 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 138 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
139 ATA_DFLAG_AN = (1 << 7), /* AN configured */ 139 ATA_DFLAG_AN = (1 << 7), /* AN configured */
140 ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */
141 ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */
142 ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ 140 ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
143 ATA_DFLAG_CFG_MASK = (1 << 12) - 1, 141 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
144 142
@@ -179,10 +177,6 @@ enum {
179 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 177 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
180 /* (doesn't imply presence) */ 178 /* (doesn't imply presence) */
181 ATA_FLAG_SATA = (1 << 1), 179 ATA_FLAG_SATA = (1 << 1),
182 ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */
183 ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */
184 ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */
185 ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */
186 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ 180 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
187 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ 181 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
188 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ 182 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */
@@ -198,11 +192,11 @@ enum {
198 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 192 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
199 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 193 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
200 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 194 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
201 ATA_FLAG_LPM = (1 << 20), /* driver can handle LPM */
202 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure 195 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
203 * management */ 196 * management */
204 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 197 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
205 * led */ 198 * led */
199 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
206 200
207 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 201 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
208 202
@@ -369,7 +363,7 @@ enum {
369 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6, 363 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6,
370 364
371 /* Horkage types. May be set by libata or controller on drives 365 /* Horkage types. May be set by libata or controller on drives
372 (some horkage may be drive/controller pair dependant */ 366 (some horkage may be drive/controller pair dependent */
373 367
374 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 368 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
375 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 369 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
@@ -986,7 +980,7 @@ extern void ata_host_init(struct ata_host *, struct device *,
986 unsigned long, struct ata_port_operations *); 980 unsigned long, struct ata_port_operations *);
987extern int ata_scsi_detect(struct scsi_host_template *sht); 981extern int ata_scsi_detect(struct scsi_host_template *sht);
988extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 982extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
989extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 983extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
990extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, 984extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
991 int cmd, void __user *arg); 985 int cmd, void __user *arg);
992extern void ata_sas_port_destroy(struct ata_port *); 986extern void ata_sas_port_destroy(struct ata_port *);
@@ -996,8 +990,7 @@ extern int ata_sas_port_init(struct ata_port *);
996extern int ata_sas_port_start(struct ata_port *ap); 990extern int ata_sas_port_start(struct ata_port *ap);
997extern void ata_sas_port_stop(struct ata_port *ap); 991extern void ata_sas_port_stop(struct ata_port *ap);
998extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); 992extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
999extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 993extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap);
1000 struct ata_port *ap);
1001extern int sata_scr_valid(struct ata_link *link); 994extern int sata_scr_valid(struct ata_link *link);
1002extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 995extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
1003extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 996extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
@@ -1040,8 +1033,7 @@ extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
1040 struct ata_taskfile *tf, u16 *id); 1033 struct ata_taskfile *tf, u16 *id);
1041extern void ata_qc_complete(struct ata_queued_cmd *qc); 1034extern void ata_qc_complete(struct ata_queued_cmd *qc);
1042extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); 1035extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
1043extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, 1036extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
1044 void (*done)(struct scsi_cmnd *));
1045extern int ata_std_bios_param(struct scsi_device *sdev, 1037extern int ata_std_bios_param(struct scsi_device *sdev,
1046 struct block_device *bdev, 1038 struct block_device *bdev,
1047 sector_t capacity, int geom[]); 1039 sector_t capacity, int geom[]);
@@ -1052,6 +1044,8 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
1052 int queue_depth, int reason); 1044 int queue_depth, int reason);
1053extern struct ata_device *ata_dev_pair(struct ata_device *adev); 1045extern struct ata_device *ata_dev_pair(struct ata_device *adev);
1054extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 1046extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1047extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
1048extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);
1055 1049
1056extern int ata_cable_40wire(struct ata_port *ap); 1050extern int ata_cable_40wire(struct ata_port *ap);
1057extern int ata_cable_80wire(struct ata_port *ap); 1051extern int ata_cable_80wire(struct ata_port *ap);
@@ -1157,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1157 ata_reset_fn_t softreset, ata_reset_fn_t hardreset, 1151 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
1158 ata_postreset_fn_t postreset); 1152 ata_postreset_fn_t postreset);
1159extern void ata_std_error_handler(struct ata_port *ap); 1153extern void ata_std_error_handler(struct ata_port *ap);
1154extern int ata_link_nr_enabled(struct ata_link *link);
1160 1155
1161/* 1156/*
1162 * Base operations to inherit from and initializers for sht 1157 * Base operations to inherit from and initializers for sht
@@ -1615,6 +1610,9 @@ extern void ata_sff_irq_on(struct ata_port *ap);
1615extern void ata_sff_irq_clear(struct ata_port *ap); 1610extern void ata_sff_irq_clear(struct ata_port *ap);
1616extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1611extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1617 u8 status, int in_wq); 1612 u8 status, int in_wq);
1613extern void ata_sff_queue_work(struct work_struct *work);
1614extern void ata_sff_queue_delayed_work(struct delayed_work *dwork,
1615 unsigned long delay);
1618extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); 1616extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay);
1619extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); 1617extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1620extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); 1618extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
diff --git a/include/linux/list.h b/include/linux/list.h
index 88a000617d77..cc6d2aa6b415 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/poison.h> 6#include <linux/poison.h>
7#include <linux/prefetch.h> 7#include <linux/const.h>
8 8
9/* 9/*
10 * Simple doubly linked list implementation. 10 * Simple doubly linked list implementation.
@@ -96,6 +96,11 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
96 * in an undefined state. 96 * in an undefined state.
97 */ 97 */
98#ifndef CONFIG_DEBUG_LIST 98#ifndef CONFIG_DEBUG_LIST
99static inline void __list_del_entry(struct list_head *entry)
100{
101 __list_del(entry->prev, entry->next);
102}
103
99static inline void list_del(struct list_head *entry) 104static inline void list_del(struct list_head *entry)
100{ 105{
101 __list_del(entry->prev, entry->next); 106 __list_del(entry->prev, entry->next);
@@ -103,6 +108,7 @@ static inline void list_del(struct list_head *entry)
103 entry->prev = LIST_POISON2; 108 entry->prev = LIST_POISON2;
104} 109}
105#else 110#else
111extern void __list_del_entry(struct list_head *entry);
106extern void list_del(struct list_head *entry); 112extern void list_del(struct list_head *entry);
107#endif 113#endif
108 114
@@ -135,7 +141,7 @@ static inline void list_replace_init(struct list_head *old,
135 */ 141 */
136static inline void list_del_init(struct list_head *entry) 142static inline void list_del_init(struct list_head *entry)
137{ 143{
138 __list_del(entry->prev, entry->next); 144 __list_del_entry(entry);
139 INIT_LIST_HEAD(entry); 145 INIT_LIST_HEAD(entry);
140} 146}
141 147
@@ -146,7 +152,7 @@ static inline void list_del_init(struct list_head *entry)
146 */ 152 */
147static inline void list_move(struct list_head *list, struct list_head *head) 153static inline void list_move(struct list_head *list, struct list_head *head)
148{ 154{
149 __list_del(list->prev, list->next); 155 __list_del_entry(list);
150 list_add(list, head); 156 list_add(list, head);
151} 157}
152 158
@@ -158,7 +164,7 @@ static inline void list_move(struct list_head *list, struct list_head *head)
158static inline void list_move_tail(struct list_head *list, 164static inline void list_move_tail(struct list_head *list,
159 struct list_head *head) 165 struct list_head *head)
160{ 166{
161 __list_del(list->prev, list->next); 167 __list_del_entry(list);
162 list_add_tail(list, head); 168 list_add_tail(list, head);
163} 169}
164 170
@@ -361,18 +367,15 @@ static inline void list_splice_tail_init(struct list_head *list,
361 * @head: the head for your list. 367 * @head: the head for your list.
362 */ 368 */
363#define list_for_each(pos, head) \ 369#define list_for_each(pos, head) \
364 for (pos = (head)->next; prefetch(pos->next), pos != (head); \ 370 for (pos = (head)->next; pos != (head); pos = pos->next)
365 pos = pos->next)
366 371
367/** 372/**
368 * __list_for_each - iterate over a list 373 * __list_for_each - iterate over a list
369 * @pos: the &struct list_head to use as a loop cursor. 374 * @pos: the &struct list_head to use as a loop cursor.
370 * @head: the head for your list. 375 * @head: the head for your list.
371 * 376 *
372 * This variant differs from list_for_each() in that it's the 377 * This variant doesn't differ from list_for_each() any more.
373 * simplest possible list iteration code, no prefetching is done. 378 * We don't do prefetching in either case.
374 * Use this for code that knows the list to be very short (empty
375 * or 1 entry) most of the time.
376 */ 379 */
377#define __list_for_each(pos, head) \ 380#define __list_for_each(pos, head) \
378 for (pos = (head)->next; pos != (head); pos = pos->next) 381 for (pos = (head)->next; pos != (head); pos = pos->next)
@@ -383,8 +386,7 @@ static inline void list_splice_tail_init(struct list_head *list,
383 * @head: the head for your list. 386 * @head: the head for your list.
384 */ 387 */
385#define list_for_each_prev(pos, head) \ 388#define list_for_each_prev(pos, head) \
386 for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ 389 for (pos = (head)->prev; pos != (head); pos = pos->prev)
387 pos = pos->prev)
388 390
389/** 391/**
390 * list_for_each_safe - iterate over a list safe against removal of list entry 392 * list_for_each_safe - iterate over a list safe against removal of list entry
@@ -404,7 +406,7 @@ static inline void list_splice_tail_init(struct list_head *list,
404 */ 406 */
405#define list_for_each_prev_safe(pos, n, head) \ 407#define list_for_each_prev_safe(pos, n, head) \
406 for (pos = (head)->prev, n = pos->prev; \ 408 for (pos = (head)->prev, n = pos->prev; \
407 prefetch(pos->prev), pos != (head); \ 409 pos != (head); \
408 pos = n, n = pos->prev) 410 pos = n, n = pos->prev)
409 411
410/** 412/**
@@ -415,7 +417,7 @@ static inline void list_splice_tail_init(struct list_head *list,
415 */ 417 */
416#define list_for_each_entry(pos, head, member) \ 418#define list_for_each_entry(pos, head, member) \
417 for (pos = list_entry((head)->next, typeof(*pos), member); \ 419 for (pos = list_entry((head)->next, typeof(*pos), member); \
418 prefetch(pos->member.next), &pos->member != (head); \ 420 &pos->member != (head); \
419 pos = list_entry(pos->member.next, typeof(*pos), member)) 421 pos = list_entry(pos->member.next, typeof(*pos), member))
420 422
421/** 423/**
@@ -426,7 +428,7 @@ static inline void list_splice_tail_init(struct list_head *list,
426 */ 428 */
427#define list_for_each_entry_reverse(pos, head, member) \ 429#define list_for_each_entry_reverse(pos, head, member) \
428 for (pos = list_entry((head)->prev, typeof(*pos), member); \ 430 for (pos = list_entry((head)->prev, typeof(*pos), member); \
429 prefetch(pos->member.prev), &pos->member != (head); \ 431 &pos->member != (head); \
430 pos = list_entry(pos->member.prev, typeof(*pos), member)) 432 pos = list_entry(pos->member.prev, typeof(*pos), member))
431 433
432/** 434/**
@@ -451,7 +453,7 @@ static inline void list_splice_tail_init(struct list_head *list,
451 */ 453 */
452#define list_for_each_entry_continue(pos, head, member) \ 454#define list_for_each_entry_continue(pos, head, member) \
453 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 455 for (pos = list_entry(pos->member.next, typeof(*pos), member); \
454 prefetch(pos->member.next), &pos->member != (head); \ 456 &pos->member != (head); \
455 pos = list_entry(pos->member.next, typeof(*pos), member)) 457 pos = list_entry(pos->member.next, typeof(*pos), member))
456 458
457/** 459/**
@@ -465,7 +467,7 @@ static inline void list_splice_tail_init(struct list_head *list,
465 */ 467 */
466#define list_for_each_entry_continue_reverse(pos, head, member) \ 468#define list_for_each_entry_continue_reverse(pos, head, member) \
467 for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ 469 for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
468 prefetch(pos->member.prev), &pos->member != (head); \ 470 &pos->member != (head); \
469 pos = list_entry(pos->member.prev, typeof(*pos), member)) 471 pos = list_entry(pos->member.prev, typeof(*pos), member))
470 472
471/** 473/**
@@ -477,7 +479,7 @@ static inline void list_splice_tail_init(struct list_head *list,
477 * Iterate over list of given type, continuing from current position. 479 * Iterate over list of given type, continuing from current position.
478 */ 480 */
479#define list_for_each_entry_from(pos, head, member) \ 481#define list_for_each_entry_from(pos, head, member) \
480 for (; prefetch(pos->member.next), &pos->member != (head); \ 482 for (; &pos->member != (head); \
481 pos = list_entry(pos->member.next, typeof(*pos), member)) 483 pos = list_entry(pos->member.next, typeof(*pos), member))
482 484
483/** 485/**
@@ -636,6 +638,12 @@ static inline void hlist_add_after(struct hlist_node *n,
636 next->next->pprev = &next->next; 638 next->next->pprev = &next->next;
637} 639}
638 640
641/* after that we'll appear to be on some hlist and hlist_del will work */
642static inline void hlist_add_fake(struct hlist_node *n)
643{
644 n->pprev = &n->next;
645}
646
639/* 647/*
640 * Move a list from one list head to another. Fixup the pprev 648 * Move a list from one list head to another. Fixup the pprev
641 * reference of the first entry if it exists. 649 * reference of the first entry if it exists.
@@ -652,8 +660,7 @@ static inline void hlist_move_list(struct hlist_head *old,
652#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 660#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
653 661
654#define hlist_for_each(pos, head) \ 662#define hlist_for_each(pos, head) \
655 for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ 663 for (pos = (head)->first; pos ; pos = pos->next)
656 pos = pos->next)
657 664
658#define hlist_for_each_safe(pos, n, head) \ 665#define hlist_for_each_safe(pos, n, head) \
659 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
@@ -668,7 +675,7 @@ static inline void hlist_move_list(struct hlist_head *old,
668 */ 675 */
669#define hlist_for_each_entry(tpos, pos, head, member) \ 676#define hlist_for_each_entry(tpos, pos, head, member) \
670 for (pos = (head)->first; \ 677 for (pos = (head)->first; \
671 pos && ({ prefetch(pos->next); 1;}) && \ 678 pos && \
672 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 679 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
673 pos = pos->next) 680 pos = pos->next)
674 681
@@ -680,7 +687,7 @@ static inline void hlist_move_list(struct hlist_head *old,
680 */ 687 */
681#define hlist_for_each_entry_continue(tpos, pos, member) \ 688#define hlist_for_each_entry_continue(tpos, pos, member) \
682 for (pos = (pos)->next; \ 689 for (pos = (pos)->next; \
683 pos && ({ prefetch(pos->next); 1;}) && \ 690 pos && \
684 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 691 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
685 pos = pos->next) 692 pos = pos->next)
686 693
@@ -691,7 +698,7 @@ static inline void hlist_move_list(struct hlist_head *old,
691 * @member: the name of the hlist_node within the struct. 698 * @member: the name of the hlist_node within the struct.
692 */ 699 */
693#define hlist_for_each_entry_from(tpos, pos, member) \ 700#define hlist_for_each_entry_from(tpos, pos, member) \
694 for (; pos && ({ prefetch(pos->next); 1;}) && \ 701 for (; pos && \
695 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 702 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
696 pos = pos->next) 703 pos = pos->next)
697 704
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
new file mode 100644
index 000000000000..31f9d75adc5b
--- /dev/null
+++ b/include/linux/list_bl.h
@@ -0,0 +1,156 @@
1#ifndef _LINUX_LIST_BL_H
2#define _LINUX_LIST_BL_H
3
4#include <linux/list.h>
5#include <linux/bit_spinlock.h>
6
7/*
8 * Special version of lists, where head of the list has a lock in the lowest
9 * bit. This is useful for scalable hash tables without increasing memory
10 * footprint overhead.
11 *
12 * For modification operations, the 0 bit of hlist_bl_head->first
13 * pointer must be set.
14 *
15 * With some small modifications, this can easily be adapted to store several
16 * arbitrary bits (not just a single lock bit), if the need arises to store
17 * some fast and compact auxiliary data.
18 */
19
20#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
21#define LIST_BL_LOCKMASK 1UL
22#else
23#define LIST_BL_LOCKMASK 0UL
24#endif
25
26#ifdef CONFIG_DEBUG_LIST
27#define LIST_BL_BUG_ON(x) BUG_ON(x)
28#else
29#define LIST_BL_BUG_ON(x)
30#endif
31
32
33struct hlist_bl_head {
34 struct hlist_bl_node *first;
35};
36
37struct hlist_bl_node {
38 struct hlist_bl_node *next, **pprev;
39};
40#define INIT_HLIST_BL_HEAD(ptr) \
41 ((ptr)->first = NULL)
42
43static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
44{
45 h->next = NULL;
46 h->pprev = NULL;
47}
48
49#define hlist_bl_entry(ptr, type, member) container_of(ptr,type,member)
50
51static inline int hlist_bl_unhashed(const struct hlist_bl_node *h)
52{
53 return !h->pprev;
54}
55
56static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
57{
58 return (struct hlist_bl_node *)
59 ((unsigned long)h->first & ~LIST_BL_LOCKMASK);
60}
61
62static inline void hlist_bl_set_first(struct hlist_bl_head *h,
63 struct hlist_bl_node *n)
64{
65 LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
66 LIST_BL_BUG_ON(((unsigned long)h->first & LIST_BL_LOCKMASK) !=
67 LIST_BL_LOCKMASK);
68 h->first = (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK);
69}
70
71static inline int hlist_bl_empty(const struct hlist_bl_head *h)
72{
73 return !((unsigned long)h->first & ~LIST_BL_LOCKMASK);
74}
75
76static inline void hlist_bl_add_head(struct hlist_bl_node *n,
77 struct hlist_bl_head *h)
78{
79 struct hlist_bl_node *first = hlist_bl_first(h);
80
81 n->next = first;
82 if (first)
83 first->pprev = &n->next;
84 n->pprev = &h->first;
85 hlist_bl_set_first(h, n);
86}
87
88static inline void __hlist_bl_del(struct hlist_bl_node *n)
89{
90 struct hlist_bl_node *next = n->next;
91 struct hlist_bl_node **pprev = n->pprev;
92
93 LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
94
95 /* pprev may be `first`, so be careful not to lose the lock bit */
96 *pprev = (struct hlist_bl_node *)
97 ((unsigned long)next |
98 ((unsigned long)*pprev & LIST_BL_LOCKMASK));
99 if (next)
100 next->pprev = pprev;
101}
102
103static inline void hlist_bl_del(struct hlist_bl_node *n)
104{
105 __hlist_bl_del(n);
106 n->next = LIST_POISON1;
107 n->pprev = LIST_POISON2;
108}
109
110static inline void hlist_bl_del_init(struct hlist_bl_node *n)
111{
112 if (!hlist_bl_unhashed(n)) {
113 __hlist_bl_del(n);
114 INIT_HLIST_BL_NODE(n);
115 }
116}
117
118static inline void hlist_bl_lock(struct hlist_bl_head *b)
119{
120 bit_spin_lock(0, (unsigned long *)b);
121}
122
123static inline void hlist_bl_unlock(struct hlist_bl_head *b)
124{
125 __bit_spin_unlock(0, (unsigned long *)b);
126}
127
128/**
129 * hlist_bl_for_each_entry - iterate over list of given type
130 * @tpos: the type * to use as a loop cursor.
131 * @pos: the &struct hlist_node to use as a loop cursor.
132 * @head: the head for your list.
133 * @member: the name of the hlist_node within the struct.
134 *
135 */
136#define hlist_bl_for_each_entry(tpos, pos, head, member) \
137 for (pos = hlist_bl_first(head); \
138 pos && \
139 ({ tpos = hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \
140 pos = pos->next)
141
142/**
143 * hlist_bl_for_each_entry_safe - iterate over list of given type safe against removal of list entry
144 * @tpos: the type * to use as a loop cursor.
145 * @pos: the &struct hlist_node to use as a loop cursor.
146 * @n: another &struct hlist_node to use as temporary storage
147 * @head: the head for your list.
148 * @member: the name of the hlist_node within the struct.
149 */
150#define hlist_bl_for_each_entry_safe(tpos, pos, n, head, member) \
151 for (pos = hlist_bl_first(head); \
152 pos && ({ n = pos->next; 1; }) && \
153 ({ tpos = hlist_bl_entry(pos, typeof(*tpos), member); 1;}); \
154 pos = n)
155
156#endif
diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h
index 34b2b7f33c3b..257d3779f2ab 100644
--- a/include/linux/lockd/debug.h
+++ b/include/linux/lockd/debug.h
@@ -44,14 +44,4 @@
44#define NLMDBG_XDR 0x0100 44#define NLMDBG_XDR 0x0100
45#define NLMDBG_ALL 0x7fff 45#define NLMDBG_ALL 0x7fff
46 46
47
48/*
49 * Support for printing NLM cookies in dprintk()
50 */
51#ifdef RPC_DEBUG
52struct nlm_cookie;
53/* Call this function with the BKL held (it uses a static buffer) */
54extern const char *nlmdbg_cookie2a(const struct nlm_cookie *);
55#endif
56
57#endif /* LINUX_LOCKD_DEBUG_H */ 47#endif /* LINUX_LOCKD_DEBUG_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index a34dea46b629..ff9abff55aa0 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -43,6 +43,7 @@ struct nlm_host {
43 struct sockaddr_storage h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
44 size_t h_addrlen; 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */ 45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
46 size_t h_srcaddrlen;
46 struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */ 47 struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */
47 char *h_name; /* remote hostname */ 48 char *h_name; /* remote hostname */
48 u32 h_version; /* interface version */ 49 u32 h_version; /* interface version */
@@ -201,9 +202,9 @@ extern u32 nsm_local_state;
201 * Lockd client functions 202 * Lockd client functions
202 */ 203 */
203struct nlm_rqst * nlm_alloc_call(struct nlm_host *host); 204struct nlm_rqst * nlm_alloc_call(struct nlm_host *host);
204void nlm_release_call(struct nlm_rqst *);
205int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *); 205int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
206int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *); 206int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
207void nlmclnt_release_call(struct nlm_rqst *);
207struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 208struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
208void nlmclnt_finish_block(struct nlm_wait *block); 209void nlmclnt_finish_block(struct nlm_wait *block);
209int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 210int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
@@ -222,13 +223,14 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
222 const u32 version, 223 const u32 version,
223 const char *hostname, 224 const char *hostname,
224 int noresvport); 225 int noresvport);
226void nlmclnt_release_host(struct nlm_host *);
225struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, 227struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
226 const char *hostname, 228 const char *hostname,
227 const size_t hostname_len); 229 const size_t hostname_len);
230void nlmsvc_release_host(struct nlm_host *);
228struct rpc_clnt * nlm_bind_host(struct nlm_host *); 231struct rpc_clnt * nlm_bind_host(struct nlm_host *);
229void nlm_rebind_host(struct nlm_host *); 232void nlm_rebind_host(struct nlm_host *);
230struct nlm_host * nlm_get_host(struct nlm_host *); 233struct nlm_host * nlm_get_host(struct nlm_host *);
231void nlm_release_host(struct nlm_host *);
232void nlm_shutdown_hosts(void); 234void nlm_shutdown_hosts(void);
233void nlm_host_rebooted(const struct nlm_reboot *); 235void nlm_host_rebooted(const struct nlm_reboot *);
234 236
@@ -266,6 +268,7 @@ unsigned long nlmsvc_retry_blocked(void);
266void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 268void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
267 nlm_host_match_fn_t match); 269 nlm_host_match_fn_t match);
268void nlmsvc_grant_reply(struct nlm_cookie *, __be32); 270void nlmsvc_grant_reply(struct nlm_cookie *, __be32);
271void nlmsvc_release_call(struct nlm_rqst *);
269 272
270/* 273/*
271 * File handling for the server personality 274 * File handling for the server personality
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 71c09b26c759..4aef1dda6406 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -436,16 +436,8 @@ do { \
436#endif /* CONFIG_LOCKDEP */ 436#endif /* CONFIG_LOCKDEP */
437 437
438#ifdef CONFIG_TRACE_IRQFLAGS 438#ifdef CONFIG_TRACE_IRQFLAGS
439extern void early_boot_irqs_off(void);
440extern void early_boot_irqs_on(void);
441extern void print_irqtrace_events(struct task_struct *curr); 439extern void print_irqtrace_events(struct task_struct *curr);
442#else 440#else
443static inline void early_boot_irqs_off(void)
444{
445}
446static inline void early_boot_irqs_on(void)
447{
448}
449static inline void print_irqtrace_events(struct task_struct *curr) 441static inline void print_irqtrace_events(struct task_struct *curr)
450{ 442{
451} 443}
@@ -522,12 +514,15 @@ static inline void print_irqtrace_events(struct task_struct *curr)
522#ifdef CONFIG_DEBUG_LOCK_ALLOC 514#ifdef CONFIG_DEBUG_LOCK_ALLOC
523# ifdef CONFIG_PROVE_LOCKING 515# ifdef CONFIG_PROVE_LOCKING
524# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) 516# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
517# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
525# else 518# else
526# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) 519# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
520# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
527# endif 521# endif
528# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 522# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
529#else 523#else
530# define lock_map_acquire(l) do { } while (0) 524# define lock_map_acquire(l) do { } while (0)
525# define lock_map_acquire_read(l) do { } while (0)
531# define lock_map_release(l) do { } while (0) 526# define lock_map_release(l) do { } while (0)
532#endif 527#endif
533 528
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index 78fbf24f357a..6a4fab7c6e09 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -148,7 +148,7 @@ write intent log information, three of which are mentioned here.
148 * 148 *
149 * DRBD currently (May 2009) only uses 61 elements on the resync lru_cache 149 * DRBD currently (May 2009) only uses 61 elements on the resync lru_cache
150 * (total memory usage 2 pages), and up to 3833 elements on the act_log 150 * (total memory usage 2 pages), and up to 3833 elements on the act_log
151 * lru_cache, totalling ~215 kB for 64bit architechture, ~53 pages. 151 * lru_cache, totalling ~215 kB for 64bit architecture, ~53 pages.
152 * 152 *
153 * We usually do not actually free these objects again, but only "recycle" 153 * We usually do not actually free these objects again, but only "recycle"
154 * them, as the change "index: -old_label, +LC_FREE" would need a transaction 154 * them, as the change "index: -old_label, +LC_FREE" would need a transaction
diff --git a/include/linux/magic.h b/include/linux/magic.h
index eb9800f05782..1e5df2af8d84 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -16,16 +16,19 @@
16#define TMPFS_MAGIC 0x01021994 16#define TMPFS_MAGIC 0x01021994
17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */ 17#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
18#define SQUASHFS_MAGIC 0x73717368 18#define SQUASHFS_MAGIC 0x73717368
19#define ECRYPTFS_SUPER_MAGIC 0xf15f
19#define EFS_SUPER_MAGIC 0x414A53 20#define EFS_SUPER_MAGIC 0x414A53
20#define EXT2_SUPER_MAGIC 0xEF53 21#define EXT2_SUPER_MAGIC 0xEF53
21#define EXT3_SUPER_MAGIC 0xEF53 22#define EXT3_SUPER_MAGIC 0xEF53
22#define XENFS_SUPER_MAGIC 0xabba1974 23#define XENFS_SUPER_MAGIC 0xabba1974
23#define EXT4_SUPER_MAGIC 0xEF53 24#define EXT4_SUPER_MAGIC 0xEF53
24#define BTRFS_SUPER_MAGIC 0x9123683E 25#define BTRFS_SUPER_MAGIC 0x9123683E
26#define NILFS_SUPER_MAGIC 0x3434
25#define HPFS_SUPER_MAGIC 0xf995e849 27#define HPFS_SUPER_MAGIC 0xf995e849
26#define ISOFS_SUPER_MAGIC 0x9660 28#define ISOFS_SUPER_MAGIC 0x9660
27#define JFFS2_SUPER_MAGIC 0x72b6 29#define JFFS2_SUPER_MAGIC 0x72b6
28#define ANON_INODE_FS_MAGIC 0x09041934 30#define ANON_INODE_FS_MAGIC 0x09041934
31#define PSTOREFS_MAGIC 0x6165676C
29 32
30#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 33#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
31#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ 34#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
@@ -57,5 +60,6 @@
57 60
58#define DEVPTS_SUPER_MAGIC 0x1cd1 61#define DEVPTS_SUPER_MAGIC 0x1cd1
59#define SOCKFS_MAGIC 0x534F434B 62#define SOCKFS_MAGIC 0x534F434B
63#define V9FS_MAGIC 0x01021997
60 64
61#endif /* __LINUX_MAGIC_H__ */ 65#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index d0f08018335d..dd3c34ebca9a 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -11,8 +11,9 @@
11#define MARVELL_PHY_ID_88E1118 0x01410e10 11#define MARVELL_PHY_ID_88E1118 0x01410e10
12#define MARVELL_PHY_ID_88E1121R 0x01410cb0 12#define MARVELL_PHY_ID_88E1121R 0x01410cb0
13#define MARVELL_PHY_ID_88E1145 0x01410cd0 13#define MARVELL_PHY_ID_88E1145 0x01410cd0
14#define MARVELL_PHY_ID_88E1149R 0x01410e50
14#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
15#define MARVELL_PHY_ID_88EC048 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
16 17
17/* struct phy_device dev_flags definitions */ 18/* struct phy_device dev_flags definitions */
18#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 19#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/math64.h b/include/linux/math64.h
index c87f1528703a..23fcdfcba81b 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -35,6 +35,14 @@ static inline u64 div64_u64(u64 dividend, u64 divisor)
35 return dividend / divisor; 35 return dividend / divisor;
36} 36}
37 37
38/**
39 * div64_s64 - signed 64bit divide with 64bit divisor
40 */
41static inline s64 div64_s64(s64 dividend, s64 divisor)
42{
43 return dividend / divisor;
44}
45
38#elif BITS_PER_LONG == 32 46#elif BITS_PER_LONG == 32
39 47
40#ifndef div_u64_rem 48#ifndef div_u64_rem
@@ -53,6 +61,10 @@ extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
53extern u64 div64_u64(u64 dividend, u64 divisor); 61extern u64 div64_u64(u64 dividend, u64 divisor);
54#endif 62#endif
55 63
64#ifndef div64_s64
65extern s64 div64_s64(s64 dividend, s64 divisor);
66#endif
67
56#endif /* BITS_PER_LONG */ 68#endif /* BITS_PER_LONG */
57 69
58/** 70/**
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 54cbbac1e71d..5525d370701d 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -18,6 +18,17 @@ struct mb_cache_entry {
18 } e_index; 18 } e_index;
19}; 19};
20 20
21struct mb_cache {
22 struct list_head c_cache_list;
23 const char *c_name;
24 atomic_t c_entry_count;
25 int c_max_entries;
26 int c_bucket_bits;
27 struct kmem_cache *c_entry_cache;
28 struct list_head *c_block_hash;
29 struct list_head *c_index_hash;
30};
31
21/* Functions on caches */ 32/* Functions on caches */
22 33
23struct mb_cache *mb_cache_create(const char *, int); 34struct mb_cache *mb_cache_create(const char *, int);
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index c779b49a1fda..b1494aced217 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -55,6 +55,7 @@
55#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ 55#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
56#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */ 56#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
57#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */ 57#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
58#define MDIO_AN_EEE_ADV 60 /* EEE advertisement */
58 59
59/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */ 60/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
60#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */ 61#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
@@ -235,6 +236,10 @@
235#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */ 236#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
236#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */ 237#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
237 238
239/* AN EEE Advertisement register. */
240#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */
241#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */
242
238/* LASI RX_ALARM control/status registers. */ 243/* LASI RX_ALARM control/status registers. */
239#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */ 244#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
240#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */ 245#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
diff --git a/include/linux/media.h b/include/linux/media.h
new file mode 100644
index 000000000000..0ef883327de2
--- /dev/null
+++ b/include/linux/media.h
@@ -0,0 +1,132 @@
1/*
2 * Multimedia device API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MEDIA_H
24#define __LINUX_MEDIA_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/version.h>
29
30#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
31
32struct media_device_info {
33 char driver[16];
34 char model[32];
35 char serial[40];
36 char bus_info[32];
37 __u32 media_version;
38 __u32 hw_revision;
39 __u32 driver_version;
40 __u32 reserved[31];
41};
42
43#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
44
45#define MEDIA_ENT_TYPE_SHIFT 16
46#define MEDIA_ENT_TYPE_MASK 0x00ff0000
47#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
48
49#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
53#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
54
55#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
59
60#define MEDIA_ENT_FL_DEFAULT (1 << 0)
61
62struct media_entity_desc {
63 __u32 id;
64 char name[32];
65 __u32 type;
66 __u32 revision;
67 __u32 flags;
68 __u32 group_id;
69 __u16 pads;
70 __u16 links;
71
72 __u32 reserved[4];
73
74 union {
75 /* Node specifications */
76 struct {
77 __u32 major;
78 __u32 minor;
79 } v4l;
80 struct {
81 __u32 major;
82 __u32 minor;
83 } fb;
84 struct {
85 __u32 card;
86 __u32 device;
87 __u32 subdevice;
88 } alsa;
89 int dvb;
90
91 /* Sub-device specifications */
92 /* Nothing needed yet */
93 __u8 raw[184];
94 };
95};
96
97#define MEDIA_PAD_FL_SINK (1 << 0)
98#define MEDIA_PAD_FL_SOURCE (1 << 1)
99
100struct media_pad_desc {
101 __u32 entity; /* entity ID */
102 __u16 index; /* pad index */
103 __u32 flags; /* pad flags */
104 __u32 reserved[2];
105};
106
107#define MEDIA_LNK_FL_ENABLED (1 << 0)
108#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
109#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
110
111struct media_link_desc {
112 struct media_pad_desc source;
113 struct media_pad_desc sink;
114 __u32 flags;
115 __u32 reserved[2];
116};
117
118struct media_links_enum {
119 __u32 entity;
120 /* Should have enough room for pads elements */
121 struct media_pad_desc __user *pads;
122 /* Should have enough room for links elements */
123 struct media_link_desc __user *links;
124 __u32 reserved[4];
125};
126
127#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
128#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
129#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
130#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
131
132#endif /* __LINUX_MEDIA_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 159a0762aeaf..5e9840f50980 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -25,6 +25,11 @@ struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28/* Stats that can be updated by kernel. */
29enum mem_cgroup_page_stat_item {
30 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */
31};
32
28extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 33extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
29 struct list_head *dst, 34 struct list_head *dst,
30 unsigned long *scanned, int order, 35 unsigned long *scanned, int order,
@@ -57,6 +62,7 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
57 gfp_t gfp_mask); 62 gfp_t gfp_mask);
58extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 63extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
59extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 64extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
65extern void mem_cgroup_rotate_reclaimable_page(struct page *page);
60extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 66extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
61extern void mem_cgroup_del_lru(struct page *page); 67extern void mem_cgroup_del_lru(struct page *page);
62extern void mem_cgroup_move_lists(struct page *page, 68extern void mem_cgroup_move_lists(struct page *page,
@@ -91,9 +97,9 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
91 97
92extern int 98extern int
93mem_cgroup_prepare_migration(struct page *page, 99mem_cgroup_prepare_migration(struct page *page,
94 struct page *newpage, struct mem_cgroup **ptr); 100 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask);
95extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 101extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
96 struct page *oldpage, struct page *newpage); 102 struct page *oldpage, struct page *newpage, bool migration_ok);
97 103
98/* 104/*
99 * For memory reclaim. 105 * For memory reclaim.
@@ -121,11 +127,34 @@ static inline bool mem_cgroup_disabled(void)
121 return false; 127 return false;
122} 128}
123 129
124void mem_cgroup_update_file_mapped(struct page *page, int val); 130void mem_cgroup_update_page_stat(struct page *page,
131 enum mem_cgroup_page_stat_item idx,
132 int val);
133
134static inline void mem_cgroup_inc_page_stat(struct page *page,
135 enum mem_cgroup_page_stat_item idx)
136{
137 mem_cgroup_update_page_stat(page, idx, 1);
138}
139
140static inline void mem_cgroup_dec_page_stat(struct page *page,
141 enum mem_cgroup_page_stat_item idx)
142{
143 mem_cgroup_update_page_stat(page, idx, -1);
144}
145
125unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 146unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
126 gfp_t gfp_mask); 147 gfp_t gfp_mask);
127u64 mem_cgroup_get_limit(struct mem_cgroup *mem); 148u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
128 149
150#ifdef CONFIG_TRANSPARENT_HUGEPAGE
151void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail);
152#endif
153
154#ifdef CONFIG_DEBUG_VM
155bool mem_cgroup_bad_page_check(struct page *page);
156void mem_cgroup_print_bad_page(struct page *page);
157#endif
129#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
130struct mem_cgroup; 159struct mem_cgroup;
131 160
@@ -187,6 +216,11 @@ static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
187 return ; 216 return ;
188} 217}
189 218
219static inline void mem_cgroup_rotate_reclaimable_page(struct page *page)
220{
221 return ;
222}
223
190static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 224static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
191{ 225{
192 return ; 226 return ;
@@ -225,14 +259,13 @@ static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
225 259
226static inline int 260static inline int
227mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 261mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
228 struct mem_cgroup **ptr) 262 struct mem_cgroup **ptr, gfp_t gfp_mask)
229{ 263{
230 return 0; 264 return 0;
231} 265}
232 266
233static inline void mem_cgroup_end_migration(struct mem_cgroup *mem, 267static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
234 struct page *oldpage, 268 struct page *oldpage, struct page *newpage, bool migration_ok)
235 struct page *newpage)
236{ 269{
237} 270}
238 271
@@ -293,8 +326,13 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
293{ 326{
294} 327}
295 328
296static inline void mem_cgroup_update_file_mapped(struct page *page, 329static inline void mem_cgroup_inc_page_stat(struct page *page,
297 int val) 330 enum mem_cgroup_page_stat_item idx)
331{
332}
333
334static inline void mem_cgroup_dec_page_stat(struct page *page,
335 enum mem_cgroup_page_stat_item idx)
298{ 336{
299} 337}
300 338
@@ -311,7 +349,25 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
311 return 0; 349 return 0;
312} 350}
313 351
352static inline void mem_cgroup_split_huge_fixup(struct page *head,
353 struct page *tail)
354{
355}
356
314#endif /* CONFIG_CGROUP_MEM_CONT */ 357#endif /* CONFIG_CGROUP_MEM_CONT */
315 358
359#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
360static inline bool
361mem_cgroup_bad_page_check(struct page *page)
362{
363 return false;
364}
365
366static inline void
367mem_cgroup_print_bad_page(struct page *page)
368{
369}
370#endif
371
316#endif /* _LINUX_MEMCONTROL_H */ 372#endif /* _LINUX_MEMCONTROL_H */
317 373
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 06c1fa0a5c7b..e1e3b2b84f85 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -21,7 +21,8 @@
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22 22
23struct memory_block { 23struct memory_block {
24 unsigned long phys_index; 24 unsigned long start_section_nr;
25 unsigned long end_section_nr;
25 unsigned long state; 26 unsigned long state;
26 int section_count; 27 int section_count;
27 28
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 864035fb8f8a..8122018d3000 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -13,12 +13,16 @@ struct mem_section;
13#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14 14
15/* 15/*
16 * Types for free bootmem. 16 * Types for free bootmem stored in page->lru.next. These have to be in
17 * The normal smallest mapcount is -1. Here is smaller value than it. 17 * some random range in unsigned long space for debugging purposes.
18 */ 18 */
19#define SECTION_INFO (-1 - 1) 19enum {
20#define MIX_SECTION_INFO (-1 - 2) 20 MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12,
21#define NODE_INFO (-1 - 3) 21 SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
22 MIX_SECTION_INFO,
23 NODE_INFO,
24 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
25};
22 26
23/* 27/*
24 * pgdat resizing functions 28 * pgdat resizing functions
@@ -70,6 +74,10 @@ extern void online_page(struct page *page);
70extern int online_pages(unsigned long, unsigned long); 74extern int online_pages(unsigned long, unsigned long);
71extern void __offline_isolated_pages(unsigned long, unsigned long); 75extern void __offline_isolated_pages(unsigned long, unsigned long);
72 76
77#ifdef CONFIG_MEMORY_HOTREMOVE
78extern bool is_pageblock_removable_nolock(struct page *page);
79#endif /* CONFIG_MEMORY_HOTREMOVE */
80
73/* reasonably generic interface to expand the physical pages in a zone */ 81/* reasonably generic interface to expand the physical pages in a zone */
74extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn, 82extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
75 unsigned long nr_pages); 83 unsigned long nr_pages);
@@ -157,6 +165,15 @@ extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
157extern void put_page_bootmem(struct page *page); 165extern void put_page_bootmem(struct page *page);
158#endif 166#endif
159 167
168/*
169 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug
170 * notifier will be called under this. 2) offline/online/add/remove memory
171 * will not run simultaneously.
172 */
173
174void lock_memory_hotplug(void);
175void unlock_memory_hotplug(void);
176
160#else /* ! CONFIG_MEMORY_HOTPLUG */ 177#else /* ! CONFIG_MEMORY_HOTPLUG */
161/* 178/*
162 * Stub functions for when hotplug is off 179 * Stub functions for when hotplug is off
@@ -188,6 +205,9 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
188{ 205{
189} 206}
190 207
208static inline void lock_memory_hotplug(void) {}
209static inline void unlock_memory_hotplug(void) {}
210
191#endif /* ! CONFIG_MEMORY_HOTPLUG */ 211#endif /* ! CONFIG_MEMORY_HOTPLUG */
192 212
193#ifdef CONFIG_MEMORY_HOTREMOVE 213#ifdef CONFIG_MEMORY_HOTREMOVE
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index bfd23bef7363..8fba7972ff5f 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -131,14 +131,16 @@ enum {
131 PM8607_ID_LDO8, 131 PM8607_ID_LDO8,
132 PM8607_ID_LDO9, 132 PM8607_ID_LDO9,
133 PM8607_ID_LDO10, 133 PM8607_ID_LDO10,
134 PM8607_ID_LDO11,
134 PM8607_ID_LDO12, 135 PM8607_ID_LDO12,
135 PM8607_ID_LDO13, 136 PM8607_ID_LDO13,
136 PM8607_ID_LDO14, 137 PM8607_ID_LDO14,
138 PM8607_ID_LDO15,
137 139
138 PM8607_ID_RG_MAX, 140 PM8607_ID_RG_MAX,
139}; 141};
140 142
141#define PM8607_VERSION (0x40) /* 8607 chip ID */ 143/* 8607 chip ID is 0x40 or 0x50 */
142#define PM8607_VERSION_MASK (0xF0) /* 8607 chip ID mask */ 144#define PM8607_VERSION_MASK (0xF0) /* 8607 chip ID mask */
143 145
144/* Interrupt Registers */ 146/* Interrupt Registers */
@@ -310,8 +312,6 @@ struct pm860x_chip {
310 312
311}; 313};
312 314
313#define PM8607_MAX_REGULATOR PM8607_ID_RG_MAX /* 3 Bucks, 13 LDOs */
314
315enum { 315enum {
316 GI2C_PORT = 0, 316 GI2C_PORT = 0,
317 PI2C_PORT, 317 PI2C_PORT,
@@ -351,23 +351,31 @@ struct pm860x_platform_data {
351 struct pm860x_led_pdata *led; 351 struct pm860x_led_pdata *led;
352 struct pm860x_touch_pdata *touch; 352 struct pm860x_touch_pdata *touch;
353 struct pm860x_power_pdata *power; 353 struct pm860x_power_pdata *power;
354 struct regulator_init_data *regulator;
354 355
355 unsigned short companion_addr; /* I2C address of companion chip */ 356 unsigned short companion_addr; /* I2C address of companion chip */
356 int i2c_port; /* Controlled by GI2C or PI2C */ 357 int i2c_port; /* Controlled by GI2C or PI2C */
357 int irq_mode; /* Clear interrupt by read/write(0/1) */ 358 int irq_mode; /* Clear interrupt by read/write(0/1) */
358 int irq_base; /* IRQ base number of 88pm860x */ 359 int irq_base; /* IRQ base number of 88pm860x */
359 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; 360 int num_leds;
361 int num_backlights;
362 int num_regulators;
360}; 363};
361 364
362extern char pm860x_backlight_name[][MFD_NAME_SIZE];
363extern char pm860x_led_name[][MFD_NAME_SIZE];
364
365extern int pm860x_reg_read(struct i2c_client *, int); 365extern int pm860x_reg_read(struct i2c_client *, int);
366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *); 368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, 369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
370 unsigned char); 370 unsigned char);
371extern int pm860x_page_reg_read(struct i2c_client *, int);
372extern int pm860x_page_reg_write(struct i2c_client *, int, unsigned char);
373extern int pm860x_page_bulk_read(struct i2c_client *, int, int,
374 unsigned char *);
375extern int pm860x_page_bulk_write(struct i2c_client *, int, int,
376 unsigned char *);
377extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char,
378 unsigned char);
371 379
372extern int pm860x_device_init(struct pm860x_chip *chip, 380extern int pm860x_device_init(struct pm860x_chip *chip,
373 struct pm860x_platform_data *pdata) __devinit ; 381 struct pm860x_platform_data *pdata) __devinit ;
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index f5cec4500f38..b31843075198 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -10,6 +10,29 @@
10#include <linux/device.h> 10#include <linux/device.h>
11 11
12/* 12/*
13 * AB8500 bank addresses
14 */
15#define AB8500_SYS_CTRL1_BLOCK 0x1
16#define AB8500_SYS_CTRL2_BLOCK 0x2
17#define AB8500_REGU_CTRL1 0x3
18#define AB8500_REGU_CTRL2 0x4
19#define AB8500_USB 0x5
20#define AB8500_TVOUT 0x6
21#define AB8500_DBI 0x7
22#define AB8500_ECI_AV_ACC 0x8
23#define AB8500_RESERVED 0x9
24#define AB8500_GPADC 0xA
25#define AB8500_CHARGER 0xB
26#define AB8500_GAS_GAUGE 0xC
27#define AB8500_AUDIO 0xD
28#define AB8500_INTERRUPT 0xE
29#define AB8500_RTC 0xF
30#define AB8500_MISC 0x10
31#define AB8500_DEBUG 0x12
32#define AB8500_PROD_TEST 0x13
33#define AB8500_OTP_EMUL 0x15
34
35/*
13 * Interrupts 36 * Interrupts
14 */ 37 */
15 38
@@ -51,40 +74,84 @@
51#define AB8500_INT_ACC_DETECT_21DB_F 37 74#define AB8500_INT_ACC_DETECT_21DB_F 37
52#define AB8500_INT_ACC_DETECT_21DB_R 38 75#define AB8500_INT_ACC_DETECT_21DB_R 38
53#define AB8500_INT_GP_SW_ADC_CONV_END 39 76#define AB8500_INT_GP_SW_ADC_CONV_END 39
54#define AB8500_INT_BTEMP_LOW 72 77#define AB8500_INT_ACC_DETECT_1DB_F 33
55#define AB8500_INT_BTEMP_LOW_MEDIUM 73 78#define AB8500_INT_ACC_DETECT_1DB_R 34
56#define AB8500_INT_BTEMP_MEDIUM_HIGH 74 79#define AB8500_INT_ACC_DETECT_22DB_F 35
57#define AB8500_INT_BTEMP_HIGH 75 80#define AB8500_INT_ACC_DETECT_22DB_R 36
58#define AB8500_INT_USB_CHARGER_NOT_OK 81 81#define AB8500_INT_ACC_DETECT_21DB_F 37
59#define AB8500_INT_ID_WAKEUP_R 82 82#define AB8500_INT_ACC_DETECT_21DB_R 38
60#define AB8500_INT_ID_DET_R1R 84 83#define AB8500_INT_GP_SW_ADC_CONV_END 39
61#define AB8500_INT_ID_DET_R2R 85 84#define AB8500_INT_GPIO6R 40
62#define AB8500_INT_ID_DET_R3R 86 85#define AB8500_INT_GPIO7R 41
63#define AB8500_INT_ID_DET_R4R 87 86#define AB8500_INT_GPIO8R 42
64#define AB8500_INT_ID_WAKEUP_F 88 87#define AB8500_INT_GPIO9R 43
65#define AB8500_INT_ID_DET_R1F 90 88#define AB8500_INT_GPIO10R 44
66#define AB8500_INT_ID_DET_R2F 91 89#define AB8500_INT_GPIO11R 45
67#define AB8500_INT_ID_DET_R3F 92 90#define AB8500_INT_GPIO12R 46
68#define AB8500_INT_ID_DET_R4F 93 91#define AB8500_INT_GPIO13R 47
69#define AB8500_INT_USB_CHG_DET_DONE 94 92#define AB8500_INT_GPIO24R 48
70#define AB8500_INT_USB_CH_TH_PROT_F 96 93#define AB8500_INT_GPIO25R 49
71#define AB8500_INT_USB_CH_TH_PROP_R 97 94#define AB8500_INT_GPIO36R 50
72#define AB8500_INT_MAIN_CH_TH_PROP_F 98 95#define AB8500_INT_GPIO37R 51
73#define AB8500_INT_MAIN_CH_TH_PROT_R 99 96#define AB8500_INT_GPIO38R 52
74#define AB8500_INT_USB_CHARGER_NOT_OKF 103 97#define AB8500_INT_GPIO39R 53
75 98#define AB8500_INT_GPIO40R 54
76#define AB8500_NR_IRQS 104 99#define AB8500_INT_GPIO41R 55
77#define AB8500_NUM_IRQ_REGS 13 100#define AB8500_INT_GPIO6F 56
101#define AB8500_INT_GPIO7F 57
102#define AB8500_INT_GPIO8F 58
103#define AB8500_INT_GPIO9F 59
104#define AB8500_INT_GPIO10F 60
105#define AB8500_INT_GPIO11F 61
106#define AB8500_INT_GPIO12F 62
107#define AB8500_INT_GPIO13F 63
108#define AB8500_INT_GPIO24F 64
109#define AB8500_INT_GPIO25F 65
110#define AB8500_INT_GPIO36F 66
111#define AB8500_INT_GPIO37F 67
112#define AB8500_INT_GPIO38F 68
113#define AB8500_INT_GPIO39F 69
114#define AB8500_INT_GPIO40F 70
115#define AB8500_INT_GPIO41F 71
116#define AB8500_INT_ADP_SOURCE_ERROR 72
117#define AB8500_INT_ADP_SINK_ERROR 73
118#define AB8500_INT_ADP_PROBE_PLUG 74
119#define AB8500_INT_ADP_PROBE_UNPLUG 75
120#define AB8500_INT_ADP_SENSE_OFF 76
121#define AB8500_INT_USB_PHY_POWER_ERR 78
122#define AB8500_INT_USB_LINK_STATUS 79
123#define AB8500_INT_BTEMP_LOW 80
124#define AB8500_INT_BTEMP_LOW_MEDIUM 81
125#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
126#define AB8500_INT_BTEMP_HIGH 83
127#define AB8500_INT_USB_CHARGER_NOT_OK 89
128#define AB8500_INT_ID_WAKEUP_R 90
129#define AB8500_INT_ID_DET_R1R 92
130#define AB8500_INT_ID_DET_R2R 93
131#define AB8500_INT_ID_DET_R3R 94
132#define AB8500_INT_ID_DET_R4R 95
133#define AB8500_INT_ID_WAKEUP_F 96
134#define AB8500_INT_ID_DET_R1F 98
135#define AB8500_INT_ID_DET_R2F 99
136#define AB8500_INT_ID_DET_R3F 100
137#define AB8500_INT_ID_DET_R4F 101
138#define AB8500_INT_USB_CHG_DET_DONE 102
139#define AB8500_INT_USB_CH_TH_PROT_F 104
140#define AB8500_INT_USB_CH_TH_PROT_R 105
141#define AB8500_INT_MAIN_CH_TH_PROT_F 106
142#define AB8500_INT_MAIN_CH_TH_PROT_R 107
143#define AB8500_INT_USB_CHARGER_NOT_OKF 111
78 144
79#define AB8500_NUM_REGULATORS 15 145#define AB8500_NR_IRQS 112
146#define AB8500_NUM_IRQ_REGS 14
80 147
81/** 148/**
82 * struct ab8500 - ab8500 internal structure 149 * struct ab8500 - ab8500 internal structure
83 * @dev: parent device 150 * @dev: parent device
84 * @lock: read/write operations lock 151 * @lock: read/write operations lock
85 * @irq_lock: genirq bus lock 152 * @irq_lock: genirq bus lock
86 * @revision: chip revision
87 * @irq: irq line 153 * @irq: irq line
154 * @chip_id: chip revision id
88 * @write: register write 155 * @write: register write
89 * @read: register read 156 * @read: register read
90 * @rx_buf: rx buf for SPI 157 * @rx_buf: rx buf for SPI
@@ -96,9 +163,10 @@ struct ab8500 {
96 struct device *dev; 163 struct device *dev;
97 struct mutex lock; 164 struct mutex lock;
98 struct mutex irq_lock; 165 struct mutex irq_lock;
99 int revision; 166
100 int irq_base; 167 int irq_base;
101 int irq; 168 int irq;
169 u8 chip_id;
102 170
103 int (*write) (struct ab8500 *a8500, u16 addr, u8 data); 171 int (*write) (struct ab8500 *a8500, u16 addr, u8 data);
104 int (*read) (struct ab8500 *a8500, u16 addr); 172 int (*read) (struct ab8500 *a8500, u16 addr);
@@ -110,24 +178,29 @@ struct ab8500 {
110 u8 oldmask[AB8500_NUM_IRQ_REGS]; 178 u8 oldmask[AB8500_NUM_IRQ_REGS];
111}; 179};
112 180
181struct regulator_reg_init;
113struct regulator_init_data; 182struct regulator_init_data;
183struct ab8500_gpio_platform_data;
114 184
115/** 185/**
116 * struct ab8500_platform_data - AB8500 platform data 186 * struct ab8500_platform_data - AB8500 platform data
117 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 187 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
118 * @init: board-specific initialization after detection of ab8500 188 * @init: board-specific initialization after detection of ab8500
189 * @num_regulator_reg_init: number of regulator init registers
190 * @regulator_reg_init: regulator init registers
191 * @num_regulator: number of regulators
119 * @regulator: machine-specific constraints for regulators 192 * @regulator: machine-specific constraints for regulators
120 */ 193 */
121struct ab8500_platform_data { 194struct ab8500_platform_data {
122 int irq_base; 195 int irq_base;
123 void (*init) (struct ab8500 *); 196 void (*init) (struct ab8500 *);
124 struct regulator_init_data *regulator[AB8500_NUM_REGULATORS]; 197 int num_regulator_reg_init;
198 struct ab8500_regulator_reg_init *regulator_reg_init;
199 int num_regulator;
200 struct regulator_init_data *regulator;
201 struct ab8500_gpio_platform_data *gpio;
125}; 202};
126 203
127extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data);
128extern int ab8500_read(struct ab8500 *a8500, u16 addr);
129extern int ab8500_set_bits(struct ab8500 *a8500, u16 addr, u8 mask, u8 data);
130
131extern int __devinit ab8500_init(struct ab8500 *ab8500); 204extern int __devinit ab8500_init(struct ab8500 *ab8500);
132extern int __devexit ab8500_exit(struct ab8500 *ab8500); 205extern int __devexit ab8500_exit(struct ab8500 *ab8500);
133 206
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/ab8500/gpadc.h
new file mode 100644
index 000000000000..46b954011f16
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpadc.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2010 ST-Ericsson SA
3 * Licensed under GPLv2.
4 *
5 * Author: Arun R Murthy <arun.murthy@stericsson.com>
6 * Author: Daniel Willerud <daniel.willerud@stericsson.com>
7 */
8
9#ifndef _AB8500_GPADC_H
10#define _AB8500_GPADC_H
11
12/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
13#define BAT_CTRL 0x01
14#define BTEMP_BALL 0x02
15#define MAIN_CHARGER_V 0x03
16#define ACC_DETECT1 0x04
17#define ACC_DETECT2 0x05
18#define ADC_AUX1 0x06
19#define ADC_AUX2 0x07
20#define MAIN_BAT_V 0x08
21#define VBUS_V 0x09
22#define MAIN_CHARGER_C 0x0A
23#define USB_CHARGER_C 0x0B
24#define BK_BAT_V 0x0C
25#define DIE_TEMP 0x0D
26
27struct ab8500_gpadc;
28
29struct ab8500_gpadc *ab8500_gpadc_get(char *name);
30int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input);
31
32#endif /* _AB8500_GPADC_H */
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/ab8500/gpio.h
new file mode 100644
index 000000000000..488a8c920a29
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpio.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright ST-Ericsson 2010.
3 *
4 * Author: Bibek Basu <bibek.basu@stericsson.com>
5 * Licensed under GPLv2.
6 */
7
8#ifndef _AB8500_GPIO_H
9#define _AB8500_GPIO_H
10
11/*
12 * Platform data to register a block: only the initial gpio/irq number.
13 */
14
15struct ab8500_gpio_platform_data {
16 int gpio_base;
17 u32 irq_base;
18 u8 config_reg[7];
19};
20
21#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/ab8500/sysctrl.h
new file mode 100644
index 000000000000..10da0291f8f8
--- /dev/null
+++ b/include/linux/mfd/ab8500/sysctrl.h
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
4 * License terms: GNU General Public License (GPL) version 2
5 */
6#ifndef __AB8500_SYSCTRL_H
7#define __AB8500_SYSCTRL_H
8
9#include <linux/bitops.h>
10
11#ifdef CONFIG_AB8500_CORE
12
13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15
16#else
17
18static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
19{
20 return 0;
21}
22
23static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
24{
25 return 0;
26}
27
28#endif /* CONFIG_AB8500_CORE */
29
30static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
31{
32 return ab8500_sysctrl_write(reg, bits, bits);
33}
34
35static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
36{
37 return ab8500_sysctrl_write(reg, bits, 0);
38}
39
40/* Registers */
41#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101
43#define AB8500_PONKEY1PRESSSTATUS 0x102
44#define AB8500_SYSCLKREQSTATUS 0x142
45#define AB8500_STW4500CTRL1 0x180
46#define AB8500_STW4500CTRL2 0x181
47#define AB8500_STW4500CTRL3 0x200
48#define AB8500_MAINWDOGCTRL 0x201
49#define AB8500_MAINWDOGTIMER 0x202
50#define AB8500_LOWBAT 0x203
51#define AB8500_BATTOK 0x204
52#define AB8500_SYSCLKTIMER 0x205
53#define AB8500_SMPSCLKCTRL 0x206
54#define AB8500_SMPSCLKSEL1 0x207
55#define AB8500_SMPSCLKSEL2 0x208
56#define AB8500_SMPSCLKSEL3 0x209
57#define AB8500_SYSULPCLKCONF 0x20A
58#define AB8500_SYSULPCLKCTRL1 0x20B
59#define AB8500_SYSCLKCTRL 0x20C
60#define AB8500_SYSCLKREQ1VALID 0x20D
61#define AB8500_SYSTEMCTRLSUP 0x20F
62#define AB8500_SYSCLKREQ1RFCLKBUF 0x210
63#define AB8500_SYSCLKREQ2RFCLKBUF 0x211
64#define AB8500_SYSCLKREQ3RFCLKBUF 0x212
65#define AB8500_SYSCLKREQ4RFCLKBUF 0x213
66#define AB8500_SYSCLKREQ5RFCLKBUF 0x214
67#define AB8500_SYSCLKREQ6RFCLKBUF 0x215
68#define AB8500_SYSCLKREQ7RFCLKBUF 0x216
69#define AB8500_SYSCLKREQ8RFCLKBUF 0x217
70#define AB8500_DITHERCLKCTRL 0x220
71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233
74
75/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
77#define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
78#define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
79#define AB8500_TURNONSTATUS_RTCALARM BIT(3)
80#define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
81#define AB8500_TURNONSTATUS_VBUSDET BIT(5)
82#define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
83
84#define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
85#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
86
87#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
88#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
89
90#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
91#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
92#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
93#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
94#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
95#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
96#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
97#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
98
99#define AB8500_STW4500CTRL1_SWOFF BIT(0)
100#define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
101#define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
102
103#define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
104#define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
105#define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
106#define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
107#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
108#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
109#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
110#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
111
112#define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
113#define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
114#define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
115#define AB8500_STW4500CTRL3_THSDENA BIT(3)
116
117#define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
118#define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
119#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
120
121#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
122#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
123
124#define AB8500_LOWBAT_LOWBATENA BIT(0)
125#define AB8500_LOWBAT_LOWBAT_MASK 0x7E
126#define AB8500_LOWBAT_LOWBAT_SHIFT 1
127
128#define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
129#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
130#define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
131#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
132
133#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
134#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
135#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
136#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
137
138#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
139#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
140#define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
141
142#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
143#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
144#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
145#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
146
147#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
148#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
149#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
150#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
151
152#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
153#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
154#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
155#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
156
157#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
158#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
159#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
160#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
161#define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
162#define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
163#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
164#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
165
166#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
167#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
168#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
169#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
170#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
171#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
172#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
173#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
174
175#define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
176#define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
177#define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
178
179#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
180#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
181#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
182
183#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
184#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
185#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
186#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
187#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
188
189#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
190#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
191#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
192
193#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
194#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
195#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
196
197#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
198#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
199#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
200
201#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
202#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
203#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
204
205#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
206#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
207#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
208
209#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
210#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
211#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
212
213#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
214#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
215#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
216
217#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
218#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
219#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
220
221#define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
222#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
223#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
224#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
225#define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
226#define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
227#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
228#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
229
230#define AB8500_SWATCTRL_UPDATERF BIT(0)
231#define AB8500_SWATCTRL_SWATENABLE BIT(1)
232#define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
233#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
234#define AB8500_SWATCTRL_SWATBIT5 BIT(6)
235
236#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
237#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
238#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
239#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
240#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
241#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
242#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
243#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
244
245#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
246#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
247#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
248#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
249#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
250#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253
254#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 390726fcbcb1..7d9b6ae1c203 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -6,8 +6,7 @@
6 * 6 *
7 * ABX500 core access functions. 7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab3550, ab5500 and possibly comming. It is not used for 9 * ab3100, ab3550, ab5500, and ab8500.
10 * ab4500 and ab8500 since they are another family of chip.
11 * 10 *
12 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 11 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
13 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -187,7 +186,6 @@ struct abx500_init_settings {
187struct ab3550_platform_data { 186struct ab3550_platform_data {
188 struct {unsigned int base; unsigned int count; } irq; 187 struct {unsigned int base; unsigned int count; } irq;
189 void *dev_data[AB3550_NUM_DEVICES]; 188 void *dev_data[AB3550_NUM_DEVICES];
190 size_t dev_data_sz[AB3550_NUM_DEVICES];
191 struct abx500_init_settings *init_settings; 189 struct abx500_init_settings *init_settings;
192 unsigned int init_settings_sz; 190 unsigned int init_settings_sz;
193}; 191};
@@ -230,4 +228,5 @@ struct abx500_ops {
230}; 228};
231 229
232int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops); 230int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
231void abx500_remove_ops(struct device *dev);
233#endif 232#endif
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 11d740b8831d..aef23309a742 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -25,29 +25,90 @@ struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id; 26 int id;
27 27
28 /* refcounting for multiple drivers to use a single cell */
29 atomic_t *usage_count;
28 int (*enable)(struct platform_device *dev); 30 int (*enable)(struct platform_device *dev);
29 int (*disable)(struct platform_device *dev); 31 int (*disable)(struct platform_device *dev);
32
30 int (*suspend)(struct platform_device *dev); 33 int (*suspend)(struct platform_device *dev);
31 int (*resume)(struct platform_device *dev); 34 int (*resume)(struct platform_device *dev);
32 35
33 /* driver-specific data for MFD-aware "cell" drivers */ 36 /* mfd_data can be used to pass data to client drivers */
34 void *driver_data; 37 void *mfd_data;
35
36 /* platform_data can be used to either pass data to "generic"
37 driver or as a hook to mfd_cell for the "cell" drivers */
38 void *platform_data;
39 size_t data_size;
40 38
41 /* 39 /*
42 * This resources can be specified relatievly to the parent device. 40 * These resources can be specified relative to the parent device.
43 * For accessing device you should use resources from device 41 * For accessing hardware you should use resources from the platform dev
44 */ 42 */
45 int num_resources; 43 int num_resources;
46 const struct resource *resources; 44 const struct resource *resources;
45
46 /* don't check for resource conflicts */
47 bool ignore_resource_conflicts;
48
49 /*
50 * Disable runtime PM callbacks for this subdevice - see
51 * pm_runtime_no_callbacks().
52 */
53 bool pm_runtime_no_callbacks;
47}; 54};
48 55
56/*
57 * Convenience functions for clients using shared cells. Refcounting
58 * happens automatically, with the cell's enable/disable callbacks
59 * being called only when a device is first being enabled or no other
60 * clients are making use of it.
61 */
62extern int mfd_cell_enable(struct platform_device *pdev);
63extern int mfd_cell_disable(struct platform_device *pdev);
64
65/*
66 * "Clone" multiple platform devices for a single cell. This is to be used
67 * for devices that have multiple users of a cell. For example, if an mfd
68 * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver,
69 * and a platform driver, the following bit of code would be use after first
70 * calling mfd_add_devices():
71 *
72 * const char *fclones[] = { "foo-gpio", "foo-mtd" };
73 * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones));
74 *
75 * Each driver (MTD, GPIO, and platform driver) would then register
76 * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively.
77 * The cell's .enable/.disable hooks should be used to deal with hardware
78 * resource contention.
79 */
80extern int mfd_clone_cell(const char *cell, const char **clones,
81 size_t n_clones);
82
83/*
84 * Given a platform device that's been created by mfd_add_devices(), fetch
85 * the mfd_cell that created it.
86 */
87static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
88{
89 return pdev->mfd_cell;
90}
91
92/*
93 * Given a platform device that's been created by mfd_add_devices(), fetch
94 * the .mfd_data entry from the mfd_cell that created it.
95 * Otherwise just return the platform_data pointer.
96 * This maintains compatibility with platform drivers whose devices aren't
97 * created by the mfd layer, and expect platform_data to contain what would've
98 * otherwise been in mfd_data.
99 */
100static inline void *mfd_get_data(struct platform_device *pdev)
101{
102 const struct mfd_cell *cell = mfd_get_cell(pdev);
103
104 if (cell)
105 return cell->mfd_data;
106 else
107 return pdev->dev.platform_data;
108}
109
49extern int mfd_add_devices(struct device *parent, int id, 110extern int mfd_add_devices(struct device *parent, int id,
50 const struct mfd_cell *cells, int n_devs, 111 struct mfd_cell *cells, int n_devs,
51 struct resource *mem_base, 112 struct resource *mem_base,
52 int irq_base); 113 int irq_base);
53 114
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
new file mode 100644
index 000000000000..69d1010e2e51
--- /dev/null
+++ b/include/linux/mfd/max8997-private.h
@@ -0,0 +1,368 @@
1/*
2 * max8997.h - Voltage regulator driver for the Maxim 8997
3 *
4 * Copyright (C) 2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_MAX8997_PRIV_H
23#define __LINUX_MFD_MAX8997_PRIV_H
24
25#include <linux/i2c.h>
26
27#define MAX8997_REG_INVALID (0xff)
28
29enum max8997_pmic_reg {
30 MAX8997_REG_PMIC_ID0 = 0x00,
31 MAX8997_REG_PMIC_ID1 = 0x01,
32 MAX8997_REG_INTSRC = 0x02,
33 MAX8997_REG_INT1 = 0x03,
34 MAX8997_REG_INT2 = 0x04,
35 MAX8997_REG_INT3 = 0x05,
36 MAX8997_REG_INT4 = 0x06,
37
38 MAX8997_REG_INT1MSK = 0x08,
39 MAX8997_REG_INT2MSK = 0x09,
40 MAX8997_REG_INT3MSK = 0x0a,
41 MAX8997_REG_INT4MSK = 0x0b,
42
43 MAX8997_REG_STATUS1 = 0x0d,
44 MAX8997_REG_STATUS2 = 0x0e,
45 MAX8997_REG_STATUS3 = 0x0f,
46 MAX8997_REG_STATUS4 = 0x10,
47
48 MAX8997_REG_MAINCON1 = 0x13,
49 MAX8997_REG_MAINCON2 = 0x14,
50 MAX8997_REG_BUCKRAMP = 0x15,
51
52 MAX8997_REG_BUCK1CTRL = 0x18,
53 MAX8997_REG_BUCK1DVS1 = 0x19,
54 MAX8997_REG_BUCK1DVS2 = 0x1a,
55 MAX8997_REG_BUCK1DVS3 = 0x1b,
56 MAX8997_REG_BUCK1DVS4 = 0x1c,
57 MAX8997_REG_BUCK1DVS5 = 0x1d,
58 MAX8997_REG_BUCK1DVS6 = 0x1e,
59 MAX8997_REG_BUCK1DVS7 = 0x1f,
60 MAX8997_REG_BUCK1DVS8 = 0x20,
61 MAX8997_REG_BUCK2CTRL = 0x21,
62 MAX8997_REG_BUCK2DVS1 = 0x22,
63 MAX8997_REG_BUCK2DVS2 = 0x23,
64 MAX8997_REG_BUCK2DVS3 = 0x24,
65 MAX8997_REG_BUCK2DVS4 = 0x25,
66 MAX8997_REG_BUCK2DVS5 = 0x26,
67 MAX8997_REG_BUCK2DVS6 = 0x27,
68 MAX8997_REG_BUCK2DVS7 = 0x28,
69 MAX8997_REG_BUCK2DVS8 = 0x29,
70 MAX8997_REG_BUCK3CTRL = 0x2a,
71 MAX8997_REG_BUCK3DVS = 0x2b,
72 MAX8997_REG_BUCK4CTRL = 0x2c,
73 MAX8997_REG_BUCK4DVS = 0x2d,
74 MAX8997_REG_BUCK5CTRL = 0x2e,
75 MAX8997_REG_BUCK5DVS1 = 0x2f,
76 MAX8997_REG_BUCK5DVS2 = 0x30,
77 MAX8997_REG_BUCK5DVS3 = 0x31,
78 MAX8997_REG_BUCK5DVS4 = 0x32,
79 MAX8997_REG_BUCK5DVS5 = 0x33,
80 MAX8997_REG_BUCK5DVS6 = 0x34,
81 MAX8997_REG_BUCK5DVS7 = 0x35,
82 MAX8997_REG_BUCK5DVS8 = 0x36,
83 MAX8997_REG_BUCK6CTRL = 0x37,
84 MAX8997_REG_BUCK6BPSKIPCTRL = 0x38,
85 MAX8997_REG_BUCK7CTRL = 0x39,
86 MAX8997_REG_BUCK7DVS = 0x3a,
87 MAX8997_REG_LDO1CTRL = 0x3b,
88 MAX8997_REG_LDO2CTRL = 0x3c,
89 MAX8997_REG_LDO3CTRL = 0x3d,
90 MAX8997_REG_LDO4CTRL = 0x3e,
91 MAX8997_REG_LDO5CTRL = 0x3f,
92 MAX8997_REG_LDO6CTRL = 0x40,
93 MAX8997_REG_LDO7CTRL = 0x41,
94 MAX8997_REG_LDO8CTRL = 0x42,
95 MAX8997_REG_LDO9CTRL = 0x43,
96 MAX8997_REG_LDO10CTRL = 0x44,
97 MAX8997_REG_LDO11CTRL = 0x45,
98 MAX8997_REG_LDO12CTRL = 0x46,
99 MAX8997_REG_LDO13CTRL = 0x47,
100 MAX8997_REG_LDO14CTRL = 0x48,
101 MAX8997_REG_LDO15CTRL = 0x49,
102 MAX8997_REG_LDO16CTRL = 0x4a,
103 MAX8997_REG_LDO17CTRL = 0x4b,
104 MAX8997_REG_LDO18CTRL = 0x4c,
105 MAX8997_REG_LDO21CTRL = 0x4d,
106
107 MAX8997_REG_MBCCTRL1 = 0x50,
108 MAX8997_REG_MBCCTRL2 = 0x51,
109 MAX8997_REG_MBCCTRL3 = 0x52,
110 MAX8997_REG_MBCCTRL4 = 0x53,
111 MAX8997_REG_MBCCTRL5 = 0x54,
112 MAX8997_REG_MBCCTRL6 = 0x55,
113 MAX8997_REG_OTPCGHCVS = 0x56,
114
115 MAX8997_REG_SAFEOUTCTRL = 0x5a,
116
117 MAX8997_REG_LBCNFG1 = 0x5e,
118 MAX8997_REG_LBCNFG2 = 0x5f,
119 MAX8997_REG_BBCCTRL = 0x60,
120
121 MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */
122 MAX8997_REG_FLASH2_CUR = 0x64,
123 MAX8997_REG_MOVIE_CUR = 0x65,
124 MAX8997_REG_GSMB_CUR = 0x66,
125 MAX8997_REG_BOOST_CNTL = 0x67,
126 MAX8997_REG_LEN_CNTL = 0x68,
127 MAX8997_REG_FLASH_CNTL = 0x69,
128 MAX8997_REG_WDT_CNTL = 0x6a,
129 MAX8997_REG_MAXFLASH1 = 0x6b,
130 MAX8997_REG_MAXFLASH2 = 0x6c,
131 MAX8997_REG_FLASHSTATUS = 0x6d,
132 MAX8997_REG_FLASHSTATUSMASK = 0x6e,
133
134 MAX8997_REG_GPIOCNTL1 = 0x70,
135 MAX8997_REG_GPIOCNTL2 = 0x71,
136 MAX8997_REG_GPIOCNTL3 = 0x72,
137 MAX8997_REG_GPIOCNTL4 = 0x73,
138 MAX8997_REG_GPIOCNTL5 = 0x74,
139 MAX8997_REG_GPIOCNTL6 = 0x75,
140 MAX8997_REG_GPIOCNTL7 = 0x76,
141 MAX8997_REG_GPIOCNTL8 = 0x77,
142 MAX8997_REG_GPIOCNTL9 = 0x78,
143 MAX8997_REG_GPIOCNTL10 = 0x79,
144 MAX8997_REG_GPIOCNTL11 = 0x7a,
145 MAX8997_REG_GPIOCNTL12 = 0x7b,
146
147 MAX8997_REG_LDO1CONFIG = 0x80,
148 MAX8997_REG_LDO2CONFIG = 0x81,
149 MAX8997_REG_LDO3CONFIG = 0x82,
150 MAX8997_REG_LDO4CONFIG = 0x83,
151 MAX8997_REG_LDO5CONFIG = 0x84,
152 MAX8997_REG_LDO6CONFIG = 0x85,
153 MAX8997_REG_LDO7CONFIG = 0x86,
154 MAX8997_REG_LDO8CONFIG = 0x87,
155 MAX8997_REG_LDO9CONFIG = 0x88,
156 MAX8997_REG_LDO10CONFIG = 0x89,
157 MAX8997_REG_LDO11CONFIG = 0x8a,
158 MAX8997_REG_LDO12CONFIG = 0x8b,
159 MAX8997_REG_LDO13CONFIG = 0x8c,
160 MAX8997_REG_LDO14CONFIG = 0x8d,
161 MAX8997_REG_LDO15CONFIG = 0x8e,
162 MAX8997_REG_LDO16CONFIG = 0x8f,
163 MAX8997_REG_LDO17CONFIG = 0x90,
164 MAX8997_REG_LDO18CONFIG = 0x91,
165 MAX8997_REG_LDO21CONFIG = 0x92,
166
167 MAX8997_REG_DVSOKTIMER1 = 0x97,
168 MAX8997_REG_DVSOKTIMER2 = 0x98,
169 MAX8997_REG_DVSOKTIMER4 = 0x99,
170 MAX8997_REG_DVSOKTIMER5 = 0x9a,
171
172 MAX8997_REG_PMIC_END = 0x9b,
173};
174
175enum max8997_muic_reg {
176 MAX8997_MUIC_REG_ID = 0x0,
177 MAX8997_MUIC_REG_INT1 = 0x1,
178 MAX8997_MUIC_REG_INT2 = 0x2,
179 MAX8997_MUIC_REG_INT3 = 0x3,
180 MAX8997_MUIC_REG_STATUS1 = 0x4,
181 MAX8997_MUIC_REG_STATUS2 = 0x5,
182 MAX8997_MUIC_REG_STATUS3 = 0x6,
183 MAX8997_MUIC_REG_INTMASK1 = 0x7,
184 MAX8997_MUIC_REG_INTMASK2 = 0x8,
185 MAX8997_MUIC_REG_INTMASK3 = 0x9,
186 MAX8997_MUIC_REG_CDETCTRL = 0xa,
187
188 MAX8997_MUIC_REG_CONTROL1 = 0xc,
189 MAX8997_MUIC_REG_CONTROL2 = 0xd,
190 MAX8997_MUIC_REG_CONTROL3 = 0xe,
191
192 MAX8997_MUIC_REG_END = 0xf,
193};
194
195enum max8997_haptic_reg {
196 MAX8997_HAPTIC_REG_GENERAL = 0x00,
197 MAX8997_HAPTIC_REG_CONF1 = 0x01,
198 MAX8997_HAPTIC_REG_CONF2 = 0x02,
199 MAX8997_HAPTIC_REG_DRVCONF = 0x03,
200 MAX8997_HAPTIC_REG_CYCLECONF1 = 0x04,
201 MAX8997_HAPTIC_REG_CYCLECONF2 = 0x05,
202 MAX8997_HAPTIC_REG_SIGCONF1 = 0x06,
203 MAX8997_HAPTIC_REG_SIGCONF2 = 0x07,
204 MAX8997_HAPTIC_REG_SIGCONF3 = 0x08,
205 MAX8997_HAPTIC_REG_SIGCONF4 = 0x09,
206 MAX8997_HAPTIC_REG_SIGDC1 = 0x0a,
207 MAX8997_HAPTIC_REG_SIGDC2 = 0x0b,
208 MAX8997_HAPTIC_REG_SIGPWMDC1 = 0x0c,
209 MAX8997_HAPTIC_REG_SIGPWMDC2 = 0x0d,
210 MAX8997_HAPTIC_REG_SIGPWMDC3 = 0x0e,
211 MAX8997_HAPTIC_REG_SIGPWMDC4 = 0x0f,
212 MAX8997_HAPTIC_REG_MTR_REV = 0x10,
213
214 MAX8997_HAPTIC_REG_END = 0x11,
215};
216
217/* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
218enum max8997_rtc_reg {
219 MAX8997_RTC_CTRLMASK = 0x02,
220 MAX8997_RTC_CTRL = 0x03,
221 MAX8997_RTC_UPDATE1 = 0x04,
222 MAX8997_RTC_UPDATE2 = 0x05,
223 MAX8997_RTC_WTSR_SMPL = 0x06,
224
225 MAX8997_RTC_SEC = 0x10,
226 MAX8997_RTC_MIN = 0x11,
227 MAX8997_RTC_HOUR = 0x12,
228 MAX8997_RTC_DAY_OF_WEEK = 0x13,
229 MAX8997_RTC_MONTH = 0x14,
230 MAX8997_RTC_YEAR = 0x15,
231 MAX8997_RTC_DAY_OF_MONTH = 0x16,
232 MAX8997_RTC_ALARM1_SEC = 0x17,
233 MAX8997_RTC_ALARM1_MIN = 0x18,
234 MAX8997_RTC_ALARM1_HOUR = 0x19,
235 MAX8997_RTC_ALARM1_DAY_OF_WEEK = 0x1a,
236 MAX8997_RTC_ALARM1_MONTH = 0x1b,
237 MAX8997_RTC_ALARM1_YEAR = 0x1c,
238 MAX8997_RTC_ALARM1_DAY_OF_MONTH = 0x1d,
239 MAX8997_RTC_ALARM2_SEC = 0x1e,
240 MAX8997_RTC_ALARM2_MIN = 0x1f,
241 MAX8997_RTC_ALARM2_HOUR = 0x20,
242 MAX8997_RTC_ALARM2_DAY_OF_WEEK = 0x21,
243 MAX8997_RTC_ALARM2_MONTH = 0x22,
244 MAX8997_RTC_ALARM2_YEAR = 0x23,
245 MAX8997_RTC_ALARM2_DAY_OF_MONTH = 0x24,
246};
247
248enum max8997_irq_source {
249 PMIC_INT1 = 0,
250 PMIC_INT2,
251 PMIC_INT3,
252 PMIC_INT4,
253
254 FUEL_GAUGE, /* Ignored (MAX17042 driver handles) */
255
256 MUIC_INT1,
257 MUIC_INT2,
258 MUIC_INT3,
259
260 GPIO_LOW, /* Not implemented */
261 GPIO_HI, /* Not implemented */
262
263 FLASH_STATUS, /* Not implemented */
264
265 MAX8997_IRQ_GROUP_NR,
266};
267
268enum max8997_irq {
269 MAX8997_PMICIRQ_PWRONR,
270 MAX8997_PMICIRQ_PWRONF,
271 MAX8997_PMICIRQ_PWRON1SEC,
272 MAX8997_PMICIRQ_JIGONR,
273 MAX8997_PMICIRQ_JIGONF,
274 MAX8997_PMICIRQ_LOWBAT2,
275 MAX8997_PMICIRQ_LOWBAT1,
276
277 MAX8997_PMICIRQ_JIGR,
278 MAX8997_PMICIRQ_JIGF,
279 MAX8997_PMICIRQ_MR,
280 MAX8997_PMICIRQ_DVS1OK,
281 MAX8997_PMICIRQ_DVS2OK,
282 MAX8997_PMICIRQ_DVS3OK,
283 MAX8997_PMICIRQ_DVS4OK,
284
285 MAX8997_PMICIRQ_CHGINS,
286 MAX8997_PMICIRQ_CHGRM,
287 MAX8997_PMICIRQ_DCINOVP,
288 MAX8997_PMICIRQ_TOPOFFR,
289 MAX8997_PMICIRQ_CHGRSTF,
290 MAX8997_PMICIRQ_MBCHGTMEXPD,
291
292 MAX8997_PMICIRQ_RTC60S,
293 MAX8997_PMICIRQ_RTCA1,
294 MAX8997_PMICIRQ_RTCA2,
295 MAX8997_PMICIRQ_SMPL_INT,
296 MAX8997_PMICIRQ_RTC1S,
297 MAX8997_PMICIRQ_WTSR,
298
299 MAX8997_MUICIRQ_ADCError,
300 MAX8997_MUICIRQ_ADCLow,
301 MAX8997_MUICIRQ_ADC,
302
303 MAX8997_MUICIRQ_VBVolt,
304 MAX8997_MUICIRQ_DBChg,
305 MAX8997_MUICIRQ_DCDTmr,
306 MAX8997_MUICIRQ_ChgDetRun,
307 MAX8997_MUICIRQ_ChgTyp,
308
309 MAX8997_MUICIRQ_OVP,
310
311 MAX8997_IRQ_NR,
312};
313
314#define MAX8997_REG_BUCK1DVS(x) (MAX8997_REG_BUCK1DVS1 + (x) - 1)
315#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1)
316#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1)
317
318#define MAX8997_NUM_GPIO 12
319struct max8997_dev {
320 struct device *dev;
321 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
322 struct i2c_client *rtc; /* slave addr 0x0c */
323 struct i2c_client *haptic; /* slave addr 0x90 */
324 struct i2c_client *muic; /* slave addr 0x4a */
325 struct mutex iolock;
326
327 int type;
328 struct platform_device *battery; /* battery control (not fuel gauge) */
329
330 int irq;
331 int ono;
332 int irq_base;
333 bool wakeup;
334 struct mutex irqlock;
335 int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
336 int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
337
338 /* For hibernation */
339 u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END +
340 MAX8997_HAPTIC_REG_END];
341
342 bool gpio_status[MAX8997_NUM_GPIO];
343};
344
345enum max8997_types {
346 TYPE_MAX8997,
347 TYPE_MAX8966,
348};
349
350extern int max8997_irq_init(struct max8997_dev *max8997);
351extern void max8997_irq_exit(struct max8997_dev *max8997);
352extern int max8997_irq_resume(struct max8997_dev *max8997);
353
354extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
355extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
356 u8 *buf);
357extern int max8997_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
358extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
359 u8 *buf);
360extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
361
362#define MAX8997_GPIO_INT_BOTH (0x3 << 4)
363#define MAX8997_GPIO_INT_RISE (0x2 << 4)
364#define MAX8997_GPIO_INT_FALL (0x1 << 4)
365
366#define MAX8997_GPIO_INT_MASK (0x3 << 4)
367#define MAX8997_GPIO_DATA_MASK (0x1 << 2)
368#endif /* __LINUX_MFD_MAX8997_PRIV_H */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
new file mode 100644
index 000000000000..60931d089422
--- /dev/null
+++ b/include/linux/mfd/max8997.h
@@ -0,0 +1,117 @@
1/*
2 * max8997.h - Driver for the Maxim 8997/8966
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * This driver is based on max8998.h
22 *
23 * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
24 * Except Fuel Gauge, every device shares the same I2C bus and included in
25 * this mfd driver. Although the fuel gauge is included in the chip, it is
26 * excluded from the driver because a) it has a different I2C bus from
27 * others and b) it can be enabled simply by using MAX17042 driver.
28 */
29
30#ifndef __LINUX_MFD_MAX8998_H
31#define __LINUX_MFD_MAX8998_H
32
33#include <linux/regulator/consumer.h>
34
35/* MAX8997/8966 regulator IDs */
36enum max8998_regulators {
37 MAX8997_LDO1 = 0,
38 MAX8997_LDO2,
39 MAX8997_LDO3,
40 MAX8997_LDO4,
41 MAX8997_LDO5,
42 MAX8997_LDO6,
43 MAX8997_LDO7,
44 MAX8997_LDO8,
45 MAX8997_LDO9,
46 MAX8997_LDO10,
47 MAX8997_LDO11,
48 MAX8997_LDO12,
49 MAX8997_LDO13,
50 MAX8997_LDO14,
51 MAX8997_LDO15,
52 MAX8997_LDO16,
53 MAX8997_LDO17,
54 MAX8997_LDO18,
55 MAX8997_LDO21,
56 MAX8997_BUCK1,
57 MAX8997_BUCK2,
58 MAX8997_BUCK3,
59 MAX8997_BUCK4,
60 MAX8997_BUCK5,
61 MAX8997_BUCK6,
62 MAX8997_BUCK7,
63 MAX8997_EN32KHZ_AP,
64 MAX8997_EN32KHZ_CP,
65 MAX8997_ENVICHG,
66 MAX8997_ESAFEOUT1,
67 MAX8997_ESAFEOUT2,
68 MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
69 MAX8997_CHARGER, /* charger current, MBCCTRL4 */
70 MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
71
72 MAX8997_REG_MAX,
73};
74
75struct max8997_regulator_data {
76 int id;
77 struct regulator_init_data *initdata;
78};
79
80struct max8997_platform_data {
81 /* IRQ */
82 int irq_base;
83 int ono;
84 int wakeup;
85
86 /* ---- PMIC ---- */
87 struct max8997_regulator_data *regulators;
88 int num_regulators;
89
90 /*
91 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
92 * With buckx_gpiodvs enabled, the buckx cannot be controlled
93 * independently. To control buckx (of 1, 2, and 5) independently,
94 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
95 *
96 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
97 * on buckx will change the voltage of bucky at the same time.
98 *
99 */
100 bool ignore_gpiodvs_side_effect;
101 int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
102 int buck125_default_idx; /* Default value of SET1, 2, 3 */
103 unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
104 bool buck1_gpiodvs;
105 unsigned int buck2_voltage[8];
106 bool buck2_gpiodvs;
107 unsigned int buck5_voltage[8];
108 bool buck5_gpiodvs;
109
110 /* MUIC: Not implemented */
111 /* HAPTIC: Not implemented */
112 /* RTC: Not implemented */
113 /* Flash: Not implemented */
114 /* Charger control: Not implemented */
115};
116
117#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index 6dc75b3e2d33..effa5d3b96ae 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998 2 * max8998.h - Voltage regulator driver for the Maxim 8998
3 * 3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics 4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
@@ -23,6 +23,8 @@
23#ifndef __LINUX_MFD_MAX8998_PRIV_H 23#ifndef __LINUX_MFD_MAX8998_PRIV_H
24#define __LINUX_MFD_MAX8998_PRIV_H 24#define __LINUX_MFD_MAX8998_PRIV_H
25 25
26#define MAX8998_NUM_IRQ_REGS 4
27
26/* MAX 8998 registers */ 28/* MAX 8998 registers */
27enum { 29enum {
28 MAX8998_REG_IRQ1, 30 MAX8998_REG_IRQ1,
@@ -46,12 +48,12 @@ enum {
46 MAX8998_REG_ONOFF2, 48 MAX8998_REG_ONOFF2,
47 MAX8998_REG_ONOFF3, 49 MAX8998_REG_ONOFF3,
48 MAX8998_REG_ONOFF4, 50 MAX8998_REG_ONOFF4,
49 MAX8998_REG_BUCK1_DVSARM1, 51 MAX8998_REG_BUCK1_VOLTAGE1,
50 MAX8998_REG_BUCK1_DVSARM2, 52 MAX8998_REG_BUCK1_VOLTAGE2,
51 MAX8998_REG_BUCK1_DVSARM3, 53 MAX8998_REG_BUCK1_VOLTAGE3,
52 MAX8998_REG_BUCK1_DVSARM4, 54 MAX8998_REG_BUCK1_VOLTAGE4,
53 MAX8998_REG_BUCK2_DVSINT1, 55 MAX8998_REG_BUCK2_VOLTAGE1,
54 MAX8998_REG_BUCK2_DVSINT2, 56 MAX8998_REG_BUCK2_VOLTAGE2,
55 MAX8998_REG_BUCK3, 57 MAX8998_REG_BUCK3,
56 MAX8998_REG_BUCK4, 58 MAX8998_REG_BUCK4,
57 MAX8998_REG_LDO2_LDO3, 59 MAX8998_REG_LDO2_LDO3,
@@ -72,41 +74,104 @@ enum {
72 MAX8998_REG_LBCNFG2, 74 MAX8998_REG_LBCNFG2,
73}; 75};
74 76
77/* IRQ definitions */
78enum {
79 MAX8998_IRQ_DCINF,
80 MAX8998_IRQ_DCINR,
81 MAX8998_IRQ_JIGF,
82 MAX8998_IRQ_JIGR,
83 MAX8998_IRQ_PWRONF,
84 MAX8998_IRQ_PWRONR,
85
86 MAX8998_IRQ_WTSREVNT,
87 MAX8998_IRQ_SMPLEVNT,
88 MAX8998_IRQ_ALARM1,
89 MAX8998_IRQ_ALARM0,
90
91 MAX8998_IRQ_ONKEY1S,
92 MAX8998_IRQ_TOPOFFR,
93 MAX8998_IRQ_DCINOVPR,
94 MAX8998_IRQ_CHGRSTF,
95 MAX8998_IRQ_DONER,
96 MAX8998_IRQ_CHGFAULT,
97
98 MAX8998_IRQ_LOBAT1,
99 MAX8998_IRQ_LOBAT2,
100
101 MAX8998_IRQ_NR,
102};
103
104/* MAX8998 various variants */
105enum {
106 TYPE_MAX8998 = 0, /* Default */
107 TYPE_LP3974, /* National version of MAX8998 */
108 TYPE_LP3979, /* Added AVS */
109};
110
111#define MAX8998_IRQ_DCINF_MASK (1 << 2)
112#define MAX8998_IRQ_DCINR_MASK (1 << 3)
113#define MAX8998_IRQ_JIGF_MASK (1 << 4)
114#define MAX8998_IRQ_JIGR_MASK (1 << 5)
115#define MAX8998_IRQ_PWRONF_MASK (1 << 6)
116#define MAX8998_IRQ_PWRONR_MASK (1 << 7)
117
118#define MAX8998_IRQ_WTSREVNT_MASK (1 << 0)
119#define MAX8998_IRQ_SMPLEVNT_MASK (1 << 1)
120#define MAX8998_IRQ_ALARM1_MASK (1 << 2)
121#define MAX8998_IRQ_ALARM0_MASK (1 << 3)
122
123#define MAX8998_IRQ_ONKEY1S_MASK (1 << 0)
124#define MAX8998_IRQ_TOPOFFR_MASK (1 << 2)
125#define MAX8998_IRQ_DCINOVPR_MASK (1 << 3)
126#define MAX8998_IRQ_CHGRSTF_MASK (1 << 4)
127#define MAX8998_IRQ_DONER_MASK (1 << 5)
128#define MAX8998_IRQ_CHGFAULT_MASK (1 << 7)
129
130#define MAX8998_IRQ_LOBAT1_MASK (1 << 0)
131#define MAX8998_IRQ_LOBAT2_MASK (1 << 1)
132
133#define MAX8998_ENRAMP (1 << 4)
134
75/** 135/**
76 * struct max8998_dev - max8998 master device for sub-drivers 136 * struct max8998_dev - max8998 master device for sub-drivers
77 * @dev: master device of the chip (can be used to access platform data) 137 * @dev: master device of the chip (can be used to access platform data)
78 * @i2c_client: i2c client private data 138 * @i2c: i2c client private data for regulator
79 * @dev_read(): chip register read function 139 * @rtc: i2c client private data for rtc
80 * @dev_write(): chip register write function
81 * @dev_update(): chip register update function
82 * @iolock: mutex for serializing io access 140 * @iolock: mutex for serializing io access
141 * @irqlock: mutex for buslock
142 * @irq_base: base IRQ number for max8998, required for IRQs
143 * @irq: generic IRQ number for max8998
144 * @ono: power onoff IRQ number for max8998
145 * @irq_masks_cur: currently active value
146 * @irq_masks_cache: cached hardware value
147 * @type: indicate which max8998 "variant" is used
83 */ 148 */
84
85struct max8998_dev { 149struct max8998_dev {
86 struct device *dev; 150 struct device *dev;
87 struct i2c_client *i2c_client; 151 struct i2c_client *i2c;
88 int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest); 152 struct i2c_client *rtc;
89 int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val);
90 int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask);
91 struct mutex iolock; 153 struct mutex iolock;
154 struct mutex irqlock;
155
156 int irq_base;
157 int irq;
158 int ono;
159 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
160 u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS];
161 int type;
162 bool wakeup;
92}; 163};
93 164
94static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg, 165int max8998_irq_init(struct max8998_dev *max8998);
95 u8 *value) 166void max8998_irq_exit(struct max8998_dev *max8998);
96{ 167int max8998_irq_resume(struct max8998_dev *max8998);
97 return max8998->dev_read(max8998, reg, value); 168
98} 169extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
99 170extern int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count,
100static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg, 171 u8 *buf);
101 u8 value) 172extern int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
102{ 173extern int max8998_bulk_write(struct i2c_client *i2c, u8 reg, int count,
103 return max8998->dev_write(max8998, reg, value); 174 u8 *buf);
104} 175extern int max8998_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
105
106static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg,
107 u8 value, u8 mask)
108{
109 return max8998->dev_update(max8998, reg, value, mask);
110}
111 176
112#endif /* __LINUX_MFD_MAX8998_PRIV_H */ 177#endif /* __LINUX_MFD_MAX8998_PRIV_H */
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 1d3601a2d853..61daa167b576 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998 2 * max8998.h - Voltage regulator driver for the Maxim 8998
3 * 3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics 4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
@@ -66,13 +66,47 @@ struct max8998_regulator_data {
66 66
67/** 67/**
68 * struct max8998_board - packages regulator init data 68 * struct max8998_board - packages regulator init data
69 * @num_regulators: number of regultors used
70 * @regulators: array of defined regulators 69 * @regulators: array of defined regulators
70 * @num_regulators: number of regultors used
71 * @irq_base: base IRQ number for max8998, required for IRQs
72 * @ono: power onoff IRQ number for max8998
73 * @buck_voltage_lock: Do NOT change the values of the following six
74 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
75 * be other than the preset values.
76 * @buck1_voltage1: BUCK1 DVS mode 1 voltage register
77 * @buck1_voltage2: BUCK1 DVS mode 2 voltage register
78 * @buck1_voltage3: BUCK1 DVS mode 3 voltage register
79 * @buck1_voltage4: BUCK1 DVS mode 4 voltage register
80 * @buck2_voltage1: BUCK2 DVS mode 1 voltage register
81 * @buck2_voltage2: BUCK2 DVS mode 2 voltage register
82 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
83 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
84 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
85 * @buck2_set3: BUCK2 gpio pin to set output voltage
86 * @buck2_default_idx: Default for BUCK2 gpio pin.
87 * @wakeup: Allow to wake up from suspend
88 * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
89 * write before reading it.
71 */ 90 */
72
73struct max8998_platform_data { 91struct max8998_platform_data {
74 int num_regulators;
75 struct max8998_regulator_data *regulators; 92 struct max8998_regulator_data *regulators;
93 int num_regulators;
94 int irq_base;
95 int ono;
96 bool buck_voltage_lock;
97 int buck1_voltage1;
98 int buck1_voltage2;
99 int buck1_voltage3;
100 int buck1_voltage4;
101 int buck2_voltage1;
102 int buck2_voltage2;
103 int buck1_set1;
104 int buck1_set2;
105 int buck1_default_idx;
106 int buck2_set3;
107 int buck2_default_idx;
108 bool wakeup;
109 bool rtc_delay;
76}; 110};
77 111
78#endif /* __LINUX_MFD_MAX8998_H */ 112#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 0fa44fb8dd26..7d0f3d6a0002 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2009 Pengutronix 2 * Copyright 2010 Yong Shen <yong.shen@linaro.org>
3 * Copyright 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify it under 6 * This program is free software; you can redistribute it and/or modify it under
@@ -9,48 +10,83 @@
9#ifndef __LINUX_MFD_MC13783_H 10#ifndef __LINUX_MFD_MC13783_H
10#define __LINUX_MFD_MC13783_H 11#define __LINUX_MFD_MC13783_H
11 12
12#include <linux/interrupt.h> 13#include <linux/mfd/mc13xxx.h>
13 14
14struct mc13783; 15struct mc13783;
15 16
16void mc13783_lock(struct mc13783 *mc13783); 17struct mc13xxx *mc13783_to_mc13xxx(struct mc13783 *mc13783);
17void mc13783_unlock(struct mc13783 *mc13783);
18 18
19int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); 19static inline void mc13783_lock(struct mc13783 *mc13783)
20int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); 20{
21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, 21 mc13xxx_lock(mc13783_to_mc13xxx(mc13783));
22 u32 mask, u32 val); 22}
23
24static inline void mc13783_unlock(struct mc13783 *mc13783)
25{
26 mc13xxx_unlock(mc13783_to_mc13xxx(mc13783));
27}
28
29static inline int mc13783_reg_read(struct mc13783 *mc13783,
30 unsigned int offset, u32 *val)
31{
32 return mc13xxx_reg_read(mc13783_to_mc13xxx(mc13783), offset, val);
33}
34
35static inline int mc13783_reg_write(struct mc13783 *mc13783,
36 unsigned int offset, u32 val)
37{
38 return mc13xxx_reg_write(mc13783_to_mc13xxx(mc13783), offset, val);
39}
40
41static inline int mc13783_reg_rmw(struct mc13783 *mc13783,
42 unsigned int offset, u32 mask, u32 val)
43{
44 return mc13xxx_reg_rmw(mc13783_to_mc13xxx(mc13783), offset, mask, val);
45}
23 46
24int mc13783_get_flags(struct mc13783 *mc13783); 47static inline int mc13783_get_flags(struct mc13783 *mc13783)
48{
49 return mc13xxx_get_flags(mc13783_to_mc13xxx(mc13783));
50}
25 51
26int mc13783_irq_request(struct mc13783 *mc13783, int irq, 52static inline int mc13783_irq_request(struct mc13783 *mc13783, int irq,
27 irq_handler_t handler, const char *name, void *dev); 53 irq_handler_t handler, const char *name, void *dev)
28int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 54{
29 irq_handler_t handler, const char *name, void *dev); 55 return mc13xxx_irq_request(mc13783_to_mc13xxx(mc13783), irq,
30int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); 56 handler, name, dev);
57}
31 58
32int mc13783_irq_mask(struct mc13783 *mc13783, int irq); 59static inline int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
33int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); 60 irq_handler_t handler, const char *name, void *dev)
34int mc13783_irq_status(struct mc13783 *mc13783, int irq, 61{
35 int *enabled, int *pending); 62 return mc13xxx_irq_request_nounmask(mc13783_to_mc13xxx(mc13783), irq,
36int mc13783_irq_ack(struct mc13783 *mc13783, int irq); 63 handler, name, dev);
64}
37 65
38static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; 66static inline int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev)
39static inline int mc13783_mask(struct mc13783 *mc13783, int irq)
40{ 67{
41 return mc13783_irq_mask(mc13783, irq); 68 return mc13xxx_irq_free(mc13783_to_mc13xxx(mc13783), irq, dev);
42} 69}
43 70
44static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated; 71static inline int mc13783_irq_mask(struct mc13783 *mc13783, int irq)
45static inline int mc13783_unmask(struct mc13783 *mc13783, int irq)
46{ 72{
47 return mc13783_irq_unmask(mc13783, irq); 73 return mc13xxx_irq_mask(mc13783_to_mc13xxx(mc13783), irq);
48} 74}
49 75
50static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated; 76static inline int mc13783_irq_unmask(struct mc13783 *mc13783, int irq)
51static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
52{ 77{
53 return mc13783_irq_ack(mc13783, irq); 78 return mc13xxx_irq_unmask(mc13783_to_mc13xxx(mc13783), irq);
79}
80static inline int mc13783_irq_status(struct mc13783 *mc13783, int irq,
81 int *enabled, int *pending)
82{
83 return mc13xxx_irq_status(mc13783_to_mc13xxx(mc13783),
84 irq, enabled, pending);
85}
86
87static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq)
88{
89 return mc13xxx_irq_ack(mc13783_to_mc13xxx(mc13783), irq);
54} 90}
55 91
56#define MC13783_ADC0 43 92#define MC13783_ADC0 43
@@ -66,96 +102,18 @@ static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
66 MC13783_ADC0_TSMOD1 | \ 102 MC13783_ADC0_TSMOD1 | \
67 MC13783_ADC0_TSMOD2) 103 MC13783_ADC0_TSMOD2)
68 104
69struct mc13783_led_platform_data { 105#define mc13783_regulator_init_data mc13xxx_regulator_init_data
70#define MC13783_LED_MD 0 106#define mc13783_regulator_platform_data mc13xxx_regulator_platform_data
71#define MC13783_LED_AD 1 107#define mc13783_led_platform_data mc13xxx_led_platform_data
72#define MC13783_LED_KP 2 108#define mc13783_leds_platform_data mc13xxx_leds_platform_data
73#define MC13783_LED_R1 3 109
74#define MC13783_LED_G1 4 110#define mc13783_platform_data mc13xxx_platform_data
75#define MC13783_LED_B1 5 111#define MC13783_USE_TOUCHSCREEN MC13XXX_USE_TOUCHSCREEN
76#define MC13783_LED_R2 6 112#define MC13783_USE_CODEC MC13XXX_USE_CODEC
77#define MC13783_LED_G2 7 113#define MC13783_USE_ADC MC13XXX_USE_ADC
78#define MC13783_LED_B2 8 114#define MC13783_USE_RTC MC13XXX_USE_RTC
79#define MC13783_LED_R3 9 115#define MC13783_USE_REGULATOR MC13XXX_USE_REGULATOR
80#define MC13783_LED_G3 10 116#define MC13783_USE_LED MC13XXX_USE_LED
81#define MC13783_LED_B3 11
82#define MC13783_LED_MAX MC13783_LED_B3
83 int id;
84 const char *name;
85 const char *default_trigger;
86
87/* Three or two bits current selection depending on the led */
88 char max_current;
89};
90
91struct mc13783_leds_platform_data {
92 int num_leds;
93 struct mc13783_led_platform_data *led;
94
95#define MC13783_LED_TRIODE_MD (1 << 0)
96#define MC13783_LED_TRIODE_AD (1 << 1)
97#define MC13783_LED_TRIODE_KP (1 << 2)
98#define MC13783_LED_BOOST_EN (1 << 3)
99#define MC13783_LED_TC1HALF (1 << 4)
100#define MC13783_LED_SLEWLIMTC (1 << 5)
101#define MC13783_LED_SLEWLIMBL (1 << 6)
102#define MC13783_LED_TRIODE_TC1 (1 << 7)
103#define MC13783_LED_TRIODE_TC2 (1 << 8)
104#define MC13783_LED_TRIODE_TC3 (1 << 9)
105 int flags;
106
107#define MC13783_LED_AB_DISABLED 0
108#define MC13783_LED_AB_MD1 1
109#define MC13783_LED_AB_MD12 2
110#define MC13783_LED_AB_MD123 3
111#define MC13783_LED_AB_MD1234 4
112#define MC13783_LED_AB_MD1234_AD1 5
113#define MC13783_LED_AB_MD1234_AD12 6
114#define MC13783_LED_AB_MD1_AD 7
115 char abmode;
116
117#define MC13783_LED_ABREF_200MV 0
118#define MC13783_LED_ABREF_400MV 1
119#define MC13783_LED_ABREF_600MV 2
120#define MC13783_LED_ABREF_800MV 3
121 char abref;
122
123#define MC13783_LED_PERIOD_10MS 0
124#define MC13783_LED_PERIOD_100MS 1
125#define MC13783_LED_PERIOD_500MS 2
126#define MC13783_LED_PERIOD_2S 3
127 char bl_period;
128 char tc1_period;
129 char tc2_period;
130 char tc3_period;
131};
132
133/* to be cleaned up */
134struct regulator_init_data;
135
136struct mc13783_regulator_init_data {
137 int id;
138 struct regulator_init_data *init_data;
139};
140
141struct mc13783_regulator_platform_data {
142 int num_regulators;
143 struct mc13783_regulator_init_data *regulators;
144};
145
146struct mc13783_platform_data {
147 int num_regulators;
148 struct mc13783_regulator_init_data *regulators;
149 struct mc13783_leds_platform_data *leds;
150
151#define MC13783_USE_TOUCHSCREEN (1 << 0)
152#define MC13783_USE_CODEC (1 << 1)
153#define MC13783_USE_ADC (1 << 2)
154#define MC13783_USE_RTC (1 << 3)
155#define MC13783_USE_REGULATOR (1 << 4)
156#define MC13783_USE_LED (1 << 5)
157 unsigned int flags;
158};
159 117
160#define MC13783_ADC_MODE_TS 1 118#define MC13783_ADC_MODE_TS 1
161#define MC13783_ADC_MODE_SINGLE_CHAN 2 119#define MC13783_ADC_MODE_SINGLE_CHAN 2
@@ -165,80 +123,80 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
165 unsigned int channel, unsigned int *sample); 123 unsigned int channel, unsigned int *sample);
166 124
167 125
168#define MC13783_SW_SW1A 0 126#define MC13783_REG_SW1A 0
169#define MC13783_SW_SW1B 1 127#define MC13783_REG_SW1B 1
170#define MC13783_SW_SW2A 2 128#define MC13783_REG_SW2A 2
171#define MC13783_SW_SW2B 3 129#define MC13783_REG_SW2B 3
172#define MC13783_SW_SW3 4 130#define MC13783_REG_SW3 4
173#define MC13783_SW_PLL 5 131#define MC13783_REG_PLL 5
174#define MC13783_REGU_VAUDIO 6 132#define MC13783_REG_VAUDIO 6
175#define MC13783_REGU_VIOHI 7 133#define MC13783_REG_VIOHI 7
176#define MC13783_REGU_VIOLO 8 134#define MC13783_REG_VIOLO 8
177#define MC13783_REGU_VDIG 9 135#define MC13783_REG_VDIG 9
178#define MC13783_REGU_VGEN 10 136#define MC13783_REG_VGEN 10
179#define MC13783_REGU_VRFDIG 11 137#define MC13783_REG_VRFDIG 11
180#define MC13783_REGU_VRFREF 12 138#define MC13783_REG_VRFREF 12
181#define MC13783_REGU_VRFCP 13 139#define MC13783_REG_VRFCP 13
182#define MC13783_REGU_VSIM 14 140#define MC13783_REG_VSIM 14
183#define MC13783_REGU_VESIM 15 141#define MC13783_REG_VESIM 15
184#define MC13783_REGU_VCAM 16 142#define MC13783_REG_VCAM 16
185#define MC13783_REGU_VRFBG 17 143#define MC13783_REG_VRFBG 17
186#define MC13783_REGU_VVIB 18 144#define MC13783_REG_VVIB 18
187#define MC13783_REGU_VRF1 19 145#define MC13783_REG_VRF1 19
188#define MC13783_REGU_VRF2 20 146#define MC13783_REG_VRF2 20
189#define MC13783_REGU_VMMC1 21 147#define MC13783_REG_VMMC1 21
190#define MC13783_REGU_VMMC2 22 148#define MC13783_REG_VMMC2 22
191#define MC13783_REGU_GPO1 23 149#define MC13783_REG_GPO1 23
192#define MC13783_REGU_GPO2 24 150#define MC13783_REG_GPO2 24
193#define MC13783_REGU_GPO3 25 151#define MC13783_REG_GPO3 25
194#define MC13783_REGU_GPO4 26 152#define MC13783_REG_GPO4 26
195#define MC13783_REGU_V1 27 153#define MC13783_REG_V1 27
196#define MC13783_REGU_V2 28 154#define MC13783_REG_V2 28
197#define MC13783_REGU_V3 29 155#define MC13783_REG_V3 29
198#define MC13783_REGU_V4 30 156#define MC13783_REG_V4 30
199#define MC13783_REGU_PWGT1SPI 31 157#define MC13783_REG_PWGT1SPI 31
200#define MC13783_REGU_PWGT2SPI 32 158#define MC13783_REG_PWGT2SPI 32
201 159
202#define MC13783_IRQ_ADCDONE 0 160#define MC13783_IRQ_ADCDONE MC13XXX_IRQ_ADCDONE
203#define MC13783_IRQ_ADCBISDONE 1 161#define MC13783_IRQ_ADCBISDONE MC13XXX_IRQ_ADCBISDONE
204#define MC13783_IRQ_TS 2 162#define MC13783_IRQ_TS MC13XXX_IRQ_TS
205#define MC13783_IRQ_WHIGH 3 163#define MC13783_IRQ_WHIGH 3
206#define MC13783_IRQ_WLOW 4 164#define MC13783_IRQ_WLOW 4
207#define MC13783_IRQ_CHGDET 6 165#define MC13783_IRQ_CHGDET MC13XXX_IRQ_CHGDET
208#define MC13783_IRQ_CHGOV 7 166#define MC13783_IRQ_CHGOV 7
209#define MC13783_IRQ_CHGREV 8 167#define MC13783_IRQ_CHGREV MC13XXX_IRQ_CHGREV
210#define MC13783_IRQ_CHGSHORT 9 168#define MC13783_IRQ_CHGSHORT MC13XXX_IRQ_CHGSHORT
211#define MC13783_IRQ_CCCV 10 169#define MC13783_IRQ_CCCV MC13XXX_IRQ_CCCV
212#define MC13783_IRQ_CHGCURR 11 170#define MC13783_IRQ_CHGCURR MC13XXX_IRQ_CHGCURR
213#define MC13783_IRQ_BPON 12 171#define MC13783_IRQ_BPON MC13XXX_IRQ_BPON
214#define MC13783_IRQ_LOBATL 13 172#define MC13783_IRQ_LOBATL MC13XXX_IRQ_LOBATL
215#define MC13783_IRQ_LOBATH 14 173#define MC13783_IRQ_LOBATH MC13XXX_IRQ_LOBATH
216#define MC13783_IRQ_UDP 15 174#define MC13783_IRQ_UDP 15
217#define MC13783_IRQ_USB 16 175#define MC13783_IRQ_USB 16
218#define MC13783_IRQ_ID 19 176#define MC13783_IRQ_ID 19
219#define MC13783_IRQ_SE1 21 177#define MC13783_IRQ_SE1 21
220#define MC13783_IRQ_CKDET 22 178#define MC13783_IRQ_CKDET 22
221#define MC13783_IRQ_UDM 23 179#define MC13783_IRQ_UDM 23
222#define MC13783_IRQ_1HZ 24 180#define MC13783_IRQ_1HZ MC13XXX_IRQ_1HZ
223#define MC13783_IRQ_TODA 25 181#define MC13783_IRQ_TODA MC13XXX_IRQ_TODA
224#define MC13783_IRQ_ONOFD1 27 182#define MC13783_IRQ_ONOFD1 27
225#define MC13783_IRQ_ONOFD2 28 183#define MC13783_IRQ_ONOFD2 28
226#define MC13783_IRQ_ONOFD3 29 184#define MC13783_IRQ_ONOFD3 29
227#define MC13783_IRQ_SYSRST 30 185#define MC13783_IRQ_SYSRST MC13XXX_IRQ_SYSRST
228#define MC13783_IRQ_RTCRST 31 186#define MC13783_IRQ_RTCRST MC13XXX_IRQ_RTCRST
229#define MC13783_IRQ_PC 32 187#define MC13783_IRQ_PC MC13XXX_IRQ_PC
230#define MC13783_IRQ_WARM 33 188#define MC13783_IRQ_WARM MC13XXX_IRQ_WARM
231#define MC13783_IRQ_MEMHLD 34 189#define MC13783_IRQ_MEMHLD MC13XXX_IRQ_MEMHLD
232#define MC13783_IRQ_PWRRDY 35 190#define MC13783_IRQ_PWRRDY 35
233#define MC13783_IRQ_THWARNL 36 191#define MC13783_IRQ_THWARNL MC13XXX_IRQ_THWARNL
234#define MC13783_IRQ_THWARNH 37 192#define MC13783_IRQ_THWARNH MC13XXX_IRQ_THWARNH
235#define MC13783_IRQ_CLK 38 193#define MC13783_IRQ_CLK MC13XXX_IRQ_CLK
236#define MC13783_IRQ_SEMAF 39 194#define MC13783_IRQ_SEMAF 39
237#define MC13783_IRQ_MC2B 41 195#define MC13783_IRQ_MC2B 41
238#define MC13783_IRQ_HSDET 42 196#define MC13783_IRQ_HSDET 42
239#define MC13783_IRQ_HSL 43 197#define MC13783_IRQ_HSL 43
240#define MC13783_IRQ_ALSPTH 44 198#define MC13783_IRQ_ALSPTH 44
241#define MC13783_IRQ_AHSSHORT 45 199#define MC13783_IRQ_AHSSHORT 45
242#define MC13783_NUM_IRQ 46 200#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
243 201
244#endif /* __LINUX_MFD_MC13783_H */ 202#endif /* ifndef __LINUX_MFD_MC13783_H */
diff --git a/include/linux/mfd/mc13892.h b/include/linux/mfd/mc13892.h
new file mode 100644
index 000000000000..a00f2bec178c
--- /dev/null
+++ b/include/linux/mfd/mc13892.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright 2010 Yong Shen <yong.shen@linaro.org>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8
9#ifndef __LINUX_MFD_MC13892_H
10#define __LINUX_MFD_MC13892_H
11
12#include <linux/mfd/mc13xxx.h>
13
14#define MC13892_SW1 0
15#define MC13892_SW2 1
16#define MC13892_SW3 2
17#define MC13892_SW4 3
18#define MC13892_SWBST 4
19#define MC13892_VIOHI 5
20#define MC13892_VPLL 6
21#define MC13892_VDIG 7
22#define MC13892_VSD 8
23#define MC13892_VUSB2 9
24#define MC13892_VVIDEO 10
25#define MC13892_VAUDIO 11
26#define MC13892_VCAM 12
27#define MC13892_VGEN1 13
28#define MC13892_VGEN2 14
29#define MC13892_VGEN3 15
30#define MC13892_VUSB 16
31#define MC13892_GPO1 17
32#define MC13892_GPO2 18
33#define MC13892_GPO3 19
34#define MC13892_GPO4 20
35#define MC13892_PWGT1SPI 21
36#define MC13892_PWGT2SPI 22
37#define MC13892_VCOINCELL 23
38
39#endif
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
new file mode 100644
index 000000000000..c064beaaccb7
--- /dev/null
+++ b/include/linux/mfd/mc13xxx.h
@@ -0,0 +1,153 @@
1/*
2 * Copyright 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#ifndef __LINUX_MFD_MC13XXX_H
10#define __LINUX_MFD_MC13XXX_H
11
12#include <linux/interrupt.h>
13
14struct mc13xxx;
15
16void mc13xxx_lock(struct mc13xxx *mc13xxx);
17void mc13xxx_unlock(struct mc13xxx *mc13xxx);
18
19int mc13xxx_reg_read(struct mc13xxx *mc13xxx, unsigned int offset, u32 *val);
20int mc13xxx_reg_write(struct mc13xxx *mc13xxx, unsigned int offset, u32 val);
21int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
22 u32 mask, u32 val);
23
24int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
25
26int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
27 irq_handler_t handler, const char *name, void *dev);
28int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
29 irq_handler_t handler, const char *name, void *dev);
30int mc13xxx_irq_free(struct mc13xxx *mc13xxx, int irq, void *dev);
31
32int mc13xxx_irq_mask(struct mc13xxx *mc13xxx, int irq);
33int mc13xxx_irq_unmask(struct mc13xxx *mc13xxx, int irq);
34int mc13xxx_irq_status(struct mc13xxx *mc13xxx, int irq,
35 int *enabled, int *pending);
36int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
37
38int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
39
40#define MC13XXX_IRQ_ADCDONE 0
41#define MC13XXX_IRQ_ADCBISDONE 1
42#define MC13XXX_IRQ_TS 2
43#define MC13XXX_IRQ_CHGDET 6
44#define MC13XXX_IRQ_CHGREV 8
45#define MC13XXX_IRQ_CHGSHORT 9
46#define MC13XXX_IRQ_CCCV 10
47#define MC13XXX_IRQ_CHGCURR 11
48#define MC13XXX_IRQ_BPON 12
49#define MC13XXX_IRQ_LOBATL 13
50#define MC13XXX_IRQ_LOBATH 14
51#define MC13XXX_IRQ_1HZ 24
52#define MC13XXX_IRQ_TODA 25
53#define MC13XXX_IRQ_SYSRST 30
54#define MC13XXX_IRQ_RTCRST 31
55#define MC13XXX_IRQ_PC 32
56#define MC13XXX_IRQ_WARM 33
57#define MC13XXX_IRQ_MEMHLD 34
58#define MC13XXX_IRQ_THWARNL 36
59#define MC13XXX_IRQ_THWARNH 37
60#define MC13XXX_IRQ_CLK 38
61
62#define MC13XXX_NUM_IRQ 46
63
64struct regulator_init_data;
65
66struct mc13xxx_regulator_init_data {
67 int id;
68 struct regulator_init_data *init_data;
69};
70
71struct mc13xxx_regulator_platform_data {
72 int num_regulators;
73 struct mc13xxx_regulator_init_data *regulators;
74};
75
76struct mc13xxx_led_platform_data {
77#define MC13783_LED_MD 0
78#define MC13783_LED_AD 1
79#define MC13783_LED_KP 2
80#define MC13783_LED_R1 3
81#define MC13783_LED_G1 4
82#define MC13783_LED_B1 5
83#define MC13783_LED_R2 6
84#define MC13783_LED_G2 7
85#define MC13783_LED_B2 8
86#define MC13783_LED_R3 9
87#define MC13783_LED_G3 10
88#define MC13783_LED_B3 11
89#define MC13783_LED_MAX MC13783_LED_B3
90 int id;
91 const char *name;
92 const char *default_trigger;
93
94/* Three or two bits current selection depending on the led */
95 char max_current;
96};
97
98struct mc13xxx_leds_platform_data {
99 int num_leds;
100 struct mc13xxx_led_platform_data *led;
101
102#define MC13783_LED_TRIODE_MD (1 << 0)
103#define MC13783_LED_TRIODE_AD (1 << 1)
104#define MC13783_LED_TRIODE_KP (1 << 2)
105#define MC13783_LED_BOOST_EN (1 << 3)
106#define MC13783_LED_TC1HALF (1 << 4)
107#define MC13783_LED_SLEWLIMTC (1 << 5)
108#define MC13783_LED_SLEWLIMBL (1 << 6)
109#define MC13783_LED_TRIODE_TC1 (1 << 7)
110#define MC13783_LED_TRIODE_TC2 (1 << 8)
111#define MC13783_LED_TRIODE_TC3 (1 << 9)
112 int flags;
113
114#define MC13783_LED_AB_DISABLED 0
115#define MC13783_LED_AB_MD1 1
116#define MC13783_LED_AB_MD12 2
117#define MC13783_LED_AB_MD123 3
118#define MC13783_LED_AB_MD1234 4
119#define MC13783_LED_AB_MD1234_AD1 5
120#define MC13783_LED_AB_MD1234_AD12 6
121#define MC13783_LED_AB_MD1_AD 7
122 char abmode;
123
124#define MC13783_LED_ABREF_200MV 0
125#define MC13783_LED_ABREF_400MV 1
126#define MC13783_LED_ABREF_600MV 2
127#define MC13783_LED_ABREF_800MV 3
128 char abref;
129
130#define MC13783_LED_PERIOD_10MS 0
131#define MC13783_LED_PERIOD_100MS 1
132#define MC13783_LED_PERIOD_500MS 2
133#define MC13783_LED_PERIOD_2S 3
134 char bl_period;
135 char tc1_period;
136 char tc2_period;
137 char tc3_period;
138};
139
140struct mc13xxx_platform_data {
141#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
142#define MC13XXX_USE_CODEC (1 << 1)
143#define MC13XXX_USE_ADC (1 << 2)
144#define MC13XXX_USE_RTC (1 << 3)
145#define MC13XXX_USE_REGULATOR (1 << 4)
146#define MC13XXX_USE_LED (1 << 5)
147 unsigned int flags;
148
149 struct mc13xxx_regulator_platform_data regulators;
150 struct mc13xxx_leds_platform_data *leds;
151};
152
153#endif /* ifndef __LINUX_MFD_MC13XXX_H */
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index ad411a78870c..50d4a047118d 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -227,4 +227,11 @@ static inline struct pcf50633 *dev_to_pcf50633(struct device *dev)
227 return dev_get_drvdata(dev); 227 return dev_get_drvdata(dev);
228} 228}
229 229
230int pcf50633_irq_init(struct pcf50633 *pcf, int irq);
231void pcf50633_irq_free(struct pcf50633 *pcf);
232#ifdef CONFIG_PM
233int pcf50633_irq_suspend(struct pcf50633 *pcf);
234int pcf50633_irq_resume(struct pcf50633 *pcf);
235#endif
236
230#endif 237#endif
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 39ca7588659b..e762c270d8d4 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -112,13 +112,19 @@ struct stmpe_keypad_platform_data {
112 bool no_autorepeat; 112 bool no_autorepeat;
113}; 113};
114 114
115#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
116
115/** 117/**
116 * struct stmpe_gpio_platform_data - STMPE GPIO platform data 118 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
117 * @gpio_base: first gpio number assigned. A maximum of 119 * @gpio_base: first gpio number assigned. A maximum of
118 * %STMPE_NR_GPIOS GPIOs will be allocated. 120 * %STMPE_NR_GPIOS GPIOs will be allocated.
121 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
122 * requestable due to different usage (e.g. touch, keypad)
123 * STMPE_GPIO_NOREQ_* macros can be used here.
119 */ 124 */
120struct stmpe_gpio_platform_data { 125struct stmpe_gpio_platform_data {
121 int gpio_base; 126 int gpio_base;
127 unsigned norequest_mask;
122 void (*setup)(struct stmpe *stmpe, unsigned gpio_base); 128 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
123 void (*remove)(struct stmpe *stmpe, unsigned gpio_base); 129 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
124}; 130};
diff --git a/include/linux/mfd/tc35892.h b/include/linux/mfd/tc35892.h
deleted file mode 100644
index eff3094ca84e..000000000000
--- a/include/linux/mfd/tc35892.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 */
6
7#ifndef __LINUX_MFD_TC35892_H
8#define __LINUX_MFD_TC35892_H
9
10#include <linux/device.h>
11
12#define TC35892_RSTCTRL_IRQRST (1 << 4)
13#define TC35892_RSTCTRL_TIMRST (1 << 3)
14#define TC35892_RSTCTRL_ROTRST (1 << 2)
15#define TC35892_RSTCTRL_KBDRST (1 << 1)
16#define TC35892_RSTCTRL_GPIRST (1 << 0)
17
18#define TC35892_IRQST 0x91
19
20#define TC35892_MANFCODE_MAGIC 0x03
21#define TC35892_MANFCODE 0x80
22#define TC35892_VERSION 0x81
23#define TC35892_IOCFG 0xA7
24
25#define TC35892_CLKMODE 0x88
26#define TC35892_CLKCFG 0x89
27#define TC35892_CLKEN 0x8A
28
29#define TC35892_RSTCTRL 0x82
30#define TC35892_EXTRSTN 0x83
31#define TC35892_RSTINTCLR 0x84
32
33#define TC35892_GPIOIS0 0xC9
34#define TC35892_GPIOIS1 0xCA
35#define TC35892_GPIOIS2 0xCB
36#define TC35892_GPIOIBE0 0xCC
37#define TC35892_GPIOIBE1 0xCD
38#define TC35892_GPIOIBE2 0xCE
39#define TC35892_GPIOIEV0 0xCF
40#define TC35892_GPIOIEV1 0xD0
41#define TC35892_GPIOIEV2 0xD1
42#define TC35892_GPIOIE0 0xD2
43#define TC35892_GPIOIE1 0xD3
44#define TC35892_GPIOIE2 0xD4
45#define TC35892_GPIORIS0 0xD6
46#define TC35892_GPIORIS1 0xD7
47#define TC35892_GPIORIS2 0xD8
48#define TC35892_GPIOMIS0 0xD9
49#define TC35892_GPIOMIS1 0xDA
50#define TC35892_GPIOMIS2 0xDB
51#define TC35892_GPIOIC0 0xDC
52#define TC35892_GPIOIC1 0xDD
53#define TC35892_GPIOIC2 0xDE
54
55#define TC35892_GPIODATA0 0xC0
56#define TC35892_GPIOMASK0 0xc1
57#define TC35892_GPIODATA1 0xC2
58#define TC35892_GPIOMASK1 0xc3
59#define TC35892_GPIODATA2 0xC4
60#define TC35892_GPIOMASK2 0xC5
61
62#define TC35892_GPIODIR0 0xC6
63#define TC35892_GPIODIR1 0xC7
64#define TC35892_GPIODIR2 0xC8
65
66#define TC35892_GPIOSYNC0 0xE6
67#define TC35892_GPIOSYNC1 0xE7
68#define TC35892_GPIOSYNC2 0xE8
69
70#define TC35892_GPIOWAKE0 0xE9
71#define TC35892_GPIOWAKE1 0xEA
72#define TC35892_GPIOWAKE2 0xEB
73
74#define TC35892_GPIOODM0 0xE0
75#define TC35892_GPIOODE0 0xE1
76#define TC35892_GPIOODM1 0xE2
77#define TC35892_GPIOODE1 0xE3
78#define TC35892_GPIOODM2 0xE4
79#define TC35892_GPIOODE2 0xE5
80
81#define TC35892_INT_GPIIRQ 0
82#define TC35892_INT_TI0IRQ 1
83#define TC35892_INT_TI1IRQ 2
84#define TC35892_INT_TI2IRQ 3
85#define TC35892_INT_ROTIRQ 5
86#define TC35892_INT_KBDIRQ 6
87#define TC35892_INT_PORIRQ 7
88
89#define TC35892_NR_INTERNAL_IRQS 8
90#define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x))
91
92struct tc35892 {
93 struct mutex lock;
94 struct device *dev;
95 struct i2c_client *i2c;
96
97 int irq_base;
98 int num_gpio;
99 struct tc35892_platform_data *pdata;
100};
101
102extern int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data);
103extern int tc35892_reg_read(struct tc35892 *tc35892, u8 reg);
104extern int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length,
105 u8 *values);
106extern int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length,
107 const u8 *values);
108extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val);
109
110/**
111 * struct tc35892_gpio_platform_data - TC35892 GPIO platform data
112 * @gpio_base: first gpio number assigned to TC35892. A maximum of
113 * %TC35892_NR_GPIOS GPIOs will be allocated.
114 * @setup: callback for board-specific initialization
115 * @remove: callback for board-specific teardown
116 */
117struct tc35892_gpio_platform_data {
118 int gpio_base;
119 void (*setup)(struct tc35892 *tc35892, unsigned gpio_base);
120 void (*remove)(struct tc35892 *tc35892, unsigned gpio_base);
121};
122
123/**
124 * struct tc35892_platform_data - TC35892 platform data
125 * @irq_base: base IRQ number. %TC35892_NR_IRQS irqs will be used.
126 * @gpio: GPIO-specific platform data
127 */
128struct tc35892_platform_data {
129 int irq_base;
130 struct tc35892_gpio_platform_data *gpio;
131};
132
133#define TC35892_NR_GPIOS 24
134#define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS)
135
136#endif
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
new file mode 100644
index 000000000000..16c76e124f9c
--- /dev/null
+++ b/include/linux/mfd/tc3589x.h
@@ -0,0 +1,195 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 */
6
7#ifndef __LINUX_MFD_TC3589x_H
8#define __LINUX_MFD_TC3589x_H
9
10#include <linux/device.h>
11
12enum tx3589x_block {
13 TC3589x_BLOCK_GPIO = 1 << 0,
14 TC3589x_BLOCK_KEYPAD = 1 << 1,
15};
16
17#define TC3589x_RSTCTRL_IRQRST (1 << 4)
18#define TC3589x_RSTCTRL_TIMRST (1 << 3)
19#define TC3589x_RSTCTRL_ROTRST (1 << 2)
20#define TC3589x_RSTCTRL_KBDRST (1 << 1)
21#define TC3589x_RSTCTRL_GPIRST (1 << 0)
22
23/* Keyboard Configuration Registers */
24#define TC3589x_KBDSETTLE_REG 0x01
25#define TC3589x_KBDBOUNCE 0x02
26#define TC3589x_KBDSIZE 0x03
27#define TC3589x_KBCFG_LSB 0x04
28#define TC3589x_KBCFG_MSB 0x05
29#define TC3589x_KBDIC 0x08
30#define TC3589x_KBDMSK 0x09
31#define TC3589x_EVTCODE_FIFO 0x10
32#define TC3589x_KBDMFS 0x8F
33
34#define TC3589x_IRQST 0x91
35
36#define TC3589x_MANFCODE_MAGIC 0x03
37#define TC3589x_MANFCODE 0x80
38#define TC3589x_VERSION 0x81
39#define TC3589x_IOCFG 0xA7
40
41#define TC3589x_CLKMODE 0x88
42#define TC3589x_CLKCFG 0x89
43#define TC3589x_CLKEN 0x8A
44
45#define TC3589x_RSTCTRL 0x82
46#define TC3589x_EXTRSTN 0x83
47#define TC3589x_RSTINTCLR 0x84
48
49/* Pull up/down configuration registers */
50#define TC3589x_IOCFG 0xA7
51#define TC3589x_IOPULLCFG0_LSB 0xAA
52#define TC3589x_IOPULLCFG0_MSB 0xAB
53#define TC3589x_IOPULLCFG1_LSB 0xAC
54#define TC3589x_IOPULLCFG1_MSB 0xAD
55#define TC3589x_IOPULLCFG2_LSB 0xAE
56
57#define TC3589x_GPIOIS0 0xC9
58#define TC3589x_GPIOIS1 0xCA
59#define TC3589x_GPIOIS2 0xCB
60#define TC3589x_GPIOIBE0 0xCC
61#define TC3589x_GPIOIBE1 0xCD
62#define TC3589x_GPIOIBE2 0xCE
63#define TC3589x_GPIOIEV0 0xCF
64#define TC3589x_GPIOIEV1 0xD0
65#define TC3589x_GPIOIEV2 0xD1
66#define TC3589x_GPIOIE0 0xD2
67#define TC3589x_GPIOIE1 0xD3
68#define TC3589x_GPIOIE2 0xD4
69#define TC3589x_GPIORIS0 0xD6
70#define TC3589x_GPIORIS1 0xD7
71#define TC3589x_GPIORIS2 0xD8
72#define TC3589x_GPIOMIS0 0xD9
73#define TC3589x_GPIOMIS1 0xDA
74#define TC3589x_GPIOMIS2 0xDB
75#define TC3589x_GPIOIC0 0xDC
76#define TC3589x_GPIOIC1 0xDD
77#define TC3589x_GPIOIC2 0xDE
78
79#define TC3589x_GPIODATA0 0xC0
80#define TC3589x_GPIOMASK0 0xc1
81#define TC3589x_GPIODATA1 0xC2
82#define TC3589x_GPIOMASK1 0xc3
83#define TC3589x_GPIODATA2 0xC4
84#define TC3589x_GPIOMASK2 0xC5
85
86#define TC3589x_GPIODIR0 0xC6
87#define TC3589x_GPIODIR1 0xC7
88#define TC3589x_GPIODIR2 0xC8
89
90#define TC3589x_GPIOSYNC0 0xE6
91#define TC3589x_GPIOSYNC1 0xE7
92#define TC3589x_GPIOSYNC2 0xE8
93
94#define TC3589x_GPIOWAKE0 0xE9
95#define TC3589x_GPIOWAKE1 0xEA
96#define TC3589x_GPIOWAKE2 0xEB
97
98#define TC3589x_GPIOODM0 0xE0
99#define TC3589x_GPIOODE0 0xE1
100#define TC3589x_GPIOODM1 0xE2
101#define TC3589x_GPIOODE1 0xE3
102#define TC3589x_GPIOODM2 0xE4
103#define TC3589x_GPIOODE2 0xE5
104
105#define TC3589x_INT_GPIIRQ 0
106#define TC3589x_INT_TI0IRQ 1
107#define TC3589x_INT_TI1IRQ 2
108#define TC3589x_INT_TI2IRQ 3
109#define TC3589x_INT_ROTIRQ 5
110#define TC3589x_INT_KBDIRQ 6
111#define TC3589x_INT_PORIRQ 7
112
113#define TC3589x_NR_INTERNAL_IRQS 8
114#define TC3589x_INT_GPIO(x) (TC3589x_NR_INTERNAL_IRQS + (x))
115
116struct tc3589x {
117 struct mutex lock;
118 struct device *dev;
119 struct i2c_client *i2c;
120
121 int irq_base;
122 int num_gpio;
123 struct tc3589x_platform_data *pdata;
124};
125
126extern int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data);
127extern int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg);
128extern int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length,
129 u8 *values);
130extern int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length,
131 const u8 *values);
132extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
133
134/*
135 * Keypad related platform specific constants
136 * These values may be modified for fine tuning
137 */
138#define TC_KPD_ROWS 0x8
139#define TC_KPD_COLUMNS 0x8
140#define TC_KPD_DEBOUNCE_PERIOD 0xA3
141#define TC_KPD_SETTLE_TIME 0xA3
142
143/**
144 * struct tc35893_platform_data - data structure for platform specific data
145 * @keymap_data: matrix scan code table for keycodes
146 * @krow: mask for available rows, value is 0xFF
147 * @kcol: mask for available columns, value is 0xFF
148 * @debounce_period: platform specific debounce time
149 * @settle_time: platform specific settle down time
150 * @irqtype: type of interrupt, falling or rising edge
151 * @enable_wakeup: specifies if keypad event can wake up system from sleep
152 * @no_autorepeat: flag for auto repetition
153 */
154struct tc3589x_keypad_platform_data {
155 const struct matrix_keymap_data *keymap_data;
156 u8 krow;
157 u8 kcol;
158 u8 debounce_period;
159 u8 settle_time;
160 unsigned long irqtype;
161 bool enable_wakeup;
162 bool no_autorepeat;
163};
164
165/**
166 * struct tc3589x_gpio_platform_data - TC3589x GPIO platform data
167 * @gpio_base: first gpio number assigned to TC3589x. A maximum of
168 * %TC3589x_NR_GPIOS GPIOs will be allocated.
169 * @setup: callback for board-specific initialization
170 * @remove: callback for board-specific teardown
171 */
172struct tc3589x_gpio_platform_data {
173 int gpio_base;
174 void (*setup)(struct tc3589x *tc3589x, unsigned gpio_base);
175 void (*remove)(struct tc3589x *tc3589x, unsigned gpio_base);
176};
177
178/**
179 * struct tc3589x_platform_data - TC3589x platform data
180 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
181 * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used.
182 * @gpio: GPIO-specific platform data
183 * @keypad: keypad-specific platform data
184 */
185struct tc3589x_platform_data {
186 unsigned int block;
187 int irq_base;
188 struct tc3589x_gpio_platform_data *gpio;
189 const struct tc3589x_keypad_platform_data *keypad;
190};
191
192#define TC3589x_NR_GPIOS 24
193#define TC3589x_NR_IRQS TC3589x_INT_GPIO(TC3589x_NR_GPIOS)
194
195#endif
diff --git a/include/linux/mfd/ti_ssp.h b/include/linux/mfd/ti_ssp.h
new file mode 100644
index 000000000000..dbb4b43bd20e
--- /dev/null
+++ b/include/linux/mfd/ti_ssp.h
@@ -0,0 +1,93 @@
1/*
2 * Sequencer Serial Port (SSP) driver for Texas Instruments' SoCs
3 *
4 * Copyright (C) 2010 Texas Instruments Inc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __TI_SSP_H__
22#define __TI_SSP_H__
23
24struct ti_ssp_dev_data {
25 const char *dev_name;
26 void *pdata;
27 size_t pdata_size;
28};
29
30struct ti_ssp_data {
31 unsigned long out_clock;
32 struct ti_ssp_dev_data dev_data[2];
33};
34
35struct ti_ssp_spi_data {
36 unsigned long iosel;
37 int num_cs;
38 void (*select)(int cs);
39};
40
41/*
42 * Sequencer port IO pin configuration bits. These do not correlate 1-1 with
43 * the hardware. The iosel field in the port data combines iosel1 and iosel2,
44 * and is therefore not a direct map to register space. It is best to use the
45 * macros below to construct iosel values.
46 *
47 * least significant 16 bits --> iosel1
48 * most significant 16 bits --> iosel2
49 */
50
51#define SSP_IN 0x0000
52#define SSP_DATA 0x0001
53#define SSP_CLOCK 0x0002
54#define SSP_CHIPSEL 0x0003
55#define SSP_OUT 0x0004
56#define SSP_PIN_SEL(pin, v) ((v) << ((pin) * 3))
57#define SSP_PIN_MASK(pin) SSP_PIN_SEL(pin, 0x7)
58#define SSP_INPUT_SEL(pin) ((pin) << 16)
59
60/* Sequencer port config bits */
61#define SSP_EARLY_DIN BIT(8)
62#define SSP_DELAY_DOUT BIT(9)
63
64/* Sequence map definitions */
65#define SSP_CLK_HIGH BIT(0)
66#define SSP_CLK_LOW 0
67#define SSP_DATA_HIGH BIT(1)
68#define SSP_DATA_LOW 0
69#define SSP_CS_HIGH BIT(2)
70#define SSP_CS_LOW 0
71#define SSP_OUT_MODE BIT(3)
72#define SSP_IN_MODE 0
73#define SSP_DATA_REG BIT(4)
74#define SSP_ADDR_REG 0
75
76#define SSP_OPCODE_DIRECT ((0x0) << 5)
77#define SSP_OPCODE_TOGGLE ((0x1) << 5)
78#define SSP_OPCODE_SHIFT ((0x2) << 5)
79#define SSP_OPCODE_BRANCH0 ((0x4) << 5)
80#define SSP_OPCODE_BRANCH1 ((0x5) << 5)
81#define SSP_OPCODE_BRANCH ((0x6) << 5)
82#define SSP_OPCODE_STOP ((0x7) << 5)
83#define SSP_BRANCH(addr) ((addr) << 8)
84#define SSP_COUNT(cycles) ((cycles) << 8)
85
86int ti_ssp_raw_read(struct device *dev);
87int ti_ssp_raw_write(struct device *dev, u32 val);
88int ti_ssp_load(struct device *dev, int offs, u32* prog, int len);
89int ti_ssp_run(struct device *dev, u32 pc, u32 input, u32 *output);
90int ti_ssp_set_mode(struct device *dev, int mode);
91int ti_ssp_set_iosel(struct device *dev, u32 iosel);
92
93#endif /* __TI_SSP_H__ */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index f07425bc3dcd..8e70310ee945 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -52,6 +52,15 @@
52 52
53/* tmio MMC platform flags */ 53/* tmio MMC platform flags */
54#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0) 54#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)
55/*
56 * Some controllers can support a 2-byte block size when the bus width
57 * is configured in 4-bit mode.
58 */
59#define TMIO_MMC_BLKSZ_2BYTES (1 << 1)
60/*
61 * Some controllers can support SDIO IRQ signalling.
62 */
63#define TMIO_MMC_SDIO_IRQ (1 << 2)
55 64
56int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 65int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
57int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 66int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -61,6 +70,7 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
61struct tmio_mmc_dma { 70struct tmio_mmc_dma {
62 void *chan_priv_tx; 71 void *chan_priv_tx;
63 void *chan_priv_rx; 72 void *chan_priv_rx;
73 int alignment_shift;
64}; 74};
65 75
66/* 76/*
@@ -74,6 +84,7 @@ struct tmio_mmc_data {
74 struct tmio_mmc_dma *dma; 84 struct tmio_mmc_dma *dma;
75 void (*set_pwr)(struct platform_device *host, int state); 85 void (*set_pwr)(struct platform_device *host, int state);
76 void (*set_clk_div)(struct platform_device *host, int state); 86 void (*set_clk_div)(struct platform_device *host, int state);
87 int (*get_cd)(struct platform_device *host);
77}; 88};
78 89
79/* 90/*
diff --git a/include/linux/mfd/tps6105x.h b/include/linux/mfd/tps6105x.h
new file mode 100644
index 000000000000..386743dd931c
--- /dev/null
+++ b/include/linux/mfd/tps6105x.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA
3 * Written on behalf of Linaro for ST-Ericsson
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9#ifndef MFD_TPS6105X_H
10#define MFD_TPS6105X_H
11
12#include <linux/i2c.h>
13#include <linux/regulator/machine.h>
14
15/*
16 * Register definitions to all subdrivers
17 */
18#define TPS6105X_REG_0 0x00
19#define TPS6105X_REG0_MODE_SHIFT 6
20#define TPS6105X_REG0_MODE_MASK (0x03<<6)
21/* These defines for both reg0 and reg1 */
22#define TPS6105X_REG0_MODE_SHUTDOWN 0x00
23#define TPS6105X_REG0_MODE_TORCH 0x01
24#define TPS6105X_REG0_MODE_TORCH_FLASH 0x02
25#define TPS6105X_REG0_MODE_VOLTAGE 0x03
26#define TPS6105X_REG0_VOLTAGE_SHIFT 4
27#define TPS6105X_REG0_VOLTAGE_MASK (3<<4)
28#define TPS6105X_REG0_VOLTAGE_450 0
29#define TPS6105X_REG0_VOLTAGE_500 1
30#define TPS6105X_REG0_VOLTAGE_525 2
31#define TPS6105X_REG0_VOLTAGE_500_2 3
32#define TPS6105X_REG0_DIMMING_SHIFT 3
33#define TPS6105X_REG0_TORCHC_SHIFT 0
34#define TPS6105X_REG0_TORCHC_MASK (7<<0)
35#define TPS6105X_REG0_TORCHC_0 0x00
36#define TPS6105X_REG0_TORCHC_50 0x01
37#define TPS6105X_REG0_TORCHC_75 0x02
38#define TPS6105X_REG0_TORCHC_100 0x03
39#define TPS6105X_REG0_TORCHC_150 0x04
40#define TPS6105X_REG0_TORCHC_200 0x05
41#define TPS6105X_REG0_TORCHC_250_400 0x06
42#define TPS6105X_REG0_TORCHC_250_500 0x07
43#define TPS6105X_REG_1 0x01
44#define TPS6105X_REG1_MODE_SHIFT 6
45#define TPS6105X_REG1_MODE_MASK (0x03<<6)
46#define TPS6105X_REG1_MODE_SHUTDOWN 0x00
47#define TPS6105X_REG1_MODE_TORCH 0x01
48#define TPS6105X_REG1_MODE_TORCH_FLASH 0x02
49#define TPS6105X_REG1_MODE_VOLTAGE 0x03
50#define TPS6105X_REG_2 0x02
51#define TPS6105X_REG_3 0x03
52
53/**
54 * enum tps6105x_mode - desired mode for the TPS6105x
55 * @TPS6105X_MODE_SHUTDOWN: this instance is inactive, not used for anything
56 * @TPS61905X_MODE_TORCH: this instance is used as a LED, usually a while
57 * LED, for example as backlight or flashlight. If this is set, the
58 * TPS6105X will register to the LED framework
59 * @TPS6105X_MODE_TORCH_FLASH: this instance is used as a flashgun, usually
60 * in a camera
61 * @TPS6105X_MODE_VOLTAGE: this instance is used as a voltage regulator and
62 * will register to the regulator framework
63 */
64enum tps6105x_mode {
65 TPS6105X_MODE_SHUTDOWN,
66 TPS6105X_MODE_TORCH,
67 TPS6105X_MODE_TORCH_FLASH,
68 TPS6105X_MODE_VOLTAGE,
69};
70
71/**
72 * struct tps6105x_platform_data - TPS61905x platform data
73 * @mode: what mode this instance shall be operated in,
74 * this is not selectable at runtime
75 * @regulator_data: initialization data for the voltage
76 * regulator if used as a voltage source
77 */
78struct tps6105x_platform_data {
79 enum tps6105x_mode mode;
80 struct regulator_init_data *regulator_data;
81};
82
83/**
84 * struct tps6105x - state holder for the TPS6105x drivers
85 * @mutex: mutex to serialize I2C accesses
86 * @i2c_client: corresponding I2C client
87 * @regulator: regulator device if used in voltage mode
88 */
89struct tps6105x {
90 struct tps6105x_platform_data *pdata;
91 struct mutex lock;
92 struct i2c_client *client;
93 struct regulator_dev *regulator;
94};
95
96extern int tps6105x_set(struct tps6105x *tps6105x, u8 reg, u8 value);
97extern int tps6105x_get(struct tps6105x *tps6105x, u8 reg, u8 *buf);
98extern int tps6105x_mask_and_set(struct tps6105x *tps6105x, u8 reg,
99 u8 bitmask, u8 bitvalues);
100
101#endif
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index 772b3ae640af..b6bab1b04e25 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -18,6 +18,36 @@ enum {
18 TPS6586X_ID_LDO_RTC, 18 TPS6586X_ID_LDO_RTC,
19}; 19};
20 20
21enum {
22 TPS6586X_INT_PLDO_0,
23 TPS6586X_INT_PLDO_1,
24 TPS6586X_INT_PLDO_2,
25 TPS6586X_INT_PLDO_3,
26 TPS6586X_INT_PLDO_4,
27 TPS6586X_INT_PLDO_5,
28 TPS6586X_INT_PLDO_6,
29 TPS6586X_INT_PLDO_7,
30 TPS6586X_INT_COMP_DET,
31 TPS6586X_INT_ADC,
32 TPS6586X_INT_PLDO_8,
33 TPS6586X_INT_PLDO_9,
34 TPS6586X_INT_PSM_0,
35 TPS6586X_INT_PSM_1,
36 TPS6586X_INT_PSM_2,
37 TPS6586X_INT_PSM_3,
38 TPS6586X_INT_RTC_ALM1,
39 TPS6586X_INT_ACUSB_OVP,
40 TPS6586X_INT_USB_DET,
41 TPS6586X_INT_AC_DET,
42 TPS6586X_INT_BAT_DET,
43 TPS6586X_INT_CHG_STAT,
44 TPS6586X_INT_CHG_TEMP,
45 TPS6586X_INT_PP,
46 TPS6586X_INT_RESUME,
47 TPS6586X_INT_LOW_SYS,
48 TPS6586X_INT_RTC_ALM2,
49};
50
21struct tps6586x_subdev_info { 51struct tps6586x_subdev_info {
22 int id; 52 int id;
23 const char *name; 53 const char *name;
@@ -29,6 +59,7 @@ struct tps6586x_platform_data {
29 struct tps6586x_subdev_info *subdevs; 59 struct tps6586x_subdev_info *subdevs;
30 60
31 int gpio_base; 61 int gpio_base;
62 int irq_base;
32}; 63};
33 64
34/* 65/*
diff --git a/include/linux/mfd/wl1273-core.h b/include/linux/mfd/wl1273-core.h
new file mode 100644
index 000000000000..db2f3f454a1b
--- /dev/null
+++ b/include/linux/mfd/wl1273-core.h
@@ -0,0 +1,290 @@
1/*
2 * include/linux/mfd/wl1273-core.h
3 *
4 * Some definitions for the wl1273 radio receiver/transmitter chip.
5 *
6 * Copyright (C) 2010 Nokia Corporation
7 * Author: Matti J. Aaltonen <matti.j.aaltonen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef WL1273_CORE_H
25#define WL1273_CORE_H
26
27#include <linux/i2c.h>
28#include <linux/mfd/core.h>
29
30#define WL1273_FM_DRIVER_NAME "wl1273-fm"
31#define RX71_FM_I2C_ADDR 0x22
32
33#define WL1273_STEREO_GET 0
34#define WL1273_RSSI_LVL_GET 1
35#define WL1273_IF_COUNT_GET 2
36#define WL1273_FLAG_GET 3
37#define WL1273_RDS_SYNC_GET 4
38#define WL1273_RDS_DATA_GET 5
39#define WL1273_FREQ_SET 10
40#define WL1273_AF_FREQ_SET 11
41#define WL1273_MOST_MODE_SET 12
42#define WL1273_MOST_BLEND_SET 13
43#define WL1273_DEMPH_MODE_SET 14
44#define WL1273_SEARCH_LVL_SET 15
45#define WL1273_BAND_SET 16
46#define WL1273_MUTE_STATUS_SET 17
47#define WL1273_RDS_PAUSE_LVL_SET 18
48#define WL1273_RDS_PAUSE_DUR_SET 19
49#define WL1273_RDS_MEM_SET 20
50#define WL1273_RDS_BLK_B_SET 21
51#define WL1273_RDS_MSK_B_SET 22
52#define WL1273_RDS_PI_MASK_SET 23
53#define WL1273_RDS_PI_SET 24
54#define WL1273_RDS_SYSTEM_SET 25
55#define WL1273_INT_MASK_SET 26
56#define WL1273_SEARCH_DIR_SET 27
57#define WL1273_VOLUME_SET 28
58#define WL1273_AUDIO_ENABLE 29
59#define WL1273_PCM_MODE_SET 30
60#define WL1273_I2S_MODE_CONFIG_SET 31
61#define WL1273_POWER_SET 32
62#define WL1273_INTX_CONFIG_SET 33
63#define WL1273_PULL_EN_SET 34
64#define WL1273_HILO_SET 35
65#define WL1273_SWITCH2FREF 36
66#define WL1273_FREQ_DRIFT_REPORT 37
67
68#define WL1273_PCE_GET 40
69#define WL1273_FIRM_VER_GET 41
70#define WL1273_ASIC_VER_GET 42
71#define WL1273_ASIC_ID_GET 43
72#define WL1273_MAN_ID_GET 44
73#define WL1273_TUNER_MODE_SET 45
74#define WL1273_STOP_SEARCH 46
75#define WL1273_RDS_CNTRL_SET 47
76
77#define WL1273_WRITE_HARDWARE_REG 100
78#define WL1273_CODE_DOWNLOAD 101
79#define WL1273_RESET 102
80
81#define WL1273_FM_POWER_MODE 254
82#define WL1273_FM_INTERRUPT 255
83
84/* Transmitter API */
85
86#define WL1273_CHANL_SET 55
87#define WL1273_SCAN_SPACING_SET 56
88#define WL1273_REF_SET 57
89#define WL1273_POWER_ENB_SET 90
90#define WL1273_POWER_ATT_SET 58
91#define WL1273_POWER_LEV_SET 59
92#define WL1273_AUDIO_DEV_SET 60
93#define WL1273_PILOT_DEV_SET 61
94#define WL1273_RDS_DEV_SET 62
95#define WL1273_PUPD_SET 91
96#define WL1273_AUDIO_IO_SET 63
97#define WL1273_PREMPH_SET 64
98#define WL1273_MONO_SET 66
99#define WL1273_MUTE 92
100#define WL1273_MPX_LMT_ENABLE 67
101#define WL1273_PI_SET 93
102#define WL1273_ECC_SET 69
103#define WL1273_PTY 70
104#define WL1273_AF 71
105#define WL1273_DISPLAY_MODE 74
106#define WL1273_RDS_REP_SET 77
107#define WL1273_RDS_CONFIG_DATA_SET 98
108#define WL1273_RDS_DATA_SET 99
109#define WL1273_RDS_DATA_ENB 94
110#define WL1273_TA_SET 78
111#define WL1273_TP_SET 79
112#define WL1273_DI_SET 80
113#define WL1273_MS_SET 81
114#define WL1273_PS_SCROLL_SPEED 82
115#define WL1273_TX_AUDIO_LEVEL_TEST 96
116#define WL1273_TX_AUDIO_LEVEL_TEST_THRESHOLD 73
117#define WL1273_TX_AUDIO_INPUT_LEVEL_RANGE_SET 54
118#define WL1273_RX_ANTENNA_SELECT 87
119#define WL1273_I2C_DEV_ADDR_SET 86
120#define WL1273_REF_ERR_CALIB_PARAM_SET 88
121#define WL1273_REF_ERR_CALIB_PERIODICITY_SET 89
122#define WL1273_SOC_INT_TRIGGER 52
123#define WL1273_SOC_AUDIO_PATH_SET 83
124#define WL1273_SOC_PCMI_OVERRIDE 84
125#define WL1273_SOC_I2S_OVERRIDE 85
126#define WL1273_RSSI_BLOCK_SCAN_FREQ_SET 95
127#define WL1273_RSSI_BLOCK_SCAN_START 97
128#define WL1273_RSSI_BLOCK_SCAN_DATA_GET 5
129#define WL1273_READ_FMANT_TUNE_VALUE 104
130
131#define WL1273_RDS_OFF 0
132#define WL1273_RDS_ON 1
133#define WL1273_RDS_RESET 2
134
135#define WL1273_AUDIO_DIGITAL 0
136#define WL1273_AUDIO_ANALOG 1
137
138#define WL1273_MODE_RX BIT(0)
139#define WL1273_MODE_TX BIT(1)
140#define WL1273_MODE_OFF BIT(2)
141#define WL1273_MODE_SUSPENDED BIT(3)
142
143#define WL1273_RADIO_CHILD BIT(0)
144#define WL1273_CODEC_CHILD BIT(1)
145
146#define WL1273_RX_MONO 1
147#define WL1273_RX_STEREO 0
148#define WL1273_TX_MONO 0
149#define WL1273_TX_STEREO 1
150
151#define WL1273_MAX_VOLUME 0xffff
152#define WL1273_DEFAULT_VOLUME 0x78b8
153
154/* I2S protocol, left channel first, data width 16 bits */
155#define WL1273_PCM_DEF_MODE 0x00
156
157/* Rx */
158#define WL1273_AUDIO_ENABLE_I2S BIT(0)
159#define WL1273_AUDIO_ENABLE_ANALOG BIT(1)
160
161/* Tx */
162#define WL1273_AUDIO_IO_SET_ANALOG 0
163#define WL1273_AUDIO_IO_SET_I2S 1
164
165#define WL1273_PUPD_SET_OFF 0x00
166#define WL1273_PUPD_SET_ON 0x01
167#define WL1273_PUPD_SET_RETENTION 0x10
168
169/* I2S mode */
170#define WL1273_IS2_WIDTH_32 0x0
171#define WL1273_IS2_WIDTH_40 0x1
172#define WL1273_IS2_WIDTH_22_23 0x2
173#define WL1273_IS2_WIDTH_23_22 0x3
174#define WL1273_IS2_WIDTH_48 0x4
175#define WL1273_IS2_WIDTH_50 0x5
176#define WL1273_IS2_WIDTH_60 0x6
177#define WL1273_IS2_WIDTH_64 0x7
178#define WL1273_IS2_WIDTH_80 0x8
179#define WL1273_IS2_WIDTH_96 0x9
180#define WL1273_IS2_WIDTH_128 0xa
181#define WL1273_IS2_WIDTH 0xf
182
183#define WL1273_IS2_FORMAT_STD (0x0 << 4)
184#define WL1273_IS2_FORMAT_LEFT (0x1 << 4)
185#define WL1273_IS2_FORMAT_RIGHT (0x2 << 4)
186#define WL1273_IS2_FORMAT_USER (0x3 << 4)
187
188#define WL1273_IS2_MASTER (0x0 << 6)
189#define WL1273_IS2_SLAVEW (0x1 << 6)
190
191#define WL1273_IS2_TRI_AFTER_SENDING (0x0 << 7)
192#define WL1273_IS2_TRI_ALWAYS_ACTIVE (0x1 << 7)
193
194#define WL1273_IS2_SDOWS_RR (0x0 << 8)
195#define WL1273_IS2_SDOWS_RF (0x1 << 8)
196#define WL1273_IS2_SDOWS_FR (0x2 << 8)
197#define WL1273_IS2_SDOWS_FF (0x3 << 8)
198
199#define WL1273_IS2_TRI_OPT (0x0 << 10)
200#define WL1273_IS2_TRI_ALWAYS (0x1 << 10)
201
202#define WL1273_IS2_RATE_48K (0x0 << 12)
203#define WL1273_IS2_RATE_44_1K (0x1 << 12)
204#define WL1273_IS2_RATE_32K (0x2 << 12)
205#define WL1273_IS2_RATE_22_05K (0x4 << 12)
206#define WL1273_IS2_RATE_16K (0x5 << 12)
207#define WL1273_IS2_RATE_12K (0x8 << 12)
208#define WL1273_IS2_RATE_11_025 (0x9 << 12)
209#define WL1273_IS2_RATE_8K (0xa << 12)
210#define WL1273_IS2_RATE (0xf << 12)
211
212#define WL1273_I2S_DEF_MODE (WL1273_IS2_WIDTH_32 | \
213 WL1273_IS2_FORMAT_STD | \
214 WL1273_IS2_MASTER | \
215 WL1273_IS2_TRI_AFTER_SENDING | \
216 WL1273_IS2_SDOWS_RR | \
217 WL1273_IS2_TRI_OPT | \
218 WL1273_IS2_RATE_48K)
219
220#define SCHAR_MIN (-128)
221#define SCHAR_MAX 127
222
223#define WL1273_FR_EVENT BIT(0)
224#define WL1273_BL_EVENT BIT(1)
225#define WL1273_RDS_EVENT BIT(2)
226#define WL1273_BBLK_EVENT BIT(3)
227#define WL1273_LSYNC_EVENT BIT(4)
228#define WL1273_LEV_EVENT BIT(5)
229#define WL1273_IFFR_EVENT BIT(6)
230#define WL1273_PI_EVENT BIT(7)
231#define WL1273_PD_EVENT BIT(8)
232#define WL1273_STIC_EVENT BIT(9)
233#define WL1273_MAL_EVENT BIT(10)
234#define WL1273_POW_ENB_EVENT BIT(11)
235#define WL1273_SCAN_OVER_EVENT BIT(12)
236#define WL1273_ERROR_EVENT BIT(13)
237
238#define TUNER_MODE_STOP_SEARCH 0
239#define TUNER_MODE_PRESET 1
240#define TUNER_MODE_AUTO_SEEK 2
241#define TUNER_MODE_AF 3
242#define TUNER_MODE_AUTO_SEEK_PI 4
243#define TUNER_MODE_AUTO_SEEK_BULK 5
244
245#define RDS_BLOCK_SIZE 3
246
247struct wl1273_fm_platform_data {
248 int (*request_resources) (struct i2c_client *client);
249 void (*free_resources) (void);
250 void (*enable) (void);
251 void (*disable) (void);
252
253 u8 forbidden_modes;
254 unsigned int children;
255};
256
257#define WL1273_FM_CORE_CELLS 2
258
259#define WL1273_BAND_OTHER 0
260#define WL1273_BAND_JAPAN 1
261
262#define WL1273_BAND_JAPAN_LOW 76000
263#define WL1273_BAND_JAPAN_HIGH 90000
264#define WL1273_BAND_OTHER_LOW 87500
265#define WL1273_BAND_OTHER_HIGH 108000
266
267#define WL1273_BAND_TX_LOW 76000
268#define WL1273_BAND_TX_HIGH 108000
269
270struct wl1273_core {
271 struct mfd_cell cells[WL1273_FM_CORE_CELLS];
272 struct wl1273_fm_platform_data *pdata;
273
274 unsigned int mode;
275 unsigned int i2s_mode;
276 unsigned int volume;
277 unsigned int audio_mode;
278 unsigned int channel_number;
279 struct mutex lock; /* for serializing fm radio operations */
280
281 struct i2c_client *client;
282
283 int (*read)(struct wl1273_core *core, u8, u16 *);
284 int (*write)(struct wl1273_core *core, u8, u16);
285 int (*write_data)(struct wl1273_core *core, u8 *, u16);
286 int (*set_audio)(struct wl1273_core *core, unsigned int);
287 int (*set_volume)(struct wl1273_core *core, unsigned int);
288};
289
290#endif /* ifndef WL1273_CORE_H */
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index eb5bd4e0e03c..903280d21866 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -238,6 +238,16 @@ struct regulator_dev;
238 238
239#define WM831X_NUM_IRQ_REGS 5 239#define WM831X_NUM_IRQ_REGS 5
240 240
241enum wm831x_parent {
242 WM8310 = 0x8310,
243 WM8311 = 0x8311,
244 WM8312 = 0x8312,
245 WM8320 = 0x8320,
246 WM8321 = 0x8321,
247 WM8325 = 0x8325,
248 WM8326 = 0x8326,
249};
250
241struct wm831x { 251struct wm831x {
242 struct mutex io_lock; 252 struct mutex io_lock;
243 253
@@ -285,6 +295,9 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,
285int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg, 295int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
286 int count, u16 *buf); 296 int count, u16 *buf);
287 297
298int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq);
299void wm831x_device_exit(struct wm831x *wm831x);
300int wm831x_device_suspend(struct wm831x *wm831x);
288int wm831x_irq_init(struct wm831x *wm831x, int irq); 301int wm831x_irq_init(struct wm831x *wm831x, int irq);
289void wm831x_irq_exit(struct wm831x *wm831x); 302void wm831x_irq_exit(struct wm831x *wm831x);
290 303
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index fd322aca33ba..632d1567a1b6 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -80,7 +80,10 @@ struct wm831x_touch_pdata {
80 int isel; /** Current for pen down (uA) */ 80 int isel; /** Current for pen down (uA) */
81 int rpu; /** Pen down sensitivity resistor divider */ 81 int rpu; /** Pen down sensitivity resistor divider */
82 int pressure; /** Report pressure (boolean) */ 82 int pressure; /** Report pressure (boolean) */
83 int data_irq; /** Touch data ready IRQ */ 83 unsigned int data_irq; /** Touch data ready IRQ */
84 int data_irqf; /** IRQ flags for data ready IRQ */
85 unsigned int pd_irq; /** Touch pendown detect IRQ */
86 int pd_irqf; /** IRQ flags for pen down IRQ */
84}; 87};
85 88
86enum wm831x_watchdog_action { 89enum wm831x_watchdog_action {
@@ -103,11 +106,17 @@ struct wm831x_watchdog_pdata {
103#define WM831X_MAX_ISINK 2 106#define WM831X_MAX_ISINK 2
104 107
105struct wm831x_pdata { 108struct wm831x_pdata {
109 /** Used to distinguish multiple WM831x chips */
110 int wm831x_num;
111
106 /** Called before subdevices are set up */ 112 /** Called before subdevices are set up */
107 int (*pre_init)(struct wm831x *wm831x); 113 int (*pre_init)(struct wm831x *wm831x);
108 /** Called after subdevices are set up */ 114 /** Called after subdevices are set up */
109 int (*post_init)(struct wm831x *wm831x); 115 int (*post_init)(struct wm831x *wm831x);
110 116
117 /** Put the /IRQ line into CMOS mode */
118 bool irq_cmos;
119
111 int irq_base; 120 int irq_base;
112 int gpio_base; 121 int gpio_base;
113 struct wm831x_backlight_pdata *backlight; 122 struct wm831x_backlight_pdata *backlight;
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index a95141eafce3..bd581c6fa085 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -522,9 +522,6 @@
522#define WM8350_MCLK_SEL_PLL_32K 3 522#define WM8350_MCLK_SEL_PLL_32K 3
523#define WM8350_MCLK_SEL_MCLK 5 523#define WM8350_MCLK_SEL_MCLK 5
524 524
525#define WM8350_MCLK_DIR_OUT 0
526#define WM8350_MCLK_DIR_IN 1
527
528/* clock divider id's */ 525/* clock divider id's */
529#define WM8350_ADC_CLKDIV 0 526#define WM8350_ADC_CLKDIV 0
530#define WM8350_DAC_CLKDIV 1 527#define WM8350_DAC_CLKDIV 1
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
index e786fe9841ef..579b50ca2e02 100644
--- a/include/linux/mfd/wm8350/pmic.h
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * pmic.h -- Power Managment Driver for Wolfson WM8350 PMIC 2 * pmic.h -- Power Management Driver for Wolfson WM8350 PMIC
3 * 3 *
4 * Copyright 2007 Wolfson Microelectronics PLC 4 * Copyright 2007 Wolfson Microelectronics PLC
5 * 5 *
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index de79baee4925..f0b69cdae41c 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -17,6 +17,11 @@
17 17
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19 19
20enum wm8994_type {
21 WM8994 = 0,
22 WM8958 = 1,
23};
24
20struct regulator_dev; 25struct regulator_dev;
21struct regulator_bulk_data; 26struct regulator_bulk_data;
22 27
@@ -48,11 +53,13 @@ struct wm8994 {
48 struct mutex io_lock; 53 struct mutex io_lock;
49 struct mutex irq_lock; 54 struct mutex irq_lock;
50 55
56 enum wm8994_type type;
57
51 struct device *dev; 58 struct device *dev;
52 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
53 int bytes, void *dest); 60 int bytes, void *dest);
54 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg, 61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
55 int bytes, void *src); 62 int bytes, const void *src);
56 63
57 void *control_data; 64 void *control_data;
58 65
@@ -64,10 +71,12 @@ struct wm8994 {
64 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; 71 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
65 72
66 /* Used over suspend/resume */ 73 /* Used over suspend/resume */
74 bool suspended;
67 u16 ldo_regs[WM8994_NUM_LDO_REGS]; 75 u16 ldo_regs[WM8994_NUM_LDO_REGS];
68 u16 gpio_regs[WM8994_NUM_GPIO_REGS]; 76 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
69 77
70 struct regulator_dev *dbvdd; 78 struct regulator_dev *dbvdd;
79 int num_supplies;
71 struct regulator_bulk_data *supplies; 80 struct regulator_bulk_data *supplies;
72}; 81};
73 82
@@ -79,6 +88,8 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
79 unsigned short mask, unsigned short val); 88 unsigned short mask, unsigned short val);
80int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 89int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
81 int count, u16 *buf); 90 int count, u16 *buf);
91int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
92 int count, const u16 *buf);
82 93
83 94
84/* Helper to save on boilerplate */ 95/* Helper to save on boilerplate */
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 5c51f367c061..466b1c777aff 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -29,7 +29,9 @@ struct wm8994_ldo_pdata {
29#define WM8994_CONFIGURE_GPIO 0x8000 29#define WM8994_CONFIGURE_GPIO 0x8000
30 30
31#define WM8994_DRC_REGS 5 31#define WM8994_DRC_REGS 5
32#define WM8994_EQ_REGS 19 32#define WM8994_EQ_REGS 20
33#define WM8958_MBC_CUTOFF_REGS 20
34#define WM8958_MBC_COEFF_REGS 48
33 35
34/** 36/**
35 * DRC configurations are specified with a label and a set of register 37 * DRC configurations are specified with a label and a set of register
@@ -59,6 +61,18 @@ struct wm8994_retune_mobile_cfg {
59 u16 regs[WM8994_EQ_REGS]; 61 u16 regs[WM8994_EQ_REGS];
60}; 62};
61 63
64/**
65 * Multiband compressor configurations are specified with a label and
66 * two sets of values to write. Configurations are expected to be
67 * generated using the multiband compressor configuration panel in
68 * WISCE - see http://www.wolfsonmicro.com/wisce/
69 */
70struct wm8958_mbc_cfg {
71 const char *name;
72 u16 cutoff_regs[WM8958_MBC_CUTOFF_REGS];
73 u16 coeff_regs[WM8958_MBC_COEFF_REGS];
74};
75
62struct wm8994_pdata { 76struct wm8994_pdata {
63 int gpio_base; 77 int gpio_base;
64 78
@@ -78,6 +92,9 @@ struct wm8994_pdata {
78 int num_retune_mobile_cfgs; 92 int num_retune_mobile_cfgs;
79 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs; 93 struct wm8994_retune_mobile_cfg *retune_mobile_cfgs;
80 94
95 int num_mbc_cfgs;
96 struct wm8958_mbc_cfg *mbc_cfgs;
97
81 /* LINEOUT can be differential or single ended */ 98 /* LINEOUT can be differential or single ended */
82 unsigned int lineout1_diff:1; 99 unsigned int lineout1_diff:1;
83 unsigned int lineout2_diff:1; 100 unsigned int lineout2_diff:1;
@@ -86,13 +103,21 @@ struct wm8994_pdata {
86 unsigned int lineout1fb:1; 103 unsigned int lineout1fb:1;
87 unsigned int lineout2fb:1; 104 unsigned int lineout2fb:1;
88 105
89 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ 106 /* IRQ for microphone detection if brought out directly as a
107 * signal.
108 */
109 int micdet_irq;
110
111 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
90 unsigned int micbias1_lvl:1; 112 unsigned int micbias1_lvl:1;
91 unsigned int micbias2_lvl:1; 113 unsigned int micbias2_lvl:1;
92 114
93 /* Jack detect threashold levels, see datasheet for values */ 115 /* WM8994 jack detect threashold levels, see datasheet for values */
94 unsigned int jd_scthr:2; 116 unsigned int jd_scthr:2;
95 unsigned int jd_thr:2; 117 unsigned int jd_thr:2;
118
119 /* WM8958 microphone bias configuration */
120 int micbias[2];
96}; 121};
97 122
98#endif 123#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 967f62f54159..f3ee84284670 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -63,13 +63,19 @@
63#define WM8994_MICBIAS 0x3A 63#define WM8994_MICBIAS 0x3A
64#define WM8994_LDO_1 0x3B 64#define WM8994_LDO_1 0x3B
65#define WM8994_LDO_2 0x3C 65#define WM8994_LDO_2 0x3C
66#define WM8958_MICBIAS1 0x3D
67#define WM8958_MICBIAS2 0x3E
66#define WM8994_CHARGE_PUMP_1 0x4C 68#define WM8994_CHARGE_PUMP_1 0x4C
69#define WM8958_CHARGE_PUMP_2 0x4D
67#define WM8994_CLASS_W_1 0x51 70#define WM8994_CLASS_W_1 0x51
68#define WM8994_DC_SERVO_1 0x54 71#define WM8994_DC_SERVO_1 0x54
69#define WM8994_DC_SERVO_2 0x55 72#define WM8994_DC_SERVO_2 0x55
70#define WM8994_DC_SERVO_4 0x57 73#define WM8994_DC_SERVO_4 0x57
71#define WM8994_DC_SERVO_READBACK 0x58 74#define WM8994_DC_SERVO_READBACK 0x58
72#define WM8994_ANALOGUE_HP_1 0x60 75#define WM8994_ANALOGUE_HP_1 0x60
76#define WM8958_MIC_DETECT_1 0xD0
77#define WM8958_MIC_DETECT_2 0xD1
78#define WM8958_MIC_DETECT_3 0xD2
73#define WM8994_CHIP_REVISION 0x100 79#define WM8994_CHIP_REVISION 0x100
74#define WM8994_CONTROL_INTERFACE 0x101 80#define WM8994_CONTROL_INTERFACE 0x101
75#define WM8994_WRITE_SEQUENCER_CTRL_1 0x110 81#define WM8994_WRITE_SEQUENCER_CTRL_1 0x110
@@ -109,6 +115,10 @@
109#define WM8994_AIF2DAC_LRCLK 0x315 115#define WM8994_AIF2DAC_LRCLK 0x315
110#define WM8994_AIF2DAC_DATA 0x316 116#define WM8994_AIF2DAC_DATA 0x316
111#define WM8994_AIF2ADC_DATA 0x317 117#define WM8994_AIF2ADC_DATA 0x317
118#define WM8958_AIF3_CONTROL_1 0x320
119#define WM8958_AIF3_CONTROL_2 0x321
120#define WM8958_AIF3DAC_DATA 0x322
121#define WM8958_AIF3ADC_DATA 0x323
112#define WM8994_AIF1_ADC1_LEFT_VOLUME 0x400 122#define WM8994_AIF1_ADC1_LEFT_VOLUME 0x400
113#define WM8994_AIF1_ADC1_RIGHT_VOLUME 0x401 123#define WM8994_AIF1_ADC1_RIGHT_VOLUME 0x401
114#define WM8994_AIF1_DAC1_LEFT_VOLUME 0x402 124#define WM8994_AIF1_DAC1_LEFT_VOLUME 0x402
@@ -242,6 +252,83 @@
242#define WM8994_INTERRUPT_STATUS_2_MASK 0x739 252#define WM8994_INTERRUPT_STATUS_2_MASK 0x739
243#define WM8994_INTERRUPT_CONTROL 0x740 253#define WM8994_INTERRUPT_CONTROL 0x740
244#define WM8994_IRQ_DEBOUNCE 0x748 254#define WM8994_IRQ_DEBOUNCE 0x748
255#define WM8958_DSP2_PROGRAM 0x900
256#define WM8958_DSP2_CONFIG 0x901
257#define WM8958_DSP2_MAGICNUM 0xA00
258#define WM8958_DSP2_RELEASEYEAR 0xA01
259#define WM8958_DSP2_RELEASEMONTHDAY 0xA02
260#define WM8958_DSP2_RELEASETIME 0xA03
261#define WM8958_DSP2_VERMAJMIN 0xA04
262#define WM8958_DSP2_VERBUILD 0xA05
263#define WM8958_DSP2_EXECCONTROL 0xA0D
264#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200
265#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201
266#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202
267#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_2 0x2203
268#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C3_1 0x2204
269#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C3_2 0x2205
270#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C2_1 0x2206
271#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C2_2 0x2207
272#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C3_1 0x2208
273#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C3_2 0x2209
274#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C1_1 0x220A
275#define WM8958_MBC_BAND_2_UPPER_CUTOFF_C1_2 0x220B
276#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C1_1 0x220C
277#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C1_2 0x220D
278#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C2_1 0x220E
279#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C2_2 0x220F
280#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C3_1 0x2210
281#define WM8958_MBC_BAND_1_UPPER_CUTOFF_C3_2 0x2211
282#define WM8958_MBC_BAND_1_LOWER_CUTOFF_1 0x2212
283#define WM8958_MBC_BAND_1_LOWER_CUTOFF_2 0x2213
284#define WM8958_MBC_BAND_1_K_1 0x2400
285#define WM8958_MBC_BAND_1_K_2 0x2401
286#define WM8958_MBC_BAND_1_N1_1 0x2402
287#define WM8958_MBC_BAND_1_N1_2 0x2403
288#define WM8958_MBC_BAND_1_N2_1 0x2404
289#define WM8958_MBC_BAND_1_N2_2 0x2405
290#define WM8958_MBC_BAND_1_N3_1 0x2406
291#define WM8958_MBC_BAND_1_N3_2 0x2407
292#define WM8958_MBC_BAND_1_N4_1 0x2408
293#define WM8958_MBC_BAND_1_N4_2 0x2409
294#define WM8958_MBC_BAND_1_N5_1 0x240A
295#define WM8958_MBC_BAND_1_N5_2 0x240B
296#define WM8958_MBC_BAND_1_X1_1 0x240C
297#define WM8958_MBC_BAND_1_X1_2 0x240D
298#define WM8958_MBC_BAND_1_X2_1 0x240E
299#define WM8958_MBC_BAND_1_X2_2 0x240F
300#define WM8958_MBC_BAND_1_X3_1 0x2410
301#define WM8958_MBC_BAND_1_X3_2 0x2411
302#define WM8958_MBC_BAND_1_ATTACK_1 0x2412
303#define WM8958_MBC_BAND_1_ATTACK_2 0x2413
304#define WM8958_MBC_BAND_1_DECAY_1 0x2414
305#define WM8958_MBC_BAND_1_DECAY_2 0x2415
306#define WM8958_MBC_BAND_2_K_1 0x2416
307#define WM8958_MBC_BAND_2_K_2 0x2417
308#define WM8958_MBC_BAND_2_N1_1 0x2418
309#define WM8958_MBC_BAND_2_N1_2 0x2419
310#define WM8958_MBC_BAND_2_N2_1 0x241A
311#define WM8958_MBC_BAND_2_N2_2 0x241B
312#define WM8958_MBC_BAND_2_N3_1 0x241C
313#define WM8958_MBC_BAND_2_N3_2 0x241D
314#define WM8958_MBC_BAND_2_N4_1 0x241E
315#define WM8958_MBC_BAND_2_N4_2 0x241F
316#define WM8958_MBC_BAND_2_N5_1 0x2420
317#define WM8958_MBC_BAND_2_N5_2 0x2421
318#define WM8958_MBC_BAND_2_X1_1 0x2422
319#define WM8958_MBC_BAND_2_X1_2 0x2423
320#define WM8958_MBC_BAND_2_X2_1 0x2424
321#define WM8958_MBC_BAND_2_X2_2 0x2425
322#define WM8958_MBC_BAND_2_X3_1 0x2426
323#define WM8958_MBC_BAND_2_X3_2 0x2427
324#define WM8958_MBC_BAND_2_ATTACK_1 0x2428
325#define WM8958_MBC_BAND_2_ATTACK_2 0x2429
326#define WM8958_MBC_BAND_2_DECAY_1 0x242A
327#define WM8958_MBC_BAND_2_DECAY_2 0x242B
328#define WM8958_MBC_B2_PG2_1 0x242C
329#define WM8958_MBC_B2_PG2_2 0x242D
330#define WM8958_MBC_B1_PG2_1 0x242E
331#define WM8958_MBC_B1_PG2_2 0x242F
245#define WM8994_WRITE_SEQUENCER_0 0x3000 332#define WM8994_WRITE_SEQUENCER_0 0x3000
246#define WM8994_WRITE_SEQUENCER_1 0x3001 333#define WM8994_WRITE_SEQUENCER_1 0x3001
247#define WM8994_WRITE_SEQUENCER_2 0x3002 334#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -992,6 +1079,12 @@
992/* 1079/*
993 * R6 (0x06) - Power Management (6) 1080 * R6 (0x06) - Power Management (6)
994 */ 1081 */
1082#define WM8958_AIF3ADC_SRC_MASK 0x0600 /* AIF3ADC_SRC - [10:9] */
1083#define WM8958_AIF3ADC_SRC_SHIFT 9 /* AIF3ADC_SRC - [10:9] */
1084#define WM8958_AIF3ADC_SRC_WIDTH 2 /* AIF3ADC_SRC - [10:9] */
1085#define WM8958_AIF2DAC_SRC_MASK 0x0180 /* AIF2DAC_SRC - [8:7] */
1086#define WM8958_AIF2DAC_SRC_SHIFT 7 /* AIF2DAC_SRC - [8:7] */
1087#define WM8958_AIF2DAC_SRC_WIDTH 2 /* AIF2DAC_SRC - [8:7] */
995#define WM8994_AIF3_TRI 0x0020 /* AIF3_TRI */ 1088#define WM8994_AIF3_TRI 0x0020 /* AIF3_TRI */
996#define WM8994_AIF3_TRI_MASK 0x0020 /* AIF3_TRI */ 1089#define WM8994_AIF3_TRI_MASK 0x0020 /* AIF3_TRI */
997#define WM8994_AIF3_TRI_SHIFT 5 /* AIF3_TRI */ 1090#define WM8994_AIF3_TRI_SHIFT 5 /* AIF3_TRI */
@@ -1836,6 +1929,14 @@
1836#define WM8994_CP_ENA_WIDTH 1 /* CP_ENA */ 1929#define WM8994_CP_ENA_WIDTH 1 /* CP_ENA */
1837 1930
1838/* 1931/*
1932 * R77 (0x4D) - Charge Pump (2)
1933 */
1934#define WM8958_CP_DISCH 0x8000 /* CP_DISCH */
1935#define WM8958_CP_DISCH_MASK 0x8000 /* CP_DISCH */
1936#define WM8958_CP_DISCH_SHIFT 15 /* CP_DISCH */
1937#define WM8958_CP_DISCH_WIDTH 1 /* CP_DISCH */
1938
1939/*
1839 * R81 (0x51) - Class W (1) 1940 * R81 (0x51) - Class W (1)
1840 */ 1941 */
1841#define WM8994_CP_DYN_SRC_SEL_MASK 0x0300 /* CP_DYN_SRC_SEL - [9:8] */ 1942#define WM8994_CP_DYN_SRC_SEL_MASK 0x0300 /* CP_DYN_SRC_SEL - [9:8] */
@@ -1952,6 +2053,46 @@
1952#define WM8994_HPOUT1R_DLY_WIDTH 1 /* HPOUT1R_DLY */ 2053#define WM8994_HPOUT1R_DLY_WIDTH 1 /* HPOUT1R_DLY */
1953 2054
1954/* 2055/*
2056 * R208 (0xD0) - Mic Detect 1
2057 */
2058#define WM8958_MICD_BIAS_STARTTIME_MASK 0xF000 /* MICD_BIAS_STARTTIME - [15:12] */
2059#define WM8958_MICD_BIAS_STARTTIME_SHIFT 12 /* MICD_BIAS_STARTTIME - [15:12] */
2060#define WM8958_MICD_BIAS_STARTTIME_WIDTH 4 /* MICD_BIAS_STARTTIME - [15:12] */
2061#define WM8958_MICD_RATE_MASK 0x0F00 /* MICD_RATE - [11:8] */
2062#define WM8958_MICD_RATE_SHIFT 8 /* MICD_RATE - [11:8] */
2063#define WM8958_MICD_RATE_WIDTH 4 /* MICD_RATE - [11:8] */
2064#define WM8958_MICD_DBTIME 0x0002 /* MICD_DBTIME */
2065#define WM8958_MICD_DBTIME_MASK 0x0002 /* MICD_DBTIME */
2066#define WM8958_MICD_DBTIME_SHIFT 1 /* MICD_DBTIME */
2067#define WM8958_MICD_DBTIME_WIDTH 1 /* MICD_DBTIME */
2068#define WM8958_MICD_ENA 0x0001 /* MICD_ENA */
2069#define WM8958_MICD_ENA_MASK 0x0001 /* MICD_ENA */
2070#define WM8958_MICD_ENA_SHIFT 0 /* MICD_ENA */
2071#define WM8958_MICD_ENA_WIDTH 1 /* MICD_ENA */
2072
2073/*
2074 * R209 (0xD1) - Mic Detect 2
2075 */
2076#define WM8958_MICD_LVL_SEL_MASK 0x00FF /* MICD_LVL_SEL - [7:0] */
2077#define WM8958_MICD_LVL_SEL_SHIFT 0 /* MICD_LVL_SEL - [7:0] */
2078#define WM8958_MICD_LVL_SEL_WIDTH 8 /* MICD_LVL_SEL - [7:0] */
2079
2080/*
2081 * R210 (0xD2) - Mic Detect 3
2082 */
2083#define WM8958_MICD_LVL_MASK 0x07FC /* MICD_LVL - [10:2] */
2084#define WM8958_MICD_LVL_SHIFT 2 /* MICD_LVL - [10:2] */
2085#define WM8958_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */
2086#define WM8958_MICD_VALID 0x0002 /* MICD_VALID */
2087#define WM8958_MICD_VALID_MASK 0x0002 /* MICD_VALID */
2088#define WM8958_MICD_VALID_SHIFT 1 /* MICD_VALID */
2089#define WM8958_MICD_VALID_WIDTH 1 /* MICD_VALID */
2090#define WM8958_MICD_STS 0x0001 /* MICD_STS */
2091#define WM8958_MICD_STS_MASK 0x0001 /* MICD_STS */
2092#define WM8958_MICD_STS_SHIFT 0 /* MICD_STS */
2093#define WM8958_MICD_STS_WIDTH 1 /* MICD_STS */
2094
2095/*
1955 * R256 (0x100) - Chip Revision 2096 * R256 (0x100) - Chip Revision
1956 */ 2097 */
1957#define WM8994_CHIP_REV_MASK 0x000F /* CHIP_REV - [3:0] */ 2098#define WM8994_CHIP_REV_MASK 0x000F /* CHIP_REV - [3:0] */
@@ -2069,6 +2210,14 @@
2069/* 2210/*
2070 * R520 (0x208) - Clocking (1) 2211 * R520 (0x208) - Clocking (1)
2071 */ 2212 */
2213#define WM8958_DSP2CLK_ENA 0x4000 /* DSP2CLK_ENA */
2214#define WM8958_DSP2CLK_ENA_MASK 0x4000 /* DSP2CLK_ENA */
2215#define WM8958_DSP2CLK_ENA_SHIFT 14 /* DSP2CLK_ENA */
2216#define WM8958_DSP2CLK_ENA_WIDTH 1 /* DSP2CLK_ENA */
2217#define WM8958_DSP2CLK_SRC 0x1000 /* DSP2CLK_SRC */
2218#define WM8958_DSP2CLK_SRC_MASK 0x1000 /* DSP2CLK_SRC */
2219#define WM8958_DSP2CLK_SRC_SHIFT 12 /* DSP2CLK_SRC */
2220#define WM8958_DSP2CLK_SRC_WIDTH 1 /* DSP2CLK_SRC */
2072#define WM8994_TOCLK_ENA 0x0010 /* TOCLK_ENA */ 2221#define WM8994_TOCLK_ENA 0x0010 /* TOCLK_ENA */
2073#define WM8994_TOCLK_ENA_MASK 0x0010 /* TOCLK_ENA */ 2222#define WM8994_TOCLK_ENA_MASK 0x0010 /* TOCLK_ENA */
2074#define WM8994_TOCLK_ENA_SHIFT 4 /* TOCLK_ENA */ 2223#define WM8994_TOCLK_ENA_SHIFT 4 /* TOCLK_ENA */
@@ -2553,6 +2702,63 @@
2553#define WM8994_AIF2ADCR_DAT_INV_WIDTH 1 /* AIF2ADCR_DAT_INV */ 2702#define WM8994_AIF2ADCR_DAT_INV_WIDTH 1 /* AIF2ADCR_DAT_INV */
2554 2703
2555/* 2704/*
2705 * R800 (0x320) - AIF3 Control (1)
2706 */
2707#define WM8958_AIF3_LRCLK_INV 0x0080 /* AIF3_LRCLK_INV */
2708#define WM8958_AIF3_LRCLK_INV_MASK 0x0080 /* AIF3_LRCLK_INV */
2709#define WM8958_AIF3_LRCLK_INV_SHIFT 7 /* AIF3_LRCLK_INV */
2710#define WM8958_AIF3_LRCLK_INV_WIDTH 1 /* AIF3_LRCLK_INV */
2711#define WM8958_AIF3_WL_MASK 0x0060 /* AIF3_WL - [6:5] */
2712#define WM8958_AIF3_WL_SHIFT 5 /* AIF3_WL - [6:5] */
2713#define WM8958_AIF3_WL_WIDTH 2 /* AIF3_WL - [6:5] */
2714#define WM8958_AIF3_FMT_MASK 0x0018 /* AIF3_FMT - [4:3] */
2715#define WM8958_AIF3_FMT_SHIFT 3 /* AIF3_FMT - [4:3] */
2716#define WM8958_AIF3_FMT_WIDTH 2 /* AIF3_FMT - [4:3] */
2717
2718/*
2719 * R801 (0x321) - AIF3 Control (2)
2720 */
2721#define WM8958_AIF3DAC_BOOST_MASK 0x0C00 /* AIF3DAC_BOOST - [11:10] */
2722#define WM8958_AIF3DAC_BOOST_SHIFT 10 /* AIF3DAC_BOOST - [11:10] */
2723#define WM8958_AIF3DAC_BOOST_WIDTH 2 /* AIF3DAC_BOOST - [11:10] */
2724#define WM8958_AIF3DAC_COMP 0x0010 /* AIF3DAC_COMP */
2725#define WM8958_AIF3DAC_COMP_MASK 0x0010 /* AIF3DAC_COMP */
2726#define WM8958_AIF3DAC_COMP_SHIFT 4 /* AIF3DAC_COMP */
2727#define WM8958_AIF3DAC_COMP_WIDTH 1 /* AIF3DAC_COMP */
2728#define WM8958_AIF3DAC_COMPMODE 0x0008 /* AIF3DAC_COMPMODE */
2729#define WM8958_AIF3DAC_COMPMODE_MASK 0x0008 /* AIF3DAC_COMPMODE */
2730#define WM8958_AIF3DAC_COMPMODE_SHIFT 3 /* AIF3DAC_COMPMODE */
2731#define WM8958_AIF3DAC_COMPMODE_WIDTH 1 /* AIF3DAC_COMPMODE */
2732#define WM8958_AIF3ADC_COMP 0x0004 /* AIF3ADC_COMP */
2733#define WM8958_AIF3ADC_COMP_MASK 0x0004 /* AIF3ADC_COMP */
2734#define WM8958_AIF3ADC_COMP_SHIFT 2 /* AIF3ADC_COMP */
2735#define WM8958_AIF3ADC_COMP_WIDTH 1 /* AIF3ADC_COMP */
2736#define WM8958_AIF3ADC_COMPMODE 0x0002 /* AIF3ADC_COMPMODE */
2737#define WM8958_AIF3ADC_COMPMODE_MASK 0x0002 /* AIF3ADC_COMPMODE */
2738#define WM8958_AIF3ADC_COMPMODE_SHIFT 1 /* AIF3ADC_COMPMODE */
2739#define WM8958_AIF3ADC_COMPMODE_WIDTH 1 /* AIF3ADC_COMPMODE */
2740#define WM8958_AIF3_LOOPBACK 0x0001 /* AIF3_LOOPBACK */
2741#define WM8958_AIF3_LOOPBACK_MASK 0x0001 /* AIF3_LOOPBACK */
2742#define WM8958_AIF3_LOOPBACK_SHIFT 0 /* AIF3_LOOPBACK */
2743#define WM8958_AIF3_LOOPBACK_WIDTH 1 /* AIF3_LOOPBACK */
2744
2745/*
2746 * R802 (0x322) - AIF3DAC Data
2747 */
2748#define WM8958_AIF3DAC_DAT_INV 0x0001 /* AIF3DAC_DAT_INV */
2749#define WM8958_AIF3DAC_DAT_INV_MASK 0x0001 /* AIF3DAC_DAT_INV */
2750#define WM8958_AIF3DAC_DAT_INV_SHIFT 0 /* AIF3DAC_DAT_INV */
2751#define WM8958_AIF3DAC_DAT_INV_WIDTH 1 /* AIF3DAC_DAT_INV */
2752
2753/*
2754 * R803 (0x323) - AIF3ADC Data
2755 */
2756#define WM8958_AIF3ADC_DAT_INV 0x0001 /* AIF3ADC_DAT_INV */
2757#define WM8958_AIF3ADC_DAT_INV_MASK 0x0001 /* AIF3ADC_DAT_INV */
2758#define WM8958_AIF3ADC_DAT_INV_SHIFT 0 /* AIF3ADC_DAT_INV */
2759#define WM8958_AIF3ADC_DAT_INV_WIDTH 1 /* AIF3ADC_DAT_INV */
2760
2761/*
2556 * R1024 (0x400) - AIF1 ADC1 Left Volume 2762 * R1024 (0x400) - AIF1 ADC1 Left Volume
2557 */ 2763 */
2558#define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */ 2764#define WM8994_AIF1ADC1_VU 0x0100 /* AIF1ADC1_VU */
@@ -4289,4 +4495,102 @@
4289#define WM8994_TEMP_SHUT_DB_SHIFT 0 /* TEMP_SHUT_DB */ 4495#define WM8994_TEMP_SHUT_DB_SHIFT 0 /* TEMP_SHUT_DB */
4290#define WM8994_TEMP_SHUT_DB_WIDTH 1 /* TEMP_SHUT_DB */ 4496#define WM8994_TEMP_SHUT_DB_WIDTH 1 /* TEMP_SHUT_DB */
4291 4497
4498/*
4499 * R2304 (0x900) - DSP2_Program
4500 */
4501#define WM8958_DSP2_ENA 0x0001 /* DSP2_ENA */
4502#define WM8958_DSP2_ENA_MASK 0x0001 /* DSP2_ENA */
4503#define WM8958_DSP2_ENA_SHIFT 0 /* DSP2_ENA */
4504#define WM8958_DSP2_ENA_WIDTH 1 /* DSP2_ENA */
4505
4506/*
4507 * R2305 (0x901) - DSP2_Config
4508 */
4509#define WM8958_MBC_SEL_MASK 0x0030 /* MBC_SEL - [5:4] */
4510#define WM8958_MBC_SEL_SHIFT 4 /* MBC_SEL - [5:4] */
4511#define WM8958_MBC_SEL_WIDTH 2 /* MBC_SEL - [5:4] */
4512#define WM8958_MBC_ENA 0x0001 /* MBC_ENA */
4513#define WM8958_MBC_ENA_MASK 0x0001 /* MBC_ENA */
4514#define WM8958_MBC_ENA_SHIFT 0 /* MBC_ENA */
4515#define WM8958_MBC_ENA_WIDTH 1 /* MBC_ENA */
4516
4517/*
4518 * R2560 (0xA00) - DSP2_MagicNum
4519 */
4520#define WM8958_DSP2_MAGIC_NUM_MASK 0xFFFF /* DSP2_MAGIC_NUM - [15:0] */
4521#define WM8958_DSP2_MAGIC_NUM_SHIFT 0 /* DSP2_MAGIC_NUM - [15:0] */
4522#define WM8958_DSP2_MAGIC_NUM_WIDTH 16 /* DSP2_MAGIC_NUM - [15:0] */
4523
4524/*
4525 * R2561 (0xA01) - DSP2_ReleaseYear
4526 */
4527#define WM8958_DSP2_RELEASE_YEAR_MASK 0xFFFF /* DSP2_RELEASE_YEAR - [15:0] */
4528#define WM8958_DSP2_RELEASE_YEAR_SHIFT 0 /* DSP2_RELEASE_YEAR - [15:0] */
4529#define WM8958_DSP2_RELEASE_YEAR_WIDTH 16 /* DSP2_RELEASE_YEAR - [15:0] */
4530
4531/*
4532 * R2562 (0xA02) - DSP2_ReleaseMonthDay
4533 */
4534#define WM8958_DSP2_RELEASE_MONTH_MASK 0xFF00 /* DSP2_RELEASE_MONTH - [15:8] */
4535#define WM8958_DSP2_RELEASE_MONTH_SHIFT 8 /* DSP2_RELEASE_MONTH - [15:8] */
4536#define WM8958_DSP2_RELEASE_MONTH_WIDTH 8 /* DSP2_RELEASE_MONTH - [15:8] */
4537#define WM8958_DSP2_RELEASE_DAY_MASK 0x00FF /* DSP2_RELEASE_DAY - [7:0] */
4538#define WM8958_DSP2_RELEASE_DAY_SHIFT 0 /* DSP2_RELEASE_DAY - [7:0] */
4539#define WM8958_DSP2_RELEASE_DAY_WIDTH 8 /* DSP2_RELEASE_DAY - [7:0] */
4540
4541/*
4542 * R2563 (0xA03) - DSP2_ReleaseTime
4543 */
4544#define WM8958_DSP2_RELEASE_HOURS_MASK 0xFF00 /* DSP2_RELEASE_HOURS - [15:8] */
4545#define WM8958_DSP2_RELEASE_HOURS_SHIFT 8 /* DSP2_RELEASE_HOURS - [15:8] */
4546#define WM8958_DSP2_RELEASE_HOURS_WIDTH 8 /* DSP2_RELEASE_HOURS - [15:8] */
4547#define WM8958_DSP2_RELEASE_MINS_MASK 0x00FF /* DSP2_RELEASE_MINS - [7:0] */
4548#define WM8958_DSP2_RELEASE_MINS_SHIFT 0 /* DSP2_RELEASE_MINS - [7:0] */
4549#define WM8958_DSP2_RELEASE_MINS_WIDTH 8 /* DSP2_RELEASE_MINS - [7:0] */
4550
4551/*
4552 * R2564 (0xA04) - DSP2_VerMajMin
4553 */
4554#define WM8958_DSP2_MAJOR_VER_MASK 0xFF00 /* DSP2_MAJOR_VER - [15:8] */
4555#define WM8958_DSP2_MAJOR_VER_SHIFT 8 /* DSP2_MAJOR_VER - [15:8] */
4556#define WM8958_DSP2_MAJOR_VER_WIDTH 8 /* DSP2_MAJOR_VER - [15:8] */
4557#define WM8958_DSP2_MINOR_VER_MASK 0x00FF /* DSP2_MINOR_VER - [7:0] */
4558#define WM8958_DSP2_MINOR_VER_SHIFT 0 /* DSP2_MINOR_VER - [7:0] */
4559#define WM8958_DSP2_MINOR_VER_WIDTH 8 /* DSP2_MINOR_VER - [7:0] */
4560
4561/*
4562 * R2565 (0xA05) - DSP2_VerBuild
4563 */
4564#define WM8958_DSP2_BUILD_VER_MASK 0xFFFF /* DSP2_BUILD_VER - [15:0] */
4565#define WM8958_DSP2_BUILD_VER_SHIFT 0 /* DSP2_BUILD_VER - [15:0] */
4566#define WM8958_DSP2_BUILD_VER_WIDTH 16 /* DSP2_BUILD_VER - [15:0] */
4567
4568/*
4569 * R2573 (0xA0D) - DSP2_ExecControl
4570 */
4571#define WM8958_DSP2_STOPC 0x0020 /* DSP2_STOPC */
4572#define WM8958_DSP2_STOPC_MASK 0x0020 /* DSP2_STOPC */
4573#define WM8958_DSP2_STOPC_SHIFT 5 /* DSP2_STOPC */
4574#define WM8958_DSP2_STOPC_WIDTH 1 /* DSP2_STOPC */
4575#define WM8958_DSP2_STOPS 0x0010 /* DSP2_STOPS */
4576#define WM8958_DSP2_STOPS_MASK 0x0010 /* DSP2_STOPS */
4577#define WM8958_DSP2_STOPS_SHIFT 4 /* DSP2_STOPS */
4578#define WM8958_DSP2_STOPS_WIDTH 1 /* DSP2_STOPS */
4579#define WM8958_DSP2_STOPI 0x0008 /* DSP2_STOPI */
4580#define WM8958_DSP2_STOPI_MASK 0x0008 /* DSP2_STOPI */
4581#define WM8958_DSP2_STOPI_SHIFT 3 /* DSP2_STOPI */
4582#define WM8958_DSP2_STOPI_WIDTH 1 /* DSP2_STOPI */
4583#define WM8958_DSP2_STOP 0x0004 /* DSP2_STOP */
4584#define WM8958_DSP2_STOP_MASK 0x0004 /* DSP2_STOP */
4585#define WM8958_DSP2_STOP_SHIFT 2 /* DSP2_STOP */
4586#define WM8958_DSP2_STOP_WIDTH 1 /* DSP2_STOP */
4587#define WM8958_DSP2_RUNR 0x0002 /* DSP2_RUNR */
4588#define WM8958_DSP2_RUNR_MASK 0x0002 /* DSP2_RUNR */
4589#define WM8958_DSP2_RUNR_SHIFT 1 /* DSP2_RUNR */
4590#define WM8958_DSP2_RUNR_WIDTH 1 /* DSP2_RUNR */
4591#define WM8958_DSP2_RUN 0x0001 /* DSP2_RUN */
4592#define WM8958_DSP2_RUN_MASK 0x0001 /* DSP2_RUN */
4593#define WM8958_DSP2_RUN_SHIFT 0 /* DSP2_RUN */
4594#define WM8958_DSP2_RUN_WIDTH 1 /* DSP2_RUN */
4595
4292#endif 4596#endif
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
new file mode 100644
index 000000000000..dd8da342a991
--- /dev/null
+++ b/include/linux/micrel_phy.h
@@ -0,0 +1,16 @@
1#ifndef _MICREL_PHY_H
2#define _MICREL_PHY_H
3
4#define MICREL_PHY_ID_MASK 0x00fffff0
5
6#define PHY_ID_KSZ9021 0x00221611
7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550
10/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
11#define PHY_ID_KS8001 0x0022161A
12
13/* struct phy_device dev_flags definitions */
14#define MICREL_PHY_50MHZ_CLK 0x00000001
15
16#endif /* _MICREL_PHY_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 7238231b8dd4..e39aeecfe9a2 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -13,7 +13,11 @@ extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 14 struct page *, struct page *);
15extern int migrate_pages(struct list_head *l, new_page_t x, 15extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, int offlining); 16 unsigned long private, bool offlining,
17 bool sync);
18extern int migrate_huge_pages(struct list_head *l, new_page_t x,
19 unsigned long private, bool offlining,
20 bool sync);
17 21
18extern int fail_migrate_page(struct address_space *, 22extern int fail_migrate_page(struct address_space *,
19 struct page *, struct page *); 23 struct page *, struct page *);
@@ -23,12 +27,19 @@ extern int migrate_prep_local(void);
23extern int migrate_vmas(struct mm_struct *mm, 27extern int migrate_vmas(struct mm_struct *mm,
24 const nodemask_t *from, const nodemask_t *to, 28 const nodemask_t *from, const nodemask_t *to,
25 unsigned long flags); 29 unsigned long flags);
30extern void migrate_page_copy(struct page *newpage, struct page *page);
31extern int migrate_huge_page_move_mapping(struct address_space *mapping,
32 struct page *newpage, struct page *page);
26#else 33#else
27#define PAGE_MIGRATION 0 34#define PAGE_MIGRATION 0
28 35
29static inline void putback_lru_pages(struct list_head *l) {} 36static inline void putback_lru_pages(struct list_head *l) {}
30static inline int migrate_pages(struct list_head *l, new_page_t x, 37static inline int migrate_pages(struct list_head *l, new_page_t x,
31 unsigned long private, int offlining) { return -ENOSYS; } 38 unsigned long private, bool offlining,
39 bool sync) { return -ENOSYS; }
40static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
41 unsigned long private, bool offlining,
42 bool sync) { return -ENOSYS; }
32 43
33static inline int migrate_prep(void) { return -ENOSYS; } 44static inline int migrate_prep(void) { return -ENOSYS; }
34static inline int migrate_prep_local(void) { return -ENOSYS; } 45static inline int migrate_prep_local(void) { return -ENOSYS; }
@@ -40,6 +51,15 @@ static inline int migrate_vmas(struct mm_struct *mm,
40 return -ENOSYS; 51 return -ENOSYS;
41} 52}
42 53
54static inline void migrate_page_copy(struct page *newpage,
55 struct page *page) {}
56
57static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
58 struct page *newpage, struct page *page)
59{
60 return -ENOSYS;
61}
62
43/* Possible settings for the migrate_page() method in address_operations */ 63/* Possible settings for the migrate_page() method in address_operations */
44#define migrate_page NULL 64#define migrate_page NULL
45#define fail_migrate_page NULL 65#define fail_migrate_page NULL
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 78a1b9671752..9a18667c13cc 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -58,6 +58,7 @@ enum {
58 MLX4_CMD_SENSE_PORT = 0x4d, 58 MLX4_CMD_SENSE_PORT = 0x4d,
59 MLX4_CMD_HW_HEALTH_CHECK = 0x50, 59 MLX4_CMD_HW_HEALTH_CHECK = 0x50,
60 MLX4_CMD_SET_PORT = 0xc, 60 MLX4_CMD_SET_PORT = 0xc,
61 MLX4_CMD_SET_NODE = 0x5a,
61 MLX4_CMD_ACCESS_DDR = 0x2e, 62 MLX4_CMD_ACCESS_DDR = 0x2e,
62 MLX4_CMD_MAP_ICM = 0xffa, 63 MLX4_CMD_MAP_ICM = 0xffa,
63 MLX4_CMD_UNMAP_ICM = 0xff9, 64 MLX4_CMD_UNMAP_ICM = 0xff9,
@@ -141,6 +142,7 @@ enum {
141 MLX4_SET_PORT_MAC_TABLE = 0x2, 142 MLX4_SET_PORT_MAC_TABLE = 0x2,
142 MLX4_SET_PORT_VLAN_TABLE = 0x3, 143 MLX4_SET_PORT_VLAN_TABLE = 0x3,
143 MLX4_SET_PORT_PRIO_MAP = 0x4, 144 MLX4_SET_PORT_PRIO_MAP = 0x4,
145 MLX4_SET_PORT_GID_TABLE = 0x5,
144}; 146};
145 147
146struct mlx4_dev; 148struct mlx4_dev;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 7338654c02b4..8985768e2c0d 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -39,6 +39,11 @@
39 39
40#include <asm/atomic.h> 40#include <asm/atomic.h>
41 41
42#define MAX_MSIX_P_PORT 17
43#define MAX_MSIX 64
44#define MSIX_LEGACY_SZ 4
45#define MIN_MSIX_P_PORT 5
46
42enum { 47enum {
43 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
44 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -67,7 +72,8 @@ enum {
67 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, 72 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18,
68 MLX4_DEV_CAP_FLAG_RAW_MCAST = 1 << 19, 73 MLX4_DEV_CAP_FLAG_RAW_MCAST = 1 << 19,
69 MLX4_DEV_CAP_FLAG_UD_AV_PORT = 1 << 20, 74 MLX4_DEV_CAP_FLAG_UD_AV_PORT = 1 << 20,
70 MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21 75 MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21,
76 MLX4_DEV_CAP_FLAG_IBOE = 1 << 30
71}; 77};
72 78
73enum { 79enum {
@@ -143,6 +149,13 @@ enum {
143 MLX4_STAT_RATE_OFFSET = 5 149 MLX4_STAT_RATE_OFFSET = 5
144}; 150};
145 151
152enum mlx4_protocol {
153 MLX4_PROT_IB_IPV6 = 0,
154 MLX4_PROT_ETH,
155 MLX4_PROT_IB_IPV4,
156 MLX4_PROT_FCOE
157};
158
146enum { 159enum {
147 MLX4_MTT_FLAG_PRESENT = 1 160 MLX4_MTT_FLAG_PRESENT = 1
148}; 161};
@@ -167,10 +180,20 @@ enum mlx4_special_vlan_idx {
167 MLX4_VLAN_REGULAR 180 MLX4_VLAN_REGULAR
168}; 181};
169 182
183enum mlx4_steer_type {
184 MLX4_MC_STEER = 0,
185 MLX4_UC_STEER,
186 MLX4_NUM_STEERS
187};
188
170enum { 189enum {
171 MLX4_NUM_FEXCH = 64 * 1024, 190 MLX4_NUM_FEXCH = 64 * 1024,
172}; 191};
173 192
193enum {
194 MLX4_MAX_FAST_REG_PAGES = 511,
195};
196
174static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 197static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
175{ 198{
176 return (major << 32) | (minor << 16) | subminor; 199 return (major << 32) | (minor << 16) | subminor;
@@ -213,6 +236,7 @@ struct mlx4_caps {
213 int num_eqs; 236 int num_eqs;
214 int reserved_eqs; 237 int reserved_eqs;
215 int num_comp_vectors; 238 int num_comp_vectors;
239 int comp_pool;
216 int num_mpts; 240 int num_mpts;
217 int num_mtt_segs; 241 int num_mtt_segs;
218 int mtts_per_seg; 242 int mtts_per_seg;
@@ -235,6 +259,9 @@ struct mlx4_caps {
235 u16 stat_rate_support; 259 u16 stat_rate_support;
236 int udp_rss; 260 int udp_rss;
237 int loopback_support; 261 int loopback_support;
262 int vep_uc_steering;
263 int vep_mc_steering;
264 int wol;
238 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 265 u8 port_width_cap[MLX4_MAX_PORTS + 1];
239 int max_gso_sz; 266 int max_gso_sz;
240 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 267 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
@@ -324,6 +351,17 @@ struct mlx4_fmr {
324struct mlx4_uar { 351struct mlx4_uar {
325 unsigned long pfn; 352 unsigned long pfn;
326 int index; 353 int index;
354 struct list_head bf_list;
355 unsigned free_bf_bmap;
356 void __iomem *map;
357 void __iomem *bf_map;
358};
359
360struct mlx4_bf {
361 unsigned long offset;
362 int buf_size;
363 struct mlx4_uar *uar;
364 void __iomem *reg;
327}; 365};
328 366
329struct mlx4_cq { 367struct mlx4_cq {
@@ -379,12 +417,33 @@ struct mlx4_av {
379 u8 dgid[16]; 417 u8 dgid[16];
380}; 418};
381 419
420struct mlx4_eth_av {
421 __be32 port_pd;
422 u8 reserved1;
423 u8 smac_idx;
424 u16 reserved2;
425 u8 reserved3;
426 u8 gid_index;
427 u8 stat_rate;
428 u8 hop_limit;
429 __be32 sl_tclass_flowlabel;
430 u8 dgid[16];
431 u32 reserved4[2];
432 __be16 vlan;
433 u8 mac[6];
434};
435
436union mlx4_ext_av {
437 struct mlx4_av ib;
438 struct mlx4_eth_av eth;
439};
440
382struct mlx4_dev { 441struct mlx4_dev {
383 struct pci_dev *pdev; 442 struct pci_dev *pdev;
384 unsigned long flags; 443 unsigned long flags;
385 struct mlx4_caps caps; 444 struct mlx4_caps caps;
386 struct radix_tree_root qp_table_tree; 445 struct radix_tree_root qp_table_tree;
387 u32 rev_id; 446 u8 rev_id;
388 char board_id[MLX4_BOARD_ID_LEN]; 447 char board_id[MLX4_BOARD_ID_LEN];
389}; 448};
390 449
@@ -407,6 +466,12 @@ struct mlx4_init_port_param {
407 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \ 466 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \
408 ~(dev)->caps.port_mask) & 1 << ((port) - 1)) 467 ~(dev)->caps.port_mask) & 1 << ((port) - 1))
409 468
469#define mlx4_foreach_ib_transport_port(port, dev) \
470 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
471 if (((dev)->caps.port_mask & 1 << ((port) - 1)) || \
472 ((dev)->caps.flags & MLX4_DEV_CAP_FLAG_IBOE))
473
474
410int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 475int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
411 struct mlx4_buf *buf); 476 struct mlx4_buf *buf);
412void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 477void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
@@ -424,6 +489,8 @@ void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn);
424 489
425int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 490int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar);
426void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 491void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar);
492int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf);
493void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf);
427 494
428int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 495int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
429 struct mlx4_mtt *mtt); 496 struct mlx4_mtt *mtt);
@@ -468,12 +535,20 @@ int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
468int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 535int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
469 536
470int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 537int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
471 int block_mcast_loopback); 538 int block_mcast_loopback, enum mlx4_protocol protocol);
472int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 539int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
473 540 enum mlx4_protocol protocol);
474int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index); 541int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
475void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index); 542int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
476 543int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
544int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
545int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
546
547int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap);
548void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn);
549int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap);
550
551int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
477int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 552int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
478void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 553void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
479 554
@@ -487,5 +562,10 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
487int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); 562int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
488int mlx4_SYNC_TPT(struct mlx4_dev *dev); 563int mlx4_SYNC_TPT(struct mlx4_dev *dev);
489int mlx4_test_interrupts(struct mlx4_dev *dev); 564int mlx4_test_interrupts(struct mlx4_dev *dev);
565int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector);
566void mlx4_release_eq(struct mlx4_dev *dev, int vec);
567
568int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);
569int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
490 570
491#endif /* MLX4_DEVICE_H */ 571#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index 53c5fdb6eac4..e1eebf78caba 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -34,6 +34,7 @@
34#define MLX4_DRIVER_H 34#define MLX4_DRIVER_H
35 35
36#include <linux/device.h> 36#include <linux/device.h>
37#include <linux/mlx4/device.h>
37 38
38struct mlx4_dev; 39struct mlx4_dev;
39 40
@@ -49,10 +50,14 @@ struct mlx4_interface {
49 void (*remove)(struct mlx4_dev *dev, void *context); 50 void (*remove)(struct mlx4_dev *dev, void *context);
50 void (*event) (struct mlx4_dev *dev, void *context, 51 void (*event) (struct mlx4_dev *dev, void *context,
51 enum mlx4_dev_event event, int port); 52 enum mlx4_dev_event event, int port);
53 void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port);
52 struct list_head list; 54 struct list_head list;
55 enum mlx4_protocol protocol;
53}; 56};
54 57
55int mlx4_register_interface(struct mlx4_interface *intf); 58int mlx4_register_interface(struct mlx4_interface *intf);
56void mlx4_unregister_interface(struct mlx4_interface *intf); 59void mlx4_unregister_interface(struct mlx4_interface *intf);
57 60
61void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
62
58#endif /* MLX4_DRIVER_H */ 63#endif /* MLX4_DRIVER_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 7abe64326f72..9e9eb21056ca 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -109,10 +109,11 @@ struct mlx4_qp_path {
109 __be32 tclass_flowlabel; 109 __be32 tclass_flowlabel;
110 u8 rgid[16]; 110 u8 rgid[16];
111 u8 sched_queue; 111 u8 sched_queue;
112 u8 snooper_flags; 112 u8 vlan_index;
113 u8 reserved3[2]; 113 u8 reserved3[2];
114 u8 counter_index; 114 u8 counter_index;
115 u8 reserved4[7]; 115 u8 reserved4;
116 u8 dmac[6];
116}; 117};
117 118
118struct mlx4_qp_context { 119struct mlx4_qp_context {
@@ -166,6 +167,7 @@ enum {
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 167 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6, 168 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
168 MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7, 169 MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
170 MLX4_WQE_CTRL_FORCE_LOOPBACK = 1 << 0,
169}; 171};
170 172
171struct mlx4_wqe_ctrl_seg { 173struct mlx4_wqe_ctrl_seg {
@@ -219,7 +221,8 @@ struct mlx4_wqe_datagram_seg {
219 __be32 av[8]; 221 __be32 av[8];
220 __be32 dqpn; 222 __be32 dqpn;
221 __be32 qkey; 223 __be32 qkey;
222 __be32 reservd[2]; 224 __be16 vlan;
225 u8 mac[6];
223}; 226};
224 227
225struct mlx4_wqe_lso_seg { 228struct mlx4_wqe_lso_seg {
@@ -300,6 +303,7 @@ struct mlx4_wqe_data_seg {
300 303
301enum { 304enum {
302 MLX4_INLINE_ALIGN = 64, 305 MLX4_INLINE_ALIGN = 64,
306 MLX4_INLINE_SEG = 1 << 31,
303}; 307};
304 308
305struct mlx4_wqe_inline_seg { 309struct mlx4_wqe_inline_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7687228dd3b7..6507dde38b16 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -14,6 +14,7 @@
14#include <linux/mm_types.h> 14#include <linux/mm_types.h>
15#include <linux/range.h> 15#include <linux/range.h>
16#include <linux/pfn.h> 16#include <linux/pfn.h>
17#include <linux/bit_spinlock.h>
17 18
18struct mempolicy; 19struct mempolicy;
19struct anon_vma; 20struct anon_vma;
@@ -82,6 +83,7 @@ extern unsigned int kobjsize(const void *objp);
82#define VM_GROWSUP 0x00000200 83#define VM_GROWSUP 0x00000200
83#else 84#else
84#define VM_GROWSUP 0x00000000 85#define VM_GROWSUP 0x00000000
86#define VM_NOHUGEPAGE 0x00000200 /* MADV_NOHUGEPAGE marked this vma */
85#endif 87#endif
86#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 88#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
87#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 89#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
@@ -101,7 +103,11 @@ extern unsigned int kobjsize(const void *objp);
101#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ 103#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
102#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 104#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
103#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 105#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
106#ifndef CONFIG_TRANSPARENT_HUGEPAGE
104#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 107#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */
108#else
109#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
110#endif
105#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 111#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
106#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 112#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
107 113
@@ -131,7 +137,8 @@ extern unsigned int kobjsize(const void *objp);
131#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) 137#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
132 138
133/* 139/*
134 * special vmas that are non-mergable, non-mlock()able 140 * Special vmas that are non-mergable, non-mlock()able.
141 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
135 */ 142 */
136#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) 143#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)
137 144
@@ -144,6 +151,8 @@ extern pgprot_t protection_map[16];
144#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 151#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
145#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 152#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
146#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ 153#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
154#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
155#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
147 156
148/* 157/*
149 * This interface is used by x86 PAT code to identify a pfn mapping that is 158 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -241,6 +250,7 @@ struct inode;
241 * files which need it (119 of them) 250 * files which need it (119 of them)
242 */ 251 */
243#include <linux/page-flags.h> 252#include <linux/page-flags.h>
253#include <linux/huge_mm.h>
244 254
245/* 255/*
246 * Methods to modify the page usage count. 256 * Methods to modify the page usage count.
@@ -304,6 +314,39 @@ static inline int is_vmalloc_or_module_addr(const void *x)
304} 314}
305#endif 315#endif
306 316
317static inline void compound_lock(struct page *page)
318{
319#ifdef CONFIG_TRANSPARENT_HUGEPAGE
320 bit_spin_lock(PG_compound_lock, &page->flags);
321#endif
322}
323
324static inline void compound_unlock(struct page *page)
325{
326#ifdef CONFIG_TRANSPARENT_HUGEPAGE
327 bit_spin_unlock(PG_compound_lock, &page->flags);
328#endif
329}
330
331static inline unsigned long compound_lock_irqsave(struct page *page)
332{
333 unsigned long uninitialized_var(flags);
334#ifdef CONFIG_TRANSPARENT_HUGEPAGE
335 local_irq_save(flags);
336 compound_lock(page);
337#endif
338 return flags;
339}
340
341static inline void compound_unlock_irqrestore(struct page *page,
342 unsigned long flags)
343{
344#ifdef CONFIG_TRANSPARENT_HUGEPAGE
345 compound_unlock(page);
346 local_irq_restore(flags);
347#endif
348}
349
307static inline struct page *compound_head(struct page *page) 350static inline struct page *compound_head(struct page *page)
308{ 351{
309 if (unlikely(PageTail(page))) 352 if (unlikely(PageTail(page)))
@@ -318,9 +361,29 @@ static inline int page_count(struct page *page)
318 361
319static inline void get_page(struct page *page) 362static inline void get_page(struct page *page)
320{ 363{
321 page = compound_head(page); 364 /*
322 VM_BUG_ON(atomic_read(&page->_count) == 0); 365 * Getting a normal page or the head of a compound page
366 * requires to already have an elevated page->_count. Only if
367 * we're getting a tail page, the elevated page->_count is
368 * required only in the head page, so for tail pages the
369 * bugcheck only verifies that the page->_count isn't
370 * negative.
371 */
372 VM_BUG_ON(atomic_read(&page->_count) < !PageTail(page));
323 atomic_inc(&page->_count); 373 atomic_inc(&page->_count);
374 /*
375 * Getting a tail page will elevate both the head and tail
376 * page->_count(s).
377 */
378 if (unlikely(PageTail(page))) {
379 /*
380 * This is safe only because
381 * __split_huge_page_refcount can't run under
382 * get_page().
383 */
384 VM_BUG_ON(atomic_read(&page->first_page->_count) <= 0);
385 atomic_inc(&page->first_page->_count);
386 }
324} 387}
325 388
326static inline struct page *virt_to_head_page(const void *x) 389static inline struct page *virt_to_head_page(const void *x)
@@ -338,6 +401,34 @@ static inline void init_page_count(struct page *page)
338 atomic_set(&page->_count, 1); 401 atomic_set(&page->_count, 1);
339} 402}
340 403
404/*
405 * PageBuddy() indicate that the page is free and in the buddy system
406 * (see mm/page_alloc.c).
407 *
408 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
409 * -2 so that an underflow of the page_mapcount() won't be mistaken
410 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
411 * efficiently by most CPU architectures.
412 */
413#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
414
415static inline int PageBuddy(struct page *page)
416{
417 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
418}
419
420static inline void __SetPageBuddy(struct page *page)
421{
422 VM_BUG_ON(atomic_read(&page->_mapcount) != -1);
423 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
424}
425
426static inline void __ClearPageBuddy(struct page *page)
427{
428 VM_BUG_ON(!PageBuddy(page));
429 atomic_set(&page->_mapcount, -1);
430}
431
341void put_page(struct page *page); 432void put_page(struct page *page);
342void put_pages_list(struct list_head *pages); 433void put_pages_list(struct list_head *pages);
343 434
@@ -369,11 +460,40 @@ static inline int compound_order(struct page *page)
369 return (unsigned long)page[1].lru.prev; 460 return (unsigned long)page[1].lru.prev;
370} 461}
371 462
463static inline int compound_trans_order(struct page *page)
464{
465 int order;
466 unsigned long flags;
467
468 if (!PageHead(page))
469 return 0;
470
471 flags = compound_lock_irqsave(page);
472 order = compound_order(page);
473 compound_unlock_irqrestore(page, flags);
474 return order;
475}
476
372static inline void set_compound_order(struct page *page, unsigned long order) 477static inline void set_compound_order(struct page *page, unsigned long order)
373{ 478{
374 page[1].lru.prev = (void *)order; 479 page[1].lru.prev = (void *)order;
375} 480}
376 481
482#ifdef CONFIG_MMU
483/*
484 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when
485 * servicing faults for write access. In the normal case, do always want
486 * pte_mkwrite. But get_user_pages can cause write faults for mappings
487 * that do not have writing enabled, when used by access_process_vm.
488 */
489static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
490{
491 if (likely(vma->vm_flags & VM_WRITE))
492 pte = pte_mkwrite(pte);
493 return pte;
494}
495#endif
496
377/* 497/*
378 * Multiple processes may "see" the same page. E.g. for untouched 498 * Multiple processes may "see" the same page. E.g. for untouched
379 * mappings of /dev/null, all processes see the same page full of 499 * mappings of /dev/null, all processes see the same page full of
@@ -489,7 +609,7 @@ static inline void set_compound_order(struct page *page, unsigned long order)
489#endif 609#endif
490 610
491/* 611/*
492 * Define the bit shifts to access each section. For non-existant 612 * Define the bit shifts to access each section. For non-existent
493 * sections we define the shift as 0; that plus a 0 mask ensures 613 * sections we define the shift as 0; that plus a 0 mask ensures
494 * the compiler will optimise away reference to them. 614 * the compiler will optimise away reference to them.
495 */ 615 */
@@ -497,8 +617,8 @@ static inline void set_compound_order(struct page *page, unsigned long order)
497#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 617#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
498#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 618#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
499 619
500/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */ 620/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
501#ifdef NODE_NOT_IN_PAGEFLAGS 621#ifdef NODE_NOT_IN_PAGE_FLAGS
502#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) 622#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
503#define ZONEID_PGOFF ((SECTIONS_PGOFF < ZONES_PGOFF)? \ 623#define ZONEID_PGOFF ((SECTIONS_PGOFF < ZONES_PGOFF)? \
504 SECTIONS_PGOFF : ZONES_PGOFF) 624 SECTIONS_PGOFF : ZONES_PGOFF)
@@ -656,7 +776,7 @@ static inline struct address_space *page_mapping(struct page *page)
656 VM_BUG_ON(PageSlab(page)); 776 VM_BUG_ON(PageSlab(page));
657 if (unlikely(PageSwapCache(page))) 777 if (unlikely(PageSwapCache(page)))
658 mapping = &swapper_space; 778 mapping = &swapper_space;
659 else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) 779 else if ((unsigned long)mapping & PAGE_MAPPING_ANON)
660 mapping = NULL; 780 mapping = NULL;
661 return mapping; 781 return mapping;
662} 782}
@@ -718,12 +838,21 @@ static inline int page_mapped(struct page *page)
718#define VM_FAULT_SIGBUS 0x0002 838#define VM_FAULT_SIGBUS 0x0002
719#define VM_FAULT_MAJOR 0x0004 839#define VM_FAULT_MAJOR 0x0004
720#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ 840#define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */
721#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned page */ 841#define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned small page */
842#define VM_FAULT_HWPOISON_LARGE 0x0020 /* Hit poisoned large page. Index encoded in upper bits */
722 843
723#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 844#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
724#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 845#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
846#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */
725 847
726#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON) 848#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
849
850#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
851 VM_FAULT_HWPOISON_LARGE)
852
853/* Encode hstate index for a hwpoisoned large page */
854#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
855#define VM_FAULT_GET_HINDEX(x) (((x) >> 12) & 0xf)
727 856
728/* 857/*
729 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. 858 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
@@ -732,7 +861,14 @@ extern void pagefault_out_of_memory(void);
732 861
733#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 862#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
734 863
864/*
865 * Flags passed to show_mem() and __show_free_areas() to suppress output in
866 * various contexts.
867 */
868#define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */
869
735extern void show_free_areas(void); 870extern void show_free_areas(void);
871extern void __show_free_areas(unsigned int flags);
736 872
737int shmem_lock(struct file *file, int lock, struct user_struct *user); 873int shmem_lock(struct file *file, int lock, struct user_struct *user);
738struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 874struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
@@ -779,6 +915,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
779 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry 915 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry
780 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry 916 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
781 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry 917 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
918 * this handler is required to be able to handle
919 * pmd_trans_huge() pmds. They may simply choose to
920 * split_huge_page() instead of handling it explicitly.
782 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry 921 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
783 * @pte_hole: if set, called for each hole at all levels 922 * @pte_hole: if set, called for each hole at all levels
784 * @hugetlb_entry: if set, called for each hugetlb entry 923 * @hugetlb_entry: if set, called for each hugetlb entry
@@ -844,7 +983,13 @@ static inline int handle_mm_fault(struct mm_struct *mm,
844 983
845extern int make_pages_present(unsigned long addr, unsigned long end); 984extern int make_pages_present(unsigned long addr, unsigned long end);
846extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 985extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
986extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
987 void *buf, int len, int write);
847 988
989int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
990 unsigned long start, int len, unsigned int foll_flags,
991 struct page **pages, struct vm_area_struct **vmas,
992 int *nonblocking);
848int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 993int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
849 unsigned long start, int nr_pages, int write, int force, 994 unsigned long start, int nr_pages, int write, int force,
850 struct page **pages, struct vm_area_struct **vmas); 995 struct page **pages, struct vm_area_struct **vmas);
@@ -860,16 +1005,39 @@ int __set_page_dirty_no_writeback(struct page *page);
860int redirty_page_for_writepage(struct writeback_control *wbc, 1005int redirty_page_for_writepage(struct writeback_control *wbc,
861 struct page *page); 1006 struct page *page);
862void account_page_dirtied(struct page *page, struct address_space *mapping); 1007void account_page_dirtied(struct page *page, struct address_space *mapping);
1008void account_page_writeback(struct page *page);
863int set_page_dirty(struct page *page); 1009int set_page_dirty(struct page *page);
864int set_page_dirty_lock(struct page *page); 1010int set_page_dirty_lock(struct page *page);
865int clear_page_dirty_for_io(struct page *page); 1011int clear_page_dirty_for_io(struct page *page);
866 1012
867/* Is the vma a continuation of the stack vma above it? */ 1013/* Is the vma a continuation of the stack vma above it? */
868static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr) 1014static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
869{ 1015{
870 return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); 1016 return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);
871} 1017}
872 1018
1019static inline int stack_guard_page_start(struct vm_area_struct *vma,
1020 unsigned long addr)
1021{
1022 return (vma->vm_flags & VM_GROWSDOWN) &&
1023 (vma->vm_start == addr) &&
1024 !vma_growsdown(vma->vm_prev, addr);
1025}
1026
1027/* Is the vma a continuation of the stack vma below it? */
1028static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr)
1029{
1030 return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP);
1031}
1032
1033static inline int stack_guard_page_end(struct vm_area_struct *vma,
1034 unsigned long addr)
1035{
1036 return (vma->vm_flags & VM_GROWSUP) &&
1037 (vma->vm_end == addr) &&
1038 !vma_growsup(vma->vm_next, addr);
1039}
1040
873extern unsigned long move_page_tables(struct vm_area_struct *vma, 1041extern unsigned long move_page_tables(struct vm_area_struct *vma,
874 unsigned long old_addr, struct vm_area_struct *new_vma, 1042 unsigned long old_addr, struct vm_area_struct *new_vma,
875 unsigned long new_addr, unsigned long len); 1043 unsigned long new_addr, unsigned long len);
@@ -1023,7 +1191,15 @@ extern void unregister_shrinker(struct shrinker *);
1023 1191
1024int vma_wants_writenotify(struct vm_area_struct *vma); 1192int vma_wants_writenotify(struct vm_area_struct *vma);
1025 1193
1026extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl); 1194extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
1195 spinlock_t **ptl);
1196static inline pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
1197 spinlock_t **ptl)
1198{
1199 pte_t *ptep;
1200 __cond_lock(*ptl, ptep = __get_locked_pte(mm, addr, ptl));
1201 return ptep;
1202}
1027 1203
1028#ifdef __PAGETABLE_PUD_FOLDED 1204#ifdef __PAGETABLE_PUD_FOLDED
1029static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, 1205static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
@@ -1045,7 +1221,8 @@ static inline int __pmd_alloc(struct mm_struct *mm, pud_t *pud,
1045int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); 1221int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
1046#endif 1222#endif
1047 1223
1048int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address); 1224int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
1225 pmd_t *pmd, unsigned long address);
1049int __pte_alloc_kernel(pmd_t *pmd, unsigned long address); 1226int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
1050 1227
1051/* 1228/*
@@ -1114,16 +1291,18 @@ static inline void pgtable_page_dtor(struct page *page)
1114 pte_unmap(pte); \ 1291 pte_unmap(pte); \
1115} while (0) 1292} while (0)
1116 1293
1117#define pte_alloc_map(mm, pmd, address) \ 1294#define pte_alloc_map(mm, vma, pmd, address) \
1118 ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ 1295 ((unlikely(pmd_none(*(pmd))) && __pte_alloc(mm, vma, \
1119 NULL: pte_offset_map(pmd, address)) 1296 pmd, address))? \
1297 NULL: pte_offset_map(pmd, address))
1120 1298
1121#define pte_alloc_map_lock(mm, pmd, address, ptlp) \ 1299#define pte_alloc_map_lock(mm, pmd, address, ptlp) \
1122 ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \ 1300 ((unlikely(pmd_none(*(pmd))) && __pte_alloc(mm, NULL, \
1301 pmd, address))? \
1123 NULL: pte_offset_map_lock(mm, pmd, address, ptlp)) 1302 NULL: pte_offset_map_lock(mm, pmd, address, ptlp))
1124 1303
1125#define pte_alloc_kernel(pmd, address) \ 1304#define pte_alloc_kernel(pmd, address) \
1126 ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \ 1305 ((unlikely(pmd_none(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
1127 NULL: pte_offset_kernel(pmd, address)) 1306 NULL: pte_offset_kernel(pmd, address))
1128 1307
1129extern void free_area_init(unsigned long * zones_size); 1308extern void free_area_init(unsigned long * zones_size);
@@ -1177,8 +1356,6 @@ int add_from_early_node_map(struct range *range, int az,
1177 int nr_range, int nid); 1356 int nr_range, int nid);
1178u64 __init find_memory_core_early(int nid, u64 size, u64 align, 1357u64 __init find_memory_core_early(int nid, u64 size, u64 align,
1179 u64 goal, u64 limit); 1358 u64 goal, u64 limit);
1180void *__alloc_memory_core_early(int nodeid, u64 size, u64 align,
1181 u64 goal, u64 limit);
1182typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1359typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1183extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); 1360extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1184extern void sparse_memory_present_with_active_regions(int nid); 1361extern void sparse_memory_present_with_active_regions(int nid);
@@ -1206,7 +1383,7 @@ extern void setup_per_zone_wmarks(void);
1206extern void calculate_zone_inactive_ratio(struct zone *zone); 1383extern void calculate_zone_inactive_ratio(struct zone *zone);
1207extern void mem_init(void); 1384extern void mem_init(void);
1208extern void __init mmap_init(void); 1385extern void __init mmap_init(void);
1209extern void show_mem(void); 1386extern void show_mem(unsigned int flags);
1210extern void si_meminfo(struct sysinfo * val); 1387extern void si_meminfo(struct sysinfo * val);
1211extern void si_meminfo_node(struct sysinfo *val, int nid); 1388extern void si_meminfo_node(struct sysinfo *val, int nid);
1212extern int after_bootmem; 1389extern int after_bootmem;
@@ -1396,6 +1573,11 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1396#define FOLL_GET 0x04 /* do get_page on page */ 1573#define FOLL_GET 0x04 /* do get_page on page */
1397#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ 1574#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1398#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 1575#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1576#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
1577 * and return without waiting upon it */
1578#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1579#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1580#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1399 1581
1400typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1582typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1401 void *data); 1583 void *data);
@@ -1434,13 +1616,13 @@ static inline bool kernel_page_present(struct page *page) { return true; }
1434#endif /* CONFIG_HIBERNATION */ 1616#endif /* CONFIG_HIBERNATION */
1435#endif 1617#endif
1436 1618
1437extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1619extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
1438#ifdef __HAVE_ARCH_GATE_AREA 1620#ifdef __HAVE_ARCH_GATE_AREA
1439int in_gate_area_no_task(unsigned long addr); 1621int in_gate_area_no_mm(unsigned long addr);
1440int in_gate_area(struct task_struct *task, unsigned long addr); 1622int in_gate_area(struct mm_struct *mm, unsigned long addr);
1441#else 1623#else
1442int in_gate_area_no_task(unsigned long addr); 1624int in_gate_area_no_mm(unsigned long addr);
1443#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1625#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})
1444#endif /* __HAVE_ARCH_GATE_AREA */ 1626#endif /* __HAVE_ARCH_GATE_AREA */
1445 1627
1446int drop_caches_sysctl_handler(struct ctl_table *, int, 1628int drop_caches_sysctl_handler(struct ctl_table *, int,
@@ -1488,16 +1670,17 @@ extern int sysctl_memory_failure_recovery;
1488extern void shake_page(struct page *p, int access); 1670extern void shake_page(struct page *p, int access);
1489extern atomic_long_t mce_bad_pages; 1671extern atomic_long_t mce_bad_pages;
1490extern int soft_offline_page(struct page *page, int flags); 1672extern int soft_offline_page(struct page *page, int flags);
1491#ifdef CONFIG_MEMORY_FAILURE
1492int is_hwpoison_address(unsigned long addr);
1493#else
1494static inline int is_hwpoison_address(unsigned long addr)
1495{
1496 return 0;
1497}
1498#endif
1499 1673
1500extern void dump_page(struct page *page); 1674extern void dump_page(struct page *page);
1501 1675
1676#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
1677extern void clear_huge_page(struct page *page,
1678 unsigned long addr,
1679 unsigned int pages_per_huge_page);
1680extern void copy_user_huge_page(struct page *dst, struct page *src,
1681 unsigned long addr, struct vm_area_struct *vma,
1682 unsigned int pages_per_huge_page);
1683#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
1684
1502#endif /* __KERNEL__ */ 1685#endif /* __KERNEL__ */
1503#endif /* _LINUX_MM_H */ 1686#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8835b877b8db..8f7d24712dc1 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -1,6 +1,8 @@
1#ifndef LINUX_MM_INLINE_H 1#ifndef LINUX_MM_INLINE_H
2#define LINUX_MM_INLINE_H 2#define LINUX_MM_INLINE_H
3 3
4#include <linux/huge_mm.h>
5
4/** 6/**
5 * page_is_file_cache - should the page be on a file LRU or anon LRU? 7 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test 8 * @page: the page to test
@@ -20,18 +22,25 @@ static inline int page_is_file_cache(struct page *page)
20} 22}
21 23
22static inline void 24static inline void
23add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) 25__add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l,
26 struct list_head *head)
24{ 27{
25 list_add(&page->lru, &zone->lru[l].list); 28 list_add(&page->lru, head);
26 __inc_zone_state(zone, NR_LRU_BASE + l); 29 __mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page));
27 mem_cgroup_add_lru_list(page, l); 30 mem_cgroup_add_lru_list(page, l);
28} 31}
29 32
30static inline void 33static inline void
34add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
35{
36 __add_page_to_lru_list(zone, page, l, &zone->lru[l].list);
37}
38
39static inline void
31del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) 40del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
32{ 41{
33 list_del(&page->lru); 42 list_del(&page->lru);
34 __dec_zone_state(zone, NR_LRU_BASE + l); 43 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page));
35 mem_cgroup_del_lru_list(page, l); 44 mem_cgroup_del_lru_list(page, l);
36} 45}
37 46
@@ -66,7 +75,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
66 l += LRU_ACTIVE; 75 l += LRU_ACTIVE;
67 } 76 }
68 } 77 }
69 __dec_zone_state(zone, NR_LRU_BASE + l); 78 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page));
70 mem_cgroup_del_lru_list(page, l); 79 mem_cgroup_del_lru_list(page, l);
71} 80}
72 81
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index cb57d657ce4d..02aa5619709b 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -237,8 +237,9 @@ struct mm_struct {
237 atomic_t mm_users; /* How many users with user space? */ 237 atomic_t mm_users; /* How many users with user space? */
238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
239 int map_count; /* number of VMAs */ 239 int map_count; /* number of VMAs */
240 struct rw_semaphore mmap_sem; 240
241 spinlock_t page_table_lock; /* Protects page tables and some counters */ 241 spinlock_t page_table_lock; /* Protects page tables and some counters */
242 struct rw_semaphore mmap_sem;
242 243
243 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung 244 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung
244 * together off init_mm.mmlist, and are protected 245 * together off init_mm.mmlist, and are protected
@@ -281,6 +282,9 @@ struct mm_struct {
281 unsigned int token_priority; 282 unsigned int token_priority;
282 unsigned int last_interval; 283 unsigned int last_interval;
283 284
285 /* How many tasks sharing this mm are OOM_DISABLE */
286 atomic_t oom_disable_count;
287
284 unsigned long flags; /* Must use atomic bitops to access the bits */ 288 unsigned long flags; /* Must use atomic bitops to access the bits */
285 289
286 struct core_state *core_state; /* coredumping support */ 290 struct core_state *core_state; /* coredumping support */
@@ -310,6 +314,9 @@ struct mm_struct {
310#ifdef CONFIG_MMU_NOTIFIER 314#ifdef CONFIG_MMU_NOTIFIER
311 struct mmu_notifier_mm *mmu_notifier_mm; 315 struct mmu_notifier_mm *mmu_notifier_mm;
312#endif 316#endif
317#ifdef CONFIG_TRANSPARENT_HUGEPAGE
318 pgtable_t pmd_huge_pte; /* protected by page_table_lock */
319#endif
313}; 320};
314 321
315/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 322/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
new file mode 100644
index 000000000000..39d787c229cb
--- /dev/null
+++ b/include/linux/mmc/boot.h
@@ -0,0 +1,7 @@
1#ifndef MMC_BOOT_H
2#define MMC_BOOT_H
3
4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
6
7#endif
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6b7525099e56..adb4888248be 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -48,11 +48,15 @@ struct mmc_ext_csd {
48 unsigned int sa_timeout; /* Units: 100ns */ 48 unsigned int sa_timeout; /* Units: 100ns */
49 unsigned int hs_max_dtr; 49 unsigned int hs_max_dtr;
50 unsigned int sectors; 50 unsigned int sectors;
51 unsigned int card_type;
51 unsigned int hc_erase_size; /* In sectors */ 52 unsigned int hc_erase_size; /* In sectors */
52 unsigned int hc_erase_timeout; /* In milliseconds */ 53 unsigned int hc_erase_timeout; /* In milliseconds */
53 unsigned int sec_trim_mult; /* Secure trim multiplier */ 54 unsigned int sec_trim_mult; /* Secure trim multiplier */
54 unsigned int sec_erase_mult; /* Secure erase multiplier */ 55 unsigned int sec_erase_mult; /* Secure erase multiplier */
55 unsigned int trim_timeout; /* In milliseconds */ 56 unsigned int trim_timeout; /* In milliseconds */
57 bool enhanced_area_en; /* enable bit */
58 unsigned long long enhanced_area_offset; /* Units: Byte */
59 unsigned int enhanced_area_size; /* Units: KB */
56}; 60};
57 61
58struct sd_scr { 62struct sd_scr {
@@ -113,12 +117,14 @@ struct mmc_card {
113#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 117#define MMC_STATE_READONLY (1<<1) /* card is read-only */
114#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 118#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
115#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 119#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
120#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
116 unsigned int quirks; /* card quirks */ 121 unsigned int quirks; /* card quirks */
117#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 122#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
118#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 123#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
119 /* for byte mode */ 124 /* for byte mode */
120#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ 125#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
121 /* (missing CIA registers) */ 126 /* (missing CIA registers) */
127#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
122 128
123 unsigned int erase_size; /* erase size in sectors */ 129 unsigned int erase_size; /* erase size in sectors */
124 unsigned int erase_shift; /* if erase unit is power 2 */ 130 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -146,6 +152,8 @@ struct mmc_card {
146 struct dentry *debugfs_root; 152 struct dentry *debugfs_root;
147}; 153};
148 154
155void mmc_fixup_device(struct mmc_card *dev);
156
149#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 157#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
150#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) 158#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
151#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) 159#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO)
@@ -154,11 +162,13 @@ struct mmc_card {
154#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 162#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
155#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 163#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
156#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 164#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
165#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
157 166
158#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 167#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
159#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 168#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
160#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 169#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
161#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 170#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
171#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
162 172
163static inline int mmc_card_lenient_fn0(const struct mmc_card *c) 173static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
164{ 174{
@@ -173,6 +183,8 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
173#define mmc_card_name(c) ((c)->cid.prod_name) 183#define mmc_card_name(c) ((c)->cid.prod_name)
174#define mmc_card_id(c) (dev_name(&(c)->dev)) 184#define mmc_card_id(c) (dev_name(&(c)->dev))
175 185
186#define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev)
187
176#define mmc_list_to_card(l) container_of(l, struct mmc_card, node) 188#define mmc_list_to_card(l) container_of(l, struct mmc_card, node)
177#define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) 189#define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev)
178#define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d) 190#define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 7429033acb66..07f27af4dba5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -153,11 +153,14 @@ extern int mmc_can_secure_erase_trim(struct mmc_card *card);
153extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, 153extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
154 unsigned int nr); 154 unsigned int nr);
155 155
156extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
157
156extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); 158extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
157extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); 159extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
158 160
159extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 161extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
160extern void mmc_release_host(struct mmc_host *host); 162extern void mmc_release_host(struct mmc_host *host);
163extern void mmc_do_release_host(struct mmc_host *host);
161extern int mmc_try_claim_host(struct mmc_host *host); 164extern int mmc_try_claim_host(struct mmc_host *host);
162 165
163/** 166/**
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
new file mode 100644
index 000000000000..bdd7ceeb99e4
--- /dev/null
+++ b/include/linux/mmc/dw_mmc.h
@@ -0,0 +1,222 @@
1/*
2 * Synopsys DesignWare Multimedia Card Interface driver
3 * (Based on NXP driver for lpc 31xx)
4 *
5 * Copyright (C) 2009 NXP Semiconductors
6 * Copyright (C) 2009, 2010 Imagination Technologies Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef _LINUX_MMC_DW_MMC_H_
15#define _LINUX_MMC_DW_MMC_H_
16
17#define MAX_MCI_SLOTS 2
18
19enum dw_mci_state {
20 STATE_IDLE = 0,
21 STATE_SENDING_CMD,
22 STATE_SENDING_DATA,
23 STATE_DATA_BUSY,
24 STATE_SENDING_STOP,
25 STATE_DATA_ERROR,
26};
27
28enum {
29 EVENT_CMD_COMPLETE = 0,
30 EVENT_XFER_COMPLETE,
31 EVENT_DATA_COMPLETE,
32 EVENT_DATA_ERROR,
33 EVENT_XFER_ERROR
34};
35
36struct mmc_data;
37
38/**
39 * struct dw_mci - MMC controller state shared between all slots
40 * @lock: Spinlock protecting the queue and associated data.
41 * @regs: Pointer to MMIO registers.
42 * @sg: Scatterlist entry currently being processed by PIO code, if any.
43 * @pio_offset: Offset into the current scatterlist entry.
44 * @cur_slot: The slot which is currently using the controller.
45 * @mrq: The request currently being processed on @cur_slot,
46 * or NULL if the controller is idle.
47 * @cmd: The command currently being sent to the card, or NULL.
48 * @data: The data currently being transferred, or NULL if no data
49 * transfer is in progress.
50 * @use_dma: Whether DMA channel is initialized or not.
51 * @sg_dma: Bus address of DMA buffer.
52 * @sg_cpu: Virtual address of DMA buffer.
53 * @dma_ops: Pointer to platform-specific DMA callbacks.
54 * @cmd_status: Snapshot of SR taken upon completion of the current
55 * command. Only valid when EVENT_CMD_COMPLETE is pending.
56 * @data_status: Snapshot of SR taken upon completion of the current
57 * data transfer. Only valid when EVENT_DATA_COMPLETE or
58 * EVENT_DATA_ERROR is pending.
59 * @stop_cmdr: Value to be loaded into CMDR when the stop command is
60 * to be sent.
61 * @dir_status: Direction of current transfer.
62 * @tasklet: Tasklet running the request state machine.
63 * @card_tasklet: Tasklet handling card detect.
64 * @pending_events: Bitmask of events flagged by the interrupt handler
65 * to be processed by the tasklet.
66 * @completed_events: Bitmask of events which the state machine has
67 * processed.
68 * @state: Tasklet state.
69 * @queue: List of slots waiting for access to the controller.
70 * @bus_hz: The rate of @mck in Hz. This forms the basis for MMC bus
71 * rate and timeout calculations.
72 * @current_speed: Configured rate of the controller.
73 * @num_slots: Number of slots available.
74 * @pdev: Platform device associated with the MMC controller.
75 * @pdata: Platform data associated with the MMC controller.
76 * @slot: Slots sharing this MMC controller.
77 * @data_shift: log2 of FIFO item size.
78 * @push_data: Pointer to FIFO push function.
79 * @pull_data: Pointer to FIFO pull function.
80 * @quirks: Set of quirks that apply to specific versions of the IP.
81 *
82 * Locking
83 * =======
84 *
85 * @lock is a softirq-safe spinlock protecting @queue as well as
86 * @cur_slot, @mrq and @state. These must always be updated
87 * at the same time while holding @lock.
88 *
89 * The @mrq field of struct dw_mci_slot is also protected by @lock,
90 * and must always be written at the same time as the slot is added to
91 * @queue.
92 *
93 * @pending_events and @completed_events are accessed using atomic bit
94 * operations, so they don't need any locking.
95 *
96 * None of the fields touched by the interrupt handler need any
97 * locking. However, ordering is important: Before EVENT_DATA_ERROR or
98 * EVENT_DATA_COMPLETE is set in @pending_events, all data-related
99 * interrupts must be disabled and @data_status updated with a
100 * snapshot of SR. Similarly, before EVENT_CMD_COMPLETE is set, the
101 * CMDRDY interrupt must be disabled and @cmd_status updated with a
102 * snapshot of SR, and before EVENT_XFER_COMPLETE can be set, the
103 * bytes_xfered field of @data must be written. This is ensured by
104 * using barriers.
105 */
106struct dw_mci {
107 spinlock_t lock;
108 void __iomem *regs;
109
110 struct scatterlist *sg;
111 unsigned int pio_offset;
112
113 struct dw_mci_slot *cur_slot;
114 struct mmc_request *mrq;
115 struct mmc_command *cmd;
116 struct mmc_data *data;
117
118 /* DMA interface members*/
119 int use_dma;
120
121 dma_addr_t sg_dma;
122 void *sg_cpu;
123 struct dw_mci_dma_ops *dma_ops;
124#ifdef CONFIG_MMC_DW_IDMAC
125 unsigned int ring_size;
126#else
127 struct dw_mci_dma_data *dma_data;
128#endif
129 u32 cmd_status;
130 u32 data_status;
131 u32 stop_cmdr;
132 u32 dir_status;
133 struct tasklet_struct tasklet;
134 struct tasklet_struct card_tasklet;
135 unsigned long pending_events;
136 unsigned long completed_events;
137 enum dw_mci_state state;
138 struct list_head queue;
139
140 u32 bus_hz;
141 u32 current_speed;
142 u32 num_slots;
143 u32 fifoth_val;
144 struct platform_device *pdev;
145 struct dw_mci_board *pdata;
146 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
147
148 /* FIFO push and pull */
149 int data_shift;
150 void (*push_data)(struct dw_mci *host, void *buf, int cnt);
151 void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
152
153 /* Workaround flags */
154 u32 quirks;
155
156 struct regulator *vmmc; /* Power regulator */
157};
158
159/* DMA ops for Internal/External DMAC interface */
160struct dw_mci_dma_ops {
161 /* DMA Ops */
162 int (*init)(struct dw_mci *host);
163 void (*start)(struct dw_mci *host, unsigned int sg_len);
164 void (*complete)(struct dw_mci *host);
165 void (*stop)(struct dw_mci *host);
166 void (*cleanup)(struct dw_mci *host);
167 void (*exit)(struct dw_mci *host);
168};
169
170/* IP Quirks/flags. */
171/* DTO fix for command transmission with IDMAC configured */
172#define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
173/* delay needed between retries on some 2.11a implementations */
174#define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
175/* High Speed Capable - Supports HS cards (up to 50MHz) */
176#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
177/* Unreliable card detection */
178#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
179
180
181struct dma_pdata;
182
183struct block_settings {
184 unsigned short max_segs; /* see blk_queue_max_segments */
185 unsigned int max_blk_size; /* maximum size of one mmc block */
186 unsigned int max_blk_count; /* maximum number of blocks in one req*/
187 unsigned int max_req_size; /* maximum number of bytes in one req*/
188 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
189};
190
191/* Board platform data */
192struct dw_mci_board {
193 u32 num_slots;
194
195 u32 quirks; /* Workaround / Quirk flags */
196 unsigned int bus_hz; /* Bus speed */
197
198 unsigned int caps; /* Capabilities */
199
200 /* delay in mS before detecting cards after interrupt */
201 u32 detect_delay_ms;
202
203 int (*init)(u32 slot_id, irq_handler_t , void *);
204 int (*get_ro)(u32 slot_id);
205 int (*get_cd)(u32 slot_id);
206 int (*get_ocr)(u32 slot_id);
207 int (*get_bus_wd)(u32 slot_id);
208 /*
209 * Enable power to selected slot and set voltage to desired level.
210 * Voltage levels are specified using MMC_VDD_xxx defines defined
211 * in linux/mmc/host.h file.
212 */
213 void (*setpower)(u32 slot_id, u32 volt);
214 void (*exit)(u32 slot_id);
215 void (*select_slot)(u32 slot_id);
216
217 struct dw_mci_dma_ops *dma_ops;
218 struct dma_pdata *data;
219 struct block_settings *blk_settings;
220};
221
222#endif /* _LINUX_MMC_DW_MMC_H_ */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1575b52c3bfa..bcb793ec7374 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -50,6 +50,12 @@ struct mmc_ios {
50#define MMC_TIMING_LEGACY 0 50#define MMC_TIMING_LEGACY 0
51#define MMC_TIMING_MMC_HS 1 51#define MMC_TIMING_MMC_HS 1
52#define MMC_TIMING_SD_HS 2 52#define MMC_TIMING_SD_HS 2
53
54 unsigned char ddr; /* dual data rate used */
55
56#define MMC_SDR_MODE 0
57#define MMC_1_2V_DDR_MODE 1
58#define MMC_1_8V_DDR_MODE 2
53}; 59};
54 60
55struct mmc_host_ops { 61struct mmc_host_ops {
@@ -123,7 +129,11 @@ struct mmc_host {
123 const struct mmc_host_ops *ops; 129 const struct mmc_host_ops *ops;
124 unsigned int f_min; 130 unsigned int f_min;
125 unsigned int f_max; 131 unsigned int f_max;
132 unsigned int f_init;
126 u32 ocr_avail; 133 u32 ocr_avail;
134 u32 ocr_avail_sdio; /* SDIO-specific OCR */
135 u32 ocr_avail_sd; /* SD-specific OCR */
136 u32 ocr_avail_mmc; /* MMC-specific OCR */
127 struct notifier_block pm_notify; 137 struct notifier_block pm_notify;
128 138
129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 139#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
@@ -157,13 +167,28 @@ struct mmc_host {
157#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 167#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
158#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 168#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
159#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 169#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
170#define MMC_CAP_1_8V_DDR (1 << 11) /* can support */
171 /* DDR mode at 1.8V */
172#define MMC_CAP_1_2V_DDR (1 << 12) /* can support */
173 /* DDR mode at 1.2V */
174#define MMC_CAP_POWER_OFF_CARD (1 << 13) /* Can power off after boot */
175#define MMC_CAP_BUS_WIDTH_TEST (1 << 14) /* CMD14/CMD19 bus width ok */
160 176
161 mmc_pm_flag_t pm_caps; /* supported pm features */ 177 mmc_pm_flag_t pm_caps; /* supported pm features */
162 178
179#ifdef CONFIG_MMC_CLKGATE
180 int clk_requests; /* internal reference counter */
181 unsigned int clk_delay; /* number of MCI clk hold cycles */
182 bool clk_gated; /* clock gated */
183 struct work_struct clk_gate_work; /* delayed clock gate */
184 unsigned int clk_old; /* old clock value cache */
185 spinlock_t clk_lock; /* lock for clk fields */
186 struct mutex clk_gate_mutex; /* mutex for clock gating */
187#endif
188
163 /* host specific block data */ 189 /* host specific block data */
164 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 190 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
165 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ 191 unsigned short max_segs; /* see blk_queue_max_segments */
166 unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
167 unsigned short unused; 192 unsigned short unused;
168 unsigned int max_req_size; /* maximum number of bytes in one req */ 193 unsigned int max_req_size; /* maximum number of bytes in one req */
169 unsigned int max_blk_size; /* maximum size of one mmc block */ 194 unsigned int max_blk_size; /* maximum size of one mmc block */
@@ -212,6 +237,10 @@ struct mmc_host {
212 struct led_trigger *led; /* activity led */ 237 struct led_trigger *led; /* activity led */
213#endif 238#endif
214 239
240#ifdef CONFIG_REGULATOR
241 bool regulator_enabled; /* regulator state */
242#endif
243
215 struct dentry *debugfs_root; 244 struct dentry *debugfs_root;
216 245
217 unsigned long private[0] ____cacheline_aligned; 246 unsigned long private[0] ____cacheline_aligned;
@@ -236,8 +265,8 @@ static inline void *mmc_priv(struct mmc_host *host)
236extern int mmc_suspend_host(struct mmc_host *); 265extern int mmc_suspend_host(struct mmc_host *);
237extern int mmc_resume_host(struct mmc_host *); 266extern int mmc_resume_host(struct mmc_host *);
238 267
239extern void mmc_power_save_host(struct mmc_host *host); 268extern int mmc_power_save_host(struct mmc_host *host);
240extern void mmc_power_restore_host(struct mmc_host *host); 269extern int mmc_power_restore_host(struct mmc_host *host);
241 270
242extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 271extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
243extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 272extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
@@ -250,8 +279,24 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
250 279
251struct regulator; 280struct regulator;
252 281
282#ifdef CONFIG_REGULATOR
253int mmc_regulator_get_ocrmask(struct regulator *supply); 283int mmc_regulator_get_ocrmask(struct regulator *supply);
254int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); 284int mmc_regulator_set_ocr(struct mmc_host *mmc,
285 struct regulator *supply,
286 unsigned short vdd_bit);
287#else
288static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
289{
290 return 0;
291}
292
293static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
294 struct regulator *supply,
295 unsigned short vdd_bit)
296{
297 return 0;
298}
299#endif
255 300
256int mmc_card_awake(struct mmc_host *host); 301int mmc_card_awake(struct mmc_host *host);
257int mmc_card_sleep(struct mmc_host *host); 302int mmc_card_sleep(struct mmc_host *host);
@@ -268,5 +313,18 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
268 host->disable_delay = disable_delay; 313 host->disable_delay = disable_delay;
269} 314}
270 315
316/* Module parameter */
317extern int mmc_assume_removable;
318
319static inline int mmc_card_is_removable(struct mmc_host *host)
320{
321 return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
322}
323
324static inline int mmc_card_is_powered_resumed(struct mmc_host *host)
325{
326 return host->pm_flags & MMC_PM_KEEP_POWER;
327}
328
271#endif 329#endif
272 330
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index dd11ae51fb68..264ba5451e3b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -40,7 +40,9 @@
40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */ 41#define MMC_STOP_TRANSMISSION 12 /* ac R1b */
42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */ 42#define MMC_SEND_STATUS 13 /* ac [31:16] RCA R1 */
43#define MMC_BUS_TEST_R 14 /* adtc R1 */
43#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */ 44#define MMC_GO_INACTIVE_STATE 15 /* ac [31:16] RCA */
45#define MMC_BUS_TEST_W 19 /* adtc R1 */
44#define MMC_SPI_READ_OCR 58 /* spi spi_R3 */ 46#define MMC_SPI_READ_OCR 58 /* spi spi_R3 */
45#define MMC_SPI_CRC_ON_OFF 59 /* spi [0:0] flag spi_R1 */ 47#define MMC_SPI_CRC_ON_OFF 59 /* spi [0:0] flag spi_R1 */
46 48
@@ -251,6 +253,8 @@ struct _mmc_csd {
251 * EXT_CSD fields 253 * EXT_CSD fields
252 */ 254 */
253 255
256#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
257#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
254#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 258#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
255#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 259#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
256#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 260#define EXT_CSD_BUS_WIDTH 183 /* R/W */
@@ -260,6 +264,7 @@ struct _mmc_csd {
260#define EXT_CSD_CARD_TYPE 196 /* RO */ 264#define EXT_CSD_CARD_TYPE 196 /* RO */
261#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 265#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
262#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 266#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
267#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */
263#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ 268#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
264#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ 269#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
265#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ 270#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
@@ -277,11 +282,19 @@ struct _mmc_csd {
277 282
278#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 283#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
279#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 284#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
280#define EXT_CSD_CARD_TYPE_MASK 0x3 /* Mask out reserved and DDR bits */ 285#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */
286#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
287 /* DDR mode @1.8V or 3V I/O */
288#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
289 /* DDR mode @1.2V I/O */
290#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
291 | EXT_CSD_CARD_TYPE_DDR_1_2V)
281 292
282#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 293#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
283#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 294#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
284#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ 295#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
296#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */
297#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */
285 298
286#define EXT_CSD_SEC_ER_EN BIT(0) 299#define EXT_CSD_SEC_ER_EN BIT(0)
287#define EXT_CSD_SEC_BD_BLK_EN BIT(2) 300#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
diff --git a/include/linux/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h
index 0239bd70241e..548d59d404cb 100644
--- a/include/linux/sdhci-pltfm.h
+++ b/include/linux/mmc/sdhci-pltfm.h
@@ -28,7 +28,7 @@ struct sdhci_host;
28struct sdhci_pltfm_data { 28struct sdhci_pltfm_data {
29 struct sdhci_ops *ops; 29 struct sdhci_ops *ops;
30 unsigned int quirks; 30 unsigned int quirks;
31 int (*init)(struct sdhci_host *host); 31 int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata);
32 void (*exit)(struct sdhci_host *host); 32 void (*exit)(struct sdhci_host *host);
33}; 33};
34 34
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
new file mode 100644
index 000000000000..83bd9f76709a
--- /dev/null
+++ b/include/linux/mmc/sdhci.h
@@ -0,0 +1,150 @@
1/*
2 * linux/include/linux/mmc/sdhci.h - Secure Digital Host Controller Interface
3 *
4 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11#ifndef __SDHCI_H
12#define __SDHCI_H
13
14#include <linux/scatterlist.h>
15#include <linux/compiler.h>
16#include <linux/types.h>
17#include <linux/io.h>
18#include <linux/mmc/host.h>
19
20struct sdhci_host {
21 /* Data set by hardware interface driver */
22 const char *hw_name; /* Hardware bus name */
23
24 unsigned int quirks; /* Deviations from spec. */
25
26/* Controller doesn't honor resets unless we touch the clock register */
27#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
28/* Controller has bad caps bits, but really supports DMA */
29#define SDHCI_QUIRK_FORCE_DMA (1<<1)
30/* Controller doesn't like to be reset when there is no card inserted. */
31#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
32/* Controller doesn't like clearing the power reg before a change */
33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
34/* Controller has flaky internal state so reset it on each ios change */
35#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
36/* Controller has an unusable DMA engine */
37#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
38/* Controller has an unusable ADMA engine */
39#define SDHCI_QUIRK_BROKEN_ADMA (1<<6)
40/* Controller can only DMA from 32-bit aligned addresses */
41#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7)
42/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
43#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8)
44/* Controller can only ADMA chunks that are a multiple of 32 bits */
45#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9)
46/* Controller needs to be reset after each request to stay stable */
47#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10)
48/* Controller needs voltage and power writes to happen separately */
49#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11)
50/* Controller provides an incorrect timeout value for transfers */
51#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
52/* Controller has an issue with buffer bits for small transfers */
53#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
54/* Controller does not provide transfer-complete interrupt when not busy */
55#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14)
56/* Controller has unreliable card detection */
57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)
58/* Controller reports inverted write-protect state */
59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
60/* Controller has nonstandard clock management */
61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17)
62/* Controller does not like fast PIO transfers */
63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
64/* Controller losing signal/interrupt enable states after reset */
65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19)
66/* Controller has to be forced to use block size of 2048 bytes */
67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
68/* Controller cannot do multi-block transfers */
69#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21)
70/* Controller can only handle 1-bit data transfers */
71#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22)
72/* Controller needs 10ms delay between applying power and clock */
73#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23)
74/* Controller uses SDCLK instead of TMCLK for data timeouts */
75#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24)
76/* Controller reports wrong base clock capability */
77#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25)
78/* Controller cannot support End Attribute in NOP ADMA descriptor */
79#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
80/* Controller is missing device caps. Use caps provided by host */
81#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
82/* Controller uses Auto CMD12 command to stop the transfer */
83#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28)
84/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
85#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
86/* Controller treats ADMA descriptors with length 0000h incorrectly */
87#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
88
89 int irq; /* Device IRQ */
90 void __iomem *ioaddr; /* Mapped address */
91
92 const struct sdhci_ops *ops; /* Low level hw interface */
93
94 struct regulator *vmmc; /* Power regulator */
95
96 /* Internal data */
97 struct mmc_host *mmc; /* MMC structure */
98 u64 dma_mask; /* custom DMA mask */
99
100#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
101 struct led_classdev led; /* LED control */
102 char led_name[32];
103#endif
104
105 spinlock_t lock; /* Mutex */
106
107 int flags; /* Host attributes */
108#define SDHCI_USE_SDMA (1<<0) /* Host is SDMA capable */
109#define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */
110#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */
111#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */
112
113 unsigned int version; /* SDHCI spec. version */
114
115 unsigned int max_clk; /* Max possible freq (MHz) */
116 unsigned int timeout_clk; /* Timeout freq (KHz) */
117
118 unsigned int clock; /* Current clock (MHz) */
119 u8 pwr; /* Current voltage */
120
121 struct mmc_request *mrq; /* Current request */
122 struct mmc_command *cmd; /* Current command */
123 struct mmc_data *data; /* Current data request */
124 unsigned int data_early:1; /* Data finished before cmd */
125
126 struct sg_mapping_iter sg_miter; /* SG state for PIO */
127 unsigned int blocks; /* remaining PIO blocks */
128
129 int sg_count; /* Mapped sg entries */
130
131 u8 *adma_desc; /* ADMA descriptor table */
132 u8 *align_buffer; /* Bounce buffer */
133
134 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
135 dma_addr_t align_addr; /* Mapped bounce buffer */
136
137 struct tasklet_struct card_tasklet; /* Tasklet structures */
138 struct tasklet_struct finish_tasklet;
139
140 struct timer_list timer; /* Timer for timeouts */
141
142 unsigned int caps; /* Alternative capabilities */
143
144 unsigned int ocr_avail_sdio; /* OCR bit masks */
145 unsigned int ocr_avail_sd;
146 unsigned int ocr_avail_mmc;
147
148 unsigned long private[0] ____cacheline_aligned;
149};
150#endif /* __SDHCI_H */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index d4a2ebbdab4b..9eb9b4b96f55 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -14,8 +14,9 @@
14#ifndef __SH_MMCIF_H__ 14#ifndef __SH_MMCIF_H__
15#define __SH_MMCIF_H__ 15#define __SH_MMCIF_H__
16 16
17#include <linux/platform_device.h>
18#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h>
19#include <linux/sh_dma.h>
19 20
20/* 21/*
21 * MMCIF : CE_CLK_CTRL [19:16] 22 * MMCIF : CE_CLK_CTRL [19:16]
@@ -31,12 +32,19 @@
31 * 1111 : Peripheral clock (sup_pclk set '1') 32 * 1111 : Peripheral clock (sup_pclk set '1')
32 */ 33 */
33 34
35struct sh_mmcif_dma {
36 struct sh_dmae_slave chan_priv_tx;
37 struct sh_dmae_slave chan_priv_rx;
38};
39
34struct sh_mmcif_plat_data { 40struct sh_mmcif_plat_data {
35 void (*set_pwr)(struct platform_device *pdev, int state); 41 void (*set_pwr)(struct platform_device *pdev, int state);
36 void (*down_pwr)(struct platform_device *pdev); 42 void (*down_pwr)(struct platform_device *pdev);
37 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 43 int (*get_cd)(struct platform_device *pdef);
38 unsigned long caps; 44 struct sh_mmcif_dma *dma;
39 u32 ocr; 45 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
46 unsigned long caps;
47 u32 ocr;
40}; 48};
41 49
42#define MMCIF_CE_CMD_SET 0x00000000 50#define MMCIF_CE_CMD_SET 0x00000000
@@ -58,19 +66,45 @@ struct sh_mmcif_plat_data {
58#define MMCIF_CE_HOST_STS2 0x0000004C 66#define MMCIF_CE_HOST_STS2 0x0000004C
59#define MMCIF_CE_VERSION 0x0000007C 67#define MMCIF_CE_VERSION 0x0000007C
60 68
61extern inline u32 sh_mmcif_readl(void __iomem *addr, int reg) 69/* CE_BUF_ACC */
70#define BUF_ACC_DMAWEN (1 << 25)
71#define BUF_ACC_DMAREN (1 << 24)
72#define BUF_ACC_BUSW_32 (0 << 17)
73#define BUF_ACC_BUSW_16 (1 << 17)
74#define BUF_ACC_ATYP (1 << 16)
75
76/* CE_CLK_CTRL */
77#define CLK_ENABLE (1 << 24) /* 1: output mmc clock */
78#define CLK_CLEAR ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
79#define CLK_SUP_PCLK ((1 << 19) | (1 << 18) | (1 << 17) | (1 << 16))
80#define CLKDIV_4 (1<<16) /* mmc clock frequency.
81 * n: bus clock/(2^(n+1)) */
82#define CLKDIV_256 (7<<16) /* mmc clock frequency. (see above) */
83#define SRSPTO_256 ((1 << 13) | (0 << 12)) /* resp timeout */
84#define SRBSYTO_29 ((1 << 11) | (1 << 10) | \
85 (1 << 9) | (1 << 8)) /* resp busy timeout */
86#define SRWDTO_29 ((1 << 7) | (1 << 6) | \
87 (1 << 5) | (1 << 4)) /* read/write timeout */
88#define SCCSTO_29 ((1 << 3) | (1 << 2) | \
89 (1 << 1) | (1 << 0)) /* ccs timeout */
90
91/* CE_VERSION */
92#define SOFT_RST_ON (1 << 31)
93#define SOFT_RST_OFF 0
94
95static inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
62{ 96{
63 return readl(addr + reg); 97 return __raw_readl(addr + reg);
64} 98}
65 99
66extern inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) 100static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
67{ 101{
68 writel(val, addr + reg); 102 __raw_writel(val, addr + reg);
69} 103}
70 104
71#define SH_MMCIF_BBS 512 /* boot block size */ 105#define SH_MMCIF_BBS 512 /* boot block size */
72 106
73extern inline void sh_mmcif_boot_cmd_send(void __iomem *base, 107static inline void sh_mmcif_boot_cmd_send(void __iomem *base,
74 unsigned long cmd, unsigned long arg) 108 unsigned long cmd, unsigned long arg)
75{ 109{
76 sh_mmcif_writel(base, MMCIF_CE_INT, 0); 110 sh_mmcif_writel(base, MMCIF_CE_INT, 0);
@@ -78,7 +112,7 @@ extern inline void sh_mmcif_boot_cmd_send(void __iomem *base,
78 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd); 112 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd);
79} 113}
80 114
81extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask) 115static inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask)
82{ 116{
83 unsigned long tmp; 117 unsigned long tmp;
84 int cnt; 118 int cnt;
@@ -94,14 +128,14 @@ extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask)
94 return -1; 128 return -1;
95} 129}
96 130
97extern inline int sh_mmcif_boot_cmd(void __iomem *base, 131static inline int sh_mmcif_boot_cmd(void __iomem *base,
98 unsigned long cmd, unsigned long arg) 132 unsigned long cmd, unsigned long arg)
99{ 133{
100 sh_mmcif_boot_cmd_send(base, cmd, arg); 134 sh_mmcif_boot_cmd_send(base, cmd, arg);
101 return sh_mmcif_boot_cmd_poll(base, 0x00010000); 135 return sh_mmcif_boot_cmd_poll(base, 0x00010000);
102} 136}
103 137
104extern inline int sh_mmcif_boot_do_read_single(void __iomem *base, 138static inline int sh_mmcif_boot_do_read_single(void __iomem *base,
105 unsigned int block_nr, 139 unsigned int block_nr,
106 unsigned long *buf) 140 unsigned long *buf)
107{ 141{
@@ -124,7 +158,7 @@ extern inline int sh_mmcif_boot_do_read_single(void __iomem *base,
124 return 0; 158 return 0;
125} 159}
126 160
127extern inline int sh_mmcif_boot_do_read(void __iomem *base, 161static inline int sh_mmcif_boot_do_read(void __iomem *base,
128 unsigned long first_block, 162 unsigned long first_block,
129 unsigned long nr_blocks, 163 unsigned long nr_blocks,
130 void *buf) 164 void *buf)
@@ -132,6 +166,17 @@ extern inline int sh_mmcif_boot_do_read(void __iomem *base,
132 unsigned long k; 166 unsigned long k;
133 int ret = 0; 167 int ret = 0;
134 168
169 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
170 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
171 CLK_ENABLE | CLKDIV_4 | SRSPTO_256 |
172 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
173
174 /* CMD9 - Get CSD */
175 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
176
177 /* CMD7 - Select the card */
178 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
179
135 /* CMD16 - Set the block size */ 180 /* CMD16 - Set the block size */
136 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS); 181 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS);
137 182
@@ -142,23 +187,22 @@ extern inline int sh_mmcif_boot_do_read(void __iomem *base,
142 return ret; 187 return ret;
143} 188}
144 189
145extern inline void sh_mmcif_boot_init(void __iomem *base) 190static inline void sh_mmcif_boot_init(void __iomem *base)
146{ 191{
147 unsigned long tmp;
148
149 /* reset */ 192 /* reset */
150 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION); 193 sh_mmcif_writel(base, MMCIF_CE_VERSION, SOFT_RST_ON);
151 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000); 194 sh_mmcif_writel(base, MMCIF_CE_VERSION, SOFT_RST_OFF);
152 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000);
153 195
154 /* byte swap */ 196 /* byte swap */
155 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000); 197 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP);
156 198
157 /* Set block size in MMCIF hardware */ 199 /* Set block size in MMCIF hardware */
158 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS); 200 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
159 201
160 /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/ 202 /* Enable the clock, set it to Bus clock/256 (about 325Khz). */
161 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff); 203 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL,
204 CLK_ENABLE | CLKDIV_256 | SRSPTO_256 |
205 SRBSYTO_29 | SRWDTO_29 | SCCSTO_29);
162 206
163 /* CMD0 */ 207 /* CMD0 */
164 sh_mmcif_boot_cmd(base, 0x00000040, 0); 208 sh_mmcif_boot_cmd(base, 0x00000040, 0);
@@ -176,25 +220,4 @@ extern inline void sh_mmcif_boot_init(void __iomem *base)
176 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 220 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
177} 221}
178 222
179extern inline void sh_mmcif_boot_slurp(void __iomem *base,
180 unsigned char *buf,
181 unsigned long no_bytes)
182{
183 unsigned long tmp;
184
185 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
186 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01012fff);
187
188 /* CMD9 - Get CSD */
189 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
190
191 /* CMD7 - Select the card */
192 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
193
194 tmp = no_bytes / SH_MMCIF_BBS;
195 tmp += (no_bytes % SH_MMCIF_BBS) ? 1 : 0;
196
197 sh_mmcif_boot_do_read(base, 512, tmp, buf);
198}
199
200#endif /* __SH_MMCIF_H__ */ 223#endif /* __SH_MMCIF_H__ */
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index 49067802a6d7..c981b959760f 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -7,8 +7,10 @@ struct sh_mobile_sdhi_info {
7 int dma_slave_tx; 7 int dma_slave_tx;
8 int dma_slave_rx; 8 int dma_slave_rx;
9 unsigned long tmio_flags; 9 unsigned long tmio_flags;
10 unsigned long tmio_caps;
10 u32 tmio_ocr_mask; /* available MMC voltages */ 11 u32 tmio_ocr_mask; /* available MMC voltages */
11 void (*set_pwr)(struct platform_device *pdev, int state); 12 void (*set_pwr)(struct platform_device *pdev, int state);
13 int (*get_cd)(struct platform_device *pdev);
12}; 14};
13 15
14#endif /* __SH_MOBILE_SDHI_H__ */ 16#endif /* __SH_MOBILE_SDHI_H__ */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
new file mode 100644
index 000000000000..19490b942db0
--- /dev/null
+++ b/include/linux/mmc/tmio.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/mmc/tmio.h
3 *
4 * Copyright (C) 2007 Ian Molton
5 * Copyright (C) 2004 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Driver for the MMC / SD / SDIO cell found in:
12 *
13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
14 */
15#ifndef _LINUX_MMC_TMIO_H_
16#define _LINUX_MMC_TMIO_H_
17
18#define CTL_SD_CMD 0x00
19#define CTL_ARG_REG 0x04
20#define CTL_STOP_INTERNAL_ACTION 0x08
21#define CTL_XFER_BLK_COUNT 0xa
22#define CTL_RESPONSE 0x0c
23#define CTL_STATUS 0x1c
24#define CTL_IRQ_MASK 0x20
25#define CTL_SD_CARD_CLK_CTL 0x24
26#define CTL_SD_XFER_LEN 0x26
27#define CTL_SD_MEM_CARD_OPT 0x28
28#define CTL_SD_ERROR_DETAIL_STATUS 0x2c
29#define CTL_SD_DATA_PORT 0x30
30#define CTL_TRANSACTION_CTL 0x34
31#define CTL_SDIO_STATUS 0x36
32#define CTL_SDIO_IRQ_MASK 0x38
33#define CTL_RESET_SD 0xe0
34#define CTL_SDIO_REGS 0x100
35#define CTL_CLK_AND_WAIT_CTL 0x138
36#define CTL_RESET_SDIO 0x1e0
37
38/* Definitions for values the CTRL_STATUS register can take. */
39#define TMIO_STAT_CMDRESPEND 0x00000001
40#define TMIO_STAT_DATAEND 0x00000004
41#define TMIO_STAT_CARD_REMOVE 0x00000008
42#define TMIO_STAT_CARD_INSERT 0x00000010
43#define TMIO_STAT_SIGSTATE 0x00000020
44#define TMIO_STAT_WRPROTECT 0x00000080
45#define TMIO_STAT_CARD_REMOVE_A 0x00000100
46#define TMIO_STAT_CARD_INSERT_A 0x00000200
47#define TMIO_STAT_SIGSTATE_A 0x00000400
48#define TMIO_STAT_CMD_IDX_ERR 0x00010000
49#define TMIO_STAT_CRCFAIL 0x00020000
50#define TMIO_STAT_STOPBIT_ERR 0x00040000
51#define TMIO_STAT_DATATIMEOUT 0x00080000
52#define TMIO_STAT_RXOVERFLOW 0x00100000
53#define TMIO_STAT_TXUNDERRUN 0x00200000
54#define TMIO_STAT_CMDTIMEOUT 0x00400000
55#define TMIO_STAT_RXRDY 0x01000000
56#define TMIO_STAT_TXRQ 0x02000000
57#define TMIO_STAT_ILL_FUNC 0x20000000
58#define TMIO_STAT_CMD_BUSY 0x40000000
59#define TMIO_STAT_ILL_ACCESS 0x80000000
60
61#define TMIO_BBS 512 /* Boot block size */
62
63#endif /* _LINUX_MMC_TMIO_H_ */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 4e02ee2b071e..cc2e7dfea9d7 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -62,6 +62,16 @@ struct mmu_notifier_ops {
62 unsigned long address); 62 unsigned long address);
63 63
64 /* 64 /*
65 * test_young is called to check the young/accessed bitflag in
66 * the secondary pte. This is used to know if the page is
67 * frequently used without actually clearing the flag or tearing
68 * down the secondary mapping on the page.
69 */
70 int (*test_young)(struct mmu_notifier *mn,
71 struct mm_struct *mm,
72 unsigned long address);
73
74 /*
65 * change_pte is called in cases that pte mapping to page is changed: 75 * 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. 76 * for example, when ksm remaps pte to point to a new shared page.
67 */ 77 */
@@ -163,6 +173,8 @@ extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
163extern void __mmu_notifier_release(struct mm_struct *mm); 173extern void __mmu_notifier_release(struct mm_struct *mm);
164extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm, 174extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
165 unsigned long address); 175 unsigned long address);
176extern int __mmu_notifier_test_young(struct mm_struct *mm,
177 unsigned long address);
166extern void __mmu_notifier_change_pte(struct mm_struct *mm, 178extern void __mmu_notifier_change_pte(struct mm_struct *mm,
167 unsigned long address, pte_t pte); 179 unsigned long address, pte_t pte);
168extern void __mmu_notifier_invalidate_page(struct mm_struct *mm, 180extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
@@ -186,6 +198,14 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
186 return 0; 198 return 0;
187} 199}
188 200
201static inline int mmu_notifier_test_young(struct mm_struct *mm,
202 unsigned long address)
203{
204 if (mm_has_notifiers(mm))
205 return __mmu_notifier_test_young(mm, address);
206 return 0;
207}
208
189static inline void mmu_notifier_change_pte(struct mm_struct *mm, 209static inline void mmu_notifier_change_pte(struct mm_struct *mm,
190 unsigned long address, pte_t pte) 210 unsigned long address, pte_t pte)
191{ 211{
@@ -227,7 +247,7 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
227 247
228/* 248/*
229 * These two macros will sometime replace ptep_clear_flush. 249 * These two macros will sometime replace ptep_clear_flush.
230 * ptep_clear_flush is impleemnted as macro itself, so this also is 250 * ptep_clear_flush is implemented as macro itself, so this also is
231 * implemented as a macro until ptep_clear_flush will converted to an 251 * implemented as a macro until ptep_clear_flush will converted to an
232 * inline function, to diminish the risk of compilation failure. The 252 * inline function, to diminish the risk of compilation failure. The
233 * invalidate_page method over time can be moved outside the PT lock 253 * invalidate_page method over time can be moved outside the PT lock
@@ -243,6 +263,32 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
243 __pte; \ 263 __pte; \
244}) 264})
245 265
266#define pmdp_clear_flush_notify(__vma, __address, __pmdp) \
267({ \
268 pmd_t __pmd; \
269 struct vm_area_struct *___vma = __vma; \
270 unsigned long ___address = __address; \
271 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
272 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
273 (__address)+HPAGE_PMD_SIZE);\
274 __pmd = pmdp_clear_flush(___vma, ___address, __pmdp); \
275 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
276 (__address)+HPAGE_PMD_SIZE); \
277 __pmd; \
278})
279
280#define pmdp_splitting_flush_notify(__vma, __address, __pmdp) \
281({ \
282 struct vm_area_struct *___vma = __vma; \
283 unsigned long ___address = __address; \
284 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
285 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
286 (__address)+HPAGE_PMD_SIZE);\
287 pmdp_splitting_flush(___vma, ___address, __pmdp); \
288 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
289 (__address)+HPAGE_PMD_SIZE); \
290})
291
246#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \ 292#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
247({ \ 293({ \
248 int __young; \ 294 int __young; \
@@ -254,6 +300,17 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
254 __young; \ 300 __young; \
255}) 301})
256 302
303#define pmdp_clear_flush_young_notify(__vma, __address, __pmdp) \
304({ \
305 int __young; \
306 struct vm_area_struct *___vma = __vma; \
307 unsigned long ___address = __address; \
308 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
309 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
310 ___address); \
311 __young; \
312})
313
257#define set_pte_at_notify(__mm, __address, __ptep, __pte) \ 314#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
258({ \ 315({ \
259 struct mm_struct *___mm = __mm; \ 316 struct mm_struct *___mm = __mm; \
@@ -276,6 +333,12 @@ static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
276 return 0; 333 return 0;
277} 334}
278 335
336static inline int mmu_notifier_test_young(struct mm_struct *mm,
337 unsigned long address)
338{
339 return 0;
340}
341
279static inline void mmu_notifier_change_pte(struct mm_struct *mm, 342static inline void mmu_notifier_change_pte(struct mm_struct *mm,
280 unsigned long address, pte_t pte) 343 unsigned long address, pte_t pte)
281{ 344{
@@ -305,7 +368,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
305} 368}
306 369
307#define ptep_clear_flush_young_notify ptep_clear_flush_young 370#define ptep_clear_flush_young_notify ptep_clear_flush_young
371#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
308#define ptep_clear_flush_notify ptep_clear_flush 372#define ptep_clear_flush_notify ptep_clear_flush
373#define pmdp_clear_flush_notify pmdp_clear_flush
374#define pmdp_splitting_flush_notify pmdp_splitting_flush
309#define set_pte_at_notify set_pte_at 375#define set_pte_at_notify set_pte_at
310 376
311#endif /* CONFIG_MMU_NOTIFIER */ 377#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 3984c4eb41fd..e56f835274c9 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -104,6 +104,8 @@ enum zone_stat_item {
104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ 104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ 105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */ 106 NR_SHMEM, /* shmem pages (included tmpfs/GEM pages) */
107 NR_DIRTIED, /* page dirtyings since bootup */
108 NR_WRITTEN, /* page writings since bootup */
107#ifdef CONFIG_NUMA 109#ifdef CONFIG_NUMA
108 NUMA_HIT, /* allocated in intended node */ 110 NUMA_HIT, /* allocated in intended node */
109 NUMA_MISS, /* allocated in non intended node */ 111 NUMA_MISS, /* allocated in non intended node */
@@ -112,6 +114,7 @@ enum zone_stat_item {
112 NUMA_LOCAL, /* allocation from local node */ 114 NUMA_LOCAL, /* allocation from local node */
113 NUMA_OTHER, /* allocation from other node */ 115 NUMA_OTHER, /* allocation from other node */
114#endif 116#endif
117 NR_ANON_TRANSPARENT_HUGEPAGES,
115 NR_VM_ZONE_STAT_ITEMS }; 118 NR_VM_ZONE_STAT_ITEMS };
116 119
117/* 120/*
@@ -421,6 +424,9 @@ struct zone {
421typedef enum { 424typedef enum {
422 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */ 425 ZONE_RECLAIM_LOCKED, /* prevents concurrent reclaim */
423 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */ 426 ZONE_OOM_LOCKED, /* zone is in OOM killer zonelist */
427 ZONE_CONGESTED, /* zone has many dirty pages backed by
428 * a congested BDI
429 */
424} zone_flags_t; 430} zone_flags_t;
425 431
426static inline void zone_set_flag(struct zone *zone, zone_flags_t flag) 432static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
@@ -438,6 +444,11 @@ static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
438 clear_bit(flag, &zone->flags); 444 clear_bit(flag, &zone->flags);
439} 445}
440 446
447static inline int zone_is_reclaim_congested(const struct zone *zone)
448{
449 return test_bit(ZONE_CONGESTED, &zone->flags);
450}
451
441static inline int zone_is_reclaim_locked(const struct zone *zone) 452static inline int zone_is_reclaim_locked(const struct zone *zone)
442{ 453{
443 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags); 454 return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
@@ -448,12 +459,6 @@ static inline int zone_is_oom_locked(const struct zone *zone)
448 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 459 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
449} 460}
450 461
451#ifdef CONFIG_SMP
452unsigned long zone_nr_free_pages(struct zone *zone);
453#else
454#define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES)
455#endif /* CONFIG_SMP */
456
457/* 462/*
458 * The "priority" of VM scanning is how much of the queues we will scan in one 463 * The "priority" of VM scanning is how much of the queues we will scan in one
459 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 464 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -467,7 +472,7 @@ unsigned long zone_nr_free_pages(struct zone *zone);
467#ifdef CONFIG_NUMA 472#ifdef CONFIG_NUMA
468 473
469/* 474/*
470 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 475 * The NUMA zonelists are doubled because we need zonelists that restrict the
471 * allocations to a single node for GFP_THISNODE. 476 * allocations to a single node for GFP_THISNODE.
472 * 477 *
473 * [0] : Zonelist with fallback 478 * [0] : Zonelist with fallback
@@ -635,6 +640,7 @@ typedef struct pglist_data {
635 wait_queue_head_t kswapd_wait; 640 wait_queue_head_t kswapd_wait;
636 struct task_struct *kswapd; 641 struct task_struct *kswapd;
637 int kswapd_max_order; 642 int kswapd_max_order;
643 enum zone_type classzone_idx;
638} pg_data_t; 644} pg_data_t;
639 645
640#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) 646#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
@@ -650,8 +656,10 @@ typedef struct pglist_data {
650 656
651extern struct mutex zonelists_mutex; 657extern struct mutex zonelists_mutex;
652void build_all_zonelists(void *data); 658void build_all_zonelists(void *data);
653void wakeup_kswapd(struct zone *zone, int order); 659void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx);
654int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 660bool zone_watermark_ok(struct zone *z, int order, unsigned long mark,
661 int classzone_idx, int alloc_flags);
662bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark,
655 int classzone_idx, int alloc_flags); 663 int classzone_idx, int alloc_flags);
656enum memmap_context { 664enum memmap_context {
657 MEMMAP_EARLY, 665 MEMMAP_EARLY,
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 48c007dae476..ae28e93fd072 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -382,6 +382,23 @@ struct ssb_device_id {
382#define SSB_ANY_ID 0xFFFF 382#define SSB_ANY_ID 0xFFFF
383#define SSB_ANY_REV 0xFF 383#define SSB_ANY_REV 0xFF
384 384
385/* Broadcom's specific AMBA core, see drivers/bcma/ */
386struct bcma_device_id {
387 __u16 manuf;
388 __u16 id;
389 __u8 rev;
390 __u8 class;
391};
392#define BCMA_CORE(_manuf, _id, _rev, _class) \
393 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
394#define BCMA_CORETABLE_END \
395 { 0, },
396
397#define BCMA_ANY_MANUF 0xFFFF
398#define BCMA_ANY_ID 0xFFFF
399#define BCMA_ANY_REV 0xFF
400#define BCMA_ANY_CLASS 0xFF
401
385struct virtio_device_id { 402struct virtio_device_id {
386 __u32 device; 403 __u32 device;
387 __u32 vendor; 404 __u32 vendor;
diff --git a/include/linux/module.h b/include/linux/module.h
index b29e7458b966..d9ca2d5dc6d0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -58,6 +58,15 @@ struct module_attribute {
58 void (*free)(struct module *); 58 void (*free)(struct module *);
59}; 59};
60 60
61struct module_version_attribute {
62 struct module_attribute mattr;
63 const char *module_name;
64 const char *version;
65} __attribute__ ((__aligned__(sizeof(void *))));
66
67extern ssize_t __modver_version_show(struct module_attribute *,
68 struct module *, char *);
69
61struct module_kobject 70struct module_kobject
62{ 71{
63 struct kobject kobj; 72 struct kobject kobj;
@@ -161,7 +170,26 @@ extern struct module __this_module;
161 Using this automatically adds a checksum of the .c files and the 170 Using this automatically adds a checksum of the .c files and the
162 local headers in "srcversion". 171 local headers in "srcversion".
163*/ 172*/
173
174#if defined(MODULE) || !defined(CONFIG_SYSFS)
164#define MODULE_VERSION(_version) MODULE_INFO(version, _version) 175#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
176#else
177#define MODULE_VERSION(_version) \
178 static struct module_version_attribute ___modver_attr = { \
179 .mattr = { \
180 .attr = { \
181 .name = "version", \
182 .mode = S_IRUGO, \
183 }, \
184 .show = __modver_version_show, \
185 }, \
186 .module_name = KBUILD_MODNAME, \
187 .version = _version, \
188 }; \
189 static const struct module_version_attribute \
190 __used __attribute__ ((__section__ ("__modver"))) \
191 * __moduleparam_const __modver_attr = &___modver_attr
192#endif
165 193
166/* Optional firmware file (or files) needed by the module 194/* Optional firmware file (or files) needed by the module
167 * format is simply firmware file name. Multiple firmware 195 * format is simply firmware file name. Multiple firmware
@@ -196,7 +224,7 @@ struct module_use {
196 extern void *__crc_##sym __attribute__((weak)); \ 224 extern void *__crc_##sym __attribute__((weak)); \
197 static const unsigned long __kcrctab_##sym \ 225 static const unsigned long __kcrctab_##sym \
198 __used \ 226 __used \
199 __attribute__((section("__kcrctab" sec), unused)) \ 227 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
200 = (unsigned long) &__crc_##sym; 228 = (unsigned long) &__crc_##sym;
201#else 229#else
202#define __CRC_SYMBOL(sym, sec) 230#define __CRC_SYMBOL(sym, sec)
@@ -211,7 +239,7 @@ struct module_use {
211 = MODULE_SYMBOL_PREFIX #sym; \ 239 = MODULE_SYMBOL_PREFIX #sym; \
212 static const struct kernel_symbol __ksymtab_##sym \ 240 static const struct kernel_symbol __ksymtab_##sym \
213 __used \ 241 __used \
214 __attribute__((section("__ksymtab" sec), unused)) \ 242 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
215 = { (unsigned long)&sym, __kstrtab_##sym } 243 = { (unsigned long)&sym, __kstrtab_##sym }
216 244
217#define EXPORT_SYMBOL(sym) \ 245#define EXPORT_SYMBOL(sym) \
@@ -308,6 +336,9 @@ struct module
308 /* The size of the executable code in each section. */ 336 /* The size of the executable code in each section. */
309 unsigned int init_text_size, core_text_size; 337 unsigned int init_text_size, core_text_size;
310 338
339 /* Size of RO sections of the module (text+rodata) */
340 unsigned int init_ro_size, core_ro_size;
341
311 /* Arch-specific module values */ 342 /* Arch-specific module values */
312 struct mod_arch_specific arch; 343 struct mod_arch_specific arch;
313 344
@@ -337,34 +368,35 @@ struct module
337 struct module_notes_attrs *notes_attrs; 368 struct module_notes_attrs *notes_attrs;
338#endif 369#endif
339 370
371 /* The command line arguments (may be mangled). People like
372 keeping pointers to this stuff */
373 char *args;
374
340#ifdef CONFIG_SMP 375#ifdef CONFIG_SMP
341 /* Per-cpu data. */ 376 /* Per-cpu data. */
342 void __percpu *percpu; 377 void __percpu *percpu;
343 unsigned int percpu_size; 378 unsigned int percpu_size;
344#endif 379#endif
345 380
346 /* The command line arguments (may be mangled). People like
347 keeping pointers to this stuff */
348 char *args;
349#ifdef CONFIG_TRACEPOINTS 381#ifdef CONFIG_TRACEPOINTS
350 struct tracepoint *tracepoints;
351 unsigned int num_tracepoints; 382 unsigned int num_tracepoints;
383 struct tracepoint * const *tracepoints_ptrs;
352#endif 384#endif
353#ifdef HAVE_JUMP_LABEL 385#ifdef HAVE_JUMP_LABEL
354 struct jump_entry *jump_entries; 386 struct jump_entry *jump_entries;
355 unsigned int num_jump_entries; 387 unsigned int num_jump_entries;
356#endif 388#endif
357#ifdef CONFIG_TRACING 389#ifdef CONFIG_TRACING
358 const char **trace_bprintk_fmt_start;
359 unsigned int num_trace_bprintk_fmt; 390 unsigned int num_trace_bprintk_fmt;
391 const char **trace_bprintk_fmt_start;
360#endif 392#endif
361#ifdef CONFIG_EVENT_TRACING 393#ifdef CONFIG_EVENT_TRACING
362 struct ftrace_event_call *trace_events; 394 struct ftrace_event_call **trace_events;
363 unsigned int num_trace_events; 395 unsigned int num_trace_events;
364#endif 396#endif
365#ifdef CONFIG_FTRACE_MCOUNT_RECORD 397#ifdef CONFIG_FTRACE_MCOUNT_RECORD
366 unsigned long *ftrace_callsites;
367 unsigned int num_ftrace_callsites; 398 unsigned int num_ftrace_callsites;
399 unsigned long *ftrace_callsites;
368#endif 400#endif
369 401
370#ifdef CONFIG_MODULE_UNLOAD 402#ifdef CONFIG_MODULE_UNLOAD
@@ -445,8 +477,9 @@ const struct kernel_symbol *find_symbol(const char *name,
445 bool warn); 477 bool warn);
446 478
447/* Walk the exported symbol table */ 479/* Walk the exported symbol table */
448bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner, 480bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
449 unsigned int symnum, void *data), void *data); 481 struct module *owner,
482 void *data), void *data);
450 483
451/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 484/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
452 symnum out of range. */ 485 symnum out of range. */
@@ -517,7 +550,7 @@ static inline void __module_get(struct module *module)
517#define symbol_put_addr(p) do { } while(0) 550#define symbol_put_addr(p) do { } while(0)
518 551
519#endif /* CONFIG_MODULE_UNLOAD */ 552#endif /* CONFIG_MODULE_UNLOAD */
520int use_module(struct module *a, struct module *b); 553int ref_module(struct module *a, struct module *b);
521 554
522/* This is a #define so the string doesn't get put in every .o file */ 555/* This is a #define so the string doesn't get put in every .o file */
523#define module_name(mod) \ 556#define module_name(mod) \
@@ -672,7 +705,6 @@ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
672{ 705{
673 return 0; 706 return 0;
674} 707}
675
676#endif /* CONFIG_MODULES */ 708#endif /* CONFIG_MODULES */
677 709
678#ifdef CONFIG_SYSFS 710#ifdef CONFIG_SYSFS
@@ -687,6 +719,13 @@ extern int module_sysfs_initialized;
687 719
688#define __MODULE_STRING(x) __stringify(x) 720#define __MODULE_STRING(x) __stringify(x)
689 721
722#ifdef CONFIG_DEBUG_SET_MODULE_RONX
723extern void set_all_modules_text_rw(void);
724extern void set_all_modules_text_ro(void);
725#else
726static inline void set_all_modules_text_rw(void) { }
727static inline void set_all_modules_text_ro(void) { }
728#endif
690 729
691#ifdef CONFIG_GENERIC_BUG 730#ifdef CONFIG_GENERIC_BUG
692void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, 731void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 9d2f1837b3d8..ddaae98c53f9 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -16,15 +16,17 @@
16/* Chosen so that structs with an unsigned long line up. */ 16/* Chosen so that structs with an unsigned long line up. */
17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) 17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
18 18
19#ifdef MODULE
20#define ___module_cat(a,b) __mod_ ## a ## b 19#define ___module_cat(a,b) __mod_ ## a ## b
21#define __module_cat(a,b) ___module_cat(a,b) 20#define __module_cat(a,b) ___module_cat(a,b)
21#ifdef MODULE
22#define __MODULE_INFO(tag, name, info) \ 22#define __MODULE_INFO(tag, name, info) \
23static const char __module_cat(name,__LINE__)[] \ 23static const char __module_cat(name,__LINE__)[] \
24 __used \ 24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \
25 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info 25 = __stringify(tag) "=" info
26#else /* !MODULE */ 26#else /* !MODULE */
27#define __MODULE_INFO(tag, name, info) 27/* This struct is here for syntactic coherency, it is not used */
28#define __MODULE_INFO(tag, name, info) \
29 struct __module_cat(name,__LINE__) {}
28#endif 30#endif
29#define __MODULE_PARM_TYPE(name, _type) \ 31#define __MODULE_PARM_TYPE(name, _type) \
30 __MODULE_INFO(parmtype, name##type, #name ":" _type) 32 __MODULE_INFO(parmtype, name##type, #name ":" _type)
@@ -65,9 +67,9 @@ struct kparam_string {
65struct kparam_array 67struct kparam_array
66{ 68{
67 unsigned int max; 69 unsigned int max;
70 unsigned int elemsize;
68 unsigned int *num; 71 unsigned int *num;
69 const struct kernel_param_ops *ops; 72 const struct kernel_param_ops *ops;
70 unsigned int elemsize;
71 void *elem; 73 void *elem;
72}; 74};
73 75
@@ -369,8 +371,9 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
369 */ 371 */
370#define module_param_array_named(name, array, type, nump, perm) \ 372#define module_param_array_named(name, array, type, nump, perm) \
371 static const struct kparam_array __param_arr_##name \ 373 static const struct kparam_array __param_arr_##name \
372 = { ARRAY_SIZE(array), nump, &param_ops_##type, \ 374 = { .max = ARRAY_SIZE(array), .num = nump, \
373 sizeof(array[0]), array }; \ 375 .ops = &param_ops_##type, \
376 .elemsize = sizeof(array[0]), .elem = array }; \
374 __module_param_call(MODULE_PARAM_PREFIX, name, \ 377 __module_param_call(MODULE_PARAM_PREFIX, name, \
375 &param_array_ops, \ 378 &param_array_ops, \
376 .arr = &__param_arr_##name, \ 379 .arr = &__param_arr_##name, \
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 5e7a59408dd4..604f122a2326 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -13,6 +13,7 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/seqlock.h>
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17 18
18struct super_block; 19struct super_block;
@@ -46,12 +47,24 @@ struct mnt_namespace;
46 47
47#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
48 49
50struct mnt_pcp {
51 int mnt_count;
52 int mnt_writers;
53};
54
49struct vfsmount { 55struct vfsmount {
50 struct list_head mnt_hash; 56 struct list_head mnt_hash;
51 struct vfsmount *mnt_parent; /* fs we are mounted on */ 57 struct vfsmount *mnt_parent; /* fs we are mounted on */
52 struct dentry *mnt_mountpoint; /* dentry of mountpoint */ 58 struct dentry *mnt_mountpoint; /* dentry of mountpoint */
53 struct dentry *mnt_root; /* root of the mounted tree */ 59 struct dentry *mnt_root; /* root of the mounted tree */
54 struct super_block *mnt_sb; /* pointer to superblock */ 60 struct super_block *mnt_sb; /* pointer to superblock */
61#ifdef CONFIG_SMP
62 struct mnt_pcp __percpu *mnt_pcp;
63 atomic_t mnt_longterm; /* how many of the refs are longterm */
64#else
65 int mnt_count;
66 int mnt_writers;
67#endif
55 struct list_head mnt_mounts; /* list of children, anchored here */ 68 struct list_head mnt_mounts; /* list of children, anchored here */
56 struct list_head mnt_child; /* and going through their mnt_child */ 69 struct list_head mnt_child; /* and going through their mnt_child */
57 int mnt_flags; 70 int mnt_flags;
@@ -70,57 +83,23 @@ struct vfsmount {
70 struct mnt_namespace *mnt_ns; /* containing namespace */ 83 struct mnt_namespace *mnt_ns; /* containing namespace */
71 int mnt_id; /* mount identifier */ 84 int mnt_id; /* mount identifier */
72 int mnt_group_id; /* peer group identifier */ 85 int mnt_group_id; /* peer group identifier */
73 /*
74 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
75 * to let these frequently modified fields in a separate cache line
76 * (so that reads of mnt_flags wont ping-pong on SMP machines)
77 */
78 atomic_t mnt_count;
79 int mnt_expiry_mark; /* true if marked for expiry */ 86 int mnt_expiry_mark; /* true if marked for expiry */
80 int mnt_pinned; 87 int mnt_pinned;
81 int mnt_ghosts; 88 int mnt_ghosts;
82#ifdef CONFIG_SMP
83 int __percpu *mnt_writers;
84#else
85 int mnt_writers;
86#endif
87}; 89};
88 90
89static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
90{
91#ifdef CONFIG_SMP
92 return mnt->mnt_writers;
93#else
94 return &mnt->mnt_writers;
95#endif
96}
97
98static inline struct vfsmount *mntget(struct vfsmount *mnt)
99{
100 if (mnt)
101 atomic_inc(&mnt->mnt_count);
102 return mnt;
103}
104
105struct file; /* forward dec */ 91struct file; /* forward dec */
106 92
107extern int mnt_want_write(struct vfsmount *mnt); 93extern int mnt_want_write(struct vfsmount *mnt);
108extern int mnt_want_write_file(struct file *file); 94extern int mnt_want_write_file(struct file *file);
109extern int mnt_clone_write(struct vfsmount *mnt); 95extern int mnt_clone_write(struct vfsmount *mnt);
110extern void mnt_drop_write(struct vfsmount *mnt); 96extern void mnt_drop_write(struct vfsmount *mnt);
111extern void mntput_no_expire(struct vfsmount *mnt); 97extern void mntput(struct vfsmount *mnt);
98extern struct vfsmount *mntget(struct vfsmount *mnt);
112extern void mnt_pin(struct vfsmount *mnt); 99extern void mnt_pin(struct vfsmount *mnt);
113extern void mnt_unpin(struct vfsmount *mnt); 100extern void mnt_unpin(struct vfsmount *mnt);
114extern int __mnt_is_readonly(struct vfsmount *mnt); 101extern int __mnt_is_readonly(struct vfsmount *mnt);
115 102
116static inline void mntput(struct vfsmount *mnt)
117{
118 if (mnt) {
119 mnt->mnt_expiry_mark = 0;
120 mntput_no_expire(mnt);
121 }
122}
123
124extern struct vfsmount *do_kern_mount(const char *fstype, int flags, 103extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
125 const char *name, void *data); 104 const char *name, void *data);
126 105
@@ -129,12 +108,7 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
129 int flags, const char *name, 108 int flags, const char *name,
130 void *data); 109 void *data);
131 110
132struct nameidata; 111extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
133
134struct path;
135extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
136 int mnt_flags, struct list_head *fslist);
137
138extern void mark_mounts_for_expiry(struct list_head *mounts); 112extern void mark_mounts_for_expiry(struct list_head *mounts);
139 113
140extern dev_t name_to_dev_t(char *name); 114extern dev_t name_to_dev_t(char *name);
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 0fa7a3a874c8..46caaf44339d 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -150,6 +150,7 @@ static inline int ip_mroute_opt(int opt)
150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int); 150extern int ip_mroute_setsockopt(struct sock *, int, char __user *, unsigned int);
151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 151extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 152extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
153extern int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
153extern int ip_mr_init(void); 154extern int ip_mr_init(void);
154#else 155#else
155static inline 156static inline
@@ -243,6 +244,7 @@ struct mfc_cache {
243#ifdef __KERNEL__ 244#ifdef __KERNEL__
244struct rtmsg; 245struct rtmsg;
245extern int ipmr_get_route(struct net *net, struct sk_buff *skb, 246extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
247 __be32 saddr, __be32 daddr,
246 struct rtmsg *rtm, int nowait); 248 struct rtmsg *rtm, int nowait);
247#endif 249#endif
248 250
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6091ab77f388..a3759cb0ac10 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -136,6 +136,7 @@ extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, unsigned int
136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 136extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
137extern int ip6_mr_input(struct sk_buff *skb); 137extern int ip6_mr_input(struct sk_buff *skb);
138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); 138extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
139extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
139extern int ip6_mr_init(void); 140extern int ip6_mr_init(void);
140extern void ip6_mr_cleanup(void); 141extern void ip6_mr_cleanup(void);
141#else 142#else
@@ -248,7 +249,7 @@ static inline int ip6mr_sk_done(struct sock *sk)
248 * Structure used to communicate from kernel to multicast router. 249 * Structure used to communicate from kernel to multicast router.
249 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{} 250 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
250 * used for IPv4 implementation). This is because this structure will be passed via an 251 * used for IPv4 implementation). This is because this structure will be passed via an
251 * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after 252 * IPv6 raw socket, on which an application will only receiver the payload i.e the data after
252 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542) 253 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
253 */ 254 */
254 255
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
index d11fe0f2f956..fe722c1fb61d 100644
--- a/include/linux/msm_mdp.h
+++ b/include/linux/msm_mdp.h
@@ -32,6 +32,7 @@ enum {
32 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */ 32 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
33 MDP_RGBA_8888, /* ARGB 888 */ 33 MDP_RGBA_8888, /* ARGB 888 */
34 MDP_BGRA_8888, /* ABGR 888 */ 34 MDP_BGRA_8888, /* ABGR 888 */
35 MDP_RGBX_8888, /* RGBX 888 */
35 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */ 36 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */
36}; 37};
37 38
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 7fa20beb2ab9..57cc0e63714f 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -84,7 +84,7 @@ struct nand_bbt_descr {
84#define NAND_BBT_PERCHIP 0x00000080 84#define NAND_BBT_PERCHIP 0x00000080
85/* bbt has a version counter at offset veroffs */ 85/* bbt has a version counter at offset veroffs */
86#define NAND_BBT_VERSION 0x00000100 86#define NAND_BBT_VERSION 0x00000100
87/* Create a bbt if none axists */ 87/* Create a bbt if none exists */
88#define NAND_BBT_CREATE 0x00000200 88#define NAND_BBT_CREATE 0x00000200
89/* Search good / bad pattern through all pages of a block */ 89/* Search good / bad pattern through all pages of a block */
90#define NAND_BBT_SCANALLPAGES 0x00000400 90#define NAND_BBT_SCANALLPAGES 0x00000400
@@ -102,6 +102,8 @@ struct nand_bbt_descr {
102#define NAND_BBT_SCANBYTE1AND6 0x00100000 102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */ 103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000 104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
105/* The bad block table does not OOB for marker */
106#define NAND_BBT_NO_OOB 0x00400000
105 107
106/* The maximum number of blocks to scan for a bbt */ 108/* The maximum number of blocks to scan for a bbt */
107#define NAND_BBT_SCAN_MAXBLOCKS 4 109#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 26529ebd59cc..1bbd9f289245 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -36,6 +36,7 @@ struct mtd_blktrans_dev {
36 struct mtd_info *mtd; 36 struct mtd_info *mtd;
37 struct mutex lock; 37 struct mutex lock;
38 int devnum; 38 int devnum;
39 bool bg_stop;
39 unsigned long size; 40 unsigned long size;
40 int readonly; 41 int readonly;
41 int open; 42 int open;
@@ -62,6 +63,7 @@ struct mtd_blktrans_ops {
62 unsigned long block, char *buffer); 63 unsigned long block, char *buffer);
63 int (*discard)(struct mtd_blktrans_dev *dev, 64 int (*discard)(struct mtd_blktrans_dev *dev,
64 unsigned long block, unsigned nr_blocks); 65 unsigned long block, unsigned nr_blocks);
66 void (*background)(struct mtd_blktrans_dev *dev);
65 67
66 /* Block layer ioctls */ 68 /* Block layer ioctls */
67 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); 69 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
@@ -85,6 +87,7 @@ extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
85extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); 87extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
86extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 88extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
87extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 89extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
90extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
88 91
89 92
90#endif /* __MTD_TRANS_H__ */ 93#endif /* __MTD_TRANS_H__ */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d2118b0eac9a..d24925492972 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -289,6 +289,7 @@ struct cfi_private {
289 must be of the same type. */ 289 must be of the same type. */
290 int mfr, id; 290 int mfr, id;
291 int numchips; 291 int numchips;
292 map_word sector_erase_cmd;
292 unsigned long chipshift; /* Because they're of the same type */ 293 unsigned long chipshift; /* Because they're of the same type */
293 const char *im_name; /* inter_module name for cmdset_setup */ 294 const char *im_name; /* inter_module name for cmdset_setup */
294 struct flchip chips[0]; /* per-chip data structure for each chip */ 295 struct flchip chips[0]; /* per-chip data structure for each chip */
@@ -307,7 +308,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
307 308
308 addr = (cmd_ofs * type) * interleave; 309 addr = (cmd_ofs * type) * interleave;
309 310
310 /* Modify the unlock address if we are in compatiblity mode. 311 /* Modify the unlock address if we are in compatibility mode.
311 * For 16bit devices on 8 bit busses 312 * For 16bit devices on 8 bit busses
312 * and 32bit devices on 16 bit busses 313 * and 32bit devices on 16 bit busses
313 * set the low bit of the alternating bit sequence of the address. 314 * set the low bit of the alternating bit sequence of the address.
@@ -526,8 +527,7 @@ struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t s
526struct cfi_fixup { 527struct cfi_fixup {
527 uint16_t mfr; 528 uint16_t mfr;
528 uint16_t id; 529 uint16_t id;
529 void (*fixup)(struct mtd_info *mtd, void* param); 530 void (*fixup)(struct mtd_info *mtd);
530 void* param;
531}; 531};
532 532
533#define CFI_MFR_ANY 0xFFFF 533#define CFI_MFR_ANY 0xFFFF
@@ -535,6 +535,7 @@ struct cfi_fixup {
535#define CFI_MFR_CONTINUATION 0x007F 535#define CFI_MFR_CONTINUATION 0x007F
536 536
537#define CFI_MFR_AMD 0x0001 537#define CFI_MFR_AMD 0x0001
538#define CFI_MFR_AMIC 0x0037
538#define CFI_MFR_ATMEL 0x001F 539#define CFI_MFR_ATMEL 0x001F
539#define CFI_MFR_EON 0x001C 540#define CFI_MFR_EON 0x001C
540#define CFI_MFR_FUJITSU 0x0004 541#define CFI_MFR_FUJITSU 0x0004
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
new file mode 100644
index 000000000000..6987995ad3cf
--- /dev/null
+++ b/include/linux/mtd/fsmc.h
@@ -0,0 +1,163 @@
1/*
2 * incude/mtd/fsmc.h
3 *
4 * ST Microelectronics
5 * Flexible Static Memory Controller (FSMC)
6 * platform data interface and header file
7 *
8 * Copyright © 2010 ST Microelectronics
9 * Vipin Kumar <vipin.kumar@st.com>
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14 */
15
16#ifndef __MTD_FSMC_H
17#define __MTD_FSMC_H
18
19#include <linux/io.h>
20#include <linux/platform_device.h>
21#include <linux/mtd/physmap.h>
22#include <linux/types.h>
23#include <linux/mtd/partitions.h>
24#include <asm/param.h>
25
26#define FSMC_NAND_BW8 1
27#define FSMC_NAND_BW16 2
28
29/*
30 * The placement of the Command Latch Enable (CLE) and
31 * Address Latch Enable (ALE) is twisted around in the
32 * SPEAR310 implementation.
33 */
34#if defined(CONFIG_MACH_SPEAR310)
35#define PLAT_NAND_CLE (1 << 17)
36#define PLAT_NAND_ALE (1 << 16)
37#else
38#define PLAT_NAND_CLE (1 << 16)
39#define PLAT_NAND_ALE (1 << 17)
40#endif
41
42#define FSMC_MAX_NOR_BANKS 4
43#define FSMC_MAX_NAND_BANKS 4
44
45#define FSMC_FLASH_WIDTH8 1
46#define FSMC_FLASH_WIDTH16 2
47
48struct fsmc_nor_bank_regs {
49 uint32_t ctrl;
50 uint32_t ctrl_tim;
51};
52
53/* ctrl register definitions */
54#define BANK_ENABLE (1 << 0)
55#define MUXED (1 << 1)
56#define NOR_DEV (2 << 2)
57#define WIDTH_8 (0 << 4)
58#define WIDTH_16 (1 << 4)
59#define RSTPWRDWN (1 << 6)
60#define WPROT (1 << 7)
61#define WRT_ENABLE (1 << 12)
62#define WAIT_ENB (1 << 13)
63
64/* ctrl_tim register definitions */
65
66struct fsmc_nand_bank_regs {
67 uint32_t pc;
68 uint32_t sts;
69 uint32_t comm;
70 uint32_t attrib;
71 uint32_t ioata;
72 uint32_t ecc1;
73 uint32_t ecc2;
74 uint32_t ecc3;
75};
76
77#define FSMC_NOR_REG_SIZE 0x40
78
79struct fsmc_regs {
80 struct fsmc_nor_bank_regs nor_bank_regs[FSMC_MAX_NOR_BANKS];
81 uint8_t reserved_1[0x40 - 0x20];
82 struct fsmc_nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS];
83 uint8_t reserved_2[0xfe0 - 0xc0];
84 uint32_t peripid0; /* 0xfe0 */
85 uint32_t peripid1; /* 0xfe4 */
86 uint32_t peripid2; /* 0xfe8 */
87 uint32_t peripid3; /* 0xfec */
88 uint32_t pcellid0; /* 0xff0 */
89 uint32_t pcellid1; /* 0xff4 */
90 uint32_t pcellid2; /* 0xff8 */
91 uint32_t pcellid3; /* 0xffc */
92};
93
94#define FSMC_BUSY_WAIT_TIMEOUT (1 * HZ)
95
96/* pc register definitions */
97#define FSMC_RESET (1 << 0)
98#define FSMC_WAITON (1 << 1)
99#define FSMC_ENABLE (1 << 2)
100#define FSMC_DEVTYPE_NAND (1 << 3)
101#define FSMC_DEVWID_8 (0 << 4)
102#define FSMC_DEVWID_16 (1 << 4)
103#define FSMC_ECCEN (1 << 6)
104#define FSMC_ECCPLEN_512 (0 << 7)
105#define FSMC_ECCPLEN_256 (1 << 7)
106#define FSMC_TCLR_1 (1 << 9)
107#define FSMC_TAR_1 (1 << 13)
108
109/* sts register definitions */
110#define FSMC_CODE_RDY (1 << 15)
111
112/* comm register definitions */
113#define FSMC_TSET_0 (0 << 0)
114#define FSMC_TWAIT_6 (6 << 8)
115#define FSMC_THOLD_4 (4 << 16)
116#define FSMC_THIZ_1 (1 << 24)
117
118/*
119 * There are 13 bytes of ecc for every 512 byte block in FSMC version 8
120 * and it has to be read consecutively and immediately after the 512
121 * byte data block for hardware to generate the error bit offsets
122 * Managing the ecc bytes in the following way is easier. This way is
123 * similar to oobfree structure maintained already in u-boot nand driver
124 */
125#define MAX_ECCPLACE_ENTRIES 32
126
127struct fsmc_nand_eccplace {
128 uint8_t offset;
129 uint8_t length;
130};
131
132struct fsmc_eccplace {
133 struct fsmc_nand_eccplace eccplace[MAX_ECCPLACE_ENTRIES];
134};
135
136/**
137 * fsmc_nand_platform_data - platform specific NAND controller config
138 * @partitions: partition table for the platform, use a default fallback
139 * if this is NULL
140 * @nr_partitions: the number of partitions in the previous entry
141 * @options: different options for the driver
142 * @width: bus width
143 * @bank: default bank
144 * @select_bank: callback to select a certain bank, this is
145 * platform-specific. If the controller only supports one bank
146 * this may be set to NULL
147 */
148struct fsmc_nand_platform_data {
149 struct mtd_partition *partitions;
150 unsigned int nr_partitions;
151 unsigned int options;
152 unsigned int width;
153 unsigned int bank;
154 void (*select_bank)(uint32_t bank, uint32_t busw);
155};
156
157extern int __init fsmc_nor_init(struct platform_device *pdev,
158 unsigned long base, uint32_t bank, uint32_t width);
159extern void __init fsmc_init_board_info(struct platform_device *pdev,
160 struct mtd_partition *partitions, unsigned int nr_partitions,
161 unsigned int width);
162
163#endif /* __MTD_FSMC_H */
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 64ee53ce95a9..02cd5f9b79b8 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -37,14 +37,14 @@ struct INFTLrecord {
37 __u16 firstEUN; 37 __u16 firstEUN;
38 __u16 lastEUN; 38 __u16 lastEUN;
39 __u16 numfreeEUNs; 39 __u16 numfreeEUNs;
40 __u16 LastFreeEUN; /* To speed up finding a free EUN */ 40 __u16 LastFreeEUN; /* To speed up finding a free EUN */
41 int head,sect,cyl; 41 int head,sect,cyl;
42 __u16 *PUtable; /* Physical Unit Table */ 42 __u16 *PUtable; /* Physical Unit Table */
43 __u16 *VUtable; /* Virtual Unit Table */ 43 __u16 *VUtable; /* Virtual Unit Table */
44 unsigned int nb_blocks; /* number of physical blocks */ 44 unsigned int nb_blocks; /* number of physical blocks */
45 unsigned int nb_boot_blocks; /* number of blocks used by the bios */ 45 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
46 struct erase_info instr; 46 struct erase_info instr;
47 struct nand_ecclayout oobinfo; 47 struct nand_ecclayout oobinfo;
48}; 48};
49 49
50int INFTL_mount(struct INFTLrecord *s); 50int INFTL_mount(struct INFTLrecord *s);
diff --git a/include/linux/mtd/latch-addr-flash.h b/include/linux/mtd/latch-addr-flash.h
new file mode 100644
index 000000000000..e94b8e128074
--- /dev/null
+++ b/include/linux/mtd/latch-addr-flash.h
@@ -0,0 +1,29 @@
1/*
2 * Interface for NOR flash driver whose high address lines are latched
3 *
4 * Copyright © 2008 MontaVista Software, Inc. <source@mvista.com>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10#ifndef __LATCH_ADDR_FLASH__
11#define __LATCH_ADDR_FLASH__
12
13struct map_info;
14struct mtd_partition;
15
16struct latch_addr_flash_data {
17 unsigned int width;
18 unsigned int size;
19
20 int (*init)(void *data, int cs);
21 void (*done)(void *data);
22 void (*set_window)(unsigned long offset, void *data);
23 void *data;
24
25 unsigned int nr_parts;
26 struct mtd_partition *parts;
27};
28
29#endif
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8485e42a9b09..9d5306bad117 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -110,6 +110,21 @@ struct mtd_oob_ops {
110 uint8_t *oobbuf; 110 uint8_t *oobbuf;
111}; 111};
112 112
113#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
114#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448
115/*
116 * Internal ECC layout control structure. For historical reasons, there is a
117 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
118 * for export to user-space via the ECCGETLAYOUT ioctl.
119 * nand_ecclayout should be expandable in the future simply by the above macros.
120 */
121struct nand_ecclayout {
122 __u32 eccbytes;
123 __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE];
124 __u32 oobavail;
125 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
126};
127
113struct mtd_info { 128struct mtd_info {
114 u_char type; 129 u_char type;
115 uint32_t flags; 130 uint32_t flags;
@@ -129,6 +144,17 @@ struct mtd_info {
129 */ 144 */
130 uint32_t writesize; 145 uint32_t writesize;
131 146
147 /*
148 * Size of the write buffer used by the MTD. MTD devices having a write
149 * buffer can write multiple writesize chunks at a time. E.g. while
150 * writing 4 * writesize bytes to a device with 2 * writesize bytes
151 * buffer the MTD driver can (but doesn't have to) do 2 writesize
152 * operations, but not 4. Currently, all NANDs have writebufsize
153 * equivalent to writesize (NAND page size). Some NOR flashes do have
154 * writebufsize greater than writesize.
155 */
156 uint32_t writebufsize;
157
132 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 158 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
133 uint32_t oobavail; // Available OOB bytes per block 159 uint32_t oobavail; // Available OOB bytes per block
134 160
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 102e12c58cb3..d44192740f6f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -27,15 +27,17 @@
27struct mtd_info; 27struct mtd_info;
28struct nand_flash_dev; 28struct nand_flash_dev;
29/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
30extern int nand_scan (struct mtd_info *mtd, int max_chips); 30extern int nand_scan(struct mtd_info *mtd, int max_chips);
31/* Separate phases of nand_scan(), allowing board driver to intervene 31/*
32 * and override command or ECC setup according to flash type */ 32 * Separate phases of nand_scan(), allowing board driver to intervene
33 * and override command or ECC setup according to flash type.
34 */
33extern int nand_scan_ident(struct mtd_info *mtd, int max_chips, 35extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
34 struct nand_flash_dev *table); 36 struct nand_flash_dev *table);
35extern int nand_scan_tail(struct mtd_info *mtd); 37extern int nand_scan_tail(struct mtd_info *mtd);
36 38
37/* Free resources held by the NAND device */ 39/* Free resources held by the NAND device */
38extern void nand_release (struct mtd_info *mtd); 40extern void nand_release(struct mtd_info *mtd);
39 41
40/* Internal helper for board drivers which need to override command function */ 42/* Internal helper for board drivers which need to override command function */
41extern void nand_wait_ready(struct mtd_info *mtd); 43extern void nand_wait_ready(struct mtd_info *mtd);
@@ -49,12 +51,13 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
49/* The maximum number of NAND chips in an array */ 51/* The maximum number of NAND chips in an array */
50#define NAND_MAX_CHIPS 8 52#define NAND_MAX_CHIPS 8
51 53
52/* This constant declares the max. oobsize / page, which 54/*
55 * This constant declares the max. oobsize / page, which
53 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
54 * adjust this accordingly. 57 * adjust this accordingly.
55 */ 58 */
56#define NAND_MAX_OOBSIZE 256 59#define NAND_MAX_OOBSIZE 576
57#define NAND_MAX_PAGESIZE 4096 60#define NAND_MAX_PAGESIZE 8192
58 61
59/* 62/*
60 * Constants for hardware specific CLE/ALE/NCE function 63 * Constants for hardware specific CLE/ALE/NCE function
@@ -88,6 +91,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
88#define NAND_CMD_RNDIN 0x85 91#define NAND_CMD_RNDIN 0x85
89#define NAND_CMD_READID 0x90 92#define NAND_CMD_READID 0x90
90#define NAND_CMD_ERASE2 0xd0 93#define NAND_CMD_ERASE2 0xd0
94#define NAND_CMD_PARAM 0xec
91#define NAND_CMD_RESET 0xff 95#define NAND_CMD_RESET 0xff
92 96
93#define NAND_CMD_LOCK 0x2a 97#define NAND_CMD_LOCK 0x2a
@@ -136,6 +140,7 @@ typedef enum {
136 NAND_ECC_HW, 140 NAND_ECC_HW,
137 NAND_ECC_HW_SYNDROME, 141 NAND_ECC_HW_SYNDROME,
138 NAND_ECC_HW_OOB_FIRST, 142 NAND_ECC_HW_OOB_FIRST,
143 NAND_ECC_SOFT_BCH,
139} nand_ecc_modes_t; 144} nand_ecc_modes_t;
140 145
141/* 146/*
@@ -152,9 +157,10 @@ typedef enum {
152#define NAND_GET_DEVICE 0x80 157#define NAND_GET_DEVICE 0x80
153 158
154 159
155/* Option constants for bizarre disfunctionality and real 160/*
156* features 161 * Option constants for bizarre disfunctionality and real
157*/ 162 * features.
163 */
158/* Chip can not auto increment pages */ 164/* Chip can not auto increment pages */
159#define NAND_NO_AUTOINCR 0x00000001 165#define NAND_NO_AUTOINCR 0x00000001
160/* Buswitdh is 16 bit */ 166/* Buswitdh is 16 bit */
@@ -165,19 +171,27 @@ typedef enum {
165#define NAND_CACHEPRG 0x00000008 171#define NAND_CACHEPRG 0x00000008
166/* Chip has copy back function */ 172/* Chip has copy back function */
167#define NAND_COPYBACK 0x00000010 173#define NAND_COPYBACK 0x00000010
168/* AND Chip which has 4 banks and a confusing page / block 174/*
169 * assignment. See Renesas datasheet for further information */ 175 * AND Chip which has 4 banks and a confusing page / block
176 * assignment. See Renesas datasheet for further information.
177 */
170#define NAND_IS_AND 0x00000020 178#define NAND_IS_AND 0x00000020
171/* Chip has a array of 4 pages which can be read without 179/*
172 * additional ready /busy waits */ 180 * Chip has a array of 4 pages which can be read without
181 * additional ready /busy waits.
182 */
173#define NAND_4PAGE_ARRAY 0x00000040 183#define NAND_4PAGE_ARRAY 0x00000040
174/* Chip requires that BBT is periodically rewritten to prevent 184/*
185 * Chip requires that BBT is periodically rewritten to prevent
175 * bits from adjacent blocks from 'leaking' in altering data. 186 * bits from adjacent blocks from 'leaking' in altering data.
176 * This happens with the Renesas AG-AND chips, possibly others. */ 187 * This happens with the Renesas AG-AND chips, possibly others.
188 */
177#define BBT_AUTO_REFRESH 0x00000080 189#define BBT_AUTO_REFRESH 0x00000080
178/* Chip does not require ready check on read. True 190/*
191 * Chip does not require ready check on read. True
179 * for all large page devices, as they do not support 192 * for all large page devices, as they do not support
180 * autoincrement.*/ 193 * autoincrement.
194 */
181#define NAND_NO_READRDY 0x00000100 195#define NAND_NO_READRDY 0x00000100
182/* Chip does not allow subpage writes */ 196/* Chip does not allow subpage writes */
183#define NAND_NO_SUBPAGE_WRITE 0x00000200 197#define NAND_NO_SUBPAGE_WRITE 0x00000200
@@ -205,16 +219,27 @@ typedef enum {
205#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) 219#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
206 220
207/* Non chip related options */ 221/* Non chip related options */
208/* Use a flash based bad block table. This option is passed to the 222/*
209 * default bad block table function. */ 223 * Use a flash based bad block table. OOB identifier is saved in OOB area.
224 * This option is passed to the default bad block table function.
225 */
210#define NAND_USE_FLASH_BBT 0x00010000 226#define NAND_USE_FLASH_BBT 0x00010000
211/* This option skips the bbt scan during initialization. */ 227/* This option skips the bbt scan during initialization. */
212#define NAND_SKIP_BBTSCAN 0x00020000 228#define NAND_SKIP_BBTSCAN 0x00020000
213/* This option is defined if the board driver allocates its own buffers 229/*
214 (e.g. because it needs them DMA-coherent */ 230 * This option is defined if the board driver allocates its own buffers
231 * (e.g. because it needs them DMA-coherent).
232 */
215#define NAND_OWN_BUFFERS 0x00040000 233#define NAND_OWN_BUFFERS 0x00040000
216/* Chip may not exist, so silence any errors in scan */ 234/* Chip may not exist, so silence any errors in scan */
217#define NAND_SCAN_SILENT_NODEV 0x00080000 235#define NAND_SCAN_SILENT_NODEV 0x00080000
236/*
237 * If passed additionally to NAND_USE_FLASH_BBT then BBT code will not touch
238 * the OOB area.
239 */
240#define NAND_USE_FLASH_BBT_NO_OOB 0x00100000
241/* Create an empty BBT with no vendor information if the BBT is available */
242#define NAND_CREATE_EMPTY_BBT 0x00200000
218 243
219/* Options set by nand scan */ 244/* Options set by nand scan */
220/* Nand scan has allocated controller struct */ 245/* Nand scan has allocated controller struct */
@@ -227,15 +252,80 @@ typedef enum {
227/* Keep gcc happy */ 252/* Keep gcc happy */
228struct nand_chip; 253struct nand_chip;
229 254
255struct nand_onfi_params {
256 /* rev info and features block */
257 /* 'O' 'N' 'F' 'I' */
258 u8 sig[4];
259 __le16 revision;
260 __le16 features;
261 __le16 opt_cmd;
262 u8 reserved[22];
263
264 /* manufacturer information block */
265 char manufacturer[12];
266 char model[20];
267 u8 jedec_id;
268 __le16 date_code;
269 u8 reserved2[13];
270
271 /* memory organization block */
272 __le32 byte_per_page;
273 __le16 spare_bytes_per_page;
274 __le32 data_bytes_per_ppage;
275 __le16 spare_bytes_per_ppage;
276 __le32 pages_per_block;
277 __le32 blocks_per_lun;
278 u8 lun_count;
279 u8 addr_cycles;
280 u8 bits_per_cell;
281 __le16 bb_per_lun;
282 __le16 block_endurance;
283 u8 guaranteed_good_blocks;
284 __le16 guaranteed_block_endurance;
285 u8 programs_per_page;
286 u8 ppage_attr;
287 u8 ecc_bits;
288 u8 interleaved_bits;
289 u8 interleaved_ops;
290 u8 reserved3[13];
291
292 /* electrical parameter block */
293 u8 io_pin_capacitance_max;
294 __le16 async_timing_mode;
295 __le16 program_cache_timing_mode;
296 __le16 t_prog;
297 __le16 t_bers;
298 __le16 t_r;
299 __le16 t_ccs;
300 __le16 src_sync_timing_mode;
301 __le16 src_ssync_features;
302 __le16 clk_pin_capacitance_typ;
303 __le16 io_pin_capacitance_typ;
304 __le16 input_pin_capacitance_typ;
305 u8 input_pin_capacitance_max;
306 u8 driver_strenght_support;
307 __le16 t_int_r;
308 __le16 t_ald;
309 u8 reserved4[7];
310
311 /* vendor */
312 u8 reserved5[90];
313
314 __le16 crc;
315} __attribute__((packed));
316
317#define ONFI_CRC_BASE 0x4F4E
318
230/** 319/**
231 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 320 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
232 * @lock: protection lock 321 * @lock: protection lock
233 * @active: the mtd device which holds the controller currently 322 * @active: the mtd device which holds the controller currently
234 * @wq: wait queue to sleep on if a NAND operation is in progress 323 * @wq: wait queue to sleep on if a NAND operation is in
235 * used instead of the per chip wait queue when a hw controller is available 324 * progress used instead of the per chip wait queue
325 * when a hw controller is available.
236 */ 326 */
237struct nand_hw_control { 327struct nand_hw_control {
238 spinlock_t lock; 328 spinlock_t lock;
239 struct nand_chip *active; 329 struct nand_chip *active;
240 wait_queue_head_t wq; 330 wait_queue_head_t wq;
241}; 331};
@@ -250,57 +340,50 @@ struct nand_hw_control {
250 * @prepad: padding information for syndrome based ecc generators 340 * @prepad: padding information for syndrome based ecc generators
251 * @postpad: padding information for syndrome based ecc generators 341 * @postpad: padding information for syndrome based ecc generators
252 * @layout: ECC layout control struct pointer 342 * @layout: ECC layout control struct pointer
343 * @priv: pointer to private ecc control data
253 * @hwctl: function to control hardware ecc generator. Must only 344 * @hwctl: function to control hardware ecc generator. Must only
254 * be provided if an hardware ECC is available 345 * be provided if an hardware ECC is available
255 * @calculate: function for ecc calculation or readback from ecc hardware 346 * @calculate: function for ecc calculation or readback from ecc hardware
256 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 347 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
257 * @read_page_raw: function to read a raw page without ECC 348 * @read_page_raw: function to read a raw page without ECC
258 * @write_page_raw: function to write a raw page without ECC 349 * @write_page_raw: function to write a raw page without ECC
259 * @read_page: function to read a page according to the ecc generator requirements 350 * @read_page: function to read a page according to the ecc generator
351 * requirements.
260 * @read_subpage: function to read parts of the page covered by ECC. 352 * @read_subpage: function to read parts of the page covered by ECC.
261 * @write_page: function to write a page according to the ecc generator requirements 353 * @write_page: function to write a page according to the ecc generator
354 * requirements.
262 * @read_oob: function to read chip OOB data 355 * @read_oob: function to read chip OOB data
263 * @write_oob: function to write chip OOB data 356 * @write_oob: function to write chip OOB data
264 */ 357 */
265struct nand_ecc_ctrl { 358struct nand_ecc_ctrl {
266 nand_ecc_modes_t mode; 359 nand_ecc_modes_t mode;
267 int steps; 360 int steps;
268 int size; 361 int size;
269 int bytes; 362 int bytes;
270 int total; 363 int total;
271 int prepad; 364 int prepad;
272 int postpad; 365 int postpad;
273 struct nand_ecclayout *layout; 366 struct nand_ecclayout *layout;
274 void (*hwctl)(struct mtd_info *mtd, int mode); 367 void *priv;
275 int (*calculate)(struct mtd_info *mtd, 368 void (*hwctl)(struct mtd_info *mtd, int mode);
276 const uint8_t *dat, 369 int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
277 uint8_t *ecc_code); 370 uint8_t *ecc_code);
278 int (*correct)(struct mtd_info *mtd, uint8_t *dat, 371 int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,
279 uint8_t *read_ecc, 372 uint8_t *calc_ecc);
280 uint8_t *calc_ecc); 373 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
281 int (*read_page_raw)(struct mtd_info *mtd, 374 uint8_t *buf, int page);
282 struct nand_chip *chip, 375 void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
283 uint8_t *buf, int page); 376 const uint8_t *buf);
284 void (*write_page_raw)(struct mtd_info *mtd, 377 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
285 struct nand_chip *chip, 378 uint8_t *buf, int page);
286 const uint8_t *buf); 379 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
287 int (*read_page)(struct mtd_info *mtd, 380 uint32_t offs, uint32_t len, uint8_t *buf);
288 struct nand_chip *chip, 381 void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
289 uint8_t *buf, int page); 382 const uint8_t *buf);
290 int (*read_subpage)(struct mtd_info *mtd, 383 int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page,
291 struct nand_chip *chip, 384 int sndcmd);
292 uint32_t offs, uint32_t len, 385 int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip,
293 uint8_t *buf); 386 int page);
294 void (*write_page)(struct mtd_info *mtd,
295 struct nand_chip *chip,
296 const uint8_t *buf);
297 int (*read_oob)(struct mtd_info *mtd,
298 struct nand_chip *chip,
299 int page,
300 int sndcmd);
301 int (*write_oob)(struct mtd_info *mtd,
302 struct nand_chip *chip,
303 int page);
304}; 387};
305 388
306/** 389/**
@@ -320,102 +403,134 @@ struct nand_buffers {
320 403
321/** 404/**
322 * struct nand_chip - NAND Private Flash Chip Data 405 * struct nand_chip - NAND Private Flash Chip Data
323 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device 406 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the
324 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device 407 * flash device
408 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the
409 * flash device.
325 * @read_byte: [REPLACEABLE] read one byte from the chip 410 * @read_byte: [REPLACEABLE] read one byte from the chip
326 * @read_word: [REPLACEABLE] read one word from the chip 411 * @read_word: [REPLACEABLE] read one word from the chip
327 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 412 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
328 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 413 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
329 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data 414 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip
415 * data.
330 * @select_chip: [REPLACEABLE] select chip nr 416 * @select_chip: [REPLACEABLE] select chip nr
331 * @block_bad: [REPLACEABLE] check, if the block is bad 417 * @block_bad: [REPLACEABLE] check, if the block is bad
332 * @block_markbad: [REPLACEABLE] mark the block bad 418 * @block_markbad: [REPLACEABLE] mark the block bad
333 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling 419 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling
334 * ALE/CLE/nCE. Also used to write command and address 420 * ALE/CLE/nCE. Also used to write command and address
335 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line 421 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting
336 * If set to NULL no access to ready/busy is available and the ready/busy information 422 * mtd->oobsize, mtd->writesize and so on.
337 * is read from the chip status register 423 * @id_data contains the 8 bytes values of NAND_CMD_READID.
338 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip 424 * Return with the bus width.
339 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready 425 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing
426 * device ready/busy line. If set to NULL no access to
427 * ready/busy is available and the ready/busy information
428 * is read from the chip status register.
429 * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing
430 * commands to the chip.
431 * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on
432 * ready.
340 * @ecc: [BOARDSPECIFIC] ecc control ctructure 433 * @ecc: [BOARDSPECIFIC] ecc control ctructure
341 * @buffers: buffer structure for read/write 434 * @buffers: buffer structure for read/write
342 * @hwcontrol: platform-specific hardware control structure 435 * @hwcontrol: platform-specific hardware control structure
343 * @ops: oob operation operands 436 * @ops: oob operation operands
344 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 437 * @erase_cmd: [INTERN] erase command write function, selectable due
438 * to AND support.
345 * @scan_bbt: [REPLACEABLE] function to scan bad block table 439 * @scan_bbt: [REPLACEABLE] function to scan bad block table
346 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 440 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
441 * data from array to read regs (tR).
347 * @state: [INTERN] the current state of the NAND device 442 * @state: [INTERN] the current state of the NAND device
348 * @oob_poi: poison value buffer 443 * @oob_poi: poison value buffer
349 * @page_shift: [INTERN] number of address bits in a page (column address bits) 444 * @page_shift: [INTERN] number of address bits in a page (column
445 * address bits).
350 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 446 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
351 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 447 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
352 * @chip_shift: [INTERN] number of address bits in one chip 448 * @chip_shift: [INTERN] number of address bits in one chip
353 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 449 * @options: [BOARDSPECIFIC] various chip options. They can partly
354 * special functionality. See the defines for further explanation 450 * be set to inform nand_scan about special functionality.
355 * @badblockpos: [INTERN] position of the bad block marker in the oob area 451 * See the defines for further explanation.
452 * @badblockpos: [INTERN] position of the bad block marker in the oob
453 * area.
454 * @badblockbits: [INTERN] number of bits to left-shift the bad block
455 * number
356 * @cellinfo: [INTERN] MLC/multichip data from chip ident 456 * @cellinfo: [INTERN] MLC/multichip data from chip ident
357 * @numchips: [INTERN] number of physical chips 457 * @numchips: [INTERN] number of physical chips
358 * @chipsize: [INTERN] the size of one chip for multichip arrays 458 * @chipsize: [INTERN] the size of one chip for multichip arrays
359 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 459 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
360 * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf 460 * @pagebuf: [INTERN] holds the pagenumber which is currently in
461 * data_buf.
361 * @subpagesize: [INTERN] holds the subpagesize 462 * @subpagesize: [INTERN] holds the subpagesize
463 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded),
464 * non 0 if ONFI supported.
465 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
466 * supported, 0 otherwise.
362 * @ecclayout: [REPLACEABLE] the default ecc placement scheme 467 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
363 * @bbt: [INTERN] bad block table pointer 468 * @bbt: [INTERN] bad block table pointer
364 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup 469 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
470 * lookup.
365 * @bbt_md: [REPLACEABLE] bad block table mirror descriptor 471 * @bbt_md: [REPLACEABLE] bad block table mirror descriptor
366 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan 472 * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial
367 * @controller: [REPLACEABLE] a pointer to a hardware controller structure 473 * bad block scan.
368 * which is shared among multiple independend devices 474 * @controller: [REPLACEABLE] a pointer to a hardware controller
475 * structure which is shared among multiple independend
476 * devices.
369 * @priv: [OPTIONAL] pointer to private chip date 477 * @priv: [OPTIONAL] pointer to private chip date
370 * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks 478 * @errstat: [OPTIONAL] hardware specific function to perform
371 * (determine if errors are correctable) 479 * additional error status checks (determine if errors are
480 * correctable).
372 * @write_page: [REPLACEABLE] High-level page write function 481 * @write_page: [REPLACEABLE] High-level page write function
373 */ 482 */
374 483
375struct nand_chip { 484struct nand_chip {
376 void __iomem *IO_ADDR_R; 485 void __iomem *IO_ADDR_R;
377 void __iomem *IO_ADDR_W; 486 void __iomem *IO_ADDR_W;
378 487
379 uint8_t (*read_byte)(struct mtd_info *mtd); 488 uint8_t (*read_byte)(struct mtd_info *mtd);
380 u16 (*read_word)(struct mtd_info *mtd); 489 u16 (*read_word)(struct mtd_info *mtd);
381 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 490 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
382 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); 491 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
383 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 492 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
384 void (*select_chip)(struct mtd_info *mtd, int chip); 493 void (*select_chip)(struct mtd_info *mtd, int chip);
385 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); 494 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
386 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 495 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
387 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, 496 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
388 unsigned int ctrl); 497 int (*init_size)(struct mtd_info *mtd, struct nand_chip *this,
389 int (*dev_ready)(struct mtd_info *mtd); 498 u8 *id_data);
390 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); 499 int (*dev_ready)(struct mtd_info *mtd);
391 int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); 500 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
392 void (*erase_cmd)(struct mtd_info *mtd, int page); 501 int page_addr);
393 int (*scan_bbt)(struct mtd_info *mtd); 502 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
394 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); 503 void (*erase_cmd)(struct mtd_info *mtd, int page);
395 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 504 int (*scan_bbt)(struct mtd_info *mtd);
396 const uint8_t *buf, int page, int cached, int raw); 505 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
397 506 int status, int page);
398 int chip_delay; 507 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
399 unsigned int options; 508 const uint8_t *buf, int page, int cached, int raw);
400 509
401 int page_shift; 510 int chip_delay;
402 int phys_erase_shift; 511 unsigned int options;
403 int bbt_erase_shift; 512
404 int chip_shift; 513 int page_shift;
405 int numchips; 514 int phys_erase_shift;
406 uint64_t chipsize; 515 int bbt_erase_shift;
407 int pagemask; 516 int chip_shift;
408 int pagebuf; 517 int numchips;
409 int subpagesize; 518 uint64_t chipsize;
410 uint8_t cellinfo; 519 int pagemask;
411 int badblockpos; 520 int pagebuf;
412 int badblockbits; 521 int subpagesize;
413 522 uint8_t cellinfo;
414 flstate_t state; 523 int badblockpos;
415 524 int badblockbits;
416 uint8_t *oob_poi; 525
417 struct nand_hw_control *controller; 526 int onfi_version;
418 struct nand_ecclayout *ecclayout; 527 struct nand_onfi_params onfi_params;
528
529 flstate_t state;
530
531 uint8_t *oob_poi;
532 struct nand_hw_control *controller;
533 struct nand_ecclayout *ecclayout;
419 534
420 struct nand_ecc_ctrl ecc; 535 struct nand_ecc_ctrl ecc;
421 struct nand_buffers *buffers; 536 struct nand_buffers *buffers;
@@ -423,13 +538,13 @@ struct nand_chip {
423 538
424 struct mtd_oob_ops ops; 539 struct mtd_oob_ops ops;
425 540
426 uint8_t *bbt; 541 uint8_t *bbt;
427 struct nand_bbt_descr *bbt_td; 542 struct nand_bbt_descr *bbt_td;
428 struct nand_bbt_descr *bbt_md; 543 struct nand_bbt_descr *bbt_md;
429 544
430 struct nand_bbt_descr *badblock_pattern; 545 struct nand_bbt_descr *badblock_pattern;
431 546
432 void *priv; 547 void *priv;
433}; 548};
434 549
435/* 550/*
@@ -473,7 +588,7 @@ struct nand_flash_dev {
473*/ 588*/
474struct nand_manufacturers { 589struct nand_manufacturers {
475 int id; 590 int id;
476 char * name; 591 char *name;
477}; 592};
478 593
479extern struct nand_flash_dev nand_flash_ids[]; 594extern struct nand_flash_dev nand_flash_ids[];
@@ -486,7 +601,7 @@ extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
486extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 601extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
487 int allowbbt); 602 int allowbbt);
488extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, 603extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
489 size_t * retlen, uint8_t * buf); 604 size_t *retlen, uint8_t *buf);
490 605
491/** 606/**
492 * struct platform_nand_chip - chip level device structure 607 * struct platform_nand_chip - chip level device structure
@@ -502,17 +617,16 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
502 * @priv: hardware controller specific settings 617 * @priv: hardware controller specific settings
503 */ 618 */
504struct platform_nand_chip { 619struct platform_nand_chip {
505 int nr_chips; 620 int nr_chips;
506 int chip_offset; 621 int chip_offset;
507 int nr_partitions; 622 int nr_partitions;
508 struct mtd_partition *partitions; 623 struct mtd_partition *partitions;
509 struct nand_ecclayout *ecclayout; 624 struct nand_ecclayout *ecclayout;
510 int chip_delay; 625 int chip_delay;
511 unsigned int options; 626 unsigned int options;
512 const char **part_probe_types; 627 const char **part_probe_types;
513 void (*set_parts)(uint64_t size, 628 void (*set_parts)(uint64_t size, struct platform_nand_chip *chip);
514 struct platform_nand_chip *chip); 629 void *priv;
515 void *priv;
516}; 630};
517 631
518/* Keep gcc happy */ 632/* Keep gcc happy */
@@ -534,18 +648,15 @@ struct platform_device;
534 * All fields are optional and depend on the hardware driver requirements 648 * All fields are optional and depend on the hardware driver requirements
535 */ 649 */
536struct platform_nand_ctrl { 650struct platform_nand_ctrl {
537 int (*probe)(struct platform_device *pdev); 651 int (*probe)(struct platform_device *pdev);
538 void (*remove)(struct platform_device *pdev); 652 void (*remove)(struct platform_device *pdev);
539 void (*hwcontrol)(struct mtd_info *mtd, int cmd); 653 void (*hwcontrol)(struct mtd_info *mtd, int cmd);
540 int (*dev_ready)(struct mtd_info *mtd); 654 int (*dev_ready)(struct mtd_info *mtd);
541 void (*select_chip)(struct mtd_info *mtd, int chip); 655 void (*select_chip)(struct mtd_info *mtd, int chip);
542 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, 656 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
543 unsigned int ctrl); 657 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
544 void (*write_buf)(struct mtd_info *mtd, 658 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
545 const uint8_t *buf, int len); 659 void *priv;
546 void (*read_buf)(struct mtd_info *mtd,
547 uint8_t *buf, int len);
548 void *priv;
549}; 660};
550 661
551/** 662/**
@@ -554,8 +665,8 @@ struct platform_nand_ctrl {
554 * @ctrl: controller level device structure 665 * @ctrl: controller level device structure
555 */ 666 */
556struct platform_nand_data { 667struct platform_nand_data {
557 struct platform_nand_chip chip; 668 struct platform_nand_chip chip;
558 struct platform_nand_ctrl ctrl; 669 struct platform_nand_ctrl ctrl;
559}; 670};
560 671
561/* Some helpers to access the data structures */ 672/* Some helpers to access the data structures */
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
new file mode 100644
index 000000000000..74acf5367556
--- /dev/null
+++ b/include/linux/mtd/nand_bch.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This file is the header for the NAND BCH ECC implementation.
9 */
10
11#ifndef __MTD_NAND_BCH_H__
12#define __MTD_NAND_BCH_H__
13
14struct mtd_info;
15struct nand_bch_control;
16
17#if defined(CONFIG_MTD_NAND_ECC_BCH)
18
19static inline int mtd_nand_has_bch(void) { return 1; }
20
21/*
22 * Calculate BCH ecc code
23 */
24int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
25 u_char *ecc_code);
26
27/*
28 * Detect and correct bit errors
29 */
30int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
31 u_char *calc_ecc);
32/*
33 * Initialize BCH encoder/decoder
34 */
35struct nand_bch_control *
36nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
37 unsigned int eccbytes, struct nand_ecclayout **ecclayout);
38/*
39 * Release BCH encoder/decoder resources
40 */
41void nand_bch_free(struct nand_bch_control *nbc);
42
43#else /* !CONFIG_MTD_NAND_ECC_BCH */
44
45static inline int mtd_nand_has_bch(void) { return 0; }
46
47static inline int
48nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
49 u_char *ecc_code)
50{
51 return -1;
52}
53
54static inline int
55nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
56 unsigned char *read_ecc, unsigned char *calc_ecc)
57{
58 return -1;
59}
60
61static inline struct nand_bch_control *
62nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
63 unsigned int eccbytes, struct nand_ecclayout **ecclayout)
64{
65 return NULL;
66}
67
68static inline void nand_bch_free(struct nand_bch_control *nbc) {}
69
70#endif /* CONFIG_MTD_NAND_ECC_BCH */
71
72#endif /* __MTD_NAND_BCH_H__ */
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 0c8815bfae1c..52b6f187bf49 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -118,6 +118,8 @@ struct onenand_chip {
118 int (*chip_probe)(struct mtd_info *mtd); 118 int (*chip_probe)(struct mtd_info *mtd);
119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
120 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
121 int (*enable)(struct mtd_info *mtd);
122 int (*disable)(struct mtd_info *mtd);
121 123
122 struct completion complete; 124 struct completion complete;
123 int irq; 125 int irq;
@@ -137,6 +139,14 @@ struct onenand_chip {
137 void *bbm; 139 void *bbm;
138 140
139 void *priv; 141 void *priv;
142
143 /*
144 * Shows that the current operation is composed
145 * of sequence of commands. For example, cache program.
146 * Such command status OnGo bit is checked at the end of
147 * sequence.
148 */
149 unsigned int ongoing;
140}; 150};
141 151
142/* 152/*
@@ -171,6 +181,9 @@ struct onenand_chip {
171#define ONENAND_IS_2PLANE(this) (0) 181#define ONENAND_IS_2PLANE(this) (0)
172#endif 182#endif
173 183
184#define ONENAND_IS_CACHE_PROGRAM(this) \
185 (this->options & ONENAND_HAS_CACHE_PROGRAM)
186
174/* Check byte access in OneNAND */ 187/* Check byte access in OneNAND */
175#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) 188#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
176 189
@@ -181,9 +194,11 @@ struct onenand_chip {
181#define ONENAND_HAS_UNLOCK_ALL (0x0002) 194#define ONENAND_HAS_UNLOCK_ALL (0x0002)
182#define ONENAND_HAS_2PLANE (0x0004) 195#define ONENAND_HAS_2PLANE (0x0004)
183#define ONENAND_HAS_4KB_PAGE (0x0008) 196#define ONENAND_HAS_4KB_PAGE (0x0008)
197#define ONENAND_HAS_CACHE_PROGRAM (0x0010)
184#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 198#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
185#define ONENAND_PAGEBUF_ALLOC (0x1000) 199#define ONENAND_PAGEBUF_ALLOC (0x1000)
186#define ONENAND_OOBBUF_ALLOC (0x2000) 200#define ONENAND_OOBBUF_ALLOC (0x2000)
201#define ONENAND_SKIP_INITIAL_UNLOCKING (0x4000)
187 202
188#define ONENAND_IS_4KB_PAGE(this) \ 203#define ONENAND_IS_4KB_PAGE(this) \
189 (this->options & ONENAND_HAS_4KB_PAGE) 204 (this->options & ONENAND_HAS_4KB_PAGE)
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index cd6f3b431195..d60130f88eed 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -168,6 +168,7 @@
168#define ONENAND_SYS_CFG1_INT (1 << 6) 168#define ONENAND_SYS_CFG1_INT (1 << 6)
169#define ONENAND_SYS_CFG1_IOBE (1 << 5) 169#define ONENAND_SYS_CFG1_IOBE (1 << 5)
170#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) 170#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4)
171#define ONENAND_SYS_CFG1_VHF (1 << 3)
171#define ONENAND_SYS_CFG1_HF (1 << 2) 172#define ONENAND_SYS_CFG1_HF (1 << 2)
172#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) 173#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1)
173 174
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 274b6196091d..4a0a8ba90a72 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -39,7 +39,7 @@ struct mtd_partition {
39 uint64_t size; /* partition size */ 39 uint64_t size; /* partition size */
40 uint64_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
43}; 43};
44 44
45#define MTDPART_OFS_NXTBLK (-2) 45#define MTDPART_OFS_NXTBLK (-2)
@@ -89,4 +89,9 @@ static inline int mtd_has_cmdlinepart(void) { return 1; }
89static inline int mtd_has_cmdlinepart(void) { return 0; } 89static inline int mtd_has_cmdlinepart(void) { return 0; }
90#endif 90#endif
91 91
92int mtd_is_partition(struct mtd_info *mtd);
93int mtd_add_partition(struct mtd_info *master, char *name,
94 long long offset, long long length);
95int mtd_del_partition(struct mtd_info *master, int partno);
96
92#endif 97#endif
diff --git a/include/linux/mtd/super.h b/include/linux/mtd/super.h
index 4016dd6fe336..f456230f9330 100644
--- a/include/linux/mtd/super.h
+++ b/include/linux/mtd/super.h
@@ -18,10 +18,9 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20 20
21extern int get_sb_mtd(struct file_system_type *fs_type, int flags, 21extern struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,
22 const char *dev_name, void *data, 22 const char *dev_name, void *data,
23 int (*fill_super)(struct super_block *, void *, int), 23 int (*fill_super)(struct super_block *, void *, int));
24 struct vfsmount *mnt);
25extern void kill_mtd_super(struct super_block *sb); 24extern void kill_mtd_super(struct super_block *sb);
26 25
27 26
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index b31bd9e9bca3..84854edf4436 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -116,18 +116,40 @@ struct ubi_volume_info {
116 * struct ubi_device_info - UBI device description data structure. 116 * struct ubi_device_info - UBI device description data structure.
117 * @ubi_num: ubi device number 117 * @ubi_num: ubi device number
118 * @leb_size: logical eraseblock size on this UBI device 118 * @leb_size: logical eraseblock size on this UBI device
119 * @leb_start: starting offset of logical eraseblocks within physical
120 * eraseblocks
119 * @min_io_size: minimal I/O unit size 121 * @min_io_size: minimal I/O unit size
122 * @max_write_size: maximum amount of bytes the underlying flash can write at a
123 * time (MTD write buffer size)
120 * @ro_mode: if this device is in read-only mode 124 * @ro_mode: if this device is in read-only mode
121 * @cdev: UBI character device major and minor numbers 125 * @cdev: UBI character device major and minor numbers
122 * 126 *
123 * Note, @leb_size is the logical eraseblock size offered by the UBI device. 127 * Note, @leb_size is the logical eraseblock size offered by the UBI device.
124 * Volumes of this UBI device may have smaller logical eraseblock size if their 128 * Volumes of this UBI device may have smaller logical eraseblock size if their
125 * alignment is not equivalent to %1. 129 * alignment is not equivalent to %1.
130 *
131 * The @max_write_size field describes flash write maximum write unit. For
132 * example, NOR flash allows for changing individual bytes, so @min_io_size is
133 * %1. However, it does not mean than NOR flash has to write data byte-by-byte.
134 * Instead, CFI NOR flashes have a write-buffer of, e.g., 64 bytes, and when
135 * writing large chunks of data, they write 64-bytes at a time. Obviously, this
136 * improves write throughput.
137 *
138 * Also, the MTD device may have N interleaved (striped) flash chips
139 * underneath, in which case @min_io_size can be physical min. I/O size of
140 * single flash chip, while @max_write_size can be N * @min_io_size.
141 *
142 * The @max_write_size field is always greater or equivalent to @min_io_size.
143 * E.g., some NOR flashes may have (@min_io_size = 1, @max_write_size = 64). In
144 * contrast, NAND flashes usually have @min_io_size = @max_write_size = NAND
145 * page size.
126 */ 146 */
127struct ubi_device_info { 147struct ubi_device_info {
128 int ubi_num; 148 int ubi_num;
129 int leb_size; 149 int leb_size;
150 int leb_start;
130 int min_io_size; 151 int min_io_size;
152 int max_write_size;
131 int ro_mode; 153 int ro_mode;
132 dev_t cdev; 154 dev_t cdev;
133}; 155};
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index 36efcba15ecd..abed4dec5c2f 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -51,7 +51,7 @@
51 * return in usecs the elapsed timebetween now and the reference x as 51 * return in usecs the elapsed timebetween now and the reference x as
52 * returned by xip_currtime(). 52 * returned by xip_currtime().
53 * 53 *
54 * note 1: convertion to usec can be approximated, as long as the 54 * note 1: conversion to usec can be approximated, as long as the
55 * returned value is <= the real elapsed time. 55 * returned value is <= the real elapsed time.
56 * note 2: this should be able to cope with a few seconds without 56 * note 2: this should be able to cope with a few seconds without
57 * overflowing. 57 * overflowing.
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index f363bc8fdc74..c75471db576e 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -51,7 +51,7 @@ struct mutex {
51 spinlock_t wait_lock; 51 spinlock_t wait_lock;
52 struct list_head wait_list; 52 struct list_head wait_list;
53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) 53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
54 struct thread_info *owner; 54 struct task_struct *owner;
55#endif 55#endif
56#ifdef CONFIG_DEBUG_MUTEXES 56#ifdef CONFIG_DEBUG_MUTEXES
57 const char *name; 57 const char *name;
@@ -160,4 +160,8 @@ extern int mutex_trylock(struct mutex *lock);
160extern void mutex_unlock(struct mutex *lock); 160extern void mutex_unlock(struct mutex *lock);
161extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 161extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
162 162
163#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
164#define arch_mutex_cpu_relax() cpu_relax()
165#endif
166
163#endif 167#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 05b441d93642..eba45ea10298 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -19,7 +19,9 @@ struct nameidata {
19 struct path path; 19 struct path path;
20 struct qstr last; 20 struct qstr last;
21 struct path root; 21 struct path root;
22 struct inode *inode; /* path.dentry.d_inode */
22 unsigned int flags; 23 unsigned int flags;
24 unsigned seq;
23 int last_type; 25 int last_type;
24 unsigned depth; 26 unsigned depth;
25 char *saved_names[MAX_NESTED_LINKS + 1]; 27 char *saved_names[MAX_NESTED_LINKS + 1];
@@ -41,14 +43,17 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
41 * - require a directory 43 * - require a directory
42 * - ending slashes ok even for nonexistent files 44 * - ending slashes ok even for nonexistent files
43 * - internal "there are more path components" flag 45 * - internal "there are more path components" flag
44 * - locked when lookup done with dcache_lock held
45 * - dentry cache is untrusted; force a real lookup 46 * - dentry cache is untrusted; force a real lookup
47 * - suppress terminal automount
46 */ 48 */
47#define LOOKUP_FOLLOW 1 49#define LOOKUP_FOLLOW 0x0001
48#define LOOKUP_DIRECTORY 2 50#define LOOKUP_DIRECTORY 0x0002
49#define LOOKUP_CONTINUE 4 51#define LOOKUP_CONTINUE 0x0004
50#define LOOKUP_PARENT 16 52
51#define LOOKUP_REVAL 64 53#define LOOKUP_PARENT 0x0010
54#define LOOKUP_REVAL 0x0020
55#define LOOKUP_RCU 0x0040
56#define LOOKUP_NO_AUTOMOUNT 0x0080
52/* 57/*
53 * Intent data 58 * Intent data
54 */ 59 */
@@ -57,6 +62,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
57#define LOOKUP_EXCL 0x0400 62#define LOOKUP_EXCL 0x0400
58#define LOOKUP_RENAME_TARGET 0x0800 63#define LOOKUP_RENAME_TARGET 0x0800
59 64
65#define LOOKUP_JUMPED 0x1000
66#define LOOKUP_ROOT 0x2000
67#define LOOKUP_EMPTY 0x4000
68
60extern int user_path_at(int, const char __user *, unsigned, struct path *); 69extern int user_path_at(int, const char __user *, unsigned, struct path *);
61 70
62#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) 71#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
@@ -66,7 +75,7 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *);
66 75
67extern int kern_path(const char *, unsigned, struct path *); 76extern int kern_path(const char *, unsigned, struct path *);
68 77
69extern int path_lookup(const char *, unsigned, struct nameidata *); 78extern int kern_path_parent(const char *, struct nameidata *);
70extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 79extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
71 const char *, unsigned int, struct nameidata *); 80 const char *, unsigned int, struct nameidata *);
72 81
@@ -75,6 +84,7 @@ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry
75 84
76extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 85extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
77 86
87extern int follow_down_one(struct path *);
78extern int follow_down(struct path *); 88extern int follow_down(struct path *);
79extern int follow_up(struct path *); 89extern int follow_up(struct path *);
80 90
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index ef663061d5ac..e13eefef0653 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -143,104 +143,4 @@ struct ncp_nls_ioctl
143#define NCP_MAXPATHLEN 255 143#define NCP_MAXPATHLEN 255
144#define NCP_MAXNAMELEN 14 144#define NCP_MAXNAMELEN 14
145 145
146#ifdef __KERNEL__
147
148#include <linux/ncp_fs_i.h>
149#include <linux/ncp_fs_sb.h>
150
151/* define because it is easy to change PRINTK to {*}PRINTK */
152#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
153
154#undef NCPFS_PARANOIA
155#ifdef NCPFS_PARANOIA
156#define PPRINTK(format, args...) PRINTK(format , ## args)
157#else
158#define PPRINTK(format, args...)
159#endif
160
161#ifndef DEBUG_NCP
162#define DEBUG_NCP 0
163#endif
164#if DEBUG_NCP > 0
165#define DPRINTK(format, args...) PRINTK(format , ## args)
166#else
167#define DPRINTK(format, args...)
168#endif
169#if DEBUG_NCP > 1
170#define DDPRINTK(format, args...) PRINTK(format , ## args)
171#else
172#define DDPRINTK(format, args...)
173#endif
174
175#define NCP_MAX_RPC_TIMEOUT (6*HZ)
176
177
178struct ncp_entry_info {
179 struct nw_info_struct i;
180 ino_t ino;
181 int opened;
182 int access;
183 unsigned int volume;
184 __u8 file_handle[6];
185};
186
187static inline struct ncp_server *NCP_SBP(struct super_block *sb)
188{
189 return sb->s_fs_info;
190}
191
192#define NCP_SERVER(inode) NCP_SBP((inode)->i_sb)
193static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode)
194{
195 return container_of(inode, struct ncp_inode_info, vfs_inode);
196}
197
198/* linux/fs/ncpfs/inode.c */
199int ncp_notify_change(struct dentry *, struct iattr *);
200struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
201void ncp_update_inode(struct inode *, struct ncp_entry_info *);
202void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
203
204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations;
207extern const struct dentry_operations ncp_root_dentry_operations;
208int ncp_conn_logged_in(struct super_block *);
209int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
211
212/* linux/fs/ncpfs/ioctl.c */
213long ncp_ioctl(struct file *, unsigned int, unsigned long);
214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
215
216/* linux/fs/ncpfs/sock.c */
217int ncp_request2(struct ncp_server *server, int function,
218 void* reply, int max_reply_size);
219static inline int ncp_request(struct ncp_server *server, int function) {
220 return ncp_request2(server, function, server->packet, server->packet_size);
221}
222int ncp_connect(struct ncp_server *server);
223int ncp_disconnect(struct ncp_server *server);
224void ncp_lock_server(struct ncp_server *server);
225void ncp_unlock_server(struct ncp_server *server);
226
227/* linux/fs/ncpfs/symlink.c */
228#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
229extern const struct address_space_operations ncp_symlink_aops;
230int ncp_symlink(struct inode*, struct dentry*, const char*);
231#endif
232
233/* linux/fs/ncpfs/file.c */
234extern const struct inode_operations ncp_file_inode_operations;
235extern const struct file_operations ncp_file_operations;
236int ncp_make_open(struct inode *, int);
237
238/* linux/fs/ncpfs/mmap.c */
239int ncp_mmap(struct file *, struct vm_area_struct *);
240
241/* linux/fs/ncpfs/ncplib_kernel.c */
242int ncp_make_closed(struct inode *);
243
244#endif /* __KERNEL__ */
245
246#endif /* _LINUX_NCP_FS_H */ 146#endif /* _LINUX_NCP_FS_H */
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
deleted file mode 100644
index 4b0bec477846..000000000000
--- a/include/linux/ncp_fs_i.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * ncp_fs_i.h
3 *
4 * Copyright (C) 1995 Volker Lendecke
5 *
6 */
7
8#ifndef _LINUX_NCP_FS_I
9#define _LINUX_NCP_FS_I
10
11/*
12 * This is the ncpfs part of the inode structure. This must contain
13 * all the information we need to work with an inode after creation.
14 */
15struct ncp_inode_info {
16 __le32 dirEntNum;
17 __le32 DosDirNum;
18 __u8 volNumber;
19 __le32 nwattr;
20 struct mutex open_mutex;
21 atomic_t opened;
22 int access;
23 int flags;
24#define NCPI_KLUDGE_SYMLINK 0x0001
25 __u8 file_handle[6];
26 struct inode vfs_inode;
27};
28
29#endif /* _LINUX_NCP_FS_I */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
deleted file mode 100644
index d64b0e894336..000000000000
--- a/include/linux/ncp_fs_sb.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * ncp_fs_sb.h
3 *
4 * Copyright (C) 1995, 1996 by Volker Lendecke
5 *
6 */
7
8#ifndef _NCP_FS_SB
9#define _NCP_FS_SB
10
11#include <linux/types.h>
12#include <linux/ncp_mount.h>
13#include <linux/net.h>
14#include <linux/mutex.h>
15#include <linux/backing-dev.h>
16
17#ifdef __KERNEL__
18
19#include <linux/workqueue.h>
20
21#define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */
22
23struct sock;
24
25struct ncp_server {
26
27 struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of
28 interest for us later, so we store
29 it completely. */
30
31 __u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
32
33 struct file *ncp_filp; /* File pointer to ncp socket */
34 struct socket *ncp_sock;/* ncp socket */
35 struct file *info_filp;
36 struct socket *info_sock;
37
38 u8 sequence;
39 u8 task;
40 u16 connection; /* Remote connection number */
41
42 u8 completion; /* Status message from server */
43 u8 conn_status; /* Bit 4 = 1 ==> Server going down, no
44 requests allowed anymore.
45 Bit 0 = 1 ==> Server is down. */
46
47 int buffer_size; /* Negotiated bufsize */
48
49 int reply_size; /* Size of last reply */
50
51 int packet_size;
52 unsigned char *packet; /* Here we prepare requests and
53 receive replies */
54 unsigned char *txbuf; /* Storage for current request */
55 unsigned char *rxbuf; /* Storage for reply to current request */
56
57 int lock; /* To prevent mismatch in protocols. */
58 struct mutex mutex;
59
60 int current_size; /* for packet preparation */
61 int has_subfunction;
62 int ncp_reply_size;
63
64 int root_setuped;
65 struct mutex root_setup_lock;
66
67 /* info for packet signing */
68 int sign_wanted; /* 1=Server needs signed packets */
69 int sign_active; /* 0=don't do signing, 1=do */
70 char sign_root[8]; /* generated from password and encr. key */
71 char sign_last[16];
72
73 /* Authentication info: NDS or BINDERY, username */
74 struct {
75 int auth_type;
76 size_t object_name_len;
77 void* object_name;
78 int object_type;
79 } auth;
80 /* Password info */
81 struct {
82 size_t len;
83 void* data;
84 } priv;
85 struct rw_semaphore auth_rwsem;
86
87 /* nls info: codepage for volume and charset for I/O */
88 struct nls_table *nls_vol;
89 struct nls_table *nls_io;
90
91 /* maximum age in jiffies */
92 atomic_t dentry_ttl;
93
94 /* miscellaneous */
95 unsigned int flags;
96
97 spinlock_t requests_lock; /* Lock accesses to tx.requests, tx.creq and rcv.creq when STREAM mode */
98
99 void (*data_ready)(struct sock* sk, int len);
100 void (*error_report)(struct sock* sk);
101 void (*write_space)(struct sock* sk); /* STREAM mode only */
102 struct {
103 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
104 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
105 struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
106
107 unsigned int state; /* STREAM only: receiver state */
108 struct {
109 __u32 magic __packed;
110 __u32 len __packed;
111 __u16 type __packed;
112 __u16 p1 __packed;
113 __u16 p2 __packed;
114 __u16 p3 __packed;
115 __u16 type2 __packed;
116 } buf; /* STREAM only: temporary buffer */
117 unsigned char* ptr; /* STREAM only: pointer to data */
118 size_t len; /* STREAM only: length of data to receive */
119 } rcv;
120 struct {
121 struct list_head requests; /* STREAM only: queued requests */
122 struct work_struct tq; /* STREAM only: transmitter ready */
123 struct ncp_request_reply* creq; /* STREAM only: currently transmitted entry */
124 } tx;
125 struct timer_list timeout_tm; /* DGRAM only: timeout timer */
126 struct work_struct timeout_tq; /* DGRAM only: associated queue, we run timers from process context */
127 int timeout_last; /* DGRAM only: current timeout length */
128 int timeout_retries; /* DGRAM only: retries left */
129 struct {
130 size_t len;
131 __u8 data[128];
132 } unexpected_packet;
133 struct backing_dev_info bdi;
134};
135
136extern void ncp_tcp_rcv_proc(struct work_struct *work);
137extern void ncp_tcp_tx_proc(struct work_struct *work);
138extern void ncpdgram_rcv_proc(struct work_struct *work);
139extern void ncpdgram_timeout_proc(struct work_struct *work);
140extern void ncpdgram_timeout_call(unsigned long server);
141extern void ncp_tcp_data_ready(struct sock* sk, int len);
142extern void ncp_tcp_write_space(struct sock* sk);
143extern void ncp_tcp_error_report(struct sock* sk);
144
145#define NCP_FLAG_UTF8 1
146
147#define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag))
148#define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag))
149#define NCP_IS_FLAG(server, flag) ((server)->flags & (flag))
150
151static inline int ncp_conn_valid(struct ncp_server *server)
152{
153 return ((server->conn_status & 0x11) == 0);
154}
155
156static inline void ncp_invalidate_conn(struct ncp_server *server)
157{
158 server->conn_status |= 0x01;
159}
160
161#endif /* __KERNEL__ */
162
163#endif
164
diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h
index a2b549eb1eca..dfcbea2d889f 100644
--- a/include/linux/ncp_mount.h
+++ b/include/linux/ncp_mount.h
@@ -68,26 +68,4 @@ struct ncp_mount_data_v4 {
68 68
69#define NCP_MOUNT_VERSION_V5 (5) /* Text only */ 69#define NCP_MOUNT_VERSION_V5 (5) /* Text only */
70 70
71#ifdef __KERNEL__
72
73struct ncp_mount_data_kernel {
74 unsigned long flags; /* NCP_MOUNT_* flags */
75 unsigned int int_flags; /* internal flags */
76#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001
77 __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */
78 struct pid *wdog_pid; /* Who cares for our watchdog packets? */
79 unsigned int ncp_fd; /* The socket to the ncp port */
80 unsigned int time_out; /* How long should I wait after
81 sending a NCP request? */
82 unsigned int retry_count; /* And how often should I retry? */
83 unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
84 __kernel_uid32_t uid;
85 __kernel_gid32_t gid;
86 __kernel_mode_t file_mode;
87 __kernel_mode_t dir_mode;
88 int info_fd;
89};
90
91#endif /* __KERNEL__ */
92
93#endif 71#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index dee0b11a8759..1da55e9b6f01 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -42,6 +42,7 @@
42#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ 42#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
43#define SYS_ACCEPT4 18 /* sys_accept4(2) */ 43#define SYS_ACCEPT4 18 /* sys_accept4(2) */
44#define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */ 44#define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */
45#define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */
45 46
46typedef enum { 47typedef enum {
47 SS_FREE = 0, /* not allocated */ 48 SS_FREE = 0, /* not allocated */
@@ -118,6 +119,7 @@ enum sock_shutdown_cmd {
118}; 119};
119 120
120struct socket_wq { 121struct socket_wq {
122 /* Note: wait MUST be first field of socket_wq */
121 wait_queue_head_t wait; 123 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list; 124 struct fasync_struct *fasync_list;
123 struct rcu_head rcu; 125 struct rcu_head rcu;
@@ -142,7 +144,7 @@ struct socket {
142 144
143 unsigned long flags; 145 unsigned long flags;
144 146
145 struct socket_wq *wq; 147 struct socket_wq __rcu *wq;
146 148
147 struct file *file; 149 struct file *file;
148 struct sock *sk; 150 struct sock *sk;
@@ -229,6 +231,8 @@ enum {
229extern int sock_wake_async(struct socket *sk, int how, int band); 231extern int sock_wake_async(struct socket *sk, int how, int band);
230extern int sock_register(const struct net_proto_family *fam); 232extern int sock_register(const struct net_proto_family *fam);
231extern void sock_unregister(int family); 233extern void sock_unregister(int family);
234extern int __sock_create(struct net *net, int family, int type, int proto,
235 struct socket **res, int kern);
232extern int sock_create(int family, int type, int proto, 236extern int sock_create(int family, int type, int proto,
233 struct socket **res); 237 struct socket **res);
234extern int sock_create_kern(int family, int type, int proto, 238extern int sock_create_kern(int family, int type, int proto,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index fcd3dda86322..ca333e79e10f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -138,6 +138,9 @@ static inline bool dev_xmit_complete(int rc)
138 138
139#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 139#define MAX_ADDR_LEN 32 /* Largest hardware address length */
140 140
141/* Initial net device group. All devices belong to group 0 by default. */
142#define INIT_NETDEV_GROUP 0
143
141#ifdef __KERNEL__ 144#ifdef __KERNEL__
142/* 145/*
143 * Compute the worst case header length according to the protocols 146 * Compute the worst case header length according to the protocols
@@ -387,7 +390,55 @@ enum gro_result {
387}; 390};
388typedef enum gro_result gro_result_t; 391typedef enum gro_result gro_result_t;
389 392
390typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb); 393/*
394 * enum rx_handler_result - Possible return values for rx_handlers.
395 * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it
396 * further.
397 * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in
398 * case skb->dev was changed by rx_handler.
399 * @RX_HANDLER_EXACT: Force exact delivery, no wildcard.
400 * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called.
401 *
402 * rx_handlers are functions called from inside __netif_receive_skb(), to do
403 * special processing of the skb, prior to delivery to protocol handlers.
404 *
405 * Currently, a net_device can only have a single rx_handler registered. Trying
406 * to register a second rx_handler will return -EBUSY.
407 *
408 * To register a rx_handler on a net_device, use netdev_rx_handler_register().
409 * To unregister a rx_handler on a net_device, use
410 * netdev_rx_handler_unregister().
411 *
412 * Upon return, rx_handler is expected to tell __netif_receive_skb() what to
413 * do with the skb.
414 *
415 * If the rx_handler consumed to skb in some way, it should return
416 * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for
417 * the skb to be delivered in some other ways.
418 *
419 * If the rx_handler changed skb->dev, to divert the skb to another
420 * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the
421 * new device will be called if it exists.
422 *
423 * If the rx_handler consider the skb should be ignored, it should return
424 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
425 * are registred on exact device (ptype->dev == skb->dev).
426 *
427 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
428 * delivered, it should return RX_HANDLER_PASS.
429 *
430 * A device without a registered rx_handler will behave as if rx_handler
431 * returned RX_HANDLER_PASS.
432 */
433
434enum rx_handler_result {
435 RX_HANDLER_CONSUMED,
436 RX_HANDLER_ANOTHER,
437 RX_HANDLER_EXACT,
438 RX_HANDLER_PASS,
439};
440typedef enum rx_handler_result rx_handler_result_t;
441typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
391 442
392extern void __napi_schedule(struct napi_struct *n); 443extern void __napi_schedule(struct napi_struct *n);
393 444
@@ -493,6 +544,8 @@ static inline void napi_synchronize(const struct napi_struct *n)
493enum netdev_queue_state_t { 544enum netdev_queue_state_t {
494 __QUEUE_STATE_XOFF, 545 __QUEUE_STATE_XOFF,
495 __QUEUE_STATE_FROZEN, 546 __QUEUE_STATE_FROZEN,
547#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF) | \
548 (1 << __QUEUE_STATE_FROZEN))
496}; 549};
497 550
498struct netdev_queue { 551struct netdev_queue {
@@ -503,6 +556,12 @@ struct netdev_queue {
503 struct Qdisc *qdisc; 556 struct Qdisc *qdisc;
504 unsigned long state; 557 unsigned long state;
505 struct Qdisc *qdisc_sleeping; 558 struct Qdisc *qdisc_sleeping;
559#ifdef CONFIG_RPS
560 struct kobject kobj;
561#endif
562#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
563 int numa_node;
564#endif
506/* 565/*
507 * write mostly part 566 * write mostly part
508 */ 567 */
@@ -512,11 +571,24 @@ struct netdev_queue {
512 * please use this field instead of dev->trans_start 571 * please use this field instead of dev->trans_start
513 */ 572 */
514 unsigned long trans_start; 573 unsigned long trans_start;
515 u64 tx_bytes;
516 u64 tx_packets;
517 u64 tx_dropped;
518} ____cacheline_aligned_in_smp; 574} ____cacheline_aligned_in_smp;
519 575
576static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
577{
578#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
579 return q->numa_node;
580#else
581 return NUMA_NO_NODE;
582#endif
583}
584
585static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node)
586{
587#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
588 q->numa_node = node;
589#endif
590}
591
520#ifdef CONFIG_RPS 592#ifdef CONFIG_RPS
521/* 593/*
522 * This structure holds an RPS map which can be of variable length. The 594 * This structure holds an RPS map which can be of variable length. The
@@ -530,14 +602,16 @@ struct rps_map {
530#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 602#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
531 603
532/* 604/*
533 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the 605 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
534 * tail pointer for that CPU's input queue at the time of last enqueue. 606 * tail pointer for that CPU's input queue at the time of last enqueue, and
607 * a hardware filter index.
535 */ 608 */
536struct rps_dev_flow { 609struct rps_dev_flow {
537 u16 cpu; 610 u16 cpu;
538 u16 fill; 611 u16 filter;
539 unsigned int last_qtail; 612 unsigned int last_qtail;
540}; 613};
614#define RPS_NO_FILTER 0xffff
541 615
542/* 616/*
543 * The rps_dev_flow_table structure contains a table of flow mappings. 617 * The rps_dev_flow_table structure contains a table of flow mappings.
@@ -585,18 +659,56 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
585 table->ents[hash & table->mask] = RPS_NO_CPU; 659 table->ents[hash & table->mask] = RPS_NO_CPU;
586} 660}
587 661
588extern struct rps_sock_flow_table *rps_sock_flow_table; 662extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
663
664#ifdef CONFIG_RFS_ACCEL
665extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
666 u32 flow_id, u16 filter_id);
667#endif
589 668
590/* This structure contains an instance of an RX queue. */ 669/* This structure contains an instance of an RX queue. */
591struct netdev_rx_queue { 670struct netdev_rx_queue {
592 struct rps_map *rps_map; 671 struct rps_map __rcu *rps_map;
593 struct rps_dev_flow_table *rps_flow_table; 672 struct rps_dev_flow_table __rcu *rps_flow_table;
594 struct kobject kobj; 673 struct kobject kobj;
595 struct netdev_rx_queue *first; 674 struct net_device *dev;
596 atomic_t count;
597} ____cacheline_aligned_in_smp; 675} ____cacheline_aligned_in_smp;
598#endif /* CONFIG_RPS */ 676#endif /* CONFIG_RPS */
599 677
678#ifdef CONFIG_XPS
679/*
680 * This structure holds an XPS map which can be of variable length. The
681 * map is an array of queues.
682 */
683struct xps_map {
684 unsigned int len;
685 unsigned int alloc_len;
686 struct rcu_head rcu;
687 u16 queues[0];
688};
689#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16)))
690#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map)) \
691 / sizeof(u16))
692
693/*
694 * This structure holds all XPS maps for device. Maps are indexed by CPU.
695 */
696struct xps_dev_maps {
697 struct rcu_head rcu;
698 struct xps_map __rcu *cpu_map[0];
699};
700#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) + \
701 (nr_cpu_ids * sizeof(struct xps_map *)))
702#endif /* CONFIG_XPS */
703
704#define TC_MAX_QUEUE 16
705#define TC_BITMASK 15
706/* HW offloaded queuing disciplines txq count and offset maps */
707struct netdev_tc_txq {
708 u16 count;
709 u16 offset;
710};
711
600/* 712/*
601 * This structure defines the management hooks for network devices. 713 * This structure defines the management hooks for network devices.
602 * The following hooks can be defined; unless noted otherwise, they are 714 * The following hooks can be defined; unless noted otherwise, they are
@@ -683,7 +795,7 @@ struct netdev_rx_queue {
683 * neither operation. 795 * neither operation.
684 * 796 *
685 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); 797 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
686 * If device support VLAN receive accleration 798 * If device support VLAN receive acceleration
687 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called 799 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
688 * when vlan groups for the device changes. Note: grp is NULL 800 * when vlan groups for the device changes. Note: grp is NULL
689 * if no vlan's groups are being used. 801 * if no vlan's groups are being used.
@@ -707,6 +819,74 @@ struct netdev_rx_queue {
707 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 819 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
708 * struct nlattr *port[]); 820 * struct nlattr *port[]);
709 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 821 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
822 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
823 * Called to setup 'tc' number of traffic classes in the net device. This
824 * is always called from the stack with the rtnl lock held and netif tx
825 * queues stopped. This allows the netdevice to perform queue management
826 * safely.
827 *
828 * Fiber Channel over Ethernet (FCoE) offload functions.
829 * int (*ndo_fcoe_enable)(struct net_device *dev);
830 * Called when the FCoE protocol stack wants to start using LLD for FCoE
831 * so the underlying device can perform whatever needed configuration or
832 * initialization to support acceleration of FCoE traffic.
833 *
834 * int (*ndo_fcoe_disable)(struct net_device *dev);
835 * Called when the FCoE protocol stack wants to stop using LLD for FCoE
836 * so the underlying device can perform whatever needed clean-ups to
837 * stop supporting acceleration of FCoE traffic.
838 *
839 * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid,
840 * struct scatterlist *sgl, unsigned int sgc);
841 * Called when the FCoE Initiator wants to initialize an I/O that
842 * is a possible candidate for Direct Data Placement (DDP). The LLD can
843 * perform necessary setup and returns 1 to indicate the device is set up
844 * successfully to perform DDP on this I/O, otherwise this returns 0.
845 *
846 * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid);
847 * Called when the FCoE Initiator/Target is done with the DDPed I/O as
848 * indicated by the FC exchange id 'xid', so the underlying device can
849 * clean up and reuse resources for later DDP requests.
850 *
851 * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid,
852 * struct scatterlist *sgl, unsigned int sgc);
853 * Called when the FCoE Target wants to initialize an I/O that
854 * is a possible candidate for Direct Data Placement (DDP). The LLD can
855 * perform necessary setup and returns 1 to indicate the device is set up
856 * successfully to perform DDP on this I/O, otherwise this returns 0.
857 *
858 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
859 * Called when the underlying device wants to override default World Wide
860 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
861 * World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE
862 * protocol stack to use.
863 *
864 * RFS acceleration.
865 * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb,
866 * u16 rxq_index, u32 flow_id);
867 * Set hardware filter for RFS. rxq_index is the target queue index;
868 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
869 * Return the filter ID on success, or a negative error code.
870 *
871 * Slave management functions (for bridge, bonding, etc). User should
872 * call netdev_set_master() to set dev->master properly.
873 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
874 * Called to make another netdev an underling.
875 *
876 * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
877 * Called to release previously enslaved netdev.
878 *
879 * Feature/offload setting functions.
880 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features);
881 * Adjusts the requested feature flags according to device-specific
882 * constraints, and returns the resulting flags. Must not modify
883 * the device state.
884 *
885 * int (*ndo_set_features)(struct net_device *dev, u32 features);
886 * Called to update device configuration to new features. Passed
887 * feature set might be less than what was returned by ndo_fix_features()).
888 * Must return >0 or -errno if it changed dev->features itself.
889 *
710 */ 890 */
711#define HAVE_NET_DEVICE_OPS 891#define HAVE_NET_DEVICE_OPS
712struct net_device_ops { 892struct net_device_ops {
@@ -765,6 +945,7 @@ struct net_device_ops {
765 struct nlattr *port[]); 945 struct nlattr *port[]);
766 int (*ndo_get_vf_port)(struct net_device *dev, 946 int (*ndo_get_vf_port)(struct net_device *dev,
767 int vf, struct sk_buff *skb); 947 int vf, struct sk_buff *skb);
948 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
768#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 949#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
769 int (*ndo_fcoe_enable)(struct net_device *dev); 950 int (*ndo_fcoe_enable)(struct net_device *dev);
770 int (*ndo_fcoe_disable)(struct net_device *dev); 951 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -774,11 +955,29 @@ struct net_device_ops {
774 unsigned int sgc); 955 unsigned int sgc);
775 int (*ndo_fcoe_ddp_done)(struct net_device *dev, 956 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
776 u16 xid); 957 u16 xid);
958 int (*ndo_fcoe_ddp_target)(struct net_device *dev,
959 u16 xid,
960 struct scatterlist *sgl,
961 unsigned int sgc);
777#define NETDEV_FCOE_WWNN 0 962#define NETDEV_FCOE_WWNN 0
778#define NETDEV_FCOE_WWPN 1 963#define NETDEV_FCOE_WWPN 1
779 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 964 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
780 u64 *wwn, int type); 965 u64 *wwn, int type);
781#endif 966#endif
967#ifdef CONFIG_RFS_ACCEL
968 int (*ndo_rx_flow_steer)(struct net_device *dev,
969 const struct sk_buff *skb,
970 u16 rxq_index,
971 u32 flow_id);
972#endif
973 int (*ndo_add_slave)(struct net_device *dev,
974 struct net_device *slave_dev);
975 int (*ndo_del_slave)(struct net_device *dev,
976 struct net_device *slave_dev);
977 u32 (*ndo_fix_features)(struct net_device *dev,
978 u32 features);
979 int (*ndo_set_features)(struct net_device *dev,
980 u32 features);
782}; 981};
783 982
784/* 983/*
@@ -821,17 +1020,24 @@ struct net_device {
821 * part of the usual set specified in Space.c. 1020 * part of the usual set specified in Space.c.
822 */ 1021 */
823 1022
824 unsigned char if_port; /* Selectable AUI, TP,..*/
825 unsigned char dma; /* DMA channel */
826
827 unsigned long state; 1023 unsigned long state;
828 1024
829 struct list_head dev_list; 1025 struct list_head dev_list;
830 struct list_head napi_list; 1026 struct list_head napi_list;
831 struct list_head unreg_list; 1027 struct list_head unreg_list;
832 1028
833 /* Net device features */ 1029 /* currently active device features */
834 unsigned long features; 1030 u32 features;
1031 /* user-changeable features */
1032 u32 hw_features;
1033 /* user-requested features */
1034 u32 wanted_features;
1035 /* mask of features inheritable by VLAN devices */
1036 u32 vlan_features;
1037
1038 /* Net device feature bits; if you change something,
1039 * also update netdev_features_strings[] in ethtool.c */
1040
835#define NETIF_F_SG 1 /* Scatter/gather IO. */ 1041#define NETIF_F_SG 1 /* Scatter/gather IO. */
836#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ 1042#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
837#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ 1043#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
@@ -856,6 +1062,9 @@ struct net_device {
856#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 1062#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
857#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ 1063#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
858#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ 1064#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1065#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
1066#define NETIF_F_NOCACHE_COPY (1 << 30) /* Use no-cache copyfromuser */
1067#define NETIF_F_LOOPBACK (1 << 31) /* Enable loopback */
859 1068
860 /* Segmentation offload features */ 1069 /* Segmentation offload features */
861#define NETIF_F_GSO_SHIFT 16 1070#define NETIF_F_GSO_SHIFT 16
@@ -867,6 +1076,12 @@ struct net_device {
867#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) 1076#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
868#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) 1077#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
869 1078
1079 /* Features valid for ethtool to change */
1080 /* = all defined minus driver/device-class-related */
1081#define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \
1082 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1083#define NETIF_F_ETHTOOL_BITS (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
1084
870 /* List of features with software fallbacks. */ 1085 /* List of features with software fallbacks. */
871#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ 1086#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
872 NETIF_F_TSO6 | NETIF_F_UFO) 1087 NETIF_F_TSO6 | NETIF_F_UFO)
@@ -877,13 +1092,32 @@ struct net_device {
877#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 1092#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
878#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 1093#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
879 1094
1095#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1096
1097#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
1098 NETIF_F_FSO)
1099
1100#define NETIF_F_ALL_TX_OFFLOADS (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1101 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1102 NETIF_F_HIGHDMA | \
1103 NETIF_F_SCTP_CSUM | \
1104 NETIF_F_ALL_FCOE)
1105
880 /* 1106 /*
881 * If one device supports one of these features, then enable them 1107 * If one device supports one of these features, then enable them
882 * for all in netdev_increment_features. 1108 * for all in netdev_increment_features.
883 */ 1109 */
884#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 1110#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
885 NETIF_F_SG | NETIF_F_HIGHDMA | \ 1111 NETIF_F_SG | NETIF_F_HIGHDMA | \
886 NETIF_F_FRAGLIST) 1112 NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
1113 /*
1114 * If one device doesn't support one of these features, then disable it
1115 * for all in netdev_increment_features.
1116 */
1117#define NETIF_F_ALL_FOR_ALL (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
1118
1119 /* changeable features with no special hardware requirements */
1120#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
887 1121
888 /* Interface index. Unique device identifier */ 1122 /* Interface index. Unique device identifier */
889 int ifindex; 1123 int ifindex;
@@ -909,13 +1143,16 @@ struct net_device {
909 const struct header_ops *header_ops; 1143 const struct header_ops *header_ops;
910 1144
911 unsigned int flags; /* interface flags (a la BSD) */ 1145 unsigned int flags; /* interface flags (a la BSD) */
1146 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */
912 unsigned short gflags; 1147 unsigned short gflags;
913 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */
914 unsigned short padded; /* How much padding added by alloc_netdev() */ 1148 unsigned short padded; /* How much padding added by alloc_netdev() */
915 1149
916 unsigned char operstate; /* RFC2863 operstate */ 1150 unsigned char operstate; /* RFC2863 operstate */
917 unsigned char link_mode; /* mapping policy to operstate */ 1151 unsigned char link_mode; /* mapping policy to operstate */
918 1152
1153 unsigned char if_port; /* Selectable AUI, TP,..*/
1154 unsigned char dma; /* DMA channel */
1155
919 unsigned int mtu; /* interface MTU value */ 1156 unsigned int mtu; /* interface MTU value */
920 unsigned short type; /* interface hardware type */ 1157 unsigned short type; /* interface hardware type */
921 unsigned short hard_header_len; /* hardware hdr length */ 1158 unsigned short hard_header_len; /* hardware hdr length */
@@ -944,15 +1181,15 @@ struct net_device {
944 /* Protocol specific pointers */ 1181 /* Protocol specific pointers */
945 1182
946#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1183#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
947 struct vlan_group *vlgrp; /* VLAN group */ 1184 struct vlan_group __rcu *vlgrp; /* VLAN group */
948#endif 1185#endif
949#ifdef CONFIG_NET_DSA 1186#ifdef CONFIG_NET_DSA
950 void *dsa_ptr; /* dsa specific data */ 1187 void *dsa_ptr; /* dsa specific data */
951#endif 1188#endif
952 void *atalk_ptr; /* AppleTalk link */ 1189 void *atalk_ptr; /* AppleTalk link */
953 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1190 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
954 void *dn_ptr; /* DECnet specific data */ 1191 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
955 void *ip6_ptr; /* IPv6 specific data */ 1192 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
956 void *ec_ptr; /* Econet specific data */ 1193 void *ec_ptr; /* Econet specific data */
957 void *ax25_ptr; /* AX.25 specific data */ 1194 void *ax25_ptr; /* AX.25 specific data */
958 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1195 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
@@ -993,10 +1230,17 @@ struct net_device {
993 1230
994 /* Number of RX queues currently active in device */ 1231 /* Number of RX queues currently active in device */
995 unsigned int real_num_rx_queues; 1232 unsigned int real_num_rx_queues;
1233
1234#ifdef CONFIG_RFS_ACCEL
1235 /* CPU reverse-mapping for RX completion interrupts, indexed
1236 * by RX queue number. Assigned by driver. This must only be
1237 * set if the ndo_rx_flow_steer operation is defined. */
1238 struct cpu_rmap *rx_cpu_rmap;
1239#endif
996#endif 1240#endif
997 1241
998 rx_handler_func_t *rx_handler; 1242 rx_handler_func_t __rcu *rx_handler;
999 void *rx_handler_data; 1243 void __rcu *rx_handler_data;
1000 1244
1001 struct netdev_queue __rcu *ingress_queue; 1245 struct netdev_queue __rcu *ingress_queue;
1002 1246
@@ -1017,6 +1261,10 @@ struct net_device {
1017 unsigned long tx_queue_len; /* Max frames per queue allowed */ 1261 unsigned long tx_queue_len; /* Max frames per queue allowed */
1018 spinlock_t tx_global_lock; 1262 spinlock_t tx_global_lock;
1019 1263
1264#ifdef CONFIG_XPS
1265 struct xps_dev_maps __rcu *xps_maps;
1266#endif
1267
1020 /* These may be needed for future network-power-down code. */ 1268 /* These may be needed for future network-power-down code. */
1021 1269
1022 /* 1270 /*
@@ -1045,7 +1293,9 @@ struct net_device {
1045 NETREG_UNREGISTERED, /* completed unregister todo */ 1293 NETREG_UNREGISTERED, /* completed unregister todo */
1046 NETREG_RELEASED, /* called free_netdev */ 1294 NETREG_RELEASED, /* called free_netdev */
1047 NETREG_DUMMY, /* dummy device for NAPI poll */ 1295 NETREG_DUMMY, /* dummy device for NAPI poll */
1048 } reg_state:16; 1296 } reg_state:8;
1297
1298 bool dismantle; /* device is going do be freed */
1049 1299
1050 enum { 1300 enum {
1051 RTNL_LINK_INITIALIZED, 1301 RTNL_LINK_INITIALIZED,
@@ -1072,7 +1322,7 @@ struct net_device {
1072 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1322 struct pcpu_dstats __percpu *dstats; /* dummy stats */
1073 }; 1323 };
1074 /* GARP */ 1324 /* GARP */
1075 struct garp_port *garp_port; 1325 struct garp_port __rcu *garp_port;
1076 1326
1077 /* class/net/name entry */ 1327 /* class/net/name entry */
1078 struct device dev; 1328 struct device dev;
@@ -1082,9 +1332,6 @@ struct net_device {
1082 /* rtnetlink link ops */ 1332 /* rtnetlink link ops */
1083 const struct rtnl_link_ops *rtnl_link_ops; 1333 const struct rtnl_link_ops *rtnl_link_ops;
1084 1334
1085 /* VLAN feature mask */
1086 unsigned long vlan_features;
1087
1088 /* for setting kernel sock attribute on TCP connection setup */ 1335 /* for setting kernel sock attribute on TCP connection setup */
1089#define GSO_MAX_SIZE 65536 1336#define GSO_MAX_SIZE 65536
1090 unsigned int gso_max_size; 1337 unsigned int gso_max_size;
@@ -1093,6 +1340,9 @@ struct net_device {
1093 /* Data Center Bridging netlink ops */ 1340 /* Data Center Bridging netlink ops */
1094 const struct dcbnl_rtnl_ops *dcbnl_ops; 1341 const struct dcbnl_rtnl_ops *dcbnl_ops;
1095#endif 1342#endif
1343 u8 num_tc;
1344 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1345 u8 prio_tc_map[TC_BITMASK + 1];
1096 1346
1097#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1347#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
1098 /* max exchange id for FCoE LRO by ddp */ 1348 /* max exchange id for FCoE LRO by ddp */
@@ -1103,12 +1353,66 @@ struct net_device {
1103 1353
1104 /* phy device may attach itself for hardware timestamping */ 1354 /* phy device may attach itself for hardware timestamping */
1105 struct phy_device *phydev; 1355 struct phy_device *phydev;
1356
1357 /* group the device belongs to */
1358 int group;
1106}; 1359};
1107#define to_net_dev(d) container_of(d, struct net_device, dev) 1360#define to_net_dev(d) container_of(d, struct net_device, dev)
1108 1361
1109#define NETDEV_ALIGN 32 1362#define NETDEV_ALIGN 32
1110 1363
1111static inline 1364static inline
1365int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio)
1366{
1367 return dev->prio_tc_map[prio & TC_BITMASK];
1368}
1369
1370static inline
1371int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc)
1372{
1373 if (tc >= dev->num_tc)
1374 return -EINVAL;
1375
1376 dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK;
1377 return 0;
1378}
1379
1380static inline
1381void netdev_reset_tc(struct net_device *dev)
1382{
1383 dev->num_tc = 0;
1384 memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq));
1385 memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map));
1386}
1387
1388static inline
1389int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset)
1390{
1391 if (tc >= dev->num_tc)
1392 return -EINVAL;
1393
1394 dev->tc_to_txq[tc].count = count;
1395 dev->tc_to_txq[tc].offset = offset;
1396 return 0;
1397}
1398
1399static inline
1400int netdev_set_num_tc(struct net_device *dev, u8 num_tc)
1401{
1402 if (num_tc > TC_MAX_QUEUE)
1403 return -EINVAL;
1404
1405 dev->num_tc = num_tc;
1406 return 0;
1407}
1408
1409static inline
1410int netdev_get_num_tc(struct net_device *dev)
1411{
1412 return dev->num_tc;
1413}
1414
1415static inline
1112struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 1416struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1113 unsigned int index) 1417 unsigned int index)
1114{ 1418{
@@ -1250,7 +1554,7 @@ struct packet_type {
1250 struct packet_type *, 1554 struct packet_type *,
1251 struct net_device *); 1555 struct net_device *);
1252 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1556 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1253 int features); 1557 u32 features);
1254 int (*gso_send_check)(struct sk_buff *skb); 1558 int (*gso_send_check)(struct sk_buff *skb);
1255 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1559 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1256 struct sk_buff *skb); 1560 struct sk_buff *skb);
@@ -1295,7 +1599,7 @@ static inline struct net_device *next_net_device_rcu(struct net_device *dev)
1295 struct net *net; 1599 struct net *net;
1296 1600
1297 net = dev_net(dev); 1601 net = dev_net(dev);
1298 lh = rcu_dereference(dev->dev_list.next); 1602 lh = rcu_dereference(list_next_rcu(&dev->dev_list));
1299 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1603 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1300} 1604}
1301 1605
@@ -1305,9 +1609,17 @@ static inline struct net_device *first_net_device(struct net *net)
1305 net_device_entry(net->dev_base_head.next); 1609 net_device_entry(net->dev_base_head.next);
1306} 1610}
1307 1611
1612static inline struct net_device *first_net_device_rcu(struct net *net)
1613{
1614 struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head));
1615
1616 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1617}
1618
1308extern int netdev_boot_setup_check(struct net_device *dev); 1619extern int netdev_boot_setup_check(struct net_device *dev);
1309extern unsigned long netdev_boot_base(const char *prefix, int unit); 1620extern unsigned long netdev_boot_base(const char *prefix, int unit);
1310extern struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr); 1621extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
1622 const char *hwaddr);
1311extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type); 1623extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
1312extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type); 1624extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
1313extern void dev_add_pack(struct packet_type *pt); 1625extern void dev_add_pack(struct packet_type *pt);
@@ -1554,6 +1866,10 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
1554 1866
1555static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) 1867static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1556{ 1868{
1869 if (WARN_ON(!dev_queue)) {
1870 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1871 return;
1872 }
1557 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1873 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
1558} 1874}
1559 1875
@@ -1595,9 +1911,9 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1595 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1911 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1596} 1912}
1597 1913
1598static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue) 1914static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue)
1599{ 1915{
1600 return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state); 1916 return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN;
1601} 1917}
1602 1918
1603/** 1919/**
@@ -1688,6 +2004,16 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
1688 __netif_schedule(txq->qdisc); 2004 __netif_schedule(txq->qdisc);
1689} 2005}
1690 2006
2007/*
2008 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
2009 * as a distribution range limit for the returned value.
2010 */
2011static inline u16 skb_tx_hash(const struct net_device *dev,
2012 const struct sk_buff *skb)
2013{
2014 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues);
2015}
2016
1691/** 2017/**
1692 * netif_is_multiqueue - test if device has multiple transmit queues 2018 * netif_is_multiqueue - test if device has multiple transmit queues
1693 * @dev: network device 2019 * @dev: network device
@@ -1778,6 +2104,7 @@ extern int dev_set_alias(struct net_device *, const char *, size_t);
1778extern int dev_change_net_namespace(struct net_device *, 2104extern int dev_change_net_namespace(struct net_device *,
1779 struct net *, const char *); 2105 struct net *, const char *);
1780extern int dev_set_mtu(struct net_device *, int); 2106extern int dev_set_mtu(struct net_device *, int);
2107extern void dev_set_group(struct net_device *, int);
1781extern int dev_set_mac_address(struct net_device *, 2108extern int dev_set_mac_address(struct net_device *,
1782 struct sockaddr *); 2109 struct sockaddr *);
1783extern int dev_hard_start_xmit(struct sk_buff *skb, 2110extern int dev_hard_start_xmit(struct sk_buff *skb,
@@ -2122,11 +2449,15 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
2122extern void ether_setup(struct net_device *dev); 2449extern void ether_setup(struct net_device *dev);
2123 2450
2124/* Support for loadable net-drivers */ 2451/* Support for loadable net-drivers */
2125extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, 2452extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
2126 void (*setup)(struct net_device *), 2453 void (*setup)(struct net_device *),
2127 unsigned int queue_count); 2454 unsigned int txqs, unsigned int rxqs);
2128#define alloc_netdev(sizeof_priv, name, setup) \ 2455#define alloc_netdev(sizeof_priv, name, setup) \
2129 alloc_netdev_mq(sizeof_priv, name, setup, 1) 2456 alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
2457
2458#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
2459 alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
2460
2130extern int register_netdev(struct net_device *dev); 2461extern int register_netdev(struct net_device *dev);
2131extern void unregister_netdev(struct net_device *dev); 2462extern void unregister_netdev(struct net_device *dev);
2132 2463
@@ -2192,15 +2523,16 @@ extern void dev_load(struct net *net, const char *name);
2192extern void dev_mcast_init(void); 2523extern void dev_mcast_init(void);
2193extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2524extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2194 struct rtnl_link_stats64 *storage); 2525 struct rtnl_link_stats64 *storage);
2195extern void dev_txq_stats_fold(const struct net_device *dev,
2196 struct rtnl_link_stats64 *stats);
2197 2526
2198extern int netdev_max_backlog; 2527extern int netdev_max_backlog;
2199extern int netdev_tstamp_prequeue; 2528extern int netdev_tstamp_prequeue;
2200extern int weight_p; 2529extern int weight_p;
2530extern int bpf_jit_enable;
2201extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2531extern int netdev_set_master(struct net_device *dev, struct net_device *master);
2532extern int netdev_set_bond_master(struct net_device *dev,
2533 struct net_device *master);
2202extern int skb_checksum_help(struct sk_buff *skb); 2534extern int skb_checksum_help(struct sk_buff *skb);
2203extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); 2535extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features);
2204#ifdef CONFIG_BUG 2536#ifdef CONFIG_BUG
2205extern void netdev_rx_csum_fault(struct net_device *dev); 2537extern void netdev_rx_csum_fault(struct net_device *dev);
2206#else 2538#else
@@ -2227,38 +2559,37 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l
2227 2559
2228extern void linkwatch_run_queue(void); 2560extern void linkwatch_run_queue(void);
2229 2561
2230unsigned long netdev_increment_features(unsigned long all, unsigned long one, 2562static inline u32 netdev_get_wanted_features(struct net_device *dev)
2231 unsigned long mask); 2563{
2232unsigned long netdev_fix_features(unsigned long features, const char *name); 2564 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2565}
2566u32 netdev_increment_features(u32 all, u32 one, u32 mask);
2567u32 netdev_fix_features(struct net_device *dev, u32 features);
2568int __netdev_update_features(struct net_device *dev);
2569void netdev_update_features(struct net_device *dev);
2570void netdev_change_features(struct net_device *dev);
2233 2571
2234void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2572void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2235 struct net_device *dev); 2573 struct net_device *dev);
2236 2574
2237static inline int net_gso_ok(int features, int gso_type) 2575u32 netif_skb_features(struct sk_buff *skb);
2576
2577static inline int net_gso_ok(u32 features, int gso_type)
2238{ 2578{
2239 int feature = gso_type << NETIF_F_GSO_SHIFT; 2579 int feature = gso_type << NETIF_F_GSO_SHIFT;
2240 return (features & feature) == feature; 2580 return (features & feature) == feature;
2241} 2581}
2242 2582
2243static inline int skb_gso_ok(struct sk_buff *skb, int features) 2583static inline int skb_gso_ok(struct sk_buff *skb, u32 features)
2244{ 2584{
2245 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2585 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2246 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2586 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2247} 2587}
2248 2588
2249static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 2589static inline int netif_needs_gso(struct sk_buff *skb, int features)
2250{ 2590{
2251 if (skb_is_gso(skb)) { 2591 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2252 int features = dev->features; 2592 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
2253
2254 if (skb->protocol == htons(ETH_P_8021Q) || skb->vlan_tci)
2255 features &= dev->vlan_features;
2256
2257 return (!skb_gso_ok(skb, features) ||
2258 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
2259 }
2260
2261 return 0;
2262} 2593}
2263 2594
2264static inline void netif_set_gso_max_size(struct net_device *dev, 2595static inline void netif_set_gso_max_size(struct net_device *dev,
@@ -2267,29 +2598,20 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2267 dev->gso_max_size = size; 2598 dev->gso_max_size = size;
2268} 2599}
2269 2600
2270extern int __skb_bond_should_drop(struct sk_buff *skb, 2601static inline int netif_is_bond_slave(struct net_device *dev)
2271 struct net_device *master);
2272
2273static inline int skb_bond_should_drop(struct sk_buff *skb,
2274 struct net_device *master)
2275{ 2602{
2276 if (master) 2603 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2277 return __skb_bond_should_drop(skb, master);
2278 return 0;
2279} 2604}
2280 2605
2281extern struct pernet_operations __net_initdata loopback_net_ops; 2606extern struct pernet_operations __net_initdata loopback_net_ops;
2282 2607
2283static inline int dev_ethtool_get_settings(struct net_device *dev, 2608int dev_ethtool_get_settings(struct net_device *dev,
2284 struct ethtool_cmd *cmd) 2609 struct ethtool_cmd *cmd);
2285{
2286 if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
2287 return -EOPNOTSUPP;
2288 return dev->ethtool_ops->get_settings(dev, cmd);
2289}
2290 2610
2291static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) 2611static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2292{ 2612{
2613 if (dev->features & NETIF_F_RXCSUM)
2614 return 1;
2293 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) 2615 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2294 return 0; 2616 return 0;
2295 return dev->ethtool_ops->get_rx_csum(dev); 2617 return dev->ethtool_ops->get_rx_csum(dev);
@@ -2331,6 +2653,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2331extern int netdev_info(const struct net_device *dev, const char *format, ...) 2653extern int netdev_info(const struct net_device *dev, const char *format, ...)
2332 __attribute__ ((format (printf, 2, 3))); 2654 __attribute__ ((format (printf, 2, 3)));
2333 2655
2656#define MODULE_ALIAS_NETDEV(device) \
2657 MODULE_ALIAS("netdev-" device)
2658
2334#if defined(DEBUG) 2659#if defined(DEBUG)
2335#define netdev_dbg(__dev, format, args...) \ 2660#define netdev_dbg(__dev, format, args...) \
2336 netdev_printk(KERN_DEBUG, __dev, format, ##args) 2661 netdev_printk(KERN_DEBUG, __dev, format, ##args)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 89341c32631a..7fa95df60146 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -24,14 +24,20 @@
24#define NF_MAX_VERDICT NF_STOP 24#define NF_MAX_VERDICT NF_STOP
25 25
26/* we overload the higher bits for encoding auxiliary data such as the queue 26/* we overload the higher bits for encoding auxiliary data such as the queue
27 * number. Not nice, but better than additional function arguments. */ 27 * number or errno values. Not nice, but better than additional function
28#define NF_VERDICT_MASK 0x0000ffff 28 * arguments. */
29#define NF_VERDICT_BITS 16 29#define NF_VERDICT_MASK 0x000000ff
30
31/* extra verdict flags have mask 0x0000ff00 */
32#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000
30 33
34/* queue number (NF_QUEUE) or errno (NF_DROP) */
31#define NF_VERDICT_QMASK 0xffff0000 35#define NF_VERDICT_QMASK 0xffff0000
32#define NF_VERDICT_QBITS 16 36#define NF_VERDICT_QBITS 16
33 37
34#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) 38#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
39
40#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
35 41
36/* only for userspace compatibility */ 42/* only for userspace compatibility */
37#ifndef __KERNEL__ 43#ifndef __KERNEL__
@@ -39,6 +45,9 @@
39 <= 0x2000 is used for protocol-flags. */ 45 <= 0x2000 is used for protocol-flags. */
40#define NFC_UNKNOWN 0x4000 46#define NFC_UNKNOWN 0x4000
41#define NFC_ALTERED 0x8000 47#define NFC_ALTERED 0x8000
48
49/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
50#define NF_VERDICT_BITS 16
42#endif 51#endif
43 52
44enum nf_inet_hooks { 53enum nf_inet_hooks {
@@ -70,6 +79,10 @@ union nf_inet_addr {
70 79
71#ifdef __KERNEL__ 80#ifdef __KERNEL__
72#ifdef CONFIG_NETFILTER 81#ifdef CONFIG_NETFILTER
82static inline int NF_DROP_GETERR(int verdict)
83{
84 return -(verdict >> NF_VERDICT_QBITS);
85}
73 86
74static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, 87static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
75 const union nf_inet_addr *a2) 88 const union nf_inet_addr *a2)
@@ -215,7 +228,7 @@ NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb,
215 int ret; 228 int ret;
216 229
217 if (!cond || 230 if (!cond ||
218 (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) 231 ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1))
219 ret = okfn(skb); 232 ret = okfn(skb);
220 return ret; 233 return ret;
221} 234}
@@ -257,7 +270,8 @@ struct nf_afinfo {
257 unsigned int dataoff, 270 unsigned int dataoff,
258 unsigned int len, 271 unsigned int len,
259 u_int8_t protocol); 272 u_int8_t protocol);
260 int (*route)(struct dst_entry **dst, struct flowi *fl); 273 int (*route)(struct net *net, struct dst_entry **dst,
274 struct flowi *fl, bool strict);
261 void (*saveroute)(const struct sk_buff *skb, 275 void (*saveroute)(const struct sk_buff *skb,
262 struct nf_queue_entry *entry); 276 struct nf_queue_entry *entry);
263 int (*reroute)(struct sk_buff *skb, 277 int (*reroute)(struct sk_buff *skb,
@@ -265,7 +279,7 @@ struct nf_afinfo {
265 int route_key_size; 279 int route_key_size;
266}; 280};
267 281
268extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; 282extern const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO];
269static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) 283static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
270{ 284{
271 return rcu_dereference(nf_afinfo[family]); 285 return rcu_dereference(nf_afinfo[family]);
@@ -355,9 +369,9 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
355#endif /*CONFIG_NETFILTER*/ 369#endif /*CONFIG_NETFILTER*/
356 370
357#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 371#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
358extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); 372extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu;
359extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); 373extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
360extern void (*nf_ct_destroy)(struct nf_conntrack *); 374extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
361#else 375#else
362static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 376static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
363#endif 377#endif
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 9d40effe7ca7..a1b410c76fc3 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -1,3 +1,5 @@
1header-y += ipset/
2
1header-y += nf_conntrack_common.h 3header-y += nf_conntrack_common.h
2header-y += nf_conntrack_ftp.h 4header-y += nf_conntrack_ftp.h
3header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
@@ -9,6 +11,7 @@ header-y += nfnetlink_conntrack.h
9header-y += nfnetlink_log.h 11header-y += nfnetlink_log.h
10header-y += nfnetlink_queue.h 12header-y += nfnetlink_queue.h
11header-y += x_tables.h 13header-y += x_tables.h
14header-y += xt_AUDIT.h
12header-y += xt_CHECKSUM.h 15header-y += xt_CHECKSUM.h
13header-y += xt_CLASSIFY.h 16header-y += xt_CLASSIFY.h
14header-y += xt_CONNMARK.h 17header-y += xt_CONNMARK.h
@@ -26,6 +29,7 @@ header-y += xt_TCPMSS.h
26header-y += xt_TCPOPTSTRIP.h 29header-y += xt_TCPOPTSTRIP.h
27header-y += xt_TEE.h 30header-y += xt_TEE.h
28header-y += xt_TPROXY.h 31header-y += xt_TPROXY.h
32header-y += xt_addrtype.h
29header-y += xt_cluster.h 33header-y += xt_cluster.h
30header-y += xt_comment.h 34header-y += xt_comment.h
31header-y += xt_connbytes.h 35header-y += xt_connbytes.h
@@ -34,6 +38,7 @@ header-y += xt_connmark.h
34header-y += xt_conntrack.h 38header-y += xt_conntrack.h
35header-y += xt_cpu.h 39header-y += xt_cpu.h
36header-y += xt_dccp.h 40header-y += xt_dccp.h
41header-y += xt_devgroup.h
37header-y += xt_dscp.h 42header-y += xt_dscp.h
38header-y += xt_esp.h 43header-y += xt_esp.h
39header-y += xt_hashlimit.h 44header-y += xt_hashlimit.h
@@ -54,7 +59,9 @@ header-y += xt_quota.h
54header-y += xt_rateest.h 59header-y += xt_rateest.h
55header-y += xt_realm.h 60header-y += xt_realm.h
56header-y += xt_recent.h 61header-y += xt_recent.h
62header-y += xt_set.h
57header-y += xt_sctp.h 63header-y += xt_sctp.h
64header-y += xt_socket.h
58header-y += xt_state.h 65header-y += xt_state.h
59header-y += xt_statistic.h 66header-y += xt_statistic.h
60header-y += xt_string.h 67header-y += xt_string.h
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild
new file mode 100644
index 000000000000..601fe71d34d5
--- /dev/null
+++ b/include/linux/netfilter/ipset/Kbuild
@@ -0,0 +1,4 @@
1header-y += ip_set.h
2header-y += ip_set_bitmap.h
3header-y += ip_set_hash.h
4header-y += ip_set_list.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
new file mode 100644
index 000000000000..5a262e3ae715
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -0,0 +1,452 @@
1#ifndef _IP_SET_H
2#define _IP_SET_H
3
4/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
5 * Patrick Schaaf <bof@bof.de>
6 * Martin Josefsson <gandalf@wlug.westbo.se>
7 * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14/* The protocol version */
15#define IPSET_PROTOCOL 6
16
17/* The max length of strings including NUL: set and type identifiers */
18#define IPSET_MAXNAMELEN 32
19
20/* Message types and commands */
21enum ipset_cmd {
22 IPSET_CMD_NONE,
23 IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
24 IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
25 IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
26 IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
27 IPSET_CMD_RENAME, /* 5: Rename a set */
28 IPSET_CMD_SWAP, /* 6: Swap two sets */
29 IPSET_CMD_LIST, /* 7: List sets */
30 IPSET_CMD_SAVE, /* 8: Save sets */
31 IPSET_CMD_ADD, /* 9: Add an element to a set */
32 IPSET_CMD_DEL, /* 10: Delete an element from a set */
33 IPSET_CMD_TEST, /* 11: Test an element in a set */
34 IPSET_CMD_HEADER, /* 12: Get set header data only */
35 IPSET_CMD_TYPE, /* 13: Get set type */
36 IPSET_MSG_MAX, /* Netlink message commands */
37
38 /* Commands in userspace: */
39 IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
40 IPSET_CMD_HELP, /* 15: Get help */
41 IPSET_CMD_VERSION, /* 16: Get program version */
42 IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
43
44 IPSET_CMD_MAX,
45
46 IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
47};
48
49/* Attributes at command level */
50enum {
51 IPSET_ATTR_UNSPEC,
52 IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
53 IPSET_ATTR_SETNAME, /* 2: Name of the set */
54 IPSET_ATTR_TYPENAME, /* 3: Typename */
55 IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
56 IPSET_ATTR_REVISION, /* 4: Settype revision */
57 IPSET_ATTR_FAMILY, /* 5: Settype family */
58 IPSET_ATTR_FLAGS, /* 6: Flags at command level */
59 IPSET_ATTR_DATA, /* 7: Nested attributes */
60 IPSET_ATTR_ADT, /* 8: Multiple data containers */
61 IPSET_ATTR_LINENO, /* 9: Restore lineno */
62 IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
63 IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
64 __IPSET_ATTR_CMD_MAX,
65};
66#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
67
68/* CADT specific attributes */
69enum {
70 IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
71 IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
72 IPSET_ATTR_IP_TO, /* 2 */
73 IPSET_ATTR_CIDR, /* 3 */
74 IPSET_ATTR_PORT, /* 4 */
75 IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
76 IPSET_ATTR_PORT_TO, /* 5 */
77 IPSET_ATTR_TIMEOUT, /* 6 */
78 IPSET_ATTR_PROTO, /* 7 */
79 IPSET_ATTR_CADT_FLAGS, /* 8 */
80 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
81 /* Reserve empty slots */
82 IPSET_ATTR_CADT_MAX = 16,
83 /* Create-only specific attributes */
84 IPSET_ATTR_GC,
85 IPSET_ATTR_HASHSIZE,
86 IPSET_ATTR_MAXELEM,
87 IPSET_ATTR_NETMASK,
88 IPSET_ATTR_PROBES,
89 IPSET_ATTR_RESIZE,
90 IPSET_ATTR_SIZE,
91 /* Kernel-only */
92 IPSET_ATTR_ELEMENTS,
93 IPSET_ATTR_REFERENCES,
94 IPSET_ATTR_MEMSIZE,
95
96 __IPSET_ATTR_CREATE_MAX,
97};
98#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
99
100/* ADT specific attributes */
101enum {
102 IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
103 IPSET_ATTR_NAME,
104 IPSET_ATTR_NAMEREF,
105 IPSET_ATTR_IP2,
106 IPSET_ATTR_CIDR2,
107 __IPSET_ATTR_ADT_MAX,
108};
109#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
110
111/* IP specific attributes */
112enum {
113 IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
114 IPSET_ATTR_IPADDR_IPV6,
115 __IPSET_ATTR_IPADDR_MAX,
116};
117#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
118
119/* Error codes */
120enum ipset_errno {
121 IPSET_ERR_PRIVATE = 4096,
122 IPSET_ERR_PROTOCOL,
123 IPSET_ERR_FIND_TYPE,
124 IPSET_ERR_MAX_SETS,
125 IPSET_ERR_BUSY,
126 IPSET_ERR_EXIST_SETNAME2,
127 IPSET_ERR_TYPE_MISMATCH,
128 IPSET_ERR_EXIST,
129 IPSET_ERR_INVALID_CIDR,
130 IPSET_ERR_INVALID_NETMASK,
131 IPSET_ERR_INVALID_FAMILY,
132 IPSET_ERR_TIMEOUT,
133 IPSET_ERR_REFERENCED,
134 IPSET_ERR_IPADDR_IPV4,
135 IPSET_ERR_IPADDR_IPV6,
136
137 /* Type specific error codes */
138 IPSET_ERR_TYPE_SPECIFIC = 4352,
139};
140
141/* Flags at command level */
142enum ipset_cmd_flags {
143 IPSET_FLAG_BIT_EXIST = 0,
144 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
145};
146
147/* Flags at CADT attribute level */
148enum ipset_cadt_flags {
149 IPSET_FLAG_BIT_BEFORE = 0,
150 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
151};
152
153/* Commands with settype-specific attributes */
154enum ipset_adt {
155 IPSET_ADD,
156 IPSET_DEL,
157 IPSET_TEST,
158 IPSET_ADT_MAX,
159 IPSET_CREATE = IPSET_ADT_MAX,
160 IPSET_CADT_MAX,
161};
162
163#ifdef __KERNEL__
164#include <linux/ip.h>
165#include <linux/ipv6.h>
166#include <linux/netlink.h>
167#include <linux/netfilter.h>
168#include <linux/vmalloc.h>
169#include <net/netlink.h>
170
171/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
172 * and IPSET_INVALID_ID if you want to increase the max number of sets.
173 */
174typedef u16 ip_set_id_t;
175
176#define IPSET_INVALID_ID 65535
177
178enum ip_set_dim {
179 IPSET_DIM_ZERO = 0,
180 IPSET_DIM_ONE,
181 IPSET_DIM_TWO,
182 IPSET_DIM_THREE,
183 /* Max dimension in elements.
184 * If changed, new revision of iptables match/target is required.
185 */
186 IPSET_DIM_MAX = 6,
187};
188
189/* Option flags for kernel operations */
190enum ip_set_kopt {
191 IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
192 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
193 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
194 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
195};
196
197/* Set features */
198enum ip_set_feature {
199 IPSET_TYPE_IP_FLAG = 0,
200 IPSET_TYPE_IP = (1 << IPSET_TYPE_IP_FLAG),
201 IPSET_TYPE_PORT_FLAG = 1,
202 IPSET_TYPE_PORT = (1 << IPSET_TYPE_PORT_FLAG),
203 IPSET_TYPE_MAC_FLAG = 2,
204 IPSET_TYPE_MAC = (1 << IPSET_TYPE_MAC_FLAG),
205 IPSET_TYPE_IP2_FLAG = 3,
206 IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG),
207 IPSET_TYPE_NAME_FLAG = 4,
208 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
209 /* Strictly speaking not a feature, but a flag for dumping:
210 * this settype must be dumped last */
211 IPSET_DUMP_LAST_FLAG = 7,
212 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
213};
214
215struct ip_set;
216
217typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout);
218
219/* Set type, variant-specific part */
220struct ip_set_type_variant {
221 /* Kernelspace: test/add/del entries
222 * returns negative error code,
223 * zero for no match/success to add/delete
224 * positive for matching element */
225 int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
226 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
227
228 /* Userspace: test/add/del entries
229 * returns negative error code,
230 * zero for no match/success to add/delete
231 * positive for matching element */
232 int (*uadt)(struct ip_set *set, struct nlattr *tb[],
233 enum ipset_adt adt, u32 *lineno, u32 flags);
234
235 /* Low level add/del/test functions */
236 ipset_adtfn adt[IPSET_ADT_MAX];
237
238 /* When adding entries and set is full, try to resize the set */
239 int (*resize)(struct ip_set *set, bool retried);
240 /* Destroy the set */
241 void (*destroy)(struct ip_set *set);
242 /* Flush the elements */
243 void (*flush)(struct ip_set *set);
244 /* Expire entries before listing */
245 void (*expire)(struct ip_set *set);
246 /* List set header data */
247 int (*head)(struct ip_set *set, struct sk_buff *skb);
248 /* List elements */
249 int (*list)(const struct ip_set *set, struct sk_buff *skb,
250 struct netlink_callback *cb);
251
252 /* Return true if "b" set is the same as "a"
253 * according to the create set parameters */
254 bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
255};
256
257/* The core set type structure */
258struct ip_set_type {
259 struct list_head list;
260
261 /* Typename */
262 char name[IPSET_MAXNAMELEN];
263 /* Protocol version */
264 u8 protocol;
265 /* Set features to control swapping */
266 u8 features;
267 /* Set type dimension */
268 u8 dimension;
269 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */
270 u8 family;
271 /* Type revision */
272 u8 revision;
273
274 /* Create set */
275 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags);
276
277 /* Attribute policies */
278 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1];
279 const struct nla_policy adt_policy[IPSET_ATTR_ADT_MAX + 1];
280
281 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
282 struct module *me;
283};
284
285/* register and unregister set type */
286extern int ip_set_type_register(struct ip_set_type *set_type);
287extern void ip_set_type_unregister(struct ip_set_type *set_type);
288
289/* A generic IP set */
290struct ip_set {
291 /* The name of the set */
292 char name[IPSET_MAXNAMELEN];
293 /* Lock protecting the set data */
294 rwlock_t lock;
295 /* References to the set */
296 u32 ref;
297 /* The core set type */
298 struct ip_set_type *type;
299 /* The type variant doing the real job */
300 const struct ip_set_type_variant *variant;
301 /* The actual INET family of the set */
302 u8 family;
303 /* The type specific data */
304 void *data;
305};
306
307/* register and unregister set references */
308extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
309extern void ip_set_put_byindex(ip_set_id_t index);
310extern const char * ip_set_name_byindex(ip_set_id_t index);
311extern ip_set_id_t ip_set_nfnl_get(const char *name);
312extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index);
313extern void ip_set_nfnl_put(ip_set_id_t index);
314
315/* API for iptables set match, and SET target */
316extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
317 u8 family, u8 dim, u8 flags);
318extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
319 u8 family, u8 dim, u8 flags);
320extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
321 u8 family, u8 dim, u8 flags);
322
323/* Utility functions */
324extern void * ip_set_alloc(size_t size);
325extern void ip_set_free(void *members);
326extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
327extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
328
329static inline int
330ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr)
331{
332 __be32 ip;
333 int ret = ip_set_get_ipaddr4(nla, &ip);
334
335 if (ret)
336 return ret;
337 *ipaddr = ntohl(ip);
338 return 0;
339}
340
341/* Ignore IPSET_ERR_EXIST errors if asked to do so? */
342static inline bool
343ip_set_eexist(int ret, u32 flags)
344{
345 return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST);
346}
347
348/* Check the NLA_F_NET_BYTEORDER flag */
349static inline bool
350ip_set_attr_netorder(struct nlattr *tb[], int type)
351{
352 return tb[type] && (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
353}
354
355static inline bool
356ip_set_optattr_netorder(struct nlattr *tb[], int type)
357{
358 return !tb[type] || (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
359}
360
361/* Useful converters */
362static inline u32
363ip_set_get_h32(const struct nlattr *attr)
364{
365 return ntohl(nla_get_be32(attr));
366}
367
368static inline u16
369ip_set_get_h16(const struct nlattr *attr)
370{
371 return ntohs(nla_get_be16(attr));
372}
373
374#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
375#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
376
377#define NLA_PUT_IPADDR4(skb, type, ipaddr) \
378do { \
379 struct nlattr *__nested = ipset_nest_start(skb, type); \
380 \
381 if (!__nested) \
382 goto nla_put_failure; \
383 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \
384 ipset_nest_end(skb, __nested); \
385} while (0)
386
387#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \
388do { \
389 struct nlattr *__nested = ipset_nest_start(skb, type); \
390 \
391 if (!__nested) \
392 goto nla_put_failure; \
393 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \
394 sizeof(struct in6_addr), ipaddrptr); \
395 ipset_nest_end(skb, __nested); \
396} while (0)
397
398/* Get address from skbuff */
399static inline __be32
400ip4addr(const struct sk_buff *skb, bool src)
401{
402 return src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
403}
404
405static inline void
406ip4addrptr(const struct sk_buff *skb, bool src, __be32 *addr)
407{
408 *addr = src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
409}
410
411static inline void
412ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
413{
414 memcpy(addr, src ? &ipv6_hdr(skb)->saddr : &ipv6_hdr(skb)->daddr,
415 sizeof(*addr));
416}
417
418/* Calculate the bytes required to store the inclusive range of a-b */
419static inline int
420bitmap_bytes(u32 a, u32 b)
421{
422 return 4 * ((((b - a + 8) / 8) + 3) / 4);
423}
424
425/* Interface to iptables/ip6tables */
426
427#define SO_IP_SET 83
428
429union ip_set_name_index {
430 char name[IPSET_MAXNAMELEN];
431 ip_set_id_t index;
432};
433
434#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
435struct ip_set_req_get_set {
436 unsigned op;
437 unsigned version;
438 union ip_set_name_index set;
439};
440
441#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
442/* Uses ip_set_req_get_set */
443
444#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
445struct ip_set_req_version {
446 unsigned op;
447 unsigned version;
448};
449
450#endif /* __KERNEL__ */
451
452#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
new file mode 100644
index 000000000000..a0196ac79051
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -0,0 +1,1073 @@
1#ifndef _IP_SET_AHASH_H
2#define _IP_SET_AHASH_H
3
4#include <linux/rcupdate.h>
5#include <linux/jhash.h>
6#include <linux/netfilter/ipset/ip_set_timeout.h>
7
8/* Hashing which uses arrays to resolve clashing. The hash table is resized
9 * (doubled) when searching becomes too long.
10 * Internally jhash is used with the assumption that the size of the
11 * stored data is a multiple of sizeof(u32). If storage supports timeout,
12 * the timeout field must be the last one in the data structure - that field
13 * is ignored when computing the hash key.
14 *
15 * Readers and resizing
16 *
17 * Resizing can be triggered by userspace command only, and those
18 * are serialized by the nfnl mutex. During resizing the set is
19 * read-locked, so the only possible concurrent operations are
20 * the kernel side readers. Those must be protected by proper RCU locking.
21 */
22
23/* Number of elements to store in an initial array block */
24#define AHASH_INIT_SIZE 4
25/* Max number of elements to store in an array block */
26#define AHASH_MAX_SIZE (3*4)
27
28/* A hash bucket */
29struct hbucket {
30 void *value; /* the array of the values */
31 u8 size; /* size of the array */
32 u8 pos; /* position of the first free entry */
33};
34
35/* The hash table: the table size stored here in order to make resizing easy */
36struct htable {
37 u8 htable_bits; /* size of hash table == 2^htable_bits */
38 struct hbucket bucket[0]; /* hashtable buckets */
39};
40
41#define hbucket(h, i) &((h)->bucket[i])
42
43/* Book-keeping of the prefixes added to the set */
44struct ip_set_hash_nets {
45 u8 cidr; /* the different cidr values in the set */
46 u32 nets; /* number of elements per cidr */
47};
48
49/* The generic ip_set hash structure */
50struct ip_set_hash {
51 struct htable *table; /* the hash table */
52 u32 maxelem; /* max elements in the hash */
53 u32 elements; /* current element (vs timeout) */
54 u32 initval; /* random jhash init value */
55 u32 timeout; /* timeout value, if enabled */
56 struct timer_list gc; /* garbage collection when timeout enabled */
57#ifdef IP_SET_HASH_WITH_NETMASK
58 u8 netmask; /* netmask value for subnets to store */
59#endif
60#ifdef IP_SET_HASH_WITH_NETS
61 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */
62#endif
63};
64
65/* Compute htable_bits from the user input parameter hashsize */
66static u8
67htable_bits(u32 hashsize)
68{
69 /* Assume that hashsize == 2^htable_bits */
70 u8 bits = fls(hashsize - 1);
71 if (jhash_size(bits) != hashsize)
72 /* Round up to the first 2^n value */
73 bits = fls(hashsize);
74
75 return bits;
76}
77
78#ifdef IP_SET_HASH_WITH_NETS
79
80#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
81
82/* Network cidr size book keeping when the hash stores different
83 * sized networks */
84static void
85add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
86{
87 u8 i;
88
89 ++h->nets[cidr-1].nets;
90
91 pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
92
93 if (h->nets[cidr-1].nets > 1)
94 return;
95
96 /* New cidr size */
97 for (i = 0; i < host_mask && h->nets[i].cidr; i++) {
98 /* Add in increasing prefix order, so larger cidr first */
99 if (h->nets[i].cidr < cidr)
100 swap(h->nets[i].cidr, cidr);
101 }
102 if (i < host_mask)
103 h->nets[i].cidr = cidr;
104}
105
106static void
107del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
108{
109 u8 i;
110
111 --h->nets[cidr-1].nets;
112
113 pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets);
114
115 if (h->nets[cidr-1].nets != 0)
116 return;
117
118 /* All entries with this cidr size deleted, so cleanup h->cidr[] */
119 for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) {
120 if (h->nets[i].cidr == cidr)
121 h->nets[i].cidr = cidr = h->nets[i+1].cidr;
122 }
123 h->nets[i - 1].cidr = 0;
124}
125#endif
126
127/* Destroy the hashtable part of the set */
128static void
129ahash_destroy(struct htable *t)
130{
131 struct hbucket *n;
132 u32 i;
133
134 for (i = 0; i < jhash_size(t->htable_bits); i++) {
135 n = hbucket(t, i);
136 if (n->size)
137 /* FIXME: use slab cache */
138 kfree(n->value);
139 }
140
141 ip_set_free(t);
142}
143
144/* Calculate the actual memory size of the set data */
145static size_t
146ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask)
147{
148 u32 i;
149 struct htable *t = h->table;
150 size_t memsize = sizeof(*h)
151 + sizeof(*t)
152#ifdef IP_SET_HASH_WITH_NETS
153 + sizeof(struct ip_set_hash_nets) * host_mask
154#endif
155 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
156
157 for (i = 0; i < jhash_size(t->htable_bits); i++)
158 memsize += t->bucket[i].size * dsize;
159
160 return memsize;
161}
162
163/* Flush a hash type of set: destroy all elements */
164static void
165ip_set_hash_flush(struct ip_set *set)
166{
167 struct ip_set_hash *h = set->data;
168 struct htable *t = h->table;
169 struct hbucket *n;
170 u32 i;
171
172 for (i = 0; i < jhash_size(t->htable_bits); i++) {
173 n = hbucket(t, i);
174 if (n->size) {
175 n->size = n->pos = 0;
176 /* FIXME: use slab cache */
177 kfree(n->value);
178 }
179 }
180#ifdef IP_SET_HASH_WITH_NETS
181 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
182 * SET_HOST_MASK(set->family));
183#endif
184 h->elements = 0;
185}
186
187/* Destroy a hash type of set */
188static void
189ip_set_hash_destroy(struct ip_set *set)
190{
191 struct ip_set_hash *h = set->data;
192
193 if (with_timeout(h->timeout))
194 del_timer_sync(&h->gc);
195
196 ahash_destroy(h->table);
197 kfree(h);
198
199 set->data = NULL;
200}
201
202#define HKEY(data, initval, htable_bits) \
203(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
204 & jhash_mask(htable_bits))
205
206#endif /* _IP_SET_AHASH_H */
207
208#define CONCAT(a, b, c) a##b##c
209#define TOKEN(a, b, c) CONCAT(a, b, c)
210
211/* Type/family dependent function prototypes */
212
213#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
214#define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull)
215#define type_pf_data_copy TOKEN(TYPE, PF, _data_copy)
216#define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out)
217#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask)
218#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
219#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
220
221#define type_pf_elem TOKEN(TYPE, PF, _elem)
222#define type_pf_telem TOKEN(TYPE, PF, _telem)
223#define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout)
224#define type_pf_data_expired TOKEN(TYPE, PF, _data_expired)
225#define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set)
226
227#define type_pf_elem_add TOKEN(TYPE, PF, _elem_add)
228#define type_pf_add TOKEN(TYPE, PF, _add)
229#define type_pf_del TOKEN(TYPE, PF, _del)
230#define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs)
231#define type_pf_test TOKEN(TYPE, PF, _test)
232
233#define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd)
234#define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem)
235#define type_pf_expire TOKEN(TYPE, PF, _expire)
236#define type_pf_tadd TOKEN(TYPE, PF, _tadd)
237#define type_pf_tdel TOKEN(TYPE, PF, _tdel)
238#define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs)
239#define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest)
240
241#define type_pf_resize TOKEN(TYPE, PF, _resize)
242#define type_pf_tresize TOKEN(TYPE, PF, _tresize)
243#define type_pf_flush ip_set_hash_flush
244#define type_pf_destroy ip_set_hash_destroy
245#define type_pf_head TOKEN(TYPE, PF, _head)
246#define type_pf_list TOKEN(TYPE, PF, _list)
247#define type_pf_tlist TOKEN(TYPE, PF, _tlist)
248#define type_pf_same_set TOKEN(TYPE, PF, _same_set)
249#define type_pf_kadt TOKEN(TYPE, PF, _kadt)
250#define type_pf_uadt TOKEN(TYPE, PF, _uadt)
251#define type_pf_gc TOKEN(TYPE, PF, _gc)
252#define type_pf_gc_init TOKEN(TYPE, PF, _gc_init)
253#define type_pf_variant TOKEN(TYPE, PF, _variant)
254#define type_pf_tvariant TOKEN(TYPE, PF, _tvariant)
255
256/* Flavour without timeout */
257
258/* Get the ith element from the array block n */
259#define ahash_data(n, i) \
260 ((struct type_pf_elem *)((n)->value) + (i))
261
262/* Add an element to the hash table when resizing the set:
263 * we spare the maintenance of the internal counters. */
264static int
265type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value)
266{
267 if (n->pos >= n->size) {
268 void *tmp;
269
270 if (n->size >= AHASH_MAX_SIZE)
271 /* Trigger rehashing */
272 return -EAGAIN;
273
274 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
275 * sizeof(struct type_pf_elem),
276 GFP_ATOMIC);
277 if (!tmp)
278 return -ENOMEM;
279 if (n->size) {
280 memcpy(tmp, n->value,
281 sizeof(struct type_pf_elem) * n->size);
282 kfree(n->value);
283 }
284 n->value = tmp;
285 n->size += AHASH_INIT_SIZE;
286 }
287 type_pf_data_copy(ahash_data(n, n->pos++), value);
288 return 0;
289}
290
291/* Resize a hash: create a new hash table with doubling the hashsize
292 * and inserting the elements to it. Repeat until we succeed or
293 * fail due to memory pressures. */
294static int
295type_pf_resize(struct ip_set *set, bool retried)
296{
297 struct ip_set_hash *h = set->data;
298 struct htable *t, *orig = h->table;
299 u8 htable_bits = orig->htable_bits;
300 const struct type_pf_elem *data;
301 struct hbucket *n, *m;
302 u32 i, j;
303 int ret;
304
305retry:
306 ret = 0;
307 htable_bits++;
308 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
309 set->name, orig->htable_bits, htable_bits, orig);
310 if (!htable_bits)
311 /* In case we have plenty of memory :-) */
312 return -IPSET_ERR_HASH_FULL;
313 t = ip_set_alloc(sizeof(*t)
314 + jhash_size(htable_bits) * sizeof(struct hbucket));
315 if (!t)
316 return -ENOMEM;
317 t->htable_bits = htable_bits;
318
319 read_lock_bh(&set->lock);
320 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
321 n = hbucket(orig, i);
322 for (j = 0; j < n->pos; j++) {
323 data = ahash_data(n, j);
324 m = hbucket(t, HKEY(data, h->initval, htable_bits));
325 ret = type_pf_elem_add(m, data);
326 if (ret < 0) {
327 read_unlock_bh(&set->lock);
328 ahash_destroy(t);
329 if (ret == -EAGAIN)
330 goto retry;
331 return ret;
332 }
333 }
334 }
335
336 rcu_assign_pointer(h->table, t);
337 read_unlock_bh(&set->lock);
338
339 /* Give time to other readers of the set */
340 synchronize_rcu_bh();
341
342 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
343 orig->htable_bits, orig, t->htable_bits, t);
344 ahash_destroy(orig);
345
346 return 0;
347}
348
349/* Add an element to a hash and update the internal counters when succeeded,
350 * otherwise report the proper error code. */
351static int
352type_pf_add(struct ip_set *set, void *value, u32 timeout)
353{
354 struct ip_set_hash *h = set->data;
355 struct htable *t;
356 const struct type_pf_elem *d = value;
357 struct hbucket *n;
358 int i, ret = 0;
359 u32 key;
360
361 if (h->elements >= h->maxelem)
362 return -IPSET_ERR_HASH_FULL;
363
364 rcu_read_lock_bh();
365 t = rcu_dereference_bh(h->table);
366 key = HKEY(value, h->initval, t->htable_bits);
367 n = hbucket(t, key);
368 for (i = 0; i < n->pos; i++)
369 if (type_pf_data_equal(ahash_data(n, i), d)) {
370 ret = -IPSET_ERR_EXIST;
371 goto out;
372 }
373
374 ret = type_pf_elem_add(n, value);
375 if (ret != 0)
376 goto out;
377
378#ifdef IP_SET_HASH_WITH_NETS
379 add_cidr(h, d->cidr, HOST_MASK);
380#endif
381 h->elements++;
382out:
383 rcu_read_unlock_bh();
384 return ret;
385}
386
387/* Delete an element from the hash: swap it with the last element
388 * and free up space if possible.
389 */
390static int
391type_pf_del(struct ip_set *set, void *value, u32 timeout)
392{
393 struct ip_set_hash *h = set->data;
394 struct htable *t = h->table;
395 const struct type_pf_elem *d = value;
396 struct hbucket *n;
397 int i;
398 struct type_pf_elem *data;
399 u32 key;
400
401 key = HKEY(value, h->initval, t->htable_bits);
402 n = hbucket(t, key);
403 for (i = 0; i < n->pos; i++) {
404 data = ahash_data(n, i);
405 if (!type_pf_data_equal(data, d))
406 continue;
407 if (i != n->pos - 1)
408 /* Not last one */
409 type_pf_data_copy(data, ahash_data(n, n->pos - 1));
410
411 n->pos--;
412 h->elements--;
413#ifdef IP_SET_HASH_WITH_NETS
414 del_cidr(h, d->cidr, HOST_MASK);
415#endif
416 if (n->pos + AHASH_INIT_SIZE < n->size) {
417 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
418 * sizeof(struct type_pf_elem),
419 GFP_ATOMIC);
420 if (!tmp)
421 return 0;
422 n->size -= AHASH_INIT_SIZE;
423 memcpy(tmp, n->value,
424 n->size * sizeof(struct type_pf_elem));
425 kfree(n->value);
426 n->value = tmp;
427 }
428 return 0;
429 }
430
431 return -IPSET_ERR_EXIST;
432}
433
434#ifdef IP_SET_HASH_WITH_NETS
435
436/* Special test function which takes into account the different network
437 * sizes added to the set */
438static int
439type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
440{
441 struct ip_set_hash *h = set->data;
442 struct htable *t = h->table;
443 struct hbucket *n;
444 const struct type_pf_elem *data;
445 int i, j = 0;
446 u32 key;
447 u8 host_mask = SET_HOST_MASK(set->family);
448
449 pr_debug("test by nets\n");
450 for (; j < host_mask && h->nets[j].cidr; j++) {
451 type_pf_data_netmask(d, h->nets[j].cidr);
452 key = HKEY(d, h->initval, t->htable_bits);
453 n = hbucket(t, key);
454 for (i = 0; i < n->pos; i++) {
455 data = ahash_data(n, i);
456 if (type_pf_data_equal(data, d))
457 return 1;
458 }
459 }
460 return 0;
461}
462#endif
463
464/* Test whether the element is added to the set */
465static int
466type_pf_test(struct ip_set *set, void *value, u32 timeout)
467{
468 struct ip_set_hash *h = set->data;
469 struct htable *t = h->table;
470 struct type_pf_elem *d = value;
471 struct hbucket *n;
472 const struct type_pf_elem *data;
473 int i;
474 u32 key;
475
476#ifdef IP_SET_HASH_WITH_NETS
477 /* If we test an IP address and not a network address,
478 * try all possible network sizes */
479 if (d->cidr == SET_HOST_MASK(set->family))
480 return type_pf_test_cidrs(set, d, timeout);
481#endif
482
483 key = HKEY(d, h->initval, t->htable_bits);
484 n = hbucket(t, key);
485 for (i = 0; i < n->pos; i++) {
486 data = ahash_data(n, i);
487 if (type_pf_data_equal(data, d))
488 return 1;
489 }
490 return 0;
491}
492
493/* Reply a HEADER request: fill out the header part of the set */
494static int
495type_pf_head(struct ip_set *set, struct sk_buff *skb)
496{
497 const struct ip_set_hash *h = set->data;
498 struct nlattr *nested;
499 size_t memsize;
500
501 read_lock_bh(&set->lock);
502 memsize = ahash_memsize(h, with_timeout(h->timeout)
503 ? sizeof(struct type_pf_telem)
504 : sizeof(struct type_pf_elem),
505 set->family == AF_INET ? 32 : 128);
506 read_unlock_bh(&set->lock);
507
508 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
509 if (!nested)
510 goto nla_put_failure;
511 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE,
512 htonl(jhash_size(h->table->htable_bits)));
513 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem));
514#ifdef IP_SET_HASH_WITH_NETMASK
515 if (h->netmask != HOST_MASK)
516 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask);
517#endif
518 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1));
519 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize));
520 if (with_timeout(h->timeout))
521 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout));
522 ipset_nest_end(skb, nested);
523
524 return 0;
525nla_put_failure:
526 return -EMSGSIZE;
527}
528
529/* Reply a LIST/SAVE request: dump the elements of the specified set */
530static int
531type_pf_list(const struct ip_set *set,
532 struct sk_buff *skb, struct netlink_callback *cb)
533{
534 const struct ip_set_hash *h = set->data;
535 const struct htable *t = h->table;
536 struct nlattr *atd, *nested;
537 const struct hbucket *n;
538 const struct type_pf_elem *data;
539 u32 first = cb->args[2];
540 /* We assume that one hash bucket fills into one page */
541 void *incomplete;
542 int i;
543
544 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
545 if (!atd)
546 return -EMSGSIZE;
547 pr_debug("list hash set %s\n", set->name);
548 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
549 incomplete = skb_tail_pointer(skb);
550 n = hbucket(t, cb->args[2]);
551 pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n);
552 for (i = 0; i < n->pos; i++) {
553 data = ahash_data(n, i);
554 pr_debug("list hash %lu hbucket %p i %u, data %p\n",
555 cb->args[2], n, i, data);
556 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
557 if (!nested) {
558 if (cb->args[2] == first) {
559 nla_nest_cancel(skb, atd);
560 return -EMSGSIZE;
561 } else
562 goto nla_put_failure;
563 }
564 if (type_pf_data_list(skb, data))
565 goto nla_put_failure;
566 ipset_nest_end(skb, nested);
567 }
568 }
569 ipset_nest_end(skb, atd);
570 /* Set listing finished */
571 cb->args[2] = 0;
572
573 return 0;
574
575nla_put_failure:
576 nlmsg_trim(skb, incomplete);
577 ipset_nest_end(skb, atd);
578 if (unlikely(first == cb->args[2])) {
579 pr_warning("Can't list set %s: one bucket does not fit into "
580 "a message. Please report it!\n", set->name);
581 cb->args[2] = 0;
582 return -EMSGSIZE;
583 }
584 return 0;
585}
586
587static int
588type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,
589 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
590static int
591type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
592 enum ipset_adt adt, u32 *lineno, u32 flags);
593
594static const struct ip_set_type_variant type_pf_variant = {
595 .kadt = type_pf_kadt,
596 .uadt = type_pf_uadt,
597 .adt = {
598 [IPSET_ADD] = type_pf_add,
599 [IPSET_DEL] = type_pf_del,
600 [IPSET_TEST] = type_pf_test,
601 },
602 .destroy = type_pf_destroy,
603 .flush = type_pf_flush,
604 .head = type_pf_head,
605 .list = type_pf_list,
606 .resize = type_pf_resize,
607 .same_set = type_pf_same_set,
608};
609
610/* Flavour with timeout support */
611
612#define ahash_tdata(n, i) \
613 (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i))
614
615static inline u32
616type_pf_data_timeout(const struct type_pf_elem *data)
617{
618 const struct type_pf_telem *tdata =
619 (const struct type_pf_telem *) data;
620
621 return tdata->timeout;
622}
623
624static inline bool
625type_pf_data_expired(const struct type_pf_elem *data)
626{
627 const struct type_pf_telem *tdata =
628 (const struct type_pf_telem *) data;
629
630 return ip_set_timeout_expired(tdata->timeout);
631}
632
633static inline void
634type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
635{
636 struct type_pf_telem *tdata = (struct type_pf_telem *) data;
637
638 tdata->timeout = ip_set_timeout_set(timeout);
639}
640
641static int
642type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
643 u32 timeout)
644{
645 struct type_pf_elem *data;
646
647 if (n->pos >= n->size) {
648 void *tmp;
649
650 if (n->size >= AHASH_MAX_SIZE)
651 /* Trigger rehashing */
652 return -EAGAIN;
653
654 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
655 * sizeof(struct type_pf_telem),
656 GFP_ATOMIC);
657 if (!tmp)
658 return -ENOMEM;
659 if (n->size) {
660 memcpy(tmp, n->value,
661 sizeof(struct type_pf_telem) * n->size);
662 kfree(n->value);
663 }
664 n->value = tmp;
665 n->size += AHASH_INIT_SIZE;
666 }
667 data = ahash_tdata(n, n->pos++);
668 type_pf_data_copy(data, value);
669 type_pf_data_timeout_set(data, timeout);
670 return 0;
671}
672
673/* Delete expired elements from the hashtable */
674static void
675type_pf_expire(struct ip_set_hash *h)
676{
677 struct htable *t = h->table;
678 struct hbucket *n;
679 struct type_pf_elem *data;
680 u32 i;
681 int j;
682
683 for (i = 0; i < jhash_size(t->htable_bits); i++) {
684 n = hbucket(t, i);
685 for (j = 0; j < n->pos; j++) {
686 data = ahash_tdata(n, j);
687 if (type_pf_data_expired(data)) {
688 pr_debug("expired %u/%u\n", i, j);
689#ifdef IP_SET_HASH_WITH_NETS
690 del_cidr(h, data->cidr, HOST_MASK);
691#endif
692 if (j != n->pos - 1)
693 /* Not last one */
694 type_pf_data_copy(data,
695 ahash_tdata(n, n->pos - 1));
696 n->pos--;
697 h->elements--;
698 }
699 }
700 if (n->pos + AHASH_INIT_SIZE < n->size) {
701 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
702 * sizeof(struct type_pf_telem),
703 GFP_ATOMIC);
704 if (!tmp)
705 /* Still try to delete expired elements */
706 continue;
707 n->size -= AHASH_INIT_SIZE;
708 memcpy(tmp, n->value,
709 n->size * sizeof(struct type_pf_telem));
710 kfree(n->value);
711 n->value = tmp;
712 }
713 }
714}
715
716static int
717type_pf_tresize(struct ip_set *set, bool retried)
718{
719 struct ip_set_hash *h = set->data;
720 struct htable *t, *orig = h->table;
721 u8 htable_bits = orig->htable_bits;
722 const struct type_pf_elem *data;
723 struct hbucket *n, *m;
724 u32 i, j;
725 int ret;
726
727 /* Try to cleanup once */
728 if (!retried) {
729 i = h->elements;
730 write_lock_bh(&set->lock);
731 type_pf_expire(set->data);
732 write_unlock_bh(&set->lock);
733 if (h->elements < i)
734 return 0;
735 }
736
737retry:
738 ret = 0;
739 htable_bits++;
740 if (!htable_bits)
741 /* In case we have plenty of memory :-) */
742 return -IPSET_ERR_HASH_FULL;
743 t = ip_set_alloc(sizeof(*t)
744 + jhash_size(htable_bits) * sizeof(struct hbucket));
745 if (!t)
746 return -ENOMEM;
747 t->htable_bits = htable_bits;
748
749 read_lock_bh(&set->lock);
750 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
751 n = hbucket(orig, i);
752 for (j = 0; j < n->pos; j++) {
753 data = ahash_tdata(n, j);
754 m = hbucket(t, HKEY(data, h->initval, htable_bits));
755 ret = type_pf_elem_tadd(m, data,
756 type_pf_data_timeout(data));
757 if (ret < 0) {
758 read_unlock_bh(&set->lock);
759 ahash_destroy(t);
760 if (ret == -EAGAIN)
761 goto retry;
762 return ret;
763 }
764 }
765 }
766
767 rcu_assign_pointer(h->table, t);
768 read_unlock_bh(&set->lock);
769
770 /* Give time to other readers of the set */
771 synchronize_rcu_bh();
772
773 ahash_destroy(orig);
774
775 return 0;
776}
777
778static int
779type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
780{
781 struct ip_set_hash *h = set->data;
782 struct htable *t = h->table;
783 const struct type_pf_elem *d = value;
784 struct hbucket *n;
785 struct type_pf_elem *data;
786 int ret = 0, i, j = AHASH_MAX_SIZE + 1;
787 u32 key;
788
789 if (h->elements >= h->maxelem)
790 /* FIXME: when set is full, we slow down here */
791 type_pf_expire(h);
792 if (h->elements >= h->maxelem)
793 return -IPSET_ERR_HASH_FULL;
794
795 rcu_read_lock_bh();
796 t = rcu_dereference_bh(h->table);
797 key = HKEY(d, h->initval, t->htable_bits);
798 n = hbucket(t, key);
799 for (i = 0; i < n->pos; i++) {
800 data = ahash_tdata(n, i);
801 if (type_pf_data_equal(data, d)) {
802 if (type_pf_data_expired(data))
803 j = i;
804 else {
805 ret = -IPSET_ERR_EXIST;
806 goto out;
807 }
808 } else if (j == AHASH_MAX_SIZE + 1 &&
809 type_pf_data_expired(data))
810 j = i;
811 }
812 if (j != AHASH_MAX_SIZE + 1) {
813 data = ahash_tdata(n, j);
814#ifdef IP_SET_HASH_WITH_NETS
815 del_cidr(h, data->cidr, HOST_MASK);
816 add_cidr(h, d->cidr, HOST_MASK);
817#endif
818 type_pf_data_copy(data, d);
819 type_pf_data_timeout_set(data, timeout);
820 goto out;
821 }
822 ret = type_pf_elem_tadd(n, d, timeout);
823 if (ret != 0)
824 goto out;
825
826#ifdef IP_SET_HASH_WITH_NETS
827 add_cidr(h, d->cidr, HOST_MASK);
828#endif
829 h->elements++;
830out:
831 rcu_read_unlock_bh();
832 return ret;
833}
834
835static int
836type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
837{
838 struct ip_set_hash *h = set->data;
839 struct htable *t = h->table;
840 const struct type_pf_elem *d = value;
841 struct hbucket *n;
842 int i, ret = 0;
843 struct type_pf_elem *data;
844 u32 key;
845
846 key = HKEY(value, h->initval, t->htable_bits);
847 n = hbucket(t, key);
848 for (i = 0; i < n->pos; i++) {
849 data = ahash_tdata(n, i);
850 if (!type_pf_data_equal(data, d))
851 continue;
852 if (type_pf_data_expired(data))
853 ret = -IPSET_ERR_EXIST;
854 if (i != n->pos - 1)
855 /* Not last one */
856 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
857
858 n->pos--;
859 h->elements--;
860#ifdef IP_SET_HASH_WITH_NETS
861 del_cidr(h, d->cidr, HOST_MASK);
862#endif
863 if (n->pos + AHASH_INIT_SIZE < n->size) {
864 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
865 * sizeof(struct type_pf_telem),
866 GFP_ATOMIC);
867 if (!tmp)
868 return 0;
869 n->size -= AHASH_INIT_SIZE;
870 memcpy(tmp, n->value,
871 n->size * sizeof(struct type_pf_telem));
872 kfree(n->value);
873 n->value = tmp;
874 }
875 return 0;
876 }
877
878 return -IPSET_ERR_EXIST;
879}
880
881#ifdef IP_SET_HASH_WITH_NETS
882static int
883type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
884{
885 struct ip_set_hash *h = set->data;
886 struct htable *t = h->table;
887 struct type_pf_elem *data;
888 struct hbucket *n;
889 int i, j = 0;
890 u32 key;
891 u8 host_mask = SET_HOST_MASK(set->family);
892
893 for (; j < host_mask && h->nets[j].cidr; j++) {
894 type_pf_data_netmask(d, h->nets[j].cidr);
895 key = HKEY(d, h->initval, t->htable_bits);
896 n = hbucket(t, key);
897 for (i = 0; i < n->pos; i++) {
898 data = ahash_tdata(n, i);
899 if (type_pf_data_equal(data, d))
900 return !type_pf_data_expired(data);
901 }
902 }
903 return 0;
904}
905#endif
906
907static int
908type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
909{
910 struct ip_set_hash *h = set->data;
911 struct htable *t = h->table;
912 struct type_pf_elem *data, *d = value;
913 struct hbucket *n;
914 int i;
915 u32 key;
916
917#ifdef IP_SET_HASH_WITH_NETS
918 if (d->cidr == SET_HOST_MASK(set->family))
919 return type_pf_ttest_cidrs(set, d, timeout);
920#endif
921 key = HKEY(d, h->initval, t->htable_bits);
922 n = hbucket(t, key);
923 for (i = 0; i < n->pos; i++) {
924 data = ahash_tdata(n, i);
925 if (type_pf_data_equal(data, d))
926 return !type_pf_data_expired(data);
927 }
928 return 0;
929}
930
931static int
932type_pf_tlist(const struct ip_set *set,
933 struct sk_buff *skb, struct netlink_callback *cb)
934{
935 const struct ip_set_hash *h = set->data;
936 const struct htable *t = h->table;
937 struct nlattr *atd, *nested;
938 const struct hbucket *n;
939 const struct type_pf_elem *data;
940 u32 first = cb->args[2];
941 /* We assume that one hash bucket fills into one page */
942 void *incomplete;
943 int i;
944
945 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
946 if (!atd)
947 return -EMSGSIZE;
948 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
949 incomplete = skb_tail_pointer(skb);
950 n = hbucket(t, cb->args[2]);
951 for (i = 0; i < n->pos; i++) {
952 data = ahash_tdata(n, i);
953 pr_debug("list %p %u\n", n, i);
954 if (type_pf_data_expired(data))
955 continue;
956 pr_debug("do list %p %u\n", n, i);
957 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
958 if (!nested) {
959 if (cb->args[2] == first) {
960 nla_nest_cancel(skb, atd);
961 return -EMSGSIZE;
962 } else
963 goto nla_put_failure;
964 }
965 if (type_pf_data_tlist(skb, data))
966 goto nla_put_failure;
967 ipset_nest_end(skb, nested);
968 }
969 }
970 ipset_nest_end(skb, atd);
971 /* Set listing finished */
972 cb->args[2] = 0;
973
974 return 0;
975
976nla_put_failure:
977 nlmsg_trim(skb, incomplete);
978 ipset_nest_end(skb, atd);
979 if (unlikely(first == cb->args[2])) {
980 pr_warning("Can't list set %s: one bucket does not fit into "
981 "a message. Please report it!\n", set->name);
982 cb->args[2] = 0;
983 return -EMSGSIZE;
984 }
985 return 0;
986}
987
988static const struct ip_set_type_variant type_pf_tvariant = {
989 .kadt = type_pf_kadt,
990 .uadt = type_pf_uadt,
991 .adt = {
992 [IPSET_ADD] = type_pf_tadd,
993 [IPSET_DEL] = type_pf_tdel,
994 [IPSET_TEST] = type_pf_ttest,
995 },
996 .destroy = type_pf_destroy,
997 .flush = type_pf_flush,
998 .head = type_pf_head,
999 .list = type_pf_tlist,
1000 .resize = type_pf_tresize,
1001 .same_set = type_pf_same_set,
1002};
1003
1004static void
1005type_pf_gc(unsigned long ul_set)
1006{
1007 struct ip_set *set = (struct ip_set *) ul_set;
1008 struct ip_set_hash *h = set->data;
1009
1010 pr_debug("called\n");
1011 write_lock_bh(&set->lock);
1012 type_pf_expire(h);
1013 write_unlock_bh(&set->lock);
1014
1015 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1016 add_timer(&h->gc);
1017}
1018
1019static void
1020type_pf_gc_init(struct ip_set *set)
1021{
1022 struct ip_set_hash *h = set->data;
1023
1024 init_timer(&h->gc);
1025 h->gc.data = (unsigned long) set;
1026 h->gc.function = type_pf_gc;
1027 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1028 add_timer(&h->gc);
1029 pr_debug("gc initialized, run in every %u\n",
1030 IPSET_GC_PERIOD(h->timeout));
1031}
1032
1033#undef type_pf_data_equal
1034#undef type_pf_data_isnull
1035#undef type_pf_data_copy
1036#undef type_pf_data_zero_out
1037#undef type_pf_data_list
1038#undef type_pf_data_tlist
1039
1040#undef type_pf_elem
1041#undef type_pf_telem
1042#undef type_pf_data_timeout
1043#undef type_pf_data_expired
1044#undef type_pf_data_netmask
1045#undef type_pf_data_timeout_set
1046
1047#undef type_pf_elem_add
1048#undef type_pf_add
1049#undef type_pf_del
1050#undef type_pf_test_cidrs
1051#undef type_pf_test
1052
1053#undef type_pf_elem_tadd
1054#undef type_pf_expire
1055#undef type_pf_tadd
1056#undef type_pf_tdel
1057#undef type_pf_ttest_cidrs
1058#undef type_pf_ttest
1059
1060#undef type_pf_resize
1061#undef type_pf_tresize
1062#undef type_pf_flush
1063#undef type_pf_destroy
1064#undef type_pf_head
1065#undef type_pf_list
1066#undef type_pf_tlist
1067#undef type_pf_same_set
1068#undef type_pf_kadt
1069#undef type_pf_uadt
1070#undef type_pf_gc
1071#undef type_pf_gc_init
1072#undef type_pf_variant
1073#undef type_pf_tvariant
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h
new file mode 100644
index 000000000000..61a9e8746c83
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -0,0 +1,31 @@
1#ifndef __IP_SET_BITMAP_H
2#define __IP_SET_BITMAP_H
3
4/* Bitmap type specific error codes */
5enum {
6 /* The element is out of the range of the set */
7 IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
8 /* The range exceeds the size limit of the set type */
9 IPSET_ERR_BITMAP_RANGE_SIZE,
10};
11
12#ifdef __KERNEL__
13#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
14
15/* Common functions */
16
17static inline u32
18range_to_mask(u32 from, u32 to, u8 *bits)
19{
20 u32 mask = 0xFFFFFFFE;
21
22 *bits = 32;
23 while (--(*bits) > 0 && mask && (to & mask) != from)
24 mask <<= 1;
25
26 return mask;
27}
28
29#endif /* __KERNEL__ */
30
31#endif /* __IP_SET_BITMAP_H */
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h
new file mode 100644
index 000000000000..90d09300e954
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_getport.h
@@ -0,0 +1,33 @@
1#ifndef _IP_SET_GETPORT_H
2#define _IP_SET_GETPORT_H
3
4extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
5 __be16 *port, u8 *proto);
6
7#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
8extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
9 __be16 *port, u8 *proto);
10#else
11static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
12 __be16 *port, u8 *proto)
13{
14 return false;
15}
16#endif
17
18extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
19 __be16 *port);
20
21static inline bool ip_set_proto_with_ports(u8 proto)
22{
23 switch (proto) {
24 case IPPROTO_TCP:
25 case IPPROTO_SCTP:
26 case IPPROTO_UDP:
27 case IPPROTO_UDPLITE:
28 return true;
29 }
30 return false;
31}
32
33#endif /*_IP_SET_GETPORT_H*/
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h
new file mode 100644
index 000000000000..b86f15c04524
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_hash.h
@@ -0,0 +1,26 @@
1#ifndef __IP_SET_HASH_H
2#define __IP_SET_HASH_H
3
4/* Hash type specific error codes */
5enum {
6 /* Hash is full */
7 IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
8 /* Null-valued element */
9 IPSET_ERR_HASH_ELEM,
10 /* Invalid protocol */
11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO,
14};
15
16#ifdef __KERNEL__
17
18#define IPSET_DEFAULT_HASHSIZE 1024
19#define IPSET_MIMINAL_HASHSIZE 64
20#define IPSET_DEFAULT_MAXELEM 65536
21#define IPSET_DEFAULT_PROBES 4
22#define IPSET_DEFAULT_RESIZE 100
23
24#endif /* __KERNEL__ */
25
26#endif /* __IP_SET_HASH_H */
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
new file mode 100644
index 000000000000..40a63f302613
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -0,0 +1,27 @@
1#ifndef __IP_SET_LIST_H
2#define __IP_SET_LIST_H
3
4/* List type specific error codes */
5enum {
6 /* Set name to be added/deleted/tested does not exist. */
7 IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
8 /* list:set type is not permitted to add */
9 IPSET_ERR_LOOP,
10 /* Missing reference set */
11 IPSET_ERR_BEFORE,
12 /* Reference set does not exist */
13 IPSET_ERR_NAMEREF,
14 /* Set is full */
15 IPSET_ERR_LIST_FULL,
16 /* Reference set is not added to the set */
17 IPSET_ERR_REF_EXIST,
18};
19
20#ifdef __KERNEL__
21
22#define IP_SET_LIST_DEFAULT_SIZE 8
23#define IP_SET_LIST_MIN_SIZE 4
24
25#endif /* __KERNEL__ */
26
27#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
new file mode 100644
index 000000000000..9f30c5f2ec1c
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -0,0 +1,127 @@
1#ifndef _IP_SET_TIMEOUT_H
2#define _IP_SET_TIMEOUT_H
3
4/* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
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#ifdef __KERNEL__
12
13/* How often should the gc be run by default */
14#define IPSET_GC_TIME (3 * 60)
15
16/* Timeout period depending on the timeout value of the given set */
17#define IPSET_GC_PERIOD(timeout) \
18 ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1)
19
20/* Set is defined without timeout support: timeout value may be 0 */
21#define IPSET_NO_TIMEOUT UINT_MAX
22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)
24
25static inline unsigned int
26ip_set_timeout_uget(struct nlattr *tb)
27{
28 unsigned int timeout = ip_set_get_h32(tb);
29
30 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
31 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
32}
33
34#ifdef IP_SET_BITMAP_TIMEOUT
35
36/* Bitmap specific timeout constants and macros for the entries */
37
38/* Bitmap entry is unset */
39#define IPSET_ELEM_UNSET 0
40/* Bitmap entry is set with no timeout value */
41#define IPSET_ELEM_PERMANENT (UINT_MAX/2)
42
43static inline bool
44ip_set_timeout_test(unsigned long timeout)
45{
46 return timeout != IPSET_ELEM_UNSET &&
47 (timeout == IPSET_ELEM_PERMANENT ||
48 time_after(timeout, jiffies));
49}
50
51static inline bool
52ip_set_timeout_expired(unsigned long timeout)
53{
54 return timeout != IPSET_ELEM_UNSET &&
55 timeout != IPSET_ELEM_PERMANENT &&
56 time_before(timeout, jiffies);
57}
58
59static inline unsigned long
60ip_set_timeout_set(u32 timeout)
61{
62 unsigned long t;
63
64 if (!timeout)
65 return IPSET_ELEM_PERMANENT;
66
67 t = timeout * HZ + jiffies;
68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 /* Bingo! */
70 t++;
71
72 return t;
73}
74
75static inline u32
76ip_set_timeout_get(unsigned long timeout)
77{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
79}
80
81#else
82
83/* Hash specific timeout constants and macros for the entries */
84
85/* Hash entry is set with no timeout value */
86#define IPSET_ELEM_PERMANENT 0
87
88static inline bool
89ip_set_timeout_test(unsigned long timeout)
90{
91 return timeout == IPSET_ELEM_PERMANENT ||
92 time_after(timeout, jiffies);
93}
94
95static inline bool
96ip_set_timeout_expired(unsigned long timeout)
97{
98 return timeout != IPSET_ELEM_PERMANENT &&
99 time_before(timeout, jiffies);
100}
101
102static inline unsigned long
103ip_set_timeout_set(u32 timeout)
104{
105 unsigned long t;
106
107 if (!timeout)
108 return IPSET_ELEM_PERMANENT;
109
110 t = timeout * HZ + jiffies;
111 if (t == IPSET_ELEM_PERMANENT)
112 /* Bingo! :-) */
113 t++;
114
115 return t;
116}
117
118static inline u32
119ip_set_timeout_get(unsigned long timeout)
120{
121 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
122}
123#endif /* ! IP_SET_BITMAP_TIMEOUT */
124
125#endif /* __KERNEL__ */
126
127#endif /* _IP_SET_TIMEOUT_H */
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h
new file mode 100644
index 000000000000..0e1fb50da562
--- /dev/null
+++ b/include/linux/netfilter/ipset/pfxlen.h
@@ -0,0 +1,35 @@
1#ifndef _PFXLEN_H
2#define _PFXLEN_H
3
4#include <asm/byteorder.h>
5#include <linux/netfilter.h>
6
7/* Prefixlen maps, by Jan Engelhardt */
8extern const union nf_inet_addr ip_set_netmask_map[];
9extern const union nf_inet_addr ip_set_hostmask_map[];
10
11static inline __be32
12ip_set_netmask(u8 pfxlen)
13{
14 return ip_set_netmask_map[pfxlen].ip;
15}
16
17static inline const __be32 *
18ip_set_netmask6(u8 pfxlen)
19{
20 return &ip_set_netmask_map[pfxlen].ip6[0];
21}
22
23static inline u32
24ip_set_hostmask(u8 pfxlen)
25{
26 return (__force u32) ip_set_hostmask_map[pfxlen].ip;
27}
28
29static inline const __be32 *
30ip_set_hostmask6(u8 pfxlen)
31{
32 return &ip_set_hostmask_map[pfxlen].ip6[0];
33}
34
35#endif /*_PFXLEN_H */
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 2a10efda17fb..6a0664c0c451 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -60,7 +60,7 @@ struct gre_hdr_pptp {
60 __be16 payload_len; /* size of ppp payload, not inc. gre header */ 60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __be16 call_id; /* peer's call_id for this session */ 61 __be16 call_id; /* peer's call_id for this session */
62 __be32 seq; /* sequence number. Present if S==1 */ 62 __be32 seq; /* sequence number. Present if S==1 */
63 __be32 ack; /* seq number of highest packet recieved by */ 63 __be32 ack; /* seq number of highest packet received by */
64 /* sender in this session */ 64 /* sender in this session */
65}; 65};
66 66
diff --git a/include/linux/netfilter/nf_conntrack_snmp.h b/include/linux/netfilter/nf_conntrack_snmp.h
new file mode 100644
index 000000000000..064bc63a5346
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_snmp.h
@@ -0,0 +1,9 @@
1#ifndef _NF_CONNTRACK_SNMP_H
2#define _NF_CONNTRACK_SNMP_H
3
4extern int (*nf_nat_snmp_hook)(struct sk_buff *skb,
5 unsigned int protoff,
6 struct nf_conn *ct,
7 enum ip_conntrack_info ctinfo);
8
9#endif /* _NF_CONNTRACK_SNMP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 361d6b5630ee..2b11fc1a86be 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -47,7 +47,8 @@ struct nfgenmsg {
47#define NFNL_SUBSYS_QUEUE 3 47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_COUNT 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7
51 52
52#ifdef __KERNEL__ 53#ifdef __KERNEL__
53 54
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 19711e3ffd42..debf1aefd753 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -42,6 +42,7 @@ enum ctattr_type {
42 CTA_SECMARK, /* obsolete */ 42 CTA_SECMARK, /* obsolete */
43 CTA_ZONE, 43 CTA_ZONE,
44 CTA_SECCTX, 44 CTA_SECCTX,
45 CTA_TIMESTAMP,
45 __CTA_MAX 46 __CTA_MAX
46}; 47};
47#define CTA_MAX (__CTA_MAX - 1) 48#define CTA_MAX (__CTA_MAX - 1)
@@ -127,6 +128,14 @@ enum ctattr_counters {
127}; 128};
128#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) 129#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
129 130
131enum ctattr_tstamp {
132 CTA_TIMESTAMP_UNSPEC,
133 CTA_TIMESTAMP_START,
134 CTA_TIMESTAMP_STOP,
135 __CTA_TIMESTAMP_MAX
136};
137#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
138
130enum ctattr_nat { 139enum ctattr_nat {
131 CTA_NAT_UNSPEC, 140 CTA_NAT_UNSPEC,
132 CTA_NAT_MINIP, 141 CTA_NAT_MINIP,
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index ea9b8d380527..90c2c9575bac 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -28,8 +28,8 @@ struct nfulnl_msg_packet_hw {
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_be64 sec; 31 __aligned_be64 sec;
32 aligned_be64 usec; 32 __aligned_be64 usec;
33}; 33};
34 34
35enum nfulnl_attr_type { 35enum nfulnl_attr_type {
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 2455fe5f4e01..af94e0014ebd 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -25,8 +25,8 @@ struct nfqnl_msg_packet_hw {
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_be64 sec; 28 __aligned_be64 sec;
29 aligned_be64 usec; 29 __aligned_be64 usec;
30}; 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 742bec051440..32cddf78b13e 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -456,72 +456,60 @@ extern void xt_proto_fini(struct net *net, u_int8_t af);
456extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 456extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
457extern void xt_free_table_info(struct xt_table_info *info); 457extern void xt_free_table_info(struct xt_table_info *info);
458 458
459/* 459/**
460 * Per-CPU spinlock associated with per-cpu table entries, and 460 * xt_recseq - recursive seqcount for netfilter use
461 * with a counter for the "reading" side that allows a recursive 461 *
462 * reader to avoid taking the lock and deadlocking. 462 * Packet processing changes the seqcount only if no recursion happened
463 * 463 * get_counters() can use read_seqcount_begin()/read_seqcount_retry(),
464 * "reading" is used by ip/arp/ip6 tables rule processing which runs per-cpu. 464 * because we use the normal seqcount convention :
465 * It needs to ensure that the rules are not being changed while the packet 465 * Low order bit set to 1 if a writer is active.
466 * is being processed. In some cases, the read lock will be acquired
467 * twice on the same CPU; this is okay because of the count.
468 *
469 * "writing" is used when reading counters.
470 * During replace any readers that are using the old tables have to complete
471 * before freeing the old table. This is handled by the write locking
472 * necessary for reading the counters.
473 */ 466 */
474struct xt_info_lock { 467DECLARE_PER_CPU(seqcount_t, xt_recseq);
475 spinlock_t lock;
476 unsigned char readers;
477};
478DECLARE_PER_CPU(struct xt_info_lock, xt_info_locks);
479 468
480/* 469/**
481 * Note: we need to ensure that preemption is disabled before acquiring 470 * xt_write_recseq_begin - start of a write section
482 * the per-cpu-variable, so we do it as a two step process rather than
483 * using "spin_lock_bh()".
484 *
485 * We _also_ need to disable bottom half processing before updating our
486 * nesting count, to make sure that the only kind of re-entrancy is this
487 * code being called by itself: since the count+lock is not an atomic
488 * operation, we can allow no races.
489 * 471 *
490 * _Only_ that special combination of being per-cpu and never getting 472 * Begin packet processing : all readers must wait the end
491 * re-entered asynchronously means that the count is safe. 473 * 1) Must be called with preemption disabled
474 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add())
475 * Returns :
476 * 1 if no recursion on this cpu
477 * 0 if recursion detected
492 */ 478 */
493static inline void xt_info_rdlock_bh(void) 479static inline unsigned int xt_write_recseq_begin(void)
494{ 480{
495 struct xt_info_lock *lock; 481 unsigned int addend;
496 482
497 local_bh_disable(); 483 /*
498 lock = &__get_cpu_var(xt_info_locks); 484 * Low order bit of sequence is set if we already
499 if (likely(!lock->readers++)) 485 * called xt_write_recseq_begin().
500 spin_lock(&lock->lock); 486 */
501} 487 addend = (__this_cpu_read(xt_recseq.sequence) + 1) & 1;
502 488
503static inline void xt_info_rdunlock_bh(void) 489 /*
504{ 490 * This is kind of a write_seqcount_begin(), but addend is 0 or 1
505 struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks); 491 * We dont check addend value to avoid a test and conditional jump,
492 * since addend is most likely 1
493 */
494 __this_cpu_add(xt_recseq.sequence, addend);
495 smp_wmb();
506 496
507 if (likely(!--lock->readers)) 497 return addend;
508 spin_unlock(&lock->lock);
509 local_bh_enable();
510} 498}
511 499
512/* 500/**
513 * The "writer" side needs to get exclusive access to the lock, 501 * xt_write_recseq_end - end of a write section
514 * regardless of readers. This must be called with bottom half 502 * @addend: return value from previous xt_write_recseq_begin()
515 * processing (and thus also preemption) disabled. 503 *
504 * End packet processing : all readers can proceed
505 * 1) Must be called with preemption disabled
506 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add())
516 */ 507 */
517static inline void xt_info_wrlock(unsigned int cpu) 508static inline void xt_write_recseq_end(unsigned int addend)
518{
519 spin_lock(&per_cpu(xt_info_locks, cpu).lock);
520}
521
522static inline void xt_info_wrunlock(unsigned int cpu)
523{ 509{
524 spin_unlock(&per_cpu(xt_info_locks, cpu).lock); 510 /* this is kind of a write_seqcount_end(), but addend is 0 or 1 */
511 smp_wmb();
512 __this_cpu_add(xt_recseq.sequence, addend);
525} 513}
526 514
527/* 515/*
@@ -611,8 +599,9 @@ struct _compat_xt_align {
611extern void xt_compat_lock(u_int8_t af); 599extern void xt_compat_lock(u_int8_t af);
612extern void xt_compat_unlock(u_int8_t af); 600extern void xt_compat_unlock(u_int8_t af);
613 601
614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); 602extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
615extern void xt_compat_flush_offsets(u_int8_t af); 603extern void xt_compat_flush_offsets(u_int8_t af);
604extern void xt_compat_init_offsets(u_int8_t af, unsigned int number);
616extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); 605extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
617 606
618extern int xt_compat_match_offset(const struct xt_match *match); 607extern int xt_compat_match_offset(const struct xt_match *match);
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/linux/netfilter/xt_AUDIT.h
new file mode 100644
index 000000000000..38751d2ea52b
--- /dev/null
+++ b/include/linux/netfilter/xt_AUDIT.h
@@ -0,0 +1,30 @@
1/*
2 * Header file for iptables xt_AUDIT target
3 *
4 * (C) 2010-2011 Thomas Graf <tgraf@redhat.com>
5 * (C) 2010-2011 Red Hat, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _XT_AUDIT_TARGET_H
13#define _XT_AUDIT_TARGET_H
14
15#include <linux/types.h>
16
17enum {
18 XT_AUDIT_TYPE_ACCEPT = 0,
19 XT_AUDIT_TYPE_DROP,
20 XT_AUDIT_TYPE_REJECT,
21 __XT_AUDIT_TYPE_MAX,
22};
23
24#define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1)
25
26struct xt_audit_info {
27 __u8 type; /* XT_AUDIT_TYPE_* */
28};
29
30#endif /* _XT_AUDIT_TARGET_H */
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index 1b564106891d..b56e76811c04 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -1,14 +1,16 @@
1#ifndef _XT_CT_H 1#ifndef _XT_CT_H
2#define _XT_CT_H 2#define _XT_CT_H
3 3
4#include <linux/types.h>
5
4#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
5 7
6struct xt_ct_target_info { 8struct xt_ct_target_info {
7 u_int16_t flags; 9 __u16 flags;
8 u_int16_t zone; 10 __u16 zone;
9 u_int32_t ct_events; 11 __u32 ct_events;
10 u_int32_t exp_events; 12 __u32 exp_events;
11 char helper[16]; 13 char helper[16];
12 14
13 /* Used internally by the kernel */ 15 /* Used internally by the kernel */
14 struct nf_conn *ct __attribute__((aligned(8))); 16 struct nf_conn *ct __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 2584f4a777de..9eafdbbb401c 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -20,4 +20,10 @@ struct xt_NFQ_info_v1 {
20 __u16 queues_total; 20 __u16 queues_total;
21}; 21};
22 22
23struct xt_NFQ_info_v2 {
24 __u16 queuenum;
25 __u16 queues_total;
26 __u16 bypass;
27};
28
23#endif /* _XT_NFQ_TARGET_H */ 29#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h
index 2db543214ff5..7157318499c2 100644
--- a/include/linux/netfilter/xt_TCPOPTSTRIP.h
+++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -1,13 +1,15 @@
1#ifndef _XT_TCPOPTSTRIP_H 1#ifndef _XT_TCPOPTSTRIP_H
2#define _XT_TCPOPTSTRIP_H 2#define _XT_TCPOPTSTRIP_H
3 3
4#include <linux/types.h>
5
4#define tcpoptstrip_set_bit(bmap, idx) \ 6#define tcpoptstrip_set_bit(bmap, idx) \
5 (bmap[(idx) >> 5] |= 1U << (idx & 31)) 7 (bmap[(idx) >> 5] |= 1U << (idx & 31))
6#define tcpoptstrip_test_bit(bmap, idx) \ 8#define tcpoptstrip_test_bit(bmap, idx) \
7 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) 9 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
8 10
9struct xt_tcpoptstrip_target_info { 11struct xt_tcpoptstrip_target_info {
10 u_int32_t strip_bmap[8]; 12 __u32 strip_bmap[8];
11}; 13};
12 14
13#endif /* _XT_TCPOPTSTRIP_H */ 15#endif /* _XT_TCPOPTSTRIP_H */
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h
index 3f3d69361289..902043c2073f 100644
--- a/include/linux/netfilter/xt_TPROXY.h
+++ b/include/linux/netfilter/xt_TPROXY.h
@@ -1,19 +1,21 @@
1#ifndef _XT_TPROXY_H 1#ifndef _XT_TPROXY_H
2#define _XT_TPROXY_H 2#define _XT_TPROXY_H
3 3
4#include <linux/types.h>
5
4/* TPROXY target is capable of marking the packet to perform 6/* TPROXY target is capable of marking the packet to perform
5 * redirection. We can get rid of that whenever we get support for 7 * redirection. We can get rid of that whenever we get support for
6 * mutliple targets in the same rule. */ 8 * mutliple targets in the same rule. */
7struct xt_tproxy_target_info { 9struct xt_tproxy_target_info {
8 u_int32_t mark_mask; 10 __u32 mark_mask;
9 u_int32_t mark_value; 11 __u32 mark_value;
10 __be32 laddr; 12 __be32 laddr;
11 __be16 lport; 13 __be16 lport;
12}; 14};
13 15
14struct xt_tproxy_target_info_v1 { 16struct xt_tproxy_target_info_v1 {
15 u_int32_t mark_mask; 17 __u32 mark_mask;
16 u_int32_t mark_value; 18 __u32 mark_value;
17 union nf_inet_addr laddr; 19 union nf_inet_addr laddr;
18 __be16 lport; 20 __be16 lport;
19}; 21};
diff --git a/include/linux/netfilter/xt_addrtype.h b/include/linux/netfilter/xt_addrtype.h
new file mode 100644
index 000000000000..b156baa9d55e
--- /dev/null
+++ b/include/linux/netfilter/xt_addrtype.h
@@ -0,0 +1,44 @@
1#ifndef _XT_ADDRTYPE_H
2#define _XT_ADDRTYPE_H
3
4#include <linux/types.h>
5
6enum {
7 XT_ADDRTYPE_INVERT_SOURCE = 0x0001,
8 XT_ADDRTYPE_INVERT_DEST = 0x0002,
9 XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004,
10 XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008,
11};
12
13
14/* rtn_type enum values from rtnetlink.h, but shifted */
15enum {
16 XT_ADDRTYPE_UNSPEC = 1 << 0,
17 XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */
18 XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */
19 XT_ADDRTYPE_BROADCAST = 1 << 3,
20 XT_ADDRTYPE_ANYCAST = 1 << 4,
21 XT_ADDRTYPE_MULTICAST = 1 << 5,
22 XT_ADDRTYPE_BLACKHOLE = 1 << 6,
23 XT_ADDRTYPE_UNREACHABLE = 1 << 7,
24 XT_ADDRTYPE_PROHIBIT = 1 << 8,
25 XT_ADDRTYPE_THROW = 1 << 9,
26 XT_ADDRTYPE_NAT = 1 << 10,
27 XT_ADDRTYPE_XRESOLVE = 1 << 11,
28};
29
30struct xt_addrtype_info_v1 {
31 __u16 source; /* source-type mask */
32 __u16 dest; /* dest-type mask */
33 __u32 flags;
34};
35
36/* revision 0 */
37struct xt_addrtype_info {
38 __u16 source; /* source-type mask */
39 __u16 dest; /* dest-type mask */
40 __u32 invert_source;
41 __u32 invert_dest;
42};
43
44#endif
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
index 886682656f09..9b883c8fbf54 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/linux/netfilter/xt_cluster.h
@@ -1,15 +1,17 @@
1#ifndef _XT_CLUSTER_MATCH_H 1#ifndef _XT_CLUSTER_MATCH_H
2#define _XT_CLUSTER_MATCH_H 2#define _XT_CLUSTER_MATCH_H
3 3
4#include <linux/types.h>
5
4enum xt_cluster_flags { 6enum xt_cluster_flags {
5 XT_CLUSTER_F_INV = (1 << 0) 7 XT_CLUSTER_F_INV = (1 << 0)
6}; 8};
7 9
8struct xt_cluster_match_info { 10struct xt_cluster_match_info {
9 u_int32_t total_nodes; 11 __u32 total_nodes;
10 u_int32_t node_mask; 12 __u32 node_mask;
11 u_int32_t hash_seed; 13 __u32 hash_seed;
12 u_int32_t flags; 14 __u32 flags;
13}; 15};
14 16
15#define XT_CLUSTER_NODES_MAX 32 17#define XT_CLUSTER_NODES_MAX 32
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
index eacfedc6b5d0..0ea5e79f5bd7 100644
--- a/include/linux/netfilter/xt_comment.h
+++ b/include/linux/netfilter/xt_comment.h
@@ -4,7 +4,7 @@
4#define XT_MAX_COMMENT_LEN 256 4#define XT_MAX_COMMENT_LEN 256
5 5
6struct xt_comment_info { 6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN]; 7 char comment[XT_MAX_COMMENT_LEN];
8}; 8};
9 9
10#endif /* XT_COMMENT_H */ 10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
index 92fcbb0d193e..f1d6c15bd9e3 100644
--- a/include/linux/netfilter/xt_connbytes.h
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -17,8 +17,8 @@ enum xt_connbytes_direction {
17 17
18struct xt_connbytes_info { 18struct xt_connbytes_info {
19 struct { 19 struct {
20 aligned_u64 from; /* count to be matched */ 20 __aligned_u64 from; /* count to be matched */
21 aligned_u64 to; /* count to be matched */ 21 __aligned_u64 to; /* count to be matched */
22 } count; 22 } count;
23 __u8 what; /* ipt_connbytes_what */ 23 __u8 what; /* ipt_connbytes_what */
24 __u8 direction; /* ipt_connbytes_direction */ 24 __u8 direction; /* ipt_connbytes_direction */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 7e3284bcbd2b..0ca66e97acbc 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -1,8 +1,15 @@
1#ifndef _XT_CONNLIMIT_H 1#ifndef _XT_CONNLIMIT_H
2#define _XT_CONNLIMIT_H 2#define _XT_CONNLIMIT_H
3 3
4#include <linux/types.h>
5
4struct xt_connlimit_data; 6struct xt_connlimit_data;
5 7
8enum {
9 XT_CONNLIMIT_INVERT = 1 << 0,
10 XT_CONNLIMIT_DADDR = 1 << 1,
11};
12
6struct xt_connlimit_info { 13struct xt_connlimit_info {
7 union { 14 union {
8 union nf_inet_addr mask; 15 union nf_inet_addr mask;
@@ -13,7 +20,14 @@ struct xt_connlimit_info {
13 }; 20 };
14#endif 21#endif
15 }; 22 };
16 unsigned int limit, inverse; 23 unsigned int limit;
24 union {
25 /* revision 0 */
26 unsigned int inverse;
27
28 /* revision 1 */
29 __u32 flags;
30 };
17 31
18 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
19 struct xt_connlimit_data *data __attribute__((aligned(8))); 33 struct xt_connlimit_data *data __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 54f47a2f6152..74b904d8f99c 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -58,4 +58,19 @@ struct xt_conntrack_mtinfo2 {
58 __u16 state_mask, status_mask; 58 __u16 state_mask, status_mask;
59}; 59};
60 60
61struct xt_conntrack_mtinfo3 {
62 union nf_inet_addr origsrc_addr, origsrc_mask;
63 union nf_inet_addr origdst_addr, origdst_mask;
64 union nf_inet_addr replsrc_addr, replsrc_mask;
65 union nf_inet_addr repldst_addr, repldst_mask;
66 __u32 expires_min, expires_max;
67 __u16 l4proto;
68 __u16 origsrc_port, origdst_port;
69 __u16 replsrc_port, repldst_port;
70 __u16 match_flags, invert_flags;
71 __u16 state_mask, status_mask;
72 __u16 origsrc_port_high, origdst_port_high;
73 __u16 replsrc_port_high, repldst_port_high;
74};
75
61#endif /*_XT_CONNTRACK_H*/ 76#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/linux/netfilter/xt_devgroup.h
new file mode 100644
index 000000000000..1babde0ec900
--- /dev/null
+++ b/include/linux/netfilter/xt_devgroup.h
@@ -0,0 +1,21 @@
1#ifndef _XT_DEVGROUP_H
2#define _XT_DEVGROUP_H
3
4#include <linux/types.h>
5
6enum xt_devgroup_flags {
7 XT_DEVGROUP_MATCH_SRC = 0x1,
8 XT_DEVGROUP_INVERT_SRC = 0x2,
9 XT_DEVGROUP_MATCH_DST = 0x4,
10 XT_DEVGROUP_INVERT_DST = 0x8,
11};
12
13struct xt_devgroup_info {
14 __u32 flags;
15 __u32 src_group;
16 __u32 src_mask;
17 __u32 dst_group;
18 __u32 dst_mask;
19};
20
21#endif /* _XT_DEVGROUP_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index b0d28c659ab7..9314723f39ca 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -1,6 +1,8 @@
1#ifndef _XT_QUOTA_H 1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H 2#define _XT_QUOTA_H
3 3
4#include <linux/types.h>
5
4enum xt_quota_flags { 6enum xt_quota_flags {
5 XT_QUOTA_INVERT = 0x1, 7 XT_QUOTA_INVERT = 0x1,
6}; 8};
@@ -9,9 +11,9 @@ enum xt_quota_flags {
9struct xt_quota_priv; 11struct xt_quota_priv;
10 12
11struct xt_quota_info { 13struct xt_quota_info {
12 u_int32_t flags; 14 __u32 flags;
13 u_int32_t pad; 15 __u32 pad;
14 aligned_u64 quota; 16 __aligned_u64 quota;
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 struct xt_quota_priv *master; 19 struct xt_quota_priv *master;
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
new file mode 100644
index 000000000000..081f1ded2842
--- /dev/null
+++ b/include/linux/netfilter/xt_set.h
@@ -0,0 +1,56 @@
1#ifndef _XT_SET_H
2#define _XT_SET_H
3
4#include <linux/types.h>
5#include <linux/netfilter/ipset/ip_set.h>
6
7/* Revision 0 interface: backward compatible with netfilter/iptables */
8
9/*
10 * Option flags for kernel operations (xt_set_info_v0)
11 */
12#define IPSET_SRC 0x01 /* Source match/add */
13#define IPSET_DST 0x02 /* Destination match/add */
14#define IPSET_MATCH_INV 0x04 /* Inverse matching */
15
16struct xt_set_info_v0 {
17 ip_set_id_t index;
18 union {
19 __u32 flags[IPSET_DIM_MAX + 1];
20 struct {
21 __u32 __flags[IPSET_DIM_MAX];
22 __u8 dim;
23 __u8 flags;
24 } compat;
25 } u;
26};
27
28/* match and target infos */
29struct xt_set_info_match_v0 {
30 struct xt_set_info_v0 match_set;
31};
32
33struct xt_set_info_target_v0 {
34 struct xt_set_info_v0 add_set;
35 struct xt_set_info_v0 del_set;
36};
37
38/* Revision 1: current interface to netfilter/iptables */
39
40struct xt_set_info {
41 ip_set_id_t index;
42 __u8 dim;
43 __u8 flags;
44};
45
46/* match and target infos */
47struct xt_set_info_match {
48 struct xt_set_info match_set;
49};
50
51struct xt_set_info_target {
52 struct xt_set_info add_set;
53 struct xt_set_info del_set;
54};
55
56#endif /*_XT_SET_H*/
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 6f475b8ff34b..26d7217bd4f1 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SOCKET_H 1#ifndef _XT_SOCKET_H
2#define _XT_SOCKET_H 2#define _XT_SOCKET_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_SOCKET_TRANSPARENT = 1 << 0, 7 XT_SOCKET_TRANSPARENT = 1 << 0,
6}; 8};
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
index 14b6df412c9f..7c37fac576c4 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/linux/netfilter/xt_time.h
@@ -1,14 +1,16 @@
1#ifndef _XT_TIME_H 1#ifndef _XT_TIME_H
2#define _XT_TIME_H 1 2#define _XT_TIME_H 1
3 3
4#include <linux/types.h>
5
4struct xt_time_info { 6struct xt_time_info {
5 u_int32_t date_start; 7 __u32 date_start;
6 u_int32_t date_stop; 8 __u32 date_stop;
7 u_int32_t daytime_start; 9 __u32 daytime_start;
8 u_int32_t daytime_stop; 10 __u32 daytime_stop;
9 u_int32_t monthdays_match; 11 __u32 monthdays_match;
10 u_int8_t weekdays_match; 12 __u8 weekdays_match;
11 u_int8_t flags; 13 __u8 flags;
12}; 14};
13 15
14enum { 16enum {
diff --git a/include/linux/netfilter/xt_u32.h b/include/linux/netfilter/xt_u32.h
index 9947f56cdbdd..04d1bfea03c2 100644
--- a/include/linux/netfilter/xt_u32.h
+++ b/include/linux/netfilter/xt_u32.h
@@ -1,6 +1,8 @@
1#ifndef _XT_U32_H 1#ifndef _XT_U32_H
2#define _XT_U32_H 1 2#define _XT_U32_H 1
3 3
4#include <linux/types.h>
5
4enum xt_u32_ops { 6enum xt_u32_ops {
5 XT_U32_AND, 7 XT_U32_AND,
6 XT_U32_LEFTSH, 8 XT_U32_LEFTSH,
@@ -9,13 +11,13 @@ enum xt_u32_ops {
9}; 11};
10 12
11struct xt_u32_location_element { 13struct xt_u32_location_element {
12 u_int32_t number; 14 __u32 number;
13 u_int8_t nextop; 15 __u8 nextop;
14}; 16};
15 17
16struct xt_u32_value_element { 18struct xt_u32_value_element {
17 u_int32_t min; 19 __u32 min;
18 u_int32_t max; 20 __u32 max;
19}; 21};
20 22
21/* 23/*
@@ -27,14 +29,14 @@ struct xt_u32_value_element {
27struct xt_u32_test { 29struct xt_u32_test {
28 struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; 30 struct xt_u32_location_element location[XT_U32_MAXSIZE+1];
29 struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; 31 struct xt_u32_value_element value[XT_U32_MAXSIZE+1];
30 u_int8_t nnums; 32 __u8 nnums;
31 u_int8_t nvalues; 33 __u8 nvalues;
32}; 34};
33 35
34struct xt_u32 { 36struct xt_u32 {
35 struct xt_u32_test tests[XT_U32_MAXSIZE+1]; 37 struct xt_u32_test tests[XT_U32_MAXSIZE+1];
36 u_int8_t ntests; 38 __u8 ntests;
37 u_int8_t invert; 39 __u8 invert;
38}; 40};
39 41
40#endif /* _XT_U32_H */ 42#endif /* _XT_U32_H */
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index c73ef0b18bdc..be5be1577a56 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_802_3_H 1#ifndef __LINUX_BRIDGE_EBT_802_3_H
2#define __LINUX_BRIDGE_EBT_802_3_H 2#define __LINUX_BRIDGE_EBT_802_3_H
3 3
4#include <linux/types.h>
5
4#define EBT_802_3_SAP 0x01 6#define EBT_802_3_SAP 0x01
5#define EBT_802_3_TYPE 0x02 7#define EBT_802_3_TYPE 0x02
6 8
@@ -24,24 +26,24 @@
24 26
25/* ui has one byte ctrl, ni has two */ 27/* ui has one byte ctrl, ni has two */
26struct hdr_ui { 28struct hdr_ui {
27 uint8_t dsap; 29 __u8 dsap;
28 uint8_t ssap; 30 __u8 ssap;
29 uint8_t ctrl; 31 __u8 ctrl;
30 uint8_t orig[3]; 32 __u8 orig[3];
31 __be16 type; 33 __be16 type;
32}; 34};
33 35
34struct hdr_ni { 36struct hdr_ni {
35 uint8_t dsap; 37 __u8 dsap;
36 uint8_t ssap; 38 __u8 ssap;
37 __be16 ctrl; 39 __be16 ctrl;
38 uint8_t orig[3]; 40 __u8 orig[3];
39 __be16 type; 41 __be16 type;
40}; 42};
41 43
42struct ebt_802_3_hdr { 44struct ebt_802_3_hdr {
43 uint8_t daddr[6]; 45 __u8 daddr[6];
44 uint8_t saddr[6]; 46 __u8 saddr[6];
45 __be16 len; 47 __be16 len;
46 union { 48 union {
47 struct hdr_ui ui; 49 struct hdr_ui ui;
@@ -59,10 +61,10 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
59#endif 61#endif
60 62
61struct ebt_802_3_info { 63struct ebt_802_3_info {
62 uint8_t sap; 64 __u8 sap;
63 __be16 type; 65 __be16 type;
64 uint8_t bitmask; 66 __u8 bitmask;
65 uint8_t invflags; 67 __u8 invflags;
66}; 68};
67 69
68#endif 70#endif
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
index 0009558609a7..bd4e3ad0b706 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_AMONG_H 1#ifndef __LINUX_BRIDGE_EBT_AMONG_H
2#define __LINUX_BRIDGE_EBT_AMONG_H 2#define __LINUX_BRIDGE_EBT_AMONG_H
3 3
4#include <linux/types.h>
5
4#define EBT_AMONG_DST 0x01 6#define EBT_AMONG_DST 0x01
5#define EBT_AMONG_SRC 0x02 7#define EBT_AMONG_SRC 0x02
6 8
@@ -30,7 +32,7 @@
30 */ 32 */
31 33
32struct ebt_mac_wormhash_tuple { 34struct ebt_mac_wormhash_tuple {
33 uint32_t cmp[2]; 35 __u32 cmp[2];
34 __be32 ip; 36 __be32 ip;
35}; 37};
36 38
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index cbf4843b6b0f..522f3e427f49 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_ARP_H 1#ifndef __LINUX_BRIDGE_EBT_ARP_H
2#define __LINUX_BRIDGE_EBT_ARP_H 2#define __LINUX_BRIDGE_EBT_ARP_H
3 3
4#include <linux/types.h>
5
4#define EBT_ARP_OPCODE 0x01 6#define EBT_ARP_OPCODE 0x01
5#define EBT_ARP_HTYPE 0x02 7#define EBT_ARP_HTYPE 0x02
6#define EBT_ARP_PTYPE 0x04 8#define EBT_ARP_PTYPE 0x04
@@ -27,8 +29,8 @@ struct ebt_arp_info
27 unsigned char smmsk[ETH_ALEN]; 29 unsigned char smmsk[ETH_ALEN];
28 unsigned char dmaddr[ETH_ALEN]; 30 unsigned char dmaddr[ETH_ALEN];
29 unsigned char dmmsk[ETH_ALEN]; 31 unsigned char dmmsk[ETH_ALEN];
30 uint8_t bitmask; 32 __u8 bitmask;
31 uint8_t invflags; 33 __u8 invflags;
32}; 34};
33 35
34#endif 36#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
index 6a708fb92241..c4bbc41b0ea4 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_BRIDGE_EBT_IP_H 15#ifndef __LINUX_BRIDGE_EBT_IP_H
16#define __LINUX_BRIDGE_EBT_IP_H 16#define __LINUX_BRIDGE_EBT_IP_H
17 17
18#include <linux/types.h>
19
18#define EBT_IP_SOURCE 0x01 20#define EBT_IP_SOURCE 0x01
19#define EBT_IP_DEST 0x02 21#define EBT_IP_DEST 0x02
20#define EBT_IP_TOS 0x04 22#define EBT_IP_TOS 0x04
@@ -31,12 +33,12 @@ struct ebt_ip_info {
31 __be32 daddr; 33 __be32 daddr;
32 __be32 smsk; 34 __be32 smsk;
33 __be32 dmsk; 35 __be32 dmsk;
34 uint8_t tos; 36 __u8 tos;
35 uint8_t protocol; 37 __u8 protocol;
36 uint8_t bitmask; 38 __u8 bitmask;
37 uint8_t invflags; 39 __u8 invflags;
38 uint16_t sport[2]; 40 __u16 sport[2];
39 uint16_t dport[2]; 41 __u16 dport[2];
40}; 42};
41 43
42#endif 44#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h
index e5de98701519..42b889682721 100644
--- a/include/linux/netfilter_bridge/ebt_ip6.h
+++ b/include/linux/netfilter_bridge/ebt_ip6.h
@@ -12,14 +12,19 @@
12#ifndef __LINUX_BRIDGE_EBT_IP6_H 12#ifndef __LINUX_BRIDGE_EBT_IP6_H
13#define __LINUX_BRIDGE_EBT_IP6_H 13#define __LINUX_BRIDGE_EBT_IP6_H
14 14
15#include <linux/types.h>
16
15#define EBT_IP6_SOURCE 0x01 17#define EBT_IP6_SOURCE 0x01
16#define EBT_IP6_DEST 0x02 18#define EBT_IP6_DEST 0x02
17#define EBT_IP6_TCLASS 0x04 19#define EBT_IP6_TCLASS 0x04
18#define EBT_IP6_PROTO 0x08 20#define EBT_IP6_PROTO 0x08
19#define EBT_IP6_SPORT 0x10 21#define EBT_IP6_SPORT 0x10
20#define EBT_IP6_DPORT 0x20 22#define EBT_IP6_DPORT 0x20
23#define EBT_IP6_ICMP6 0x40
24
21#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ 25#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
22 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT) 26 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
27 EBT_IP6_ICMP6)
23#define EBT_IP6_MATCH "ip6" 28#define EBT_IP6_MATCH "ip6"
24 29
25/* the same values are used for the invflags */ 30/* the same values are used for the invflags */
@@ -28,12 +33,18 @@ struct ebt_ip6_info {
28 struct in6_addr daddr; 33 struct in6_addr daddr;
29 struct in6_addr smsk; 34 struct in6_addr smsk;
30 struct in6_addr dmsk; 35 struct in6_addr dmsk;
31 uint8_t tclass; 36 __u8 tclass;
32 uint8_t protocol; 37 __u8 protocol;
33 uint8_t bitmask; 38 __u8 bitmask;
34 uint8_t invflags; 39 __u8 invflags;
35 uint16_t sport[2]; 40 union {
36 uint16_t dport[2]; 41 __u16 sport[2];
42 __u8 icmpv6_type[2];
43 };
44 union {
45 __u16 dport[2];
46 __u8 icmpv6_code[2];
47 };
37}; 48};
38 49
39#endif 50#endif
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h
index 4bf76b751676..66d80b30ba0e 100644
--- a/include/linux/netfilter_bridge/ebt_limit.h
+++ b/include/linux/netfilter_bridge/ebt_limit.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H 1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H
2#define __LINUX_BRIDGE_EBT_LIMIT_H 2#define __LINUX_BRIDGE_EBT_LIMIT_H
3 3
4#include <linux/types.h>
5
4#define EBT_LIMIT_MATCH "limit" 6#define EBT_LIMIT_MATCH "limit"
5 7
6/* timings are in milliseconds. */ 8/* timings are in milliseconds. */
@@ -10,13 +12,13 @@
10 seconds, or one every 59 hours. */ 12 seconds, or one every 59 hours. */
11 13
12struct ebt_limit_info { 14struct ebt_limit_info {
13 u_int32_t avg; /* Average secs between packets * scale */ 15 __u32 avg; /* Average secs between packets * scale */
14 u_int32_t burst; /* Period multiplier for upper limit. */ 16 __u32 burst; /* Period multiplier for upper limit. */
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 unsigned long prev; 19 unsigned long prev;
18 u_int32_t credit; 20 __u32 credit;
19 u_int32_t credit_cap, cost; 21 __u32 credit_cap, cost;
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h
index cc2cdfb764bc..7e7f1d1fe494 100644
--- a/include/linux/netfilter_bridge/ebt_log.h
+++ b/include/linux/netfilter_bridge/ebt_log.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LOG_H 1#ifndef __LINUX_BRIDGE_EBT_LOG_H
2#define __LINUX_BRIDGE_EBT_LOG_H 2#define __LINUX_BRIDGE_EBT_LOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ 6#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
5#define EBT_LOG_ARP 0x02 7#define EBT_LOG_ARP 0x02
6#define EBT_LOG_NFLOG 0x04 8#define EBT_LOG_NFLOG 0x04
@@ -10,9 +12,9 @@
10#define EBT_LOG_WATCHER "log" 12#define EBT_LOG_WATCHER "log"
11 13
12struct ebt_log_info { 14struct ebt_log_info {
13 uint8_t loglevel; 15 __u8 loglevel;
14 uint8_t prefix[EBT_LOG_PREFIX_SIZE]; 16 __u8 prefix[EBT_LOG_PREFIX_SIZE];
15 uint32_t bitmask; 17 __u32 bitmask;
16}; 18};
17 19
18#endif 20#endif
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h
index 9ceb10ec0ed6..410f9e5a71d4 100644
--- a/include/linux/netfilter_bridge/ebt_mark_m.h
+++ b/include/linux/netfilter_bridge/ebt_mark_m.h
@@ -1,13 +1,15 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H 1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H
2#define __LINUX_BRIDGE_EBT_MARK_M_H 2#define __LINUX_BRIDGE_EBT_MARK_M_H
3 3
4#include <linux/types.h>
5
4#define EBT_MARK_AND 0x01 6#define EBT_MARK_AND 0x01
5#define EBT_MARK_OR 0x02 7#define EBT_MARK_OR 0x02
6#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) 8#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
7struct ebt_mark_m_info { 9struct ebt_mark_m_info {
8 unsigned long mark, mask; 10 unsigned long mark, mask;
9 uint8_t invert; 11 __u8 invert;
10 uint8_t bitmask; 12 __u8 bitmask;
11}; 13};
12#define EBT_MARK_MATCH "mark_m" 14#define EBT_MARK_MATCH "mark_m"
13 15
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
index 052817849b83..df829fce9125 100644
--- a/include/linux/netfilter_bridge/ebt_nflog.h
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H 1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H 2#define __LINUX_BRIDGE_EBT_NFLOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_NFLOG_MASK 0x0 6#define EBT_NFLOG_MASK 0x0
5 7
6#define EBT_NFLOG_PREFIX_SIZE 64 8#define EBT_NFLOG_PREFIX_SIZE 64
@@ -10,11 +12,11 @@
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1 12#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11 13
12struct ebt_nflog_info { 14struct ebt_nflog_info {
13 u_int32_t len; 15 __u32 len;
14 u_int16_t group; 16 __u16 group;
15 u_int16_t threshold; 17 __u16 threshold;
16 u_int16_t flags; 18 __u16 flags;
17 u_int16_t pad; 19 __u16 pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE]; 20 char prefix[EBT_NFLOG_PREFIX_SIZE];
19}; 21};
20 22
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h
index 51a799840931..c241badcd036 100644
--- a/include/linux/netfilter_bridge/ebt_pkttype.h
+++ b/include/linux/netfilter_bridge/ebt_pkttype.h
@@ -1,9 +1,11 @@
1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H 1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
2#define __LINUX_BRIDGE_EBT_PKTTYPE_H 2#define __LINUX_BRIDGE_EBT_PKTTYPE_H
3 3
4#include <linux/types.h>
5
4struct ebt_pkttype_info { 6struct ebt_pkttype_info {
5 uint8_t pkt_type; 7 __u8 pkt_type;
6 uint8_t invert; 8 __u8 invert;
7}; 9};
8#define EBT_PKTTYPE_MATCH "pkttype" 10#define EBT_PKTTYPE_MATCH "pkttype"
9 11
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h
index e503a0aa2728..1025b9f5fb7d 100644
--- a/include/linux/netfilter_bridge/ebt_stp.h
+++ b/include/linux/netfilter_bridge/ebt_stp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_STP_H 1#ifndef __LINUX_BRIDGE_EBT_STP_H
2#define __LINUX_BRIDGE_EBT_STP_H 2#define __LINUX_BRIDGE_EBT_STP_H
3 3
4#include <linux/types.h>
5
4#define EBT_STP_TYPE 0x0001 6#define EBT_STP_TYPE 0x0001
5 7
6#define EBT_STP_FLAGS 0x0002 8#define EBT_STP_FLAGS 0x0002
@@ -21,24 +23,24 @@
21#define EBT_STP_MATCH "stp" 23#define EBT_STP_MATCH "stp"
22 24
23struct ebt_stp_config_info { 25struct ebt_stp_config_info {
24 uint8_t flags; 26 __u8 flags;
25 uint16_t root_priol, root_priou; 27 __u16 root_priol, root_priou;
26 char root_addr[6], root_addrmsk[6]; 28 char root_addr[6], root_addrmsk[6];
27 uint32_t root_costl, root_costu; 29 __u32 root_costl, root_costu;
28 uint16_t sender_priol, sender_priou; 30 __u16 sender_priol, sender_priou;
29 char sender_addr[6], sender_addrmsk[6]; 31 char sender_addr[6], sender_addrmsk[6];
30 uint16_t portl, portu; 32 __u16 portl, portu;
31 uint16_t msg_agel, msg_ageu; 33 __u16 msg_agel, msg_ageu;
32 uint16_t max_agel, max_ageu; 34 __u16 max_agel, max_ageu;
33 uint16_t hello_timel, hello_timeu; 35 __u16 hello_timel, hello_timeu;
34 uint16_t forward_delayl, forward_delayu; 36 __u16 forward_delayl, forward_delayu;
35}; 37};
36 38
37struct ebt_stp_info { 39struct ebt_stp_info {
38 uint8_t type; 40 __u8 type;
39 struct ebt_stp_config_info config; 41 struct ebt_stp_config_info config;
40 uint16_t bitmask; 42 __u16 bitmask;
41 uint16_t invflags; 43 __u16 invflags;
42}; 44};
43 45
44#endif 46#endif
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h
index b677e2671541..89a6becb5269 100644
--- a/include/linux/netfilter_bridge/ebt_ulog.h
+++ b/include/linux/netfilter_bridge/ebt_ulog.h
@@ -1,6 +1,8 @@
1#ifndef _EBT_ULOG_H 1#ifndef _EBT_ULOG_H
2#define _EBT_ULOG_H 2#define _EBT_ULOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_ULOG_DEFAULT_NLGROUP 0 6#define EBT_ULOG_DEFAULT_NLGROUP 0
5#define EBT_ULOG_DEFAULT_QTHRESHOLD 1 7#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
6#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ 8#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
@@ -10,7 +12,7 @@
10#define EBT_ULOG_VERSION 1 12#define EBT_ULOG_VERSION 1
11 13
12struct ebt_ulog_info { 14struct ebt_ulog_info {
13 uint32_t nlgroup; 15 __u32 nlgroup;
14 unsigned int cprange; 16 unsigned int cprange;
15 unsigned int qthreshold; 17 unsigned int qthreshold;
16 char prefix[EBT_ULOG_PREFIX_LEN]; 18 char prefix[EBT_ULOG_PREFIX_LEN];
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
index 1d98be4031e7..967d1d5cf98d 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_VLAN_H 1#ifndef __LINUX_BRIDGE_EBT_VLAN_H
2#define __LINUX_BRIDGE_EBT_VLAN_H 2#define __LINUX_BRIDGE_EBT_VLAN_H
3 3
4#include <linux/types.h>
5
4#define EBT_VLAN_ID 0x01 6#define EBT_VLAN_ID 0x01
5#define EBT_VLAN_PRIO 0x02 7#define EBT_VLAN_PRIO 0x02
6#define EBT_VLAN_ENCAP 0x04 8#define EBT_VLAN_ENCAP 0x04
@@ -8,12 +10,12 @@
8#define EBT_VLAN_MATCH "vlan" 10#define EBT_VLAN_MATCH "vlan"
9 11
10struct ebt_vlan_info { 12struct ebt_vlan_info {
11 uint16_t id; /* VLAN ID {1-4095} */ 13 __u16 id; /* VLAN ID {1-4095} */
12 uint8_t prio; /* VLAN User Priority {0-7} */ 14 __u8 prio; /* VLAN User Priority {0-7} */
13 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ 15 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, 16 __u8 bitmask; /* Args bitmask bit 1=1 - ID arg,
15 bit 2=1 User-Priority arg, bit 3=1 encap*/ 17 bit 2=1 User-Priority arg, bit 3=1 encap*/
16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, 18 __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
17 bit 2=1 - inversed Pirority arg */ 19 bit 2=1 - inversed Pirority arg */
18}; 20};
19 21
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 1c6f0c5f530e..8797ed16feb2 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -92,7 +92,7 @@ struct ebt_entries {
92 92
93/* This is a hack to make a difference between an ebt_entry struct and an 93/* This is a hack to make a difference between an ebt_entry struct and an
94 * ebt_entries struct when traversing the entries from start to end. 94 * ebt_entries struct when traversing the entries from start to end.
95 * Using this simplifies the code alot, while still being able to use 95 * Using this simplifies the code a lot, while still being able to use
96 * ebt_entries. 96 * ebt_entries.
97 * Contrary, iptables doesn't use something like ebt_entries and therefore uses 97 * Contrary, iptables doesn't use something like ebt_entries and therefore uses
98 * different techniques for naming the policy and such. So, iptables doesn't 98 * different techniques for naming the policy and such. So, iptables doesn't
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index e5a3687c8a72..c6a204c97047 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_CLUSTERIP_H_target 1#ifndef _IPT_CLUSTERIP_H_target
2#define _IPT_CLUSTERIP_H_target 2#define _IPT_CLUSTERIP_H_target
3 3
4#include <linux/types.h>
5
4enum clusterip_hashmode { 6enum clusterip_hashmode {
5 CLUSTERIP_HASHMODE_SIP = 0, 7 CLUSTERIP_HASHMODE_SIP = 0,
6 CLUSTERIP_HASHMODE_SIP_SPT, 8 CLUSTERIP_HASHMODE_SIP_SPT,
@@ -17,15 +19,15 @@ struct clusterip_config;
17 19
18struct ipt_clusterip_tgt_info { 20struct ipt_clusterip_tgt_info {
19 21
20 u_int32_t flags; 22 __u32 flags;
21 23
22 /* only relevant for new ones */ 24 /* only relevant for new ones */
23 u_int8_t clustermac[6]; 25 __u8 clustermac[6];
24 u_int16_t num_total_nodes; 26 __u16 num_total_nodes;
25 u_int16_t num_local_nodes; 27 __u16 num_local_nodes;
26 u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; 28 __u16 local_nodes[CLUSTERIP_MAX_NODES];
27 u_int32_t hash_mode; 29 __u32 hash_mode;
28 u_int32_t hash_initval; 30 __u32 hash_initval;
29 31
30 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
31 struct clusterip_config *config; 33 struct clusterip_config *config;
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h
index 7ca45918ab8e..bb88d5315a4d 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,6 +8,8 @@
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
12#include <linux/types.h>
11#include <linux/netfilter/xt_DSCP.h> 13#include <linux/netfilter/xt_DSCP.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -19,11 +21,11 @@
19#define IPT_ECN_OP_MASK 0xce 21#define IPT_ECN_OP_MASK 0xce
20 22
21struct ipt_ECN_info { 23struct ipt_ECN_info {
22 u_int8_t operation; /* bitset of operations */ 24 __u8 operation; /* bitset of operations */
23 u_int8_t ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ 25 __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */
24 union { 26 union {
25 struct { 27 struct {
26 u_int8_t ece:1, cwr:1; /* TCP ECT bits */ 28 __u8 ece:1, cwr:1; /* TCP ECT bits */
27 } tcp; 29 } tcp;
28 } proto; 30 } proto;
29}; 31};
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index 2529660c5b38..5bca78267afd 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -1,15 +1,17 @@
1#ifndef _IPT_SAME_H 1#ifndef _IPT_SAME_H
2#define _IPT_SAME_H 2#define _IPT_SAME_H
3 3
4#include <linux/types.h>
5
4#define IPT_SAME_MAX_RANGE 10 6#define IPT_SAME_MAX_RANGE 10
5 7
6#define IPT_SAME_NODST 0x01 8#define IPT_SAME_NODST 0x01
7 9
8struct ipt_same_info { 10struct ipt_same_info {
9 unsigned char info; 11 unsigned char info;
10 u_int32_t rangesize; 12 __u32 rangesize;
11 u_int32_t ipnum; 13 __u32 ipnum;
12 u_int32_t *iparray; 14 __u32 *iparray;
13 15
14 /* hangs off end. */ 16 /* hangs off end. */
15 struct nf_nat_range range[IPT_SAME_MAX_RANGE]; 17 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h
index ee6611edc112..f6ac169d92f9 100644
--- a/include/linux/netfilter_ipv4/ipt_TTL.h
+++ b/include/linux/netfilter_ipv4/ipt_TTL.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_SET = 0, 10 IPT_TTL_SET = 0,
9 IPT_TTL_INC, 11 IPT_TTL_INC,
@@ -13,8 +15,8 @@ enum {
13#define IPT_TTL_MAXMODE IPT_TTL_DEC 15#define IPT_TTL_MAXMODE IPT_TTL_DEC
14 16
15struct ipt_TTL_info { 17struct ipt_TTL_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h
index 446de6aef983..0da42237c8da 100644
--- a/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_ADDRTYPE_H 1#ifndef _IPT_ADDRTYPE_H
2#define _IPT_ADDRTYPE_H 2#define _IPT_ADDRTYPE_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, 7 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001,
6 IPT_ADDRTYPE_INVERT_DEST = 0x0002, 8 IPT_ADDRTYPE_INVERT_DEST = 0x0002,
@@ -9,17 +11,17 @@ enum {
9}; 11};
10 12
11struct ipt_addrtype_info_v1 { 13struct ipt_addrtype_info_v1 {
12 u_int16_t source; /* source-type mask */ 14 __u16 source; /* source-type mask */
13 u_int16_t dest; /* dest-type mask */ 15 __u16 dest; /* dest-type mask */
14 u_int32_t flags; 16 __u32 flags;
15}; 17};
16 18
17/* revision 0 */ 19/* revision 0 */
18struct ipt_addrtype_info { 20struct ipt_addrtype_info {
19 u_int16_t source; /* source-type mask */ 21 __u16 source; /* source-type mask */
20 u_int16_t dest; /* dest-type mask */ 22 __u16 dest; /* dest-type mask */
21 u_int32_t invert_source; 23 __u32 invert_source;
22 u_int32_t invert_dest; 24 __u32 invert_dest;
23}; 25};
24 26
25#endif 27#endif
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h
index 2e555b4d05e3..4e02bb0119e3 100644
--- a/include/linux/netfilter_ipv4/ipt_ah.h
+++ b/include/linux/netfilter_ipv4/ipt_ah.h
@@ -1,9 +1,11 @@
1#ifndef _IPT_AH_H 1#ifndef _IPT_AH_H
2#define _IPT_AH_H 2#define _IPT_AH_H
3 3
4#include <linux/types.h>
5
4struct ipt_ah { 6struct ipt_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int8_t invflags; /* Inverse flags */ 8 __u8 invflags; /* Inverse flags */
7}; 9};
8 10
9 11
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index 9945baa4ccd7..eabf95fb7d3e 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -8,6 +8,8 @@
8*/ 8*/
9#ifndef _IPT_ECN_H 9#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 10#define _IPT_ECN_H
11
12#include <linux/types.h>
11#include <linux/netfilter/xt_dscp.h> 13#include <linux/netfilter/xt_dscp.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -20,12 +22,12 @@
20 22
21/* match info */ 23/* match info */
22struct ipt_ecn_info { 24struct ipt_ecn_info {
23 u_int8_t operation; 25 __u8 operation;
24 u_int8_t invert; 26 __u8 invert;
25 u_int8_t ip_ect; 27 __u8 ip_ect;
26 union { 28 union {
27 struct { 29 struct {
28 u_int8_t ect; 30 __u8 ect;
29 } tcp; 31 } tcp;
30 } proto; 32 } proto;
31}; 33};
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/linux/netfilter_ipv4/ipt_ttl.h
index ee24fd86a3aa..37bee4442486 100644
--- a/include/linux/netfilter_ipv4/ipt_ttl.h
+++ b/include/linux/netfilter_ipv4/ipt_ttl.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_EQ = 0, /* equals */ 10 IPT_TTL_EQ = 0, /* equals */
9 IPT_TTL_NE, /* not equals */ 11 IPT_TTL_NE, /* not equals */
@@ -13,8 +15,8 @@ enum {
13 15
14 16
15struct ipt_ttl_info { 17struct ipt_ttl_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h
index afb7813d45ab..ebd8ead1bb63 100644
--- a/include/linux/netfilter_ipv6/ip6t_HL.h
+++ b/include/linux/netfilter_ipv6/ip6t_HL.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_SET = 0, 11 IP6T_HL_SET = 0,
10 IP6T_HL_INC, 12 IP6T_HL_INC,
@@ -14,8 +16,8 @@ enum {
14#define IP6T_HL_MAXMODE IP6T_HL_DEC 16#define IP6T_HL_MAXMODE IP6T_HL_DEC
15 17
16struct ip6t_HL_info { 18struct ip6t_HL_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h
index 6be6504162bb..205ed62e4605 100644
--- a/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_REJECT_H 1#ifndef _IP6T_REJECT_H
2#define _IP6T_REJECT_H 2#define _IP6T_REJECT_H
3 3
4#include <linux/types.h>
5
4enum ip6t_reject_with { 6enum ip6t_reject_with {
5 IP6T_ICMP6_NO_ROUTE, 7 IP6T_ICMP6_NO_ROUTE,
6 IP6T_ICMP6_ADM_PROHIBITED, 8 IP6T_ICMP6_ADM_PROHIBITED,
@@ -12,7 +14,7 @@ enum ip6t_reject_with {
12}; 14};
13 15
14struct ip6t_reject_info { 16struct ip6t_reject_info {
15 u_int32_t with; /* reject type */ 17 __u32 with; /* reject type */
16}; 18};
17 19
18#endif /*_IP6T_REJECT_H*/ 20#endif /*_IP6T_REJECT_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h
index 17a745cfb2c7..5da2b65cb3ad 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_AH_H 1#ifndef _IP6T_AH_H
2#define _IP6T_AH_H 2#define _IP6T_AH_H
3 3
4#include <linux/types.h>
5
4struct ip6t_ah { 6struct ip6t_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t hdrres; /* Test of the Reserved Filed */ 9 __u8 hdrres; /* Test of the Reserved Filed */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_AH_SPI 0x01 13#define IP6T_AH_SPI 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h
index 3724d0850920..b47f61b9e082 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_FRAG_H 1#ifndef _IP6T_FRAG_H
2#define _IP6T_FRAG_H 2#define _IP6T_FRAG_H
3 3
4#include <linux/types.h>
5
4struct ip6t_frag { 6struct ip6t_frag {
5 u_int32_t ids[2]; /* Security Parameter Index */ 7 __u32 ids[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t flags; /* */ 9 __u8 flags; /* */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_FRAG_IDS 0x01 13#define IP6T_FRAG_IDS 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/linux/netfilter_ipv6/ip6t_hl.h
index 5ef91b8319a8..6e76dbc6c19a 100644
--- a/include/linux/netfilter_ipv6/ip6t_hl.h
+++ b/include/linux/netfilter_ipv6/ip6t_hl.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_EQ = 0, /* equals */ 11 IP6T_HL_EQ = 0, /* equals */
10 IP6T_HL_NE, /* not equals */ 12 IP6T_HL_NE, /* not equals */
@@ -14,8 +16,8 @@ enum {
14 16
15 17
16struct ip6t_hl_info { 18struct ip6t_hl_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
index 01dfd445596a..efae3a20c214 100644
--- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
@@ -8,10 +8,12 @@ on whether they contain certain headers */
8#ifndef __IPV6HEADER_H 8#ifndef __IPV6HEADER_H
9#define __IPV6HEADER_H 9#define __IPV6HEADER_H
10 10
11#include <linux/types.h>
12
11struct ip6t_ipv6header_info { 13struct ip6t_ipv6header_info {
12 u_int8_t matchflags; 14 __u8 matchflags;
13 u_int8_t invflags; 15 __u8 invflags;
14 u_int8_t modeflag; 16 __u8 modeflag;
15}; 17};
16 18
17#define MASK_HOPOPTS 128 19#define MASK_HOPOPTS 128
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h
index 18549bca2d1f..a7729a5025cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_mh.h
+++ b/include/linux/netfilter_ipv6/ip6t_mh.h
@@ -1,10 +1,12 @@
1#ifndef _IP6T_MH_H 1#ifndef _IP6T_MH_H
2#define _IP6T_MH_H 2#define _IP6T_MH_H
3 3
4#include <linux/types.h>
5
4/* MH matching stuff */ 6/* MH matching stuff */
5struct ip6t_mh { 7struct ip6t_mh {
6 u_int8_t types[2]; /* MH type range */ 8 __u8 types[2]; /* MH type range */
7 u_int8_t invflags; /* Inverse flags */ 9 __u8 invflags; /* Inverse flags */
8}; 10};
9 11
10/* Values for "invflags" field in struct ip6t_mh. */ 12/* Values for "invflags" field in struct ip6t_mh. */
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h
index 62d89bcd9f9c..17d419a811fd 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -1,14 +1,16 @@
1#ifndef _IP6T_OPTS_H 1#ifndef _IP6T_OPTS_H
2#define _IP6T_OPTS_H 2#define _IP6T_OPTS_H
3 3
4#include <linux/types.h>
5
4#define IP6T_OPTS_OPTSNR 16 6#define IP6T_OPTS_OPTSNR 16
5 7
6struct ip6t_opts { 8struct ip6t_opts {
7 u_int32_t hdrlen; /* Header Length */ 9 __u32 hdrlen; /* Header Length */
8 u_int8_t flags; /* */ 10 __u8 flags; /* */
9 u_int8_t invflags; /* Inverse flags */ 11 __u8 invflags; /* Inverse flags */
10 u_int16_t opts[IP6T_OPTS_OPTSNR]; /* opts */ 12 __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */
11 u_int8_t optsnr; /* Nr of OPts */ 13 __u8 optsnr; /* Nr of OPts */
12}; 14};
13 15
14#define IP6T_OPTS_LEN 0x01 16#define IP6T_OPTS_LEN 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h
index ab91bfd2cd00..7605a5ff81cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -1,18 +1,19 @@
1#ifndef _IP6T_RT_H 1#ifndef _IP6T_RT_H
2#define _IP6T_RT_H 2#define _IP6T_RT_H
3 3
4#include <linux/types.h>
4/*#include <linux/in6.h>*/ 5/*#include <linux/in6.h>*/
5 6
6#define IP6T_RT_HOPS 16 7#define IP6T_RT_HOPS 16
7 8
8struct ip6t_rt { 9struct ip6t_rt {
9 u_int32_t rt_type; /* Routing Type */ 10 __u32 rt_type; /* Routing Type */
10 u_int32_t segsleft[2]; /* Segments Left */ 11 __u32 segsleft[2]; /* Segments Left */
11 u_int32_t hdrlen; /* Header Length */ 12 __u32 hdrlen; /* Header Length */
12 u_int8_t flags; /* */ 13 __u8 flags; /* */
13 u_int8_t invflags; /* Inverse flags */ 14 __u8 invflags; /* Inverse flags */
14 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ 15 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */
15 u_int8_t addrnr; /* Nr of Addresses */ 16 __u8 addrnr; /* Nr of Addresses */
16}; 17};
17 18
18#define IP6T_RT_TYP 0x01 19#define IP6T_RT_TYP 0x01
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 123566912d73..4c4ac3f3ce5a 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -70,7 +70,7 @@ struct nlmsghdr {
70 Check NLM_F_EXCL 70 Check NLM_F_EXCL
71 */ 71 */
72 72
73#define NLMSG_ALIGNTO 4 73#define NLMSG_ALIGNTO 4U
74#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) 74#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
75#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) 75#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
76#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) 76#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
@@ -160,10 +160,6 @@ struct netlink_skb_parms {
160 struct ucred creds; /* Skb credentials */ 160 struct ucred creds; /* Skb credentials */
161 __u32 pid; 161 __u32 pid;
162 __u32 dst_group; 162 __u32 dst_group;
163 kernel_cap_t eff_cap;
164 __u32 loginuid; /* Login (audit) uid */
165 __u32 sessionid; /* Session id (audit) */
166 __u32 sid; /* SELinux security id */
167}; 163};
168 164
169#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 165#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
new file mode 100644
index 000000000000..7ab8521f2347
--- /dev/null
+++ b/include/linux/nfc/pn544.h
@@ -0,0 +1,97 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _PN544_H_
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28#define PN544_DRIVER_NAME "pn544"
29#define PN544_MAXWINDOW_SIZE 7
30#define PN544_WINDOW_SIZE 4
31#define PN544_RETRIES 10
32#define PN544_MAX_I2C_TRANSFER 0x0400
33#define PN544_MSG_MAX_SIZE 0x21 /* at normal HCI mode */
34
35/* ioctl */
36#define PN544_CHAR_BASE 'P'
37#define PN544_IOR(num, dtype) _IOR(PN544_CHAR_BASE, num, dtype)
38#define PN544_IOW(num, dtype) _IOW(PN544_CHAR_BASE, num, dtype)
39#define PN544_GET_FW_MODE PN544_IOW(1, unsigned int)
40#define PN544_SET_FW_MODE PN544_IOW(2, unsigned int)
41#define PN544_GET_DEBUG PN544_IOW(3, unsigned int)
42#define PN544_SET_DEBUG PN544_IOW(4, unsigned int)
43
44/* Timing restrictions (ms) */
45#define PN544_RESETVEN_TIME 30 /* 7 */
46#define PN544_PVDDVEN_TIME 0
47#define PN544_VBATVEN_TIME 0
48#define PN544_GPIO4VEN_TIME 0
49#define PN544_WAKEUP_ACK 5
50#define PN544_WAKEUP_GUARD (PN544_WAKEUP_ACK + 1)
51#define PN544_INACTIVITY_TIME 1000
52#define PN544_INTERFRAME_DELAY 200 /* us */
53#define PN544_BAUDRATE_CHANGE 150 /* us */
54
55/* Debug bits */
56#define PN544_DEBUG_BUF 0x01
57#define PN544_DEBUG_READ 0x02
58#define PN544_DEBUG_WRITE 0x04
59#define PN544_DEBUG_IRQ 0x08
60#define PN544_DEBUG_CALLS 0x10
61#define PN544_DEBUG_MODE 0x20
62
63/* Normal (HCI) mode */
64#define PN544_LLC_HCI_OVERHEAD 3 /* header + crc (to length) */
65#define PN544_LLC_MIN_SIZE (1 + PN544_LLC_HCI_OVERHEAD) /* length + */
66#define PN544_LLC_MAX_DATA (PN544_MSG_MAX_SIZE - 2)
67#define PN544_LLC_MAX_HCI_SIZE (PN544_LLC_MAX_DATA - 2)
68
69struct pn544_llc_packet {
70 unsigned char length; /* of rest of packet */
71 unsigned char header;
72 unsigned char data[PN544_LLC_MAX_DATA]; /* includes crc-ccitt */
73};
74
75/* Firmware upgrade mode */
76#define PN544_FW_HEADER_SIZE 3
77/* max fw transfer is 1024bytes, but I2C limits it to 0xC0 */
78#define PN544_MAX_FW_DATA (PN544_MAX_I2C_TRANSFER - PN544_FW_HEADER_SIZE)
79
80struct pn544_fw_packet {
81 unsigned char command; /* status in answer */
82 unsigned char length[2]; /* big-endian order (msf) */
83 unsigned char data[PN544_MAX_FW_DATA];
84};
85
86#ifdef __KERNEL__
87/* board config */
88struct pn544_nfc_platform_data {
89 int (*request_resources) (struct i2c_client *client);
90 void (*free_resources) (void);
91 void (*enable) (int fw);
92 int (*test) (void);
93 void (*disable) (void);
94};
95#endif /* __KERNEL__ */
96
97#endif /* _PN544_H_ */
diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h
index ac33806ec7f9..6ccfe3b641e1 100644
--- a/include/linux/nfs3.h
+++ b/include/linux/nfs3.h
@@ -11,6 +11,9 @@
11#define NFS3_MAXGROUPS 16 11#define NFS3_MAXGROUPS 16
12#define NFS3_FHSIZE 64 12#define NFS3_FHSIZE 64
13#define NFS3_COOKIESIZE 4 13#define NFS3_COOKIESIZE 4
14#define NFS3_CREATEVERFSIZE 8
15#define NFS3_COOKIEVERFSIZE 8
16#define NFS3_WRITEVERFSIZE 8
14#define NFS3_FIFO_DEV (-1) 17#define NFS3_FIFO_DEV (-1)
15#define NFS3MODE_FMT 0170000 18#define NFS3MODE_FMT 0170000
16#define NFS3MODE_DIR 0040000 19#define NFS3MODE_DIR 0040000
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 07e40c625972..178fafe0ff93 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -17,7 +17,9 @@
17 17
18#define NFS4_BITMAP_SIZE 2 18#define NFS4_BITMAP_SIZE 2
19#define NFS4_VERIFIER_SIZE 8 19#define NFS4_VERIFIER_SIZE 8
20#define NFS4_STATEID_SIZE 16 20#define NFS4_STATEID_SEQID_SIZE 4
21#define NFS4_STATEID_OTHER_SIZE 12
22#define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
21#define NFS4_FHSIZE 128 23#define NFS4_FHSIZE 128
22#define NFS4_MAXPATHLEN PATH_MAX 24#define NFS4_MAXPATHLEN PATH_MAX
23#define NFS4_MAXNAMLEN NAME_MAX 25#define NFS4_MAXNAMLEN NAME_MAX
@@ -61,6 +63,12 @@
61#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 63#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
62#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 64#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
63 65
66#define NFS4_CDFC4_FORE 0x1
67#define NFS4_CDFC4_BACK 0x2
68#define NFS4_CDFC4_BOTH 0x3
69#define NFS4_CDFC4_FORE_OR_BOTH 0x3
70#define NFS4_CDFC4_BACK_OR_BOTH 0x7
71
64#define NFS4_SET_TO_SERVER_TIME 0 72#define NFS4_SET_TO_SERVER_TIME 0
65#define NFS4_SET_TO_CLIENT_TIME 1 73#define NFS4_SET_TO_CLIENT_TIME 1
66 74
@@ -106,9 +114,13 @@
106 114
107#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 115#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
108#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 116#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
117#define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100
118
109#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 119#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
110#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 120#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
111#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 121#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
122#define EXCHGID4_FLAG_MASK_PNFS 0x00070000
123
112#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 124#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
113#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 125#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
114/* 126/*
@@ -116,8 +128,8 @@
116 * they're set in the argument or response, have separate 128 * they're set in the argument or response, have separate
117 * invalid flag masks for arg (_A) and resp (_R). 129 * invalid flag masks for arg (_A) and resp (_R).
118 */ 130 */
119#define EXCHGID4_FLAG_MASK_A 0x40070003 131#define EXCHGID4_FLAG_MASK_A 0x40070103
120#define EXCHGID4_FLAG_MASK_R 0x80070003 132#define EXCHGID4_FLAG_MASK_R 0x80070103
121 133
122#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 134#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
123#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 135#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
@@ -131,6 +143,9 @@
131#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200 143#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200
132#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400 144#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400
133 145
146#define NFS4_SECINFO_STYLE4_CURRENT_FH 0
147#define NFS4_SECINFO_STYLE4_PARENT 1
148
134#define NFS4_MAX_UINT64 (~(u64)0) 149#define NFS4_MAX_UINT64 (~(u64)0)
135 150
136/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations. 151/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
@@ -167,7 +182,16 @@ struct nfs4_acl {
167}; 182};
168 183
169typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 184typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
170typedef struct { char data[NFS4_STATEID_SIZE]; } nfs4_stateid; 185
186struct nfs41_stateid {
187 __be32 seqid;
188 char other[NFS4_STATEID_OTHER_SIZE];
189} __attribute__ ((packed));
190
191typedef union {
192 char data[NFS4_STATEID_SIZE];
193 struct nfs41_stateid stateid;
194} nfs4_stateid;
171 195
172enum nfs_opnum4 { 196enum nfs_opnum4 {
173 OP_ACCESS = 3, 197 OP_ACCESS = 3,
@@ -335,7 +359,7 @@ enum nfsstat4 {
335 /* Error 10073 is unused. */ 359 /* Error 10073 is unused. */
336 NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */ 360 NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */
337 NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ 361 NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */
338 NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */ 362 NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not original */
339 NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */ 363 NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */
340 NFS4ERR_DEADSESSION = 10078, /* persistent session dead */ 364 NFS4ERR_DEADSESSION = 10078, /* persistent session dead */
341 NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */ 365 NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */
@@ -471,6 +495,8 @@ enum lock_type4 {
471#define FATTR4_WORD1_TIME_MODIFY (1UL << 21) 495#define FATTR4_WORD1_TIME_MODIFY (1UL << 21)
472#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22) 496#define FATTR4_WORD1_TIME_MODIFY_SET (1UL << 22)
473#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23) 497#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)
498#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
499#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
474 500
475#define NFSPROC4_NULL 0 501#define NFSPROC4_NULL 0
476#define NFSPROC4_COMPOUND 1 502#define NFSPROC4_COMPOUND 1
@@ -524,6 +550,7 @@ enum {
524 NFSPROC4_CLNT_SETACL, 550 NFSPROC4_CLNT_SETACL,
525 NFSPROC4_CLNT_FS_LOCATIONS, 551 NFSPROC4_CLNT_FS_LOCATIONS,
526 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 552 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
553 NFSPROC4_CLNT_SECINFO,
527 554
528 /* nfs41 */ 555 /* nfs41 */
529 NFSPROC4_CLNT_EXCHANGE_ID, 556 NFSPROC4_CLNT_EXCHANGE_ID,
@@ -532,6 +559,9 @@ enum {
532 NFSPROC4_CLNT_SEQUENCE, 559 NFSPROC4_CLNT_SEQUENCE,
533 NFSPROC4_CLNT_GET_LEASE_TIME, 560 NFSPROC4_CLNT_GET_LEASE_TIME,
534 NFSPROC4_CLNT_RECLAIM_COMPLETE, 561 NFSPROC4_CLNT_RECLAIM_COMPLETE,
562 NFSPROC4_CLNT_LAYOUTGET,
563 NFSPROC4_CLNT_GETDEVICEINFO,
564 NFSPROC4_CLNT_LAYOUTCOMMIT,
535}; 565};
536 566
537/* nfs41 types */ 567/* nfs41 types */
@@ -550,6 +580,49 @@ enum state_protect_how4 {
550 SP4_SSV = 2 580 SP4_SSV = 2
551}; 581};
552 582
583enum pnfs_layouttype {
584 LAYOUT_NFSV4_1_FILES = 1,
585 LAYOUT_OSD2_OBJECTS = 2,
586 LAYOUT_BLOCK_VOLUME = 3,
587};
588
589/* used for both layout return and recall */
590enum pnfs_layoutreturn_type {
591 RETURN_FILE = 1,
592 RETURN_FSID = 2,
593 RETURN_ALL = 3
594};
595
596enum pnfs_iomode {
597 IOMODE_READ = 1,
598 IOMODE_RW = 2,
599 IOMODE_ANY = 3,
600};
601
602enum pnfs_notify_deviceid_type4 {
603 NOTIFY_DEVICEID4_CHANGE = 1 << 1,
604 NOTIFY_DEVICEID4_DELETE = 1 << 2,
605};
606
607#define NFL4_UFLG_MASK 0x0000003F
608#define NFL4_UFLG_DENSE 0x00000001
609#define NFL4_UFLG_COMMIT_THRU_MDS 0x00000002
610#define NFL4_UFLG_STRIPE_UNIT_SIZE_MASK 0xFFFFFFC0
611
612/* Encoded in the loh_body field of type layouthint4 */
613enum filelayout_hint_care4 {
614 NFLH4_CARE_DENSE = NFL4_UFLG_DENSE,
615 NFLH4_CARE_COMMIT_THRU_MDS = NFL4_UFLG_COMMIT_THRU_MDS,
616 NFLH4_CARE_STRIPE_UNIT_SIZE = 0x00000040,
617 NFLH4_CARE_STRIPE_COUNT = 0x00000080
618};
619
620#define NFS4_DEVICEID4_SIZE 16
621
622struct nfs4_deviceid {
623 char data[NFS4_DEVICEID4_SIZE];
624};
625
553#endif 626#endif
554#endif 627#endif
555 628
diff --git a/include/linux/nfs4_acl.h b/include/linux/nfs4_acl.h
deleted file mode 100644
index c9c05a78e9bb..000000000000
--- a/include/linux/nfs4_acl.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * include/linux/nfs4_acl.c
3 *
4 * Common NFSv4 ACL handling definitions.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Marius Aamodt Eriksen <marius@umich.edu>
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef LINUX_NFS4_ACL_H
38#define LINUX_NFS4_ACL_H
39
40#include <linux/posix_acl.h>
41
42/* Maximum ACL we'll accept from client; chosen (somewhat arbitrarily) to
43 * fit in a page: */
44#define NFS4_ACL_MAX 170
45
46struct nfs4_acl *nfs4_acl_new(int);
47int nfs4_acl_get_whotype(char *, u32);
48int nfs4_acl_write_who(int who, char *p);
49int nfs4_acl_permission(struct nfs4_acl *acl, uid_t owner, gid_t group,
50 uid_t who, u32 mask);
51
52#define NFS4_ACL_TYPE_DEFAULT 0x01
53#define NFS4_ACL_DIR 0x02
54#define NFS4_ACL_OWNER 0x04
55
56struct nfs4_acl *nfs4_acl_posix_to_nfsv4(struct posix_acl *,
57 struct posix_acl *, unsigned int flags);
58int nfs4_acl_nfsv4_to_posix(struct nfs4_acl *, struct posix_acl **,
59 struct posix_acl **, unsigned int flags);
60
61#endif /* LINUX_NFS4_ACL_H */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index a46e430d9622..1b93b9c60e55 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -33,6 +33,8 @@
33#define FLUSH_STABLE 4 /* commit to stable storage */ 33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */ 34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
36 38
37#ifdef __KERNEL__ 39#ifdef __KERNEL__
38 40
@@ -93,8 +95,13 @@ struct nfs_open_context {
93 int error; 95 int error;
94 96
95 struct list_head list; 97 struct list_head list;
98};
96 99
100struct nfs_open_dir_context {
101 struct rpc_cred *cred;
97 __u64 dir_cookie; 102 __u64 dir_cookie;
103 __u64 dup_cookie;
104 int duped;
98}; 105};
99 106
100/* 107/*
@@ -188,6 +195,10 @@ struct nfs_inode {
188 struct nfs_delegation __rcu *delegation; 195 struct nfs_delegation __rcu *delegation;
189 fmode_t delegation_state; 196 fmode_t delegation_state;
190 struct rw_semaphore rwsem; 197 struct rw_semaphore rwsem;
198
199 /* pNFS layout information */
200 struct pnfs_layout_hdr *layout;
201 atomic_t commits_outstanding;
191#endif /* CONFIG_NFS_V4*/ 202#endif /* CONFIG_NFS_V4*/
192#ifdef CONFIG_NFS_FSCACHE 203#ifdef CONFIG_NFS_FSCACHE
193 struct fscache_cookie *fscache; 204 struct fscache_cookie *fscache;
@@ -212,11 +223,12 @@ struct nfs_inode {
212#define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */ 223#define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */
213#define NFS_INO_STALE (1) /* possible stale inode */ 224#define NFS_INO_STALE (1) /* possible stale inode */
214#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */ 225#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */
215#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */
216#define NFS_INO_FLUSHING (4) /* inode is flushing out data */ 226#define NFS_INO_FLUSHING (4) /* inode is flushing out data */
217#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 227#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
218#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 228#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
219#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 229#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
230#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */
231#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
220 232
221static inline struct nfs_inode *NFS_I(const struct inode *inode) 233static inline struct nfs_inode *NFS_I(const struct inode *inode)
222{ 234{
@@ -348,7 +360,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
348extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 360extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
349extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 361extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
350extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 362extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
351extern int nfs_permission(struct inode *, int); 363extern int nfs_permission(struct inode *, int, unsigned int);
352extern int nfs_open(struct inode *, struct file *); 364extern int nfs_open(struct inode *, struct file *);
353extern int nfs_release(struct inode *, struct file *); 365extern int nfs_release(struct inode *, struct file *);
354extern int nfs_attribute_timeout(struct inode *inode); 366extern int nfs_attribute_timeout(struct inode *inode);
@@ -398,6 +410,7 @@ extern const struct inode_operations nfs3_file_inode_operations;
398#endif /* CONFIG_NFS_V3 */ 410#endif /* CONFIG_NFS_V3 */
399extern const struct file_operations nfs_file_operations; 411extern const struct file_operations nfs_file_operations;
400extern const struct address_space_operations nfs_file_aops; 412extern const struct address_space_operations nfs_file_aops;
413extern const struct address_space_operations nfs_dir_aops;
401 414
402static inline struct nfs_open_context *nfs_file_open_context(struct file *filp) 415static inline struct nfs_open_context *nfs_file_open_context(struct file *filp)
403{ 416{
@@ -498,7 +511,7 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
498extern int nfs_writepages(struct address_space *, struct writeback_control *); 511extern int nfs_writepages(struct address_space *, struct writeback_control *);
499extern int nfs_flush_incompatible(struct file *file, struct page *page); 512extern int nfs_flush_incompatible(struct file *file, struct page *page);
500extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 513extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
501extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 514extern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
502 515
503/* 516/*
504 * Try to write back everything synchronously (but check the 517 * Try to write back everything synchronously (but check the
@@ -590,12 +603,6 @@ nfs_fileid_to_ino_t(u64 fileid)
590 return ino; 603 return ino;
591} 604}
592 605
593#define nfs_wait_event(clnt, wq, condition) \
594({ \
595 int __retval = wait_event_killable(wq, condition); \
596 __retval; \
597})
598
599#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 606#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
600 607
601#endif /* __KERNEL__ */ 608#endif /* __KERNEL__ */
@@ -615,6 +622,8 @@ nfs_fileid_to_ino_t(u64 fileid)
615#define NFSDBG_CLIENT 0x0200 622#define NFSDBG_CLIENT 0x0200
616#define NFSDBG_MOUNT 0x0400 623#define NFSDBG_MOUNT 0x0400
617#define NFSDBG_FSCACHE 0x0800 624#define NFSDBG_FSCACHE 0x0800
625#define NFSDBG_PNFS 0x1000
626#define NFSDBG_PNFS_LD 0x2000
618#define NFSDBG_ALL 0xFFFF 627#define NFSDBG_ALL 0xFFFF
619 628
620#ifdef __KERNEL__ 629#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 5eef862ec187..87694ca86914 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -30,6 +30,8 @@ struct nfs_client {
30#define NFS_CS_CALLBACK 1 /* - callback started */ 30#define NFS_CS_CALLBACK 1 /* - callback started */
31#define NFS_CS_IDMAP 2 /* - idmap started */ 31#define NFS_CS_IDMAP 2 /* - idmap started */
32#define NFS_CS_RENEWD 3 /* - renewd started */ 32#define NFS_CS_RENEWD 3 /* - renewd started */
33#define NFS_CS_STOP_RENEW 4 /* no more state to renew */
34#define NFS_CS_CHECK_LEASE_TIME 5 /* need to check lease time */
33 struct sockaddr_storage cl_addr; /* server identifier */ 35 struct sockaddr_storage cl_addr; /* server identifier */
34 size_t cl_addrlen; 36 size_t cl_addrlen;
35 char * cl_hostname; /* hostname of server */ 37 char * cl_hostname; /* hostname of server */
@@ -45,13 +47,9 @@ struct nfs_client {
45 47
46#ifdef CONFIG_NFS_V4 48#ifdef CONFIG_NFS_V4
47 u64 cl_clientid; /* constant */ 49 u64 cl_clientid; /* constant */
50 nfs4_verifier cl_confirm; /* Clientid verifier */
48 unsigned long cl_state; 51 unsigned long cl_state;
49 52
50 struct rb_root cl_openowner_id;
51 struct rb_root cl_lockowner_id;
52
53 struct list_head cl_delegations;
54 struct rb_root cl_state_owners;
55 spinlock_t cl_lock; 53 spinlock_t cl_lock;
56 54
57 unsigned long cl_lease_time; 55 unsigned long cl_lease_time;
@@ -71,18 +69,16 @@ struct nfs_client {
71 */ 69 */
72 char cl_ipaddr[48]; 70 char cl_ipaddr[48];
73 unsigned char cl_id_uniquifier; 71 unsigned char cl_id_uniquifier;
72 u32 cl_cb_ident; /* v4.0 callback identifier */
74 const struct nfs4_minor_version_ops *cl_mvops; 73 const struct nfs4_minor_version_ops *cl_mvops;
75#endif /* CONFIG_NFS_V4 */
76 74
77#ifdef CONFIG_NFS_V4_1
78 /* clientid returned from EXCHANGE_ID, used by session operations */
79 u64 cl_ex_clid;
80 /* The sequence id to use for the next CREATE_SESSION */ 75 /* The sequence id to use for the next CREATE_SESSION */
81 u32 cl_seqid; 76 u32 cl_seqid;
82 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 77 /* The flags used for obtaining the clientid during EXCHANGE_ID */
83 u32 cl_exchange_flags; 78 u32 cl_exchange_flags;
84 struct nfs4_session *cl_session; /* sharred session */ 79 struct nfs4_session *cl_session; /* sharred session */
85#endif /* CONFIG_NFS_V4_1 */ 80 struct list_head cl_layouts;
81#endif /* CONFIG_NFS_V4 */
86 82
87#ifdef CONFIG_NFS_FSCACHE 83#ifdef CONFIG_NFS_FSCACHE
88 struct fscache_cookie *fscache; /* client index cache cookie */ 84 struct fscache_cookie *fscache; /* client index cache cookie */
@@ -145,7 +141,15 @@ struct nfs_server {
145 u32 acl_bitmask; /* V4 bitmask representing the ACEs 141 u32 acl_bitmask; /* V4 bitmask representing the ACEs
146 that are supported on this 142 that are supported on this
147 filesystem */ 143 filesystem */
144 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
145 struct rpc_wait_queue roc_rpcwaitq;
146
147 /* the following fields are protected by nfs_client->cl_lock */
148 struct rb_root state_owners;
149 struct rb_root openowner_id;
150 struct rb_root lockowner_id;
148#endif 151#endif
152 struct list_head delegations;
149 void (*destroy)(struct nfs_server *); 153 void (*destroy)(struct nfs_server *);
150 154
151 atomic_t active; /* Keep trace of any activity to this server */ 155 atomic_t active; /* Keep trace of any activity to this server */
@@ -174,12 +178,13 @@ struct nfs_server {
174#define NFS_CAP_CTIME (1U << 12) 178#define NFS_CAP_CTIME (1U << 12)
175#define NFS_CAP_MTIME (1U << 13) 179#define NFS_CAP_MTIME (1U << 13)
176#define NFS_CAP_POSIX_LOCK (1U << 14) 180#define NFS_CAP_POSIX_LOCK (1U << 14)
181#define NFS_CAP_UIDGID_NOMAP (1U << 15)
177 182
178 183
179/* maximum number of slots to use */ 184/* maximum number of slots to use */
180#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE 185#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE
181 186
182#if defined(CONFIG_NFS_V4_1) 187#if defined(CONFIG_NFS_V4)
183 188
184/* Sessions */ 189/* Sessions */
185#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) 190#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long)))
@@ -193,6 +198,7 @@ struct nfs4_slot_table {
193 * op for dynamic resizing */ 198 * op for dynamic resizing */
194 int target_max_slots; /* Set by CB_RECALL_SLOT as 199 int target_max_slots; /* Set by CB_RECALL_SLOT as
195 * the new max_slots */ 200 * the new max_slots */
201 struct completion complete;
196}; 202};
197 203
198static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp) 204static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
@@ -209,7 +215,6 @@ struct nfs4_session {
209 unsigned long session_state; 215 unsigned long session_state;
210 u32 hash_alg; 216 u32 hash_alg;
211 u32 ssv_len; 217 u32 ssv_len;
212 struct completion complete;
213 218
214 /* The fore and back channel */ 219 /* The fore and back channel */
215 struct nfs4_channel_attrs fc_attrs; 220 struct nfs4_channel_attrs fc_attrs;
@@ -219,5 +224,5 @@ struct nfs4_session {
219 struct nfs_client *clp; 224 struct nfs_client *clp;
220}; 225};
221 226
222#endif /* CONFIG_NFS_V4_1 */ 227#endif /* CONFIG_NFS_V4 */
223#endif 228#endif
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index e8352dc5afb5..ae7d6a380dae 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -65,6 +65,7 @@ struct idmap_msg {
65 65
66/* Forward declaration to make this header independent of others */ 66/* Forward declaration to make this header independent of others */
67struct nfs_client; 67struct nfs_client;
68struct nfs_server;
68 69
69#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 70#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
70 71
@@ -96,10 +97,10 @@ void nfs_idmap_delete(struct nfs_client *);
96 97
97#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ 98#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
98 99
99int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *); 100int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *);
100int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *); 101int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *);
101int nfs_map_uid_to_name(struct nfs_client *, __u32, char *, size_t); 102int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
102int nfs_map_gid_to_group(struct nfs_client *, __u32, char *, size_t); 103int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t);
103 104
104extern unsigned int nfs_idmap_cache_timeout; 105extern unsigned int nfs_idmap_cache_timeout;
105#endif /* __KERNEL__ */ 106#endif /* __KERNEL__ */
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 68b10f5f8907..8866bb3502ee 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -113,6 +113,8 @@ enum nfs_stat_eventcounters {
113 NFSIOS_SHORTREAD, 113 NFSIOS_SHORTREAD,
114 NFSIOS_SHORTWRITE, 114 NFSIOS_SHORTWRITE,
115 NFSIOS_DELAY, 115 NFSIOS_DELAY,
116 NFSIOS_PNFS_READ,
117 NFSIOS_PNFS_WRITE,
116 __NFSIOS_COUNTSMAX, 118 __NFSIOS_COUNTSMAX,
117}; 119};
118 120
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index f8b60e7f4c44..91af2e49fa3a 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -29,14 +29,19 @@
29 */ 29 */
30enum { 30enum {
31 PG_BUSY = 0, 31 PG_BUSY = 0,
32 PG_MAPPED,
32 PG_CLEAN, 33 PG_CLEAN,
33 PG_NEED_COMMIT, 34 PG_NEED_COMMIT,
34 PG_NEED_RESCHED, 35 PG_NEED_RESCHED,
36 PG_PNFS_COMMIT,
35}; 37};
36 38
37struct nfs_inode; 39struct nfs_inode;
38struct nfs_page { 40struct nfs_page {
39 struct list_head wb_list; /* Defines state of page: */ 41 union {
42 struct list_head wb_list; /* Defines state of page: */
43 struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */
44 };
40 struct page *wb_page; /* page to read in/write out */ 45 struct page *wb_page; /* page to read in/write out */
41 struct nfs_open_context *wb_context; /* File state context info */ 46 struct nfs_open_context *wb_context; /* File state context info */
42 struct nfs_lock_context *wb_lock_context; /* lock context info */ 47 struct nfs_lock_context *wb_lock_context; /* lock context info */
@@ -56,11 +61,14 @@ struct nfs_pageio_descriptor {
56 size_t pg_count; 61 size_t pg_count;
57 size_t pg_bsize; 62 size_t pg_bsize;
58 unsigned int pg_base; 63 unsigned int pg_base;
64 char pg_moreio;
59 65
60 struct inode *pg_inode; 66 struct inode *pg_inode;
61 int (*pg_doio)(struct inode *, struct list_head *, unsigned int, size_t, int); 67 int (*pg_doio)(struct nfs_pageio_descriptor *);
62 int pg_ioflags; 68 int pg_ioflags;
63 int pg_error; 69 int pg_error;
70 struct pnfs_layout_segment *pg_lseg;
71 int (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
64}; 72};
65 73
66#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
@@ -70,7 +78,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
70 struct page *page, 78 struct page *page,
71 unsigned int offset, 79 unsigned int offset,
72 unsigned int count); 80 unsigned int count);
73extern void nfs_clear_request(struct nfs_page *req);
74extern void nfs_release_request(struct nfs_page *req); 81extern void nfs_release_request(struct nfs_page *req);
75 82
76 83
@@ -78,7 +85,7 @@ extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
78 pgoff_t idx_start, unsigned int npages, int tag); 85 pgoff_t idx_start, unsigned int npages, int tag);
79extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 86extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
80 struct inode *inode, 87 struct inode *inode,
81 int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), 88 int (*doio)(struct nfs_pageio_descriptor *desc),
82 size_t bsize, 89 size_t bsize,
83 int how); 90 int how);
84extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 91extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index da7a1300dc60..7e371f7df9c4 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h> 5#include <linux/nfs3.h>
6#include <linux/sunrpc/gss_api.h>
6 7
7/* 8/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust 9 * To change the maximum rsize and wsize supported by the NFS client, adjust
@@ -14,6 +15,9 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 15#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 16#define NFS_MIN_FILE_IO_SIZE (1024U)
16 17
18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors;
20
17struct nfs_fsid { 21struct nfs_fsid {
18 uint64_t major; 22 uint64_t major;
19 uint64_t minor; 23 uint64_t minor;
@@ -46,6 +50,7 @@ struct nfs_fattr {
46 } du; 50 } du;
47 struct nfs_fsid fsid; 51 struct nfs_fsid fsid;
48 __u64 fileid; 52 __u64 fileid;
53 __u64 mounted_on_fileid;
49 struct timespec atime; 54 struct timespec atime;
50 struct timespec mtime; 55 struct timespec mtime;
51 struct timespec ctime; 56 struct timespec ctime;
@@ -78,6 +83,8 @@ struct nfs_fattr {
78#define NFS_ATTR_FATTR_CHANGE (1U << 17) 83#define NFS_ATTR_FATTR_CHANGE (1U << 17)
79#define NFS_ATTR_FATTR_PRECHANGE (1U << 18) 84#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 85#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
86#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
87#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
81 88
82#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 89#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \ 90 | NFS_ATTR_FATTR_MODE \
@@ -114,6 +121,7 @@ struct nfs_fsinfo {
114 __u64 maxfilesize; 121 __u64 maxfilesize;
115 struct timespec time_delta; /* server time granularity */ 122 struct timespec time_delta; /* server time granularity */
116 __u32 lease_time; /* in seconds */ 123 __u32 lease_time; /* in seconds */
124 __u32 layouttype; /* supported pnfs layout driver */
117}; 125};
118 126
119struct nfs_fsstat { 127struct nfs_fsstat {
@@ -186,6 +194,81 @@ struct nfs4_get_lease_time_res {
186 struct nfs4_sequence_res lr_seq_res; 194 struct nfs4_sequence_res lr_seq_res;
187}; 195};
188 196
197#define PNFS_LAYOUT_MAXSIZE 4096
198
199struct nfs4_layoutdriver_data {
200 struct page **pages;
201 __u32 pglen;
202 __u32 len;
203};
204
205struct pnfs_layout_range {
206 u32 iomode;
207 u64 offset;
208 u64 length;
209};
210
211struct nfs4_layoutget_args {
212 __u32 type;
213 struct pnfs_layout_range range;
214 __u64 minlength;
215 __u32 maxcount;
216 struct inode *inode;
217 struct nfs_open_context *ctx;
218 struct nfs4_sequence_args seq_args;
219 nfs4_stateid stateid;
220 struct nfs4_layoutdriver_data layout;
221};
222
223struct nfs4_layoutget_res {
224 __u32 return_on_close;
225 struct pnfs_layout_range range;
226 __u32 type;
227 nfs4_stateid stateid;
228 struct nfs4_sequence_res seq_res;
229 struct nfs4_layoutdriver_data *layoutp;
230};
231
232struct nfs4_layoutget {
233 struct nfs4_layoutget_args args;
234 struct nfs4_layoutget_res res;
235 struct pnfs_layout_segment **lsegpp;
236 gfp_t gfp_flags;
237};
238
239struct nfs4_getdeviceinfo_args {
240 struct pnfs_device *pdev;
241 struct nfs4_sequence_args seq_args;
242};
243
244struct nfs4_getdeviceinfo_res {
245 struct pnfs_device *pdev;
246 struct nfs4_sequence_res seq_res;
247};
248
249struct nfs4_layoutcommit_args {
250 nfs4_stateid stateid;
251 __u64 lastbytewritten;
252 struct inode *inode;
253 const u32 *bitmask;
254 struct nfs4_sequence_args seq_args;
255};
256
257struct nfs4_layoutcommit_res {
258 struct nfs_fattr *fattr;
259 const struct nfs_server *server;
260 struct nfs4_sequence_res seq_res;
261};
262
263struct nfs4_layoutcommit_data {
264 struct rpc_task task;
265 struct nfs_fattr fattr;
266 struct pnfs_layout_segment *lseg;
267 struct rpc_cred *cred;
268 struct nfs4_layoutcommit_args args;
269 struct nfs4_layoutcommit_res res;
270};
271
189/* 272/*
190 * Arguments to the open call. 273 * Arguments to the open call.
191 */ 274 */
@@ -267,6 +350,7 @@ struct nfs_closeres {
267struct nfs_lowner { 350struct nfs_lowner {
268 __u64 clientid; 351 __u64 clientid;
269 __u64 id; 352 __u64 id;
353 dev_t s_dev;
270}; 354};
271 355
272struct nfs_lock_args { 356struct nfs_lock_args {
@@ -433,6 +517,8 @@ struct nfs_entry {
433 int eof; 517 int eof;
434 struct nfs_fh * fh; 518 struct nfs_fh * fh;
435 struct nfs_fattr * fattr; 519 struct nfs_fattr * fattr;
520 unsigned char d_type;
521 struct nfs_server * server;
436}; 522};
437 523
438/* 524/*
@@ -883,6 +969,38 @@ struct nfs4_fs_locations_res {
883 struct nfs4_sequence_res seq_res; 969 struct nfs4_sequence_res seq_res;
884}; 970};
885 971
972struct nfs4_secinfo_oid {
973 unsigned int len;
974 char data[GSS_OID_MAX_LEN];
975};
976
977struct nfs4_secinfo_gss {
978 struct nfs4_secinfo_oid sec_oid4;
979 unsigned int qop4;
980 unsigned int service;
981};
982
983struct nfs4_secinfo_flavor {
984 unsigned int flavor;
985 struct nfs4_secinfo_gss gss;
986};
987
988struct nfs4_secinfo_flavors {
989 unsigned int num_flavors;
990 struct nfs4_secinfo_flavor flavors[0];
991};
992
993struct nfs4_secinfo_arg {
994 const struct nfs_fh *dir_fh;
995 const struct qstr *name;
996 struct nfs4_sequence_args seq_args;
997};
998
999struct nfs4_secinfo_res {
1000 struct nfs4_secinfo_flavors *flavors;
1001 struct nfs4_sequence_res seq_res;
1002};
1003
886#endif /* CONFIG_NFS_V4 */ 1004#endif /* CONFIG_NFS_V4 */
887 1005
888struct nfstime4 { 1006struct nfstime4 {
@@ -963,9 +1081,12 @@ struct nfs_read_data {
963 unsigned int npages; /* Max length of pagevec */ 1081 unsigned int npages; /* Max length of pagevec */
964 struct nfs_readargs args; 1082 struct nfs_readargs args;
965 struct nfs_readres res; 1083 struct nfs_readres res;
966#ifdef CONFIG_NFS_V4
967 unsigned long timestamp; /* For lease renewal */ 1084 unsigned long timestamp; /* For lease renewal */
968#endif 1085 struct pnfs_layout_segment *lseg;
1086 struct nfs_client *ds_clp; /* pNFS data server */
1087 const struct rpc_call_ops *mds_ops;
1088 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1089 __u64 mds_offset;
969 struct page *page_array[NFS_PAGEVEC_SIZE]; 1090 struct page *page_array[NFS_PAGEVEC_SIZE];
970}; 1091};
971 1092
@@ -982,13 +1103,21 @@ struct nfs_write_data {
982 unsigned int npages; /* Max length of pagevec */ 1103 unsigned int npages; /* Max length of pagevec */
983 struct nfs_writeargs args; /* argument struct */ 1104 struct nfs_writeargs args; /* argument struct */
984 struct nfs_writeres res; /* result struct */ 1105 struct nfs_writeres res; /* result struct */
1106 struct pnfs_layout_segment *lseg;
1107 struct nfs_client *ds_clp; /* pNFS data server */
1108 int ds_commit_index;
1109 const struct rpc_call_ops *mds_ops;
1110 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
985#ifdef CONFIG_NFS_V4 1111#ifdef CONFIG_NFS_V4
986 unsigned long timestamp; /* For lease renewal */ 1112 unsigned long timestamp; /* For lease renewal */
987#endif 1113#endif
1114 __u64 mds_offset; /* Filelayout dense stripe */
988 struct page *page_array[NFS_PAGEVEC_SIZE]; 1115 struct page *page_array[NFS_PAGEVEC_SIZE];
989}; 1116};
990 1117
991struct nfs_access_entry; 1118struct nfs_access_entry;
1119struct nfs_client;
1120struct rpc_timeout;
992 1121
993/* 1122/*
994 * RPC procedure vector for NFSv2/NFSv3 demuxing 1123 * RPC procedure vector for NFSv2/NFSv3 demuxing
@@ -1008,7 +1137,7 @@ struct nfs_rpc_ops {
1008 struct nfs_fattr *); 1137 struct nfs_fattr *);
1009 int (*setattr) (struct dentry *, struct nfs_fattr *, 1138 int (*setattr) (struct dentry *, struct nfs_fattr *,
1010 struct iattr *); 1139 struct iattr *);
1011 int (*lookup) (struct inode *, struct qstr *, 1140 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
1012 struct nfs_fh *, struct nfs_fattr *); 1141 struct nfs_fh *, struct nfs_fattr *);
1013 int (*access) (struct inode *, struct nfs_access_entry *); 1142 int (*access) (struct inode *, struct nfs_access_entry *);
1014 int (*readlink)(struct inode *, struct page *, unsigned int, 1143 int (*readlink)(struct inode *, struct page *, unsigned int,
@@ -1038,7 +1167,7 @@ struct nfs_rpc_ops {
1038 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 1167 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1039 struct nfs_pathconf *); 1168 struct nfs_pathconf *);
1040 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1169 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1041 __be32 *(*decode_dirent)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int plus); 1170 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1042 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1171 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1043 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1172 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1044 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1173 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
@@ -1053,6 +1182,9 @@ struct nfs_rpc_ops {
1053 struct nfs_open_context *ctx, 1182 struct nfs_open_context *ctx,
1054 int open_flags, 1183 int open_flags,
1055 struct iattr *iattr); 1184 struct iattr *iattr);
1185 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1186 const char *, rpc_authflavor_t, int);
1187 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
1056}; 1188};
1057 1189
1058/* 1190/*
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index f321b578edeb..fabcb1e5c460 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -51,10 +51,10 @@ nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
51 return w; 51 return w;
52} 52}
53 53
54extern unsigned int 54extern int
55nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode, 55nfsacl_encode(struct xdr_buf *buf, unsigned int base, struct inode *inode,
56 struct posix_acl *acl, int encode_entries, int typeflag); 56 struct posix_acl *acl, int encode_entries, int typeflag);
57extern unsigned int 57extern int
58nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, 58nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
59 struct posix_acl **pacl); 59 struct posix_acl **pacl);
60 60
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 8ae78a61eea4..84058ec69390 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -35,7 +35,7 @@
35#define NFSEXP_NOHIDE 0x0200 35#define NFSEXP_NOHIDE 0x0200
36#define NFSEXP_NOSUBTREECHECK 0x0400 36#define NFSEXP_NOSUBTREECHECK 0x0400
37#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */ 37#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
38#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect */ 38#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */
39#define NFSEXP_FSID 0x2000 39#define NFSEXP_FSID 0x2000
40#define NFSEXP_CROSSMOUNT 0x4000 40#define NFSEXP_CROSSMOUNT 0x4000
41#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ 41#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
@@ -80,7 +80,7 @@ struct nfsd4_fs_locations {
80 80
81/* 81/*
82 * We keep an array of pseudoflavors with the export, in order from most 82 * We keep an array of pseudoflavors with the export, in order from most
83 * to least preferred. For the forseeable future, we don't expect more 83 * to least preferred. For the foreseeable future, we don't expect more
84 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3, 84 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
85 * spkm3i, and spkm3p (and using all 8 at once should be rare). 85 * spkm3i, and spkm3p (and using all 8 at once should be rare).
86 */ 86 */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 80d55bbc5365..f76d80ccec10 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -49,7 +49,7 @@ struct nfs_fhbase_old {
49 * 49 *
50 * The auth_type field specifies how the filehandle can be authenticated 50 * The auth_type field specifies how the filehandle can be authenticated
51 * This might allow a file to be confirmed to be in a writable part of a 51 * This might allow a file to be confirmed to be in a writable part of a
52 * filetree without checking the path from it upto the root. 52 * filetree without checking the path from it up to the root.
53 * Current values: 53 * Current values:
54 * 0 - No authentication. fb_auth is 0 bytes long 54 * 0 - No authentication. fb_auth is 0 bytes long
55 * Possible future values: 55 * Possible future values:
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h
deleted file mode 100644
index d4a2ac18bd4c..000000000000
--- a/include/linux/nfsd_idmap.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * include/linux/nfsd_idmap.h
3 *
4 * Mapping of UID to name and vice versa.
5 *
6 * Copyright (c) 2002, 2003 The Regents of the University of
7 * Michigan. All rights reserved.
8> *
9 * Marius Aamodt Eriksen <marius@umich.edu>
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef LINUX_NFSD_IDMAP_H
38#define LINUX_NFSD_IDMAP_H
39
40#include <linux/in.h>
41#include <linux/sunrpc/svc.h>
42
43/* XXX from linux/nfs_idmap.h */
44#define IDMAP_NAMESZ 128
45
46#ifdef CONFIG_NFSD_V4
47int nfsd_idmap_init(void);
48void nfsd_idmap_shutdown(void);
49#else
50static inline int nfsd_idmap_init(void)
51{
52 return 0;
53}
54static inline void nfsd_idmap_shutdown(void)
55{
56}
57#endif
58
59int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *);
60int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *);
61int nfsd_map_uid_to_name(struct svc_rqst *, __u32, char *);
62int nfsd_map_gid_to_name(struct svc_rqst *, __u32, char *);
63
64#endif /* LINUX_NFSD_IDMAP_H */
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 227e49dd5720..8768c469e93e 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -40,26 +40,7 @@
40 40
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43 43#include <linux/magic.h>
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63 44
64 45
65#define NILFS_INODE_BMAP_SIZE 7 46#define NILFS_INODE_BMAP_SIZE 7
@@ -236,8 +217,10 @@ struct nilfs_super_block {
236 * If there is a bit set in the incompatible feature set that the kernel 217 * If there is a bit set in the incompatible feature set that the kernel
237 * doesn't know about, it should refuse to mount the filesystem. 218 * doesn't know about, it should refuse to mount the filesystem.
238 */ 219 */
220#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
221
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL 222#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL 223#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL 224#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242 225
243/* 226/*
@@ -260,7 +243,6 @@ struct nilfs_super_block {
260#define NILFS_USER_INO 11 /* Fisrt user's file inode number */ 243#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
261 244
262#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ 245#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
263#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
264 246
265#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in 247#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
266 a full segment */ 248 a full segment */
@@ -346,17 +328,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
346{ 328{
347 unsigned len = le16_to_cpu(dlen); 329 unsigned len = le16_to_cpu(dlen);
348 330
331#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
349 if (len == NILFS_MAX_REC_LEN) 332 if (len == NILFS_MAX_REC_LEN)
350 return 1 << 16; 333 return 1 << 16;
334#endif
351 return len; 335 return len;
352} 336}
353 337
354static inline __le16 nilfs_rec_len_to_disk(unsigned len) 338static inline __le16 nilfs_rec_len_to_disk(unsigned len)
355{ 339{
340#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
356 if (len == (1 << 16)) 341 if (len == (1 << 16))
357 return cpu_to_le16(NILFS_MAX_REC_LEN); 342 return cpu_to_le16(NILFS_MAX_REC_LEN);
358 else if (len > (1 << 16)) 343 else if (len > (1 << 16))
359 BUG(); 344 BUG();
345#endif
360 return cpu_to_le16(len); 346 return cpu_to_le16(len);
361} 347}
362 348
@@ -525,7 +511,7 @@ struct nilfs_checkpoint {
525 __le64 cp_create; 511 __le64 cp_create;
526 __le64 cp_nblk_inc; 512 __le64 cp_nblk_inc;
527 __le64 cp_inodes_count; 513 __le64 cp_inodes_count;
528 __le64 cp_blocks_count; /* Reserved (might be deleted) */ 514 __le64 cp_blocks_count;
529 515
530 /* Do not change the byte offset of ifile inode. 516 /* Do not change the byte offset of ifile inode.
531 To keep the compatibility of the disk format, 517 To keep the compatibility of the disk format,
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 0edb2566c14c..c7ccaae15af6 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -77,6 +77,39 @@
77 */ 77 */
78 78
79/** 79/**
80 * DOC: Virtual interface / concurrency capabilities
81 *
82 * Some devices are able to operate with virtual MACs, they can have
83 * more than one virtual interface. The capability handling for this
84 * is a bit complex though, as there may be a number of restrictions
85 * on the types of concurrency that are supported.
86 *
87 * To start with, each device supports the interface types listed in
88 * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the
89 * types there no concurrency is implied.
90 *
91 * Once concurrency is desired, more attributes must be observed:
92 * To start with, since some interface types are purely managed in
93 * software, like the AP-VLAN type in mac80211 for example, there's
94 * an additional list of these, they can be added at any time and
95 * are only restricted by some semantic restrictions (e.g. AP-VLAN
96 * cannot be added without a corresponding AP interface). This list
97 * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute.
98 *
99 * Further, the list of supported combinations is exported. This is
100 * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically,
101 * it exports a list of "groups", and at any point in time the
102 * interfaces that are currently active must fall into any one of
103 * the advertised groups. Within each group, there are restrictions
104 * on the number of interfaces of different types that are supported
105 * and also the number of different channels, along with potentially
106 * some other restrictions. See &enum nl80211_if_combination_attrs.
107 *
108 * All together, these attributes define the concurrency of virtual
109 * interfaces that a given device supports.
110 */
111
112/**
80 * enum nl80211_commands - supported nl80211 commands 113 * enum nl80211_commands - supported nl80211 commands
81 * 114 *
82 * @NL80211_CMD_UNSPEC: unspecified command to catch errors 115 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -148,6 +181,10 @@
148 * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to 181 * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
149 * destination %NL80211_ATTR_MAC on the interface identified by 182 * destination %NL80211_ATTR_MAC on the interface identified by
150 * %NL80211_ATTR_IFINDEX. 183 * %NL80211_ATTR_IFINDEX.
184 * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
185 * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP.
186 * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
187 * %NL80211_ATTR_MAC.
151 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the 188 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
152 * the interface identified by %NL80211_ATTR_IFINDEX. 189 * the interface identified by %NL80211_ATTR_IFINDEX.
153 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC 190 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
@@ -172,10 +209,10 @@
172 * to the specified ISO/IEC 3166-1 alpha2 country code. The core will 209 * to the specified ISO/IEC 3166-1 alpha2 country code. The core will
173 * store this as a valid request and then query userspace for it. 210 * store this as a valid request and then query userspace for it.
174 * 211 *
175 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the 212 * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
176 * interface identified by %NL80211_ATTR_IFINDEX 213 * interface identified by %NL80211_ATTR_IFINDEX
177 * 214 *
178 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the 215 * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
179 * interface identified by %NL80211_ATTR_IFINDEX 216 * interface identified by %NL80211_ATTR_IFINDEX
180 * 217 *
181 * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The 218 * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
@@ -199,6 +236,28 @@
199 * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, 236 * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
200 * partial scan results may be available 237 * partial scan results may be available
201 * 238 *
239 * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
240 * intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL.
241 * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
242 * are passed, they are used in the probe requests. For
243 * broadcast, a broadcast SSID must be passed (ie. an empty
244 * string). If no SSID is passed, no probe requests are sent and
245 * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES,
246 * if passed, define which channels should be scanned; if not
247 * passed, all channels allowed for the current regulatory domain
248 * are used. Extra IEs can also be passed from the userspace by
249 * using the %NL80211_ATTR_IE attribute.
250 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan
251 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
252 * results available.
253 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
254 * stopped. The driver may issue this event at any time during a
255 * scheduled scan. One reason for stopping the scan is if the hardware
256 * does not support starting an association or a normal scan while running
257 * a scheduled scan. This event is also sent when the
258 * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface
259 * is brought down while a scheduled scan was running.
260 *
202 * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation 261 * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation
203 * or noise level 262 * or noise level
204 * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to 263 * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to
@@ -358,11 +417,16 @@
358 * user space application). %NL80211_ATTR_FRAME is used to specify the 417 * user space application). %NL80211_ATTR_FRAME is used to specify the
359 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 418 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and
360 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 419 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on
361 * which channel the frame is to be transmitted or was received. This 420 * which channel the frame is to be transmitted or was received. If this
362 * channel has to be the current channel (remain-on-channel or the 421 * channel is not the current channel (remain-on-channel or the
363 * operational channel). When called, this operation returns a cookie 422 * operational channel) the device will switch to the given channel and
364 * (%NL80211_ATTR_COOKIE) that will be included with the TX status event 423 * transmit the frame, optionally waiting for a response for the time
365 * pertaining to the TX request. 424 * specified using %NL80211_ATTR_DURATION. When called, this operation
425 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
426 * TX status event pertaining to the TX request.
427 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
428 * command may be used with the corresponding cookie to cancel the wait
429 * time if it is known that it is no longer necessary.
366 * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. 430 * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
367 * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame 431 * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
368 * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies 432 * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
@@ -389,11 +453,41 @@
389 * 453 *
390 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. 454 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
391 * 455 *
456 * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
457 * mesh config parameters may be given.
458 * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
459 * network is determined by the network interface.
460 *
461 * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame
462 * notification. This event is used to indicate that an unprotected
463 * deauthentication frame was dropped when MFP is in use.
464 * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame
465 * notification. This event is used to indicate that an unprotected
466 * disassociation frame was dropped when MFP is in use.
467 *
468 * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a
469 * beacon or probe response from a compatible mesh peer. This is only
470 * sent while no station information (sta_info) exists for the new peer
471 * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On
472 * reception of this notification, userspace may decide to create a new
473 * station (@NL80211_CMD_NEW_STATION). To stop this notification from
474 * reoccurring, the userspace authentication daemon may want to create the
475 * new station with the AUTHENTICATED flag unset and maybe change it later
476 * depending on the authentication result.
477 *
478 * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
479 * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
480 * Since wireless is more complex than wired ethernet, it supports
481 * various triggers. These triggers can be configured through this
482 * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
483 * more background information, see
484 * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
485 *
392 * @NL80211_CMD_MAX: highest used command number 486 * @NL80211_CMD_MAX: highest used command number
393 * @__NL80211_CMD_AFTER_LAST: internal use 487 * @__NL80211_CMD_AFTER_LAST: internal use
394 */ 488 */
395enum nl80211_commands { 489enum nl80211_commands {
396/* don't change the order or add anything inbetween, this is ABI! */ 490/* don't change the order or add anything between, this is ABI! */
397 NL80211_CMD_UNSPEC, 491 NL80211_CMD_UNSPEC,
398 492
399 NL80211_CMD_GET_WIPHY, /* can dump */ 493 NL80211_CMD_GET_WIPHY, /* can dump */
@@ -431,8 +525,8 @@ enum nl80211_commands {
431 NL80211_CMD_SET_REG, 525 NL80211_CMD_SET_REG,
432 NL80211_CMD_REQ_SET_REG, 526 NL80211_CMD_REQ_SET_REG,
433 527
434 NL80211_CMD_GET_MESH_PARAMS, 528 NL80211_CMD_GET_MESH_CONFIG,
435 NL80211_CMD_SET_MESH_PARAMS, 529 NL80211_CMD_SET_MESH_CONFIG,
436 530
437 NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, 531 NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
438 532
@@ -493,6 +587,24 @@ enum nl80211_commands {
493 NL80211_CMD_SET_CHANNEL, 587 NL80211_CMD_SET_CHANNEL,
494 NL80211_CMD_SET_WDS_PEER, 588 NL80211_CMD_SET_WDS_PEER,
495 589
590 NL80211_CMD_FRAME_WAIT_CANCEL,
591
592 NL80211_CMD_JOIN_MESH,
593 NL80211_CMD_LEAVE_MESH,
594
595 NL80211_CMD_UNPROT_DEAUTHENTICATE,
596 NL80211_CMD_UNPROT_DISASSOCIATE,
597
598 NL80211_CMD_NEW_PEER_CANDIDATE,
599
600 NL80211_CMD_GET_WOWLAN,
601 NL80211_CMD_SET_WOWLAN,
602
603 NL80211_CMD_START_SCHED_SCAN,
604 NL80211_CMD_STOP_SCHED_SCAN,
605 NL80211_CMD_SCHED_SCAN_RESULTS,
606 NL80211_CMD_SCHED_SCAN_STOPPED,
607
496 /* add new commands above here */ 608 /* add new commands above here */
497 609
498 /* used to define NL80211_CMD_MAX below */ 610 /* used to define NL80211_CMD_MAX below */
@@ -513,6 +625,11 @@ enum nl80211_commands {
513#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 625#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
514#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT 626#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
515 627
628/* source-level API compatibility */
629#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
630#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
631#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
632
516/** 633/**
517 * enum nl80211_attrs - nl80211 netlink attributes 634 * enum nl80211_attrs - nl80211 netlink attributes
518 * 635 *
@@ -583,7 +700,7 @@ enum nl80211_commands {
583 * consisting of a nested array. 700 * consisting of a nested array.
584 * 701 *
585 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). 702 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
586 * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link. 703 * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link.
587 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. 704 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
588 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path 705 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
589 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at 706 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
@@ -758,6 +875,9 @@ enum nl80211_commands {
758 * cache, a wiphy attribute. 875 * cache, a wiphy attribute.
759 * 876 *
760 * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. 877 * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32.
878 * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that
879 * specifies the maximum duration that can be requested with the
880 * remain-on-channel operation, in milliseconds, u32.
761 * 881 *
762 * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. 882 * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects.
763 * 883 *
@@ -804,11 +924,83 @@ enum nl80211_commands {
804 * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly 924 * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly
805 * means support for per-station GTKs. 925 * means support for per-station GTKs.
806 * 926 *
927 * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting.
928 * This can be used to mask out antennas which are not attached or should
929 * not be used for transmitting. If an antenna is not selected in this
930 * bitmap the hardware is not allowed to transmit on this antenna.
931 *
932 * Each bit represents one antenna, starting with antenna 1 at the first
933 * bit. Depending on which antennas are selected in the bitmap, 802.11n
934 * drivers can derive which chainmasks to use (if all antennas belonging to
935 * a particular chain are disabled this chain should be disabled) and if
936 * a chain has diversity antennas wether diversity should be used or not.
937 * HT capabilities (STBC, TX Beamforming, Antenna selection) can be
938 * derived from the available chains after applying the antenna mask.
939 * Non-802.11n drivers can derive wether to use diversity or not.
940 * Drivers may reject configurations or RX/TX mask combinations they cannot
941 * support by returning -EINVAL.
942 *
943 * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving.
944 * This can be used to mask out antennas which are not attached or should
945 * not be used for receiving. If an antenna is not selected in this bitmap
946 * the hardware should not be configured to receive on this antenna.
947 * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX.
948 *
949 * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available
950 * for configuration as TX antennas via the above parameters.
951 *
952 * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available
953 * for configuration as RX antennas via the above parameters.
954 *
955 * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS
956 *
957 * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be
958 * transmitted on another channel when the channel given doesn't match
959 * the current channel. If the current channel doesn't match and this
960 * flag isn't set, the frame will be rejected. This is also used as an
961 * nl80211 capability flag.
962 *
963 * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16)
964 *
965 * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags
966 * attributes, specifying what a key should be set as default as.
967 * See &enum nl80211_key_default_types.
968 *
969 * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be
970 * changed once the mesh is active.
971 * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute
972 * containing attributes from &enum nl80211_meshconf_params.
973 * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver
974 * allows auth frames in a mesh to be passed to userspace for processing via
975 * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag.
976 * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as
977 * defined in &enum nl80211_plink_state. Used when userspace is
978 * driving the peer link management state machine.
979 * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled.
980 *
981 * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities,
982 * the supported WoWLAN triggers
983 * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
984 * indicate which WoW triggers should be enabled. This is also
985 * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
986 * triggers.
987
988 * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
989 * cycles, in msecs.
990 *
991 * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
992 * interface combinations. In each nested item, it contains attributes
993 * defined in &enum nl80211_if_combination_attrs.
994 * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
995 * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
996 * are managed in software: interfaces of these types aren't subject to
997 * any restrictions in their number or combinations.
998 *
807 * @NL80211_ATTR_MAX: highest attribute number currently defined 999 * @NL80211_ATTR_MAX: highest attribute number currently defined
808 * @__NL80211_ATTR_AFTER_LAST: internal use 1000 * @__NL80211_ATTR_AFTER_LAST: internal use
809 */ 1001 */
810enum nl80211_attrs { 1002enum nl80211_attrs {
811/* don't change the order or add anything inbetween, this is ABI! */ 1003/* don't change the order or add anything between, this is ABI! */
812 NL80211_ATTR_UNSPEC, 1004 NL80211_ATTR_UNSPEC,
813 1005
814 NL80211_ATTR_WIPHY, 1006 NL80211_ATTR_WIPHY,
@@ -858,7 +1050,7 @@ enum nl80211_attrs {
858 NL80211_ATTR_REG_ALPHA2, 1050 NL80211_ATTR_REG_ALPHA2,
859 NL80211_ATTR_REG_RULES, 1051 NL80211_ATTR_REG_RULES,
860 1052
861 NL80211_ATTR_MESH_PARAMS, 1053 NL80211_ATTR_MESH_CONFIG,
862 1054
863 NL80211_ATTR_BSS_BASIC_RATES, 1055 NL80211_ATTR_BSS_BASIC_RATES,
864 1056
@@ -973,6 +1165,35 @@ enum nl80211_attrs {
973 1165
974 NL80211_ATTR_SUPPORT_IBSS_RSN, 1166 NL80211_ATTR_SUPPORT_IBSS_RSN,
975 1167
1168 NL80211_ATTR_WIPHY_ANTENNA_TX,
1169 NL80211_ATTR_WIPHY_ANTENNA_RX,
1170
1171 NL80211_ATTR_MCAST_RATE,
1172
1173 NL80211_ATTR_OFFCHANNEL_TX_OK,
1174
1175 NL80211_ATTR_BSS_HT_OPMODE,
1176
1177 NL80211_ATTR_KEY_DEFAULT_TYPES,
1178
1179 NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
1180
1181 NL80211_ATTR_MESH_SETUP,
1182
1183 NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
1184 NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
1185
1186 NL80211_ATTR_SUPPORT_MESH_AUTH,
1187 NL80211_ATTR_STA_PLINK_STATE,
1188
1189 NL80211_ATTR_WOWLAN_TRIGGERS,
1190 NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
1191
1192 NL80211_ATTR_SCHED_SCAN_INTERVAL,
1193
1194 NL80211_ATTR_INTERFACE_COMBINATIONS,
1195 NL80211_ATTR_SOFTWARE_IFTYPES,
1196
976 /* add attributes here, update the policy in nl80211.c */ 1197 /* add attributes here, update the policy in nl80211.c */
977 1198
978 __NL80211_ATTR_AFTER_LAST, 1199 __NL80211_ATTR_AFTER_LAST,
@@ -981,6 +1202,7 @@ enum nl80211_attrs {
981 1202
982/* source-level API compatibility */ 1203/* source-level API compatibility */
983#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION 1204#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
1205#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
984 1206
985/* 1207/*
986 * Allow user space programs to use #ifdef on new attributes by defining them 1208 * Allow user space programs to use #ifdef on new attributes by defining them
@@ -1024,7 +1246,9 @@ enum nl80211_attrs {
1024 * @NL80211_IFTYPE_ADHOC: independent BSS member 1246 * @NL80211_IFTYPE_ADHOC: independent BSS member
1025 * @NL80211_IFTYPE_STATION: managed BSS member 1247 * @NL80211_IFTYPE_STATION: managed BSS member
1026 * @NL80211_IFTYPE_AP: access point 1248 * @NL80211_IFTYPE_AP: access point
1027 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points 1249 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
1250 * are a bit special in that they must always be tied to a pre-existing
1251 * AP type interface.
1028 * @NL80211_IFTYPE_WDS: wireless distribution interface 1252 * @NL80211_IFTYPE_WDS: wireless distribution interface
1029 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames 1253 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
1030 * @NL80211_IFTYPE_MESH_POINT: mesh point 1254 * @NL80211_IFTYPE_MESH_POINT: mesh point
@@ -1066,6 +1290,7 @@ enum nl80211_iftype {
1066 * with short barker preamble 1290 * with short barker preamble
1067 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 1291 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
1068 * @NL80211_STA_FLAG_MFP: station uses management frame protection 1292 * @NL80211_STA_FLAG_MFP: station uses management frame protection
1293 * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
1069 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined 1294 * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
1070 * @__NL80211_STA_FLAG_AFTER_LAST: internal use 1295 * @__NL80211_STA_FLAG_AFTER_LAST: internal use
1071 */ 1296 */
@@ -1075,6 +1300,7 @@ enum nl80211_sta_flags {
1075 NL80211_STA_FLAG_SHORT_PREAMBLE, 1300 NL80211_STA_FLAG_SHORT_PREAMBLE,
1076 NL80211_STA_FLAG_WME, 1301 NL80211_STA_FLAG_WME,
1077 NL80211_STA_FLAG_MFP, 1302 NL80211_STA_FLAG_MFP,
1303 NL80211_STA_FLAG_AUTHENTICATED,
1078 1304
1079 /* keep last */ 1305 /* keep last */
1080 __NL80211_STA_FLAG_AFTER_LAST, 1306 __NL80211_STA_FLAG_AFTER_LAST,
@@ -1120,6 +1346,36 @@ enum nl80211_rate_info {
1120}; 1346};
1121 1347
1122/** 1348/**
1349 * enum nl80211_sta_bss_param - BSS information collected by STA
1350 *
1351 * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM
1352 * when getting information about the bitrate of a station.
1353 *
1354 * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved
1355 * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag)
1356 * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled
1357 * (flag)
1358 * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled
1359 * (flag)
1360 * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8)
1361 * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16)
1362 * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined
1363 * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use
1364 */
1365enum nl80211_sta_bss_param {
1366 __NL80211_STA_BSS_PARAM_INVALID,
1367 NL80211_STA_BSS_PARAM_CTS_PROT,
1368 NL80211_STA_BSS_PARAM_SHORT_PREAMBLE,
1369 NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME,
1370 NL80211_STA_BSS_PARAM_DTIM_PERIOD,
1371 NL80211_STA_BSS_PARAM_BEACON_INTERVAL,
1372
1373 /* keep last */
1374 __NL80211_STA_BSS_PARAM_AFTER_LAST,
1375 NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1
1376};
1377
1378/**
1123 * enum nl80211_sta_info - station information 1379 * enum nl80211_sta_info - station information
1124 * 1380 *
1125 * These attribute types are used with %NL80211_ATTR_STA_INFO 1381 * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -1129,16 +1385,26 @@ enum nl80211_rate_info {
1129 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) 1385 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
1130 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) 1386 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
1131 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 1387 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
1132 * @__NL80211_STA_INFO_AFTER_LAST: internal
1133 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1134 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) 1388 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
1135 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute 1389 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
1136 * containing info as possible, see &enum nl80211_sta_info_txrate. 1390 * containing info as possible, see &enum nl80211_rate_info
1137 * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) 1391 * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
1138 * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this 1392 * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
1139 * station) 1393 * station)
1140 * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) 1394 * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)
1141 * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) 1395 * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)
1396 * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)
1397 * @NL80211_STA_INFO_LLID: the station's mesh LLID
1398 * @NL80211_STA_INFO_PLID: the station's mesh PLID
1399 * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station
1400 * (see %enum nl80211_plink_state)
1401 * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested
1402 * attribute, like NL80211_STA_INFO_TX_BITRATE.
1403 * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
1404 * containing info as possible, see &enum nl80211_sta_bss_param
1405 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1406 * @__NL80211_STA_INFO_AFTER_LAST: internal
1407 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1142 */ 1408 */
1143enum nl80211_sta_info { 1409enum nl80211_sta_info {
1144 __NL80211_STA_INFO_INVALID, 1410 __NL80211_STA_INFO_INVALID,
@@ -1154,6 +1420,10 @@ enum nl80211_sta_info {
1154 NL80211_STA_INFO_TX_PACKETS, 1420 NL80211_STA_INFO_TX_PACKETS,
1155 NL80211_STA_INFO_TX_RETRIES, 1421 NL80211_STA_INFO_TX_RETRIES,
1156 NL80211_STA_INFO_TX_FAILED, 1422 NL80211_STA_INFO_TX_FAILED,
1423 NL80211_STA_INFO_SIGNAL_AVG,
1424 NL80211_STA_INFO_RX_BITRATE,
1425 NL80211_STA_INFO_BSS_PARAM,
1426 NL80211_STA_INFO_CONNECTED_TIME,
1157 1427
1158 /* keep last */ 1428 /* keep last */
1159 __NL80211_STA_INFO_AFTER_LAST, 1429 __NL80211_STA_INFO_AFTER_LAST,
@@ -1307,7 +1577,11 @@ enum nl80211_bitrate_attr {
1307 * wireless core it thinks its knows the regulatory domain we should be in. 1577 * wireless core it thinks its knows the regulatory domain we should be in.
1308 * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 1578 * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an
1309 * 802.11 country information element with regulatory information it 1579 * 802.11 country information element with regulatory information it
1310 * thinks we should consider. 1580 * thinks we should consider. cfg80211 only processes the country
1581 * code from the IE, and relies on the regulatory domain information
1582 * structure passed by userspace (CRDA) from our wireless-regdb.
1583 * If a channel is enabled but the country code indicates it should
1584 * be disabled we disable the channel and re-enable it upon disassociation.
1311 */ 1585 */
1312enum nl80211_reg_initiator { 1586enum nl80211_reg_initiator {
1313 NL80211_REGDOM_SET_BY_CORE, 1587 NL80211_REGDOM_SET_BY_CORE,
@@ -1476,14 +1750,15 @@ enum nl80211_mntr_flags {
1476/** 1750/**
1477 * enum nl80211_meshconf_params - mesh configuration parameters 1751 * enum nl80211_meshconf_params - mesh configuration parameters
1478 * 1752 *
1479 * Mesh configuration parameters 1753 * Mesh configuration parameters. These can be changed while the mesh is
1754 * active.
1480 * 1755 *
1481 * @__NL80211_MESHCONF_INVALID: internal use 1756 * @__NL80211_MESHCONF_INVALID: internal use
1482 * 1757 *
1483 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in 1758 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
1484 * millisecond units, used by the Peer Link Open message 1759 * millisecond units, used by the Peer Link Open message
1485 * 1760 *
1486 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in 1761 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in
1487 * millisecond units, used by the peer link management to close a peer link 1762 * millisecond units, used by the peer link management to close a peer link
1488 * 1763 *
1489 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in 1764 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
@@ -1523,7 +1798,10 @@ enum nl80211_mntr_flags {
1523 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) 1798 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
1524 * that it takes for an HWMP information element to propagate across the mesh 1799 * that it takes for an HWMP information element to propagate across the mesh
1525 * 1800 *
1526 * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not 1801 * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not
1802 *
1803 * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
1804 * source mesh point for path selection elements.
1527 * 1805 *
1528 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 1806 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
1529 * 1807 *
@@ -1545,6 +1823,7 @@ enum nl80211_meshconf_params {
1545 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 1823 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
1546 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 1824 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
1547 NL80211_MESHCONF_HWMP_ROOTMODE, 1825 NL80211_MESHCONF_HWMP_ROOTMODE,
1826 NL80211_MESHCONF_ELEMENT_TTL,
1548 1827
1549 /* keep last */ 1828 /* keep last */
1550 __NL80211_MESHCONF_ATTR_AFTER_LAST, 1829 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -1552,6 +1831,54 @@ enum nl80211_meshconf_params {
1552}; 1831};
1553 1832
1554/** 1833/**
1834 * enum nl80211_mesh_setup_params - mesh setup parameters
1835 *
1836 * Mesh setup parameters. These are used to start/join a mesh and cannot be
1837 * changed while the mesh is active.
1838 *
1839 * @__NL80211_MESH_SETUP_INVALID: Internal use
1840 *
1841 * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a
1842 * vendor specific path selection algorithm or disable it to use the default
1843 * HWMP.
1844 *
1845 * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a
1846 * vendor specific path metric or disable it to use the default Airtime
1847 * metric.
1848 *
1849 * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
1850 * robust security network ie, or a vendor specific information element that
1851 * vendors will use to identify the path selection methods and metrics in use.
1852 *
1853 * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication
1854 * daemon will be authenticating mesh candidates.
1855 *
1856 * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication
1857 * daemon will be securing peer link frames. AMPE is a secured version of Mesh
1858 * Peering Management (MPM) and is implemented with the assistance of a
1859 * userspace daemon. When this flag is set, the kernel will send peer
1860 * management frames to a userspace daemon that will implement AMPE
1861 * functionality (security capabilities selection, key confirmation, and key
1862 * management). When the flag is unset (default), the kernel can autonomously
1863 * complete (unsecured) mesh peering without the need of a userspace daemon.
1864 *
1865 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
1866 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
1867 */
1868enum nl80211_mesh_setup_params {
1869 __NL80211_MESH_SETUP_INVALID,
1870 NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
1871 NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
1872 NL80211_MESH_SETUP_IE,
1873 NL80211_MESH_SETUP_USERSPACE_AUTH,
1874 NL80211_MESH_SETUP_USERSPACE_AMPE,
1875
1876 /* keep last */
1877 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
1878 NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1
1879};
1880
1881/**
1555 * enum nl80211_txq_attr - TX queue parameter attributes 1882 * enum nl80211_txq_attr - TX queue parameter attributes
1556 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved 1883 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
1557 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) 1884 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
@@ -1709,6 +2036,23 @@ enum nl80211_wpa_versions {
1709}; 2036};
1710 2037
1711/** 2038/**
2039 * enum nl80211_key_default_types - key default types
2040 * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid
2041 * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default
2042 * unicast key
2043 * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default
2044 * multicast key
2045 * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types
2046 */
2047enum nl80211_key_default_types {
2048 __NL80211_KEY_DEFAULT_TYPE_INVALID,
2049 NL80211_KEY_DEFAULT_TYPE_UNICAST,
2050 NL80211_KEY_DEFAULT_TYPE_MULTICAST,
2051
2052 NUM_NL80211_KEY_DEFAULT_TYPES
2053};
2054
2055/**
1712 * enum nl80211_key_attributes - key attributes 2056 * enum nl80211_key_attributes - key attributes
1713 * @__NL80211_KEY_INVALID: invalid 2057 * @__NL80211_KEY_INVALID: invalid
1714 * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of 2058 * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of
@@ -1724,6 +2068,9 @@ enum nl80211_wpa_versions {
1724 * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not 2068 * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not
1725 * specified the default depends on whether a MAC address was 2069 * specified the default depends on whether a MAC address was
1726 * given with the command using the key or not (u32) 2070 * given with the command using the key or not (u32)
2071 * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags
2072 * attributes, specifying what a key should be set as default as.
2073 * See &enum nl80211_key_default_types.
1727 * @__NL80211_KEY_AFTER_LAST: internal 2074 * @__NL80211_KEY_AFTER_LAST: internal
1728 * @NL80211_KEY_MAX: highest key attribute 2075 * @NL80211_KEY_MAX: highest key attribute
1729 */ 2076 */
@@ -1736,6 +2083,7 @@ enum nl80211_key_attributes {
1736 NL80211_KEY_DEFAULT, 2083 NL80211_KEY_DEFAULT,
1737 NL80211_KEY_DEFAULT_MGMT, 2084 NL80211_KEY_DEFAULT_MGMT,
1738 NL80211_KEY_TYPE, 2085 NL80211_KEY_TYPE,
2086 NL80211_KEY_DEFAULT_TYPES,
1739 2087
1740 /* keep last */ 2088 /* keep last */
1741 __NL80211_KEY_AFTER_LAST, 2089 __NL80211_KEY_AFTER_LAST,
@@ -1786,6 +2134,8 @@ enum nl80211_ps_state {
1786 * the minimum amount the RSSI level must change after an event before a 2134 * the minimum amount the RSSI level must change after an event before a
1787 * new event may be issued (to reduce effects of RSSI oscillation). 2135 * new event may be issued (to reduce effects of RSSI oscillation).
1788 * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event 2136 * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
2137 * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many
2138 * consecutive packets were not acknowledged by the peer
1789 * @__NL80211_ATTR_CQM_AFTER_LAST: internal 2139 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
1790 * @NL80211_ATTR_CQM_MAX: highest key attribute 2140 * @NL80211_ATTR_CQM_MAX: highest key attribute
1791 */ 2141 */
@@ -1794,6 +2144,7 @@ enum nl80211_attr_cqm {
1794 NL80211_ATTR_CQM_RSSI_THOLD, 2144 NL80211_ATTR_CQM_RSSI_THOLD,
1795 NL80211_ATTR_CQM_RSSI_HYST, 2145 NL80211_ATTR_CQM_RSSI_HYST,
1796 NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, 2146 NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
2147 NL80211_ATTR_CQM_PKT_LOSS_EVENT,
1797 2148
1798 /* keep last */ 2149 /* keep last */
1799 __NL80211_ATTR_CQM_AFTER_LAST, 2150 __NL80211_ATTR_CQM_AFTER_LAST,
@@ -1825,4 +2176,189 @@ enum nl80211_tx_power_setting {
1825 NL80211_TX_POWER_FIXED, 2176 NL80211_TX_POWER_FIXED,
1826}; 2177};
1827 2178
2179/**
2180 * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
2181 * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
2182 * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has
2183 * a zero bit are ignored
2184 * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have
2185 * a bit for each byte in the pattern. The lowest-order bit corresponds
2186 * to the first byte of the pattern, but the bytes of the pattern are
2187 * in a little-endian-like format, i.e. the 9th byte of the pattern
2188 * corresponds to the lowest-order bit in the second byte of the mask.
2189 * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
2190 * xx indicates "don't care") would be represented by a pattern of
2191 * twelve zero bytes, and a mask of "0xed,0x07".
2192 * Note that the pattern matching is done as though frames were not
2193 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
2194 * first (including SNAP header unpacking) and then matched.
2195 * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
2196 * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
2197 */
2198enum nl80211_wowlan_packet_pattern_attr {
2199 __NL80211_WOWLAN_PKTPAT_INVALID,
2200 NL80211_WOWLAN_PKTPAT_MASK,
2201 NL80211_WOWLAN_PKTPAT_PATTERN,
2202
2203 NUM_NL80211_WOWLAN_PKTPAT,
2204 MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
2205};
2206
2207/**
2208 * struct nl80211_wowlan_pattern_support - pattern support information
2209 * @max_patterns: maximum number of patterns supported
2210 * @min_pattern_len: minimum length of each pattern
2211 * @max_pattern_len: maximum length of each pattern
2212 *
2213 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
2214 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
2215 * capability information given by the kernel to userspace.
2216 */
2217struct nl80211_wowlan_pattern_support {
2218 __u32 max_patterns;
2219 __u32 min_pattern_len;
2220 __u32 max_pattern_len;
2221} __attribute__((packed));
2222
2223/**
2224 * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
2225 * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
2226 * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
2227 * the chip into a special state -- works best with chips that have
2228 * support for low-power operation already (flag)
2229 * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
2230 * is detected is implementation-specific (flag)
2231 * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
2232 * by 16 repetitions of MAC addr, anywhere in payload) (flag)
2233 * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
2234 * which are passed in an array of nested attributes, each nested attribute
2235 * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
2236 * Each pattern defines a wakeup packet. The matching is done on the MSDU,
2237 * i.e. as though the packet was an 802.3 packet, so the pattern matching
2238 * is done after the packet is converted to the MSDU.
2239 *
2240 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
2241 * carrying a &struct nl80211_wowlan_pattern_support.
2242 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
2243 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
2244 */
2245enum nl80211_wowlan_triggers {
2246 __NL80211_WOWLAN_TRIG_INVALID,
2247 NL80211_WOWLAN_TRIG_ANY,
2248 NL80211_WOWLAN_TRIG_DISCONNECT,
2249 NL80211_WOWLAN_TRIG_MAGIC_PKT,
2250 NL80211_WOWLAN_TRIG_PKT_PATTERN,
2251
2252 /* keep last */
2253 NUM_NL80211_WOWLAN_TRIG,
2254 MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
2255};
2256
2257/**
2258 * enum nl80211_iface_limit_attrs - limit attributes
2259 * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
2260 * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
2261 * can be chosen from this set of interface types (u32)
2262 * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a
2263 * flag attribute for each interface type in this set
2264 * @NUM_NL80211_IFACE_LIMIT: number of attributes
2265 * @MAX_NL80211_IFACE_LIMIT: highest attribute number
2266 */
2267enum nl80211_iface_limit_attrs {
2268 NL80211_IFACE_LIMIT_UNSPEC,
2269 NL80211_IFACE_LIMIT_MAX,
2270 NL80211_IFACE_LIMIT_TYPES,
2271
2272 /* keep last */
2273 NUM_NL80211_IFACE_LIMIT,
2274 MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1
2275};
2276
2277/**
2278 * enum nl80211_if_combination_attrs -- interface combination attributes
2279 *
2280 * @NL80211_IFACE_COMB_UNSPEC: (reserved)
2281 * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits
2282 * for given interface types, see &enum nl80211_iface_limit_attrs.
2283 * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of
2284 * interfaces that can be created in this group. This number doesn't
2285 * apply to interfaces purely managed in software, which are listed
2286 * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE.
2287 * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that
2288 * beacon intervals within this group must be all the same even for
2289 * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt
2290 * the infrastructure network's beacon interval.
2291 * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
2292 * different channels may be used within this group.
2293 * @NUM_NL80211_IFACE_COMB: number of attributes
2294 * @MAX_NL80211_IFACE_COMB: highest attribute number
2295 *
2296 * Examples:
2297 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
2298 * => allows an AP and a STA that must match BIs
2299 *
2300 * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8
2301 * => allows 8 of AP/GO
2302 *
2303 * numbers = [ #{STA} <= 2 ], channels = 2, max = 2
2304 * => allows two STAs on different channels
2305 *
2306 * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
2307 * => allows a STA plus three P2P interfaces
2308 *
2309 * The list of these four possiblities could completely be contained
2310 * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
2311 * that any of these groups must match.
2312 *
2313 * "Combinations" of just a single interface will not be listed here,
2314 * a single interface of any valid interface type is assumed to always
2315 * be possible by itself. This means that implicitly, for each valid
2316 * interface type, the following group always exists:
2317 * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1
2318 */
2319enum nl80211_if_combination_attrs {
2320 NL80211_IFACE_COMB_UNSPEC,
2321 NL80211_IFACE_COMB_LIMITS,
2322 NL80211_IFACE_COMB_MAXNUM,
2323 NL80211_IFACE_COMB_STA_AP_BI_MATCH,
2324 NL80211_IFACE_COMB_NUM_CHANNELS,
2325
2326 /* keep last */
2327 NUM_NL80211_IFACE_COMB,
2328 MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1
2329};
2330
2331
2332/**
2333 * enum nl80211_plink_state - state of a mesh peer link finite state machine
2334 *
2335 * @NL80211_PLINK_LISTEN: initial state, considered the implicit
2336 * state of non existant mesh peer links
2337 * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to
2338 * this mesh peer
2339 * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received
2340 * from this mesh peer
2341 * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been
2342 * received from this mesh peer
2343 * @NL80211_PLINK_ESTAB: mesh peer link is established
2344 * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled
2345 * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh
2346 * plink are discarded
2347 * @NUM_NL80211_PLINK_STATES: number of peer link states
2348 * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states
2349 */
2350enum nl80211_plink_state {
2351 NL80211_PLINK_LISTEN,
2352 NL80211_PLINK_OPN_SNT,
2353 NL80211_PLINK_OPN_RCVD,
2354 NL80211_PLINK_CNF_RCVD,
2355 NL80211_PLINK_ESTAB,
2356 NL80211_PLINK_HOLDING,
2357 NL80211_PLINK_BLOCKED,
2358
2359 /* keep last */
2360 NUM_NL80211_PLINK_STATES,
2361 MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
2362};
2363
1828#endif /* __LINUX_NL80211_H */ 2364#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 06aab5eee134..c536f8545f74 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -14,22 +14,14 @@
14 * may be used to reset the timeout - for code which intentionally 14 * may be used to reset the timeout - for code which intentionally
15 * disables interrupts for a long time. This call is stateless. 15 * disables interrupts for a long time. This call is stateless.
16 */ 16 */
17#ifdef ARCH_HAS_NMI_WATCHDOG 17#if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
18#include <asm/nmi.h> 18#include <asm/nmi.h>
19extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
20extern void acpi_nmi_disable(void);
21extern void acpi_nmi_enable(void);
22#else 20#else
23#ifndef CONFIG_HARDLOCKUP_DETECTOR
24static inline void touch_nmi_watchdog(void) 21static inline void touch_nmi_watchdog(void)
25{ 22{
26 touch_softlockup_watchdog(); 23 touch_softlockup_watchdog();
27} 24}
28#else
29extern void touch_nmi_watchdog(void);
30#endif
31static inline void acpi_nmi_disable(void) { }
32static inline void acpi_nmi_enable(void) { }
33#endif 25#endif
34 26
35/* 27/*
diff --git a/include/linux/node.h b/include/linux/node.h
index 06292dac3eab..92370e22343c 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -10,11 +10,6 @@
10 * 10 *
11 * Nodes are exported via driverfs in the class/node/devices/ 11 * Nodes are exported via driverfs in the class/node/devices/
12 * directory. 12 * directory.
13 *
14 * Per-node interfaces can be implemented using a struct device_interface.
15 * See the following for how to do this:
16 * - drivers/base/intf.c
17 * - Documentation/driver-model/interface.txt
18 */ 13 */
19#ifndef _LINUX_NODE_H_ 14#ifndef _LINUX_NODE_H_
20#define _LINUX_NODE_H_ 15#define _LINUX_NODE_H_
@@ -44,7 +39,8 @@ extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
44extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); 39extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
45extern int register_mem_sect_under_node(struct memory_block *mem_blk, 40extern int register_mem_sect_under_node(struct memory_block *mem_blk,
46 int nid); 41 int nid);
47extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); 42extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
43 unsigned long phys_index);
48 44
49#ifdef CONFIG_HUGETLBFS 45#ifdef CONFIG_HUGETLBFS
50extern void register_hugetlbfs_with_node(node_registration_func_t doregister, 46extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
@@ -72,7 +68,8 @@ static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
72{ 68{
73 return 0; 69 return 0;
74} 70}
75static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) 71static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
72 unsigned long phys_index)
76{ 73{
77 return 0; 74 return 0;
78} 75}
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 2026f9e1ceb8..621dfa16acc0 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -237,7 +237,7 @@ static inline int notifier_to_errno(int ret)
237 * enabling interrupts. Must not sleep, 237 * enabling interrupts. Must not sleep,
238 * must not fail */ 238 * must not fail */
239 239
240/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 240/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
241 * operation in progress 241 * operation in progress
242 */ 242 */
243#define CPU_TASKS_FROZEN 0x0010 243#define CPU_TASKS_FROZEN 0x0010
diff --git a/include/linux/of.h b/include/linux/of.h
index cad7cf0ab278..bfc0ed1b0ced 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -23,8 +23,6 @@
23 23
24#include <asm/byteorder.h> 24#include <asm/byteorder.h>
25 25
26#ifdef CONFIG_OF
27
28typedef u32 phandle; 26typedef u32 phandle;
29typedef u32 ihandle; 27typedef u32 ihandle;
30 28
@@ -65,11 +63,18 @@ struct device_node {
65#endif 63#endif
66}; 64};
67 65
66#ifdef CONFIG_OF
67
68/* Pointer for first entry in chain of all nodes. */ 68/* Pointer for first entry in chain of all nodes. */
69extern struct device_node *allnodes; 69extern struct device_node *allnodes;
70extern struct device_node *of_chosen; 70extern struct device_node *of_chosen;
71extern rwlock_t devtree_lock; 71extern rwlock_t devtree_lock;
72 72
73static inline bool of_have_populated_dt(void)
74{
75 return allnodes != NULL;
76}
77
73static inline bool of_node_is_root(const struct device_node *node) 78static inline bool of_node_is_root(const struct device_node *node)
74{ 79{
75 return node && (node->parent == NULL); 80 return node && (node->parent == NULL);
@@ -103,7 +108,7 @@ extern void of_node_put(struct device_node *node);
103#endif 108#endif
104 109
105/* 110/*
106 * OF address retreival & translation 111 * OF address retrieval & translation
107 */ 112 */
108 113
109/* Helper to read a big number; size is in cells (not bytes) */ 114/* Helper to read a big number; size is in cells (not bytes) */
@@ -222,5 +227,12 @@ extern void of_attach_node(struct device_node *);
222extern void of_detach_node(struct device_node *); 227extern void of_detach_node(struct device_node *);
223#endif 228#endif
224 229
230#else
231
232static inline bool of_have_populated_dt(void)
233{
234 return false;
235}
236
225#endif /* CONFIG_OF */ 237#endif /* CONFIG_OF */
226#endif /* _LINUX_OF_H */ 238#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 8aea06f0564c..2feda6ee6140 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -3,7 +3,7 @@
3#include <linux/ioport.h> 3#include <linux/ioport.h>
4#include <linux/of.h> 4#include <linux/of.h>
5 5
6extern u64 of_translate_address(struct device_node *np, const u32 *addr); 6extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
7extern int of_address_to_resource(struct device_node *dev, int index, 7extern int of_address_to_resource(struct device_node *dev, int index,
8 struct resource *r); 8 struct resource *r);
9extern void __iomem *of_iomap(struct device_node *device, int index); 9extern void __iomem *of_iomap(struct device_node *device, int index);
@@ -21,7 +21,7 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
21#endif 21#endif
22 22
23#ifdef CONFIG_PCI 23#ifdef CONFIG_PCI
24extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, 24extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
25 u64 *size, unsigned int *flags); 25 u64 *size, unsigned int *flags);
26extern int of_pci_address_to_resource(struct device_node *dev, int bar, 26extern int of_pci_address_to_resource(struct device_node *dev, int bar,
27 struct resource *r); 27 struct resource *r);
@@ -32,7 +32,7 @@ static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
32 return -ENOSYS; 32 return -ENOSYS;
33} 33}
34 34
35static inline const u32 *of_get_pci_address(struct device_node *dev, 35static inline const __be32 *of_get_pci_address(struct device_node *dev,
36 int bar_no, u64 *size, unsigned int *flags) 36 int bar_no, u64 *size, unsigned int *flags)
37{ 37{
38 return NULL; 38 return NULL;
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347079d9..ae5638480ef2 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -18,7 +18,7 @@ extern void of_device_make_bus_id(struct device *dev);
18 * @drv: the device_driver structure to test 18 * @drv: the device_driver structure to test
19 * @dev: the device structure to match against 19 * @dev: the device structure to match against
20 */ 20 */
21static inline int of_driver_match_device(const struct device *dev, 21static inline int of_driver_match_device(struct device *dev,
22 const struct device_driver *drv) 22 const struct device_driver *drv)
23{ 23{
24 return of_match_device(drv->of_match_table, dev) != NULL; 24 return of_match_device(drv->of_match_table, dev) != NULL;
@@ -57,6 +57,11 @@ static inline int of_device_uevent(struct device *dev,
57 57
58static inline void of_device_node_put(struct device *dev) { } 58static inline void of_device_node_put(struct device *dev) { }
59 59
60static inline const struct of_device_id *of_match_device(
61 const struct of_device_id *matches, const struct device *dev)
62{
63 return NULL;
64}
60#endif /* CONFIG_OF_DEVICE */ 65#endif /* CONFIG_OF_DEVICE */
61 66
62#endif /* _LINUX_OF_DEVICE_H */ 67#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 7bbf5b328438..c84d900fbbb3 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -58,6 +58,23 @@ struct boot_param_header {
58}; 58};
59 59
60#if defined(CONFIG_OF_FLATTREE) 60#if defined(CONFIG_OF_FLATTREE)
61
62struct device_node;
63
64/* For scanning an arbitrary device-tree at any time */
65extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
66extern void *of_fdt_get_property(struct boot_param_header *blob,
67 unsigned long node,
68 const char *name,
69 unsigned long *size);
70extern int of_fdt_is_compatible(struct boot_param_header *blob,
71 unsigned long node,
72 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
74 const char **compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes);
77
61/* TBD: Temporary export of fdt globals - remove when code fully merged */ 78/* TBD: Temporary export of fdt globals - remove when code fully merged */
62extern int __initdata dt_root_addr_cells; 79extern int __initdata dt_root_addr_cells;
63extern int __initdata dt_root_size_cells; 80extern int __initdata dt_root_size_cells;
@@ -71,6 +88,7 @@ extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
71extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 88extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
72 unsigned long *size); 89 unsigned long *size);
73extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char **matches);
74extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
75 93
76extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
@@ -79,7 +97,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
79extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 97extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
80 int depth, void *data); 98 int depth, void *data);
81extern void early_init_dt_add_memory_arch(u64 base, u64 size); 99extern void early_init_dt_add_memory_arch(u64 base, u64 size);
82extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align); 100extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
83extern u64 dt_mem_next_cell(int s, __be32 **cellp); 101extern u64 dt_mem_next_cell(int s, __be32 **cellp);
84 102
85/* 103/*
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 109e013b1772..e6955f5d1f08 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -68,6 +68,7 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
68extern int of_irq_count(struct device_node *dev); 68extern int of_irq_count(struct device_node *dev);
69extern int of_irq_to_resource_table(struct device_node *dev, 69extern int of_irq_to_resource_table(struct device_node *dev,
70 struct resource *res, int nr_irqs); 70 struct resource *res, int nr_irqs);
71extern struct device_node *of_irq_find_parent(struct device_node *child);
71 72
72#endif /* CONFIG_OF_IRQ */ 73#endif /* CONFIG_OF_IRQ */
73#endif /* CONFIG_OF */ 74#endif /* CONFIG_OF */
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
new file mode 100644
index 000000000000..e913081fb52a
--- /dev/null
+++ b/include/linux/of_net.h
@@ -0,0 +1,15 @@
1/*
2 * OF helpers for network devices.
3 *
4 * This file is released under the GPLv2
5 */
6
7#ifndef __LINUX_OF_NET_H
8#define __LINUX_OF_NET_H
9
10#ifdef CONFIG_OF_NET
11#include <linux/of.h>
12extern const void *of_get_mac_address(struct device_node *np);
13#endif
14
15#endif /* __LINUX_OF_NET_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
new file mode 100644
index 000000000000..85a27b650d76
--- /dev/null
+++ b/include/linux/of_pci.h
@@ -0,0 +1,9 @@
1#ifndef __OF_PCI_H
2#define __OF_PCI_H
3
4#include <linux/pci.h>
5
6struct pci_dev;
7struct of_irq;
8int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
9#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716ad38ce..fb51ae38cea7 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -23,13 +23,7 @@
23 * of_platform_driver - Legacy of-aware driver for platform devices. 23 * of_platform_driver - Legacy of-aware driver for platform devices.
24 * 24 *
25 * An of_platform_driver driver is attached to a basic platform_device on 25 * An of_platform_driver driver is attached to a basic platform_device on
26 * ether the "platform bus" (platform_bus_type), or the ibm ebus 26 * the ibm ebus (ibmebus_bus_type).
27 * (ibmebus_bus_type).
28 *
29 * of_platform_driver is being phased out when used with the platform_bus_type,
30 * and regular platform_drivers should be used instead. When the transition
31 * is complete, only ibmebus will be using this structure, and the
32 * platform_driver member of this structure will be removed.
33 */ 27 */
34struct of_platform_driver 28struct of_platform_driver
35{ 29{
@@ -42,35 +36,22 @@ struct of_platform_driver
42 int (*shutdown)(struct platform_device* dev); 36 int (*shutdown)(struct platform_device* dev);
43 37
44 struct device_driver driver; 38 struct device_driver driver;
45 struct platform_driver platform_driver;
46}; 39};
47#define to_of_platform_driver(drv) \ 40#define to_of_platform_driver(drv) \
48 container_of(drv,struct of_platform_driver, driver) 41 container_of(drv,struct of_platform_driver, driver)
49 42
50extern int of_register_driver(struct of_platform_driver *drv,
51 struct bus_type *bus);
52extern void of_unregister_driver(struct of_platform_driver *drv);
53
54/* Platform drivers register/unregister */ 43/* Platform drivers register/unregister */
55extern int of_register_platform_driver(struct of_platform_driver *drv);
56extern void of_unregister_platform_driver(struct of_platform_driver *drv);
57
58extern struct platform_device *of_device_alloc(struct device_node *np, 44extern struct platform_device *of_device_alloc(struct device_node *np,
59 const char *bus_id, 45 const char *bus_id,
60 struct device *parent); 46 struct device *parent);
61extern struct platform_device *of_find_device_by_node(struct device_node *np); 47extern struct platform_device *of_find_device_by_node(struct device_node *np);
62 48
63extern int of_bus_type_init(struct bus_type *bus, const char *name);
64
65#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ 49#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
66/* Platform devices and busses creation */ 50/* Platform devices and busses creation */
67extern struct platform_device *of_platform_device_create(struct device_node *np, 51extern struct platform_device *of_platform_device_create(struct device_node *np,
68 const char *bus_id, 52 const char *bus_id,
69 struct device *parent); 53 struct device *parent);
70 54
71/* pseudo "matches" value to not do deep probe */
72#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
73
74extern int of_platform_bus_probe(struct device_node *root, 55extern int of_platform_bus_probe(struct device_node *root,
75 const struct of_device_id *matches, 56 const struct of_device_id *matches,
76 struct device *parent); 57 struct device *parent);
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h
new file mode 100644
index 000000000000..b6111f8cd49a
--- /dev/null
+++ b/include/linux/omap3isp.h
@@ -0,0 +1,646 @@
1/*
2 * omap3isp.h
3 *
4 * TI OMAP3 ISP - User-space API
5 *
6 * Copyright (C) 2010 Nokia Corporation
7 * Copyright (C) 2009 Texas Instruments, Inc.
8 *
9 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 * Sakari Ailus <sakari.ailus@iki.fi>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 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
24 * 02110-1301 USA
25 */
26
27#ifndef OMAP3_ISP_USER_H
28#define OMAP3_ISP_USER_H
29
30#include <linux/types.h>
31
32/*
33 * Private IOCTLs
34 *
35 * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
36 * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
37 * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
38 * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
39 * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
40 * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
41 * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
42 */
43
44#define VIDIOC_OMAP3ISP_CCDC_CFG \
45 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
46#define VIDIOC_OMAP3ISP_PRV_CFG \
47 _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
48#define VIDIOC_OMAP3ISP_AEWB_CFG \
49 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
50#define VIDIOC_OMAP3ISP_HIST_CFG \
51 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
52#define VIDIOC_OMAP3ISP_AF_CFG \
53 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
54#define VIDIOC_OMAP3ISP_STAT_REQ \
55 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
56#define VIDIOC_OMAP3ISP_STAT_EN \
57 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
58
59/*
60 * Events
61 *
62 * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
63 * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
64 * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
65 * V4L2_EVENT_OMAP3ISP_HS_VS: Horizontal/vertical synchronization detected
66 */
67
68#define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100)
69#define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
70#define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
71#define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
72#define V4L2_EVENT_OMAP3ISP_HS_VS (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
73
74struct omap3isp_stat_event_status {
75 __u32 frame_number;
76 __u16 config_counter;
77 __u8 buf_err;
78};
79
80/* AE/AWB related structures and flags*/
81
82/* H3A Range Constants */
83#define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023
84#define OMAP3ISP_AEWB_MIN_WIN_H 2
85#define OMAP3ISP_AEWB_MAX_WIN_H 256
86#define OMAP3ISP_AEWB_MIN_WIN_W 6
87#define OMAP3ISP_AEWB_MAX_WIN_W 256
88#define OMAP3ISP_AEWB_MIN_WINVC 1
89#define OMAP3ISP_AEWB_MIN_WINHC 1
90#define OMAP3ISP_AEWB_MAX_WINVC 128
91#define OMAP3ISP_AEWB_MAX_WINHC 36
92#define OMAP3ISP_AEWB_MAX_WINSTART 4095
93#define OMAP3ISP_AEWB_MIN_SUB_INC 2
94#define OMAP3ISP_AEWB_MAX_SUB_INC 32
95#define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600
96
97#define OMAP3ISP_AF_IIRSH_MIN 0
98#define OMAP3ISP_AF_IIRSH_MAX 4095
99#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1
100#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36
101#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1
102#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128
103#define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2
104#define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32
105#define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2
106#define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256
107#define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16
108#define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256
109#define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1
110#define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095
111#define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0
112#define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095
113#define OMAP3ISP_AF_THRESHOLD_MAX 255
114#define OMAP3ISP_AF_COEF_MAX 4095
115#define OMAP3ISP_AF_PAXEL_SIZE 48
116#define OMAP3ISP_AF_MAX_BUF_SIZE 221184
117
118/**
119 * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
120 * saturation_limit: Saturation limit.
121 * @win_height: Window Height. Range 2 - 256, even values only.
122 * @win_width: Window Width. Range 6 - 256, even values only.
123 * @ver_win_count: Vertical Window Count. Range 1 - 128.
124 * @hor_win_count: Horizontal Window Count. Range 1 - 36.
125 * @ver_win_start: Vertical Window Start. Range 0 - 4095.
126 * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
127 * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
128 * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
129 * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
130 * values only.
131 * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
132 * values only.
133 * @alaw_enable: AEW ALAW EN flag.
134 */
135struct omap3isp_h3a_aewb_config {
136 /*
137 * Common fields.
138 * They should be the first ones and must be in the same order as in
139 * ispstat_generic_config struct.
140 */
141 __u32 buf_size;
142 __u16 config_counter;
143
144 /* Private fields */
145 __u16 saturation_limit;
146 __u16 win_height;
147 __u16 win_width;
148 __u16 ver_win_count;
149 __u16 hor_win_count;
150 __u16 ver_win_start;
151 __u16 hor_win_start;
152 __u16 blk_ver_win_start;
153 __u16 blk_win_height;
154 __u16 subsample_ver_inc;
155 __u16 subsample_hor_inc;
156 __u8 alaw_enable;
157};
158
159/**
160 * struct omap3isp_stat_data - Statistic data sent to or received from user
161 * @ts: Timestamp of returned framestats.
162 * @buf: Pointer to pass to user.
163 * @frame_number: Frame number of requested stats.
164 * @cur_frame: Current frame number being processed.
165 * @config_counter: Number of the configuration associated with the data.
166 */
167struct omap3isp_stat_data {
168 struct timeval ts;
169 void __user *buf;
170 __u32 buf_size;
171 __u16 frame_number;
172 __u16 cur_frame;
173 __u16 config_counter;
174};
175
176
177/* Histogram related structs */
178
179/* Flags for number of bins */
180#define OMAP3ISP_HIST_BINS_32 0
181#define OMAP3ISP_HIST_BINS_64 1
182#define OMAP3ISP_HIST_BINS_128 2
183#define OMAP3ISP_HIST_BINS_256 3
184
185/* Number of bins * 4 colors * 4-bytes word */
186#define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4)
187
188#define OMAP3ISP_HIST_MEM_SIZE 1024
189#define OMAP3ISP_HIST_MIN_REGIONS 1
190#define OMAP3ISP_HIST_MAX_REGIONS 4
191#define OMAP3ISP_HIST_MAX_WB_GAIN 255
192#define OMAP3ISP_HIST_MIN_WB_GAIN 0
193#define OMAP3ISP_HIST_MAX_BIT_WIDTH 14
194#define OMAP3ISP_HIST_MIN_BIT_WIDTH 8
195#define OMAP3ISP_HIST_MAX_WG 4
196#define OMAP3ISP_HIST_MAX_BUF_SIZE 4096
197
198/* Source */
199#define OMAP3ISP_HIST_SOURCE_CCDC 0
200#define OMAP3ISP_HIST_SOURCE_MEM 1
201
202/* CFA pattern */
203#define OMAP3ISP_HIST_CFA_BAYER 0
204#define OMAP3ISP_HIST_CFA_FOVEONX3 1
205
206struct omap3isp_hist_region {
207 __u16 h_start;
208 __u16 h_end;
209 __u16 v_start;
210 __u16 v_end;
211};
212
213struct omap3isp_hist_config {
214 /*
215 * Common fields.
216 * They should be the first ones and must be in the same order as in
217 * ispstat_generic_config struct.
218 */
219 __u32 buf_size;
220 __u16 config_counter;
221
222 __u8 num_acc_frames; /* Num of image frames to be processed and
223 accumulated for each histogram frame */
224 __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */
225 __u8 cfa; /* BAYER or FOVEON X3 */
226 __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */
227 __u8 num_regions; /* number of regions to be configured */
228 struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
229};
230
231/* Auto Focus related structs */
232
233#define OMAP3ISP_AF_NUM_COEF 11
234
235enum omap3isp_h3a_af_fvmode {
236 OMAP3ISP_AF_MODE_SUMMED = 0,
237 OMAP3ISP_AF_MODE_PEAK = 1
238};
239
240/* Red, Green, and blue pixel location in the AF windows */
241enum omap3isp_h3a_af_rgbpos {
242 OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */
243 OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */
244 OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */
245 OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */
246 OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */
247 OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */
248};
249
250/* Contains the information regarding the Horizontal Median Filter */
251struct omap3isp_h3a_af_hmf {
252 __u8 enable; /* Status of Horizontal Median Filter */
253 __u8 threshold; /* Threshold Value for Horizontal Median Filter */
254};
255
256/* Contains the information regarding the IIR Filters */
257struct omap3isp_h3a_af_iir {
258 __u16 h_start; /* IIR horizontal start */
259 __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */
260 __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */
261};
262
263/* Contains the information regarding the Paxels Structure in AF Engine */
264struct omap3isp_h3a_af_paxel {
265 __u16 h_start; /* Horizontal Start Position */
266 __u16 v_start; /* Vertical Start Position */
267 __u8 width; /* Width of the Paxel */
268 __u8 height; /* Height of the Paxel */
269 __u8 h_cnt; /* Horizontal Count */
270 __u8 v_cnt; /* vertical Count */
271 __u8 line_inc; /* Line Increment */
272};
273
274/* Contains the parameters required for hardware set up of AF Engine */
275struct omap3isp_h3a_af_config {
276 /*
277 * Common fields.
278 * They should be the first ones and must be in the same order as in
279 * ispstat_generic_config struct.
280 */
281 __u32 buf_size;
282 __u16 config_counter;
283
284 struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */
285 struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */
286 struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */
287 enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */
288 enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */
289 __u8 alaw_enable; /* AF ALAW status */
290};
291
292/* ISP CCDC structs */
293
294/* Abstraction layer CCDC configurations */
295#define OMAP3ISP_CCDC_ALAW (1 << 0)
296#define OMAP3ISP_CCDC_LPF (1 << 1)
297#define OMAP3ISP_CCDC_BLCLAMP (1 << 2)
298#define OMAP3ISP_CCDC_BCOMP (1 << 3)
299#define OMAP3ISP_CCDC_FPC (1 << 4)
300#define OMAP3ISP_CCDC_CULL (1 << 5)
301#define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7)
302#define OMAP3ISP_CCDC_TBL_LSC (1 << 8)
303
304#define OMAP3ISP_RGB_MAX 3
305
306/* Enumeration constants for Alaw input width */
307enum omap3isp_alaw_ipwidth {
308 OMAP3ISP_ALAW_BIT12_3 = 0x3,
309 OMAP3ISP_ALAW_BIT11_2 = 0x4,
310 OMAP3ISP_ALAW_BIT10_1 = 0x5,
311 OMAP3ISP_ALAW_BIT9_0 = 0x6
312};
313
314/**
315 * struct omap3isp_ccdc_lsc_config - LSC configuration
316 * @offset: Table Offset of the gain table.
317 * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
318 * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
319 * @gain_format: Gain table format.
320 * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
321 * @fmtlnh: Number of pixels in horizontal direction to use for the data
322 * reformatter.
323 * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
324 * @fmtlnv: Number of lines in vertical direction for the data reformatter.
325 * @initial_x: X position, in pixels, of the first active pixel in reference
326 * to the first active paxel. Must be an even number.
327 * @initial_y: Y position, in pixels, of the first active pixel in reference
328 * to the first active paxel. Must be an even number.
329 * @size: Size of LSC gain table. Filled when loaded from userspace.
330 */
331struct omap3isp_ccdc_lsc_config {
332 __u16 offset;
333 __u8 gain_mode_n;
334 __u8 gain_mode_m;
335 __u8 gain_format;
336 __u16 fmtsph;
337 __u16 fmtlnh;
338 __u16 fmtslv;
339 __u16 fmtlnv;
340 __u8 initial_x;
341 __u8 initial_y;
342 __u32 size;
343};
344
345/**
346 * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
347 * @obgain: Optical black average gain.
348 * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
349 * @oblines: Optical Black Sample lines.
350 * @oblen: Optical Black Sample Length.
351 * @dcsubval: Digital Black Clamp subtract value.
352 */
353struct omap3isp_ccdc_bclamp {
354 __u8 obgain;
355 __u8 obstpixel;
356 __u8 oblines;
357 __u8 oblen;
358 __u16 dcsubval;
359};
360
361/**
362 * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
363 * @fpnum: Number of faulty pixels to be corrected in the frame.
364 * @fpcaddr: Memory address of the FPC Table
365 */
366struct omap3isp_ccdc_fpc {
367 __u16 fpnum;
368 __u32 fpcaddr;
369};
370
371/**
372 * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
373 * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
374 * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
375 * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
376 * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
377 */
378struct omap3isp_ccdc_blcomp {
379 __u8 b_mg;
380 __u8 gb_g;
381 __u8 gr_cy;
382 __u8 r_ye;
383};
384
385/**
386 * omap3isp_ccdc_culling - Culling parameters
387 * @v_pattern: Vertical culling pattern.
388 * @h_odd: Horizontal Culling pattern for odd lines.
389 * @h_even: Horizontal Culling pattern for even lines.
390 */
391struct omap3isp_ccdc_culling {
392 __u8 v_pattern;
393 __u16 h_odd;
394 __u16 h_even;
395};
396
397/**
398 * omap3isp_ccdc_update_config - CCDC configuration
399 * @update: Specifies which CCDC registers should be updated.
400 * @flag: Specifies which CCDC functions should be enabled.
401 * @alawip: Enable/Disable A-Law compression.
402 * @bclamp: Black clamp control register.
403 * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
404 * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
405 * @cull: Cull control register.
406 * @lsc: Pointer to LSC gain table.
407 */
408struct omap3isp_ccdc_update_config {
409 __u16 update;
410 __u16 flag;
411 enum omap3isp_alaw_ipwidth alawip;
412 struct omap3isp_ccdc_bclamp __user *bclamp;
413 struct omap3isp_ccdc_blcomp __user *blcomp;
414 struct omap3isp_ccdc_fpc __user *fpc;
415 struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
416 struct omap3isp_ccdc_culling __user *cull;
417 __u8 __user *lsc;
418};
419
420/* Preview configurations */
421#define OMAP3ISP_PREV_LUMAENH (1 << 0)
422#define OMAP3ISP_PREV_INVALAW (1 << 1)
423#define OMAP3ISP_PREV_HRZ_MED (1 << 2)
424#define OMAP3ISP_PREV_CFA (1 << 3)
425#define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4)
426#define OMAP3ISP_PREV_WB (1 << 5)
427#define OMAP3ISP_PREV_BLKADJ (1 << 6)
428#define OMAP3ISP_PREV_RGB2RGB (1 << 7)
429#define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
430#define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
431#define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
432#define OMAP3ISP_PREV_GAMMABYPASS (1 << 11)
433#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
434#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
435#define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
436#define OMAP3ISP_PREV_NF (1 << 15)
437#define OMAP3ISP_PREV_GAMMA (1 << 16)
438
439#define OMAP3ISP_PREV_NF_TBL_SIZE 64
440#define OMAP3ISP_PREV_CFA_TBL_SIZE 576
441#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
442#define OMAP3ISP_PREV_YENH_TBL_SIZE 128
443
444#define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4
445
446/**
447 * struct omap3isp_prev_hmed - Horizontal Median Filter
448 * @odddist: Distance between consecutive pixels of same color in the odd line.
449 * @evendist: Distance between consecutive pixels of same color in the even
450 * line.
451 * @thres: Horizontal median filter threshold.
452 */
453struct omap3isp_prev_hmed {
454 __u8 odddist;
455 __u8 evendist;
456 __u8 thres;
457};
458
459/*
460 * Enumeration for CFA Formats supported by preview
461 */
462enum omap3isp_cfa_fmt {
463 OMAP3ISP_CFAFMT_BAYER,
464 OMAP3ISP_CFAFMT_SONYVGA,
465 OMAP3ISP_CFAFMT_RGBFOVEON,
466 OMAP3ISP_CFAFMT_DNSPL,
467 OMAP3ISP_CFAFMT_HONEYCOMB,
468 OMAP3ISP_CFAFMT_RRGGBBFOVEON
469};
470
471/**
472 * struct omap3isp_prev_cfa - CFA Interpolation
473 * @format: CFA Format Enum value supported by preview.
474 * @gradthrs_vert: CFA Gradient Threshold - Vertical.
475 * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
476 * @table: Pointer to the CFA table.
477 */
478struct omap3isp_prev_cfa {
479 enum omap3isp_cfa_fmt format;
480 __u8 gradthrs_vert;
481 __u8 gradthrs_horz;
482 __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE];
483};
484
485/**
486 * struct omap3isp_prev_csup - Chrominance Suppression
487 * @gain: Gain.
488 * @thres: Threshold.
489 * @hypf_en: Flag to enable/disable the High Pass Filter.
490 */
491struct omap3isp_prev_csup {
492 __u8 gain;
493 __u8 thres;
494 __u8 hypf_en;
495};
496
497/**
498 * struct omap3isp_prev_wbal - White Balance
499 * @dgain: Digital gain (U10Q8).
500 * @coef3: White balance gain - COEF 3 (U8Q5).
501 * @coef2: White balance gain - COEF 2 (U8Q5).
502 * @coef1: White balance gain - COEF 1 (U8Q5).
503 * @coef0: White balance gain - COEF 0 (U8Q5).
504 */
505struct omap3isp_prev_wbal {
506 __u16 dgain;
507 __u8 coef3;
508 __u8 coef2;
509 __u8 coef1;
510 __u8 coef0;
511};
512
513/**
514 * struct omap3isp_prev_blkadj - Black Level Adjustment
515 * @red: Black level offset adjustment for Red in 2's complement format
516 * @green: Black level offset adjustment for Green in 2's complement format
517 * @blue: Black level offset adjustment for Blue in 2's complement format
518 */
519struct omap3isp_prev_blkadj {
520 /*Black level offset adjustment for Red in 2's complement format */
521 __u8 red;
522 /*Black level offset adjustment for Green in 2's complement format */
523 __u8 green;
524 /* Black level offset adjustment for Blue in 2's complement format */
525 __u8 blue;
526};
527
528/**
529 * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
530 * @matrix: Blending values(S12Q8 format)
531 * [RR] [GR] [BR]
532 * [RG] [GG] [BG]
533 * [RB] [GB] [BB]
534 * @offset: Blending offset value for R,G,B in 2's complement integer format.
535 */
536struct omap3isp_prev_rgbtorgb {
537 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
538 __u16 offset[OMAP3ISP_RGB_MAX];
539};
540
541/**
542 * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
543 * @matrix: Color space conversion coefficients(S10Q8)
544 * [CSCRY] [CSCGY] [CSCBY]
545 * [CSCRCB] [CSCGCB] [CSCBCB]
546 * [CSCRCR] [CSCGCR] [CSCBCR]
547 * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
548 */
549struct omap3isp_prev_csc {
550 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
551 __s16 offset[OMAP3ISP_RGB_MAX];
552};
553
554/**
555 * struct omap3isp_prev_yclimit - Y, C Value Limit
556 * @minC: Minimum C value
557 * @maxC: Maximum C value
558 * @minY: Minimum Y value
559 * @maxY: Maximum Y value
560 */
561struct omap3isp_prev_yclimit {
562 __u8 minC;
563 __u8 maxC;
564 __u8 minY;
565 __u8 maxY;
566};
567
568/**
569 * struct omap3isp_prev_dcor - Defect correction
570 * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
571 * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
572 */
573struct omap3isp_prev_dcor {
574 __u8 couplet_mode_en;
575 __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
576};
577
578/**
579 * struct omap3isp_prev_nf - Noise Filter
580 * @spread: Spread value to be used in Noise Filter
581 * @table: Pointer to the Noise Filter table
582 */
583struct omap3isp_prev_nf {
584 __u8 spread;
585 __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
586};
587
588/**
589 * struct omap3isp_prev_gtables - Gamma correction tables
590 * @red: Array for red gamma table.
591 * @green: Array for green gamma table.
592 * @blue: Array for blue gamma table.
593 */
594struct omap3isp_prev_gtables {
595 __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
596 __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
597 __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
598};
599
600/**
601 * struct omap3isp_prev_luma - Luma enhancement
602 * @table: Array for luma enhancement table.
603 */
604struct omap3isp_prev_luma {
605 __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
606};
607
608/**
609 * struct omap3isp_prev_update_config - Preview engine configuration (user)
610 * @update: Specifies which ISP Preview registers should be updated.
611 * @flag: Specifies which ISP Preview functions should be enabled.
612 * @shading_shift: 3bit value of shift used in shading compensation.
613 * @luma: Pointer to luma enhancement structure.
614 * @hmed: Pointer to structure containing the odd and even distance.
615 * between the pixels in the image along with the filter threshold.
616 * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
617 * format in the image, vertical and horizontal gradient threshold.
618 * @csup: Pointer to Structure for Chrominance Suppression coefficients.
619 * @wbal: Pointer to structure for White Balance.
620 * @blkadj: Pointer to structure for Black Adjustment.
621 * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
622 * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
623 * @yclimit: Pointer to structure for Y, C Value Limit.
624 * @dcor: Pointer to structure for defect correction.
625 * @nf: Pointer to structure for Noise Filter
626 * @gamma: Pointer to gamma structure.
627 */
628struct omap3isp_prev_update_config {
629 __u32 update;
630 __u32 flag;
631 __u32 shading_shift;
632 struct omap3isp_prev_luma __user *luma;
633 struct omap3isp_prev_hmed __user *hmed;
634 struct omap3isp_prev_cfa __user *cfa;
635 struct omap3isp_prev_csup __user *csup;
636 struct omap3isp_prev_wbal __user *wbal;
637 struct omap3isp_prev_blkadj __user *blkadj;
638 struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
639 struct omap3isp_prev_csc __user *csc;
640 struct omap3isp_prev_yclimit __user *yclimit;
641 struct omap3isp_prev_dcor __user *dcor;
642 struct omap3isp_prev_nf __user *nf;
643 struct omap3isp_prev_gtables __user *gamma;
644};
645
646#endif /* OMAP3_ISP_USER_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 32fb81212fd1..7f5cfd3b37dd 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -16,6 +16,8 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/errno.h>
20#include <linux/printk.h>
19#include <asm/atomic.h> 21#include <asm/atomic.h>
20 22
21/* Each escaped entry is prefixed by ESCAPE_CODE 23/* Each escaped entry is prefixed by ESCAPE_CODE
@@ -104,6 +106,13 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
104void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, 106void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
105 unsigned long event, int is_kernel); 107 unsigned long event, int is_kernel);
106 108
109/**
110 * Add an hardware sample.
111 */
112void oprofile_add_ext_hw_sample(unsigned long pc, struct pt_regs * const regs,
113 unsigned long event, int is_kernel,
114 struct task_struct *task);
115
107/* Use this instead when the PC value is not from the regs. Doesn't 116/* Use this instead when the PC value is not from the regs. Doesn't
108 * backtrace. */ 117 * backtrace. */
109void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); 118void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event);
@@ -186,10 +195,17 @@ int oprofile_add_data(struct op_entry *entry, unsigned long val);
186int oprofile_add_data64(struct op_entry *entry, u64 val); 195int oprofile_add_data64(struct op_entry *entry, u64 val);
187int oprofile_write_commit(struct op_entry *entry); 196int oprofile_write_commit(struct op_entry *entry);
188 197
189#ifdef CONFIG_PERF_EVENTS 198#ifdef CONFIG_HW_PERF_EVENTS
190int __init oprofile_perf_init(struct oprofile_operations *ops); 199int __init oprofile_perf_init(struct oprofile_operations *ops);
191void oprofile_perf_exit(void); 200void oprofile_perf_exit(void);
192char *op_name_from_perf_id(void); 201char *op_name_from_perf_id(void);
193#endif /* CONFIG_PERF_EVENTS */ 202#else
203static inline int __init oprofile_perf_init(struct oprofile_operations *ops)
204{
205 pr_info("oprofile: hardware counters not available\n");
206 return -ENODEV;
207}
208static inline void oprofile_perf_exit(void) { }
209#endif /* CONFIG_HW_PERF_EVENTS */
194 210
195#endif /* OPROFILE_H */ 211#endif /* OPROFILE_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5f38c460367e..811183de1ef5 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -48,9 +48,6 @@
48 * struct page (these bits with information) are always mapped into kernel 48 * struct page (these bits with information) are always mapped into kernel
49 * address space... 49 * address space...
50 * 50 *
51 * PG_buddy is set to indicate that the page is free and in the buddy system
52 * (see mm/page_alloc.c).
53 *
54 * PG_hwpoison indicates that a page got corrupted in hardware and contains 51 * 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 52 * 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! 53 * not safe since it may cause another machine check. Don't touch!
@@ -96,7 +93,6 @@ enum pageflags {
96 PG_swapcache, /* Swap page: swp_entry_t in private */ 93 PG_swapcache, /* Swap page: swp_entry_t in private */
97 PG_mappedtodisk, /* Has blocks allocated on-disk */ 94 PG_mappedtodisk, /* Has blocks allocated on-disk */
98 PG_reclaim, /* To be reclaimed asap */ 95 PG_reclaim, /* To be reclaimed asap */
99 PG_buddy, /* Page is free, on buddy lists */
100 PG_swapbacked, /* Page is backed by RAM/swap */ 96 PG_swapbacked, /* Page is backed by RAM/swap */
101 PG_unevictable, /* Page is "unevictable" */ 97 PG_unevictable, /* Page is "unevictable" */
102#ifdef CONFIG_MMU 98#ifdef CONFIG_MMU
@@ -108,6 +104,9 @@ enum pageflags {
108#ifdef CONFIG_MEMORY_FAILURE 104#ifdef CONFIG_MEMORY_FAILURE
109 PG_hwpoison, /* hardware poisoned page. Don't touch */ 105 PG_hwpoison, /* hardware poisoned page. Don't touch */
110#endif 106#endif
107#ifdef CONFIG_TRANSPARENT_HUGEPAGE
108 PG_compound_lock,
109#endif
111 __NR_PAGEFLAGS, 110 __NR_PAGEFLAGS,
112 111
113 /* Filesystems */ 112 /* Filesystems */
@@ -197,8 +196,8 @@ static inline int __TestClearPage##uname(struct page *page) { return 0; }
197 196
198struct page; /* forward declaration */ 197struct page; /* forward declaration */
199 198
200TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 199TESTPAGEFLAG(Locked, locked)
201PAGEFLAG(Error, error) 200PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
202PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 201PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
203PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
204PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 203PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
@@ -230,7 +229,6 @@ PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1)
230 * risky: they bypass page accounting. 229 * risky: they bypass page accounting.
231 */ 230 */
232TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback) 231TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
233__PAGEFLAG(Buddy, buddy)
234PAGEFLAG(MappedToDisk, mappedtodisk) 232PAGEFLAG(MappedToDisk, mappedtodisk)
235 233
236/* PG_readahead is only used for file reads; PG_reclaim is only for writes */ 234/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
@@ -344,7 +342,7 @@ static inline void set_page_writeback(struct page *page)
344 * tests can be used in performance sensitive paths. PageCompound is 342 * tests can be used in performance sensitive paths. PageCompound is
345 * generally not used in hot code paths. 343 * generally not used in hot code paths.
346 */ 344 */
347__PAGEFLAG(Head, head) 345__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
348__PAGEFLAG(Tail, tail) 346__PAGEFLAG(Tail, tail)
349 347
350static inline int PageCompound(struct page *page) 348static inline int PageCompound(struct page *page)
@@ -352,6 +350,13 @@ static inline int PageCompound(struct page *page)
352 return page->flags & ((1L << PG_head) | (1L << PG_tail)); 350 return page->flags & ((1L << PG_head) | (1L << PG_tail));
353 351
354} 352}
353#ifdef CONFIG_TRANSPARENT_HUGEPAGE
354static inline void ClearPageCompound(struct page *page)
355{
356 BUG_ON(!PageHead(page));
357 ClearPageHead(page);
358}
359#endif
355#else 360#else
356/* 361/*
357 * Reduce page flag use as much as possible by overlapping 362 * Reduce page flag use as much as possible by overlapping
@@ -389,14 +394,61 @@ static inline void __ClearPageTail(struct page *page)
389 page->flags &= ~PG_head_tail_mask; 394 page->flags &= ~PG_head_tail_mask;
390} 395}
391 396
397#ifdef CONFIG_TRANSPARENT_HUGEPAGE
398static inline void ClearPageCompound(struct page *page)
399{
400 BUG_ON((page->flags & PG_head_tail_mask) != (1 << PG_compound));
401 clear_bit(PG_compound, &page->flags);
402}
403#endif
404
392#endif /* !PAGEFLAGS_EXTENDED */ 405#endif /* !PAGEFLAGS_EXTENDED */
393 406
407#ifdef CONFIG_TRANSPARENT_HUGEPAGE
408/*
409 * PageHuge() only returns true for hugetlbfs pages, but not for
410 * normal or transparent huge pages.
411 *
412 * PageTransHuge() returns true for both transparent huge and
413 * hugetlbfs pages, but not normal pages. PageTransHuge() can only be
414 * called only in the core VM paths where hugetlbfs pages can't exist.
415 */
416static inline int PageTransHuge(struct page *page)
417{
418 VM_BUG_ON(PageTail(page));
419 return PageHead(page);
420}
421
422static inline int PageTransCompound(struct page *page)
423{
424 return PageCompound(page);
425}
426
427#else
428
429static inline int PageTransHuge(struct page *page)
430{
431 return 0;
432}
433
434static inline int PageTransCompound(struct page *page)
435{
436 return 0;
437}
438#endif
439
394#ifdef CONFIG_MMU 440#ifdef CONFIG_MMU
395#define __PG_MLOCKED (1 << PG_mlocked) 441#define __PG_MLOCKED (1 << PG_mlocked)
396#else 442#else
397#define __PG_MLOCKED 0 443#define __PG_MLOCKED 0
398#endif 444#endif
399 445
446#ifdef CONFIG_TRANSPARENT_HUGEPAGE
447#define __PG_COMPOUND_LOCK (1 << PG_compound_lock)
448#else
449#define __PG_COMPOUND_LOCK 0
450#endif
451
400/* 452/*
401 * Flags checked when a page is freed. Pages being freed should not have 453 * Flags checked when a page is freed. Pages being freed should not have
402 * these flags set. It they are, there is a problem. 454 * these flags set. It they are, there is a problem.
@@ -404,9 +456,10 @@ static inline void __ClearPageTail(struct page *page)
404#define PAGE_FLAGS_CHECK_AT_FREE \ 456#define PAGE_FLAGS_CHECK_AT_FREE \
405 (1 << PG_lru | 1 << PG_locked | \ 457 (1 << PG_lru | 1 << PG_locked | \
406 1 << PG_private | 1 << PG_private_2 | \ 458 1 << PG_private | 1 << PG_private_2 | \
407 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 459 1 << PG_writeback | 1 << PG_reserved | \
408 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 460 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
409 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON) 461 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \
462 __PG_COMPOUND_LOCK)
410 463
411/* 464/*
412 * Flags checked when a page is prepped for return by the page allocator. 465 * Flags checked when a page is prepped for return by the page allocator.
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 5bb13b3db84d..961ecc7d30bc 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -1,8 +1,26 @@
1#ifndef __LINUX_PAGE_CGROUP_H 1#ifndef __LINUX_PAGE_CGROUP_H
2#define __LINUX_PAGE_CGROUP_H 2#define __LINUX_PAGE_CGROUP_H
3 3
4enum {
5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
7 PCG_CACHE, /* charged as cache */
8 PCG_USED, /* this object is in use. */
9 PCG_MIGRATION, /* under page migration */
10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS,
16};
17
18#ifndef __GENERATING_BOUNDS_H
19#include <generated/bounds.h>
20
4#ifdef CONFIG_CGROUP_MEM_RES_CTLR 21#ifdef CONFIG_CGROUP_MEM_RES_CTLR
5#include <linux/bit_spinlock.h> 22#include <linux/bit_spinlock.h>
23
6/* 24/*
7 * Page Cgroup can be considered as an extended mem_map. 25 * Page Cgroup can be considered as an extended mem_map.
8 * A page_cgroup page is associated with every page descriptor. The 26 * A page_cgroup page is associated with every page descriptor. The
@@ -13,7 +31,6 @@
13struct page_cgroup { 31struct page_cgroup {
14 unsigned long flags; 32 unsigned long flags;
15 struct mem_cgroup *mem_cgroup; 33 struct mem_cgroup *mem_cgroup;
16 struct page *page;
17 struct list_head lru; /* per cgroup LRU list */ 34 struct list_head lru; /* per cgroup LRU list */
18}; 35};
19 36
@@ -32,16 +49,7 @@ static inline void __init page_cgroup_init(void)
32#endif 49#endif
33 50
34struct page_cgroup *lookup_page_cgroup(struct page *page); 51struct page_cgroup *lookup_page_cgroup(struct page *page);
35 52struct page *lookup_cgroup_page(struct page_cgroup *pc);
36enum {
37 /* flags for mem_cgroup */
38 PCG_LOCK, /* page cgroup is locked */
39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */
41 PCG_ACCT_LRU, /* page has been accounted for */
42 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
43 PCG_MIGRATION, /* under page migration */
44};
45 53
46#define TESTPCGFLAG(uname, lname) \ 54#define TESTPCGFLAG(uname, lname) \
47static inline int PageCgroup##uname(struct page_cgroup *pc) \ 55static inline int PageCgroup##uname(struct page_cgroup *pc) \
@@ -59,8 +67,6 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
59static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ 67static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
60 { return test_and_clear_bit(PCG_##lname, &pc->flags); } 68 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
61 69
62TESTPCGFLAG(Locked, LOCK)
63
64/* Cache flag is set only once (at allocation) */ 70/* Cache flag is set only once (at allocation) */
65TESTPCGFLAG(Cache, CACHE) 71TESTPCGFLAG(Cache, CACHE)
66CLEARPCGFLAG(Cache, CACHE) 72CLEARPCGFLAG(Cache, CACHE)
@@ -84,24 +90,69 @@ SETPCGFLAG(Migration, MIGRATION)
84CLEARPCGFLAG(Migration, MIGRATION) 90CLEARPCGFLAG(Migration, MIGRATION)
85TESTPCGFLAG(Migration, MIGRATION) 91TESTPCGFLAG(Migration, MIGRATION)
86 92
87static inline int page_cgroup_nid(struct page_cgroup *pc) 93static inline void lock_page_cgroup(struct page_cgroup *pc)
88{ 94{
89 return page_to_nid(pc->page); 95 /*
96 * Don't take this lock in IRQ context.
97 * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION
98 */
99 bit_spin_lock(PCG_LOCK, &pc->flags);
90} 100}
91 101
92static inline enum zone_type page_cgroup_zid(struct page_cgroup *pc) 102static inline void unlock_page_cgroup(struct page_cgroup *pc)
93{ 103{
94 return page_zonenum(pc->page); 104 bit_spin_unlock(PCG_LOCK, &pc->flags);
95} 105}
96 106
97static inline void lock_page_cgroup(struct page_cgroup *pc) 107static inline void move_lock_page_cgroup(struct page_cgroup *pc,
108 unsigned long *flags)
98{ 109{
99 bit_spin_lock(PCG_LOCK, &pc->flags); 110 /*
111 * We know updates to pc->flags of page cache's stats are from both of
112 * usual context or IRQ context. Disable IRQ to avoid deadlock.
113 */
114 local_irq_save(*flags);
115 bit_spin_lock(PCG_MOVE_LOCK, &pc->flags);
100} 116}
101 117
102static inline void unlock_page_cgroup(struct page_cgroup *pc) 118static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
119 unsigned long *flags)
103{ 120{
104 bit_spin_unlock(PCG_LOCK, &pc->flags); 121 bit_spin_unlock(PCG_MOVE_LOCK, &pc->flags);
122 local_irq_restore(*flags);
123}
124
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existent fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
105} 156}
106 157
107#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
@@ -124,7 +175,7 @@ static inline void __init page_cgroup_init_flatmem(void)
124{ 175{
125} 176}
126 177
127#endif 178#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
128 179
129#include <linux/swap.h> 180#include <linux/swap.h>
130 181
@@ -160,5 +211,8 @@ static inline void swap_cgroup_swapoff(int type)
160 return; 211 return;
161} 212}
162 213
163#endif 214#endif /* CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
164#endif 215
216#endif /* !__GENERATING_BOUNDS_H */
217
218#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index e8c06122be36..19ef95d293ae 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -67,7 +67,8 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
67 67
68#define get_pageblock_flags(page) \ 68#define get_pageblock_flags(page) \
69 get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) 69 get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1)
70#define set_pageblock_flags(page) \ 70#define set_pageblock_flags(page, flags) \
71 set_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) 71 set_pageblock_flags_group(page, flags, \
72 0, NR_PAGEBLOCK_BITS-1)
72 73
73#endif /* PAGEBLOCK_FLAGS_H */ 74#endif /* PAGEBLOCK_FLAGS_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e12cdc6d79ee..c11950652646 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -48,7 +48,7 @@ static inline void mapping_clear_unevictable(struct address_space *mapping)
48 48
49static inline int mapping_unevictable(struct address_space *mapping) 49static inline int mapping_unevictable(struct address_space *mapping)
50{ 50{
51 if (likely(mapping)) 51 if (mapping)
52 return test_bit(AS_UNEVICTABLE, &mapping->flags); 52 return test_bit(AS_UNEVICTABLE, &mapping->flags);
53 return !!mapping; 53 return !!mapping;
54} 54}
@@ -298,7 +298,8 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
298 298
299extern void __lock_page(struct page *page); 299extern void __lock_page(struct page *page);
300extern int __lock_page_killable(struct page *page); 300extern int __lock_page_killable(struct page *page);
301extern void __lock_page_nosync(struct page *page); 301extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
302 unsigned int flags);
302extern void unlock_page(struct page *page); 303extern void unlock_page(struct page *page);
303 304
304static inline void __set_page_locked(struct page *page) 305static inline void __set_page_locked(struct page *page)
@@ -340,16 +341,16 @@ static inline int lock_page_killable(struct page *page)
340} 341}
341 342
342/* 343/*
343 * lock_page_nosync should only be used if we can't pin the page's inode. 344 * lock_page_or_retry - Lock the page, unless this would block and the
344 * Doesn't play quite so well with block device plugging. 345 * caller indicated that it can handle a retry.
345 */ 346 */
346static inline void lock_page_nosync(struct page *page) 347static inline int lock_page_or_retry(struct page *page, struct mm_struct *mm,
348 unsigned int flags)
347{ 349{
348 might_sleep(); 350 might_sleep();
349 if (!trylock_page(page)) 351 return trylock_page(page) || __lock_page_or_retry(page, mm, flags);
350 __lock_page_nosync(page);
351} 352}
352 353
353/* 354/*
354 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 355 * This is exported only for wait_on_page_locked/wait_on_page_writeback.
355 * Never use this directly! 356 * Never use this directly!
@@ -442,8 +443,9 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
442 pgoff_t index, gfp_t gfp_mask); 443 pgoff_t index, gfp_t gfp_mask);
443int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 444int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
444 pgoff_t index, gfp_t gfp_mask); 445 pgoff_t index, gfp_t gfp_mask);
445extern void remove_from_page_cache(struct page *page); 446extern void delete_from_page_cache(struct page *page);
446extern void __remove_from_page_cache(struct page *page); 447extern void __delete_from_page_cache(struct page *page);
448int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
447 449
448/* 450/*
449 * Like add_to_page_cache_locked, but used to add newly allocated pages: 451 * Like add_to_page_cache_locked, but used to add newly allocated pages:
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h
new file mode 100644
index 000000000000..a6ee9aa898bb
--- /dev/null
+++ b/include/linux/pata_arasan_cf_data.h
@@ -0,0 +1,49 @@
1/*
2 * include/linux/pata_arasan_cf_data.h
3 *
4 * Arasan Compact Flash host controller platform data header file
5 *
6 * Copyright (C) 2011 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef _PATA_ARASAN_CF_DATA_H
15#define _PATA_ARASAN_CF_DATA_H
16
17#include <linux/platform_device.h>
18
19struct arasan_cf_pdata {
20 u8 cf_if_clk;
21 #define CF_IF_CLK_100M (0x0)
22 #define CF_IF_CLK_75M (0x1)
23 #define CF_IF_CLK_66M (0x2)
24 #define CF_IF_CLK_50M (0x3)
25 #define CF_IF_CLK_40M (0x4)
26 #define CF_IF_CLK_33M (0x5)
27 #define CF_IF_CLK_25M (0x6)
28 #define CF_IF_CLK_125M (0x7)
29 #define CF_IF_CLK_150M (0x8)
30 #define CF_IF_CLK_166M (0x9)
31 #define CF_IF_CLK_200M (0xA)
32 /*
33 * Platform specific incapabilities of CF controller is handled via
34 * quirks
35 */
36 u32 quirk;
37 #define CF_BROKEN_PIO (1)
38 #define CF_BROKEN_MWDMA (1 << 1)
39 #define CF_BROKEN_UDMA (1 << 2)
40 /* This is platform specific data for the DMA controller */
41 void *dma_priv;
42};
43
44static inline void
45set_arasan_cf_pdata(struct platform_device *pdev, struct arasan_cf_pdata *data)
46{
47 pdev->dev.platform_data = data;
48}
49#endif /* _PATA_ARASAN_CF_DATA_H */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index c8b6473c5f42..44623500f419 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -35,9 +35,12 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
35 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), 35 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
36 pbus->number); 36 pbus->number);
37} 37}
38#endif
39
40#ifdef CONFIG_ACPI_APEI
41extern bool aer_acpi_firmware_first(void);
38#else 42#else
39static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 43static inline bool aer_acpi_firmware_first(void) { return false; }
40{ return NULL; }
41#endif 44#endif
42 45
43#endif /* _PCI_ACPI_H_ */ 46#endif /* _PCI_ACPI_H_ */
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 91ba0b338b47..67cb3ae38016 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -26,7 +26,9 @@
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev); 26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pcie_clear_aspm(void);
30extern void pcie_no_aspm(void); 32extern void pcie_no_aspm(void);
31#else 33#else
32static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 34static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -38,10 +40,15 @@ static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev)
38static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) 40static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
39{ 41{
40} 42}
43static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
44{
45}
41static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 46static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
42{ 47{
43} 48}
44 49static inline void pcie_clear_aspm(void)
50{
51}
45static inline void pcie_no_aspm(void) 52static inline void pcie_no_aspm(void)
46{ 53{
47} 54}
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
new file mode 100644
index 000000000000..655824fa4c76
--- /dev/null
+++ b/include/linux/pci-ats.h
@@ -0,0 +1,52 @@
1#ifndef LINUX_PCI_ATS_H
2#define LINUX_PCI_ATS_H
3
4/* Address Translation Service */
5struct pci_ats {
6 int pos; /* capability position */
7 int stu; /* Smallest Translation Unit */
8 int qdep; /* Invalidate Queue Depth */
9 int ref_cnt; /* Physical Function reference count */
10 unsigned int is_enabled:1; /* Enable bit is set */
11};
12
13#ifdef CONFIG_PCI_IOV
14
15extern int pci_enable_ats(struct pci_dev *dev, int ps);
16extern void pci_disable_ats(struct pci_dev *dev);
17extern int pci_ats_queue_depth(struct pci_dev *dev);
18/**
19 * pci_ats_enabled - query the ATS status
20 * @dev: the PCI device
21 *
22 * Returns 1 if ATS capability is enabled, or 0 if not.
23 */
24static inline int pci_ats_enabled(struct pci_dev *dev)
25{
26 return dev->ats && dev->ats->is_enabled;
27}
28
29#else /* CONFIG_PCI_IOV */
30
31static inline int pci_enable_ats(struct pci_dev *dev, int ps)
32{
33 return -ENODEV;
34}
35
36static inline void pci_disable_ats(struct pci_dev *dev)
37{
38}
39
40static inline int pci_ats_queue_depth(struct pci_dev *dev)
41{
42 return -ENODEV;
43}
44
45static inline int pci_ats_enabled(struct pci_dev *dev)
46{
47 return 0;
48}
49
50#endif /* CONFIG_PCI_IOV */
51
52#endif /* LINUX_PCI_ATS_H*/
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c8d95e369ff4..96f70d7e058d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -541,7 +541,7 @@ struct pci_error_handlers {
541struct module; 541struct module;
542struct pci_driver { 542struct pci_driver {
543 struct list_head node; 543 struct list_head node;
544 char *name; 544 const char *name;
545 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ 545 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
546 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ 546 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
547 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 547 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
@@ -806,7 +806,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
806 806
807/* Power management related routines */ 807/* Power management related routines */
808int pci_save_state(struct pci_dev *dev); 808int pci_save_state(struct pci_dev *dev);
809int pci_restore_state(struct pci_dev *dev); 809void pci_restore_state(struct pci_dev *dev);
810int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); 810int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
811int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 811int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
812pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 812pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
@@ -819,6 +819,8 @@ pci_power_t pci_target_state(struct pci_dev *dev);
819int pci_prepare_to_sleep(struct pci_dev *dev); 819int pci_prepare_to_sleep(struct pci_dev *dev);
820int pci_back_from_sleep(struct pci_dev *dev); 820int pci_back_from_sleep(struct pci_dev *dev);
821bool pci_dev_run_wake(struct pci_dev *dev); 821bool pci_dev_run_wake(struct pci_dev *dev);
822bool pci_check_pme_status(struct pci_dev *dev);
823void pci_pme_wakeup_bus(struct pci_bus *bus);
822 824
823static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 825static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
824 bool enable) 826 bool enable)
@@ -991,13 +993,28 @@ extern void pci_restore_msi_state(struct pci_dev *dev);
991extern int pci_msi_enabled(void); 993extern int pci_msi_enabled(void);
992#endif 994#endif
993 995
996#ifdef CONFIG_PCIEPORTBUS
997extern bool pcie_ports_disabled;
998extern bool pcie_ports_auto;
999#else
1000#define pcie_ports_disabled true
1001#define pcie_ports_auto false
1002#endif
1003
994#ifndef CONFIG_PCIEASPM 1004#ifndef CONFIG_PCIEASPM
995static inline int pcie_aspm_enabled(void) 1005static inline int pcie_aspm_enabled(void) { return 0; }
996{ 1006static inline bool pcie_aspm_support_enabled(void) { return false; }
997 return 0;
998}
999#else 1007#else
1000extern int pcie_aspm_enabled(void); 1008extern int pcie_aspm_enabled(void);
1009extern bool pcie_aspm_support_enabled(void);
1010#endif
1011
1012#ifdef CONFIG_PCIEAER
1013void pci_no_aer(void);
1014bool pci_aer_available(void);
1015#else
1016static inline void pci_no_aer(void) { }
1017static inline bool pci_aer_available(void) { return false; }
1001#endif 1018#endif
1002 1019
1003#ifndef CONFIG_PCIE_ECRC 1020#ifndef CONFIG_PCIE_ECRC
@@ -1165,12 +1182,15 @@ static inline int pci_save_state(struct pci_dev *dev)
1165 return 0; 1182 return 0;
1166} 1183}
1167 1184
1168static inline int pci_restore_state(struct pci_dev *dev) 1185static inline void pci_restore_state(struct pci_dev *dev)
1186{ }
1187
1188static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1169{ 1189{
1170 return 0; 1190 return 0;
1171} 1191}
1172 1192
1173static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) 1193static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable)
1174{ 1194{
1175 return 0; 1195 return 0;
1176} 1196}
@@ -1463,6 +1483,7 @@ void pci_request_acs(void);
1463#define PCI_VPD_RO_KEYWORD_PARTNO "PN" 1483#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
1464#define PCI_VPD_RO_KEYWORD_MFR_ID "MN" 1484#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
1465#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" 1485#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
1486#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"
1466 1487
1467/** 1488/**
1468 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length 1489 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b4c3d1b50037..8652a4fa3fe2 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -517,7 +517,9 @@
517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_NB_MISC 0x1603 520#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603
521#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604
522#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
521#define PCI_DEVICE_ID_AMD_LANCE 0x2000 523#define PCI_DEVICE_ID_AMD_LANCE 0x2000
522#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 524#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
523#define PCI_DEVICE_ID_AMD_SCSI 0x2020 525#define PCI_DEVICE_ID_AMD_SCSI 0x2020
@@ -606,6 +608,8 @@
606#define PCI_DEVICE_ID_MATROX_G550 0x2527 608#define PCI_DEVICE_ID_MATROX_G550 0x2527
607#define PCI_DEVICE_ID_MATROX_VIA 0x4536 609#define PCI_DEVICE_ID_MATROX_VIA 0x4536
608 610
611#define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2
612
609#define PCI_VENDOR_ID_CT 0x102c 613#define PCI_VENDOR_ID_CT 0x102c
610#define PCI_DEVICE_ID_CT_69000 0x00c0 614#define PCI_DEVICE_ID_CT_69000 0x00c0
611#define PCI_DEVICE_ID_CT_65545 0x00d8 615#define PCI_DEVICE_ID_CT_65545 0x00d8
@@ -767,6 +771,8 @@
767#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 771#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
768#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 772#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
769 773
774#define PCI_VENDOR_ID_STMICRO 0x104A
775
770#define PCI_VENDOR_ID_BUSLOGIC 0x104B 776#define PCI_VENDOR_ID_BUSLOGIC 0x104B
771#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 777#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
772#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 778#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
@@ -1251,6 +1257,8 @@
1251#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 1257#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
1252#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C 1258#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
1253#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1259#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1260#define PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V0 0x0360
1261#define PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V4 0x0364
1254#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 1262#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1255#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7
1256#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB 1264#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB
@@ -1646,6 +1654,11 @@
1646#define PCI_DEVICE_ID_O2_6836 0x6836 1654#define PCI_DEVICE_ID_O2_6836 0x6836
1647#define PCI_DEVICE_ID_O2_6812 0x6872 1655#define PCI_DEVICE_ID_O2_6812 0x6872
1648#define PCI_DEVICE_ID_O2_6933 0x6933 1656#define PCI_DEVICE_ID_O2_6933 0x6933
1657#define PCI_DEVICE_ID_O2_8120 0x8120
1658#define PCI_DEVICE_ID_O2_8220 0x8220
1659#define PCI_DEVICE_ID_O2_8221 0x8221
1660#define PCI_DEVICE_ID_O2_8320 0x8320
1661#define PCI_DEVICE_ID_O2_8321 0x8321
1649 1662
1650#define PCI_VENDOR_ID_3DFX 0x121a 1663#define PCI_VENDOR_ID_3DFX 0x121a
1651#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 1664#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001
@@ -2043,6 +2056,7 @@
2043#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 2056#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
2044#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 2057#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150
2045 2058
2059#define PCI_VENDOR_ID_BCM_GVC 0x14a4
2046#define PCI_VENDOR_ID_BROADCOM 0x14e4 2060#define PCI_VENDOR_ID_BROADCOM 0x14e4
2047#define PCI_DEVICE_ID_TIGON3_5752 0x1600 2061#define PCI_DEVICE_ID_TIGON3_5752 0x1600
2048#define PCI_DEVICE_ID_TIGON3_5752M 0x1601 2062#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
@@ -2067,6 +2081,8 @@
2067#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2081#define PCI_DEVICE_ID_TIGON3_5723 0x165b
2068#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 2082#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
2069#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2083#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
2084#define PCI_DEVICE_ID_NX2_57712 0x1662
2085#define PCI_DEVICE_ID_NX2_57712E 0x1663
2070#define PCI_DEVICE_ID_TIGON3_5714 0x1668 2086#define PCI_DEVICE_ID_TIGON3_5714 0x1668
2071#define PCI_DEVICE_ID_TIGON3_5714S 0x1669 2087#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
2072#define PCI_DEVICE_ID_TIGON3_5780 0x166a 2088#define PCI_DEVICE_ID_TIGON3_5780 0x166a
@@ -2358,6 +2374,10 @@
2358#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 2374#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2359#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382 2375#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382
2360#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 2376#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383
2377#define PCI_DEVICE_ID_JMICRON_JMB385_MS 0x2388
2378#define PCI_DEVICE_ID_JMICRON_JMB388_SD 0x2391
2379#define PCI_DEVICE_ID_JMICRON_JMB388_ESD 0x2392
2380#define PCI_DEVICE_ID_JMICRON_JMB390_MS 0x2393
2361 2381
2362#define PCI_VENDOR_ID_KORENIX 0x1982 2382#define PCI_VENDOR_ID_KORENIX 0x1982
2363#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2383#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
@@ -2430,6 +2450,14 @@
2430#define PCI_DEVICE_ID_INTEL_82375 0x0482 2450#define PCI_DEVICE_ID_INTEL_82375 0x0482
2431#define PCI_DEVICE_ID_INTEL_82424 0x0483 2451#define PCI_DEVICE_ID_INTEL_82424 0x0483
2432#define PCI_DEVICE_ID_INTEL_82378 0x0484 2452#define PCI_DEVICE_ID_INTEL_82378 0x0484
2453#define PCI_DEVICE_ID_INTEL_MRST_SD0 0x0807
2454#define PCI_DEVICE_ID_INTEL_MRST_SD1 0x0808
2455#define PCI_DEVICE_ID_INTEL_MFD_SD 0x0820
2456#define PCI_DEVICE_ID_INTEL_MFD_SDIO1 0x0821
2457#define PCI_DEVICE_ID_INTEL_MFD_SDIO2 0x0822
2458#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823
2459#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824
2460#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F
2433#define PCI_DEVICE_ID_INTEL_I960 0x0960 2461#define PCI_DEVICE_ID_INTEL_I960 0x0960
2434#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 2462#define PCI_DEVICE_ID_INTEL_I960RM 0x0962
2435#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062 2463#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062
@@ -2451,9 +2479,12 @@
2451#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 2479#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21
2452#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2480#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2453#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 2481#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2454#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 2482#define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41
2455#define PCI_DEVICE_ID_INTEL_CPT_LPC_MIN 0x1c41 2483#define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f
2456#define PCI_DEVICE_ID_INTEL_CPT_LPC_MAX 0x1c5f 2484#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40
2485#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41
2486#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MIN 0x2310
2487#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MAX 0x231f
2457#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2488#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2458#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2489#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2459#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2490#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
@@ -2662,9 +2693,8 @@
2662#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2693#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a
2663#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2694#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2664#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2695#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2665#define PCI_DEVICE_ID_INTEL_PCH_LPC_MIN 0x3b00 2696#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00
2666#define PCI_DEVICE_ID_INTEL_PCH_LPC_MAX 0x3b1f 2697#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f
2667#define PCI_DEVICE_ID_INTEL_PCH_SMBUS 0x3b30
2668#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2698#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2669#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2699#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2670#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2700#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
@@ -2673,8 +2703,8 @@
2673#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035 2703#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035
2674#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036 2704#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036
2675#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2705#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2676#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2706#define PCI_DEVICE_ID_INTEL_EP80579_0 0x5031
2677#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2707#define PCI_DEVICE_ID_INTEL_EP80579_1 0x5032
2678#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 2708#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
2679#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 2709#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
2680#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 2710#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
@@ -2705,6 +2735,7 @@
2705#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2735#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2706#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2736#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2707#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2737#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2738#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2708#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2739#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2709#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2740#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
2710#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca 2741#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 455b9ccdfca7..be01380f798a 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -223,7 +223,7 @@
223#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ 223#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
224#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ 224#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
225#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ 225#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
226#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ 226#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxiliary power support mask */
227#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ 227#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
228#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ 228#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
229#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ 229#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
@@ -300,12 +300,22 @@
300#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ 300#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
301#define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ 301#define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */
302 302
303/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */ 303/* MSI-X registers */
304#define PCI_MSIX_FLAGS 2 304#define PCI_MSIX_FLAGS 2
305#define PCI_MSIX_FLAGS_QSIZE 0x7FF 305#define PCI_MSIX_FLAGS_QSIZE 0x7FF
306#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 306#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
307#define PCI_MSIX_FLAGS_MASKALL (1 << 14) 307#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
308#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 308#define PCI_MSIX_TABLE 4
309#define PCI_MSIX_PBA 8
310#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
311
312/* MSI-X entry's format */
313#define PCI_MSIX_ENTRY_SIZE 16
314#define PCI_MSIX_ENTRY_LOWER_ADDR 0
315#define PCI_MSIX_ENTRY_UPPER_ADDR 4
316#define PCI_MSIX_ENTRY_DATA 8
317#define PCI_MSIX_ENTRY_VECTOR_CTRL 12
318#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1
309 319
310/* CompactPCI Hotswap Register */ 320/* CompactPCI Hotswap Register */
311 321
@@ -425,7 +435,7 @@
425#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ 435#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
426#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */ 436#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */
427#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */ 437#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */
428#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Suprise Down Error Reporting Capable */ 438#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Surprise Down Error Reporting Capable */
429#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */ 439#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
430#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */ 440#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
431#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */ 441#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
@@ -494,6 +504,8 @@
494#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ 504#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
495#define PCI_EXP_RTCAP 30 /* Root Capabilities */ 505#define PCI_EXP_RTCAP 30 /* Root Capabilities */
496#define PCI_EXP_RTSTA 32 /* Root Status */ 506#define PCI_EXP_RTSTA 32 /* Root Status */
507#define PCI_EXP_RTSTA_PME 0x10000 /* PME status */
508#define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */
497#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ 509#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */
498#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ 510#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
499#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ 511#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 018db9a62ffe..27ef6b190ea6 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -148,18 +148,6 @@
148 DEFINE_PER_CPU_SECTION(type, name, "..readmostly") 148 DEFINE_PER_CPU_SECTION(type, name, "..readmostly")
149 149
150/* 150/*
151 * Declaration/definition used for large per-CPU variables that must be
152 * aligned to something larger than the pagesize.
153 */
154#define DECLARE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
155 DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \
156 __aligned(size)
157
158#define DEFINE_PER_CPU_MULTIPAGE_ALIGNED(type, name, size) \
159 DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \
160 __aligned(size)
161
162/*
163 * Intermodule exports for per-CPU variables. sparse forgets about 151 * Intermodule exports for per-CPU variables. sparse forgets about
164 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to 152 * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to
165 * noop if __CHECKER__. 153 * noop if __CHECKER__.
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 5095b834a6fb..8b97308e65df 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -240,6 +240,45 @@ extern void __bad_size_call_parameter(void);
240 pscr_ret__; \ 240 pscr_ret__; \
241}) 241})
242 242
243#define __pcpu_size_call_return2(stem, variable, ...) \
244({ \
245 typeof(variable) pscr2_ret__; \
246 __verify_pcpu_ptr(&(variable)); \
247 switch(sizeof(variable)) { \
248 case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \
249 case 2: pscr2_ret__ = stem##2(variable, __VA_ARGS__); break; \
250 case 4: pscr2_ret__ = stem##4(variable, __VA_ARGS__); break; \
251 case 8: pscr2_ret__ = stem##8(variable, __VA_ARGS__); break; \
252 default: \
253 __bad_size_call_parameter(); break; \
254 } \
255 pscr2_ret__; \
256})
257
258/*
259 * Special handling for cmpxchg_double. cmpxchg_double is passed two
260 * percpu variables. The first has to be aligned to a double word
261 * boundary and the second has to follow directly thereafter.
262 */
263#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
264({ \
265 bool pdcrb_ret__; \
266 __verify_pcpu_ptr(&pcp1); \
267 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
268 VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
269 VM_BUG_ON((unsigned long)(&pcp2) != \
270 (unsigned long)(&pcp1) + sizeof(pcp1)); \
271 switch(sizeof(pcp1)) { \
272 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
273 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
274 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
275 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
276 default: \
277 __bad_size_call_parameter(); break; \
278 } \
279 pdcrb_ret__; \
280})
281
243#define __pcpu_size_call(stem, variable, ...) \ 282#define __pcpu_size_call(stem, variable, ...) \
244do { \ 283do { \
245 __verify_pcpu_ptr(&(variable)); \ 284 __verify_pcpu_ptr(&(variable)); \
@@ -402,6 +441,128 @@ do { \
402# define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val)) 441# define this_cpu_xor(pcp, val) __pcpu_size_call(this_cpu_or_, (pcp), (val))
403#endif 442#endif
404 443
444#define _this_cpu_generic_add_return(pcp, val) \
445({ \
446 typeof(pcp) ret__; \
447 preempt_disable(); \
448 __this_cpu_add(pcp, val); \
449 ret__ = __this_cpu_read(pcp); \
450 preempt_enable(); \
451 ret__; \
452})
453
454#ifndef this_cpu_add_return
455# ifndef this_cpu_add_return_1
456# define this_cpu_add_return_1(pcp, val) _this_cpu_generic_add_return(pcp, val)
457# endif
458# ifndef this_cpu_add_return_2
459# define this_cpu_add_return_2(pcp, val) _this_cpu_generic_add_return(pcp, val)
460# endif
461# ifndef this_cpu_add_return_4
462# define this_cpu_add_return_4(pcp, val) _this_cpu_generic_add_return(pcp, val)
463# endif
464# ifndef this_cpu_add_return_8
465# define this_cpu_add_return_8(pcp, val) _this_cpu_generic_add_return(pcp, val)
466# endif
467# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
468#endif
469
470#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val))
471#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
472#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
473
474#define _this_cpu_generic_xchg(pcp, nval) \
475({ typeof(pcp) ret__; \
476 preempt_disable(); \
477 ret__ = __this_cpu_read(pcp); \
478 __this_cpu_write(pcp, nval); \
479 preempt_enable(); \
480 ret__; \
481})
482
483#ifndef this_cpu_xchg
484# ifndef this_cpu_xchg_1
485# define this_cpu_xchg_1(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
486# endif
487# ifndef this_cpu_xchg_2
488# define this_cpu_xchg_2(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
489# endif
490# ifndef this_cpu_xchg_4
491# define this_cpu_xchg_4(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
492# endif
493# ifndef this_cpu_xchg_8
494# define this_cpu_xchg_8(pcp, nval) _this_cpu_generic_xchg(pcp, nval)
495# endif
496# define this_cpu_xchg(pcp, nval) \
497 __pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
498#endif
499
500#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
501({ typeof(pcp) ret__; \
502 preempt_disable(); \
503 ret__ = __this_cpu_read(pcp); \
504 if (ret__ == (oval)) \
505 __this_cpu_write(pcp, nval); \
506 preempt_enable(); \
507 ret__; \
508})
509
510#ifndef this_cpu_cmpxchg
511# ifndef this_cpu_cmpxchg_1
512# define this_cpu_cmpxchg_1(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
513# endif
514# ifndef this_cpu_cmpxchg_2
515# define this_cpu_cmpxchg_2(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
516# endif
517# ifndef this_cpu_cmpxchg_4
518# define this_cpu_cmpxchg_4(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
519# endif
520# ifndef this_cpu_cmpxchg_8
521# define this_cpu_cmpxchg_8(pcp, oval, nval) _this_cpu_generic_cmpxchg(pcp, oval, nval)
522# endif
523# define this_cpu_cmpxchg(pcp, oval, nval) \
524 __pcpu_size_call_return2(this_cpu_cmpxchg_, pcp, oval, nval)
525#endif
526
527/*
528 * cmpxchg_double replaces two adjacent scalars at once. The first
529 * two parameters are per cpu variables which have to be of the same
530 * size. A truth value is returned to indicate success or failure
531 * (since a double register result is difficult to handle). There is
532 * very limited hardware support for these operations, so only certain
533 * sizes may work.
534 */
535#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
536({ \
537 int ret__; \
538 preempt_disable(); \
539 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
540 oval1, oval2, nval1, nval2); \
541 preempt_enable(); \
542 ret__; \
543})
544
545#ifndef this_cpu_cmpxchg_double
546# ifndef this_cpu_cmpxchg_double_1
547# define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
548 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
549# endif
550# ifndef this_cpu_cmpxchg_double_2
551# define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
552 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
553# endif
554# ifndef this_cpu_cmpxchg_double_4
555# define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
556 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
557# endif
558# ifndef this_cpu_cmpxchg_double_8
559# define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
560 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
561# endif
562# define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
563 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
564#endif
565
405/* 566/*
406 * Generic percpu operations that do not require preemption handling. 567 * Generic percpu operations that do not require preemption handling.
407 * Either we do not care about races or the caller has the 568 * Either we do not care about races or the caller has the
@@ -529,11 +690,120 @@ do { \
529# define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val)) 690# define __this_cpu_xor(pcp, val) __pcpu_size_call(__this_cpu_xor_, (pcp), (val))
530#endif 691#endif
531 692
693#define __this_cpu_generic_add_return(pcp, val) \
694({ \
695 __this_cpu_add(pcp, val); \
696 __this_cpu_read(pcp); \
697})
698
699#ifndef __this_cpu_add_return
700# ifndef __this_cpu_add_return_1
701# define __this_cpu_add_return_1(pcp, val) __this_cpu_generic_add_return(pcp, val)
702# endif
703# ifndef __this_cpu_add_return_2
704# define __this_cpu_add_return_2(pcp, val) __this_cpu_generic_add_return(pcp, val)
705# endif
706# ifndef __this_cpu_add_return_4
707# define __this_cpu_add_return_4(pcp, val) __this_cpu_generic_add_return(pcp, val)
708# endif
709# ifndef __this_cpu_add_return_8
710# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val)
711# endif
712# define __this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
713#endif
714
715#define __this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val))
716#define __this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
717#define __this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
718
719#define __this_cpu_generic_xchg(pcp, nval) \
720({ typeof(pcp) ret__; \
721 ret__ = __this_cpu_read(pcp); \
722 __this_cpu_write(pcp, nval); \
723 ret__; \
724})
725
726#ifndef __this_cpu_xchg
727# ifndef __this_cpu_xchg_1
728# define __this_cpu_xchg_1(pcp, nval) __this_cpu_generic_xchg(pcp, nval)
729# endif
730# ifndef __this_cpu_xchg_2
731# define __this_cpu_xchg_2(pcp, nval) __this_cpu_generic_xchg(pcp, nval)
732# endif
733# ifndef __this_cpu_xchg_4
734# define __this_cpu_xchg_4(pcp, nval) __this_cpu_generic_xchg(pcp, nval)
735# endif
736# ifndef __this_cpu_xchg_8
737# define __this_cpu_xchg_8(pcp, nval) __this_cpu_generic_xchg(pcp, nval)
738# endif
739# define __this_cpu_xchg(pcp, nval) \
740 __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval)
741#endif
742
743#define __this_cpu_generic_cmpxchg(pcp, oval, nval) \
744({ \
745 typeof(pcp) ret__; \
746 ret__ = __this_cpu_read(pcp); \
747 if (ret__ == (oval)) \
748 __this_cpu_write(pcp, nval); \
749 ret__; \
750})
751
752#ifndef __this_cpu_cmpxchg
753# ifndef __this_cpu_cmpxchg_1
754# define __this_cpu_cmpxchg_1(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval)
755# endif
756# ifndef __this_cpu_cmpxchg_2
757# define __this_cpu_cmpxchg_2(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval)
758# endif
759# ifndef __this_cpu_cmpxchg_4
760# define __this_cpu_cmpxchg_4(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval)
761# endif
762# ifndef __this_cpu_cmpxchg_8
763# define __this_cpu_cmpxchg_8(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval)
764# endif
765# define __this_cpu_cmpxchg(pcp, oval, nval) \
766 __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval)
767#endif
768
769#define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
770({ \
771 int __ret = 0; \
772 if (__this_cpu_read(pcp1) == (oval1) && \
773 __this_cpu_read(pcp2) == (oval2)) { \
774 __this_cpu_write(pcp1, (nval1)); \
775 __this_cpu_write(pcp2, (nval2)); \
776 __ret = 1; \
777 } \
778 (__ret); \
779})
780
781#ifndef __this_cpu_cmpxchg_double
782# ifndef __this_cpu_cmpxchg_double_1
783# define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
784 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
785# endif
786# ifndef __this_cpu_cmpxchg_double_2
787# define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
788 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
789# endif
790# ifndef __this_cpu_cmpxchg_double_4
791# define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
792 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
793# endif
794# ifndef __this_cpu_cmpxchg_double_8
795# define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
796 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
797# endif
798# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
799 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
800#endif
801
532/* 802/*
533 * IRQ safe versions of the per cpu RMW operations. Note that these operations 803 * IRQ safe versions of the per cpu RMW operations. Note that these operations
534 * are *not* safe against modification of the same variable from another 804 * are *not* safe against modification of the same variable from another
535 * processors (which one gets when using regular atomic operations) 805 * processors (which one gets when using regular atomic operations)
536 . They are guaranteed to be atomic vs. local interrupts and 806 * They are guaranteed to be atomic vs. local interrupts and
537 * preemption only. 807 * preemption only.
538 */ 808 */
539#define irqsafe_cpu_generic_to_op(pcp, val, op) \ 809#define irqsafe_cpu_generic_to_op(pcp, val, op) \
@@ -620,4 +890,65 @@ do { \
620# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val)) 890# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
621#endif 891#endif
622 892
893#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) \
894({ \
895 typeof(pcp) ret__; \
896 unsigned long flags; \
897 local_irq_save(flags); \
898 ret__ = __this_cpu_read(pcp); \
899 if (ret__ == (oval)) \
900 __this_cpu_write(pcp, nval); \
901 local_irq_restore(flags); \
902 ret__; \
903})
904
905#ifndef irqsafe_cpu_cmpxchg
906# ifndef irqsafe_cpu_cmpxchg_1
907# define irqsafe_cpu_cmpxchg_1(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
908# endif
909# ifndef irqsafe_cpu_cmpxchg_2
910# define irqsafe_cpu_cmpxchg_2(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
911# endif
912# ifndef irqsafe_cpu_cmpxchg_4
913# define irqsafe_cpu_cmpxchg_4(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
914# endif
915# ifndef irqsafe_cpu_cmpxchg_8
916# define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
917# endif
918# define irqsafe_cpu_cmpxchg(pcp, oval, nval) \
919 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval)
920#endif
921
922#define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
923({ \
924 int ret__; \
925 unsigned long flags; \
926 local_irq_save(flags); \
927 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
928 oval1, oval2, nval1, nval2); \
929 local_irq_restore(flags); \
930 ret__; \
931})
932
933#ifndef irqsafe_cpu_cmpxchg_double
934# ifndef irqsafe_cpu_cmpxchg_double_1
935# define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
936 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
937# endif
938# ifndef irqsafe_cpu_cmpxchg_double_2
939# define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
940 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
941# endif
942# ifndef irqsafe_cpu_cmpxchg_double_4
943# define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
944 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
945# endif
946# ifndef irqsafe_cpu_cmpxchg_double_8
947# define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
948 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
949# endif
950# define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
951 __pcpu_double_call_return_bool(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
952#endif
953
623#endif /* __LINUX_PERCPU_H */ 954#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 8a7d510ffa9c..46f6ba56fa91 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -78,6 +78,11 @@ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
78 return 1; 78 return 1;
79} 79}
80 80
81static inline int percpu_counter_initialized(struct percpu_counter *fbc)
82{
83 return (fbc->counters != NULL);
84}
85
81#else 86#else
82 87
83struct percpu_counter { 88struct percpu_counter {
@@ -143,6 +148,11 @@ static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
143 return percpu_counter_read(fbc); 148 return percpu_counter_read(fbc);
144} 149}
145 150
151static inline int percpu_counter_initialized(struct percpu_counter *fbc)
152{
153 return 1;
154}
155
146#endif /* CONFIG_SMP */ 156#endif /* CONFIG_SMP */
147 157
148static inline void percpu_counter_inc(struct percpu_counter *fbc) 158static inline void percpu_counter_inc(struct percpu_counter *fbc)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 057bf22a8323..3412684ce5d5 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -2,8 +2,8 @@
2 * Performance events: 2 * Performance events:
3 * 3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> 4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar 5 * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra 6 * Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra
7 * 7 *
8 * Data type definitions, declarations, prototypes. 8 * Data type definitions, declarations, prototypes.
9 * 9 *
@@ -52,6 +52,8 @@ enum perf_hw_id {
52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, 52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
53 PERF_COUNT_HW_BRANCH_MISSES = 5, 53 PERF_COUNT_HW_BRANCH_MISSES = 5,
54 PERF_COUNT_HW_BUS_CYCLES = 6, 54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
55 57
56 PERF_COUNT_HW_MAX, /* non-ABI */ 58 PERF_COUNT_HW_MAX, /* non-ABI */
57}; 59};
@@ -215,8 +217,9 @@ struct perf_event_attr {
215 */ 217 */
216 precise_ip : 2, /* skid constraint */ 218 precise_ip : 2, /* skid constraint */
217 mmap_data : 1, /* non-exec mmap data */ 219 mmap_data : 1, /* non-exec mmap data */
220 sample_id_all : 1, /* sample_type all events */
218 221
219 __reserved_1 : 46; 222 __reserved_1 : 45;
220 223
221 union { 224 union {
222 __u32 wakeup_events; /* wakeup every n events */ 225 __u32 wakeup_events; /* wakeup every n events */
@@ -224,8 +227,14 @@ struct perf_event_attr {
224 }; 227 };
225 228
226 __u32 bp_type; 229 __u32 bp_type;
227 __u64 bp_addr; 230 union {
228 __u64 bp_len; 231 __u64 bp_addr;
232 __u64 config1; /* extension of config */
233 };
234 union {
235 __u64 bp_len;
236 __u64 config2; /* extension of config1 */
237 };
229}; 238};
230 239
231/* 240/*
@@ -327,6 +336,15 @@ struct perf_event_header {
327enum perf_event_type { 336enum perf_event_type {
328 337
329 /* 338 /*
339 * If perf_event_attr.sample_id_all is set then all event types will
340 * have the sample_type selected fields related to where/when
341 * (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID)
342 * described in PERF_RECORD_SAMPLE below, it will be stashed just after
343 * the perf_event_header and the fields already present for the existing
344 * fields, i.e. at the end of the payload. That way a newer perf.data
345 * file will be supported by older perf tools, with these new optional
346 * fields being ignored.
347 *
330 * The MMAP events record the PROT_EXEC mappings so that we can 348 * The MMAP events record the PROT_EXEC mappings so that we can
331 * correlate userspace IPs to code. They have the following structure: 349 * correlate userspace IPs to code. They have the following structure:
332 * 350 *
@@ -452,8 +470,9 @@ enum perf_callchain_context {
452 PERF_CONTEXT_MAX = (__u64)-4095, 470 PERF_CONTEXT_MAX = (__u64)-4095,
453}; 471};
454 472
455#define PERF_FLAG_FD_NO_GROUP (1U << 0) 473#define PERF_FLAG_FD_NO_GROUP (1U << 0)
456#define PERF_FLAG_FD_OUTPUT (1U << 1) 474#define PERF_FLAG_FD_OUTPUT (1U << 1)
475#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
457 476
458#ifdef __KERNEL__ 477#ifdef __KERNEL__
459/* 478/*
@@ -461,14 +480,15 @@ enum perf_callchain_context {
461 */ 480 */
462 481
463#ifdef CONFIG_PERF_EVENTS 482#ifdef CONFIG_PERF_EVENTS
483# include <linux/cgroup.h>
464# include <asm/perf_event.h> 484# include <asm/perf_event.h>
465# include <asm/local64.h> 485# include <asm/local64.h>
466#endif 486#endif
467 487
468struct perf_guest_info_callbacks { 488struct perf_guest_info_callbacks {
469 int (*is_in_guest) (void); 489 int (*is_in_guest)(void);
470 int (*is_user_mode) (void); 490 int (*is_user_mode)(void);
471 unsigned long (*get_guest_ip) (void); 491 unsigned long (*get_guest_ip)(void);
472}; 492};
473 493
474#ifdef CONFIG_HAVE_HW_BREAKPOINT 494#ifdef CONFIG_HAVE_HW_BREAKPOINT
@@ -487,7 +507,7 @@ struct perf_guest_info_callbacks {
487#include <linux/ftrace.h> 507#include <linux/ftrace.h>
488#include <linux/cpu.h> 508#include <linux/cpu.h>
489#include <linux/irq_work.h> 509#include <linux/irq_work.h>
490#include <linux/jump_label_ref.h> 510#include <linux/jump_label.h>
491#include <asm/atomic.h> 511#include <asm/atomic.h>
492#include <asm/local.h> 512#include <asm/local.h>
493 513
@@ -529,6 +549,9 @@ struct hw_perf_event {
529 unsigned long event_base; 549 unsigned long event_base;
530 int idx; 550 int idx;
531 int last_cpu; 551 int last_cpu;
552 unsigned int extra_reg;
553 u64 extra_config;
554 int extra_alloc;
532 }; 555 };
533 struct { /* software */ 556 struct { /* software */
534 struct hrtimer hrtimer; 557 struct hrtimer hrtimer;
@@ -578,6 +601,10 @@ struct perf_event;
578struct pmu { 601struct pmu {
579 struct list_head entry; 602 struct list_head entry;
580 603
604 struct device *dev;
605 char *name;
606 int type;
607
581 int * __percpu pmu_disable_count; 608 int * __percpu pmu_disable_count;
582 struct perf_cpu_context * __percpu pmu_cpu_context; 609 struct perf_cpu_context * __percpu pmu_cpu_context;
583 int task_ctx_nr; 610 int task_ctx_nr;
@@ -627,19 +654,19 @@ struct pmu {
627 * Start the transaction, after this ->add() doesn't need to 654 * Start the transaction, after this ->add() doesn't need to
628 * do schedulability tests. 655 * do schedulability tests.
629 */ 656 */
630 void (*start_txn) (struct pmu *pmu); /* optional */ 657 void (*start_txn) (struct pmu *pmu); /* optional */
631 /* 658 /*
632 * If ->start_txn() disabled the ->add() schedulability test 659 * If ->start_txn() disabled the ->add() schedulability test
633 * then ->commit_txn() is required to perform one. On success 660 * then ->commit_txn() is required to perform one. On success
634 * the transaction is closed. On error the transaction is kept 661 * the transaction is closed. On error the transaction is kept
635 * open until ->cancel_txn() is called. 662 * open until ->cancel_txn() is called.
636 */ 663 */
637 int (*commit_txn) (struct pmu *pmu); /* optional */ 664 int (*commit_txn) (struct pmu *pmu); /* optional */
638 /* 665 /*
639 * Will cancel the transaction, assumes ->del() is called 666 * Will cancel the transaction, assumes ->del() is called
640 * for each successfull ->add() during the transaction. 667 * for each successful ->add() during the transaction.
641 */ 668 */
642 void (*cancel_txn) (struct pmu *pmu); /* optional */ 669 void (*cancel_txn) (struct pmu *pmu); /* optional */
643}; 670};
644 671
645/** 672/**
@@ -687,21 +714,37 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
687 struct pt_regs *regs); 714 struct pt_regs *regs);
688 715
689enum perf_group_flag { 716enum perf_group_flag {
690 PERF_GROUP_SOFTWARE = 0x1, 717 PERF_GROUP_SOFTWARE = 0x1,
691}; 718};
692 719
693#define SWEVENT_HLIST_BITS 8 720#define SWEVENT_HLIST_BITS 8
694#define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS) 721#define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS)
695 722
696struct swevent_hlist { 723struct swevent_hlist {
697 struct hlist_head heads[SWEVENT_HLIST_SIZE]; 724 struct hlist_head heads[SWEVENT_HLIST_SIZE];
698 struct rcu_head rcu_head; 725 struct rcu_head rcu_head;
699}; 726};
700 727
701#define PERF_ATTACH_CONTEXT 0x01 728#define PERF_ATTACH_CONTEXT 0x01
702#define PERF_ATTACH_GROUP 0x02 729#define PERF_ATTACH_GROUP 0x02
703#define PERF_ATTACH_TASK 0x04 730#define PERF_ATTACH_TASK 0x04
704 731
732#ifdef CONFIG_CGROUP_PERF
733/*
734 * perf_cgroup_info keeps track of time_enabled for a cgroup.
735 * This is a per-cpu dynamically allocated data structure.
736 */
737struct perf_cgroup_info {
738 u64 time;
739 u64 timestamp;
740};
741
742struct perf_cgroup {
743 struct cgroup_subsys_state css;
744 struct perf_cgroup_info *info; /* timing info, one per cpu */
745};
746#endif
747
705/** 748/**
706 * struct perf_event - performance event kernel representation: 749 * struct perf_event - performance event kernel representation:
707 */ 750 */
@@ -747,7 +790,20 @@ struct perf_event {
747 u64 tstamp_running; 790 u64 tstamp_running;
748 u64 tstamp_stopped; 791 u64 tstamp_stopped;
749 792
793 /*
794 * timestamp shadows the actual context timing but it can
795 * be safely used in NMI interrupt context. It reflects the
796 * context time as it was when the event was last scheduled in.
797 *
798 * ctx_time already accounts for ctx->timestamp. Therefore to
799 * compute ctx_time for a sample, simply add perf_clock().
800 */
801 u64 shadow_ctx_time;
802
750 struct perf_event_attr attr; 803 struct perf_event_attr attr;
804 u16 header_size;
805 u16 id_header_size;
806 u16 read_size;
751 struct hw_perf_event hw; 807 struct hw_perf_event hw;
752 808
753 struct perf_event_context *ctx; 809 struct perf_event_context *ctx;
@@ -805,6 +861,11 @@ struct perf_event {
805 struct event_filter *filter; 861 struct event_filter *filter;
806#endif 862#endif
807 863
864#ifdef CONFIG_CGROUP_PERF
865 struct perf_cgroup *cgrp; /* cgroup event is attach to */
866 int cgrp_defer_enabled;
867#endif
868
808#endif /* CONFIG_PERF_EVENTS */ 869#endif /* CONFIG_PERF_EVENTS */
809}; 870};
810 871
@@ -819,8 +880,8 @@ enum perf_event_context_type {
819 * Used as a container for task events and CPU events as well: 880 * Used as a container for task events and CPU events as well:
820 */ 881 */
821struct perf_event_context { 882struct perf_event_context {
822 enum perf_event_context_type type;
823 struct pmu *pmu; 883 struct pmu *pmu;
884 enum perf_event_context_type type;
824 /* 885 /*
825 * Protect the states of the events in the list, 886 * Protect the states of the events in the list,
826 * nr_active, and the list: 887 * nr_active, and the list:
@@ -840,6 +901,7 @@ struct perf_event_context {
840 int nr_active; 901 int nr_active;
841 int is_active; 902 int is_active;
842 int nr_stat; 903 int nr_stat;
904 int rotate_disable;
843 atomic_t refcount; 905 atomic_t refcount;
844 struct task_struct *task; 906 struct task_struct *task;
845 907
@@ -858,11 +920,12 @@ struct perf_event_context {
858 u64 generation; 920 u64 generation;
859 int pin_count; 921 int pin_count;
860 struct rcu_head rcu_head; 922 struct rcu_head rcu_head;
923 int nr_cgroups; /* cgroup events present */
861}; 924};
862 925
863/* 926/*
864 * Number of contexts where an event can trigger: 927 * Number of contexts where an event can trigger:
865 * task, softirq, hardirq, nmi. 928 * task, softirq, hardirq, nmi.
866 */ 929 */
867#define PERF_NR_CONTEXTS 4 930#define PERF_NR_CONTEXTS 4
868 931
@@ -876,6 +939,8 @@ struct perf_cpu_context {
876 int exclusive; 939 int exclusive;
877 struct list_head rotation_list; 940 struct list_head rotation_list;
878 int jiffies_interval; 941 int jiffies_interval;
942 struct pmu *active_pmu;
943 struct perf_cgroup *cgrp;
879}; 944};
880 945
881struct perf_output_handle { 946struct perf_output_handle {
@@ -891,27 +956,13 @@ struct perf_output_handle {
891 956
892#ifdef CONFIG_PERF_EVENTS 957#ifdef CONFIG_PERF_EVENTS
893 958
894extern int perf_pmu_register(struct pmu *pmu); 959extern int perf_pmu_register(struct pmu *pmu, char *name, int type);
895extern void perf_pmu_unregister(struct pmu *pmu); 960extern void perf_pmu_unregister(struct pmu *pmu);
896 961
897extern int perf_num_counters(void); 962extern int perf_num_counters(void);
898extern const char *perf_pmu_name(void); 963extern const char *perf_pmu_name(void);
899extern void __perf_event_task_sched_in(struct task_struct *task); 964extern void __perf_event_task_sched_in(struct task_struct *task);
900extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); 965extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
901
902extern atomic_t perf_task_events;
903
904static inline void perf_event_task_sched_in(struct task_struct *task)
905{
906 COND_STMT(&perf_task_events, __perf_event_task_sched_in(task));
907}
908
909static inline
910void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
911{
912 COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
913}
914
915extern int perf_event_init_task(struct task_struct *child); 966extern int perf_event_init_task(struct task_struct *child);
916extern void perf_event_exit_task(struct task_struct *child); 967extern void perf_event_exit_task(struct task_struct *child);
917extern void perf_event_free_task(struct task_struct *task); 968extern void perf_event_free_task(struct task_struct *task);
@@ -952,8 +1003,7 @@ struct perf_sample_data {
952 struct perf_raw_record *raw; 1003 struct perf_raw_record *raw;
953}; 1004};
954 1005
955static inline 1006static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
956void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
957{ 1007{
958 data->addr = addr; 1008 data->addr = addr;
959 data->raw = NULL; 1009 data->raw = NULL;
@@ -972,6 +1022,11 @@ extern int perf_event_overflow(struct perf_event *event, int nmi,
972 struct perf_sample_data *data, 1022 struct perf_sample_data *data,
973 struct pt_regs *regs); 1023 struct pt_regs *regs);
974 1024
1025static inline bool is_sampling_event(struct perf_event *event)
1026{
1027 return event->attr.sample_period != 0;
1028}
1029
975/* 1030/*
976 * Return 1 for a software event, 0 for a hardware event 1031 * Return 1 for a software event, 0 for a hardware event
977 */ 1032 */
@@ -980,13 +1035,12 @@ static inline int is_software_event(struct perf_event *event)
980 return event->pmu->task_ctx_nr == perf_sw_context; 1035 return event->pmu->task_ctx_nr == perf_sw_context;
981} 1036}
982 1037
983extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; 1038extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
984 1039
985extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 1040extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
986 1041
987#ifndef perf_arch_fetch_caller_regs 1042#ifndef perf_arch_fetch_caller_regs
988static inline void 1043static inline void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
989perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
990#endif 1044#endif
991 1045
992/* 1046/*
@@ -1009,15 +1063,28 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
1009{ 1063{
1010 struct pt_regs hot_regs; 1064 struct pt_regs hot_regs;
1011 1065
1012 JUMP_LABEL(&perf_swevent_enabled[event_id], have_event); 1066 if (static_branch(&perf_swevent_enabled[event_id])) {
1013 return; 1067 if (!regs) {
1014 1068 perf_fetch_caller_regs(&hot_regs);
1015have_event: 1069 regs = &hot_regs;
1016 if (!regs) { 1070 }
1017 perf_fetch_caller_regs(&hot_regs); 1071 __perf_sw_event(event_id, nr, nmi, regs, addr);
1018 regs = &hot_regs;
1019 } 1072 }
1020 __perf_sw_event(event_id, nr, nmi, regs, addr); 1073}
1074
1075extern struct jump_label_key perf_sched_events;
1076
1077static inline void perf_event_task_sched_in(struct task_struct *task)
1078{
1079 if (static_branch(&perf_sched_events))
1080 __perf_event_task_sched_in(task);
1081}
1082
1083static inline void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next)
1084{
1085 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
1086
1087 __perf_event_task_sched_out(task, next);
1021} 1088}
1022 1089
1023extern void perf_event_mmap(struct vm_area_struct *vma); 1090extern void perf_event_mmap(struct vm_area_struct *vma);
@@ -1031,14 +1098,10 @@ extern void perf_event_fork(struct task_struct *tsk);
1031/* Callchains */ 1098/* Callchains */
1032DECLARE_PER_CPU(struct perf_callchain_entry, perf_callchain_entry); 1099DECLARE_PER_CPU(struct perf_callchain_entry, perf_callchain_entry);
1033 1100
1034extern void perf_callchain_user(struct perf_callchain_entry *entry, 1101extern void perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs);
1035 struct pt_regs *regs); 1102extern void perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs);
1036extern void perf_callchain_kernel(struct perf_callchain_entry *entry,
1037 struct pt_regs *regs);
1038
1039 1103
1040static inline void 1104static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
1041perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
1042{ 1105{
1043 if (entry->nr < PERF_MAX_STACK_DEPTH) 1106 if (entry->nr < PERF_MAX_STACK_DEPTH)
1044 entry->ip[entry->nr++] = ip; 1107 entry->ip[entry->nr++] = ip;
@@ -1048,6 +1111,10 @@ extern int sysctl_perf_event_paranoid;
1048extern int sysctl_perf_event_mlock; 1111extern int sysctl_perf_event_mlock;
1049extern int sysctl_perf_event_sample_rate; 1112extern int sysctl_perf_event_sample_rate;
1050 1113
1114extern int perf_proc_update_handler(struct ctl_table *table, int write,
1115 void __user *buffer, size_t *lenp,
1116 loff_t *ppos);
1117
1051static inline bool perf_paranoid_tracepoint_raw(void) 1118static inline bool perf_paranoid_tracepoint_raw(void)
1052{ 1119{
1053 return sysctl_perf_event_paranoid > -1; 1120 return sysctl_perf_event_paranoid > -1;
@@ -1070,9 +1137,9 @@ extern void perf_tp_event(u64 addr, u64 count, void *record,
1070extern void perf_bp_event(struct perf_event *event, void *data); 1137extern void perf_bp_event(struct perf_event *event, void *data);
1071 1138
1072#ifndef perf_misc_flags 1139#ifndef perf_misc_flags
1073#define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ 1140# define perf_misc_flags(regs) \
1074 PERF_RECORD_MISC_KERNEL) 1141 (user_mode(regs) ? PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL)
1075#define perf_instruction_pointer(regs) instruction_pointer(regs) 1142# define perf_instruction_pointer(regs) instruction_pointer(regs)
1076#endif 1143#endif
1077 1144
1078extern int perf_output_begin(struct perf_output_handle *handle, 1145extern int perf_output_begin(struct perf_output_handle *handle,
@@ -1107,9 +1174,9 @@ static inline void
1107perf_bp_event(struct perf_event *event, void *data) { } 1174perf_bp_event(struct perf_event *event, void *data) { }
1108 1175
1109static inline int perf_register_guest_info_callbacks 1176static inline int perf_register_guest_info_callbacks
1110(struct perf_guest_info_callbacks *callbacks) { return 0; } 1177(struct perf_guest_info_callbacks *callbacks) { return 0; }
1111static inline int perf_unregister_guest_info_callbacks 1178static inline int perf_unregister_guest_info_callbacks
1112(struct perf_guest_info_callbacks *callbacks) { return 0; } 1179(struct perf_guest_info_callbacks *callbacks) { return 0; }
1113 1180
1114static inline void perf_event_mmap(struct vm_area_struct *vma) { } 1181static inline void perf_event_mmap(struct vm_area_struct *vma) { }
1115static inline void perf_event_comm(struct task_struct *tsk) { } 1182static inline void perf_event_comm(struct task_struct *tsk) { }
@@ -1122,23 +1189,22 @@ static inline void perf_event_disable(struct perf_event *event) { }
1122static inline void perf_event_task_tick(void) { } 1189static inline void perf_event_task_tick(void) { }
1123#endif 1190#endif
1124 1191
1125#define perf_output_put(handle, x) \ 1192#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
1126 perf_output_copy((handle), &(x), sizeof(x))
1127 1193
1128/* 1194/*
1129 * This has to have a higher priority than migration_notifier in sched.c. 1195 * This has to have a higher priority than migration_notifier in sched.c.
1130 */ 1196 */
1131#define perf_cpu_notifier(fn) \ 1197#define perf_cpu_notifier(fn) \
1132do { \ 1198do { \
1133 static struct notifier_block fn##_nb __cpuinitdata = \ 1199 static struct notifier_block fn##_nb __cpuinitdata = \
1134 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 1200 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
1135 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 1201 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
1136 (void *)(unsigned long)smp_processor_id()); \ 1202 (void *)(unsigned long)smp_processor_id()); \
1137 fn(&fn##_nb, (unsigned long)CPU_STARTING, \ 1203 fn(&fn##_nb, (unsigned long)CPU_STARTING, \
1138 (void *)(unsigned long)smp_processor_id()); \ 1204 (void *)(unsigned long)smp_processor_id()); \
1139 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ 1205 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
1140 (void *)(unsigned long)smp_processor_id()); \ 1206 (void *)(unsigned long)smp_processor_id()); \
1141 register_cpu_notifier(&fn##_nb); \ 1207 register_cpu_notifier(&fn##_nb); \
1142} while (0) 1208} while (0)
1143 1209
1144#endif /* __KERNEL__ */ 1210#endif /* __KERNEL__ */
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 26c8df786918..6fb13841db45 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -36,9 +36,7 @@
36/* Socket options for SOL_PNPIPE level */ 36/* Socket options for SOL_PNPIPE level */
37#define PNPIPE_ENCAP 1 37#define PNPIPE_ENCAP 1
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39#define PNPIPE_PIPE_HANDLE 3 39#define PNPIPE_HANDLE 3
40#define PNPIPE_ENABLE 4
41/* unused slot */
42 40
43#define PNADDR_ANY 0 41#define PNADDR_ANY 0
44#define PNADDR_BROADCAST 0xFC 42#define PNADDR_BROADCAST 0xFC
diff --git a/include/linux/phy.h b/include/linux/phy.h
index a6e047a04f79..7da5fa845959 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -472,11 +472,7 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
472int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 472int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
473struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 473struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
474int phy_device_register(struct phy_device *phy); 474int phy_device_register(struct phy_device *phy);
475int phy_clear_interrupt(struct phy_device *phydev);
476int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
477int phy_init_hw(struct phy_device *phydev); 475int phy_init_hw(struct phy_device *phydev);
478int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
479 u32 flags, phy_interface_t interface);
480struct phy_device * phy_attach(struct net_device *dev, 476struct phy_device * phy_attach(struct net_device *dev,
481 const char *bus_id, u32 flags, phy_interface_t interface); 477 const char *bus_id, u32 flags, phy_interface_t interface);
482struct phy_device *phy_find_first(struct mii_bus *bus); 478struct phy_device *phy_find_first(struct mii_bus *bus);
@@ -492,17 +488,12 @@ void phy_start(struct phy_device *phydev);
492void phy_stop(struct phy_device *phydev); 488void phy_stop(struct phy_device *phydev);
493int phy_start_aneg(struct phy_device *phydev); 489int phy_start_aneg(struct phy_device *phydev);
494 490
495void phy_sanitize_settings(struct phy_device *phydev);
496int phy_stop_interrupts(struct phy_device *phydev); 491int phy_stop_interrupts(struct phy_device *phydev);
497int phy_enable_interrupts(struct phy_device *phydev);
498int phy_disable_interrupts(struct phy_device *phydev);
499 492
500static inline int phy_read_status(struct phy_device *phydev) { 493static inline int phy_read_status(struct phy_device *phydev) {
501 return phydev->drv->read_status(phydev); 494 return phydev->drv->read_status(phydev);
502} 495}
503 496
504int genphy_config_advert(struct phy_device *phydev);
505int genphy_setup_forced(struct phy_device *phydev);
506int genphy_restart_aneg(struct phy_device *phydev); 497int genphy_restart_aneg(struct phy_device *phydev);
507int genphy_config_aneg(struct phy_device *phydev); 498int genphy_config_aneg(struct phy_device *phydev);
508int genphy_update_link(struct phy_device *phydev); 499int genphy_update_link(struct phy_device *phydev);
@@ -511,8 +502,6 @@ int genphy_suspend(struct phy_device *phydev);
511int genphy_resume(struct phy_device *phydev); 502int genphy_resume(struct phy_device *phydev);
512void phy_driver_unregister(struct phy_driver *drv); 503void phy_driver_unregister(struct phy_driver *drv);
513int phy_driver_register(struct phy_driver *new_driver); 504int phy_driver_register(struct phy_driver *new_driver);
514void phy_prepare_link(struct phy_device *phydev,
515 void (*adjust_link)(struct net_device *));
516void phy_state_machine(struct work_struct *work); 505void phy_state_machine(struct work_struct *work);
517void phy_start_machine(struct phy_device *phydev, 506void phy_start_machine(struct phy_device *phydev,
518 void (*handler)(struct net_device *)); 507 void (*handler)(struct net_device *));
@@ -523,7 +512,6 @@ int phy_mii_ioctl(struct phy_device *phydev,
523 struct ifreq *ifr, int cmd); 512 struct ifreq *ifr, int cmd);
524int phy_start_interrupts(struct phy_device *phydev); 513int phy_start_interrupts(struct phy_device *phydev);
525void phy_print_status(struct phy_device *phydev); 514void phy_print_status(struct phy_device *phydev);
526struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
527void phy_device_free(struct phy_device *phydev); 515void phy_device_free(struct phy_device *phydev);
528 516
529int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask, 517int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 49f1c2f66e95..cdced84261d7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -21,7 +21,7 @@ enum pid_type
21 * quickly from the numeric pid value. The attached processes may be 21 * quickly from the numeric pid value. The attached processes may be
22 * quickly accessed by following pointers from struct pid. 22 * quickly accessed by following pointers from struct pid.
23 * 23 *
24 * Storing pid_t values in the kernel and refering to them later has a 24 * Storing pid_t values in the kernel and referring to them later has a
25 * problem. The process originally with that pid may have exited and the 25 * problem. The process originally with that pid may have exited and the
26 * pid allocator wrapped, and another process could have come along 26 * pid allocator wrapped, and another process could have come along
27 * and been assigned that pid. 27 * and been assigned that pid.
@@ -117,7 +117,7 @@ extern struct pid *find_vpid(int nr);
117 */ 117 */
118extern struct pid *find_get_pid(int nr); 118extern struct pid *find_get_pid(int nr);
119extern struct pid *find_ge_pid(int nr, struct pid_namespace *); 119extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
120int next_pidmap(struct pid_namespace *pid_ns, int last); 120int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
121 121
122extern struct pid *alloc_pid(struct pid_namespace *ns); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
@@ -141,6 +141,17 @@ static inline struct pid_namespace *ns_of_pid(struct pid *pid)
141} 141}
142 142
143/* 143/*
144 * is_child_reaper returns true if the pid is the init process
145 * of the current namespace. As this one could be checked before
146 * pid_ns->child_reaper is assigned in copy_process, we check
147 * with the pid number.
148 */
149static inline bool is_child_reaper(struct pid *pid)
150{
151 return pid->numbers[pid->level].nr == 1;
152}
153
154/*
144 * the helpers to get the pid's id seen from different namespaces 155 * the helpers to get the pid's id seen from different namespaces
145 * 156 *
146 * pid_nr() : global id, i.e. the id seen from the init namespace; 157 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 445796945ac9..77257c92155a 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -30,6 +30,7 @@ struct pipe_buffer {
30 * struct pipe_inode_info - a linux kernel pipe 30 * struct pipe_inode_info - a linux kernel pipe
31 * @wait: reader/writer wait point in case of empty/full pipe 31 * @wait: reader/writer wait point in case of empty/full pipe
32 * @nrbufs: the number of non-empty pipe buffers in this pipe 32 * @nrbufs: the number of non-empty pipe buffers in this pipe
33 * @buffers: total number of buffers (should be a power of 2)
33 * @curbuf: the current pipe buffer entry 34 * @curbuf: the current pipe buffer entry
34 * @tmp_page: cached released page 35 * @tmp_page: cached released page
35 * @readers: number of current readers of this pipe 36 * @readers: number of current readers of this pipe
@@ -160,5 +161,6 @@ void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
160 161
161/* for F_SETPIPE_SZ and F_GETPIPE_SZ */ 162/* for F_SETPIPE_SZ and F_GETPIPE_SZ */
162long pipe_fcntl(struct file *, unsigned int, unsigned long arg); 163long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
164struct pipe_inode_info *get_pipe_info(struct file *file);
163 165
164#endif 166#endif
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 2cfa4bc8dea6..c5336705921f 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -223,7 +223,7 @@ struct tc_gred_qopt {
223 __u32 limit; /* HARD maximal queue length (bytes) */ 223 __u32 limit; /* HARD maximal queue length (bytes) */
224 __u32 qth_min; /* Min average length threshold (bytes) */ 224 __u32 qth_min; /* Min average length threshold (bytes) */
225 __u32 qth_max; /* Max average length threshold (bytes) */ 225 __u32 qth_max; /* Max average length threshold (bytes) */
226 __u32 DP; /* upto 2^32 DPs */ 226 __u32 DP; /* up to 2^32 DPs */
227 __u32 backlog; 227 __u32 backlog;
228 __u32 qave; 228 __u32 qave;
229 __u32 forced; 229 __u32 forced;
@@ -247,6 +247,35 @@ struct tc_gred_sopt {
247 __u16 pad1; 247 __u16 pad1;
248}; 248};
249 249
250/* CHOKe section */
251
252enum {
253 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB,
256 __TCA_CHOKE_MAX,
257};
258
259#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1)
260
261struct tc_choke_qopt {
262 __u32 limit; /* Hard queue length (packets) */
263 __u32 qth_min; /* Min average threshold (packets) */
264 __u32 qth_max; /* Max average threshold (packets) */
265 unsigned char Wlog; /* log(W) */
266 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
267 unsigned char Scell_log; /* cell size for idle damping */
268 unsigned char flags; /* see RED flags */
269};
270
271struct tc_choke_xstats {
272 __u32 early; /* Early drops */
273 __u32 pdrop; /* Drops due to queue limits */
274 __u32 other; /* Drops due to drop() calls */
275 __u32 marked; /* Marked packets */
276 __u32 matched; /* Drops due to flow match */
277};
278
250/* HTB section */ 279/* HTB section */
251#define TC_HTB_NUMPRIO 8 280#define TC_HTB_NUMPRIO 8
252#define TC_HTB_MAXDEPTH 8 281#define TC_HTB_MAXDEPTH 8
@@ -435,6 +464,7 @@ enum {
435 TCA_NETEM_DELAY_DIST, 464 TCA_NETEM_DELAY_DIST,
436 TCA_NETEM_REORDER, 465 TCA_NETEM_REORDER,
437 TCA_NETEM_CORRUPT, 466 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS,
438 __TCA_NETEM_MAX, 468 __TCA_NETEM_MAX,
439}; 469};
440 470
@@ -465,7 +495,33 @@ struct tc_netem_corrupt {
465 __u32 correlation; 495 __u32 correlation;
466}; 496};
467 497
498enum {
499 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
501 NETEM_LOSS_GE, /* Gilbert Elliot models */
502 __NETEM_LOSS_MAX
503};
504#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
505
506/* State transition probablities for 4 state model */
507struct tc_netem_gimodel {
508 __u32 p13;
509 __u32 p31;
510 __u32 p32;
511 __u32 p14;
512 __u32 p23;
513};
514
515/* Gilbert-Elliot models */
516struct tc_netem_gemodel {
517 __u32 p;
518 __u32 r;
519 __u32 h;
520 __u32 k1;
521};
522
468#define NETEM_DIST_SCALE 8192 523#define NETEM_DIST_SCALE 8192
524#define NETEM_DIST_MAX 16384
469 525
470/* DRR */ 526/* DRR */
471 527
@@ -481,4 +537,70 @@ struct tc_drr_stats {
481 __u32 deficit; 537 __u32 deficit;
482}; 538};
483 539
540/* MQPRIO */
541#define TC_QOPT_BITMASK 15
542#define TC_QOPT_MAX_QUEUE 16
543
544struct tc_mqprio_qopt {
545 __u8 num_tc;
546 __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
547 __u8 hw;
548 __u16 count[TC_QOPT_MAX_QUEUE];
549 __u16 offset[TC_QOPT_MAX_QUEUE];
550};
551
552/* SFB */
553
554enum {
555 TCA_SFB_UNSPEC,
556 TCA_SFB_PARMS,
557 __TCA_SFB_MAX,
558};
559
560#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
561
562/*
563 * Note: increment, decrement are Q0.16 fixed-point values.
564 */
565struct tc_sfb_qopt {
566 __u32 rehash_interval; /* delay between hash move, in ms */
567 __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */
568 __u32 max; /* max len of qlen_min */
569 __u32 bin_size; /* maximum queue length per bin */
570 __u32 increment; /* probability increment, (d1 in Blue) */
571 __u32 decrement; /* probability decrement, (d2 in Blue) */
572 __u32 limit; /* max SFB queue length */
573 __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */
574 __u32 penalty_burst;
575};
576
577struct tc_sfb_xstats {
578 __u32 earlydrop;
579 __u32 penaltydrop;
580 __u32 bucketdrop;
581 __u32 queuedrop;
582 __u32 childdrop; /* drops in child qdisc */
583 __u32 marked;
584 __u32 maxqlen;
585 __u32 maxprob;
586 __u32 avgprob;
587};
588
589#define SFB_MAX_PROB 0xFFFF
590
591/* QFQ */
592enum {
593 TCA_QFQ_UNSPEC,
594 TCA_QFQ_WEIGHT,
595 TCA_QFQ_LMAX,
596 __TCA_QFQ_MAX
597};
598
599#define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1)
600
601struct tc_qfq_stats {
602 __u32 weight;
603 __u32 lmax;
604};
605
484#endif 606#endif
diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h
new file mode 100644
index 000000000000..98a2046f8b31
--- /dev/null
+++ b/include/linux/platform_data/msm_serial_hs.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2008 Google, Inc.
3 * Author: Nick Pelly <npelly@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MSM_SERIAL_HS_H
16#define __ASM_ARCH_MSM_SERIAL_HS_H
17
18#include <linux/serial_core.h>
19
20/* API to request the uart clock off or on for low power management
21 * Clients should call request_clock_off() when no uart data is expected,
22 * and must call request_clock_on() before any further uart data can be
23 * received. */
24extern void msm_hs_request_clock_off(struct uart_port *uport);
25extern void msm_hs_request_clock_on(struct uart_port *uport);
26
27/**
28 * struct msm_serial_hs_platform_data
29 * @rx_wakeup_irq: Rx activity irq
30 * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
31 * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
32 * @exit_lpm_cb: function called before every Tx transaction
33 *
34 * This is an optional structure required for UART Rx GPIO IRQ based
35 * wakeup from low power state. UART wakeup can be triggered by RX activity
36 * (using a wakeup GPIO on the UART RX pin). This should only be used if
37 * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
38 * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
39 * since the first RX byte will always be lost. RTS will be asserted even
40 * while the UART is clocked off in this mode of operation.
41 */
42struct msm_serial_hs_platform_data {
43 int rx_wakeup_irq;
44 unsigned char inject_rx_on_wakeup;
45 char rx_to_inject;
46 void (*exit_lpm_cb)(struct uart_port *);
47};
48
49#endif
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
new file mode 100644
index 000000000000..6bca5b569acb
--- /dev/null
+++ b/include/linux/platform_data/tegra_usb.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _TEGRA_USB_H_
16#define _TEGRA_USB_H_
17
18enum tegra_usb_operating_modes {
19 TEGRA_USB_DEVICE,
20 TEGRA_USB_HOST,
21 TEGRA_USB_OTG,
22};
23
24struct tegra_ehci_platform_data {
25 enum tegra_usb_operating_modes operating_mode;
26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend;
28 void *phy_config;
29};
30
31#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
new file mode 100644
index 000000000000..f39140aabc6f
--- /dev/null
+++ b/include/linux/platform_data/uio_pruss.h
@@ -0,0 +1,25 @@
1/*
2 * include/linux/platform_data/uio_pruss.h
3 *
4 * Platform data for uio_pruss driver
5 *
6 * Copyright (C) 2010-11 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef _UIO_PRUSS_H_
19#define _UIO_PRUSS_H_
20
21/* To configure the PRUSS INTC base offset for UIO driver */
22struct uio_pruss_pdata {
23 u32 pintc_base;
24};
25#endif /* _UIO_PRUSS_H_ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2e700ec0601f..ede1a80e3358 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -14,6 +14,8 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16 16
17struct mfd_cell;
18
17struct platform_device { 19struct platform_device {
18 const char * name; 20 const char * name;
19 int id; 21 int id;
@@ -23,6 +25,9 @@ struct platform_device {
23 25
24 const struct platform_device_id *id_entry; 26 const struct platform_device_id *id_entry;
25 27
28 /* MFD cell pointer */
29 struct mfd_cell *mfd_cell;
30
26 /* arch specific additions */ 31 /* arch specific additions */
27 struct pdev_archdata archdata; 32 struct pdev_archdata archdata;
28}; 33};
@@ -130,17 +135,21 @@ extern void platform_driver_unregister(struct platform_driver *);
130extern int platform_driver_probe(struct platform_driver *driver, 135extern int platform_driver_probe(struct platform_driver *driver,
131 int (*probe)(struct platform_device *)); 136 int (*probe)(struct platform_device *));
132 137
133#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 138static inline void *platform_get_drvdata(const struct platform_device *pdev)
134#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 139{
140 return dev_get_drvdata(&pdev->dev);
141}
142
143static inline void platform_set_drvdata(struct platform_device *pdev, void *data)
144{
145 dev_set_drvdata(&pdev->dev, data);
146}
135 147
136extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 148extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
137 int (*probe)(struct platform_device *), 149 int (*probe)(struct platform_device *),
138 struct resource *res, unsigned int n_res, 150 struct resource *res, unsigned int n_res,
139 const void *data, size_t size); 151 const void *data, size_t size);
140 152
141extern const struct dev_pm_ops * platform_bus_get_pm_ops(void);
142extern void platform_bus_set_pm_ops(const struct dev_pm_ops *pm);
143
144/* early platform driver interface */ 153/* early platform driver interface */
145struct early_platform_driver { 154struct early_platform_driver {
146 const char *class_str; 155 const char *class_str;
@@ -193,4 +202,64 @@ static inline char *early_platform_driver_setup_func(void) \
193} 202}
194#endif /* MODULE */ 203#endif /* MODULE */
195 204
205#ifdef CONFIG_PM_SLEEP
206extern int platform_pm_prepare(struct device *dev);
207extern void platform_pm_complete(struct device *dev);
208#else
209#define platform_pm_prepare NULL
210#define platform_pm_complete NULL
211#endif
212
213#ifdef CONFIG_SUSPEND
214extern int platform_pm_suspend(struct device *dev);
215extern int platform_pm_suspend_noirq(struct device *dev);
216extern int platform_pm_resume(struct device *dev);
217extern int platform_pm_resume_noirq(struct device *dev);
218#else
219#define platform_pm_suspend NULL
220#define platform_pm_resume NULL
221#define platform_pm_suspend_noirq NULL
222#define platform_pm_resume_noirq NULL
223#endif
224
225#ifdef CONFIG_HIBERNATE_CALLBACKS
226extern int platform_pm_freeze(struct device *dev);
227extern int platform_pm_freeze_noirq(struct device *dev);
228extern int platform_pm_thaw(struct device *dev);
229extern int platform_pm_thaw_noirq(struct device *dev);
230extern int platform_pm_poweroff(struct device *dev);
231extern int platform_pm_poweroff_noirq(struct device *dev);
232extern int platform_pm_restore(struct device *dev);
233extern int platform_pm_restore_noirq(struct device *dev);
234#else
235#define platform_pm_freeze NULL
236#define platform_pm_thaw NULL
237#define platform_pm_poweroff NULL
238#define platform_pm_restore NULL
239#define platform_pm_freeze_noirq NULL
240#define platform_pm_thaw_noirq NULL
241#define platform_pm_poweroff_noirq NULL
242#define platform_pm_restore_noirq NULL
243#endif
244
245#ifdef CONFIG_PM_SLEEP
246#define USE_PLATFORM_PM_SLEEP_OPS \
247 .prepare = platform_pm_prepare, \
248 .complete = platform_pm_complete, \
249 .suspend = platform_pm_suspend, \
250 .resume = platform_pm_resume, \
251 .freeze = platform_pm_freeze, \
252 .thaw = platform_pm_thaw, \
253 .poweroff = platform_pm_poweroff, \
254 .restore = platform_pm_restore, \
255 .suspend_noirq = platform_pm_suspend_noirq, \
256 .resume_noirq = platform_pm_resume_noirq, \
257 .freeze_noirq = platform_pm_freeze_noirq, \
258 .thaw_noirq = platform_pm_thaw_noirq, \
259 .poweroff_noirq = platform_pm_poweroff_noirq, \
260 .restore_noirq = platform_pm_restore_noirq,
261#else
262#define USE_PLATFORM_PM_SLEEP_OPS
263#endif
264
196#endif /* _PLATFORM_DEVICE_H_ */ 265#endif /* _PLATFORM_DEVICE_H_ */
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 7254eda078e5..c9b9f322c8d8 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -31,15 +31,17 @@
31 * 31 *
32 * Simple ASCII art explanation: 32 * Simple ASCII art explanation:
33 * 33 *
34 * |HEAD | 34 * pl:prio_list (only for plist_node)
35 * | | 35 * nl:node_list
36 * |prio_list.prev|<------------------------------------| 36 * HEAD| NODE(S)
37 * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-| 37 * |
38 * |10 | |10| |21| |21| |21| |40| (prio) 38 * ||------------------------------------|
39 * | | | | | | | | | | | | 39 * ||->|pl|<->|pl|<--------------->|pl|<-|
40 * | | | | | | | | | | | | 40 * | |10| |21| |21| |21| |40| (prio)
41 * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| 41 * | | | | | | | | | | |
42 * |node_list.prev|<------------------------------------| 42 * | | | | | | | | | | |
43 * |->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-|
44 * |-------------------------------------------|
43 * 45 *
44 * The nodes on the prio_list list are sorted by priority to simplify 46 * The nodes on the prio_list list are sorted by priority to simplify
45 * the insertion of new nodes. There are no nodes with duplicate 47 * the insertion of new nodes. There are no nodes with duplicate
@@ -78,7 +80,6 @@
78#include <linux/spinlock_types.h> 80#include <linux/spinlock_types.h>
79 81
80struct plist_head { 82struct plist_head {
81 struct list_head prio_list;
82 struct list_head node_list; 83 struct list_head node_list;
83#ifdef CONFIG_DEBUG_PI_LIST 84#ifdef CONFIG_DEBUG_PI_LIST
84 raw_spinlock_t *rawlock; 85 raw_spinlock_t *rawlock;
@@ -88,7 +89,8 @@ struct plist_head {
88 89
89struct plist_node { 90struct plist_node {
90 int prio; 91 int prio;
91 struct plist_head plist; 92 struct list_head prio_list;
93 struct list_head node_list;
92}; 94};
93 95
94#ifdef CONFIG_DEBUG_PI_LIST 96#ifdef CONFIG_DEBUG_PI_LIST
@@ -100,7 +102,6 @@ struct plist_node {
100#endif 102#endif
101 103
102#define _PLIST_HEAD_INIT(head) \ 104#define _PLIST_HEAD_INIT(head) \
103 .prio_list = LIST_HEAD_INIT((head).prio_list), \
104 .node_list = LIST_HEAD_INIT((head).node_list) 105 .node_list = LIST_HEAD_INIT((head).node_list)
105 106
106/** 107/**
@@ -133,7 +134,8 @@ struct plist_node {
133#define PLIST_NODE_INIT(node, __prio) \ 134#define PLIST_NODE_INIT(node, __prio) \
134{ \ 135{ \
135 .prio = (__prio), \ 136 .prio = (__prio), \
136 .plist = { _PLIST_HEAD_INIT((node).plist) }, \ 137 .prio_list = LIST_HEAD_INIT((node).prio_list), \
138 .node_list = LIST_HEAD_INIT((node).node_list), \
137} 139}
138 140
139/** 141/**
@@ -144,7 +146,6 @@ struct plist_node {
144static inline void 146static inline void
145plist_head_init(struct plist_head *head, spinlock_t *lock) 147plist_head_init(struct plist_head *head, spinlock_t *lock)
146{ 148{
147 INIT_LIST_HEAD(&head->prio_list);
148 INIT_LIST_HEAD(&head->node_list); 149 INIT_LIST_HEAD(&head->node_list);
149#ifdef CONFIG_DEBUG_PI_LIST 150#ifdef CONFIG_DEBUG_PI_LIST
150 head->spinlock = lock; 151 head->spinlock = lock;
@@ -160,7 +161,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
160static inline void 161static inline void
161plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) 162plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
162{ 163{
163 INIT_LIST_HEAD(&head->prio_list);
164 INIT_LIST_HEAD(&head->node_list); 164 INIT_LIST_HEAD(&head->node_list);
165#ifdef CONFIG_DEBUG_PI_LIST 165#ifdef CONFIG_DEBUG_PI_LIST
166 head->rawlock = lock; 166 head->rawlock = lock;
@@ -176,7 +176,8 @@ plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
176static inline void plist_node_init(struct plist_node *node, int prio) 176static inline void plist_node_init(struct plist_node *node, int prio)
177{ 177{
178 node->prio = prio; 178 node->prio = prio;
179 plist_head_init(&node->plist, NULL); 179 INIT_LIST_HEAD(&node->prio_list);
180 INIT_LIST_HEAD(&node->node_list);
180} 181}
181 182
182extern void plist_add(struct plist_node *node, struct plist_head *head); 183extern void plist_add(struct plist_node *node, struct plist_head *head);
@@ -188,7 +189,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
188 * @head: the head for your list 189 * @head: the head for your list
189 */ 190 */
190#define plist_for_each(pos, head) \ 191#define plist_for_each(pos, head) \
191 list_for_each_entry(pos, &(head)->node_list, plist.node_list) 192 list_for_each_entry(pos, &(head)->node_list, node_list)
192 193
193/** 194/**
194 * plist_for_each_safe - iterate safely over a plist of given type 195 * plist_for_each_safe - iterate safely over a plist of given type
@@ -199,7 +200,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
199 * Iterate over a plist of given type, safe against removal of list entry. 200 * Iterate over a plist of given type, safe against removal of list entry.
200 */ 201 */
201#define plist_for_each_safe(pos, n, head) \ 202#define plist_for_each_safe(pos, n, head) \
202 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) 203 list_for_each_entry_safe(pos, n, &(head)->node_list, node_list)
203 204
204/** 205/**
205 * plist_for_each_entry - iterate over list of given type 206 * plist_for_each_entry - iterate over list of given type
@@ -208,7 +209,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
208 * @mem: the name of the list_struct within the struct 209 * @mem: the name of the list_struct within the struct
209 */ 210 */
210#define plist_for_each_entry(pos, head, mem) \ 211#define plist_for_each_entry(pos, head, mem) \
211 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) 212 list_for_each_entry(pos, &(head)->node_list, mem.node_list)
212 213
213/** 214/**
214 * plist_for_each_entry_safe - iterate safely over list of given type 215 * plist_for_each_entry_safe - iterate safely over list of given type
@@ -220,7 +221,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
220 * Iterate over list of given type, safe against removal of list entry. 221 * Iterate over list of given type, safe against removal of list entry.
221 */ 222 */
222#define plist_for_each_entry_safe(pos, n, head, m) \ 223#define plist_for_each_entry_safe(pos, n, head, m) \
223 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) 224 list_for_each_entry_safe(pos, n, &(head)->node_list, m.node_list)
224 225
225/** 226/**
226 * plist_head_empty - return !0 if a plist_head is empty 227 * plist_head_empty - return !0 if a plist_head is empty
@@ -237,7 +238,7 @@ static inline int plist_head_empty(const struct plist_head *head)
237 */ 238 */
238static inline int plist_node_empty(const struct plist_node *node) 239static inline int plist_node_empty(const struct plist_node *node)
239{ 240{
240 return plist_head_empty(&node->plist); 241 return list_empty(&node->node_list);
241} 242}
242 243
243/* All functions below assume the plist_head is not empty. */ 244/* All functions below assume the plist_head is not empty. */
@@ -285,7 +286,7 @@ static inline int plist_node_empty(const struct plist_node *node)
285static inline struct plist_node *plist_first(const struct plist_head *head) 286static inline struct plist_node *plist_first(const struct plist_head *head)
286{ 287{
287 return list_entry(head->node_list.next, 288 return list_entry(head->node_list.next,
288 struct plist_node, plist.node_list); 289 struct plist_node, node_list);
289} 290}
290 291
291/** 292/**
@@ -297,7 +298,7 @@ static inline struct plist_node *plist_first(const struct plist_head *head)
297static inline struct plist_node *plist_last(const struct plist_head *head) 298static inline struct plist_node *plist_last(const struct plist_head *head)
298{ 299{
299 return list_entry(head->node_list.prev, 300 return list_entry(head->node_list.prev,
300 struct plist_node, plist.node_list); 301 struct plist_node, node_list);
301} 302}
302 303
303#endif 304#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 40f3f45702ba..3160648ccdda 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -267,7 +267,7 @@ const struct dev_pm_ops name = { \
267 * callbacks provided by device drivers supporting both the system sleep PM and 267 * callbacks provided by device drivers supporting both the system sleep PM and
268 * runtime PM, make the pm member point to generic_subsys_pm_ops. 268 * runtime PM, make the pm member point to generic_subsys_pm_ops.
269 */ 269 */
270#ifdef CONFIG_PM_OPS 270#ifdef CONFIG_PM
271extern struct dev_pm_ops generic_subsys_pm_ops; 271extern struct dev_pm_ops generic_subsys_pm_ops;
272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) 272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
273#else 273#else
@@ -367,45 +367,6 @@ extern struct dev_pm_ops generic_subsys_pm_ops;
367 { .event = PM_EVENT_AUTO_RESUME, }) 367 { .event = PM_EVENT_AUTO_RESUME, })
368 368
369/** 369/**
370 * Device power management states
371 *
372 * These state labels are used internally by the PM core to indicate the current
373 * status of a device with respect to the PM core operations.
374 *
375 * DPM_ON Device is regarded as operational. Set this way
376 * initially and when ->complete() is about to be called.
377 * Also set when ->prepare() fails.
378 *
379 * DPM_PREPARING Device is going to be prepared for a PM transition. Set
380 * when ->prepare() is about to be called.
381 *
382 * DPM_RESUMING Device is going to be resumed. Set when ->resume(),
383 * ->thaw(), or ->restore() is about to be called.
384 *
385 * DPM_SUSPENDING Device has been prepared for a power transition. Set
386 * when ->prepare() has just succeeded.
387 *
388 * DPM_OFF Device is regarded as inactive. Set immediately after
389 * ->suspend(), ->freeze(), or ->poweroff() has succeeded.
390 * Also set when ->resume()_noirq, ->thaw_noirq(), or
391 * ->restore_noirq() is about to be called.
392 *
393 * DPM_OFF_IRQ Device is in a "deep sleep". Set immediately after
394 * ->suspend_noirq(), ->freeze_noirq(), or
395 * ->poweroff_noirq() has just succeeded.
396 */
397
398enum dpm_state {
399 DPM_INVALID,
400 DPM_ON,
401 DPM_PREPARING,
402 DPM_RESUMING,
403 DPM_SUSPENDING,
404 DPM_OFF,
405 DPM_OFF_IRQ,
406};
407
408/**
409 * Device run-time power management status. 370 * Device run-time power management status.
410 * 371 *
411 * These status labels are used internally by the PM core to indicate the 372 * These status labels are used internally by the PM core to indicate the
@@ -463,13 +424,15 @@ struct wakeup_source;
463struct dev_pm_info { 424struct dev_pm_info {
464 pm_message_t power_state; 425 pm_message_t power_state;
465 unsigned int can_wakeup:1; 426 unsigned int can_wakeup:1;
466 unsigned async_suspend:1; 427 unsigned int async_suspend:1;
467 enum dpm_state status; /* Owned by the PM core */ 428 unsigned int in_suspend:1; /* Owned by the PM core */
468 spinlock_t lock; 429 spinlock_t lock;
469#ifdef CONFIG_PM_SLEEP 430#ifdef CONFIG_PM_SLEEP
470 struct list_head entry; 431 struct list_head entry;
471 struct completion completion; 432 struct completion completion;
472 struct wakeup_source *wakeup; 433 struct wakeup_source *wakeup;
434#else
435 unsigned int should_wakeup:1;
473#endif 436#endif
474#ifdef CONFIG_PM_RUNTIME 437#ifdef CONFIG_PM_RUNTIME
475 struct timer_list suspend_timer; 438 struct timer_list suspend_timer;
@@ -486,6 +449,7 @@ struct dev_pm_info {
486 unsigned int run_wake:1; 449 unsigned int run_wake:1;
487 unsigned int runtime_auto:1; 450 unsigned int runtime_auto:1;
488 unsigned int no_callbacks:1; 451 unsigned int no_callbacks:1;
452 unsigned int irq_safe:1;
489 unsigned int use_autosuspend:1; 453 unsigned int use_autosuspend:1;
490 unsigned int timer_autosuspends:1; 454 unsigned int timer_autosuspends:1;
491 enum rpm_request request; 455 enum rpm_request request;
@@ -496,11 +460,20 @@ struct dev_pm_info {
496 unsigned long active_jiffies; 460 unsigned long active_jiffies;
497 unsigned long suspended_jiffies; 461 unsigned long suspended_jiffies;
498 unsigned long accounting_timestamp; 462 unsigned long accounting_timestamp;
463 void *subsys_data; /* Owned by the subsystem. */
499#endif 464#endif
500}; 465};
501 466
502extern void update_pm_runtime_accounting(struct device *dev); 467extern void update_pm_runtime_accounting(struct device *dev);
503 468
469/*
470 * Power domains provide callbacks that are executed during system suspend,
471 * hibernation, system resume and during runtime PM transitions along with
472 * subsystem-level and driver-level callbacks.
473 */
474struct dev_power_domain {
475 struct dev_pm_ops ops;
476};
504 477
505/* 478/*
506 * The PM_EVENT_ messages are also used by drivers implementing the legacy 479 * The PM_EVENT_ messages are also used by drivers implementing the legacy
@@ -558,14 +531,16 @@ extern void update_pm_runtime_accounting(struct device *dev);
558 531
559#ifdef CONFIG_PM_SLEEP 532#ifdef CONFIG_PM_SLEEP
560extern void device_pm_lock(void); 533extern void device_pm_lock(void);
561extern int sysdev_resume(void);
562extern void dpm_resume_noirq(pm_message_t state); 534extern void dpm_resume_noirq(pm_message_t state);
563extern void dpm_resume_end(pm_message_t state); 535extern void dpm_resume_end(pm_message_t state);
536extern void dpm_resume(pm_message_t state);
537extern void dpm_complete(pm_message_t state);
564 538
565extern void device_pm_unlock(void); 539extern void device_pm_unlock(void);
566extern int sysdev_suspend(pm_message_t state);
567extern int dpm_suspend_noirq(pm_message_t state); 540extern int dpm_suspend_noirq(pm_message_t state);
568extern int dpm_suspend_start(pm_message_t state); 541extern int dpm_suspend_start(pm_message_t state);
542extern int dpm_suspend(pm_message_t state);
543extern int dpm_prepare(pm_message_t state);
569 544
570extern void __suspend_report_result(const char *function, void *fn, int ret); 545extern void __suspend_report_result(const char *function, void *fn, int ret);
571 546
@@ -575,6 +550,16 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
575 } while (0) 550 } while (0)
576 551
577extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); 552extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
553
554extern int pm_generic_prepare(struct device *dev);
555extern int pm_generic_suspend(struct device *dev);
556extern int pm_generic_resume(struct device *dev);
557extern int pm_generic_freeze(struct device *dev);
558extern int pm_generic_thaw(struct device *dev);
559extern int pm_generic_restore(struct device *dev);
560extern int pm_generic_poweroff(struct device *dev);
561extern void pm_generic_complete(struct device *dev);
562
578#else /* !CONFIG_PM_SLEEP */ 563#else /* !CONFIG_PM_SLEEP */
579 564
580#define device_pm_lock() do {} while (0) 565#define device_pm_lock() do {} while (0)
@@ -591,6 +576,15 @@ static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
591{ 576{
592 return 0; 577 return 0;
593} 578}
579
580#define pm_generic_prepare NULL
581#define pm_generic_suspend NULL
582#define pm_generic_resume NULL
583#define pm_generic_freeze NULL
584#define pm_generic_thaw NULL
585#define pm_generic_restore NULL
586#define pm_generic_poweroff NULL
587#define pm_generic_complete NULL
594#endif /* !CONFIG_PM_SLEEP */ 588#endif /* !CONFIG_PM_SLEEP */
595 589
596/* How to reorder dpm_list after device_move() */ 590/* How to reorder dpm_list after device_move() */
@@ -601,13 +595,4 @@ enum dpm_order {
601 DPM_ORDER_DEV_LAST, 595 DPM_ORDER_DEV_LAST,
602}; 596};
603 597
604/*
605 * Global Power Management flags
606 * Used to keep APM and ACPI from both being active
607 */
608extern unsigned int pm_flags;
609
610#define PM_APM 1
611#define PM_ACPI 2
612
613#endif /* _LINUX_PM_H */ 598#endif /* _LINUX_PM_H */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 3ec2358f8692..878cf84baeb1 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -40,6 +40,7 @@ extern int pm_generic_runtime_idle(struct device *dev);
40extern int pm_generic_runtime_suspend(struct device *dev); 40extern int pm_generic_runtime_suspend(struct device *dev);
41extern int pm_generic_runtime_resume(struct device *dev); 41extern int pm_generic_runtime_resume(struct device *dev);
42extern void pm_runtime_no_callbacks(struct device *dev); 42extern void pm_runtime_no_callbacks(struct device *dev);
43extern void pm_runtime_irq_safe(struct device *dev);
43extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); 44extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
44extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); 45extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
45extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 46extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
@@ -77,7 +78,18 @@ static inline void device_set_run_wake(struct device *dev, bool enable)
77 78
78static inline bool pm_runtime_suspended(struct device *dev) 79static inline bool pm_runtime_suspended(struct device *dev)
79{ 80{
80 return dev->power.runtime_status == RPM_SUSPENDED; 81 return dev->power.runtime_status == RPM_SUSPENDED
82 && !dev->power.disable_depth;
83}
84
85static inline bool pm_runtime_enabled(struct device *dev)
86{
87 return !dev->power.disable_depth;
88}
89
90static inline bool pm_runtime_callbacks_present(struct device *dev)
91{
92 return !dev->power.no_callbacks;
81} 93}
82 94
83static inline void pm_runtime_mark_last_busy(struct device *dev) 95static inline void pm_runtime_mark_last_busy(struct device *dev)
@@ -118,12 +130,15 @@ static inline void pm_runtime_put_noidle(struct device *dev) {}
118static inline bool device_run_wake(struct device *dev) { return false; } 130static inline bool device_run_wake(struct device *dev) { return false; }
119static inline void device_set_run_wake(struct device *dev, bool enable) {} 131static inline void device_set_run_wake(struct device *dev, bool enable) {}
120static inline bool pm_runtime_suspended(struct device *dev) { return false; } 132static inline bool pm_runtime_suspended(struct device *dev) { return false; }
133static inline bool pm_runtime_enabled(struct device *dev) { return false; }
121 134
122static inline int pm_generic_runtime_idle(struct device *dev) { return 0; } 135static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
123static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 136static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
124static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 137static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
125static inline void pm_runtime_no_callbacks(struct device *dev) {} 138static inline void pm_runtime_no_callbacks(struct device *dev) {}
139static inline void pm_runtime_irq_safe(struct device *dev) {}
126 140
141static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; }
127static inline void pm_runtime_mark_last_busy(struct device *dev) {} 142static inline void pm_runtime_mark_last_busy(struct device *dev) {}
128static inline void __pm_runtime_use_autosuspend(struct device *dev, 143static inline void __pm_runtime_use_autosuspend(struct device *dev,
129 bool use) {} 144 bool use) {}
@@ -195,6 +210,11 @@ static inline int pm_runtime_put_sync(struct device *dev)
195 return __pm_runtime_idle(dev, RPM_GET_PUT); 210 return __pm_runtime_idle(dev, RPM_GET_PUT);
196} 211}
197 212
213static inline int pm_runtime_put_sync_suspend(struct device *dev)
214{
215 return __pm_runtime_suspend(dev, RPM_GET_PUT);
216}
217
198static inline int pm_runtime_put_sync_autosuspend(struct device *dev) 218static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
199{ 219{
200 return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO); 220 return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO);
@@ -225,4 +245,46 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
225 __pm_runtime_use_autosuspend(dev, false); 245 __pm_runtime_use_autosuspend(dev, false);
226} 246}
227 247
248struct pm_clk_notifier_block {
249 struct notifier_block nb;
250 struct dev_power_domain *pwr_domain;
251 char *con_ids[];
252};
253
254#ifdef CONFIG_PM_RUNTIME_CLK
255extern int pm_runtime_clk_init(struct device *dev);
256extern void pm_runtime_clk_destroy(struct device *dev);
257extern int pm_runtime_clk_add(struct device *dev, const char *con_id);
258extern void pm_runtime_clk_remove(struct device *dev, const char *con_id);
259extern int pm_runtime_clk_suspend(struct device *dev);
260extern int pm_runtime_clk_resume(struct device *dev);
261#else
262static inline int pm_runtime_clk_init(struct device *dev)
263{
264 return -EINVAL;
265}
266static inline void pm_runtime_clk_destroy(struct device *dev)
267{
268}
269static inline int pm_runtime_clk_add(struct device *dev, const char *con_id)
270{
271 return -EINVAL;
272}
273static inline void pm_runtime_clk_remove(struct device *dev, const char *con_id)
274{
275}
276#define pm_runtime_clock_suspend NULL
277#define pm_runtime_clock_resume NULL
278#endif
279
280#ifdef CONFIG_HAVE_CLK
281extern void pm_runtime_clk_add_notifier(struct bus_type *bus,
282 struct pm_clk_notifier_block *clknb);
283#else
284static inline void pm_runtime_clk_add_notifier(struct bus_type *bus,
285 struct pm_clk_notifier_block *clknb)
286{
287}
288#endif
289
228#endif 290#endif
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 9cff00dd6b63..a32da962d693 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -62,18 +62,11 @@ struct wakeup_source {
62 * Changes to device_may_wakeup take effect on the next pm state change. 62 * Changes to device_may_wakeup take effect on the next pm state change.
63 */ 63 */
64 64
65static inline void device_set_wakeup_capable(struct device *dev, bool capable)
66{
67 dev->power.can_wakeup = capable;
68}
69
70static inline bool device_can_wakeup(struct device *dev) 65static inline bool device_can_wakeup(struct device *dev)
71{ 66{
72 return dev->power.can_wakeup; 67 return dev->power.can_wakeup;
73} 68}
74 69
75
76
77static inline bool device_may_wakeup(struct device *dev) 70static inline bool device_may_wakeup(struct device *dev)
78{ 71{
79 return dev->power.can_wakeup && !!dev->power.wakeup; 72 return dev->power.can_wakeup && !!dev->power.wakeup;
@@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name);
88extern void wakeup_source_unregister(struct wakeup_source *ws); 81extern void wakeup_source_unregister(struct wakeup_source *ws);
89extern int device_wakeup_enable(struct device *dev); 82extern int device_wakeup_enable(struct device *dev);
90extern int device_wakeup_disable(struct device *dev); 83extern int device_wakeup_disable(struct device *dev);
84extern void device_set_wakeup_capable(struct device *dev, bool capable);
91extern int device_init_wakeup(struct device *dev, bool val); 85extern int device_init_wakeup(struct device *dev, bool val);
92extern int device_set_wakeup_enable(struct device *dev, bool enable); 86extern int device_set_wakeup_enable(struct device *dev, bool enable);
93extern void __pm_stay_awake(struct wakeup_source *ws); 87extern void __pm_stay_awake(struct wakeup_source *ws);
@@ -109,11 +103,6 @@ static inline bool device_can_wakeup(struct device *dev)
109 return dev->power.can_wakeup; 103 return dev->power.can_wakeup;
110} 104}
111 105
112static inline bool device_may_wakeup(struct device *dev)
113{
114 return false;
115}
116
117static inline struct wakeup_source *wakeup_source_create(const char *name) 106static inline struct wakeup_source *wakeup_source_create(const char *name)
118{ 107{
119 return NULL; 108 return NULL;
@@ -134,24 +123,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {}
134 123
135static inline int device_wakeup_enable(struct device *dev) 124static inline int device_wakeup_enable(struct device *dev)
136{ 125{
137 return -EINVAL; 126 dev->power.should_wakeup = true;
127 return 0;
138} 128}
139 129
140static inline int device_wakeup_disable(struct device *dev) 130static inline int device_wakeup_disable(struct device *dev)
141{ 131{
132 dev->power.should_wakeup = false;
142 return 0; 133 return 0;
143} 134}
144 135
145static inline int device_init_wakeup(struct device *dev, bool val) 136static inline int device_set_wakeup_enable(struct device *dev, bool enable)
146{ 137{
147 dev->power.can_wakeup = val; 138 dev->power.should_wakeup = enable;
148 return val ? -EINVAL : 0; 139 return 0;
149} 140}
150 141
142static inline int device_init_wakeup(struct device *dev, bool val)
143{
144 device_set_wakeup_capable(dev, val);
145 device_set_wakeup_enable(dev, val);
146 return 0;
147}
151 148
152static inline int device_set_wakeup_enable(struct device *dev, bool enable) 149static inline bool device_may_wakeup(struct device *dev)
153{ 150{
154 return -EINVAL; 151 return dev->power.can_wakeup && dev->power.should_wakeup;
155} 152}
156 153
157static inline void __pm_stay_awake(struct wakeup_source *ws) {} 154static inline void __pm_stay_awake(struct wakeup_source *ws) {}
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 600cc1fde64d..cf40010ce0cd 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -57,7 +57,7 @@ struct poll_table_entry {
57}; 57};
58 58
59/* 59/*
60 * Structures and helpers for sys_poll/sys_poll 60 * Structures and helpers for select/poll syscall
61 */ 61 */
62struct poll_wqueues { 62struct poll_wqueues {
63 poll_table pt; 63 poll_table pt;
@@ -73,6 +73,8 @@ extern void poll_initwait(struct poll_wqueues *pwq);
73extern void poll_freewait(struct poll_wqueues *pwq); 73extern void poll_freewait(struct poll_wqueues *pwq);
74extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state, 74extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
75 ktime_t *expires, unsigned long slack); 75 ktime_t *expires, unsigned long slack);
76extern long select_estimate_accuracy(struct timespec *tv);
77
76 78
77static inline int poll_schedule(struct poll_wqueues *pwq, int state) 79static inline int poll_schedule(struct poll_wqueues *pwq, int state)
78{ 80{
@@ -80,7 +82,7 @@ static inline int poll_schedule(struct poll_wqueues *pwq, int state)
80} 82}
81 83
82/* 84/*
83 * Scaleable version of the fd_set. 85 * Scalable version of the fd_set.
84 */ 86 */
85 87
86typedef struct { 88typedef struct {
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
new file mode 100644
index 000000000000..7f1183dcd119
--- /dev/null
+++ b/include/linux/posix-clock.h
@@ -0,0 +1,151 @@
1/*
2 * posix-clock.h - support for dynamic clock devices
3 *
4 * Copyright (C) 2010 OMICRON electronics GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20#ifndef _LINUX_POSIX_CLOCK_H_
21#define _LINUX_POSIX_CLOCK_H_
22
23#include <linux/cdev.h>
24#include <linux/fs.h>
25#include <linux/poll.h>
26#include <linux/posix-timers.h>
27#include <linux/rwsem.h>
28
29struct posix_clock;
30
31/**
32 * struct posix_clock_operations - functional interface to the clock
33 *
34 * Every posix clock is represented by a character device. Drivers may
35 * optionally offer extended capabilities by implementing the
36 * character device methods. The character device file operations are
37 * first handled by the clock device layer, then passed on to the
38 * driver by calling these functions.
39 *
40 * @owner: The clock driver should set to THIS_MODULE
41 * @clock_adjtime: Adjust the clock
42 * @clock_gettime: Read the current time
43 * @clock_getres: Get the clock resolution
44 * @clock_settime: Set the current time value
45 * @timer_create: Create a new timer
46 * @timer_delete: Remove a previously created timer
47 * @timer_gettime: Get remaining time and interval of a timer
48 * @timer_setttime: Set a timer's initial expiration and interval
49 * @fasync: Optional character device fasync method
50 * @mmap: Optional character device mmap method
51 * @open: Optional character device open method
52 * @release: Optional character device release method
53 * @ioctl: Optional character device ioctl method
54 * @read: Optional character device read method
55 * @poll: Optional character device poll method
56 */
57struct posix_clock_operations {
58 struct module *owner;
59
60 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
61
62 int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts);
63
64 int (*clock_getres) (struct posix_clock *pc, struct timespec *ts);
65
66 int (*clock_settime)(struct posix_clock *pc,
67 const struct timespec *ts);
68
69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
70
71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
72
73 void (*timer_gettime)(struct posix_clock *pc,
74 struct k_itimer *kit, struct itimerspec *tsp);
75
76 int (*timer_settime)(struct posix_clock *pc,
77 struct k_itimer *kit, int flags,
78 struct itimerspec *tsp, struct itimerspec *old);
79 /*
80 * Optional character device methods:
81 */
82 int (*fasync) (struct posix_clock *pc,
83 int fd, struct file *file, int on);
84
85 long (*ioctl) (struct posix_clock *pc,
86 unsigned int cmd, unsigned long arg);
87
88 int (*mmap) (struct posix_clock *pc,
89 struct vm_area_struct *vma);
90
91 int (*open) (struct posix_clock *pc, fmode_t f_mode);
92
93 uint (*poll) (struct posix_clock *pc,
94 struct file *file, poll_table *wait);
95
96 int (*release) (struct posix_clock *pc);
97
98 ssize_t (*read) (struct posix_clock *pc,
99 uint flags, char __user *buf, size_t cnt);
100};
101
102/**
103 * struct posix_clock - represents a dynamic posix clock
104 *
105 * @ops: Functional interface to the clock
106 * @cdev: Character device instance for this clock
107 * @kref: Reference count.
108 * @rwsem: Protects the 'zombie' field from concurrent access.
109 * @zombie: If 'zombie' is true, then the hardware has disappeared.
110 * @release: A function to free the structure when the reference count reaches
111 * zero. May be NULL if structure is statically allocated.
112 *
113 * Drivers should embed their struct posix_clock within a private
114 * structure, obtaining a reference to it during callbacks using
115 * container_of().
116 */
117struct posix_clock {
118 struct posix_clock_operations ops;
119 struct cdev cdev;
120 struct kref kref;
121 struct rw_semaphore rwsem;
122 bool zombie;
123 void (*release)(struct posix_clock *clk);
124};
125
126/**
127 * posix_clock_register() - register a new clock
128 * @clk: Pointer to the clock. Caller must provide 'ops' and 'release'
129 * @devid: Allocated device id
130 *
131 * A clock driver calls this function to register itself with the
132 * clock device subsystem. If 'clk' points to dynamically allocated
133 * memory, then the caller must provide a 'release' function to free
134 * that memory.
135 *
136 * Returns zero on success, non-zero otherwise.
137 */
138int posix_clock_register(struct posix_clock *clk, dev_t devid);
139
140/**
141 * posix_clock_unregister() - unregister a clock
142 * @clk: Clock instance previously registered via posix_clock_register()
143 *
144 * A clock driver calls this function to remove itself from the clock
145 * device subsystem. The posix_clock itself will remain (in an
146 * inactive state) until its reference count drops to zero, at which
147 * point it will be deallocated with its 'release' method.
148 */
149void posix_clock_unregister(struct posix_clock *clk);
150
151#endif
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 3e23844a6990..808227d40a64 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -4,6 +4,8 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/timex.h>
8#include <linux/alarmtimer.h>
7 9
8union cpu_time_count { 10union cpu_time_count {
9 cputime_t cpu; 11 cputime_t cpu;
@@ -17,10 +19,21 @@ struct cpu_timer_list {
17 int firing; 19 int firing;
18}; 20};
19 21
22/*
23 * Bit fields within a clockid:
24 *
25 * The most significant 29 bits hold either a pid or a file descriptor.
26 *
27 * Bit 2 indicates whether a cpu clock refers to a thread or a process.
28 *
29 * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
30 *
31 * A clockid is invalid if bits 2, 1, and 0 are all set.
32 */
20#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) 33#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
21#define CPUCLOCK_PERTHREAD(clock) \ 34#define CPUCLOCK_PERTHREAD(clock) \
22 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) 35 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
23#define CPUCLOCK_PID_MASK 7 36
24#define CPUCLOCK_PERTHREAD_MASK 4 37#define CPUCLOCK_PERTHREAD_MASK 4
25#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) 38#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
26#define CPUCLOCK_CLOCK_MASK 3 39#define CPUCLOCK_CLOCK_MASK 3
@@ -28,12 +41,17 @@ struct cpu_timer_list {
28#define CPUCLOCK_VIRT 1 41#define CPUCLOCK_VIRT 1
29#define CPUCLOCK_SCHED 2 42#define CPUCLOCK_SCHED 2
30#define CPUCLOCK_MAX 3 43#define CPUCLOCK_MAX 3
44#define CLOCKFD CPUCLOCK_MAX
45#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
31 46
32#define MAKE_PROCESS_CPUCLOCK(pid, clock) \ 47#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
33 ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) 48 ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
34#define MAKE_THREAD_CPUCLOCK(tid, clock) \ 49#define MAKE_THREAD_CPUCLOCK(tid, clock) \
35 MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) 50 MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)
36 51
52#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)
53#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))
54
37/* POSIX.1b interval timer structure. */ 55/* POSIX.1b interval timer structure. */
38struct k_itimer { 56struct k_itimer {
39 struct list_head list; /* free/ allocate list */ 57 struct list_head list; /* free/ allocate list */
@@ -63,14 +81,16 @@ struct k_itimer {
63 unsigned long incr; 81 unsigned long incr;
64 unsigned long expires; 82 unsigned long expires;
65 } mmtimer; 83 } mmtimer;
84 struct alarm alarmtimer;
66 } it; 85 } it;
67}; 86};
68 87
69struct k_clock { 88struct k_clock {
70 int res; /* in nanoseconds */
71 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); 89 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
72 int (*clock_set) (const clockid_t which_clock, struct timespec * tp); 90 int (*clock_set) (const clockid_t which_clock,
91 const struct timespec *tp);
73 int (*clock_get) (const clockid_t which_clock, struct timespec * tp); 92 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
93 int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
74 int (*timer_create) (struct k_itimer *timer); 94 int (*timer_create) (struct k_itimer *timer);
75 int (*nsleep) (const clockid_t which_clock, int flags, 95 int (*nsleep) (const clockid_t which_clock, int flags,
76 struct timespec *, struct timespec __user *); 96 struct timespec *, struct timespec __user *);
@@ -84,28 +104,14 @@ struct k_clock {
84 struct itimerspec * cur_setting); 104 struct itimerspec * cur_setting);
85}; 105};
86 106
87void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); 107extern struct k_clock clock_posix_cpu;
108extern struct k_clock clock_posix_dynamic;
88 109
89/* error handlers for timer_create, nanosleep and settime */ 110void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock);
90int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
91 struct timespec __user *);
92int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
93 111
94/* function to call to trigger timer event */ 112/* function to call to trigger timer event */
95int posix_timer_event(struct k_itimer *timr, int si_private); 113int posix_timer_event(struct k_itimer *timr, int si_private);
96 114
97int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
98int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
99int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
100int posix_cpu_timer_create(struct k_itimer *timer);
101int posix_cpu_nsleep(const clockid_t which_clock, int flags,
102 struct timespec *rqtp, struct timespec __user *rmtp);
103long posix_cpu_nsleep_restart(struct restart_block *restart_block);
104int posix_cpu_timer_set(struct k_itimer *timer, int flags,
105 struct itimerspec *new, struct itimerspec *old);
106int posix_cpu_timer_del(struct k_itimer *timer);
107void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
108
109void posix_cpu_timer_schedule(struct k_itimer *timer); 115void posix_cpu_timer_schedule(struct k_itimer *timer);
110 116
111void run_posix_cpu_timers(struct task_struct *task); 117void run_posix_cpu_timers(struct task_struct *task);
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 67608161df6b..54211c1cd926 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -71,6 +71,7 @@ posix_acl_release(struct posix_acl *acl)
71 71
72/* posix_acl.c */ 72/* posix_acl.c */
73 73
74extern void posix_acl_init(struct posix_acl *, int);
74extern struct posix_acl *posix_acl_alloc(int, gfp_t); 75extern struct posix_acl *posix_acl_alloc(int, gfp_t);
75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t); 76extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
76extern int posix_acl_valid(const struct posix_acl *); 77extern int posix_acl_valid(const struct posix_acl *);
@@ -108,6 +109,25 @@ static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
108 return acl; 109 return acl;
109} 110}
110 111
112static inline int negative_cached_acl(struct inode *inode, int type)
113{
114 struct posix_acl **p, *acl;
115 switch (type) {
116 case ACL_TYPE_ACCESS:
117 p = &inode->i_acl;
118 break;
119 case ACL_TYPE_DEFAULT:
120 p = &inode->i_default_acl;
121 break;
122 default:
123 BUG();
124 }
125 acl = ACCESS_ONCE(*p);
126 if (acl)
127 return 0;
128 return 1;
129}
130
111static inline void set_cached_acl(struct inode *inode, 131static inline void set_cached_acl(struct inode *inode,
112 int type, 132 int type,
113 struct posix_acl *acl) 133 struct posix_acl *acl)
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h
new file mode 100644
index 000000000000..b0843b68af92
--- /dev/null
+++ b/include/linux/power/bq20z75.h
@@ -0,0 +1,39 @@
1/*
2 * Gas Gauge driver for TI's BQ20Z75
3 *
4 * Copyright (c) 2010, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __LINUX_POWER_BQ20Z75_H_
22#define __LINUX_POWER_BQ20Z75_H_
23
24#include <linux/power_supply.h>
25#include <linux/types.h>
26
27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices
29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 */
33struct bq20z75_platform_data {
34 int battery_detect;
35 int battery_detect_present;
36 int i2c_retry_count;
37};
38
39#endif
diff --git a/include/linux/power/bq27x00_battery.h b/include/linux/power/bq27x00_battery.h
new file mode 100644
index 000000000000..a857f719bf40
--- /dev/null
+++ b/include/linux/power/bq27x00_battery.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_BQ27X00_BATTERY_H__
2#define __LINUX_BQ27X00_BATTERY_H__
3
4/**
5 * struct bq27000_plaform_data - Platform data for bq27000 devices
6 * @name: Name of the battery. If NULL the driver will fallback to "bq27000".
7 * @read: HDQ read callback.
8 * This function should provide access to the HDQ bus the battery is
9 * connected to.
10 * The first parameter is a pointer to the battery device, the second the
11 * register to be read. The return value should either be the content of
12 * the passed register or an error value.
13 */
14struct bq27000_platform_data {
15 const char *name;
16 int (*read)(struct device *dev, unsigned int);
17};
18
19#endif
diff --git a/include/linux/power/gpio-charger.h b/include/linux/power/gpio-charger.h
new file mode 100644
index 000000000000..de1dfe09a03d
--- /dev/null
+++ b/include/linux/power/gpio-charger.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __LINUX_POWER_GPIO_CHARGER_H__
16#define __LINUX_POWER_GPIO_CHARGER_H__
17
18#include <linux/power_supply.h>
19#include <linux/types.h>
20
21/**
22 * struct gpio_charger_platform_data - platform_data for gpio_charger devices
23 * @name: Name for the chargers power_supply device
24 * @type: Type of the charger
25 * @gpio: GPIO which is used to indicate the chargers status
26 * @gpio_active_low: Should be set to 1 if the GPIO is active low otherwise 0
27 * @supplied_to: Array of battery names to which this chargers supplies power
28 * @num_supplicants: Number of entries in the supplied_to array
29 */
30struct gpio_charger_platform_data {
31 const char *name;
32 enum power_supply_type type;
33
34 int gpio;
35 int gpio_active_low;
36
37 char **supplied_to;
38 size_t num_supplicants;
39};
40
41#endif
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
new file mode 100644
index 000000000000..7995deb8bfc1
--- /dev/null
+++ b/include/linux/power/max17042_battery.h
@@ -0,0 +1,30 @@
1/*
2 * Fuel gauge driver for Maxim 17042 / 8966 / 8997
3 * Note that Maxim 8966 and 8997 are mfd and this is its subdevice.
4 *
5 * Copyright (C) 2011 Samsung Electronics
6 * MyungJoo Ham <myungjoo.ham@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __MAX17042_BATTERY_H_
24#define __MAX17042_BATTERY_H_
25
26struct max17042_platform_data {
27 bool enable_current_sense;
28};
29
30#endif /* __MAX17042_BATTERY_H_ */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 30083a896f36..204c18dfdc9e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -89,6 +89,7 @@ enum power_supply_property {
89 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 89 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
90 POWER_SUPPLY_PROP_VOLTAGE_NOW, 90 POWER_SUPPLY_PROP_VOLTAGE_NOW,
91 POWER_SUPPLY_PROP_VOLTAGE_AVG, 91 POWER_SUPPLY_PROP_VOLTAGE_AVG,
92 POWER_SUPPLY_PROP_CURRENT_MAX,
92 POWER_SUPPLY_PROP_CURRENT_NOW, 93 POWER_SUPPLY_PROP_CURRENT_NOW,
93 POWER_SUPPLY_PROP_CURRENT_AVG, 94 POWER_SUPPLY_PROP_CURRENT_AVG,
94 POWER_SUPPLY_PROP_POWER_NOW, 95 POWER_SUPPLY_PROP_POWER_NOW,
@@ -125,7 +126,10 @@ enum power_supply_type {
125 POWER_SUPPLY_TYPE_BATTERY = 0, 126 POWER_SUPPLY_TYPE_BATTERY = 0,
126 POWER_SUPPLY_TYPE_UPS, 127 POWER_SUPPLY_TYPE_UPS,
127 POWER_SUPPLY_TYPE_MAINS, 128 POWER_SUPPLY_TYPE_MAINS,
128 POWER_SUPPLY_TYPE_USB, 129 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
130 POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */
131 POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */
132 POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
129}; 133};
130 134
131union power_supply_propval { 135union power_supply_propval {
@@ -169,6 +173,8 @@ struct power_supply {
169 char *full_trig_name; 173 char *full_trig_name;
170 struct led_trigger *online_trig; 174 struct led_trigger *online_trig;
171 char *online_trig_name; 175 char *online_trig_name;
176 struct led_trigger *charging_blink_full_solid_trig;
177 char *charging_blink_full_solid_trig_name;
172#endif 178#endif
173}; 179};
174 180
@@ -209,4 +215,49 @@ extern void power_supply_unregister(struct power_supply *psy);
209/* For APM emulation, think legacy userspace. */ 215/* For APM emulation, think legacy userspace. */
210extern struct class *power_supply_class; 216extern struct class *power_supply_class;
211 217
218static inline bool power_supply_is_amp_property(enum power_supply_property psp)
219{
220 switch (psp) {
221 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
222 case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
223 case POWER_SUPPLY_PROP_CHARGE_FULL:
224 case POWER_SUPPLY_PROP_CHARGE_EMPTY:
225 case POWER_SUPPLY_PROP_CHARGE_NOW:
226 case POWER_SUPPLY_PROP_CHARGE_AVG:
227 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
228 case POWER_SUPPLY_PROP_CURRENT_MAX:
229 case POWER_SUPPLY_PROP_CURRENT_NOW:
230 case POWER_SUPPLY_PROP_CURRENT_AVG:
231 return 1;
232 default:
233 break;
234 }
235
236 return 0;
237}
238
239static inline bool power_supply_is_watt_property(enum power_supply_property psp)
240{
241 switch (psp) {
242 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
243 case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
244 case POWER_SUPPLY_PROP_ENERGY_FULL:
245 case POWER_SUPPLY_PROP_ENERGY_EMPTY:
246 case POWER_SUPPLY_PROP_ENERGY_NOW:
247 case POWER_SUPPLY_PROP_ENERGY_AVG:
248 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
249 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
250 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
251 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
252 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
253 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
254 case POWER_SUPPLY_PROP_POWER_NOW:
255 return 1;
256 default:
257 break;
258 }
259
260 return 0;
261}
262
212#endif /* __LINUX_POWER_SUPPLY_H__ */ 263#endif /* __LINUX_POWER_SUPPLY_H__ */
diff --git a/include/linux/pps.h b/include/linux/pps.h
index 0194ab06177b..a9bb1d93451a 100644
--- a/include/linux/pps.h
+++ b/include/linux/pps.h
@@ -114,11 +114,18 @@ struct pps_fdata {
114 struct pps_ktime timeout; 114 struct pps_ktime timeout;
115}; 115};
116 116
117struct pps_bind_args {
118 int tsformat; /* format of time stamps */
119 int edge; /* selected event type */
120 int consumer; /* selected kernel consumer */
121};
122
117#include <linux/ioctl.h> 123#include <linux/ioctl.h>
118 124
119#define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *) 125#define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *)
120#define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *) 126#define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *)
121#define PPS_GETCAP _IOR('p', 0xa3, int *) 127#define PPS_GETCAP _IOR('p', 0xa3, int *)
122#define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *) 128#define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *)
129#define PPS_KC_BIND _IOW('p', 0xa5, struct pps_bind_args *)
123 130
124#endif /* _PPS_H_ */ 131#endif /* _PPS_H_ */
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index e0a193f830ef..94048547f29a 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -18,6 +18,9 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21#ifndef LINUX_PPS_KERNEL_H
22#define LINUX_PPS_KERNEL_H
23
21#include <linux/pps.h> 24#include <linux/pps.h>
22 25
23#include <linux/cdev.h> 26#include <linux/cdev.h>
@@ -28,18 +31,28 @@
28 * Global defines 31 * Global defines
29 */ 32 */
30 33
34struct pps_device;
35
31/* The specific PPS source info */ 36/* The specific PPS source info */
32struct pps_source_info { 37struct pps_source_info {
33 char name[PPS_MAX_NAME_LEN]; /* simbolic name */ 38 char name[PPS_MAX_NAME_LEN]; /* simbolic name */
34 char path[PPS_MAX_NAME_LEN]; /* path of connected device */ 39 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
35 int mode; /* PPS's allowed mode */ 40 int mode; /* PPS's allowed mode */
36 41
37 void (*echo)(int source, int event, void *data); /* PPS echo function */ 42 void (*echo)(struct pps_device *pps,
43 int event, void *data); /* PPS echo function */
38 44
39 struct module *owner; 45 struct module *owner;
40 struct device *dev; 46 struct device *dev;
41}; 47};
42 48
49struct pps_event_time {
50#ifdef CONFIG_NTP_PPS
51 struct timespec ts_raw;
52#endif /* CONFIG_NTP_PPS */
53 struct timespec ts_real;
54};
55
43/* The main struct */ 56/* The main struct */
44struct pps_device { 57struct pps_device {
45 struct pps_source_info info; /* PSS source info */ 58 struct pps_source_info info; /* PSS source info */
@@ -52,38 +65,56 @@ struct pps_device {
52 struct pps_ktime clear_tu; 65 struct pps_ktime clear_tu;
53 int current_mode; /* PPS mode at event time */ 66 int current_mode; /* PPS mode at event time */
54 67
55 int go; /* PPS event is arrived? */ 68 unsigned int last_ev; /* last PPS event id */
56 wait_queue_head_t queue; /* PPS event queue */ 69 wait_queue_head_t queue; /* PPS event queue */
57 70
58 unsigned int id; /* PPS source unique ID */ 71 unsigned int id; /* PPS source unique ID */
59 struct cdev cdev; 72 struct cdev cdev;
60 struct device *dev; 73 struct device *dev;
61 int devno;
62 struct fasync_struct *async_queue; /* fasync method */ 74 struct fasync_struct *async_queue; /* fasync method */
63 spinlock_t lock; 75 spinlock_t lock;
64
65 atomic_t usage; /* usage count */
66}; 76};
67 77
68/* 78/*
69 * Global variables 79 * Global variables
70 */ 80 */
71 81
72extern spinlock_t pps_idr_lock;
73extern struct idr pps_idr;
74extern struct timespec pps_irq_ts[];
75
76extern struct device_attribute pps_attrs[]; 82extern struct device_attribute pps_attrs[];
77 83
78/* 84/*
79 * Exported functions 85 * Exported functions
80 */ 86 */
81 87
82struct pps_device *pps_get_source(int source); 88extern struct pps_device *pps_register_source(
83extern void pps_put_source(struct pps_device *pps); 89 struct pps_source_info *info, int default_params);
84extern int pps_register_source(struct pps_source_info *info, 90extern void pps_unregister_source(struct pps_device *pps);
85 int default_params);
86extern void pps_unregister_source(int source);
87extern int pps_register_cdev(struct pps_device *pps); 91extern int pps_register_cdev(struct pps_device *pps);
88extern void pps_unregister_cdev(struct pps_device *pps); 92extern void pps_unregister_cdev(struct pps_device *pps);
89extern void pps_event(int source, struct pps_ktime *ts, int event, void *data); 93extern void pps_event(struct pps_device *pps,
94 struct pps_event_time *ts, int event, void *data);
95
96static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
97 struct timespec ts)
98{
99 kt->sec = ts.tv_sec;
100 kt->nsec = ts.tv_nsec;
101}
102
103#ifdef CONFIG_NTP_PPS
104
105static inline void pps_get_ts(struct pps_event_time *ts)
106{
107 getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real);
108}
109
110#else /* CONFIG_NTP_PPS */
111
112static inline void pps_get_ts(struct pps_event_time *ts)
113{
114 getnstimeofday(&ts->ts_real);
115}
116
117#endif /* CONFIG_NTP_PPS */
118
119#endif /* LINUX_PPS_KERNEL_H */
120
diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h
index af7c36a5a521..a3bfbdf63d32 100644
--- a/include/linux/prefetch.h
+++ b/include/linux/prefetch.h
@@ -29,7 +29,7 @@
29 prefetchw(x) - prefetches the cacheline at "x" for write 29 prefetchw(x) - prefetches the cacheline at "x" for write
30 spin_lock_prefetch(x) - prefetches the spinlock *x for taking 30 spin_lock_prefetch(x) - prefetches the spinlock *x for taking
31 31
32 there is also PREFETCH_STRIDE which is the architecure-prefered 32 there is also PREFETCH_STRIDE which is the architecure-preferred
33 "lookahead" size for prefetching streamed operations. 33 "lookahead" size for prefetching streamed operations.
34 34
35*/ 35*/
diff --git a/include/linux/printk.h b/include/linux/printk.h
new file mode 100644
index 000000000000..ee048e77e1ae
--- /dev/null
+++ b/include/linux/printk.h
@@ -0,0 +1,302 @@
1#ifndef __KERNEL_PRINTK__
2#define __KERNEL_PRINTK__
3
4extern const char linux_banner[];
5extern const char linux_proc_banner[];
6
7#define KERN_EMERG "<0>" /* system is unusable */
8#define KERN_ALERT "<1>" /* action must be taken immediately */
9#define KERN_CRIT "<2>" /* critical conditions */
10#define KERN_ERR "<3>" /* error conditions */
11#define KERN_WARNING "<4>" /* warning conditions */
12#define KERN_NOTICE "<5>" /* normal but significant condition */
13#define KERN_INFO "<6>" /* informational */
14#define KERN_DEBUG "<7>" /* debug-level messages */
15
16/* Use the default kernel loglevel */
17#define KERN_DEFAULT "<d>"
18/*
19 * Annotation for a "continued" line of log printout (only done after a
20 * line that had no enclosing \n). Only to be used by core/arch code
21 * during early bootup (a continued line is not SMP-safe otherwise).
22 */
23#define KERN_CONT "<c>"
24
25extern int console_printk[];
26
27#define console_loglevel (console_printk[0])
28#define default_message_loglevel (console_printk[1])
29#define minimum_console_loglevel (console_printk[2])
30#define default_console_loglevel (console_printk[3])
31
32static inline void console_silent(void)
33{
34 console_loglevel = 0;
35}
36
37static inline void console_verbose(void)
38{
39 if (console_loglevel)
40 console_loglevel = 15;
41}
42
43struct va_format {
44 const char *fmt;
45 va_list *va;
46};
47
48/*
49 * FW_BUG
50 * Add this to a message where you are sure the firmware is buggy or behaves
51 * really stupid or out of spec. Be aware that the responsible BIOS developer
52 * should be able to fix this issue or at least get a concrete idea of the
53 * problem by reading your message without the need of looking at the kernel
54 * code.
55 *
56 * Use it for definite and high priority BIOS bugs.
57 *
58 * FW_WARN
59 * Use it for not that clear (e.g. could the kernel messed up things already?)
60 * and medium priority BIOS bugs.
61 *
62 * FW_INFO
63 * Use this one if you want to tell the user or vendor about something
64 * suspicious, but generally harmless related to the firmware.
65 *
66 * Use it for information or very low priority BIOS bugs.
67 */
68#define FW_BUG "[Firmware Bug]: "
69#define FW_WARN "[Firmware Warn]: "
70#define FW_INFO "[Firmware Info]: "
71
72/*
73 * HW_ERR
74 * Add this to a message for hardware errors, so that user can report
75 * it to hardware vendor instead of LKML or software vendor.
76 */
77#define HW_ERR "[Hardware Error]: "
78
79/*
80 * Dummy printk for disabled debugging statements to use whilst maintaining
81 * gcc's format and side-effect checking.
82 */
83static inline __attribute__ ((format (printf, 1, 2)))
84int no_printk(const char *fmt, ...)
85{
86 return 0;
87}
88
89extern asmlinkage __attribute__ ((format (printf, 1, 2)))
90void early_printk(const char *fmt, ...);
91
92extern int printk_needs_cpu(int cpu);
93extern void printk_tick(void);
94
95#ifdef CONFIG_PRINTK
96asmlinkage __attribute__ ((format (printf, 1, 0)))
97int vprintk(const char *fmt, va_list args);
98asmlinkage __attribute__ ((format (printf, 1, 2))) __cold
99int printk(const char *fmt, ...);
100
101/*
102 * Please don't use printk_ratelimit(), because it shares ratelimiting state
103 * with all other unrelated printk_ratelimit() callsites. Instead use
104 * printk_ratelimited() or plain old __ratelimit().
105 */
106extern int __printk_ratelimit(const char *func);
107#define printk_ratelimit() __printk_ratelimit(__func__)
108extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
109 unsigned int interval_msec);
110
111extern int printk_delay_msec;
112extern int dmesg_restrict;
113extern int kptr_restrict;
114
115void log_buf_kexec_setup(void);
116#else
117static inline __attribute__ ((format (printf, 1, 0)))
118int vprintk(const char *s, va_list args)
119{
120 return 0;
121}
122static inline __attribute__ ((format (printf, 1, 2))) __cold
123int printk(const char *s, ...)
124{
125 return 0;
126}
127static inline int printk_ratelimit(void)
128{
129 return 0;
130}
131static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
132 unsigned int interval_msec)
133{
134 return false;
135}
136
137static inline void log_buf_kexec_setup(void)
138{
139}
140#endif
141
142extern void dump_stack(void) __cold;
143
144#ifndef pr_fmt
145#define pr_fmt(fmt) fmt
146#endif
147
148#define pr_emerg(fmt, ...) \
149 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
150#define pr_alert(fmt, ...) \
151 printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
152#define pr_crit(fmt, ...) \
153 printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
154#define pr_err(fmt, ...) \
155 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
156#define pr_warning(fmt, ...) \
157 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
158#define pr_warn pr_warning
159#define pr_notice(fmt, ...) \
160 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
161#define pr_info(fmt, ...) \
162 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
163#define pr_cont(fmt, ...) \
164 printk(KERN_CONT fmt, ##__VA_ARGS__)
165
166/* pr_devel() should produce zero code unless DEBUG is defined */
167#ifdef DEBUG
168#define pr_devel(fmt, ...) \
169 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
170#else
171#define pr_devel(fmt, ...) \
172 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
173#endif
174
175/* If you are writing a driver, please use dev_dbg instead */
176#if defined(DEBUG)
177#define pr_debug(fmt, ...) \
178 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
179#elif defined(CONFIG_DYNAMIC_DEBUG)
180/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
181#define pr_debug(fmt, ...) \
182 dynamic_pr_debug(fmt, ##__VA_ARGS__)
183#else
184#define pr_debug(fmt, ...) \
185 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
186#endif
187
188/*
189 * Print a one-time message (analogous to WARN_ONCE() et al):
190 */
191
192#ifdef CONFIG_PRINTK
193#define printk_once(fmt, ...) \
194({ \
195 static bool __print_once; \
196 \
197 if (!__print_once) { \
198 __print_once = true; \
199 printk(fmt, ##__VA_ARGS__); \
200 } \
201})
202#else
203#define printk_once(fmt, ...) \
204 no_printk(fmt, ##__VA_ARGS__)
205#endif
206
207#define pr_emerg_once(fmt, ...) \
208 printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
209#define pr_alert_once(fmt, ...) \
210 printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
211#define pr_crit_once(fmt, ...) \
212 printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
213#define pr_err_once(fmt, ...) \
214 printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
215#define pr_warn_once(fmt, ...) \
216 printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
217#define pr_notice_once(fmt, ...) \
218 printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
219#define pr_info_once(fmt, ...) \
220 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
221#define pr_cont_once(fmt, ...) \
222 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
223/* If you are writing a driver, please use dev_dbg instead */
224#if defined(DEBUG)
225#define pr_debug_once(fmt, ...) \
226 printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
227#else
228#define pr_debug_once(fmt, ...) \
229 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
230#endif
231
232/*
233 * ratelimited messages with local ratelimit_state,
234 * no local ratelimit_state used in the !PRINTK case
235 */
236#ifdef CONFIG_PRINTK
237#define printk_ratelimited(fmt, ...) \
238({ \
239 static DEFINE_RATELIMIT_STATE(_rs, \
240 DEFAULT_RATELIMIT_INTERVAL, \
241 DEFAULT_RATELIMIT_BURST); \
242 \
243 if (__ratelimit(&_rs)) \
244 printk(fmt, ##__VA_ARGS__); \
245})
246#else
247#define printk_ratelimited(fmt, ...) \
248 no_printk(fmt, ##__VA_ARGS__)
249#endif
250
251#define pr_emerg_ratelimited(fmt, ...) \
252 printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
253#define pr_alert_ratelimited(fmt, ...) \
254 printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
255#define pr_crit_ratelimited(fmt, ...) \
256 printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
257#define pr_err_ratelimited(fmt, ...) \
258 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
259#define pr_warn_ratelimited(fmt, ...) \
260 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
261#define pr_notice_ratelimited(fmt, ...) \
262 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
263#define pr_info_ratelimited(fmt, ...) \
264 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
265/* no pr_cont_ratelimited, don't do that... */
266/* If you are writing a driver, please use dev_dbg instead */
267#if defined(DEBUG)
268#define pr_debug_ratelimited(fmt, ...) \
269 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
270#else
271#define pr_debug_ratelimited(fmt, ...) \
272 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
273#endif
274
275enum {
276 DUMP_PREFIX_NONE,
277 DUMP_PREFIX_ADDRESS,
278 DUMP_PREFIX_OFFSET
279};
280extern void hex_dump_to_buffer(const void *buf, size_t len,
281 int rowsize, int groupsize,
282 char *linebuf, size_t linebuflen, bool ascii);
283#ifdef CONFIG_PRINTK
284extern void print_hex_dump(const char *level, const char *prefix_str,
285 int prefix_type, int rowsize, int groupsize,
286 const void *buf, size_t len, bool ascii);
287extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
288 const void *buf, size_t len);
289#else
290static inline void print_hex_dump(const char *level, const char *prefix_str,
291 int prefix_type, int rowsize, int groupsize,
292 const void *buf, size_t len, bool ascii)
293{
294}
295static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
296 const void *buf, size_t len)
297{
298}
299
300#endif
301
302#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 379eaed72d4b..eaf4350c0f90 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 unsigned short namelen; 53 unsigned int namelen;
54 const char *name; 54 const char *name;
55 mode_t mode; 55 mode_t mode;
56 nlink_t nlink; 56 nlink_t nlink;
@@ -208,6 +208,8 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
208 struct proc_dir_entry *parent,const char *dest) {return NULL;} 208 struct proc_dir_entry *parent,const char *dest) {return NULL;}
209static inline struct proc_dir_entry *proc_mkdir(const char *name, 209static inline struct proc_dir_entry *proc_mkdir(const char *name,
210 struct proc_dir_entry *parent) {return NULL;} 210 struct proc_dir_entry *parent) {return NULL;}
211static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
212 mode_t mode, struct proc_dir_entry *parent) { return NULL; }
211 213
212static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 214static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
213 mode_t mode, struct proc_dir_entry *base, 215 mode_t mode, struct proc_dir_entry *base,
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
new file mode 100644
index 000000000000..2455ef2683f0
--- /dev/null
+++ b/include/linux/pstore.h
@@ -0,0 +1,62 @@
1/*
2 * Persistent Storage - pstore.h
3 *
4 * Copyright (C) 2010 Intel Corporation <tony.luck@intel.com>
5 *
6 * This code is the generic layer to export data records from platform
7 * level persistent storage via a file system.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H
24
25/* types */
26enum pstore_type_id {
27 PSTORE_TYPE_DMESG = 0,
28 PSTORE_TYPE_MCE = 1,
29 PSTORE_TYPE_UNKNOWN = 255
30};
31
32struct pstore_info {
33 struct module *owner;
34 char *name;
35 struct mutex buf_mutex; /* serialize access to 'buf' */
36 char *buf;
37 size_t bufsize;
38 int (*open)(struct pstore_info *psi);
39 int (*close)(struct pstore_info *psi);
40 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
41 struct timespec *time);
42 u64 (*write)(enum pstore_type_id type, size_t size);
43 int (*erase)(u64 id);
44};
45
46#ifdef CONFIG_PSTORE
47extern int pstore_register(struct pstore_info *);
48extern int pstore_write(enum pstore_type_id type, char *buf, size_t size);
49#else
50static inline int
51pstore_register(struct pstore_info *psi)
52{
53 return -ENODEV;
54}
55static inline int
56pstore_write(enum pstore_type_id type, char *buf, size_t size)
57{
58 return -ENODEV;
59}
60#endif
61
62#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 4272521e29e9..9178d5cc0b01 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -100,15 +100,14 @@
100#include <linux/sched.h> /* For struct task_struct. */ 100#include <linux/sched.h> /* For struct task_struct. */
101 101
102 102
103extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 103extern long arch_ptrace(struct task_struct *child, long request,
104extern int ptrace_traceme(void); 104 unsigned long addr, unsigned long data);
105extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 105extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
106extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 106extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
107extern int ptrace_attach(struct task_struct *tsk);
108extern int ptrace_detach(struct task_struct *, unsigned int);
109extern void ptrace_disable(struct task_struct *); 107extern void ptrace_disable(struct task_struct *);
110extern int ptrace_check_attach(struct task_struct *task, int kill); 108extern int ptrace_check_attach(struct task_struct *task, int kill);
111extern int ptrace_request(struct task_struct *child, long request, long addr, long data); 109extern int ptrace_request(struct task_struct *child, long request,
110 unsigned long addr, unsigned long data);
112extern void ptrace_notify(int exit_code); 111extern void ptrace_notify(int exit_code);
113extern void __ptrace_link(struct task_struct *child, 112extern void __ptrace_link(struct task_struct *child,
114 struct task_struct *new_parent); 113 struct task_struct *new_parent);
@@ -132,8 +131,10 @@ static inline void ptrace_unlink(struct task_struct *child)
132 __ptrace_unlink(child); 131 __ptrace_unlink(child);
133} 132}
134 133
135int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); 134int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr,
136int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); 135 unsigned long data);
136int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
137 unsigned long data);
137 138
138/** 139/**
139 * task_ptrace - return %PT_* flags that apply to a task 140 * task_ptrace - return %PT_* flags that apply to a task
@@ -188,6 +189,10 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
188 child->ptrace = current->ptrace; 189 child->ptrace = current->ptrace;
189 __ptrace_link(child, current->parent); 190 __ptrace_link(child, current->parent);
190 } 191 }
192
193#ifdef CONFIG_HAVE_HW_BREAKPOINT
194 atomic_set(&child->ptrace_bp_refcnt, 1);
195#endif
191} 196}
192 197
193/** 198/**
@@ -349,6 +354,13 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
349 unsigned long args[6], unsigned int maxargs, 354 unsigned long args[6], unsigned int maxargs,
350 unsigned long *sp, unsigned long *pc); 355 unsigned long *sp, unsigned long *pc);
351 356
352#endif 357#ifdef CONFIG_HAVE_HW_BREAKPOINT
358extern int ptrace_get_breakpoints(struct task_struct *tsk);
359extern void ptrace_put_breakpoints(struct task_struct *tsk);
360#else
361static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
362#endif /* CONFIG_HAVE_HW_BREAKPOINT */
363
364#endif /* __KERNEL */
353 365
354#endif 366#endif
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 01b3d759f1fc..5e3e25a3c9c3 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -4,14 +4,18 @@
4#ifndef __LINUX_PWM_BACKLIGHT_H 4#ifndef __LINUX_PWM_BACKLIGHT_H
5#define __LINUX_PWM_BACKLIGHT_H 5#define __LINUX_PWM_BACKLIGHT_H
6 6
7#include <linux/backlight.h>
8
7struct platform_pwm_backlight_data { 9struct platform_pwm_backlight_data {
8 int pwm_id; 10 int pwm_id;
9 unsigned int max_brightness; 11 unsigned int max_brightness;
10 unsigned int dft_brightness; 12 unsigned int dft_brightness;
13 unsigned int lth_brightness;
11 unsigned int pwm_period_ns; 14 unsigned int pwm_period_ns;
12 int (*init)(struct device *dev); 15 int (*init)(struct device *dev);
13 int (*notify)(struct device *dev, int brightness); 16 int (*notify)(struct device *dev, int brightness);
14 void (*exit)(struct device *dev); 17 void (*exit)(struct device *dev);
18 int (*check_fb)(struct device *dev, struct fb_info *info);
15}; 19};
16 20
17#endif 21#endif
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
new file mode 100644
index 000000000000..44835fb39793
--- /dev/null
+++ b/include/linux/pxa2xx_ssp.h
@@ -0,0 +1,209 @@
1/*
2 * pxa2xx_ssp.h
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
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 driver supports the following PXA CPU/SSP ports:-
11 *
12 * PXA250 SSP
13 * PXA255 SSP, NSSP
14 * PXA26x SSP, NSSP, ASSP
15 * PXA27x SSP1, SSP2, SSP3
16 * PXA3xx SSP1, SSP2, SSP3, SSP4
17 */
18
19#ifndef __LINUX_SSP_H
20#define __LINUX_SSP_H
21
22#include <linux/list.h>
23#include <linux/io.h>
24
25/*
26 * SSP Serial Port Registers
27 * PXA250, PXA255, PXA26x and PXA27x SSP controllers are all slightly different.
28 * PXA255, PXA26x and PXA27x have extra ports, registers and bits.
29 */
30
31#define SSCR0 (0x00) /* SSP Control Register 0 */
32#define SSCR1 (0x04) /* SSP Control Register 1 */
33#define SSSR (0x08) /* SSP Status Register */
34#define SSITR (0x0C) /* SSP Interrupt Test Register */
35#define SSDR (0x10) /* SSP Data Write/Data Read Register */
36
37#define SSTO (0x28) /* SSP Time Out Register */
38#define SSPSP (0x2C) /* SSP Programmable Serial Protocol */
39#define SSTSA (0x30) /* SSP Tx Timeslot Active */
40#define SSRSA (0x34) /* SSP Rx Timeslot Active */
41#define SSTSS (0x38) /* SSP Timeslot Status */
42#define SSACD (0x3C) /* SSP Audio Clock Divider */
43#define SSACDD (0x40) /* SSP Audio Clock Dither Divider */
44
45/* Common PXA2xx bits first */
46#define SSCR0_DSS (0x0000000f) /* Data Size Select (mask) */
47#define SSCR0_DataSize(x) ((x) - 1) /* Data Size Select [4..16] */
48#define SSCR0_FRF (0x00000030) /* FRame Format (mask) */
49#define SSCR0_Motorola (0x0 << 4) /* Motorola's Serial Peripheral Interface (SPI) */
50#define SSCR0_TI (0x1 << 4) /* Texas Instruments' Synchronous Serial Protocol (SSP) */
51#define SSCR0_National (0x2 << 4) /* National Microwire */
52#define SSCR0_ECS (1 << 6) /* External clock select */
53#define SSCR0_SSE (1 << 7) /* Synchronous Serial Port Enable */
54#define SSCR0_SCR(x) ((x) << 8) /* Serial Clock Rate (mask) */
55
56/* PXA27x, PXA3xx */
57#define SSCR0_EDSS (1 << 20) /* Extended data size select */
58#define SSCR0_NCS (1 << 21) /* Network clock select */
59#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */
60#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */
61#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */
62#define SSCR0_SlotsPerFrm(x) (((x) - 1) << 24) /* Time slots per frame [1..8] */
63#define SSCR0_FPCKE (1 << 29) /* FIFO packing enable */
64#define SSCR0_ACS (1 << 30) /* Audio clock select */
65#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */
66
67
68#define SSCR1_RIE (1 << 0) /* Receive FIFO Interrupt Enable */
69#define SSCR1_TIE (1 << 1) /* Transmit FIFO Interrupt Enable */
70#define SSCR1_LBM (1 << 2) /* Loop-Back Mode */
71#define SSCR1_SPO (1 << 3) /* Motorola SPI SSPSCLK polarity setting */
72#define SSCR1_SPH (1 << 4) /* Motorola SPI SSPSCLK phase setting */
73#define SSCR1_MWDS (1 << 5) /* Microwire Transmit Data Size */
74
75#define SSSR_ALT_FRM_MASK 3 /* Masks the SFRM signal number */
76#define SSSR_TNF (1 << 2) /* Transmit FIFO Not Full */
77#define SSSR_RNE (1 << 3) /* Receive FIFO Not Empty */
78#define SSSR_BSY (1 << 4) /* SSP Busy */
79#define SSSR_TFS (1 << 5) /* Transmit FIFO Service Request */
80#define SSSR_RFS (1 << 6) /* Receive FIFO Service Request */
81#define SSSR_ROR (1 << 7) /* Receive FIFO Overrun */
82
83#ifdef CONFIG_ARCH_PXA
84#define RX_THRESH_DFLT 8
85#define TX_THRESH_DFLT 8
86
87#define SSSR_TFL_MASK (0xf << 8) /* Transmit FIFO Level mask */
88#define SSSR_RFL_MASK (0xf << 12) /* Receive FIFO Level mask */
89
90#define SSCR1_TFT (0x000003c0) /* Transmit FIFO Threshold (mask) */
91#define SSCR1_TxTresh(x) (((x) - 1) << 6) /* level [1..16] */
92#define SSCR1_RFT (0x00003c00) /* Receive FIFO Threshold (mask) */
93#define SSCR1_RxTresh(x) (((x) - 1) << 10) /* level [1..16] */
94
95#else
96
97#define RX_THRESH_DFLT 2
98#define TX_THRESH_DFLT 2
99
100#define SSSR_TFL_MASK (0x3 << 8) /* Transmit FIFO Level mask */
101#define SSSR_RFL_MASK (0x3 << 12) /* Receive FIFO Level mask */
102
103#define SSCR1_TFT (0x000000c0) /* Transmit FIFO Threshold (mask) */
104#define SSCR1_TxTresh(x) (((x) - 1) << 6) /* level [1..4] */
105#define SSCR1_RFT (0x00000c00) /* Receive FIFO Threshold (mask) */
106#define SSCR1_RxTresh(x) (((x) - 1) << 10) /* level [1..4] */
107#endif
108
109/* extra bits in PXA255, PXA26x and PXA27x SSP ports */
110#define SSCR0_TISSP (1 << 4) /* TI Sync Serial Protocol */
111#define SSCR0_PSP (3 << 4) /* PSP - Programmable Serial Protocol */
112#define SSCR1_TTELP (1 << 31) /* TXD Tristate Enable Last Phase */
113#define SSCR1_TTE (1 << 30) /* TXD Tristate Enable */
114#define SSCR1_EBCEI (1 << 29) /* Enable Bit Count Error interrupt */
115#define SSCR1_SCFR (1 << 28) /* Slave Clock free Running */
116#define SSCR1_ECRA (1 << 27) /* Enable Clock Request A */
117#define SSCR1_ECRB (1 << 26) /* Enable Clock request B */
118#define SSCR1_SCLKDIR (1 << 25) /* Serial Bit Rate Clock Direction */
119#define SSCR1_SFRMDIR (1 << 24) /* Frame Direction */
120#define SSCR1_RWOT (1 << 23) /* Receive Without Transmit */
121#define SSCR1_TRAIL (1 << 22) /* Trailing Byte */
122#define SSCR1_TSRE (1 << 21) /* Transmit Service Request Enable */
123#define SSCR1_RSRE (1 << 20) /* Receive Service Request Enable */
124#define SSCR1_TINTE (1 << 19) /* Receiver Time-out Interrupt enable */
125#define SSCR1_PINTE (1 << 18) /* Peripheral Trailing Byte Interrupt Enable */
126#define SSCR1_IFS (1 << 16) /* Invert Frame Signal */
127#define SSCR1_STRF (1 << 15) /* Select FIFO or EFWR */
128#define SSCR1_EFWR (1 << 14) /* Enable FIFO Write/Read */
129
130#define SSSR_BCE (1 << 23) /* Bit Count Error */
131#define SSSR_CSS (1 << 22) /* Clock Synchronisation Status */
132#define SSSR_TUR (1 << 21) /* Transmit FIFO Under Run */
133#define SSSR_EOC (1 << 20) /* End Of Chain */
134#define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */
135#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */
136
137
138#define SSPSP_SCMODE(x) ((x) << 0) /* Serial Bit Rate Clock Mode */
139#define SSPSP_SFRMP (1 << 2) /* Serial Frame Polarity */
140#define SSPSP_ETDS (1 << 3) /* End of Transfer data State */
141#define SSPSP_STRTDLY(x) ((x) << 4) /* Start Delay */
142#define SSPSP_DMYSTRT(x) ((x) << 7) /* Dummy Start */
143#define SSPSP_SFRMDLY(x) ((x) << 9) /* Serial Frame Delay */
144#define SSPSP_SFRMWDTH(x) ((x) << 16) /* Serial Frame Width */
145#define SSPSP_DMYSTOP(x) ((x) << 23) /* Dummy Stop */
146#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */
147
148/* PXA3xx */
149#define SSPSP_EDMYSTRT(x) ((x) << 26) /* Extended Dummy Start */
150#define SSPSP_EDMYSTOP(x) ((x) << 28) /* Extended Dummy Stop */
151#define SSPSP_TIMING_MASK (0x7f8001f0)
152
153#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */
154#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */
155#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
156#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */
157
158enum pxa_ssp_type {
159 SSP_UNDEFINED = 0,
160 PXA25x_SSP, /* pxa 210, 250, 255, 26x */
161 PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */
162 PXA27x_SSP,
163 PXA168_SSP,
164 CE4100_SSP,
165};
166
167struct ssp_device {
168 struct platform_device *pdev;
169 struct list_head node;
170
171 struct clk *clk;
172 void __iomem *mmio_base;
173 unsigned long phys_base;
174
175 const char *label;
176 int port_id;
177 int type;
178 int use_count;
179 int irq;
180 int drcmr_rx;
181 int drcmr_tx;
182};
183
184/**
185 * pxa_ssp_write_reg - Write to a SSP register
186 *
187 * @dev: SSP device to access
188 * @reg: Register to write to
189 * @val: Value to be written.
190 */
191static inline void pxa_ssp_write_reg(struct ssp_device *dev, u32 reg, u32 val)
192{
193 __raw_writel(val, dev->mmio_base + reg);
194}
195
196/**
197 * pxa_ssp_read_reg - Read from a SSP register
198 *
199 * @dev: SSP device to access
200 * @reg: Register to read from
201 */
202static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
203{
204 return __raw_readl(dev->mmio_base + reg);
205}
206
207struct ssp_device *pxa_ssp_request(int port, const char *label);
208void pxa_ssp_free(struct ssp_device *);
209#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 94c1f03b50eb..9a85412e0db6 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -322,9 +322,12 @@ struct dquot_operations {
322 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323}; 323};
324 324
325struct path;
326
325/* Operations handling requests from userspace */ 327/* Operations handling requests from userspace */
326struct quotactl_ops { 328struct quotactl_ops {
327 int (*quota_on)(struct super_block *, int, int, char *); 329 int (*quota_on)(struct super_block *, int, int, struct path *);
330 int (*quota_on_meta)(struct super_block *, int, int);
328 int (*quota_off)(struct super_block *, int); 331 int (*quota_off)(struct super_block *, int);
329 int (*quota_sync)(struct super_block *, int, int); 332 int (*quota_sync)(struct super_block *, int, int);
330 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 333 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index d1a9193960f1..26f9e3612e0f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -31,8 +31,9 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
31#define quota_error(sb, fmt, args...) \ 31#define quota_error(sb, fmt, args...) \
32 __quota_error((sb), __func__, fmt , ## args) 32 __quota_error((sb), __func__, fmt , ## args)
33 33
34extern void __quota_error(struct super_block *sb, const char *func, 34extern __attribute__((format (printf, 3, 4)))
35 const char *fmt, ...); 35void __quota_error(struct super_block *sb, const char *func,
36 const char *fmt, ...);
36 37
37/* 38/*
38 * declaration of quota_function calls in kernel. 39 * declaration of quota_function calls in kernel.
@@ -75,11 +76,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
75 76
76int dquot_file_open(struct inode *inode, struct file *file); 77int dquot_file_open(struct inode *inode, struct file *file);
77 78
78int dquot_quota_on(struct super_block *sb, int type, int format_id,
79 char *path);
80int dquot_enable(struct inode *inode, int type, int format_id, 79int dquot_enable(struct inode *inode, int type, int format_id,
81 unsigned int flags); 80 unsigned int flags);
82int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 81int dquot_quota_on(struct super_block *sb, int type, int format_id,
83 struct path *path); 82 struct path *path);
84int dquot_quota_on_mount(struct super_block *sb, char *qf_name, 83int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
85 int format_id, int type); 84 int format_id, int type);
@@ -278,7 +277,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
278 /* 277 /*
279 * Mark inode fully dirty. Since we are allocating blocks, inode 278 * Mark inode fully dirty. Since we are allocating blocks, inode
280 * would become fully dirty soon anyway and it reportedly 279 * would become fully dirty soon anyway and it reportedly
281 * reduces inode_lock contention. 280 * reduces lock contention.
282 */ 281 */
283 mark_inode_dirty(inode); 282 mark_inode_dirty(inode);
284 } 283 }
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index a39cbed9ee17..23241c2fecce 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -34,19 +34,13 @@
34 * needed for RCU lookups (because root->height is unreliable). The only 34 * needed for RCU lookups (because root->height is unreliable). The only
35 * time callers need worry about this is when doing a lookup_slot under 35 * time callers need worry about this is when doing a lookup_slot under
36 * RCU. 36 * RCU.
37 *
38 * Indirect pointer in fact is also used to tag the last pointer of a node
39 * when it is shrunk, before we rcu free the node. See shrink code for
40 * details.
37 */ 41 */
38#define RADIX_TREE_INDIRECT_PTR 1 42#define RADIX_TREE_INDIRECT_PTR 1
39#define RADIX_TREE_RETRY ((void *)-1UL)
40
41static inline void *radix_tree_ptr_to_indirect(void *ptr)
42{
43 return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR);
44}
45 43
46static inline void *radix_tree_indirect_to_ptr(void *ptr)
47{
48 return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR);
49}
50#define radix_tree_indirect_to_ptr(ptr) \ 44#define radix_tree_indirect_to_ptr(ptr) \
51 radix_tree_indirect_to_ptr((void __force *)(ptr)) 45 radix_tree_indirect_to_ptr((void __force *)(ptr))
52 46
@@ -140,16 +134,45 @@ do { \
140 * removed. 134 * removed.
141 * 135 *
142 * For use with radix_tree_lookup_slot(). Caller must hold tree at least read 136 * For use with radix_tree_lookup_slot(). Caller must hold tree at least read
143 * locked across slot lookup and dereference. More likely, will be used with 137 * locked across slot lookup and dereference. Not required if write lock is
144 * radix_tree_replace_slot(), as well, so caller will hold tree write locked. 138 * held (ie. items cannot be concurrently inserted).
139 *
140 * radix_tree_deref_retry must be used to confirm validity of the pointer if
141 * only the read lock is held.
145 */ 142 */
146static inline void *radix_tree_deref_slot(void **pslot) 143static inline void *radix_tree_deref_slot(void **pslot)
147{ 144{
148 void *ret = rcu_dereference(*pslot); 145 return rcu_dereference(*pslot);
149 if (unlikely(radix_tree_is_indirect_ptr(ret)))
150 ret = RADIX_TREE_RETRY;
151 return ret;
152} 146}
147
148/**
149 * radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held
150 * @pslot: pointer to slot, returned by radix_tree_lookup_slot
151 * Returns: item that was stored in that slot with any direct pointer flag
152 * removed.
153 *
154 * Similar to radix_tree_deref_slot but only used during migration when a pages
155 * mapping is being moved. The caller does not hold the RCU read lock but it
156 * must hold the tree lock to prevent parallel updates.
157 */
158static inline void *radix_tree_deref_slot_protected(void **pslot,
159 spinlock_t *treelock)
160{
161 return rcu_dereference_protected(*pslot, lockdep_is_held(treelock));
162}
163
164/**
165 * radix_tree_deref_retry - check radix_tree_deref_slot
166 * @arg: pointer returned by radix_tree_deref_slot
167 * Returns: 0 if retry is not required, otherwise retry is required
168 *
169 * radix_tree_deref_retry must be used with radix_tree_deref_slot.
170 */
171static inline int radix_tree_deref_retry(void *arg)
172{
173 return unlikely((unsigned long)arg & RADIX_TREE_INDIRECT_PTR);
174}
175
153/** 176/**
154 * radix_tree_replace_slot - replace item in a slot 177 * radix_tree_replace_slot - replace item in a slot
155 * @pslot: pointer to slot, returned by radix_tree_lookup_slot 178 * @pslot: pointer to slot, returned by radix_tree_lookup_slot
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index ffa2efbbe382..75cbf4f62fe8 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -251,7 +251,7 @@ struct mdp_superblock_1 {
251 __le64 utime; /* 40 bits second, 24 btes microseconds */ 251 __le64 utime; /* 40 bits second, 24 btes microseconds */
252 __le64 events; /* incremented when superblock updated */ 252 __le64 events; /* incremented when superblock updated */
253 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ 253 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
254 __le32 sb_csum; /* checksum upto devs[max_dev] */ 254 __le32 sb_csum; /* checksum up to devs[max_dev] */
255 __le32 max_dev; /* size of devs[] array to consider */ 255 __le32 max_dev; /* size of devs[] array to consider */
256 __u8 pad3[64-32]; /* set to 0 when writing */ 256 __u8 pad3[64-32]; /* set to 0 when writing */
257 257
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index e7320b5e82fb..3a8f0c9b2933 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -3,8 +3,8 @@
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev); 5 int mode, dev_t dev);
6extern int ramfs_get_sb(struct file_system_type *fs_type, 6extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
7 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 int flags, const char *dev_name, void *data);
8 8
9#ifndef CONFIG_MMU 9#ifndef CONFIG_MMU
10extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize); 10extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h
new file mode 100644
index 000000000000..0ae68a2c1212
--- /dev/null
+++ b/include/linux/ramoops.h
@@ -0,0 +1,15 @@
1#ifndef __RAMOOPS_H
2#define __RAMOOPS_H
3
4/*
5 * Ramoops platform data
6 * @mem_size memory size for ramoops
7 * @mem_address physical memory address to contain ramoops
8 */
9
10struct ramoops_platform_data {
11 unsigned long mem_size;
12 unsigned long mem_address;
13};
14
15#endif
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h
index ffa805780f85..5c6118189363 100644
--- a/include/linux/rar_register.h
+++ b/include/linux/rar_register.h
@@ -34,11 +34,27 @@
34 34
35struct rar_device; 35struct rar_device;
36 36
37#if defined(CONFIG_RAR_REGISTER)
37int register_rar(int num, 38int register_rar(int num,
38 int (*callback)(unsigned long data), unsigned long data); 39 int (*callback)(unsigned long data), unsigned long data);
39void unregister_rar(int num); 40void unregister_rar(int num);
40int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end); 41int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end);
41int rar_lock(int rar_index); 42int rar_lock(int rar_index);
43#else
44extern void unregister_rar(int num) { }
45extern int rar_lock(int rar_index) { return -EIO; }
46
47extern inline int register_rar(int num,
48 int (*callback)(unsigned long data), unsigned long data)
49{
50 return -ENODEV;
51}
52
53extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end)
54{
55 return -ENODEV;
56}
57#endif /* RAR_REGISTER */
42 58
43#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
44#endif /* _RAR_REGISTER_H */ 60#endif /* _RAR_REGISTER_H */
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 8f69d09a41a5..03ff67b0cdf5 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -36,6 +36,8 @@ static inline void ratelimit_state_init(struct ratelimit_state *rs,
36 rs->begin = 0; 36 rs->begin = 0;
37} 37}
38 38
39extern struct ratelimit_state printk_ratelimit_state;
40
39extern int ___ratelimit(struct ratelimit_state *rs, const char *func); 41extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
40#define __ratelimit(state) ___ratelimit(state, __func__) 42#define __ratelimit(state) ___ratelimit(state, __func__)
41 43
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 7066acb2c530..033b507b33b1 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -136,6 +136,14 @@ static inline void rb_set_color(struct rb_node *rb, int color)
136#define RB_EMPTY_NODE(node) (rb_parent(node) == node) 136#define RB_EMPTY_NODE(node) (rb_parent(node) == node)
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) 137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
138 138
139static inline void rb_init_node(struct rb_node *rb)
140{
141 rb->rb_parent_color = 0;
142 rb->rb_right = NULL;
143 rb->rb_left = NULL;
144 RB_CLEAR_NODE(rb);
145}
146
139extern void rb_insert_color(struct rb_node *, struct rb_root *); 147extern void rb_insert_color(struct rb_node *, struct rb_root *);
140extern void rb_erase(struct rb_node *, struct rb_root *); 148extern void rb_erase(struct rb_node *, struct rb_root *);
141 149
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index f31ef61f1c65..e3beb315517a 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -241,11 +241,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
241#define list_first_entry_rcu(ptr, type, member) \ 241#define list_first_entry_rcu(ptr, type, member) \
242 list_entry_rcu((ptr)->next, type, member) 242 list_entry_rcu((ptr)->next, type, member)
243 243
244#define __list_for_each_rcu(pos, head) \
245 for (pos = rcu_dereference_raw(list_next_rcu(head)); \
246 pos != (head); \
247 pos = rcu_dereference_raw(list_next_rcu((pos)))
248
249/** 244/**
250 * list_for_each_entry_rcu - iterate over rcu list of given type 245 * list_for_each_entry_rcu - iterate over rcu list of given type
251 * @pos: the type * to use as a loop cursor. 246 * @pos: the type * to use as a loop cursor.
@@ -258,7 +253,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
258 */ 253 */
259#define list_for_each_entry_rcu(pos, head, member) \ 254#define list_for_each_entry_rcu(pos, head, member) \
260 for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \ 255 for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \
261 prefetch(pos->member.next), &pos->member != (head); \ 256 &pos->member != (head); \
262 pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) 257 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
263 258
264 259
@@ -275,7 +270,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
275 */ 270 */
276#define list_for_each_continue_rcu(pos, head) \ 271#define list_for_each_continue_rcu(pos, head) \
277 for ((pos) = rcu_dereference_raw(list_next_rcu(pos)); \ 272 for ((pos) = rcu_dereference_raw(list_next_rcu(pos)); \
278 prefetch((pos)->next), (pos) != (head); \ 273 (pos) != (head); \
279 (pos) = rcu_dereference_raw(list_next_rcu(pos))) 274 (pos) = rcu_dereference_raw(list_next_rcu(pos)))
280 275
281/** 276/**
@@ -289,7 +284,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
289 */ 284 */
290#define list_for_each_entry_continue_rcu(pos, head, member) \ 285#define list_for_each_entry_continue_rcu(pos, head, member) \
291 for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ 286 for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
292 prefetch(pos->member.next), &pos->member != (head); \ 287 &pos->member != (head); \
293 pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) 288 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
294 289
295/** 290/**
@@ -432,7 +427,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
432 427
433#define __hlist_for_each_rcu(pos, head) \ 428#define __hlist_for_each_rcu(pos, head) \
434 for (pos = rcu_dereference(hlist_first_rcu(head)); \ 429 for (pos = rcu_dereference(hlist_first_rcu(head)); \
435 pos && ({ prefetch(pos->next); 1; }); \ 430 pos; \
436 pos = rcu_dereference(hlist_next_rcu(pos))) 431 pos = rcu_dereference(hlist_next_rcu(pos)))
437 432
438/** 433/**
@@ -448,7 +443,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
448 */ 443 */
449#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 444#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
450 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \ 445 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \
451 pos && ({ prefetch(pos->next); 1; }) && \ 446 pos && \
452 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 447 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
453 pos = rcu_dereference_raw(hlist_next_rcu(pos))) 448 pos = rcu_dereference_raw(hlist_next_rcu(pos)))
454 449
@@ -465,7 +460,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
465 */ 460 */
466#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \ 461#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \
467 for (pos = rcu_dereference_bh((head)->first); \ 462 for (pos = rcu_dereference_bh((head)->first); \
468 pos && ({ prefetch(pos->next); 1; }) && \ 463 pos && \
469 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 464 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
470 pos = rcu_dereference_bh(pos->next)) 465 pos = rcu_dereference_bh(pos->next))
471 466
@@ -477,7 +472,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
477 */ 472 */
478#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \ 473#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \
479 for (pos = rcu_dereference((pos)->next); \ 474 for (pos = rcu_dereference((pos)->next); \
480 pos && ({ prefetch(pos->next); 1; }) && \ 475 pos && \
481 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 476 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
482 pos = rcu_dereference(pos->next)) 477 pos = rcu_dereference(pos->next))
483 478
@@ -489,7 +484,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
489 */ 484 */
490#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \ 485#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \
491 for (pos = rcu_dereference_bh((pos)->next); \ 486 for (pos = rcu_dereference_bh((pos)->next); \
492 pos && ({ prefetch(pos->next); 1; }) && \ 487 pos && \
493 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 488 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
494 pos = rcu_dereference_bh(pos->next)) 489 pos = rcu_dereference_bh(pos->next))
495 490
diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h
new file mode 100644
index 000000000000..cf1244fbf3b6
--- /dev/null
+++ b/include/linux/rculist_bl.h
@@ -0,0 +1,128 @@
1#ifndef _LINUX_RCULIST_BL_H
2#define _LINUX_RCULIST_BL_H
3
4/*
5 * RCU-protected bl list version. See include/linux/list_bl.h.
6 */
7#include <linux/list_bl.h>
8#include <linux/rcupdate.h>
9
10static inline void hlist_bl_set_first_rcu(struct hlist_bl_head *h,
11 struct hlist_bl_node *n)
12{
13 LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
14 LIST_BL_BUG_ON(((unsigned long)h->first & LIST_BL_LOCKMASK) !=
15 LIST_BL_LOCKMASK);
16 rcu_assign_pointer(h->first,
17 (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK));
18}
19
20static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h)
21{
22 return (struct hlist_bl_node *)
23 ((unsigned long)rcu_dereference(h->first) & ~LIST_BL_LOCKMASK);
24}
25
26/**
27 * hlist_bl_del_init_rcu - deletes entry from hash list with re-initialization
28 * @n: the element to delete from the hash list.
29 *
30 * Note: hlist_bl_unhashed() on the node returns true after this. It is
31 * useful for RCU based read lockfree traversal if the writer side
32 * must know if the list entry is still hashed or already unhashed.
33 *
34 * In particular, it means that we can not poison the forward pointers
35 * that may still be used for walking the hash list and we can only
36 * zero the pprev pointer so list_unhashed() will return true after
37 * this.
38 *
39 * The caller must take whatever precautions are necessary (such as
40 * holding appropriate locks) to avoid racing with another
41 * list-mutation primitive, such as hlist_bl_add_head_rcu() or
42 * hlist_bl_del_rcu(), running on this same list. However, it is
43 * perfectly legal to run concurrently with the _rcu list-traversal
44 * primitives, such as hlist_bl_for_each_entry_rcu().
45 */
46static inline void hlist_bl_del_init_rcu(struct hlist_bl_node *n)
47{
48 if (!hlist_bl_unhashed(n)) {
49 __hlist_bl_del(n);
50 n->pprev = NULL;
51 }
52}
53
54/**
55 * hlist_bl_del_rcu - deletes entry from hash list without re-initialization
56 * @n: the element to delete from the hash list.
57 *
58 * Note: hlist_bl_unhashed() on entry does not return true after this,
59 * the entry is in an undefined state. It is useful for RCU based
60 * lockfree traversal.
61 *
62 * In particular, it means that we can not poison the forward
63 * pointers that may still be used for walking the hash list.
64 *
65 * The caller must take whatever precautions are necessary
66 * (such as holding appropriate locks) to avoid racing
67 * with another list-mutation primitive, such as hlist_bl_add_head_rcu()
68 * or hlist_bl_del_rcu(), running on this same list.
69 * However, it is perfectly legal to run concurrently with
70 * the _rcu list-traversal primitives, such as
71 * hlist_bl_for_each_entry().
72 */
73static inline void hlist_bl_del_rcu(struct hlist_bl_node *n)
74{
75 __hlist_bl_del(n);
76 n->pprev = LIST_POISON2;
77}
78
79/**
80 * hlist_bl_add_head_rcu
81 * @n: the element to add to the hash list.
82 * @h: the list to add to.
83 *
84 * Description:
85 * Adds the specified element to the specified hlist_bl,
86 * while permitting racing traversals.
87 *
88 * The caller must take whatever precautions are necessary
89 * (such as holding appropriate locks) to avoid racing
90 * with another list-mutation primitive, such as hlist_bl_add_head_rcu()
91 * or hlist_bl_del_rcu(), running on this same list.
92 * However, it is perfectly legal to run concurrently with
93 * the _rcu list-traversal primitives, such as
94 * hlist_bl_for_each_entry_rcu(), used to prevent memory-consistency
95 * problems on Alpha CPUs. Regardless of the type of CPU, the
96 * list-traversal primitive must be guarded by rcu_read_lock().
97 */
98static inline void hlist_bl_add_head_rcu(struct hlist_bl_node *n,
99 struct hlist_bl_head *h)
100{
101 struct hlist_bl_node *first;
102
103 /* don't need hlist_bl_first_rcu because we're under lock */
104 first = hlist_bl_first(h);
105
106 n->next = first;
107 if (first)
108 first->pprev = &n->next;
109 n->pprev = &h->first;
110
111 /* need _rcu because we can have concurrent lock free readers */
112 hlist_bl_set_first_rcu(h, n);
113}
114/**
115 * hlist_bl_for_each_entry_rcu - iterate over rcu list of given type
116 * @tpos: the type * to use as a loop cursor.
117 * @pos: the &struct hlist_bl_node to use as a loop cursor.
118 * @head: the head for your list.
119 * @member: the name of the hlist_bl_node within the struct.
120 *
121 */
122#define hlist_bl_for_each_entry_rcu(tpos, pos, head, member) \
123 for (pos = hlist_bl_first_rcu(head); \
124 pos && \
125 ({ tpos = hlist_bl_entry(pos, typeof(*tpos), member); 1; }); \
126 pos = rcu_dereference_raw(pos->next))
127
128#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 03cda7bed985..99f9aa7c2804 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -47,6 +47,20 @@
47extern int rcutorture_runnable; /* for sysctl */ 47extern int rcutorture_runnable; /* for sysctl */
48#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 48#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
49 49
50#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
51extern void rcutorture_record_test_transition(void);
52extern void rcutorture_record_progress(unsigned long vernum);
53#else
54static inline void rcutorture_record_test_transition(void)
55{
56}
57static inline void rcutorture_record_progress(unsigned long vernum)
58{
59}
60#endif
61
62#define UINT_CMP_GE(a, b) (UINT_MAX / 2 >= (a) - (b))
63#define UINT_CMP_LT(a, b) (UINT_MAX / 2 < (a) - (b))
50#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) 64#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
51#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) 65#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
52 66
@@ -66,8 +80,6 @@ extern void call_rcu_sched(struct rcu_head *head,
66extern void synchronize_sched(void); 80extern void synchronize_sched(void);
67extern void rcu_barrier_bh(void); 81extern void rcu_barrier_bh(void);
68extern void rcu_barrier_sched(void); 82extern void rcu_barrier_sched(void);
69extern void synchronize_sched_expedited(void);
70extern int sched_expedited_torture_stats(char *page);
71 83
72static inline void __rcu_read_lock_bh(void) 84static inline void __rcu_read_lock_bh(void)
73{ 85{
@@ -118,7 +130,6 @@ static inline int rcu_preempt_depth(void)
118#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 130#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
119 131
120/* Internal to kernel */ 132/* Internal to kernel */
121extern void rcu_init(void);
122extern void rcu_sched_qs(int cpu); 133extern void rcu_sched_qs(int cpu);
123extern void rcu_bh_qs(int cpu); 134extern void rcu_bh_qs(int cpu);
124extern void rcu_check_callbacks(int cpu, int user); 135extern void rcu_check_callbacks(int cpu, int user);
@@ -339,6 +350,12 @@ extern int rcu_my_thread_group_empty(void);
339 ((typeof(*p) __force __kernel *)(p)); \ 350 ((typeof(*p) __force __kernel *)(p)); \
340 }) 351 })
341 352
353#define __rcu_access_index(p, space) \
354 ({ \
355 typeof(p) _________p1 = ACCESS_ONCE(p); \
356 rcu_dereference_sparse(p, space); \
357 (_________p1); \
358 })
342#define __rcu_dereference_index_check(p, c) \ 359#define __rcu_dereference_index_check(p, c) \
343 ({ \ 360 ({ \
344 typeof(p) _________p1 = ACCESS_ONCE(p); \ 361 typeof(p) _________p1 = ACCESS_ONCE(p); \
@@ -429,6 +446,20 @@ extern int rcu_my_thread_group_empty(void);
429#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/ 446#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
430 447
431/** 448/**
449 * rcu_access_index() - fetch RCU index with no dereferencing
450 * @p: The index to read
451 *
452 * Return the value of the specified RCU-protected index, but omit the
453 * smp_read_barrier_depends() and keep the ACCESS_ONCE(). This is useful
454 * when the value of this index is accessed, but the index is not
455 * dereferenced, for example, when testing an RCU-protected index against
456 * -1. Although rcu_access_index() may also be used in cases where
457 * update-side locks prevent the value of the index from changing, you
458 * should instead use rcu_dereference_index_protected() for this use case.
459 */
460#define rcu_access_index(p) __rcu_access_index((p), __rcu)
461
462/**
432 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking 463 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking
433 * @p: The pointer to read, prior to dereferencing 464 * @p: The pointer to read, prior to dereferencing
434 * @c: The conditions under which the dereference will take place 465 * @c: The conditions under which the dereference will take place
@@ -754,6 +785,7 @@ extern struct debug_obj_descr rcuhead_debug_descr;
754 785
755static inline void debug_rcu_head_queue(struct rcu_head *head) 786static inline void debug_rcu_head_queue(struct rcu_head *head)
756{ 787{
788 WARN_ON_ONCE((unsigned long)head & 0x3);
757 debug_object_activate(head, &rcuhead_debug_descr); 789 debug_object_activate(head, &rcuhead_debug_descr);
758 debug_object_active_state(head, &rcuhead_debug_descr, 790 debug_object_active_state(head, &rcuhead_debug_descr,
759 STATE_RCU_HEAD_READY, 791 STATE_RCU_HEAD_READY,
@@ -777,4 +809,60 @@ static inline void debug_rcu_head_unqueue(struct rcu_head *head)
777} 809}
778#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 810#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
779 811
812static __always_inline bool __is_kfree_rcu_offset(unsigned long offset)
813{
814 return offset < 4096;
815}
816
817static __always_inline
818void __kfree_rcu(struct rcu_head *head, unsigned long offset)
819{
820 typedef void (*rcu_callback)(struct rcu_head *);
821
822 BUILD_BUG_ON(!__builtin_constant_p(offset));
823
824 /* See the kfree_rcu() header comment. */
825 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));
826
827 call_rcu(head, (rcu_callback)offset);
828}
829
830extern void kfree(const void *);
831
832static inline void __rcu_reclaim(struct rcu_head *head)
833{
834 unsigned long offset = (unsigned long)head->func;
835
836 if (__is_kfree_rcu_offset(offset))
837 kfree((void *)head - offset);
838 else
839 head->func(head);
840}
841
842/**
843 * kfree_rcu() - kfree an object after a grace period.
844 * @ptr: pointer to kfree
845 * @rcu_head: the name of the struct rcu_head within the type of @ptr.
846 *
847 * Many rcu callbacks functions just call kfree() on the base structure.
848 * These functions are trivial, but their size adds up, and furthermore
849 * when they are used in a kernel module, that module must invoke the
850 * high-latency rcu_barrier() function at module-unload time.
851 *
852 * The kfree_rcu() function handles this issue. Rather than encoding a
853 * function address in the embedded rcu_head structure, kfree_rcu() instead
854 * encodes the offset of the rcu_head structure within the base structure.
855 * Because the functions are not allowed in the low-order 4096 bytes of
856 * kernel virtual memory, offsets up to 4095 bytes can be accommodated.
857 * If the offset is larger than 4095 bytes, a compile-time error will
858 * be generated in __kfree_rcu(). If this error is triggered, you can
859 * either fall back to use of call_rcu() or rearrange the structure to
860 * position the rcu_head structure into the first 4096 bytes.
861 *
862 * Note that the allowable offset might decrease in the future, for example,
863 * to allow something like kmem_cache_free_rcu().
864 */
865#define kfree_rcu(ptr, rcu_head) \
866 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
867
780#endif /* __LINUX_RCUPDATE_H */ 868#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 13877cb93a60..52b3e0281fd0 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -27,7 +27,9 @@
27 27
28#include <linux/cache.h> 28#include <linux/cache.h>
29 29
30#define rcu_init_sched() do { } while (0) 30static inline void rcu_init(void)
31{
32}
31 33
32#ifdef CONFIG_TINY_RCU 34#ifdef CONFIG_TINY_RCU
33 35
@@ -58,6 +60,11 @@ static inline void synchronize_rcu_bh_expedited(void)
58 synchronize_sched(); 60 synchronize_sched();
59} 61}
60 62
63static inline void synchronize_sched_expedited(void)
64{
65 synchronize_sched();
66}
67
61#ifdef CONFIG_TINY_RCU 68#ifdef CONFIG_TINY_RCU
62 69
63static inline void rcu_preempt_note_context_switch(void) 70static inline void rcu_preempt_note_context_switch(void)
@@ -93,6 +100,14 @@ static inline void rcu_note_context_switch(int cpu)
93} 100}
94 101
95/* 102/*
103 * Take advantage of the fact that there is only one CPU, which
104 * allows us to ignore virtualization-based context switches.
105 */
106static inline void rcu_virt_note_context_switch(int cpu)
107{
108}
109
110/*
96 * Return the number of grace periods. 111 * Return the number of grace periods.
97 */ 112 */
98static inline long rcu_batches_completed(void) 113static inline long rcu_batches_completed(void)
@@ -125,16 +140,12 @@ static inline void rcu_cpu_stall_reset(void)
125} 140}
126 141
127#ifdef CONFIG_DEBUG_LOCK_ALLOC 142#ifdef CONFIG_DEBUG_LOCK_ALLOC
128
129extern int rcu_scheduler_active __read_mostly; 143extern int rcu_scheduler_active __read_mostly;
130extern void rcu_scheduler_starting(void); 144extern void rcu_scheduler_starting(void);
131
132#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 145#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
133
134static inline void rcu_scheduler_starting(void) 146static inline void rcu_scheduler_starting(void)
135{ 147{
136} 148}
137
138#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 149#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
139 150
140#endif /* __LINUX_RCUTINY_H */ 151#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 95518e628794..e65d06634dd8 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,10 +30,21 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33extern void rcu_init(void);
33extern void rcu_note_context_switch(int cpu); 34extern void rcu_note_context_switch(int cpu);
34extern int rcu_needs_cpu(int cpu); 35extern int rcu_needs_cpu(int cpu);
35extern void rcu_cpu_stall_reset(void); 36extern void rcu_cpu_stall_reset(void);
36 37
38/*
39 * Note a virtualization-based context switch. This is simply a
40 * wrapper around rcu_note_context_switch(), which allows TINY_RCU
41 * to save a few bytes.
42 */
43static inline void rcu_virt_note_context_switch(int cpu)
44{
45 rcu_note_context_switch(cpu);
46}
47
37#ifdef CONFIG_TREE_PREEMPT_RCU 48#ifdef CONFIG_TREE_PREEMPT_RCU
38 49
39extern void exit_rcu(void); 50extern void exit_rcu(void);
@@ -47,6 +58,7 @@ static inline void exit_rcu(void)
47#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ 58#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
48 59
49extern void synchronize_rcu_bh(void); 60extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void);
50extern void synchronize_rcu_expedited(void); 62extern void synchronize_rcu_expedited(void);
51 63
52static inline void synchronize_rcu_bh_expedited(void) 64static inline void synchronize_rcu_bh_expedited(void)
@@ -56,9 +68,12 @@ static inline void synchronize_rcu_bh_expedited(void)
56 68
57extern void rcu_barrier(void); 69extern void rcu_barrier(void);
58 70
71extern unsigned long rcutorture_testseq;
72extern unsigned long rcutorture_vernum;
59extern long rcu_batches_completed(void); 73extern long rcu_batches_completed(void);
60extern long rcu_batches_completed_bh(void); 74extern long rcu_batches_completed_bh(void);
61extern long rcu_batches_completed_sched(void); 75extern long rcu_batches_completed_sched(void);
76
62extern void rcu_force_quiescent_state(void); 77extern void rcu_force_quiescent_state(void);
63extern void rcu_bh_force_quiescent_state(void); 78extern void rcu_bh_force_quiescent_state(void);
64extern void rcu_sched_force_quiescent_state(void); 79extern void rcu_sched_force_quiescent_state(void);
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index f509877c2ed4..76579f964a29 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -3,23 +3,72 @@
3 * 3 *
4 * License Terms: GNU General Public License v2 4 * License Terms: GNU General Public License v2
5 * 5 *
6 * Author: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson 6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 * 7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
8 */ 8 */
9 9
10#ifndef __LINUX_MFD_AB8500_REGULATOR_H 10#ifndef __LINUX_MFD_AB8500_REGULATOR_H
11#define __LINUX_MFD_AB8500_REGULATOR_H 11#define __LINUX_MFD_AB8500_REGULATOR_H
12 12
13/* AB8500 regulators */ 13/* AB8500 regulators */
14#define AB8500_LDO_AUX1 0 14enum ab8500_regulator_id {
15#define AB8500_LDO_AUX2 1 15 AB8500_LDO_AUX1,
16#define AB8500_LDO_AUX3 2 16 AB8500_LDO_AUX2,
17#define AB8500_LDO_INTCORE 3 17 AB8500_LDO_AUX3,
18#define AB8500_LDO_TVOUT 4 18 AB8500_LDO_INTCORE,
19#define AB8500_LDO_AUDIO 5 19 AB8500_LDO_TVOUT,
20#define AB8500_LDO_ANAMIC1 6 20 AB8500_LDO_USB,
21#define AB8500_LDO_ANAMIC2 7 21 AB8500_LDO_AUDIO,
22#define AB8500_LDO_DMIC 8 22 AB8500_LDO_ANAMIC1,
23#define AB8500_LDO_ANA 9 23 AB8500_LDO_ANAMIC2,
24 AB8500_LDO_DMIC,
25 AB8500_LDO_ANA,
26 AB8500_NUM_REGULATORS,
27};
28
29/* AB8500 register initialization */
30struct ab8500_regulator_reg_init {
31 int id;
32 u8 value;
33};
34
35#define INIT_REGULATOR_REGISTER(_id, _value) \
36 { \
37 .id = _id, \
38 .value = _value, \
39 }
40
41/* AB8500 registers */
42enum ab8500_regulator_reg {
43 AB8500_REGUREQUESTCTRL2,
44 AB8500_REGUREQUESTCTRL3,
45 AB8500_REGUREQUESTCTRL4,
46 AB8500_REGUSYSCLKREQ1HPVALID1,
47 AB8500_REGUSYSCLKREQ1HPVALID2,
48 AB8500_REGUHWHPREQ1VALID1,
49 AB8500_REGUHWHPREQ1VALID2,
50 AB8500_REGUHWHPREQ2VALID1,
51 AB8500_REGUHWHPREQ2VALID2,
52 AB8500_REGUSWHPREQVALID1,
53 AB8500_REGUSWHPREQVALID2,
54 AB8500_REGUSYSCLKREQVALID1,
55 AB8500_REGUSYSCLKREQVALID2,
56 AB8500_REGUMISC1,
57 AB8500_VAUDIOSUPPLY,
58 AB8500_REGUCTRL1VAMIC,
59 AB8500_VPLLVANAREGU,
60 AB8500_VREFDDR,
61 AB8500_EXTSUPPLYREGU,
62 AB8500_VAUX12REGU,
63 AB8500_VRF1VAUX3REGU,
64 AB8500_VAUX1SEL,
65 AB8500_VAUX2SEL,
66 AB8500_VRF1VAUX3SEL,
67 AB8500_REGUCTRL2SPARE,
68 AB8500_REGUCTRLDISCH,
69 AB8500_REGUCTRLDISCH2,
70 AB8500_VSMPS1SEL1,
71 AB8500_NUM_REGULATOR_REGISTERS,
72};
24 73
25#endif 74#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index ebd747265294..9e87c1cb7270 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -153,7 +153,10 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector);
153int regulator_is_supported_voltage(struct regulator *regulator, 153int regulator_is_supported_voltage(struct regulator *regulator,
154 int min_uV, int max_uV); 154 int min_uV, int max_uV);
155int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 155int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
156int regulator_set_voltage_time(struct regulator *regulator,
157 int old_uV, int new_uV);
156int regulator_get_voltage(struct regulator *regulator); 158int regulator_get_voltage(struct regulator *regulator);
159int regulator_sync_voltage(struct regulator *regulator);
157int regulator_set_current_limit(struct regulator *regulator, 160int regulator_set_current_limit(struct regulator *regulator,
158 int min_uA, int max_uA); 161 int min_uA, int max_uA);
159int regulator_get_current_limit(struct regulator *regulator); 162int regulator_get_current_limit(struct regulator *regulator);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 592cd7c642c2..6c433b89c80d 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -42,7 +42,11 @@ enum regulator_status {
42 * 42 *
43 * @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.
44 * The driver should select the voltage closest to min_uV. 44 * The driver should select the voltage closest to min_uV.
45 * @set_voltage_sel: Set the voltage for the regulator using the specified
46 * selector.
45 * @get_voltage: Return the currently configured voltage for the regulator. 47 * @get_voltage: Return the currently configured voltage for the regulator.
48 * @get_voltage_sel: Return the currently configured voltage selector for the
49 * regulator.
46 * @list_voltage: Return one of the supported voltages, in microvolts; zero 50 * @list_voltage: Return one of the supported voltages, in microvolts; zero
47 * if the selector indicates a voltage that is unusable on this system; 51 * if the selector indicates a voltage that is unusable on this system;
48 * or negative errno. Selectors range from zero to one less than 52 * or negative errno. Selectors range from zero to one less than
@@ -59,7 +63,11 @@ enum regulator_status {
59 * when running with the specified parameters. 63 * when running with the specified parameters.
60 * 64 *
61 * @enable_time: Time taken for the regulator voltage output voltage to 65 * @enable_time: Time taken for the regulator voltage output voltage to
62 * stabalise after being enabled, in microseconds. 66 * stabilise after being enabled, in microseconds.
67 * @set_voltage_time_sel: Time taken for the regulator voltage output voltage
68 * to stabilise after being set to a new value, in microseconds.
69 * The function provides the from and to voltage selector, the
70 * function should return the worst case.
63 * 71 *
64 * @set_suspend_voltage: Set the voltage for the regulator when the system 72 * @set_suspend_voltage: Set the voltage for the regulator when the system
65 * is suspended. 73 * is suspended.
@@ -79,8 +87,11 @@ struct regulator_ops {
79 int (*list_voltage) (struct regulator_dev *, unsigned selector); 87 int (*list_voltage) (struct regulator_dev *, unsigned selector);
80 88
81 /* get/set regulator voltage */ 89 /* get/set regulator voltage */
82 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); 90 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
91 unsigned *selector);
92 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
83 int (*get_voltage) (struct regulator_dev *); 93 int (*get_voltage) (struct regulator_dev *);
94 int (*get_voltage_sel) (struct regulator_dev *);
84 95
85 /* get/set regulator current */ 96 /* get/set regulator current */
86 int (*set_current_limit) (struct regulator_dev *, 97 int (*set_current_limit) (struct regulator_dev *,
@@ -96,8 +107,11 @@ struct regulator_ops {
96 int (*set_mode) (struct regulator_dev *, unsigned int mode); 107 int (*set_mode) (struct regulator_dev *, unsigned int mode);
97 unsigned int (*get_mode) (struct regulator_dev *); 108 unsigned int (*get_mode) (struct regulator_dev *);
98 109
99 /* Time taken to enable the regulator */ 110 /* Time taken to enable or set voltage on the regulator */
100 int (*enable_time) (struct regulator_dev *); 111 int (*enable_time) (struct regulator_dev *);
112 int (*set_voltage_time_sel) (struct regulator_dev *,
113 unsigned int old_selector,
114 unsigned int new_selector);
101 115
102 /* report regulator status ... most other accessors report 116 /* report regulator status ... most other accessors report
103 * control inputs, this reports results of combining inputs 117 * control inputs, this reports results of combining inputs
@@ -168,9 +182,9 @@ struct regulator_desc {
168 */ 182 */
169struct regulator_dev { 183struct regulator_dev {
170 struct regulator_desc *desc; 184 struct regulator_desc *desc;
171 int use_count;
172 int open_count;
173 int exclusive; 185 int exclusive;
186 u32 use_count;
187 u32 open_count;
174 188
175 /* lists we belong to */ 189 /* lists we belong to */
176 struct list_head list; /* list of all regulators */ 190 struct list_head list; /* list of all regulators */
@@ -188,10 +202,14 @@ struct regulator_dev {
188 struct regulator_dev *supply; /* for tree */ 202 struct regulator_dev *supply; /* for tree */
189 203
190 void *reg_data; /* regulator_dev data */ 204 void *reg_data; /* regulator_dev data */
205
206#ifdef CONFIG_DEBUG_FS
207 struct dentry *debugfs;
208#endif
191}; 209};
192 210
193struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 211struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
194 struct device *dev, struct regulator_init_data *init_data, 212 struct device *dev, const struct regulator_init_data *init_data,
195 void *driver_data); 213 void *driver_data);
196void regulator_unregister(struct regulator_dev *rdev); 214void regulator_unregister(struct regulator_dev *rdev);
197 215
diff --git a/include/linux/regulator/lp3972.h b/include/linux/regulator/lp3972.h
new file mode 100644
index 000000000000..9bb7389b7a1e
--- /dev/null
+++ b/include/linux/regulator/lp3972.h
@@ -0,0 +1,48 @@
1/*
2 * National Semiconductors LP3972 PMIC chip client interface
3 *
4 * Based on lp3971.h
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_REGULATOR_LP3972_H
22#define __LINUX_REGULATOR_LP3972_H
23
24#include <linux/regulator/machine.h>
25
26#define LP3972_LDO1 0
27#define LP3972_LDO2 1
28#define LP3972_LDO3 2
29#define LP3972_LDO4 3
30#define LP3972_LDO5 4
31
32#define LP3972_DCDC1 5
33#define LP3972_DCDC2 6
34#define LP3972_DCDC3 7
35
36#define LP3972_NUM_REGULATORS 8
37
38struct lp3972_regulator_subdev {
39 int id;
40 struct regulator_init_data *initdata;
41};
42
43struct lp3972_platform_data {
44 int num_regulators;
45 struct lp3972_regulator_subdev *regulators;
46};
47
48#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index e2980287245e..c4c4fc45f856 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -186,13 +186,19 @@ struct regulator_init_data {
186}; 186};
187 187
188int regulator_suspend_prepare(suspend_state_t state); 188int regulator_suspend_prepare(suspend_state_t state);
189int regulator_suspend_finish(void);
189 190
190#ifdef CONFIG_REGULATOR 191#ifdef CONFIG_REGULATOR
191void regulator_has_full_constraints(void); 192void regulator_has_full_constraints(void);
193void regulator_use_dummy_regulator(void);
192#else 194#else
193static inline void regulator_has_full_constraints(void) 195static inline void regulator_has_full_constraints(void)
194{ 196{
195} 197}
198
199static inline void regulator_use_dummy_regulator(void)
200{
201}
196#endif 202#endif
197 203
198#endif 204#endif
diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h
new file mode 100644
index 000000000000..45e42855ad05
--- /dev/null
+++ b/include/linux/regulator/max8952.h
@@ -0,0 +1,135 @@
1/*
2 * max8952.h - Voltage regulation for the Maxim 8952
3 *
4 * Copyright (C) 2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef REGULATOR_MAX8952
23#define REGULATOR_MAX8952
24
25#include <linux/regulator/machine.h>
26
27enum {
28 MAX8952_DVS_MODE0,
29 MAX8952_DVS_MODE1,
30 MAX8952_DVS_MODE2,
31 MAX8952_DVS_MODE3,
32};
33
34enum {
35 MAX8952_DVS_770mV = 0,
36 MAX8952_DVS_780mV,
37 MAX8952_DVS_790mV,
38 MAX8952_DVS_800mV,
39 MAX8952_DVS_810mV,
40 MAX8952_DVS_820mV,
41 MAX8952_DVS_830mV,
42 MAX8952_DVS_840mV,
43 MAX8952_DVS_850mV,
44 MAX8952_DVS_860mV,
45 MAX8952_DVS_870mV,
46 MAX8952_DVS_880mV,
47 MAX8952_DVS_890mV,
48 MAX8952_DVS_900mV,
49 MAX8952_DVS_910mV,
50 MAX8952_DVS_920mV,
51 MAX8952_DVS_930mV,
52 MAX8952_DVS_940mV,
53 MAX8952_DVS_950mV,
54 MAX8952_DVS_960mV,
55 MAX8952_DVS_970mV,
56 MAX8952_DVS_980mV,
57 MAX8952_DVS_990mV,
58 MAX8952_DVS_1000mV,
59 MAX8952_DVS_1010mV,
60 MAX8952_DVS_1020mV,
61 MAX8952_DVS_1030mV,
62 MAX8952_DVS_1040mV,
63 MAX8952_DVS_1050mV,
64 MAX8952_DVS_1060mV,
65 MAX8952_DVS_1070mV,
66 MAX8952_DVS_1080mV,
67 MAX8952_DVS_1090mV,
68 MAX8952_DVS_1100mV,
69 MAX8952_DVS_1110mV,
70 MAX8952_DVS_1120mV,
71 MAX8952_DVS_1130mV,
72 MAX8952_DVS_1140mV,
73 MAX8952_DVS_1150mV,
74 MAX8952_DVS_1160mV,
75 MAX8952_DVS_1170mV,
76 MAX8952_DVS_1180mV,
77 MAX8952_DVS_1190mV,
78 MAX8952_DVS_1200mV,
79 MAX8952_DVS_1210mV,
80 MAX8952_DVS_1220mV,
81 MAX8952_DVS_1230mV,
82 MAX8952_DVS_1240mV,
83 MAX8952_DVS_1250mV,
84 MAX8952_DVS_1260mV,
85 MAX8952_DVS_1270mV,
86 MAX8952_DVS_1280mV,
87 MAX8952_DVS_1290mV,
88 MAX8952_DVS_1300mV,
89 MAX8952_DVS_1310mV,
90 MAX8952_DVS_1320mV,
91 MAX8952_DVS_1330mV,
92 MAX8952_DVS_1340mV,
93 MAX8952_DVS_1350mV,
94 MAX8952_DVS_1360mV,
95 MAX8952_DVS_1370mV,
96 MAX8952_DVS_1380mV,
97 MAX8952_DVS_1390mV,
98 MAX8952_DVS_1400mV,
99};
100
101enum {
102 MAX8952_SYNC_FREQ_26MHZ, /* Default */
103 MAX8952_SYNC_FREQ_13MHZ,
104 MAX8952_SYNC_FREQ_19_2MHZ,
105};
106
107enum {
108 MAX8952_RAMP_32mV_us = 0, /* Default */
109 MAX8952_RAMP_16mV_us,
110 MAX8952_RAMP_8mV_us,
111 MAX8952_RAMP_4mV_us,
112 MAX8952_RAMP_2mV_us,
113 MAX8952_RAMP_1mV_us,
114 MAX8952_RAMP_0_5mV_us,
115 MAX8952_RAMP_0_25mV_us,
116};
117
118#define MAX8952_NUM_DVS_MODE 4
119
120struct max8952_platform_data {
121 int gpio_vid0;
122 int gpio_vid1;
123 int gpio_en;
124
125 u8 default_mode;
126 u8 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */
127
128 u8 sync_freq;
129 u8 ramp_speed;
130
131 struct regulator_init_data reg_data;
132};
133
134
135#endif /* REGULATOR_MAX8952 */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 91a4177e60ce..eca75df00fed 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -22,7 +22,6 @@
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23#include <linux/bitops.h> 23#include <linux/bitops.h>
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/smp_lock.h>
26#include <linux/buffer_head.h> 25#include <linux/buffer_head.h>
27#include <linux/reiserfs_fs_i.h> 26#include <linux/reiserfs_fs_i.h>
28#include <linux/reiserfs_fs_sb.h> 27#include <linux/reiserfs_fs_sb.h>
@@ -1125,15 +1124,18 @@ struct reiserfs_de_head {
1125# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) 1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
1126# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) 1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
1127 1126
1128# define set_bit_unaligned(nr, addr) ext2_set_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1127# define set_bit_unaligned(nr, addr) \
1129# define clear_bit_unaligned(nr, addr) ext2_clear_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1128 __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1130# define test_bit_unaligned(nr, addr) ext2_test_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1129# define clear_bit_unaligned(nr, addr) \
1130 __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1131# define test_bit_unaligned(nr, addr) \
1132 test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1131 1133
1132#else 1134#else
1133 1135
1134# define set_bit_unaligned(nr, addr) ext2_set_bit(nr, addr) 1136# define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr)
1135# define clear_bit_unaligned(nr, addr) ext2_clear_bit(nr, addr) 1137# define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr)
1136# define test_bit_unaligned(nr, addr) ext2_test_bit(nr, addr) 1138# define test_bit_unaligned(nr, addr) test_bit_le(nr, addr)
1137 1139
1138#endif 1140#endif
1139 1141
@@ -1555,7 +1557,7 @@ struct tree_balance {
1555/* When inserting an item. */ 1557/* When inserting an item. */
1556#define M_INSERT 'i' 1558#define M_INSERT 'i'
1557/* When inserting into (directories only) or appending onto an already 1559/* When inserting into (directories only) or appending onto an already
1558 existant item. */ 1560 existent item. */
1559#define M_PASTE 'p' 1561#define M_PASTE 'p'
1560/* When deleting an item. */ 1562/* When deleting an item. */
1561#define M_DELETE 'd' 1563#define M_DELETE 'd'
@@ -2072,6 +2074,8 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
2072void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); 2074void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
2073int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); 2075int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
2074 2076
2077int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len);
2078
2075/* namei.c */ 2079/* namei.c */
2076void set_de_name_and_namelen(struct reiserfs_dir_entry *de); 2080void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
2077int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, 2081int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
@@ -2328,14 +2332,10 @@ __u32 keyed_hash(const signed char *msg, int len);
2328__u32 yura_hash(const signed char *msg, int len); 2332__u32 yura_hash(const signed char *msg, int len);
2329__u32 r5_hash(const signed char *msg, int len); 2333__u32 r5_hash(const signed char *msg, int len);
2330 2334
2331/* the ext2 bit routines adjust for big or little endian as 2335#define reiserfs_test_and_set_le_bit __test_and_set_bit_le
2332** appropriate for the arch, so in our laziness we use them rather 2336#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le
2333** than using the bit routines they call more directly. These 2337#define reiserfs_test_le_bit test_bit_le
2334** routines must be used when changing on disk bitmaps. */ 2338#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le
2335#define reiserfs_test_and_set_le_bit ext2_set_bit
2336#define reiserfs_test_and_clear_le_bit ext2_clear_bit
2337#define reiserfs_test_le_bit ext2_test_bit
2338#define reiserfs_find_next_zero_le_bit ext2_find_next_zero_bit
2339 2339
2340/* sometimes reiserfs_truncate may require to allocate few new blocks 2340/* sometimes reiserfs_truncate may require to allocate few new blocks
2341 to perform indirect2direct conversion. People probably used to 2341 to perform indirect2direct conversion. People probably used to
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index b2cf2089769b..6deef5dc95fb 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -41,7 +41,7 @@ int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
41int reiserfs_lookup_privroot(struct super_block *sb); 41int reiserfs_lookup_privroot(struct super_block *sb);
42int reiserfs_delete_xattrs(struct inode *inode); 42int reiserfs_delete_xattrs(struct inode *inode);
43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); 43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
44int reiserfs_permission(struct inode *inode, int mask); 44int reiserfs_permission(struct inode *inode, int mask, unsigned int flags);
45 45
46#ifdef CONFIG_REISERFS_FS_XATTR 46#ifdef CONFIG_REISERFS_FS_XATTR
47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
@@ -63,6 +63,7 @@ extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern const struct xattr_handler reiserfs_xattr_security_handler; 63extern const struct xattr_handler reiserfs_xattr_security_handler;
64#ifdef CONFIG_REISERFS_FS_SECURITY 64#ifdef CONFIG_REISERFS_FS_SECURITY
65int reiserfs_security_init(struct inode *dir, struct inode *inode, 65int reiserfs_security_init(struct inode *dir, struct inode *inode,
66 const struct qstr *qstr,
66 struct reiserfs_security_handle *sec); 67 struct reiserfs_security_handle *sec);
67int reiserfs_security_write(struct reiserfs_transaction_handle *th, 68int reiserfs_security_write(struct reiserfs_transaction_handle *th,
68 struct inode *inode, 69 struct inode *inode,
@@ -130,6 +131,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
130#ifndef CONFIG_REISERFS_FS_SECURITY 131#ifndef CONFIG_REISERFS_FS_SECURITY
131static inline int reiserfs_security_init(struct inode *dir, 132static inline int reiserfs_security_init(struct inode *dir,
132 struct inode *inode, 133 struct inode *inode,
134 const struct qstr *qstr,
133 struct reiserfs_security_handle *sec) 135 struct reiserfs_security_handle *sec)
134{ 136{
135 return 0; 137 return 0;
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index fcb9884df618..c9d625ca659e 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -129,20 +129,22 @@ int __must_check res_counter_charge(struct res_counter *counter,
129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
130void res_counter_uncharge(struct res_counter *counter, unsigned long val); 130void res_counter_uncharge(struct res_counter *counter, unsigned long val);
131 131
132static inline bool res_counter_limit_check_locked(struct res_counter *cnt) 132/**
133{ 133 * res_counter_margin - calculate chargeable space of a counter
134 if (cnt->usage < cnt->limit) 134 * @cnt: the counter
135 return true; 135 *
136 136 * Returns the difference between the hard limit and the current usage
137 return false; 137 * of resource counter @cnt.
138} 138 */
139 139static inline unsigned long long res_counter_margin(struct res_counter *cnt)
140static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
141{ 140{
142 if (cnt->usage < cnt->soft_limit) 141 unsigned long long margin;
143 return true; 142 unsigned long flags;
144 143
145 return false; 144 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage;
146 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin;
146} 148}
147 149
148/** 150/**
@@ -167,32 +169,6 @@ res_counter_soft_limit_excess(struct res_counter *cnt)
167 return excess; 169 return excess;
168} 170}
169 171
170/*
171 * Helper function to detect if the cgroup is within it's limit or
172 * not. It's currently called from cgroup_rss_prepare()
173 */
174static inline bool res_counter_check_under_limit(struct res_counter *cnt)
175{
176 bool ret;
177 unsigned long flags;
178
179 spin_lock_irqsave(&cnt->lock, flags);
180 ret = res_counter_limit_check_locked(cnt);
181 spin_unlock_irqrestore(&cnt->lock, flags);
182 return ret;
183}
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
196static inline void res_counter_reset_max(struct res_counter *cnt) 172static inline void res_counter_reset_max(struct res_counter *cnt)
197{ 173{
198 unsigned long flags; 174 unsigned long flags;
diff --git a/include/linux/resource.h b/include/linux/resource.h
index 88d36f9145ba..d01c96c1966e 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -2,6 +2,7 @@
2#define _LINUX_RESOURCE_H 2#define _LINUX_RESOURCE_H
3 3
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * Resource control/accounting header file for linux 8 * Resource control/accounting header file for linux
diff --git a/include/linux/rfkill-regulator.h b/include/linux/rfkill-regulator.h
new file mode 100644
index 000000000000..aca36bc83315
--- /dev/null
+++ b/include/linux/rfkill-regulator.h
@@ -0,0 +1,48 @@
1/*
2 * rfkill-regulator.c - Regulator consumer driver for rfkill
3 *
4 * Copyright (C) 2009 Guiming Zhuo <gmzhuo@gmail.com>
5 * Copyright (C) 2011 Antonio Ospite <ospite@studenti.unina.it>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#ifndef __LINUX_RFKILL_REGULATOR_H
14#define __LINUX_RFKILL_REGULATOR_H
15
16/*
17 * Use "vrfkill" as supply id when declaring the regulator consumer:
18 *
19 * static struct regulator_consumer_supply pcap_regulator_V6_consumers [] = {
20 * { .dev_name = "rfkill-regulator.0", .supply = "vrfkill" },
21 * };
22 *
23 * If you have several regulator driven rfkill, you can append a numerical id to
24 * .dev_name as done above, and use the same id when declaring the platform
25 * device:
26 *
27 * static struct rfkill_regulator_platform_data ezx_rfkill_bt_data = {
28 * .name = "ezx-bluetooth",
29 * .type = RFKILL_TYPE_BLUETOOTH,
30 * };
31 *
32 * static struct platform_device a910_rfkill = {
33 * .name = "rfkill-regulator",
34 * .id = 0,
35 * .dev = {
36 * .platform_data = &ezx_rfkill_bt_data,
37 * },
38 * };
39 */
40
41#include <linux/rfkill.h>
42
43struct rfkill_regulator_platform_data {
44 char *name; /* the name for the rfkill switch */
45 enum rfkill_type type; /* the type as specified in rfkill.h */
46};
47
48#endif /* __LINUX_RFKILL_REGULATOR_H */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 08c32e4f261a..c6c608482cba 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -354,37 +354,6 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
354} 354}
355#endif /* RFKILL || RFKILL_MODULE */ 355#endif /* RFKILL || RFKILL_MODULE */
356 356
357
358#ifdef CONFIG_RFKILL_LEDS
359/**
360 * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
361 * This function might return a NULL pointer if registering of the
362 * LED trigger failed. Use this as "default_trigger" for the LED.
363 */
364const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
365
366/**
367 * rfkill_set_led_trigger_name -- set the LED trigger name
368 * @rfkill: rfkill struct
369 * @name: LED trigger name
370 *
371 * This function sets the LED trigger name of the radio LED
372 * trigger that rfkill creates. It is optional, but if called
373 * must be called before rfkill_register() to be effective.
374 */
375void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
376#else
377static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
378{
379 return NULL;
380}
381
382static inline void
383rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
384{
385}
386#endif
387
388#endif /* __KERNEL__ */ 357#endif /* __KERNEL__ */
389 358
390#endif /* RFKILL_H */ 359#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 25b4f686d918..ab38ac80b0f9 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -62,18 +62,6 @@ enum ring_buffer_type {
62unsigned ring_buffer_event_length(struct ring_buffer_event *event); 62unsigned ring_buffer_event_length(struct ring_buffer_event *event);
63void *ring_buffer_event_data(struct ring_buffer_event *event); 63void *ring_buffer_event_data(struct ring_buffer_event *event);
64 64
65/**
66 * ring_buffer_event_time_delta - return the delta timestamp of the event
67 * @event: the event to get the delta timestamp of
68 *
69 * The delta timestamp is the 27 bit timestamp since the last event.
70 */
71static inline unsigned
72ring_buffer_event_time_delta(struct ring_buffer_event *event)
73{
74 return event->time_delta;
75}
76
77/* 65/*
78 * ring_buffer_discard_commit will remove an event that has not 66 * ring_buffer_discard_commit will remove an event that has not
79 * ben committed yet. If this is used, then ring_buffer_unlock_commit 67 * ben committed yet. If this is used, then ring_buffer_unlock_commit
@@ -112,6 +100,8 @@ void ring_buffer_free(struct ring_buffer *buffer);
112 100
113int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);
114 102
103void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);
104
115struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, 105struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer,
116 unsigned long length); 106 unsigned long length);
117int ring_buffer_unlock_commit(struct ring_buffer *buffer, 107int ring_buffer_unlock_commit(struct ring_buffer *buffer,
diff --git a/include/linux/rio.h b/include/linux/rio.h
index bd6eb0ed34a7..4d50611112ba 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -24,6 +24,7 @@
24#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
25#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
26 26
27#define RIO_MAX_MPORTS 8
27#define RIO_MAX_MPORT_RESOURCES 16 28#define RIO_MAX_MPORT_RESOURCES 16
28#define RIO_MAX_DEV_RESOURCES 16 29#define RIO_MAX_DEV_RESOURCES 16
29 30
@@ -66,13 +67,62 @@
66 67
67#define RIO_PW_MSG_SIZE 64 68#define RIO_PW_MSG_SIZE 64
68 69
70/*
71 * A component tag value (stored in the component tag CSR) is used as device's
72 * unique identifier assigned during enumeration. Besides being used for
73 * identifying switches (which do not have device ID register), it also is used
74 * by error management notification and therefore has to be assigned
75 * to endpoints as well.
76 */
77#define RIO_CTAG_RESRVD 0xfffe0000 /* Reserved */
78#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
79
69extern struct bus_type rio_bus_type; 80extern struct bus_type rio_bus_type;
81extern struct device rio_bus;
70extern struct list_head rio_devices; /* list of all devices */ 82extern struct list_head rio_devices; /* list of all devices */
71 83
72struct rio_mport; 84struct rio_mport;
85struct rio_dev;
73union rio_pw_msg; 86union rio_pw_msg;
74 87
75/** 88/**
89 * struct rio_switch - RIO switch info
90 * @node: Node in global list of switches
91 * @switchid: Switch ID that is unique across a network
92 * @route_table: Copy of switch routing table
93 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
94 * @add_entry: Callback for switch-specific route add function
95 * @get_entry: Callback for switch-specific route get function
96 * @clr_table: Callback for switch-specific clear route table function
97 * @set_domain: Callback for switch-specific domain setting function
98 * @get_domain: Callback for switch-specific domain get function
99 * @em_init: Callback for switch-specific error management init function
100 * @em_handle: Callback for switch-specific error management handler function
101 * @sw_sysfs: Callback that initializes switch-specific sysfs attributes
102 * @nextdev: Array of per-port pointers to the next attached device
103 */
104struct rio_switch {
105 struct list_head node;
106 u16 switchid;
107 u8 *route_table;
108 u32 port_ok;
109 int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
110 u16 table, u16 route_destid, u8 route_port);
111 int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
112 u16 table, u16 route_destid, u8 *route_port);
113 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
114 u16 table);
115 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
116 u8 sw_domain);
117 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
118 u8 *sw_domain);
119 int (*em_init) (struct rio_dev *dev);
120 int (*em_handle) (struct rio_dev *dev, u8 swport);
121 int (*sw_sysfs) (struct rio_dev *dev, int create);
122 struct rio_dev *nextdev[0];
123};
124
125/**
76 * struct rio_dev - RIO device info 126 * struct rio_dev - RIO device info
77 * @global_list: Node in list of all RIO devices 127 * @global_list: Node in list of all RIO devices
78 * @net_list: Node in list of RIO devices in a network 128 * @net_list: Node in list of RIO devices in a network
@@ -92,12 +142,14 @@ union rio_pw_msg;
92 * @phys_efptr: RIO device extended features pointer 142 * @phys_efptr: RIO device extended features pointer
93 * @em_efptr: RIO Error Management features pointer 143 * @em_efptr: RIO Error Management features pointer
94 * @dma_mask: Mask of bits of RIO address this device implements 144 * @dma_mask: Mask of bits of RIO address this device implements
95 * @rswitch: Pointer to &struct rio_switch if valid for this device
96 * @driver: Driver claiming this device 145 * @driver: Driver claiming this device
97 * @dev: Device model device 146 * @dev: Device model device
98 * @riores: RIO resources this device owns 147 * @riores: RIO resources this device owns
99 * @pwcback: port-write callback function for this device 148 * @pwcback: port-write callback function for this device
100 * @destid: Network destination ID 149 * @destid: Network destination ID (or associated destid for switch)
150 * @hopcount: Hopcount to this device
151 * @prev: Previous RIO device connected to the current one
152 * @rswitch: struct rio_switch (if valid for this device)
101 */ 153 */
102struct rio_dev { 154struct rio_dev {
103 struct list_head global_list; /* node in list of all RIO devices */ 155 struct list_head global_list; /* node in list of all RIO devices */
@@ -111,24 +163,27 @@ struct rio_dev {
111 u16 asm_rev; 163 u16 asm_rev;
112 u16 efptr; 164 u16 efptr;
113 u32 pef; 165 u32 pef;
114 u32 swpinfo; /* Only used for switches */ 166 u32 swpinfo;
115 u32 src_ops; 167 u32 src_ops;
116 u32 dst_ops; 168 u32 dst_ops;
117 u32 comp_tag; 169 u32 comp_tag;
118 u32 phys_efptr; 170 u32 phys_efptr;
119 u32 em_efptr; 171 u32 em_efptr;
120 u64 dma_mask; 172 u64 dma_mask;
121 struct rio_switch *rswitch; /* RIO switch info */
122 struct rio_driver *driver; /* RIO driver claiming this device */ 173 struct rio_driver *driver; /* RIO driver claiming this device */
123 struct device dev; /* LDM device structure */ 174 struct device dev; /* LDM device structure */
124 struct resource riores[RIO_MAX_DEV_RESOURCES]; 175 struct resource riores[RIO_MAX_DEV_RESOURCES];
125 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step); 176 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
126 u16 destid; 177 u16 destid;
178 u8 hopcount;
179 struct rio_dev *prev;
180 struct rio_switch rswitch[0]; /* RIO switch info */
127}; 181};
128 182
129#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list) 183#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
130#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) 184#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
131#define to_rio_dev(n) container_of(n, struct rio_dev, dev) 185#define to_rio_dev(n) container_of(n, struct rio_dev, dev)
186#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
132 187
133/** 188/**
134 * struct rio_msg - RIO message event 189 * struct rio_msg - RIO message event
@@ -174,6 +229,7 @@ enum rio_phy_type {
174 * @index: Port index, unique among all port interfaces of the same type 229 * @index: Port index, unique among all port interfaces of the same type
175 * @sys_size: RapidIO common transport system size 230 * @sys_size: RapidIO common transport system size
176 * @phy_type: RapidIO phy type 231 * @phy_type: RapidIO phy type
232 * @phys_efptr: RIO port extended features pointer
177 * @name: Port name string 233 * @name: Port name string
178 * @priv: Master port private data 234 * @priv: Master port private data
179 */ 235 */
@@ -186,7 +242,7 @@ struct rio_mport {
186 struct rio_msg inb_msg[RIO_MAX_MBOX]; 242 struct rio_msg inb_msg[RIO_MAX_MBOX];
187 struct rio_msg outb_msg[RIO_MAX_MBOX]; 243 struct rio_msg outb_msg[RIO_MAX_MBOX];
188 int host_deviceid; /* Host device ID */ 244 int host_deviceid; /* Host device ID */
189 struct rio_ops *ops; /* maintenance transaction functions */ 245 struct rio_ops *ops; /* low-level architecture-dependent routines */
190 unsigned char id; /* port ID, unique among all ports */ 246 unsigned char id; /* port ID, unique among all ports */
191 unsigned char index; /* port index, unique among all port 247 unsigned char index; /* port index, unique among all port
192 interfaces of the same type */ 248 interfaces of the same type */
@@ -195,6 +251,7 @@ struct rio_mport {
195 * 1 - Large size, 65536 devices. 251 * 1 - Large size, 65536 devices.
196 */ 252 */
197 enum rio_phy_type phy_type; /* RapidIO phy type */ 253 enum rio_phy_type phy_type; /* RapidIO phy type */
254 u32 phys_efptr;
198 unsigned char name[40]; 255 unsigned char name[40];
199 void *priv; /* Master port private data */ 256 void *priv; /* Master port private data */
200}; 257};
@@ -215,42 +272,9 @@ struct rio_net {
215 unsigned char id; /* RIO network ID */ 272 unsigned char id; /* RIO network ID */
216}; 273};
217 274
218/** 275/* Definitions used by switch sysfs initialization callback */
219 * struct rio_switch - RIO switch info 276#define RIO_SW_SYSFS_CREATE 1 /* Create switch attributes */
220 * @node: Node in global list of switches 277#define RIO_SW_SYSFS_REMOVE 0 /* Remove switch attributes */
221 * @switchid: Switch ID that is unique across a network
222 * @hopcount: Hopcount to this switch
223 * @destid: Associated destid in the path
224 * @route_table: Copy of switch routing table
225 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
226 * @add_entry: Callback for switch-specific route add function
227 * @get_entry: Callback for switch-specific route get function
228 * @clr_table: Callback for switch-specific clear route table function
229 * @set_domain: Callback for switch-specific domain setting function
230 * @get_domain: Callback for switch-specific domain get function
231 * @em_init: Callback for switch-specific error management initialization function
232 * @em_handle: Callback for switch-specific error management handler function
233 */
234struct rio_switch {
235 struct list_head node;
236 u16 switchid;
237 u16 hopcount;
238 u16 destid;
239 u8 *route_table;
240 u32 port_ok;
241 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
242 u16 table, u16 route_destid, u8 route_port);
243 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
244 u16 table, u16 route_destid, u8 * route_port);
245 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
246 u16 table);
247 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
248 u8 sw_domain);
249 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
250 u8 *sw_domain);
251 int (*em_init) (struct rio_dev *dev);
252 int (*em_handle) (struct rio_dev *dev, u8 swport);
253};
254 278
255/* Low-level architecture-dependent routines */ 279/* Low-level architecture-dependent routines */
256 280
@@ -262,6 +286,13 @@ struct rio_switch {
262 * @cwrite: Callback to perform network write of config space. 286 * @cwrite: Callback to perform network write of config space.
263 * @dsend: Callback to send a doorbell message. 287 * @dsend: Callback to send a doorbell message.
264 * @pwenable: Callback to enable/disable port-write message handling. 288 * @pwenable: Callback to enable/disable port-write message handling.
289 * @open_outb_mbox: Callback to initialize outbound mailbox.
290 * @close_outb_mbox: Callback to shut down outbound mailbox.
291 * @open_inb_mbox: Callback to initialize inbound mailbox.
292 * @close_inb_mbox: Callback to shut down inbound mailbox.
293 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
294 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
295 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
265 */ 296 */
266struct rio_ops { 297struct rio_ops {
267 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 298 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -274,6 +305,16 @@ struct rio_ops {
274 u8 hopcount, u32 offset, int len, u32 data); 305 u8 hopcount, u32 offset, int len, u32 data);
275 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 306 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
276 int (*pwenable) (struct rio_mport *mport, int enable); 307 int (*pwenable) (struct rio_mport *mport, int enable);
308 int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
309 int mbox, int entries);
310 void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
311 int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
312 int mbox, int entries);
313 void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
314 int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
315 int mbox, void *buffer, size_t len);
316 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
317 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
277}; 318};
278 319
279#define RIO_RESOURCE_MEM 0x00000100 320#define RIO_RESOURCE_MEM 0x00000100
@@ -355,12 +396,7 @@ union rio_pw_msg {
355}; 396};
356 397
357/* Architecture and hardware-specific functions */ 398/* Architecture and hardware-specific functions */
358extern int rio_init_mports(void); 399extern int rio_register_mport(struct rio_mport *);
359extern void rio_register_mport(struct rio_mport *);
360extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int,
361 void *, size_t);
362extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *);
363extern void *rio_hw_get_inb_message(struct rio_mport *, int);
364extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 400extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
365extern void rio_close_inb_mbox(struct rio_mport *, int); 401extern void rio_close_inb_mbox(struct rio_mport *, int);
366extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 402extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index edc55da717b3..229b3ca23134 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -150,16 +150,8 @@ static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset,
150static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset, 150static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset,
151 u32 * data) 151 u32 * data)
152{ 152{
153 u8 hopcount = 0xff; 153 return rio_mport_read_config_32(rdev->net->hport, rdev->destid,
154 u16 destid = rdev->destid; 154 rdev->hopcount, offset, data);
155
156 if (rdev->rswitch) {
157 destid = rdev->rswitch->destid;
158 hopcount = rdev->rswitch->hopcount;
159 }
160
161 return rio_mport_read_config_32(rdev->net->hport, destid, hopcount,
162 offset, data);
163}; 155};
164 156
165/** 157/**
@@ -174,16 +166,8 @@ static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset,
174static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset, 166static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset,
175 u32 data) 167 u32 data)
176{ 168{
177 u8 hopcount = 0xff; 169 return rio_mport_write_config_32(rdev->net->hport, rdev->destid,
178 u16 destid = rdev->destid; 170 rdev->hopcount, offset, data);
179
180 if (rdev->rswitch) {
181 destid = rdev->rswitch->destid;
182 hopcount = rdev->rswitch->hopcount;
183 }
184
185 return rio_mport_write_config_32(rdev->net->hport, destid, hopcount,
186 offset, data);
187}; 171};
188 172
189/** 173/**
@@ -198,16 +182,8 @@ static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset,
198static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset, 182static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset,
199 u16 * data) 183 u16 * data)
200{ 184{
201 u8 hopcount = 0xff; 185 return rio_mport_read_config_16(rdev->net->hport, rdev->destid,
202 u16 destid = rdev->destid; 186 rdev->hopcount, offset, data);
203
204 if (rdev->rswitch) {
205 destid = rdev->rswitch->destid;
206 hopcount = rdev->rswitch->hopcount;
207 }
208
209 return rio_mport_read_config_16(rdev->net->hport, destid, hopcount,
210 offset, data);
211}; 187};
212 188
213/** 189/**
@@ -222,16 +198,8 @@ static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset,
222static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset, 198static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset,
223 u16 data) 199 u16 data)
224{ 200{
225 u8 hopcount = 0xff; 201 return rio_mport_write_config_16(rdev->net->hport, rdev->destid,
226 u16 destid = rdev->destid; 202 rdev->hopcount, offset, data);
227
228 if (rdev->rswitch) {
229 destid = rdev->rswitch->destid;
230 hopcount = rdev->rswitch->hopcount;
231 }
232
233 return rio_mport_write_config_16(rdev->net->hport, destid, hopcount,
234 offset, data);
235}; 203};
236 204
237/** 205/**
@@ -245,16 +213,8 @@ static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset,
245 */ 213 */
246static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data) 214static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data)
247{ 215{
248 u8 hopcount = 0xff; 216 return rio_mport_read_config_8(rdev->net->hport, rdev->destid,
249 u16 destid = rdev->destid; 217 rdev->hopcount, offset, data);
250
251 if (rdev->rswitch) {
252 destid = rdev->rswitch->destid;
253 hopcount = rdev->rswitch->hopcount;
254 }
255
256 return rio_mport_read_config_8(rdev->net->hport, destid, hopcount,
257 offset, data);
258}; 218};
259 219
260/** 220/**
@@ -268,16 +228,8 @@ static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data)
268 */ 228 */
269static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data) 229static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data)
270{ 230{
271 u8 hopcount = 0xff; 231 return rio_mport_write_config_8(rdev->net->hport, rdev->destid,
272 u16 destid = rdev->destid; 232 rdev->hopcount, offset, data);
273
274 if (rdev->rswitch) {
275 destid = rdev->rswitch->destid;
276 hopcount = rdev->rswitch->hopcount;
277 }
278
279 return rio_mport_write_config_8(rdev->net->hport, destid, hopcount,
280 offset, data);
281}; 233};
282 234
283extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, 235extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid,
@@ -365,7 +317,8 @@ static inline int rio_add_outb_message(struct rio_mport *mport,
365 struct rio_dev *rdev, int mbox, 317 struct rio_dev *rdev, int mbox,
366 void *buffer, size_t len) 318 void *buffer, size_t len)
367{ 319{
368 return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len); 320 return mport->ops->add_outb_message(mport, rdev, mbox,
321 buffer, len);
369} 322}
370 323
371extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int, 324extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int,
@@ -384,7 +337,7 @@ extern int rio_release_inb_mbox(struct rio_mport *, int);
384static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox, 337static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
385 void *buffer) 338 void *buffer)
386{ 339{
387 return rio_hw_add_inb_buffer(mport, mbox, buffer); 340 return mport->ops->add_inb_buffer(mport, mbox, buffer);
388} 341}
389 342
390/** 343/**
@@ -396,7 +349,7 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
396 */ 349 */
397static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox) 350static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox)
398{ 351{
399 return rio_hw_get_inb_message(mport, mbox); 352 return mport->ops->get_inb_message(mport, mbox);
400} 353}
401 354
402/* Doorbell management */ 355/* Doorbell management */
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index db50e1c288b7..0cee0152aca9 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -34,5 +34,10 @@
34#define RIO_DID_IDTCPS16 0x035b 34#define RIO_DID_IDTCPS16 0x035b
35#define RIO_DID_IDTCPS6Q 0x035f 35#define RIO_DID_IDTCPS6Q 0x035f
36#define RIO_DID_IDTCPS10Q 0x035e 36#define RIO_DID_IDTCPS10Q 0x035e
37#define RIO_DID_IDTCPS1848 0x0374
38#define RIO_DID_IDTCPS1432 0x0375
39#define RIO_DID_IDTCPS1616 0x0379
40#define RIO_DID_IDTVPS1616 0x0377
41#define RIO_DID_IDTSPS1616 0x0378
37 42
38#endif /* LINUX_RIO_IDS_H */ 43#endif /* LINUX_RIO_IDS_H */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index aedee0489fb4..9026b30238f3 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -14,10 +14,12 @@
14#define LINUX_RIO_REGS_H 14#define LINUX_RIO_REGS_H
15 15
16/* 16/*
17 * In RapidIO, each device has a 2MB configuration space that is 17 * In RapidIO, each device has a 16MB configuration space that is
18 * accessed via maintenance transactions. Portions of configuration 18 * accessed via maintenance transactions. Portions of configuration
19 * space are standardized and/or reserved. 19 * space are standardized and/or reserved.
20 */ 20 */
21#define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */
22
21#define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ 23#define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */
22#define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ 24#define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */
23#define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ 25#define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */
@@ -33,6 +35,7 @@
33#define RIO_PEF_MEMORY 0x40000000 /* [I] MMIO */ 35#define RIO_PEF_MEMORY 0x40000000 /* [I] MMIO */
34#define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ 36#define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */
35#define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ 37#define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */
38#define RIO_PEF_MULTIPORT 0x08000000 /* [VI, 2.1] Multiport */
36#define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */ 39#define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */
37#define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */ 40#define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */
38#define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */ 41#define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */
@@ -51,6 +54,7 @@
51#define RIO_SWP_INFO_PORT_TOTAL_MASK 0x0000ff00 /* [I] Total number of ports */ 54#define RIO_SWP_INFO_PORT_TOTAL_MASK 0x0000ff00 /* [I] Total number of ports */
52#define RIO_SWP_INFO_PORT_NUM_MASK 0x000000ff /* [I] Maintenance transaction port number */ 55#define RIO_SWP_INFO_PORT_NUM_MASK 0x000000ff /* [I] Maintenance transaction port number */
53#define RIO_GET_TOTAL_PORTS(x) ((x & RIO_SWP_INFO_PORT_TOTAL_MASK) >> 8) 56#define RIO_GET_TOTAL_PORTS(x) ((x & RIO_SWP_INFO_PORT_TOTAL_MASK) >> 8)
57#define RIO_GET_PORT_NUM(x) (x & RIO_SWP_INFO_PORT_NUM_MASK)
54 58
55#define RIO_SRC_OPS_CAR 0x18 /* [I] Source Operations CAR */ 59#define RIO_SRC_OPS_CAR 0x18 /* [I] Source Operations CAR */
56#define RIO_SRC_OPS_READ 0x00008000 /* [I] Read op */ 60#define RIO_SRC_OPS_READ 0x00008000 /* [I] Read op */
@@ -159,6 +163,7 @@
159#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */ 163#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */
160 164
161#define RIO_STD_RTE_CONF_DESTID_SEL_CSR 0x70 165#define RIO_STD_RTE_CONF_DESTID_SEL_CSR 0x70
166#define RIO_STD_RTE_CONF_EXTCFGEN 0x80000000
162#define RIO_STD_RTE_CONF_PORT_SEL_CSR 0x74 167#define RIO_STD_RTE_CONF_PORT_SEL_CSR 0x74
163#define RIO_STD_RTE_DEFAULT_PORT 0x78 168#define RIO_STD_RTE_DEFAULT_PORT 0x78
164 169
@@ -222,15 +227,17 @@
222#define RIO_PORT_GEN_MASTER 0x40000000 227#define RIO_PORT_GEN_MASTER 0x40000000
223#define RIO_PORT_GEN_DISCOVERED 0x20000000 228#define RIO_PORT_GEN_DISCOVERED 0x20000000
224#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ 229#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */
230#define RIO_MNT_REQ_CMD_RD 0x03 /* Reset-device command */
231#define RIO_MNT_REQ_CMD_IS 0x04 /* Input-status command */
225#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ 232#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */
226#define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */ 233#define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */
227#define RIO_PORT_N_MNT_RSP_ASTAT 0x000003e0 /* ackID Status */ 234#define RIO_PORT_N_MNT_RSP_ASTAT 0x000007e0 /* ackID Status */
228#define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */ 235#define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */
229#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ 236#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */
230#define RIO_PORT_N_ACK_CLEAR 0x80000000 237#define RIO_PORT_N_ACK_CLEAR 0x80000000
231#define RIO_PORT_N_ACK_INBOUND 0x1f000000 238#define RIO_PORT_N_ACK_INBOUND 0x3f000000
232#define RIO_PORT_N_ACK_OUTSTAND 0x00001f00 239#define RIO_PORT_N_ACK_OUTSTAND 0x00003f00
233#define RIO_PORT_N_ACK_OUTBOUND 0x0000001f 240#define RIO_PORT_N_ACK_OUTBOUND 0x0000003f
234#define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20) 241#define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20)
235#define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */ 242#define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */
236#define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */ 243#define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */
@@ -238,7 +245,6 @@
238#define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004 245#define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004
239#define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002 246#define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002
240#define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001 247#define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001
241#define RIO_PORT_N_ERR_STS_CLR_MASK 0x07120204
242#define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20) 248#define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20)
243#define RIO_PORT_N_CTL_PWIDTH 0xc0000000 249#define RIO_PORT_N_CTL_PWIDTH 0xc0000000
244#define RIO_PORT_N_CTL_PWIDTH_1 0x00000000 250#define RIO_PORT_N_CTL_PWIDTH_1 0x00000000
@@ -261,6 +267,10 @@
261#define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */ 267#define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */
262#define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */ 268#define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */
263#define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */ 269#define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */
270#define REM_LTL_ERR_ILLTRAN 0x08000000 /* Illegal Transaction decode */
271#define REM_LTL_ERR_UNSOLR 0x00800000 /* Unsolicited Response */
272#define REM_LTL_ERR_UNSUPTR 0x00400000 /* Unsupported Transaction */
273#define REM_LTL_ERR_IMPSPEC 0x000000ff /* Implementation Specific */
264#define RIO_EM_LTL_HIADDR_CAP 0x010 /* Logical/Transport Layer High Address Capture CSR */ 274#define RIO_EM_LTL_HIADDR_CAP 0x010 /* Logical/Transport Layer High Address Capture CSR */
265#define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */ 275#define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */
266#define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */ 276#define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 31b2fd75dcba..830e65dc01ee 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -25,20 +25,17 @@
25 * pointing to this anon_vma once its vma list is empty. 25 * pointing to this anon_vma once its vma list is empty.
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */
29 struct anon_vma *root; /* Root of this anon_vma tree */ 28 struct anon_vma *root; /* Root of this anon_vma tree */
30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) 29 spinlock_t lock; /* Serialize access to vma list */
31
32 /* 30 /*
33 * The external_refcount is taken by either KSM or page migration 31 * The refcount is taken on an anon_vma when there is no
34 * to take a reference to an anon_vma when there is no
35 * guarantee that the vma of page tables will exist for 32 * guarantee that the vma of page tables will exist for
36 * the duration of the operation. A caller that takes 33 * the duration of the operation. A caller that takes
37 * the reference is responsible for clearing up the 34 * the reference is responsible for clearing up the
38 * anon_vma if they are the last user on release 35 * anon_vma if they are the last user on release
39 */ 36 */
40 atomic_t external_refcount; 37 atomic_t refcount;
41#endif 38
42 /* 39 /*
43 * NOTE: the LSB of the head.next is set by 40 * NOTE: the LSB of the head.next is set by
44 * mm_take_all_locks() _after_ taking the above lock. So the 41 * mm_take_all_locks() _after_ taking the above lock. So the
@@ -71,41 +68,18 @@ struct anon_vma_chain {
71}; 68};
72 69
73#ifdef CONFIG_MMU 70#ifdef CONFIG_MMU
74#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
75static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
76{
77 atomic_set(&anon_vma->external_refcount, 0);
78}
79
80static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
81{
82 return atomic_read(&anon_vma->external_refcount);
83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma) 71static inline void get_anon_vma(struct anon_vma *anon_vma)
86{ 72{
87 atomic_inc(&anon_vma->external_refcount); 73 atomic_inc(&anon_vma->refcount);
88}
89
90void drop_anon_vma(struct anon_vma *);
91#else
92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
93{
94}
95
96static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
97{
98 return 0;
99} 74}
100 75
101static inline void get_anon_vma(struct anon_vma *anon_vma) 76void __put_anon_vma(struct anon_vma *anon_vma);
102{
103}
104 77
105static inline void drop_anon_vma(struct anon_vma *anon_vma) 78static inline void put_anon_vma(struct anon_vma *anon_vma)
106{ 79{
80 if (atomic_dec_and_test(&anon_vma->refcount))
81 __put_anon_vma(anon_vma);
107} 82}
108#endif /* CONFIG_KSM */
109 83
110static inline struct anon_vma *page_anon_vma(struct page *page) 84static inline struct anon_vma *page_anon_vma(struct page *page)
111{ 85{
@@ -148,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *);
148int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
149int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150void __anon_vma_link(struct vm_area_struct *); 124void __anon_vma_link(struct vm_area_struct *);
151void anon_vma_free(struct anon_vma *);
152 125
153static inline void anon_vma_merge(struct vm_area_struct *vma, 126static inline void anon_vma_merge(struct vm_area_struct *vma,
154 struct vm_area_struct *next) 127 struct vm_area_struct *next)
@@ -157,6 +130,8 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
157 unlink_anon_vmas(next); 130 unlink_anon_vmas(next);
158} 131}
159 132
133struct anon_vma *page_get_anon_vma(struct page *page);
134
160/* 135/*
161 * rmap interfaces called when adding or removing pte of page 136 * rmap interfaces called when adding or removing pte of page
162 */ 137 */
@@ -198,6 +173,8 @@ enum ttu_flags {
198}; 173};
199#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 174#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
200 175
176bool is_vma_temporary_stack(struct vm_area_struct *vma);
177
201int try_to_unmap(struct page *, enum ttu_flags flags); 178int try_to_unmap(struct page *, enum ttu_flags flags);
202int try_to_unmap_one(struct page *, struct vm_area_struct *, 179int try_to_unmap_one(struct page *, struct vm_area_struct *,
203 unsigned long address, enum ttu_flags flags); 180 unsigned long address, enum ttu_flags flags);
@@ -205,9 +182,20 @@ int try_to_unmap_one(struct page *, struct vm_area_struct *,
205/* 182/*
206 * Called from mm/filemap_xip.c to unmap empty zero page 183 * Called from mm/filemap_xip.c to unmap empty zero page
207 */ 184 */
208pte_t *page_check_address(struct page *, struct mm_struct *, 185pte_t *__page_check_address(struct page *, struct mm_struct *,
209 unsigned long, spinlock_t **, int); 186 unsigned long, spinlock_t **, int);
210 187
188static inline pte_t *page_check_address(struct page *page, struct mm_struct *mm,
189 unsigned long address,
190 spinlock_t **ptlp, int sync)
191{
192 pte_t *ptep;
193
194 __cond_lock(*ptlp, ptep = __page_check_address(page, mm, address,
195 ptlp, sync));
196 return ptep;
197}
198
211/* 199/*
212 * Used by swapoff to help locate where page is expected in vma. 200 * Used by swapoff to help locate where page is expected in vma.
213 */ 201 */
@@ -230,7 +218,20 @@ int try_to_munlock(struct page *);
230/* 218/*
231 * Called by memory-failure.c to kill processes. 219 * Called by memory-failure.c to kill processes.
232 */ 220 */
233struct anon_vma *page_lock_anon_vma(struct page *page); 221struct anon_vma *__page_lock_anon_vma(struct page *page);
222
223static inline struct anon_vma *page_lock_anon_vma(struct page *page)
224{
225 struct anon_vma *anon_vma;
226
227 __cond_lock(RCU, anon_vma = __page_lock_anon_vma(page));
228
229 /* (void) is needed to make gcc happy */
230 (void) __cond_lock(&anon_vma->root->lock, anon_vma);
231
232 return anon_vma;
233}
234
234void page_unlock_anon_vma(struct anon_vma *anon_vma); 235void page_unlock_anon_vma(struct anon_vma *anon_vma);
235int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); 236int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
236 237
diff --git a/include/linux/romfs_fs.h b/include/linux/romfs_fs.h
index c490fbc43fe2..5f57f93b284f 100644
--- a/include/linux/romfs_fs.h
+++ b/include/linux/romfs_fs.h
@@ -1,6 +1,9 @@
1#ifndef __LINUX_ROMFS_FS_H 1#ifndef __LINUX_ROMFS_FS_H
2#define __LINUX_ROMFS_FS_H 2#define __LINUX_ROMFS_FS_H
3 3
4#include <linux/types.h>
5#include <linux/fs.h>
6
4/* The basic structures of the romfs filesystem */ 7/* The basic structures of the romfs filesystem */
5 8
6#define ROMBSIZE BLOCK_SIZE 9#define ROMBSIZE BLOCK_SIZE
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 14dbc83ded20..877ece45426f 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -107,12 +107,17 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
107extern int rtc_valid_tm(struct rtc_time *tm); 107extern int rtc_valid_tm(struct rtc_time *tm);
108extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); 108extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
109extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); 109extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
110ktime_t rtc_tm_to_ktime(struct rtc_time tm);
111struct rtc_time rtc_ktime_to_tm(ktime_t kt);
112
110 113
111#include <linux/device.h> 114#include <linux/device.h>
112#include <linux/seq_file.h> 115#include <linux/seq_file.h>
113#include <linux/cdev.h> 116#include <linux/cdev.h>
114#include <linux/poll.h> 117#include <linux/poll.h>
115#include <linux/mutex.h> 118#include <linux/mutex.h>
119#include <linux/timerqueue.h>
120#include <linux/workqueue.h>
116 121
117extern struct class *rtc_class; 122extern struct class *rtc_class;
118 123
@@ -128,7 +133,6 @@ extern struct class *rtc_class;
128 * The (current) exceptions are mostly filesystem hooks: 133 * The (current) exceptions are mostly filesystem hooks:
129 * - the proc() hook for procfs 134 * - the proc() hook for procfs
130 * - non-ioctl() chardev hooks: open(), release(), read_callback() 135 * - non-ioctl() chardev hooks: open(), release(), read_callback()
131 * - periodic irq calls: irq_set_state(), irq_set_freq()
132 * 136 *
133 * REVISIT those periodic irq calls *do* have ops_lock when they're 137 * REVISIT those periodic irq calls *do* have ops_lock when they're
134 * issued through ioctl() ... 138 * issued through ioctl() ...
@@ -143,15 +147,24 @@ struct rtc_class_ops {
143 int (*set_alarm)(struct device *, struct rtc_wkalrm *); 147 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
144 int (*proc)(struct device *, struct seq_file *); 148 int (*proc)(struct device *, struct seq_file *);
145 int (*set_mmss)(struct device *, unsigned long secs); 149 int (*set_mmss)(struct device *, unsigned long secs);
146 int (*irq_set_state)(struct device *, int enabled);
147 int (*irq_set_freq)(struct device *, int freq);
148 int (*read_callback)(struct device *, int data); 150 int (*read_callback)(struct device *, int data);
149 int (*alarm_irq_enable)(struct device *, unsigned int enabled); 151 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
150 int (*update_irq_enable)(struct device *, unsigned int enabled);
151}; 152};
152 153
153#define RTC_DEVICE_NAME_SIZE 20 154#define RTC_DEVICE_NAME_SIZE 20
154struct rtc_task; 155typedef struct rtc_task {
156 void (*func)(void *private_data);
157 void *private_data;
158} rtc_task_t;
159
160
161struct rtc_timer {
162 struct rtc_task task;
163 struct timerqueue_node node;
164 ktime_t period;
165 int enabled;
166};
167
155 168
156/* flags */ 169/* flags */
157#define RTC_DEV_BUSY 0 170#define RTC_DEV_BUSY 0
@@ -179,6 +192,15 @@ struct rtc_device
179 spinlock_t irq_task_lock; 192 spinlock_t irq_task_lock;
180 int irq_freq; 193 int irq_freq;
181 int max_user_freq; 194 int max_user_freq;
195
196 struct timerqueue_head timerqueue;
197 struct rtc_timer aie_timer;
198 struct rtc_timer uie_rtctimer;
199 struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */
200 int pie_enabled;
201 struct work_struct irqwork;
202
203
182#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 204#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
183 struct work_struct uie_task; 205 struct work_struct uie_task;
184 struct timer_list uie_timer; 206 struct timer_list uie_timer;
@@ -201,10 +223,13 @@ extern void rtc_device_unregister(struct rtc_device *rtc);
201extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 223extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
202extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 224extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
203extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); 225extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
226int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
204extern int rtc_read_alarm(struct rtc_device *rtc, 227extern int rtc_read_alarm(struct rtc_device *rtc,
205 struct rtc_wkalrm *alrm); 228 struct rtc_wkalrm *alrm);
206extern int rtc_set_alarm(struct rtc_device *rtc, 229extern int rtc_set_alarm(struct rtc_device *rtc,
207 struct rtc_wkalrm *alrm); 230 struct rtc_wkalrm *alrm);
231extern int rtc_initialize_alarm(struct rtc_device *rtc,
232 struct rtc_wkalrm *alrm);
208extern void rtc_update_irq(struct rtc_device *rtc, 233extern void rtc_update_irq(struct rtc_device *rtc,
209 unsigned long num, unsigned long events); 234 unsigned long num, unsigned long events);
210 235
@@ -224,15 +249,21 @@ extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
224extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, 249extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
225 unsigned int enabled); 250 unsigned int enabled);
226 251
227typedef struct rtc_task { 252void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode);
228 void (*func)(void *private_data); 253void rtc_aie_update_irq(void *private);
229 void *private_data; 254void rtc_uie_update_irq(void *private);
230} rtc_task_t; 255enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer);
231 256
232int rtc_register(rtc_task_t *task); 257int rtc_register(rtc_task_t *task);
233int rtc_unregister(rtc_task_t *task); 258int rtc_unregister(rtc_task_t *task);
234int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 259int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
235 260
261void rtc_timer_init(struct rtc_timer *timer, void (*f)(void* p), void* data);
262int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer,
263 ktime_t expires, ktime_t period);
264int rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer* timer);
265void rtc_timer_do_work(struct work_struct *work);
266
236static inline bool is_leap_year(unsigned int year) 267static inline bool is_leap_year(unsigned int year)
237{ 268{
238 return (!(year % 4) && (year % 100)) || !(year % 400); 269 return (!(year % 4) && (year % 100)) || !(year % 400);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d42f274418b8..bbad657a3725 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -6,7 +6,6 @@
6#include <linux/if_link.h> 6#include <linux/if_link.h>
7#include <linux/if_addr.h> 7#include <linux/if_addr.h>
8#include <linux/neighbour.h> 8#include <linux/neighbour.h>
9#include <linux/netdevice.h>
10 9
11/* rtnetlink families. Values up to 127 are reserved for real address 10/* rtnetlink families. Values up to 127 are reserved for real address
12 * families, values above 128 may be used arbitrarily. 11 * families, values above 128 may be used arbitrarily.
@@ -606,6 +605,7 @@ struct tcamsg {
606#ifdef __KERNEL__ 605#ifdef __KERNEL__
607 606
608#include <linux/mutex.h> 607#include <linux/mutex.h>
608#include <linux/netdevice.h>
609 609
610static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) 610static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
611{ 611{
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h
index bd31808c7d8e..cc0072e93e36 100644
--- a/include/linux/rwlock_types.h
+++ b/include/linux/rwlock_types.h
@@ -43,14 +43,6 @@ typedef struct {
43 RW_DEP_MAP_INIT(lockname) } 43 RW_DEP_MAP_INIT(lockname) }
44#endif 44#endif
45 45
46/*
47 * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence
48 * deprecated.
49 *
50 * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate.
51 */
52#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
53
54#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) 46#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
55 47
56#endif /* __LINUX_RWLOCK_TYPES_H */ 48#endif /* __LINUX_RWLOCK_TYPES_H */
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index bdfcc2527970..34701241b673 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -12,15 +12,7 @@
12#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" 12#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead"
13#endif 13#endif
14 14
15#include <linux/spinlock.h>
16#include <linux/list.h>
17
18#ifdef __KERNEL__ 15#ifdef __KERNEL__
19
20#include <linux/types.h>
21
22struct rwsem_waiter;
23
24/* 16/*
25 * the rw-semaphore definition 17 * the rw-semaphore definition
26 * - if activity is 0 then there are no active readers or writers 18 * - if activity is 0 then there are no active readers or writers
@@ -37,28 +29,7 @@ struct rw_semaphore {
37#endif 29#endif
38}; 30};
39 31
40#ifdef CONFIG_DEBUG_LOCK_ALLOC 32#define RWSEM_UNLOCKED_VALUE 0x00000000
41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42#else
43# define __RWSEM_DEP_MAP_INIT(lockname)
44#endif
45
46#define __RWSEM_INITIALIZER(name) \
47{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \
48 __RWSEM_DEP_MAP_INIT(name) }
49
50#define DECLARE_RWSEM(name) \
51 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
52
53extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
54 struct lock_class_key *key);
55
56#define init_rwsem(sem) \
57do { \
58 static struct lock_class_key __key; \
59 \
60 __init_rwsem((sem), #sem, &__key); \
61} while (0)
62 33
63extern void __down_read(struct rw_semaphore *sem); 34extern void __down_read(struct rw_semaphore *sem);
64extern int __down_read_trylock(struct rw_semaphore *sem); 35extern int __down_read_trylock(struct rw_semaphore *sem);
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index efd348fe8ca7..a8afe9cd000c 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -11,6 +11,9 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/list.h>
15#include <linux/spinlock.h>
16
14#include <asm/system.h> 17#include <asm/system.h>
15#include <asm/atomic.h> 18#include <asm/atomic.h>
16 19
@@ -19,9 +22,57 @@ struct rw_semaphore;
19#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
20#include <linux/rwsem-spinlock.h> /* use a generic implementation */ 23#include <linux/rwsem-spinlock.h> /* use a generic implementation */
21#else 24#else
22#include <asm/rwsem.h> /* use an arch-specific implementation */ 25/* All arch specific implementations share the same struct */
26struct rw_semaphore {
27 long count;
28 spinlock_t wait_lock;
29 struct list_head wait_list;
30#ifdef CONFIG_DEBUG_LOCK_ALLOC
31 struct lockdep_map dep_map;
32#endif
33};
34
35extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
36extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
37extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
38extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
39
40/* Include the arch specific part */
41#include <asm/rwsem.h>
42
43/* In all implementations count != 0 means locked */
44static inline int rwsem_is_locked(struct rw_semaphore *sem)
45{
46 return sem->count != 0;
47}
48
49#endif
50
51/* Common initializer macros and functions */
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
55#else
56# define __RWSEM_DEP_MAP_INIT(lockname)
23#endif 57#endif
24 58
59#define __RWSEM_INITIALIZER(name) \
60 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock), \
61 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
62
63#define DECLARE_RWSEM(name) \
64 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
65
66extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
67 struct lock_class_key *key);
68
69#define init_rwsem(sem) \
70do { \
71 static struct lock_class_key __key; \
72 \
73 __init_rwsem((sem), #sem, &__key); \
74} while (0)
75
25/* 76/*
26 * lock for reading 77 * lock for reading
27 */ 78 */
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
index dbce22faa660..fbe58b7e63eb 100644
--- a/include/linux/s3c_adc_battery.h
+++ b/include/linux/s3c_adc_battery.h
@@ -14,6 +14,7 @@ struct s3c_adc_bat_pdata {
14 void (*disable_charger)(void); 14 void (*disable_charger)(void);
15 15
16 int gpio_charge_finished; 16 int gpio_charge_finished;
17 int gpio_inverted;
17 18
18 const struct s3c_adc_bat_thresh *lut_noac; 19 const struct s3c_adc_bat_thresh *lut_noac;
19 unsigned int lut_noac_cnt; 20 unsigned int lut_noac_cnt;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 56154bbb8da9..885c4f242ad7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -21,7 +21,8 @@
21#define CLONE_DETACHED 0x00400000 /* Unused, ignored */ 21#define CLONE_DETACHED 0x00400000 /* Unused, ignored */
22#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ 22#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ 23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
24#define CLONE_STOPPED 0x02000000 /* Start in stopped state */ 24/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state)
25 and is now available for re-use. */
25#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ 26#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
26#define CLONE_NEWIPC 0x08000000 /* New ipcs */ 27#define CLONE_NEWIPC 0x08000000 /* New ipcs */
27#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 28#define CLONE_NEWUSER 0x10000000 /* New user namespace */
@@ -70,7 +71,6 @@ struct sched_param {
70#include <linux/smp.h> 71#include <linux/smp.h>
71#include <linux/sem.h> 72#include <linux/sem.h>
72#include <linux/signal.h> 73#include <linux/signal.h>
73#include <linux/path.h>
74#include <linux/compiler.h> 74#include <linux/compiler.h>
75#include <linux/completion.h> 75#include <linux/completion.h>
76#include <linux/pid.h> 76#include <linux/pid.h>
@@ -88,7 +88,6 @@ struct sched_param {
88#include <linux/timer.h> 88#include <linux/timer.h>
89#include <linux/hrtimer.h> 89#include <linux/hrtimer.h>
90#include <linux/task_io_accounting.h> 90#include <linux/task_io_accounting.h>
91#include <linux/kobject.h>
92#include <linux/latencytop.h> 91#include <linux/latencytop.h>
93#include <linux/cred.h> 92#include <linux/cred.h>
94 93
@@ -100,6 +99,7 @@ struct robust_list_head;
100struct bio_list; 99struct bio_list;
101struct fs_struct; 100struct fs_struct;
102struct perf_event_context; 101struct perf_event_context;
102struct blk_plug;
103 103
104/* 104/*
105 * List of flags we want to share for kernel threads, 105 * List of flags we want to share for kernel threads,
@@ -143,7 +143,7 @@ extern unsigned long nr_iowait_cpu(int cpu);
143extern unsigned long this_cpu_load(void); 143extern unsigned long this_cpu_load(void);
144 144
145 145
146extern void calc_global_load(void); 146extern void calc_global_load(unsigned long ticks);
147 147
148extern unsigned long get_parent_ip(unsigned long addr); 148extern unsigned long get_parent_ip(unsigned long addr);
149 149
@@ -316,6 +316,7 @@ extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
316 size_t *lenp, loff_t *ppos); 316 size_t *lenp, loff_t *ppos);
317extern unsigned int softlockup_panic; 317extern unsigned int softlockup_panic;
318extern int softlockup_thresh; 318extern int softlockup_thresh;
319void lockup_detector_init(void);
319#else 320#else
320static inline void touch_softlockup_watchdog(void) 321static inline void touch_softlockup_watchdog(void)
321{ 322{
@@ -326,6 +327,9 @@ static inline void touch_softlockup_watchdog_sync(void)
326static inline void touch_all_softlockup_watchdogs(void) 327static inline void touch_all_softlockup_watchdogs(void)
327{ 328{
328} 329}
330static inline void lockup_detector_init(void)
331{
332}
329#endif 333#endif
330 334
331#ifdef CONFIG_DETECT_HUNG_TASK 335#ifdef CONFIG_DETECT_HUNG_TASK
@@ -356,7 +360,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout);
356extern signed long schedule_timeout_killable(signed long timeout); 360extern signed long schedule_timeout_killable(signed long timeout);
357extern signed long schedule_timeout_uninterruptible(signed long timeout); 361extern signed long schedule_timeout_uninterruptible(signed long timeout);
358asmlinkage void schedule(void); 362asmlinkage void schedule(void);
359extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner); 363extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
360 364
361struct nsproxy; 365struct nsproxy;
362struct user_namespace; 366struct user_namespace;
@@ -431,6 +435,7 @@ extern int get_dumpable(struct mm_struct *mm);
431#endif 435#endif
432 /* leave room for more dump flags */ 436 /* leave room for more dump flags */
433#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */ 437#define MMF_VM_MERGEABLE 16 /* KSM may merge identical pages */
438#define MMF_VM_HUGEPAGE 17 /* set when VM_HUGEPAGE is set on vma */
434 439
435#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK) 440#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
436 441
@@ -509,8 +514,10 @@ struct thread_group_cputimer {
509 spinlock_t lock; 514 spinlock_t lock;
510}; 515};
511 516
517struct autogroup;
518
512/* 519/*
513 * NOTE! "signal_struct" does not have it's own 520 * NOTE! "signal_struct" does not have its own
514 * locking, because a shared signal_struct always 521 * locking, because a shared signal_struct always
515 * implies a shared sighand_struct, so locking 522 * implies a shared sighand_struct, so locking
516 * sighand_struct is always a proper superset of 523 * sighand_struct is always a proper superset of
@@ -576,6 +583,9 @@ struct signal_struct {
576 583
577 struct tty_struct *tty; /* NULL if no tty */ 584 struct tty_struct *tty; /* NULL if no tty */
578 585
586#ifdef CONFIG_SCHED_AUTOGROUP
587 struct autogroup *autogroup;
588#endif
579 /* 589 /*
580 * Cumulative resource counters for dead threads in the group, 590 * Cumulative resource counters for dead threads in the group,
581 * and for reaped dead child processes forked by this group. 591 * and for reaped dead child processes forked by this group.
@@ -626,6 +636,12 @@ struct signal_struct {
626 636
627 int oom_adj; /* OOM kill score adjustment (bit shift) */ 637 int oom_adj; /* OOM kill score adjustment (bit shift) */
628 int oom_score_adj; /* OOM kill score adjustment */ 638 int oom_score_adj; /* OOM kill score adjustment */
639 int oom_score_adj_min; /* OOM kill score adjustment minimum value.
640 * Only settable by CAP_SYS_RESOURCE. */
641
642 struct mutex cred_guard_mutex; /* guard against foreign influences on
643 * credential calculations
644 * (notably. ptrace) */
629}; 645};
630 646
631/* Context switch must be unlocked if interrupts are to be enabled */ 647/* Context switch must be unlocked if interrupts are to be enabled */
@@ -637,9 +653,8 @@ struct signal_struct {
637 * Bits in flags field of signal_struct. 653 * Bits in flags field of signal_struct.
638 */ 654 */
639#define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */ 655#define SIGNAL_STOP_STOPPED 0x00000001 /* job control stop in effect */
640#define SIGNAL_STOP_DEQUEUED 0x00000002 /* stop signal dequeued */ 656#define SIGNAL_STOP_CONTINUED 0x00000002 /* SIGCONT since WCONTINUED reap */
641#define SIGNAL_STOP_CONTINUED 0x00000004 /* SIGCONT since WCONTINUED reap */ 657#define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */
642#define SIGNAL_GROUP_EXIT 0x00000008 /* group exit in progress */
643/* 658/*
644 * Pending notifications to parent. 659 * Pending notifications to parent.
645 */ 660 */
@@ -668,8 +683,11 @@ struct user_struct {
668 atomic_t inotify_watches; /* How many inotify watches does this user have? */ 683 atomic_t inotify_watches; /* How many inotify watches does this user have? */
669 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */ 684 atomic_t inotify_devs; /* How many inotify devs does this user have opened? */
670#endif 685#endif
686#ifdef CONFIG_FANOTIFY
687 atomic_t fanotify_listeners;
688#endif
671#ifdef CONFIG_EPOLL 689#ifdef CONFIG_EPOLL
672 atomic_t epoll_watches; /* The number of file descriptors currently watched */ 690 atomic_long_t epoll_watches; /* The number of file descriptors currently watched */
673#endif 691#endif
674#ifdef CONFIG_POSIX_MQUEUE 692#ifdef CONFIG_POSIX_MQUEUE
675 /* protected by mq_lock */ 693 /* protected by mq_lock */
@@ -712,10 +730,6 @@ struct sched_info {
712 /* timestamps */ 730 /* timestamps */
713 unsigned long long last_arrival,/* when we last ran on a cpu */ 731 unsigned long long last_arrival,/* when we last ran on a cpu */
714 last_queued; /* when we were last queued to run */ 732 last_queued; /* when we were last queued to run */
715#ifdef CONFIG_SCHEDSTATS
716 /* BKL stats */
717 unsigned int bkl_count;
718#endif
719}; 733};
720#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 734#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
721 735
@@ -835,7 +849,7 @@ extern int __weak arch_sd_sibiling_asym_packing(void);
835 849
836/* 850/*
837 * Optimise SD flags for power savings: 851 * Optimise SD flags for power savings:
838 * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings. 852 * SD_BALANCE_NEWIDLE helps aggressive task consolidation and power savings.
839 * Keep default SD flags if sched_{smt,mc}_power_saving=0 853 * Keep default SD flags if sched_{smt,mc}_power_saving=0
840 */ 854 */
841 855
@@ -849,12 +863,14 @@ static inline int sd_power_saving_flags(void)
849 863
850struct sched_group { 864struct sched_group {
851 struct sched_group *next; /* Must be a circular list */ 865 struct sched_group *next; /* Must be a circular list */
866 atomic_t ref;
852 867
853 /* 868 /*
854 * CPU power of this group, SCHED_LOAD_SCALE being max power for a 869 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
855 * single CPU. 870 * single CPU.
856 */ 871 */
857 unsigned int cpu_power, cpu_power_orig; 872 unsigned int cpu_power, cpu_power_orig;
873 unsigned int group_weight;
858 874
859 /* 875 /*
860 * The CPUs this group covers. 876 * The CPUs this group covers.
@@ -862,9 +878,6 @@ struct sched_group {
862 * NOTE: this field is variable length. (Allocated dynamically 878 * NOTE: this field is variable length. (Allocated dynamically
863 * by attaching extra space to the end of the structure, 879 * by attaching extra space to the end of the structure,
864 * depending on how many CPUs the kernel has booted up with) 880 * depending on how many CPUs the kernel has booted up with)
865 *
866 * It is also be embedded into static data structures at build
867 * time. (See 'struct static_sched_group' in kernel/sched.c)
868 */ 881 */
869 unsigned long cpumask[0]; 882 unsigned long cpumask[0];
870}; 883};
@@ -874,17 +887,6 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
874 return to_cpumask(sg->cpumask); 887 return to_cpumask(sg->cpumask);
875} 888}
876 889
877enum sched_domain_level {
878 SD_LV_NONE = 0,
879 SD_LV_SIBLING,
880 SD_LV_MC,
881 SD_LV_BOOK,
882 SD_LV_CPU,
883 SD_LV_NODE,
884 SD_LV_ALLNODES,
885 SD_LV_MAX
886};
887
888struct sched_domain_attr { 890struct sched_domain_attr {
889 int relax_domain_level; 891 int relax_domain_level;
890}; 892};
@@ -893,6 +895,8 @@ struct sched_domain_attr {
893 .relax_domain_level = -1, \ 895 .relax_domain_level = -1, \
894} 896}
895 897
898extern int sched_domain_level_max;
899
896struct sched_domain { 900struct sched_domain {
897 /* These fields must be setup */ 901 /* These fields must be setup */
898 struct sched_domain *parent; /* top domain must be null terminated */ 902 struct sched_domain *parent; /* top domain must be null terminated */
@@ -910,7 +914,7 @@ struct sched_domain {
910 unsigned int forkexec_idx; 914 unsigned int forkexec_idx;
911 unsigned int smt_gain; 915 unsigned int smt_gain;
912 int flags; /* See SD_* */ 916 int flags; /* See SD_* */
913 enum sched_domain_level level; 917 int level;
914 918
915 /* Runtime fields. */ 919 /* Runtime fields. */
916 unsigned long last_balance; /* init to jiffies. units in jiffies */ 920 unsigned long last_balance; /* init to jiffies. units in jiffies */
@@ -953,6 +957,10 @@ struct sched_domain {
953#ifdef CONFIG_SCHED_DEBUG 957#ifdef CONFIG_SCHED_DEBUG
954 char *name; 958 char *name;
955#endif 959#endif
960 union {
961 void *private; /* used during construction */
962 struct rcu_head rcu; /* used during destruction */
963 };
956 964
957 unsigned int span_weight; 965 unsigned int span_weight;
958 /* 966 /*
@@ -961,9 +969,6 @@ struct sched_domain {
961 * NOTE: this field is variable length. (Allocated dynamically 969 * NOTE: this field is variable length. (Allocated dynamically
962 * by attaching extra space to the end of the structure, 970 * by attaching extra space to the end of the structure,
963 * depending on how many CPUs the kernel has booted up with) 971 * depending on how many CPUs the kernel has booted up with)
964 *
965 * It is also be embedded into static data structures at build
966 * time. (See 'struct static_sched_domain' in kernel/sched.c)
967 */ 972 */
968 unsigned long span[0]; 973 unsigned long span[0];
969}; 974};
@@ -1028,8 +1033,12 @@ struct sched_domain;
1028#define WF_FORK 0x02 /* child wakeup after fork */ 1033#define WF_FORK 0x02 /* child wakeup after fork */
1029 1034
1030#define ENQUEUE_WAKEUP 1 1035#define ENQUEUE_WAKEUP 1
1031#define ENQUEUE_WAKING 2 1036#define ENQUEUE_HEAD 2
1032#define ENQUEUE_HEAD 4 1037#ifdef CONFIG_SMP
1038#define ENQUEUE_WAKING 4 /* sched_class::task_waking was called */
1039#else
1040#define ENQUEUE_WAKING 0
1041#endif
1033 1042
1034#define DEQUEUE_SLEEP 1 1043#define DEQUEUE_SLEEP 1
1035 1044
@@ -1039,6 +1048,7 @@ struct sched_class {
1039 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); 1048 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1040 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); 1049 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1041 void (*yield_task) (struct rq *rq); 1050 void (*yield_task) (struct rq *rq);
1051 bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
1042 1052
1043 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); 1053 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
1044 1054
@@ -1046,12 +1056,11 @@ struct sched_class {
1046 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1056 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1047 1057
1048#ifdef CONFIG_SMP 1058#ifdef CONFIG_SMP
1049 int (*select_task_rq)(struct rq *rq, struct task_struct *p, 1059 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1050 int sd_flag, int flags);
1051 1060
1052 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1061 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1053 void (*post_schedule) (struct rq *this_rq); 1062 void (*post_schedule) (struct rq *this_rq);
1054 void (*task_waking) (struct rq *this_rq, struct task_struct *task); 1063 void (*task_waking) (struct task_struct *task);
1055 void (*task_woken) (struct rq *this_rq, struct task_struct *task); 1064 void (*task_woken) (struct rq *this_rq, struct task_struct *task);
1056 1065
1057 void (*set_cpus_allowed)(struct task_struct *p, 1066 void (*set_cpus_allowed)(struct task_struct *p,
@@ -1065,18 +1074,16 @@ struct sched_class {
1065 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); 1074 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
1066 void (*task_fork) (struct task_struct *p); 1075 void (*task_fork) (struct task_struct *p);
1067 1076
1068 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 1077 void (*switched_from) (struct rq *this_rq, struct task_struct *task);
1069 int running); 1078 void (*switched_to) (struct rq *this_rq, struct task_struct *task);
1070 void (*switched_to) (struct rq *this_rq, struct task_struct *task,
1071 int running);
1072 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1079 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1073 int oldprio, int running); 1080 int oldprio);
1074 1081
1075 unsigned int (*get_rr_interval) (struct rq *rq, 1082 unsigned int (*get_rr_interval) (struct rq *rq,
1076 struct task_struct *task); 1083 struct task_struct *task);
1077 1084
1078#ifdef CONFIG_FAIR_GROUP_SCHED 1085#ifdef CONFIG_FAIR_GROUP_SCHED
1079 void (*moved_group) (struct task_struct *p, int on_rq); 1086 void (*task_move_group) (struct task_struct *p, int on_rq);
1080#endif 1087#endif
1081}; 1088};
1082 1089
@@ -1178,13 +1185,11 @@ struct task_struct {
1178 unsigned int flags; /* per process flags, defined below */ 1185 unsigned int flags; /* per process flags, defined below */
1179 unsigned int ptrace; 1186 unsigned int ptrace;
1180 1187
1181 int lock_depth; /* BKL lock depth */
1182
1183#ifdef CONFIG_SMP 1188#ifdef CONFIG_SMP
1184#ifdef __ARCH_WANT_UNLOCKED_CTXSW 1189 struct task_struct *wake_entry;
1185 int oncpu; 1190 int on_cpu;
1186#endif
1187#endif 1191#endif
1192 int on_rq;
1188 1193
1189 int prio, static_prio, normal_prio; 1194 int prio, static_prio, normal_prio;
1190 unsigned int rt_priority; 1195 unsigned int rt_priority;
@@ -1221,15 +1226,23 @@ struct task_struct {
1221#ifdef CONFIG_TREE_PREEMPT_RCU 1226#ifdef CONFIG_TREE_PREEMPT_RCU
1222 struct rcu_node *rcu_blocked_node; 1227 struct rcu_node *rcu_blocked_node;
1223#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 1228#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1229#ifdef CONFIG_RCU_BOOST
1230 struct rt_mutex *rcu_boost_mutex;
1231#endif /* #ifdef CONFIG_RCU_BOOST */
1224 1232
1225#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1233#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
1226 struct sched_info sched_info; 1234 struct sched_info sched_info;
1227#endif 1235#endif
1228 1236
1229 struct list_head tasks; 1237 struct list_head tasks;
1238#ifdef CONFIG_SMP
1230 struct plist_node pushable_tasks; 1239 struct plist_node pushable_tasks;
1240#endif
1231 1241
1232 struct mm_struct *mm, *active_mm; 1242 struct mm_struct *mm, *active_mm;
1243#ifdef CONFIG_COMPAT_BRK
1244 unsigned brk_randomized:1;
1245#endif
1233#if defined(SPLIT_RSS_COUNTING) 1246#if defined(SPLIT_RSS_COUNTING)
1234 struct task_rss_stat rss_stat; 1247 struct task_rss_stat rss_stat;
1235#endif 1248#endif
@@ -1237,6 +1250,7 @@ struct task_struct {
1237 int exit_state; 1250 int exit_state;
1238 int exit_code, exit_signal; 1251 int exit_code, exit_signal;
1239 int pdeath_signal; /* The signal sent when the parent dies */ 1252 int pdeath_signal; /* The signal sent when the parent dies */
1253 unsigned int group_stop; /* GROUP_STOP_*, siglock protected */
1240 /* ??? */ 1254 /* ??? */
1241 unsigned int personality; 1255 unsigned int personality;
1242 unsigned did_exec:1; 1256 unsigned did_exec:1;
@@ -1247,6 +1261,7 @@ struct task_struct {
1247 1261
1248 /* Revert to default priority/policy when forking */ 1262 /* Revert to default priority/policy when forking */
1249 unsigned sched_reset_on_fork:1; 1263 unsigned sched_reset_on_fork:1;
1264 unsigned sched_contributes_to_load:1;
1250 1265
1251 pid_t pid; 1266 pid_t pid;
1252 pid_t tgid; 1267 pid_t tgid;
@@ -1305,9 +1320,6 @@ struct task_struct {
1305 * credentials (COW) */ 1320 * credentials (COW) */
1306 const struct cred __rcu *cred; /* effective (overridable) subjective task 1321 const struct cred __rcu *cred; /* effective (overridable) subjective task
1307 * credentials (COW) */ 1322 * credentials (COW) */
1308 struct mutex cred_guard_mutex; /* guard against foreign influences on
1309 * credential calculations
1310 * (notably. ptrace) */
1311 struct cred *replacement_session_keyring; /* for KEYCTL_SESSION_TO_PARENT */ 1323 struct cred *replacement_session_keyring; /* for KEYCTL_SESSION_TO_PARENT */
1312 1324
1313 char comm[TASK_COMM_LEN]; /* executable name excluding path 1325 char comm[TASK_COMM_LEN]; /* executable name excluding path
@@ -1408,6 +1420,11 @@ struct task_struct {
1408/* stacked block device info */ 1420/* stacked block device info */
1409 struct bio_list *bio_list; 1421 struct bio_list *bio_list;
1410 1422
1423#ifdef CONFIG_BLOCK
1424/* stack plugging */
1425 struct blk_plug *plug;
1426#endif
1427
1411/* VM state */ 1428/* VM state */
1412 struct reclaim_state *reclaim_state; 1429 struct reclaim_state *reclaim_state;
1413 1430
@@ -1451,6 +1468,7 @@ struct task_struct {
1451#ifdef CONFIG_NUMA 1468#ifdef CONFIG_NUMA
1452 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1469 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1453 short il_next; 1470 short il_next;
1471 short pref_node_fork;
1454#endif 1472#endif
1455 atomic_t fs_excl; /* holding fs exclusive resources */ 1473 atomic_t fs_excl; /* holding fs exclusive resources */
1456 struct rcu_head rcu; 1474 struct rcu_head rcu;
@@ -1503,10 +1521,13 @@ struct task_struct {
1503 struct memcg_batch_info { 1521 struct memcg_batch_info {
1504 int do_batch; /* incremented when batch uncharge started */ 1522 int do_batch; /* incremented when batch uncharge started */
1505 struct mem_cgroup *memcg; /* target memcg of uncharge */ 1523 struct mem_cgroup *memcg; /* target memcg of uncharge */
1506 unsigned long bytes; /* uncharged usage */ 1524 unsigned long nr_pages; /* uncharged usage */
1507 unsigned long memsw_bytes; /* uncharged mem+swap usage */ 1525 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1508 } memcg_batch; 1526 } memcg_batch;
1509#endif 1527#endif
1528#ifdef CONFIG_HAVE_HW_BREAKPOINT
1529 atomic_t ptrace_bp_refcnt;
1530#endif
1510}; 1531};
1511 1532
1512/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1533/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1694,7 +1715,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1694/* 1715/*
1695 * Per process flags 1716 * Per process flags
1696 */ 1717 */
1697#define PF_KSOFTIRQD 0x00000001 /* I am ksoftirqd */
1698#define PF_STARTING 0x00000002 /* being created */ 1718#define PF_STARTING 0x00000002 /* being created */
1699#define PF_EXITING 0x00000004 /* getting shut down */ 1719#define PF_EXITING 0x00000004 /* getting shut down */
1700#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1720#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
@@ -1706,7 +1726,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1706#define PF_DUMPCORE 0x00000200 /* dumped core */ 1726#define PF_DUMPCORE 0x00000200 /* dumped core */
1707#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1727#define PF_SIGNALED 0x00000400 /* killed by a signal */
1708#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1728#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1709#define PF_FLUSHER 0x00001000 /* responsible for disk writeback */
1710#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1729#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1711#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */ 1730#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1712#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1731#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
@@ -1724,7 +1743,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1724#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1743#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1725#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1744#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1726#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1745#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1727#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1746#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1728#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ 1747#define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */
1729 1748
1730/* 1749/*
@@ -1752,10 +1771,22 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1752#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1771#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1753#define used_math() tsk_used_math(current) 1772#define used_math() tsk_used_math(current)
1754 1773
1774/*
1775 * task->group_stop flags
1776 */
1777#define GROUP_STOP_SIGMASK 0xffff /* signr of the last group stop */
1778#define GROUP_STOP_PENDING (1 << 16) /* task should stop for group stop */
1779#define GROUP_STOP_CONSUME (1 << 17) /* consume group stop count */
1780#define GROUP_STOP_TRAPPING (1 << 18) /* switching from STOPPED to TRACED */
1781#define GROUP_STOP_DEQUEUED (1 << 19) /* stop signal dequeued */
1782
1783extern void task_clear_group_stop_pending(struct task_struct *task);
1784
1755#ifdef CONFIG_PREEMPT_RCU 1785#ifdef CONFIG_PREEMPT_RCU
1756 1786
1757#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ 1787#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1758#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ 1788#define RCU_READ_UNLOCK_BOOSTED (1 << 1) /* boosted while in RCU read-side. */
1789#define RCU_READ_UNLOCK_NEED_QS (1 << 2) /* RCU core needs CPU response. */
1759 1790
1760static inline void rcu_copy_process(struct task_struct *p) 1791static inline void rcu_copy_process(struct task_struct *p)
1761{ 1792{
@@ -1763,7 +1794,10 @@ static inline void rcu_copy_process(struct task_struct *p)
1763 p->rcu_read_unlock_special = 0; 1794 p->rcu_read_unlock_special = 0;
1764#ifdef CONFIG_TREE_PREEMPT_RCU 1795#ifdef CONFIG_TREE_PREEMPT_RCU
1765 p->rcu_blocked_node = NULL; 1796 p->rcu_blocked_node = NULL;
1766#endif 1797#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
1798#ifdef CONFIG_RCU_BOOST
1799 p->rcu_boost_mutex = NULL;
1800#endif /* #ifdef CONFIG_RCU_BOOST */
1767 INIT_LIST_HEAD(&p->rcu_node_entry); 1801 INIT_LIST_HEAD(&p->rcu_node_entry);
1768} 1802}
1769 1803
@@ -1868,14 +1902,11 @@ extern void sched_clock_idle_sleep_event(void);
1868extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1902extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1869 1903
1870#ifdef CONFIG_HOTPLUG_CPU 1904#ifdef CONFIG_HOTPLUG_CPU
1871extern void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p);
1872extern void idle_task_exit(void); 1905extern void idle_task_exit(void);
1873#else 1906#else
1874static inline void idle_task_exit(void) {} 1907static inline void idle_task_exit(void) {}
1875#endif 1908#endif
1876 1909
1877extern void sched_idle_next(void);
1878
1879#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP) 1910#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
1880extern void wake_up_idle_cpu(int cpu); 1911extern void wake_up_idle_cpu(int cpu);
1881#else 1912#else
@@ -1885,8 +1916,6 @@ static inline void wake_up_idle_cpu(int cpu) { }
1885extern unsigned int sysctl_sched_latency; 1916extern unsigned int sysctl_sched_latency;
1886extern unsigned int sysctl_sched_min_granularity; 1917extern unsigned int sysctl_sched_min_granularity;
1887extern unsigned int sysctl_sched_wakeup_granularity; 1918extern unsigned int sysctl_sched_wakeup_granularity;
1888extern unsigned int sysctl_sched_shares_ratelimit;
1889extern unsigned int sysctl_sched_shares_thresh;
1890extern unsigned int sysctl_sched_child_runs_first; 1919extern unsigned int sysctl_sched_child_runs_first;
1891 1920
1892enum sched_tunable_scaling { 1921enum sched_tunable_scaling {
@@ -1902,6 +1931,7 @@ extern unsigned int sysctl_sched_migration_cost;
1902extern unsigned int sysctl_sched_nr_migrate; 1931extern unsigned int sysctl_sched_nr_migrate;
1903extern unsigned int sysctl_sched_time_avg; 1932extern unsigned int sysctl_sched_time_avg;
1904extern unsigned int sysctl_timer_migration; 1933extern unsigned int sysctl_timer_migration;
1934extern unsigned int sysctl_sched_shares_window;
1905 1935
1906int sched_proc_update_handler(struct ctl_table *table, int write, 1936int sched_proc_update_handler(struct ctl_table *table, int write,
1907 void __user *buffer, size_t *length, 1937 void __user *buffer, size_t *length,
@@ -1925,7 +1955,23 @@ int sched_rt_handler(struct ctl_table *table, int write,
1925 void __user *buffer, size_t *lenp, 1955 void __user *buffer, size_t *lenp,
1926 loff_t *ppos); 1956 loff_t *ppos);
1927 1957
1928extern unsigned int sysctl_sched_compat_yield; 1958#ifdef CONFIG_SCHED_AUTOGROUP
1959extern unsigned int sysctl_sched_autogroup_enabled;
1960
1961extern void sched_autogroup_create_attach(struct task_struct *p);
1962extern void sched_autogroup_detach(struct task_struct *p);
1963extern void sched_autogroup_fork(struct signal_struct *sig);
1964extern void sched_autogroup_exit(struct signal_struct *sig);
1965#ifdef CONFIG_PROC_FS
1966extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m);
1967extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice);
1968#endif
1969#else
1970static inline void sched_autogroup_create_attach(struct task_struct *p) { }
1971static inline void sched_autogroup_detach(struct task_struct *p) { }
1972static inline void sched_autogroup_fork(struct signal_struct *sig) { }
1973static inline void sched_autogroup_exit(struct signal_struct *sig) { }
1974#endif
1929 1975
1930#ifdef CONFIG_RT_MUTEXES 1976#ifdef CONFIG_RT_MUTEXES
1931extern int rt_mutex_getprio(struct task_struct *p); 1977extern int rt_mutex_getprio(struct task_struct *p);
@@ -1939,15 +1985,17 @@ static inline int rt_mutex_getprio(struct task_struct *p)
1939# define rt_mutex_adjust_pi(p) do { } while (0) 1985# define rt_mutex_adjust_pi(p) do { } while (0)
1940#endif 1986#endif
1941 1987
1988extern bool yield_to(struct task_struct *p, bool preempt);
1942extern void set_user_nice(struct task_struct *p, long nice); 1989extern void set_user_nice(struct task_struct *p, long nice);
1943extern int task_prio(const struct task_struct *p); 1990extern int task_prio(const struct task_struct *p);
1944extern int task_nice(const struct task_struct *p); 1991extern int task_nice(const struct task_struct *p);
1945extern int can_nice(const struct task_struct *p, const int nice); 1992extern int can_nice(const struct task_struct *p, const int nice);
1946extern int task_curr(const struct task_struct *p); 1993extern int task_curr(const struct task_struct *p);
1947extern int idle_cpu(int cpu); 1994extern int idle_cpu(int cpu);
1948extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1995extern int sched_setscheduler(struct task_struct *, int,
1996 const struct sched_param *);
1949extern int sched_setscheduler_nocheck(struct task_struct *, int, 1997extern int sched_setscheduler_nocheck(struct task_struct *, int,
1950 struct sched_param *); 1998 const struct sched_param *);
1951extern struct task_struct *idle_task(int cpu); 1999extern struct task_struct *idle_task(int cpu);
1952extern struct task_struct *curr_task(int cpu); 2000extern struct task_struct *curr_task(int cpu);
1953extern void set_curr_task(int cpu, struct task_struct *p); 2001extern void set_curr_task(int cpu, struct task_struct *p);
@@ -2010,18 +2058,17 @@ extern void release_uids(struct user_namespace *ns);
2010 2058
2011#include <asm/current.h> 2059#include <asm/current.h>
2012 2060
2013extern void do_timer(unsigned long ticks); 2061extern void xtime_update(unsigned long ticks);
2014 2062
2015extern int wake_up_state(struct task_struct *tsk, unsigned int state); 2063extern int wake_up_state(struct task_struct *tsk, unsigned int state);
2016extern int wake_up_process(struct task_struct *tsk); 2064extern int wake_up_process(struct task_struct *tsk);
2017extern void wake_up_new_task(struct task_struct *tsk, 2065extern void wake_up_new_task(struct task_struct *tsk);
2018 unsigned long clone_flags);
2019#ifdef CONFIG_SMP 2066#ifdef CONFIG_SMP
2020 extern void kick_process(struct task_struct *tsk); 2067 extern void kick_process(struct task_struct *tsk);
2021#else 2068#else
2022 static inline void kick_process(struct task_struct *tsk) { } 2069 static inline void kick_process(struct task_struct *tsk) { }
2023#endif 2070#endif
2024extern void sched_fork(struct task_struct *p, int clone_flags); 2071extern void sched_fork(struct task_struct *p);
2025extern void sched_dead(struct task_struct *p); 2072extern void sched_dead(struct task_struct *p);
2026 2073
2027extern void proc_caches_init(void); 2074extern void proc_caches_init(void);
@@ -2146,8 +2193,10 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
2146extern char *get_task_comm(char *to, struct task_struct *tsk); 2193extern char *get_task_comm(char *to, struct task_struct *tsk);
2147 2194
2148#ifdef CONFIG_SMP 2195#ifdef CONFIG_SMP
2196void scheduler_ipi(void);
2149extern unsigned long wait_task_inactive(struct task_struct *, long match_state); 2197extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
2150#else 2198#else
2199static inline void scheduler_ipi(void) { }
2151static inline unsigned long wait_task_inactive(struct task_struct *p, 2200static inline unsigned long wait_task_inactive(struct task_struct *p,
2152 long match_state) 2201 long match_state)
2153{ 2202{
@@ -2237,9 +2286,16 @@ static inline void task_unlock(struct task_struct *p)
2237 spin_unlock(&p->alloc_lock); 2286 spin_unlock(&p->alloc_lock);
2238} 2287}
2239 2288
2240extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk, 2289extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
2241 unsigned long *flags); 2290 unsigned long *flags);
2242 2291
2292#define lock_task_sighand(tsk, flags) \
2293({ struct sighand_struct *__ss; \
2294 __cond_lock(&(tsk)->sighand->siglock, \
2295 (__ss = __lock_task_sighand(tsk, flags))); \
2296 __ss; \
2297}) \
2298
2243static inline void unlock_task_sighand(struct task_struct *tsk, 2299static inline void unlock_task_sighand(struct task_struct *tsk,
2244 unsigned long *flags) 2300 unsigned long *flags)
2245{ 2301{
@@ -2467,7 +2523,7 @@ extern void normalize_rt_tasks(void);
2467 2523
2468#ifdef CONFIG_CGROUP_SCHED 2524#ifdef CONFIG_CGROUP_SCHED
2469 2525
2470extern struct task_group init_task_group; 2526extern struct task_group root_task_group;
2471 2527
2472extern struct task_group *sched_create_group(struct task_group *parent); 2528extern struct task_group *sched_create_group(struct task_group *parent);
2473extern void sched_destroy_group(struct task_group *tg); 2529extern void sched_destroy_group(struct task_group *tg);
@@ -2532,13 +2588,6 @@ static inline void inc_syscw(struct task_struct *tsk)
2532#define TASK_SIZE_OF(tsk) TASK_SIZE 2588#define TASK_SIZE_OF(tsk) TASK_SIZE
2533#endif 2589#endif
2534 2590
2535/*
2536 * Call the function if the target task is executing on a CPU right now:
2537 */
2538extern void task_oncpu_function_call(struct task_struct *p,
2539 void (*func) (void *info), void *info);
2540
2541
2542#ifdef CONFIG_MM_OWNER 2591#ifdef CONFIG_MM_OWNER
2543extern void mm_update_next_owner(struct mm_struct *mm); 2592extern void mm_update_next_owner(struct mm_struct *mm);
2544extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); 2593extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
diff --git a/include/linux/security.h b/include/linux/security.h
index b8246a8df7d2..8ce59ef3e5af 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -25,6 +25,7 @@
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h> 26#include <linux/fsnotify.h>
27#include <linux/binfmts.h> 27#include <linux/binfmts.h>
28#include <linux/dcache.h>
28#include <linux/signal.h> 29#include <linux/signal.h>
29#include <linux/resource.h> 30#include <linux/resource.h>
30#include <linux/sem.h> 31#include <linux/sem.h>
@@ -46,14 +47,15 @@
46 47
47struct ctl_table; 48struct ctl_table;
48struct audit_krule; 49struct audit_krule;
50struct user_namespace;
49 51
50/* 52/*
51 * These functions are in security/capability.c and are used 53 * These functions are in security/capability.c and are used
52 * as the default capabilities functions 54 * as the default capabilities functions
53 */ 55 */
54extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 56extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
55 int cap, int audit); 57 struct user_namespace *ns, int cap, int audit);
56extern int cap_settime(struct timespec *ts, struct timezone *tz); 58extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
57extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 59extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
58extern int cap_ptrace_traceme(struct task_struct *parent); 60extern int cap_ptrace_traceme(struct task_struct *parent);
59extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 61extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -77,7 +79,6 @@ extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
77extern int cap_task_setscheduler(struct task_struct *p); 79extern int cap_task_setscheduler(struct task_struct *p);
78extern int cap_task_setioprio(struct task_struct *p, int ioprio); 80extern int cap_task_setioprio(struct task_struct *p, int ioprio);
79extern int cap_task_setnice(struct task_struct *p, int nice); 81extern int cap_task_setnice(struct task_struct *p, int nice);
80extern int cap_syslog(int type, bool from_file);
81extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); 82extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
82 83
83struct msghdr; 84struct msghdr;
@@ -268,6 +269,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
268 * @orig the original mount data copied from userspace. 269 * @orig the original mount data copied from userspace.
269 * @copy copied data which will be passed to the security module. 270 * @copy copied data which will be passed to the security module.
270 * Returns 0 if the copy was successful. 271 * Returns 0 if the copy was successful.
272 * @sb_remount:
273 * Extracts security system specifc mount options and verifys no changes
274 * are being made to those options.
275 * @sb superblock being remounted
276 * @data contains the filesystem-specific data.
277 * Return 0 if permission is granted.
271 * @sb_umount: 278 * @sb_umount:
272 * Check permission before the @mnt file system is unmounted. 279 * Check permission before the @mnt file system is unmounted.
273 * @mnt contains the mounted file system. 280 * @mnt contains the mounted file system.
@@ -316,6 +323,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
316 * then it should return -EOPNOTSUPP to skip this processing. 323 * then it should return -EOPNOTSUPP to skip this processing.
317 * @inode contains the inode structure of the newly created inode. 324 * @inode contains the inode structure of the newly created inode.
318 * @dir contains the inode structure of the parent directory. 325 * @dir contains the inode structure of the parent directory.
326 * @qstr contains the last path component of the new object
319 * @name will be set to the allocated name suffix (e.g. selinux). 327 * @name will be set to the allocated name suffix (e.g. selinux).
320 * @value will be set to the allocated attribute value. 328 * @value will be set to the allocated attribute value.
321 * @len will be set to the length of the value. 329 * @len will be set to the length of the value.
@@ -458,7 +466,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
458 * called when the actual read/write operations are performed. 466 * called when the actual read/write operations are performed.
459 * @inode contains the inode structure to check. 467 * @inode contains the inode structure to check.
460 * @mask contains the permission mask. 468 * @mask contains the permission mask.
461 * @nd contains the nameidata (may be NULL).
462 * Return 0 if permission is granted. 469 * Return 0 if permission is granted.
463 * @inode_setattr: 470 * @inode_setattr:
464 * Check permission before setting file attributes. Note that the kernel 471 * Check permission before setting file attributes. Note that the kernel
@@ -797,8 +804,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
797 * @unix_stream_connect: 804 * @unix_stream_connect:
798 * Check permissions before establishing a Unix domain stream connection 805 * Check permissions before establishing a Unix domain stream connection
799 * between @sock and @other. 806 * between @sock and @other.
800 * @sock contains the socket structure. 807 * @sock contains the sock structure.
801 * @other contains the peer socket structure. 808 * @other contains the peer sock structure.
809 * @newsk contains the new sock structure.
802 * Return 0 if permission is granted. 810 * Return 0 if permission is granted.
803 * @unix_may_send: 811 * @unix_may_send:
804 * Check permissions before connecting or sending datagrams from @sock to 812 * Check permissions before connecting or sending datagrams from @sock to
@@ -1059,8 +1067,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1059 * @cred points to the credentials to provide the context against which to 1067 * @cred points to the credentials to provide the context against which to
1060 * evaluate the security data on the key. 1068 * evaluate the security data on the key.
1061 * @perm describes the combination of permissions required of this key. 1069 * @perm describes the combination of permissions required of this key.
1062 * Return 1 if permission granted, 0 if permission denied and -ve it the 1070 * Return 0 if permission is granted, -ve error otherwise.
1063 * normal permissions model should be effected.
1064 * @key_getsecurity: 1071 * @key_getsecurity:
1065 * Get a textual representation of the security context attached to a key 1072 * Get a textual representation of the security context attached to a key
1066 * for the purposes of honouring KEYCTL_GETSECURITY. This function 1073 * for the purposes of honouring KEYCTL_GETSECURITY. This function
@@ -1256,15 +1263,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1256 * credentials. 1263 * credentials.
1257 * @tsk contains the task_struct for the process. 1264 * @tsk contains the task_struct for the process.
1258 * @cred contains the credentials to use. 1265 * @cred contains the credentials to use.
1266 * @ns contains the user namespace we want the capability in
1259 * @cap contains the capability <include/linux/capability.h>. 1267 * @cap contains the capability <include/linux/capability.h>.
1260 * @audit: Whether to write an audit message or not 1268 * @audit: Whether to write an audit message or not
1261 * Return 0 if the capability is granted for @tsk. 1269 * Return 0 if the capability is granted for @tsk.
1262 * @sysctl:
1263 * Check permission before accessing the @table sysctl variable in the
1264 * manner specified by @op.
1265 * @table contains the ctl_table structure for the sysctl variable.
1266 * @op contains the operation (001 = search, 002 = write, 004 = read).
1267 * Return 0 if permission is granted.
1268 * @syslog: 1270 * @syslog:
1269 * Check permission before accessing the kernel message ring or changing 1271 * Check permission before accessing the kernel message ring or changing
1270 * logging to the console. 1272 * logging to the console.
@@ -1384,12 +1386,11 @@ struct security_operations {
1384 const kernel_cap_t *inheritable, 1386 const kernel_cap_t *inheritable,
1385 const kernel_cap_t *permitted); 1387 const kernel_cap_t *permitted);
1386 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1388 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1387 int cap, int audit); 1389 struct user_namespace *ns, int cap, int audit);
1388 int (*sysctl) (struct ctl_table *table, int op);
1389 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1390 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1390 int (*quota_on) (struct dentry *dentry); 1391 int (*quota_on) (struct dentry *dentry);
1391 int (*syslog) (int type, bool from_file); 1392 int (*syslog) (int type);
1392 int (*settime) (struct timespec *ts, struct timezone *tz); 1393 int (*settime) (const struct timespec *ts, const struct timezone *tz);
1393 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1394 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1394 1395
1395 int (*bprm_set_creds) (struct linux_binprm *bprm); 1396 int (*bprm_set_creds) (struct linux_binprm *bprm);
@@ -1401,6 +1402,7 @@ struct security_operations {
1401 int (*sb_alloc_security) (struct super_block *sb); 1402 int (*sb_alloc_security) (struct super_block *sb);
1402 void (*sb_free_security) (struct super_block *sb); 1403 void (*sb_free_security) (struct super_block *sb);
1403 int (*sb_copy_data) (char *orig, char *copy); 1404 int (*sb_copy_data) (char *orig, char *copy);
1405 int (*sb_remount) (struct super_block *sb, void *data);
1404 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); 1406 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1405 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1407 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1406 int (*sb_statfs) (struct dentry *dentry); 1408 int (*sb_statfs) (struct dentry *dentry);
@@ -1437,7 +1439,8 @@ struct security_operations {
1437 int (*inode_alloc_security) (struct inode *inode); 1439 int (*inode_alloc_security) (struct inode *inode);
1438 void (*inode_free_security) (struct inode *inode); 1440 void (*inode_free_security) (struct inode *inode);
1439 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1441 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1440 char **name, void **value, size_t *len); 1442 const struct qstr *qstr, char **name,
1443 void **value, size_t *len);
1441 int (*inode_create) (struct inode *dir, 1444 int (*inode_create) (struct inode *dir,
1442 struct dentry *dentry, int mode); 1445 struct dentry *dentry, int mode);
1443 int (*inode_link) (struct dentry *old_dentry, 1446 int (*inode_link) (struct dentry *old_dentry,
@@ -1453,7 +1456,7 @@ struct security_operations {
1453 struct inode *new_dir, struct dentry *new_dentry); 1456 struct inode *new_dir, struct dentry *new_dentry);
1454 int (*inode_readlink) (struct dentry *dentry); 1457 int (*inode_readlink) (struct dentry *dentry);
1455 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1458 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1456 int (*inode_permission) (struct inode *inode, int mask); 1459 int (*inode_permission) (struct inode *inode, int mask, unsigned flags);
1457 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1460 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1458 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1461 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1459 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1462 int (*inode_setxattr) (struct dentry *dentry, const char *name,
@@ -1569,8 +1572,7 @@ struct security_operations {
1569 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen); 1572 int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
1570 1573
1571#ifdef CONFIG_SECURITY_NETWORK 1574#ifdef CONFIG_SECURITY_NETWORK
1572 int (*unix_stream_connect) (struct socket *sock, 1575 int (*unix_stream_connect) (struct sock *sock, struct sock *other, struct sock *newsk);
1573 struct socket *other, struct sock *newsk);
1574 int (*unix_may_send) (struct socket *sock, struct socket *other); 1576 int (*unix_may_send) (struct socket *sock, struct socket *other);
1575 1577
1576 int (*socket_create) (int family, int type, int protocol, int kern); 1578 int (*socket_create) (int family, int type, int protocol, int kern);
@@ -1626,7 +1628,7 @@ struct security_operations {
1626 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1628 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1627 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, 1629 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,
1628 struct xfrm_policy *xp, 1630 struct xfrm_policy *xp,
1629 struct flowi *fl); 1631 const struct flowi *fl);
1630 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); 1632 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
1631#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1633#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1632 1634
@@ -1665,14 +1667,16 @@ int security_capset(struct cred *new, const struct cred *old,
1665 const kernel_cap_t *effective, 1667 const kernel_cap_t *effective,
1666 const kernel_cap_t *inheritable, 1668 const kernel_cap_t *inheritable,
1667 const kernel_cap_t *permitted); 1669 const kernel_cap_t *permitted);
1668int security_capable(int cap); 1670int security_capable(struct user_namespace *ns, const struct cred *cred,
1669int security_real_capable(struct task_struct *tsk, int cap); 1671 int cap);
1670int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1672int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1671int security_sysctl(struct ctl_table *table, int op); 1673 int cap);
1674int security_real_capable_noaudit(struct task_struct *tsk,
1675 struct user_namespace *ns, int cap);
1672int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1676int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1673int security_quota_on(struct dentry *dentry); 1677int security_quota_on(struct dentry *dentry);
1674int security_syslog(int type, bool from_file); 1678int security_syslog(int type);
1675int security_settime(struct timespec *ts, struct timezone *tz); 1679int security_settime(const struct timespec *ts, const struct timezone *tz);
1676int security_vm_enough_memory(long pages); 1680int security_vm_enough_memory(long pages);
1677int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1681int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1678int security_vm_enough_memory_kern(long pages); 1682int security_vm_enough_memory_kern(long pages);
@@ -1684,6 +1688,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm);
1684int security_sb_alloc(struct super_block *sb); 1688int security_sb_alloc(struct super_block *sb);
1685void security_sb_free(struct super_block *sb); 1689void security_sb_free(struct super_block *sb);
1686int security_sb_copy_data(char *orig, char *copy); 1690int security_sb_copy_data(char *orig, char *copy);
1691int security_sb_remount(struct super_block *sb, void *data);
1687int security_sb_kern_mount(struct super_block *sb, int flags, void *data); 1692int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1688int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1693int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1689int security_sb_statfs(struct dentry *dentry); 1694int security_sb_statfs(struct dentry *dentry);
@@ -1699,7 +1704,8 @@ int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1699int security_inode_alloc(struct inode *inode); 1704int security_inode_alloc(struct inode *inode);
1700void security_inode_free(struct inode *inode); 1705void security_inode_free(struct inode *inode);
1701int security_inode_init_security(struct inode *inode, struct inode *dir, 1706int security_inode_init_security(struct inode *inode, struct inode *dir,
1702 char **name, void **value, size_t *len); 1707 const struct qstr *qstr, char **name,
1708 void **value, size_t *len);
1703int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1709int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
1704int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1710int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1705 struct dentry *new_dentry); 1711 struct dentry *new_dentry);
@@ -1714,6 +1720,7 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1714int security_inode_readlink(struct dentry *dentry); 1720int security_inode_readlink(struct dentry *dentry);
1715int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1721int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1716int security_inode_permission(struct inode *inode, int mask); 1722int security_inode_permission(struct inode *inode, int mask);
1723int security_inode_exec_permission(struct inode *inode, unsigned int flags);
1717int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1724int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1718int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1725int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1719int security_inode_setxattr(struct dentry *dentry, const char *name, 1726int security_inode_setxattr(struct dentry *dentry, const char *name,
@@ -1858,38 +1865,34 @@ static inline int security_capset(struct cred *new,
1858 return cap_capset(new, old, effective, inheritable, permitted); 1865 return cap_capset(new, old, effective, inheritable, permitted);
1859} 1866}
1860 1867
1861static inline int security_capable(int cap) 1868static inline int security_capable(struct user_namespace *ns,
1869 const struct cred *cred, int cap)
1862{ 1870{
1863 return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT); 1871 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1864} 1872}
1865 1873
1866static inline int security_real_capable(struct task_struct *tsk, int cap) 1874static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1867{ 1875{
1868 int ret; 1876 int ret;
1869 1877
1870 rcu_read_lock(); 1878 rcu_read_lock();
1871 ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT); 1879 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1872 rcu_read_unlock(); 1880 rcu_read_unlock();
1873 return ret; 1881 return ret;
1874} 1882}
1875 1883
1876static inline 1884static inline
1877int security_real_capable_noaudit(struct task_struct *tsk, int cap) 1885int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap)
1878{ 1886{
1879 int ret; 1887 int ret;
1880 1888
1881 rcu_read_lock(); 1889 rcu_read_lock();
1882 ret = cap_capable(tsk, __task_cred(tsk), cap, 1890 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1883 SECURITY_CAP_NOAUDIT); 1891 SECURITY_CAP_NOAUDIT);
1884 rcu_read_unlock(); 1892 rcu_read_unlock();
1885 return ret; 1893 return ret;
1886} 1894}
1887 1895
1888static inline int security_sysctl(struct ctl_table *table, int op)
1889{
1890 return 0;
1891}
1892
1893static inline int security_quotactl(int cmds, int type, int id, 1896static inline int security_quotactl(int cmds, int type, int id,
1894 struct super_block *sb) 1897 struct super_block *sb)
1895{ 1898{
@@ -1901,12 +1904,13 @@ static inline int security_quota_on(struct dentry *dentry)
1901 return 0; 1904 return 0;
1902} 1905}
1903 1906
1904static inline int security_syslog(int type, bool from_file) 1907static inline int security_syslog(int type)
1905{ 1908{
1906 return cap_syslog(type, from_file); 1909 return 0;
1907} 1910}
1908 1911
1909static inline int security_settime(struct timespec *ts, struct timezone *tz) 1912static inline int security_settime(const struct timespec *ts,
1913 const struct timezone *tz)
1910{ 1914{
1911 return cap_settime(ts, tz); 1915 return cap_settime(ts, tz);
1912} 1916}
@@ -1966,6 +1970,11 @@ static inline int security_sb_copy_data(char *orig, char *copy)
1966 return 0; 1970 return 0;
1967} 1971}
1968 1972
1973static inline int security_sb_remount(struct super_block *sb, void *data)
1974{
1975 return 0;
1976}
1977
1969static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) 1978static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1970{ 1979{
1971 return 0; 1980 return 0;
@@ -2025,6 +2034,7 @@ static inline void security_inode_free(struct inode *inode)
2025 2034
2026static inline int security_inode_init_security(struct inode *inode, 2035static inline int security_inode_init_security(struct inode *inode,
2027 struct inode *dir, 2036 struct inode *dir,
2037 const struct qstr *qstr,
2028 char **name, 2038 char **name,
2029 void **value, 2039 void **value,
2030 size_t *len) 2040 size_t *len)
@@ -2103,6 +2113,12 @@ static inline int security_inode_permission(struct inode *inode, int mask)
2103 return 0; 2113 return 0;
2104} 2114}
2105 2115
2116static inline int security_inode_exec_permission(struct inode *inode,
2117 unsigned int flags)
2118{
2119 return 0;
2120}
2121
2106static inline int security_inode_setattr(struct dentry *dentry, 2122static inline int security_inode_setattr(struct dentry *dentry,
2107 struct iattr *attr) 2123 struct iattr *attr)
2108{ 2124{
@@ -2526,8 +2542,7 @@ static inline int security_inode_getsecctx(struct inode *inode, void **ctx, u32
2526 2542
2527#ifdef CONFIG_SECURITY_NETWORK 2543#ifdef CONFIG_SECURITY_NETWORK
2528 2544
2529int security_unix_stream_connect(struct socket *sock, struct socket *other, 2545int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
2530 struct sock *newsk);
2531int security_unix_may_send(struct socket *sock, struct socket *other); 2546int security_unix_may_send(struct socket *sock, struct socket *other);
2532int security_socket_create(int family, int type, int protocol, int kern); 2547int security_socket_create(int family, int type, int protocol, int kern);
2533int security_socket_post_create(struct socket *sock, int family, 2548int security_socket_post_create(struct socket *sock, int family,
@@ -2568,8 +2583,8 @@ void security_tun_dev_post_create(struct sock *sk);
2568int security_tun_dev_attach(struct sock *sk); 2583int security_tun_dev_attach(struct sock *sk);
2569 2584
2570#else /* CONFIG_SECURITY_NETWORK */ 2585#else /* CONFIG_SECURITY_NETWORK */
2571static inline int security_unix_stream_connect(struct socket *sock, 2586static inline int security_unix_stream_connect(struct sock *sock,
2572 struct socket *other, 2587 struct sock *other,
2573 struct sock *newsk) 2588 struct sock *newsk)
2574{ 2589{
2575 return 0; 2590 return 0;
@@ -2758,7 +2773,8 @@ int security_xfrm_state_delete(struct xfrm_state *x);
2758void security_xfrm_state_free(struct xfrm_state *x); 2773void security_xfrm_state_free(struct xfrm_state *x);
2759int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 2774int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2760int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2775int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2761 struct xfrm_policy *xp, struct flowi *fl); 2776 struct xfrm_policy *xp,
2777 const struct flowi *fl);
2762int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2778int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
2763void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); 2779void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2764 2780
@@ -2810,7 +2826,7 @@ static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_s
2810} 2826}
2811 2827
2812static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2828static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2813 struct xfrm_policy *xp, struct flowi *fl) 2829 struct xfrm_policy *xp, const struct flowi *fl)
2814{ 2830{
2815 return 1; 2831 return 1;
2816} 2832}
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index 5310d27abd2a..39fa04966aa8 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -29,9 +29,6 @@ struct semaphore {
29#define DEFINE_SEMAPHORE(name) \ 29#define DEFINE_SEMAPHORE(name) \
30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) 30 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
31 31
32#define DECLARE_MUTEX(name) \
33 struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
34
35static inline void sema_init(struct semaphore *sem, int val) 32static inline void sema_init(struct semaphore *sem, int val)
36{ 33{
37 static struct lock_class_key __key; 34 static struct lock_class_key __key;
@@ -39,9 +36,6 @@ static inline void sema_init(struct semaphore *sem, int val)
39 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0); 36 lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
40} 37}
41 38
42#define init_MUTEX(sem) sema_init(sem, 1)
43#define init_MUTEX_LOCKED(sem) sema_init(sem, 0)
44
45extern void down(struct semaphore *sem); 39extern void down(struct semaphore *sem);
46extern int __must_check down_interruptible(struct semaphore *sem); 40extern int __must_check down_interruptible(struct semaphore *sem);
47extern int __must_check down_killable(struct semaphore *sem); 41extern int __must_check down_killable(struct semaphore *sem);
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 632205ccc25d..06d69648fc86 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -88,12 +88,12 @@ static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
88 unsigned ret; 88 unsigned ret;
89 89
90repeat: 90repeat:
91 ret = sl->sequence; 91 ret = ACCESS_ONCE(sl->sequence);
92 smp_rmb();
93 if (unlikely(ret & 1)) { 92 if (unlikely(ret & 1)) {
94 cpu_relax(); 93 cpu_relax();
95 goto repeat; 94 goto repeat;
96 } 95 }
96 smp_rmb();
97 97
98 return ret; 98 return ret;
99} 99}
@@ -107,7 +107,7 @@ static __always_inline int read_seqretry(const seqlock_t *sl, unsigned start)
107{ 107{
108 smp_rmb(); 108 smp_rmb();
109 109
110 return (sl->sequence != start); 110 return unlikely(sl->sequence != start);
111} 111}
112 112
113 113
@@ -125,14 +125,25 @@ typedef struct seqcount {
125#define SEQCNT_ZERO { 0 } 125#define SEQCNT_ZERO { 0 }
126#define seqcount_init(x) do { *(x) = (seqcount_t) SEQCNT_ZERO; } while (0) 126#define seqcount_init(x) do { *(x) = (seqcount_t) SEQCNT_ZERO; } while (0)
127 127
128/* Start of read using pointer to a sequence counter only. */ 128/**
129static inline unsigned read_seqcount_begin(const seqcount_t *s) 129 * __read_seqcount_begin - begin a seq-read critical section (without barrier)
130 * @s: pointer to seqcount_t
131 * Returns: count to be passed to read_seqcount_retry
132 *
133 * __read_seqcount_begin is like read_seqcount_begin, but has no smp_rmb()
134 * barrier. Callers should ensure that smp_rmb() or equivalent ordering is
135 * provided before actually loading any of the variables that are to be
136 * protected in this critical section.
137 *
138 * Use carefully, only in critical code, and comment how the barrier is
139 * provided.
140 */
141static inline unsigned __read_seqcount_begin(const seqcount_t *s)
130{ 142{
131 unsigned ret; 143 unsigned ret;
132 144
133repeat: 145repeat:
134 ret = s->sequence; 146 ret = s->sequence;
135 smp_rmb();
136 if (unlikely(ret & 1)) { 147 if (unlikely(ret & 1)) {
137 cpu_relax(); 148 cpu_relax();
138 goto repeat; 149 goto repeat;
@@ -140,14 +151,56 @@ repeat:
140 return ret; 151 return ret;
141} 152}
142 153
143/* 154/**
144 * Test if reader processed invalid data because sequence number has changed. 155 * read_seqcount_begin - begin a seq-read critical section
156 * @s: pointer to seqcount_t
157 * Returns: count to be passed to read_seqcount_retry
158 *
159 * read_seqcount_begin opens a read critical section of the given seqcount.
160 * Validity of the critical section is tested by checking read_seqcount_retry
161 * function.
162 */
163static inline unsigned read_seqcount_begin(const seqcount_t *s)
164{
165 unsigned ret = __read_seqcount_begin(s);
166 smp_rmb();
167 return ret;
168}
169
170/**
171 * __read_seqcount_retry - end a seq-read critical section (without barrier)
172 * @s: pointer to seqcount_t
173 * @start: count, from read_seqcount_begin
174 * Returns: 1 if retry is required, else 0
175 *
176 * __read_seqcount_retry is like read_seqcount_retry, but has no smp_rmb()
177 * barrier. Callers should ensure that smp_rmb() or equivalent ordering is
178 * provided before actually loading any of the variables that are to be
179 * protected in this critical section.
180 *
181 * Use carefully, only in critical code, and comment how the barrier is
182 * provided.
183 */
184static inline int __read_seqcount_retry(const seqcount_t *s, unsigned start)
185{
186 return unlikely(s->sequence != start);
187}
188
189/**
190 * read_seqcount_retry - end a seq-read critical section
191 * @s: pointer to seqcount_t
192 * @start: count, from read_seqcount_begin
193 * Returns: 1 if retry is required, else 0
194 *
195 * read_seqcount_retry closes a read critical section of the given seqcount.
196 * If the critical section was invalid, it must be ignored (and typically
197 * retried).
145 */ 198 */
146static inline int read_seqcount_retry(const seqcount_t *s, unsigned start) 199static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
147{ 200{
148 smp_rmb(); 201 smp_rmb();
149 202
150 return s->sequence != start; 203 return __read_seqcount_retry(s, start);
151} 204}
152 205
153 206
@@ -167,6 +220,19 @@ static inline void write_seqcount_end(seqcount_t *s)
167 s->sequence++; 220 s->sequence++;
168} 221}
169 222
223/**
224 * write_seqcount_barrier - invalidate in-progress read-side seq operations
225 * @s: pointer to seqcount_t
226 *
227 * After write_seqcount_barrier, no read-side seq operations will complete
228 * successfully and see data older than this.
229 */
230static inline void write_seqcount_barrier(seqcount_t *s)
231{
232 smp_wmb();
233 s->sequence+=2;
234}
235
170/* 236/*
171 * Possible sw/hw IRQ protected versions of the interfaces. 237 * Possible sw/hw IRQ protected versions of the interfaces.
172 */ 238 */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 212eb4c67797..758c5b0c6fd3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -95,7 +95,7 @@
95/* PPC CPM type number */ 95/* PPC CPM type number */
96#define PORT_CPM 58 96#define PORT_CPM 58
97 97
98/* MPC52xx type numbers */ 98/* MPC52xx (and MPC512x) type numbers */
99#define PORT_MPC52xx 59 99#define PORT_MPC52xx 59
100 100
101/* IBM icom */ 101/* IBM icom */
@@ -199,6 +199,9 @@
199/* TI OMAP-UART */ 199/* TI OMAP-UART */
200#define PORT_OMAP 96 200#define PORT_OMAP 96
201 201
202/* VIA VT8500 SoC */
203#define PORT_VT8500 97
204
202#ifdef __KERNEL__ 205#ifdef __KERNEL__
203 206
204#include <linux/compiler.h> 207#include <linux/compiler.h>
@@ -209,6 +212,7 @@
209#include <linux/tty.h> 212#include <linux/tty.h>
210#include <linux/mutex.h> 213#include <linux/mutex.h>
211#include <linux/sysrq.h> 214#include <linux/sysrq.h>
215#include <linux/pps_kernel.h>
212 216
213struct uart_port; 217struct uart_port;
214struct serial_struct; 218struct serial_struct;
@@ -311,6 +315,7 @@ struct uart_port {
311#define UPIO_TSI (5) /* Tsi108/109 type IO */ 315#define UPIO_TSI (5) /* Tsi108/109 type IO */
312#define UPIO_DWAPB (6) /* DesignWare APB UART */ 316#define UPIO_DWAPB (6) /* DesignWare APB UART */
313#define UPIO_RM9000 (7) /* RM9000 type IO */ 317#define UPIO_RM9000 (7) /* RM9000 type IO */
318#define UPIO_DWAPB32 (8) /* DesignWare APB UART (32 bit accesses) */
314 319
315 unsigned int read_status_mask; /* driver specific */ 320 unsigned int read_status_mask; /* driver specific */
316 unsigned int ignore_status_mask; /* driver specific */ 321 unsigned int ignore_status_mask; /* driver specific */
@@ -361,6 +366,7 @@ struct uart_port {
361 struct device *dev; /* parent device */ 366 struct device *dev; /* parent device */
362 unsigned char hub6; /* this should be in the 8250 driver */ 367 unsigned char hub6; /* this should be in the 8250 driver */
363 unsigned char suspended; 368 unsigned char suspended;
369 unsigned char irq_wake;
364 unsigned char unused[2]; 370 unsigned char unused[2];
365 void *private_data; /* generic platform data pointer */ 371 void *private_data; /* generic platform data pointer */
366}; 372};
@@ -523,10 +529,10 @@ uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
523 struct uart_state *state = uport->state; 529 struct uart_state *state = uport->state;
524 struct tty_port *port = &state->port; 530 struct tty_port *port = &state->port;
525 struct tty_ldisc *ld = tty_ldisc_ref(port->tty); 531 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
526 struct timespec ts; 532 struct pps_event_time ts;
527 533
528 if (ld && ld->ops->dcd_change) 534 if (ld && ld->ops->dcd_change)
529 getnstimeofday(&ts); 535 pps_get_ts(&ts);
530 536
531 uport->icount.dcd++; 537 uport->icount.dcd++;
532#ifdef CONFIG_HARD_PPS 538#ifdef CONFIG_HARD_PPS
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index c7a0ce11cd47..3ecb71a9e505 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -99,6 +99,13 @@
99#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ 99#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
100#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ 100#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
101 101
102/*
103 * Access to some registers depends on register access / configuration
104 * mode.
105 */
106#define UART_LCR_CONF_MODE_A UART_LCR_DLAB /* Configutation mode A */
107#define UART_LCR_CONF_MODE_B 0xBF /* Configutation mode B */
108
102#define UART_MCR 4 /* Out: Modem Control Register */ 109#define UART_MCR 4 /* Out: Modem Control Register */
103#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ 110#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */
104#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ 111#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */
@@ -341,5 +348,17 @@
341#define UART_OMAP_SYSS 0x16 /* System status register */ 348#define UART_OMAP_SYSS 0x16 /* System status register */
342#define UART_OMAP_WER 0x17 /* Wake-up enable register */ 349#define UART_OMAP_WER 0x17 /* Wake-up enable register */
343 350
351/*
352 * These are the definitions for the MDR1 register
353 */
354#define UART_OMAP_MDR1_16X_MODE 0x00 /* UART 16x mode */
355#define UART_OMAP_MDR1_SIR_MODE 0x01 /* SIR mode */
356#define UART_OMAP_MDR1_16X_ABAUD_MODE 0x02 /* UART 16x auto-baud */
357#define UART_OMAP_MDR1_13X_MODE 0x03 /* UART 13x mode */
358#define UART_OMAP_MDR1_MIR_MODE 0x04 /* MIR mode */
359#define UART_OMAP_MDR1_FIR_MODE 0x05 /* FIR mode */
360#define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */
361#define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */
362
344#endif /* _LINUX_SERIAL_REG_H */ 363#endif /* _LINUX_SERIAL_REG_H */
345 364
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index baed2122c5a6..a2afc9fbe186 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -8,6 +8,23 @@
8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
9 */ 9 */
10 10
11enum {
12 SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */
13 SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */
14 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
15 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
16 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */
17};
18
19#define SCSCR_TIE (1 << 7)
20#define SCSCR_RIE (1 << 6)
21#define SCSCR_TE (1 << 5)
22#define SCSCR_RE (1 << 4)
23#define SCSCR_REIE (1 << 3) /* not supported by all parts */
24#define SCSCR_TOIE (1 << 2) /* not supported by all parts */
25#define SCSCR_CKE1 (1 << 1)
26#define SCSCR_CKE0 (1 << 0)
27
11/* Offsets into the sci_port->irqs array */ 28/* Offsets into the sci_port->irqs array */
12enum { 29enum {
13 SCIx_ERI_IRQ, 30 SCIx_ERI_IRQ,
@@ -17,23 +34,32 @@ enum {
17 SCIx_NR_IRQS, 34 SCIx_NR_IRQS,
18}; 35};
19 36
37#define SCIx_IRQ_MUXED(irq) \
38{ \
39 [SCIx_ERI_IRQ] = (irq), \
40 [SCIx_RXI_IRQ] = (irq), \
41 [SCIx_TXI_IRQ] = (irq), \
42 [SCIx_BRI_IRQ] = (irq), \
43}
44
20struct device; 45struct device;
21 46
22/* 47/*
23 * Platform device specific platform_data struct 48 * Platform device specific platform_data struct
24 */ 49 */
25struct plat_sci_port { 50struct plat_sci_port {
26 void __iomem *membase; /* io cookie */
27 unsigned long mapbase; /* resource base */ 51 unsigned long mapbase; /* resource base */
28 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 52 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
29 unsigned int type; /* SCI / SCIF / IRDA */ 53 unsigned int type; /* SCI / SCIF / IRDA */
30 upf_t flags; /* UPF_* flags */ 54 upf_t flags; /* UPF_* flags */
31 char *clk; /* clock string */ 55
56 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
57 unsigned int scscr; /* SCSCR initialization */
58
32 struct device *dma_dev; 59 struct device *dma_dev;
33#ifdef CONFIG_SERIAL_SH_SCI_DMA 60
34 unsigned int dma_slave_tx; 61 unsigned int dma_slave_tx;
35 unsigned int dma_slave_rx; 62 unsigned int dma_slave_rx;
36#endif
37}; 63};
38 64
39#endif /* __LINUX_SERIAL_SCI_H */ 65#endif /* __LINUX_SERIAL_SCI_H */
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index 0299b4ce63db..fe817918b30e 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -70,9 +70,6 @@
70#define SFI_SIG_APIC "APIC" 70#define SFI_SIG_APIC "APIC"
71#define SFI_SIG_XSDT "XSDT" 71#define SFI_SIG_XSDT "XSDT"
72#define SFI_SIG_WAKE "WAKE" 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#define SFI_SIG_DEVS "DEVS" 73#define SFI_SIG_DEVS "DEVS"
77#define SFI_SIG_GPIO "GPIO" 74#define SFI_SIG_GPIO "GPIO"
78 75
@@ -80,6 +77,8 @@
80#define SFI_OEM_ID_SIZE 6 77#define SFI_OEM_ID_SIZE 6
81#define SFI_OEM_TABLE_ID_SIZE 8 78#define SFI_OEM_TABLE_ID_SIZE 8
82 79
80#define SFI_NAME_LEN 16
81
83#define SFI_SYST_SEARCH_BEGIN 0x000E0000 82#define SFI_SYST_SEARCH_BEGIN 0x000E0000
84#define SFI_SYST_SEARCH_END 0x000FFFFF 83#define SFI_SYST_SEARCH_END 0x000FFFFF
85 84
@@ -159,34 +158,13 @@ struct sfi_device_table_entry {
159 u16 addr; 158 u16 addr;
160 u8 irq; 159 u8 irq;
161 u32 max_freq; 160 u32 max_freq;
162 char name[16]; 161 char name[SFI_NAME_LEN];
163} __packed; 162} __packed;
164 163
165struct sfi_gpio_table_entry { 164struct sfi_gpio_table_entry {
166 char controller_name[16]; 165 char controller_name[SFI_NAME_LEN];
167 u16 pin_no; 166 u16 pin_no;
168 char pin_name[16]; 167 char pin_name[SFI_NAME_LEN];
169} __packed;
170
171struct sfi_spi_table_entry {
172 u16 host_num; /* attached to host 0, 1...*/
173 u16 cs; /* chip select */
174 u16 irq_info;
175 char name[16];
176 u8 dev_info[10];
177} __packed;
178
179struct sfi_i2c_table_entry {
180 u16 host_num;
181 u16 addr; /* slave addr */
182 u16 irq_info;
183 char name[16];
184 u8 dev_info[10];
185} __packed;
186
187struct sfi_gpe_table_entry {
188 u16 logical_id; /* logical id */
189 u16 phys_id; /* physical GPE id */
190} __packed; 168} __packed;
191 169
192typedef int (*sfi_table_handler) (struct sfi_table_header *table); 170typedef int (*sfi_table_handler) (struct sfi_table_header *table);
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 4dca992f3093..9a52f72527dc 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -19,11 +19,13 @@ struct clk_mapping {
19}; 19};
20 20
21struct clk_ops { 21struct clk_ops {
22#ifdef CONFIG_SH_CLK_CPG_LEGACY
22 void (*init)(struct clk *clk); 23 void (*init)(struct clk *clk);
24#endif
23 int (*enable)(struct clk *clk); 25 int (*enable)(struct clk *clk);
24 void (*disable)(struct clk *clk); 26 void (*disable)(struct clk *clk);
25 unsigned long (*recalc)(struct clk *clk); 27 unsigned long (*recalc)(struct clk *clk);
26 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); 28 int (*set_rate)(struct clk *clk, unsigned long rate);
27 int (*set_parent)(struct clk *clk, struct clk *parent); 29 int (*set_parent)(struct clk *clk, struct clk *parent);
28 long (*round_rate)(struct clk *clk, unsigned long rate); 30 long (*round_rate)(struct clk *clk, unsigned long rate);
29}; 31};
@@ -67,36 +69,6 @@ int clk_register(struct clk *);
67void clk_unregister(struct clk *); 69void clk_unregister(struct clk *);
68void clk_enable_init_clocks(void); 70void clk_enable_init_clocks(void);
69 71
70/**
71 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
72 * @clk: clock source
73 * @rate: desired clock rate in Hz
74 * @algo_id: algorithm id to be passed down to ops->set_rate
75 *
76 * Returns success (0) or negative errno.
77 */
78int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
79
80enum clk_sh_algo_id {
81 NO_CHANGE = 0,
82
83 IUS_N1_N1,
84 IUS_322,
85 IUS_522,
86 IUS_N11,
87
88 SB_N1,
89
90 SB3_N1,
91 SB3_32,
92 SB3_43,
93 SB3_54,
94
95 BP_N1,
96
97 IP_N1,
98};
99
100struct clk_div_mult_table { 72struct clk_div_mult_table {
101 unsigned int *divisors; 73 unsigned int *divisors;
102 unsigned int nr_divisors; 74 unsigned int nr_divisors;
@@ -122,6 +94,10 @@ int clk_rate_table_find(struct clk *clk,
122long clk_rate_div_range_round(struct clk *clk, unsigned int div_min, 94long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
123 unsigned int div_max, unsigned long rate); 95 unsigned int div_max, unsigned long rate);
124 96
97long clk_round_parent(struct clk *clk, unsigned long target,
98 unsigned long *best_freq, unsigned long *parent_freq,
99 unsigned int div_min, unsigned int div_max);
100
125#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 101#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
126{ \ 102{ \
127 .parent = _parent, \ 103 .parent = _parent, \
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index b4f183a31f13..5812fefbcedf 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -79,7 +79,7 @@ struct intc_hw_desc {
79 unsigned int nr_subgroups; 79 unsigned int nr_subgroups;
80}; 80};
81 81
82#define _INTC_ARRAY(a) a, a == NULL ? 0 : sizeof(a)/sizeof(*a) 82#define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a)
83 83
84#define INTC_HW_DESC(vectors, groups, mask_regs, \ 84#define INTC_HW_DESC(vectors, groups, mask_regs, \
85 prio_regs, sense_regs, ack_regs) \ 85 prio_regs, sense_regs, ack_regs) \
@@ -129,7 +129,4 @@ static inline int register_intc_userimask(unsigned long addr)
129} 129}
130#endif 130#endif
131 131
132int reserve_irq_vector(unsigned int irq);
133void reserve_irq_legacy(void);
134
135#endif /* __SH_INTC_H */ 132#endif /* __SH_INTC_H */
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 864bd56bd3b0..4d9dcd138315 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -5,7 +5,6 @@ struct sh_timer_config {
5 char *name; 5 char *name;
6 long channel_offset; 6 long channel_offset;
7 int timer_bit; 7 int timer_bit;
8 char *clk;
9 unsigned long clockevent_rating; 8 unsigned long clockevent_rating;
10 unsigned long clocksource_rating; 9 unsigned long clocksource_rating;
11}; 10};
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
new file mode 100644
index 000000000000..e2accb3164d8
--- /dev/null
+++ b/include/linux/sigma.h
@@ -0,0 +1,60 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 u32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 u16 len;
44 u16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | sa->len;
51}
52
53static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
54{
55 return sizeof(*sa) + payload_len + (payload_len % 2);
56}
57
58extern int process_sigma_firmware(struct i2c_client *client, const char *name);
59
60#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index fcd2b14b1932..a822300a253b 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -7,6 +7,8 @@
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/list.h> 8#include <linux/list.h>
9 9
10struct task_struct;
11
10/* for sysctl */ 12/* for sysctl */
11extern int print_fatal_signals; 13extern int print_fatal_signals;
12/* 14/*
@@ -123,13 +125,13 @@ _SIG_SET_BINOP(sigorsets, _sig_or)
123#define _sig_and(x,y) ((x) & (y)) 125#define _sig_and(x,y) ((x) & (y))
124_SIG_SET_BINOP(sigandsets, _sig_and) 126_SIG_SET_BINOP(sigandsets, _sig_and)
125 127
126#define _sig_nand(x,y) ((x) & ~(y)) 128#define _sig_andn(x,y) ((x) & ~(y))
127_SIG_SET_BINOP(signandsets, _sig_nand) 129_SIG_SET_BINOP(sigandnsets, _sig_andn)
128 130
129#undef _SIG_SET_BINOP 131#undef _SIG_SET_BINOP
130#undef _sig_or 132#undef _sig_or
131#undef _sig_and 133#undef _sig_and
132#undef _sig_nand 134#undef _sig_andn
133 135
134#define _SIG_SET_OP(name, op) \ 136#define _SIG_SET_OP(name, op) \
135static inline void name(sigset_t *set) \ 137static inline void name(sigset_t *set) \
@@ -234,6 +236,9 @@ static inline int valid_signal(unsigned long sig)
234 return sig <= _NSIG ? 1 : 0; 236 return sig <= _NSIG ? 1 : 0;
235} 237}
236 238
239struct timespec;
240struct pt_regs;
241
237extern int next_signal(struct sigpending *pending, sigset_t *mask); 242extern int next_signal(struct sigpending *pending, sigset_t *mask);
238extern int do_send_sig_info(int sig, struct siginfo *info, 243extern int do_send_sig_info(int sig, struct siginfo *info,
239 struct task_struct *p, bool group); 244 struct task_struct *p, bool group);
@@ -242,10 +247,12 @@ extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
242extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, 247extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
243 siginfo_t *info); 248 siginfo_t *info);
244extern long do_sigpending(void __user *, unsigned long); 249extern long do_sigpending(void __user *, unsigned long);
250extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
251 const struct timespec *);
245extern int sigprocmask(int, sigset_t *, sigset_t *); 252extern int sigprocmask(int, sigset_t *, sigset_t *);
253extern void set_current_blocked(const sigset_t *);
246extern int show_unhandled_signals; 254extern int show_unhandled_signals;
247 255
248struct pt_regs;
249extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
250extern void exit_signals(struct task_struct *tsk); 257extern void exit_signals(struct task_struct *tsk);
251 258
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index b363b916c909..3ff4961da9b5 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -33,6 +33,7 @@ struct signalfd_siginfo {
33 __u64 ssi_utime; 33 __u64 ssi_utime;
34 __u64 ssi_stime; 34 __u64 ssi_stime;
35 __u64 ssi_addr; 35 __u64 ssi_addr;
36 __u16 ssi_addr_lsb;
36 37
37 /* 38 /*
38 * Pad strcture to 128 bytes. Remember to update the 39 * Pad strcture to 128 bytes. Remember to update the
@@ -43,7 +44,7 @@ struct signalfd_siginfo {
43 * comes out of a read(2) and we really don't want to have 44 * comes out of a read(2) and we really don't want to have
44 * a compat on read(2). 45 * a compat on read(2).
45 */ 46 */
46 __u8 __pad[48]; 47 __u8 __pad[46];
47}; 48};
48 49
49 50
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index e6ba898de61c..16c9c091555d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -122,8 +122,14 @@ struct sk_buff_head {
122 122
123struct sk_buff; 123struct sk_buff;
124 124
125/* To allow 64K frame to be packed as single skb without frag_list */ 125/* To allow 64K frame to be packed as single skb without frag_list. Since
126 * GRO uses frags we allocate at least 16 regardless of page size.
127 */
128#if (65536/PAGE_SIZE + 2) < 16
129#define MAX_SKB_FRAGS 16UL
130#else
126#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 131#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
132#endif
127 133
128typedef struct skb_frag_struct skb_frag_t; 134typedef struct skb_frag_struct skb_frag_t;
129 135
@@ -255,6 +261,11 @@ typedef unsigned int sk_buff_data_t;
255typedef unsigned char *sk_buff_data_t; 261typedef unsigned char *sk_buff_data_t;
256#endif 262#endif
257 263
264#if defined(CONFIG_NF_DEFRAG_IPV4) || defined(CONFIG_NF_DEFRAG_IPV4_MODULE) || \
265 defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
266#define NET_SKBUFF_NF_DEFRAG_NEEDED 1
267#endif
268
258/** 269/**
259 * struct sk_buff - socket buffer 270 * struct sk_buff - socket buffer
260 * @next: Next buffer in list 271 * @next: Next buffer in list
@@ -362,6 +373,8 @@ struct sk_buff {
362 void (*destructor)(struct sk_buff *skb); 373 void (*destructor)(struct sk_buff *skb);
363#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 374#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
364 struct nf_conntrack *nfct; 375 struct nf_conntrack *nfct;
376#endif
377#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
365 struct sk_buff *nfct_reasm; 378 struct sk_buff *nfct_reasm;
366#endif 379#endif
367#ifdef CONFIG_BRIDGE_NETFILTER 380#ifdef CONFIG_BRIDGE_NETFILTER
@@ -378,17 +391,15 @@ struct sk_buff {
378 391
379 __u32 rxhash; 392 __u32 rxhash;
380 393
394 __u16 queue_mapping;
381 kmemcheck_bitfield_begin(flags2); 395 kmemcheck_bitfield_begin(flags2);
382 __u16 queue_mapping:16;
383#ifdef CONFIG_IPV6_NDISC_NODETYPE 396#ifdef CONFIG_IPV6_NDISC_NODETYPE
384 __u8 ndisc_nodetype:2, 397 __u8 ndisc_nodetype:2;
385 deliver_no_wcard:1;
386#else
387 __u8 deliver_no_wcard:1;
388#endif 398#endif
399 __u8 ooo_okay:1;
389 kmemcheck_bitfield_end(flags2); 400 kmemcheck_bitfield_end(flags2);
390 401
391 /* 0/14 bit hole */ 402 /* 0/13 bit hole */
392 403
393#ifdef CONFIG_NET_DMA 404#ifdef CONFIG_NET_DMA
394 dma_cookie_t dma_cookie; 405 dma_cookie_t dma_cookie;
@@ -463,7 +474,7 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
463extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); 474extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst);
464 475
465/** 476/**
466 * skb_dst_is_noref - Test if skb dst isnt refcounted 477 * skb_dst_is_noref - Test if skb dst isn't refcounted
467 * @skb: buffer 478 * @skb: buffer
468 */ 479 */
469static inline bool skb_dst_is_noref(const struct sk_buff *skb) 480static inline bool skb_dst_is_noref(const struct sk_buff *skb)
@@ -1354,6 +1365,11 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1354} 1365}
1355#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1366#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1356 1367
1368static inline int skb_checksum_start_offset(const struct sk_buff *skb)
1369{
1370 return skb->csum_start - skb_headroom(skb);
1371}
1372
1357static inline int skb_transport_offset(const struct sk_buff *skb) 1373static inline int skb_transport_offset(const struct sk_buff *skb)
1358{ 1374{
1359 return skb_transport_header(skb) - skb->data; 1375 return skb_transport_header(skb) - skb->data;
@@ -1766,7 +1782,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1766 1782
1767#define skb_queue_walk(queue, skb) \ 1783#define skb_queue_walk(queue, skb) \
1768 for (skb = (queue)->next; \ 1784 for (skb = (queue)->next; \
1769 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1785 skb != (struct sk_buff *)(queue); \
1770 skb = skb->next) 1786 skb = skb->next)
1771 1787
1772#define skb_queue_walk_safe(queue, skb, tmp) \ 1788#define skb_queue_walk_safe(queue, skb, tmp) \
@@ -1775,7 +1791,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1775 skb = tmp, tmp = skb->next) 1791 skb = tmp, tmp = skb->next)
1776 1792
1777#define skb_queue_walk_from(queue, skb) \ 1793#define skb_queue_walk_from(queue, skb) \
1778 for (; prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1794 for (; skb != (struct sk_buff *)(queue); \
1779 skb = skb->next) 1795 skb = skb->next)
1780 1796
1781#define skb_queue_walk_from_safe(queue, skb, tmp) \ 1797#define skb_queue_walk_from_safe(queue, skb, tmp) \
@@ -1785,9 +1801,18 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1785 1801
1786#define skb_queue_reverse_walk(queue, skb) \ 1802#define skb_queue_reverse_walk(queue, skb) \
1787 for (skb = (queue)->prev; \ 1803 for (skb = (queue)->prev; \
1788 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1804 skb != (struct sk_buff *)(queue); \
1789 skb = skb->prev) 1805 skb = skb->prev)
1790 1806
1807#define skb_queue_reverse_walk_safe(queue, skb, tmp) \
1808 for (skb = (queue)->prev, tmp = skb->prev; \
1809 skb != (struct sk_buff *)(queue); \
1810 skb = tmp, tmp = skb->prev)
1811
1812#define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \
1813 for (tmp = skb->prev; \
1814 skb != (struct sk_buff *)(queue); \
1815 skb = tmp, tmp = skb->prev)
1791 1816
1792static inline bool skb_has_frag_list(const struct sk_buff *skb) 1817static inline bool skb_has_frag_list(const struct sk_buff *skb)
1793{ 1818{
@@ -1855,7 +1880,7 @@ extern void skb_split(struct sk_buff *skb,
1855extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 1880extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1856 int shiftlen); 1881 int shiftlen);
1857 1882
1858extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1883extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features);
1859 1884
1860static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1885static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1861 int len, void *buffer) 1886 int len, void *buffer)
@@ -2051,6 +2076,8 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
2051 if (nfct) 2076 if (nfct)
2052 atomic_inc(&nfct->use); 2077 atomic_inc(&nfct->use);
2053} 2078}
2079#endif
2080#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2054static inline void nf_conntrack_get_reasm(struct sk_buff *skb) 2081static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
2055{ 2082{
2056 if (skb) 2083 if (skb)
@@ -2079,6 +2106,8 @@ static inline void nf_reset(struct sk_buff *skb)
2079#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2106#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2080 nf_conntrack_put(skb->nfct); 2107 nf_conntrack_put(skb->nfct);
2081 skb->nfct = NULL; 2108 skb->nfct = NULL;
2109#endif
2110#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2082 nf_conntrack_put_reasm(skb->nfct_reasm); 2111 nf_conntrack_put_reasm(skb->nfct_reasm);
2083 skb->nfct_reasm = NULL; 2112 skb->nfct_reasm = NULL;
2084#endif 2113#endif
@@ -2095,6 +2124,8 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2095 dst->nfct = src->nfct; 2124 dst->nfct = src->nfct;
2096 nf_conntrack_get(src->nfct); 2125 nf_conntrack_get(src->nfct);
2097 dst->nfctinfo = src->nfctinfo; 2126 dst->nfctinfo = src->nfctinfo;
2127#endif
2128#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2098 dst->nfct_reasm = src->nfct_reasm; 2129 dst->nfct_reasm = src->nfct_reasm;
2099 nf_conntrack_get_reasm(src->nfct_reasm); 2130 nf_conntrack_get_reasm(src->nfct_reasm);
2100#endif 2131#endif
@@ -2108,6 +2139,8 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2108{ 2139{
2109#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2140#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2110 nf_conntrack_put(dst->nfct); 2141 nf_conntrack_put(dst->nfct);
2142#endif
2143#ifdef NET_SKBUFF_NF_DEFRAG_NEEDED
2111 nf_conntrack_put_reasm(dst->nfct_reasm); 2144 nf_conntrack_put_reasm(dst->nfct_reasm);
2112#endif 2145#endif
2113#ifdef CONFIG_BRIDGE_NETFILTER 2146#ifdef CONFIG_BRIDGE_NETFILTER
@@ -2164,8 +2197,9 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
2164 return skb->queue_mapping != 0; 2197 return skb->queue_mapping != 0;
2165} 2198}
2166 2199
2167extern u16 skb_tx_hash(const struct net_device *dev, 2200extern u16 __skb_tx_hash(const struct net_device *dev,
2168 const struct sk_buff *skb); 2201 const struct sk_buff *skb,
2202 unsigned int num_tx_queues);
2169 2203
2170#ifdef CONFIG_XFRM 2204#ifdef CONFIG_XFRM
2171static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2205static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 59260e21bdf5..ad4dd1c8d30a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -105,9 +105,6 @@ void kmem_cache_destroy(struct kmem_cache *);
105int kmem_cache_shrink(struct kmem_cache *); 105int kmem_cache_shrink(struct kmem_cache *);
106void kmem_cache_free(struct kmem_cache *, void *); 106void kmem_cache_free(struct kmem_cache *, void *);
107unsigned int kmem_cache_size(struct kmem_cache *); 107unsigned int kmem_cache_size(struct kmem_cache *);
108const char *kmem_cache_name(struct kmem_cache *);
109int kern_ptr_validate(const void *ptr, unsigned long size);
110int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
111 108
112/* 109/*
113 * Please use this macro to create slab caches. Simply specify the 110 * Please use this macro to create slab caches. Simply specify the
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 791a502f6906..83203ae9390b 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -138,11 +138,12 @@ void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
138void *__kmalloc(size_t size, gfp_t flags); 138void *__kmalloc(size_t size, gfp_t flags);
139 139
140#ifdef CONFIG_TRACING 140#ifdef CONFIG_TRACING
141extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags); 141extern void *kmem_cache_alloc_trace(size_t size,
142 struct kmem_cache *cachep, gfp_t flags);
142extern size_t slab_buffer_size(struct kmem_cache *cachep); 143extern size_t slab_buffer_size(struct kmem_cache *cachep);
143#else 144#else
144static __always_inline void * 145static __always_inline void *
145kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags) 146kmem_cache_alloc_trace(size_t size, struct kmem_cache *cachep, gfp_t flags)
146{ 147{
147 return kmem_cache_alloc(cachep, flags); 148 return kmem_cache_alloc(cachep, flags);
148} 149}
@@ -179,10 +180,7 @@ found:
179#endif 180#endif
180 cachep = malloc_sizes[i].cs_cachep; 181 cachep = malloc_sizes[i].cs_cachep;
181 182
182 ret = kmem_cache_alloc_notrace(cachep, flags); 183 ret = kmem_cache_alloc_trace(size, cachep, flags);
183
184 trace_kmalloc(_THIS_IP_, ret,
185 size, slab_buffer_size(cachep), flags);
186 184
187 return ret; 185 return ret;
188 } 186 }
@@ -194,14 +192,16 @@ extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
194extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 192extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
195 193
196#ifdef CONFIG_TRACING 194#ifdef CONFIG_TRACING
197extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, 195extern void *kmem_cache_alloc_node_trace(size_t size,
198 gfp_t flags, 196 struct kmem_cache *cachep,
199 int nodeid); 197 gfp_t flags,
198 int nodeid);
200#else 199#else
201static __always_inline void * 200static __always_inline void *
202kmem_cache_alloc_node_notrace(struct kmem_cache *cachep, 201kmem_cache_alloc_node_trace(size_t size,
203 gfp_t flags, 202 struct kmem_cache *cachep,
204 int nodeid) 203 gfp_t flags,
204 int nodeid)
205{ 205{
206 return kmem_cache_alloc_node(cachep, flags, nodeid); 206 return kmem_cache_alloc_node(cachep, flags, nodeid);
207} 207}
@@ -210,7 +210,6 @@ kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
210static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 210static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
211{ 211{
212 struct kmem_cache *cachep; 212 struct kmem_cache *cachep;
213 void *ret;
214 213
215 if (__builtin_constant_p(size)) { 214 if (__builtin_constant_p(size)) {
216 int i = 0; 215 int i = 0;
@@ -234,13 +233,7 @@ found:
234#endif 233#endif
235 cachep = malloc_sizes[i].cs_cachep; 234 cachep = malloc_sizes[i].cs_cachep;
236 235
237 ret = kmem_cache_alloc_node_notrace(cachep, flags, node); 236 return kmem_cache_alloc_node_trace(size, cachep, flags, node);
238
239 trace_kmalloc_node(_THIS_IP_, ret,
240 size, slab_buffer_size(cachep),
241 flags, node);
242
243 return ret;
244 } 237 }
245 return __kmalloc_node(size, flags, node); 238 return __kmalloc_node(size, flags, node);
246} 239}
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index e4f5ed180b9b..45ca123e8002 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,9 +10,8 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <linux/kmemleak.h>
14 13
15#include <trace/events/kmem.h> 14#include <linux/kmemleak.h>
16 15
17enum stat_item { 16enum stat_item {
18 ALLOC_FASTPATH, /* Allocation from cpu slab */ 17 ALLOC_FASTPATH, /* Allocation from cpu slab */
@@ -33,10 +32,14 @@ enum stat_item {
33 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ 32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
34 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ 33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
35 ORDER_FALLBACK, /* Number of times fallback was necessary */ 34 ORDER_FALLBACK, /* Number of times fallback was necessary */
35 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
36 NR_SLUB_STAT_ITEMS }; 36 NR_SLUB_STAT_ITEMS };
37 37
38struct kmem_cache_cpu { 38struct kmem_cache_cpu {
39 void **freelist; /* Pointer to first free per cpu object */ 39 void **freelist; /* Pointer to next available object */
40#ifdef CONFIG_CMPXCHG_LOCAL
41 unsigned long tid; /* Globally unique transaction id */
42#endif
40 struct page *page; /* The slab from which we are allocating */ 43 struct page *page; /* The slab from which we are allocating */
41 int node; /* The node of the page (or -1 for debug) */ 44 int node; /* The node of the page (or -1 for debug) */
42#ifdef CONFIG_SLUB_STATS 45#ifdef CONFIG_SLUB_STATS
@@ -71,6 +74,7 @@ struct kmem_cache {
71 struct kmem_cache_cpu __percpu *cpu_slab; 74 struct kmem_cache_cpu __percpu *cpu_slab;
72 /* Used for retriving partial slabs etc */ 75 /* Used for retriving partial slabs etc */
73 unsigned long flags; 76 unsigned long flags;
77 unsigned long min_partial;
74 int size; /* The size of an object including meta data */ 78 int size; /* The size of an object including meta data */
75 int objsize; /* The size of an object without meta data */ 79 int objsize; /* The size of an object without meta data */
76 int offset; /* Free pointer offset. */ 80 int offset; /* Free pointer offset. */
@@ -84,7 +88,7 @@ struct kmem_cache {
84 void (*ctor)(void *); 88 void (*ctor)(void *);
85 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
86 int align; /* Alignment */ 90 int align; /* Alignment */
87 unsigned long min_partial; 91 int reserved; /* Reserved bytes at the end of slabs */
88 const char *name; /* Name (only for display!) */ 92 const char *name; /* Name (only for display!) */
89 struct list_head list; /* List of slab caches */ 93 struct list_head list; /* List of slab caches */
90#ifdef CONFIG_SYSFS 94#ifdef CONFIG_SYSFS
@@ -216,31 +220,40 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
216void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 220void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
217void *__kmalloc(size_t size, gfp_t flags); 221void *__kmalloc(size_t size, gfp_t flags);
218 222
223static __always_inline void *
224kmalloc_order(size_t size, gfp_t flags, unsigned int order)
225{
226 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);
227 kmemleak_alloc(ret, size, 1, flags);
228 return ret;
229}
230
219#ifdef CONFIG_TRACING 231#ifdef CONFIG_TRACING
220extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags); 232extern void *
233kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size);
234extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
221#else 235#else
222static __always_inline void * 236static __always_inline void *
223kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags) 237kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size)
224{ 238{
225 return kmem_cache_alloc(s, gfpflags); 239 return kmem_cache_alloc(s, gfpflags);
226} 240}
241
242static __always_inline void *
243kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
244{
245 return kmalloc_order(size, flags, order);
246}
227#endif 247#endif
228 248
229static __always_inline void *kmalloc_large(size_t size, gfp_t flags) 249static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
230{ 250{
231 unsigned int order = get_order(size); 251 unsigned int order = get_order(size);
232 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); 252 return kmalloc_order_trace(size, flags, order);
233
234 kmemleak_alloc(ret, size, 1, flags);
235 trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags);
236
237 return ret;
238} 253}
239 254
240static __always_inline void *kmalloc(size_t size, gfp_t flags) 255static __always_inline void *kmalloc(size_t size, gfp_t flags)
241{ 256{
242 void *ret;
243
244 if (__builtin_constant_p(size)) { 257 if (__builtin_constant_p(size)) {
245 if (size > SLUB_MAX_SIZE) 258 if (size > SLUB_MAX_SIZE)
246 return kmalloc_large(size, flags); 259 return kmalloc_large(size, flags);
@@ -251,11 +264,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
251 if (!s) 264 if (!s)
252 return ZERO_SIZE_PTR; 265 return ZERO_SIZE_PTR;
253 266
254 ret = kmem_cache_alloc_notrace(s, flags); 267 return kmem_cache_alloc_trace(s, flags, size);
255
256 trace_kmalloc(_THIS_IP_, ret, size, s->size, flags);
257
258 return ret;
259 } 268 }
260 } 269 }
261 return __kmalloc(size, flags); 270 return __kmalloc(size, flags);
@@ -266,14 +275,14 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node);
266void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 275void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
267 276
268#ifdef CONFIG_TRACING 277#ifdef CONFIG_TRACING
269extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s, 278extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
270 gfp_t gfpflags, 279 gfp_t gfpflags,
271 int node); 280 int node, size_t size);
272#else 281#else
273static __always_inline void * 282static __always_inline void *
274kmem_cache_alloc_node_notrace(struct kmem_cache *s, 283kmem_cache_alloc_node_trace(struct kmem_cache *s,
275 gfp_t gfpflags, 284 gfp_t gfpflags,
276 int node) 285 int node, size_t size)
277{ 286{
278 return kmem_cache_alloc_node(s, gfpflags, node); 287 return kmem_cache_alloc_node(s, gfpflags, node);
279} 288}
@@ -281,8 +290,6 @@ kmem_cache_alloc_node_notrace(struct kmem_cache *s,
281 290
282static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 291static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
283{ 292{
284 void *ret;
285
286 if (__builtin_constant_p(size) && 293 if (__builtin_constant_p(size) &&
287 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) { 294 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
288 struct kmem_cache *s = kmalloc_slab(size); 295 struct kmem_cache *s = kmalloc_slab(size);
@@ -290,12 +297,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
290 if (!s) 297 if (!s)
291 return ZERO_SIZE_PTR; 298 return ZERO_SIZE_PTR;
292 299
293 ret = kmem_cache_alloc_node_notrace(s, flags, node); 300 return kmem_cache_alloc_node_trace(s, flags, node, size);
294
295 trace_kmalloc_node(_THIS_IP_, ret,
296 size, s->size, flags, node);
297
298 return ret;
299 } 301 }
300 return __kmalloc_node(size, flags, node); 302 return __kmalloc_node(size, flags, node);
301} 303}
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index 214f93209b8c..02fde50a79a5 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -172,3 +172,11 @@ struct sm501_platdata {
172 struct sm501_platdata_gpio_i2c *gpio_i2c; 172 struct sm501_platdata_gpio_i2c *gpio_i2c;
173 unsigned int gpio_i2c_nr; 173 unsigned int gpio_i2c_nr;
174}; 174};
175
176#if defined(CONFIG_PPC32)
177#define smc501_readl(addr) ioread32be((addr))
178#define smc501_writel(val, addr) iowrite32be((val), (addr))
179#else
180#define smc501_readl(addr) readl(addr)
181#define smc501_writel(val, addr) writel(val, addr)
182#endif
diff --git a/include/linux/smb.h b/include/linux/smb.h
deleted file mode 100644
index 82fefddc5987..000000000000
--- a/include/linux/smb.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * smb.h
3 *
4 * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _LINUX_SMB_H
10#define _LINUX_SMB_H
11
12#include <linux/types.h>
13#include <linux/magic.h>
14#ifdef __KERNEL__
15#include <linux/time.h>
16#endif
17
18enum smb_protocol {
19 SMB_PROTOCOL_NONE,
20 SMB_PROTOCOL_CORE,
21 SMB_PROTOCOL_COREPLUS,
22 SMB_PROTOCOL_LANMAN1,
23 SMB_PROTOCOL_LANMAN2,
24 SMB_PROTOCOL_NT1
25};
26
27enum smb_case_hndl {
28 SMB_CASE_DEFAULT,
29 SMB_CASE_LOWER,
30 SMB_CASE_UPPER
31};
32
33struct smb_dskattr {
34 __u16 total;
35 __u16 allocblocks;
36 __u16 blocksize;
37 __u16 free;
38};
39
40struct smb_conn_opt {
41
42 /* The socket */
43 unsigned int fd;
44
45 enum smb_protocol protocol;
46 enum smb_case_hndl case_handling;
47
48 /* Connection-Options */
49
50 __u32 max_xmit;
51 __u16 server_uid;
52 __u16 tid;
53
54 /* The following are LANMAN 1.0 options */
55 __u16 secmode;
56 __u16 maxmux;
57 __u16 maxvcs;
58 __u16 rawmode;
59 __u32 sesskey;
60
61 /* The following are NT LM 0.12 options */
62 __u32 maxraw;
63 __u32 capabilities;
64 __s16 serverzone;
65};
66
67#ifdef __KERNEL__
68
69#define SMB_NLS_MAXNAMELEN 20
70struct smb_nls_codepage {
71 char local_name[SMB_NLS_MAXNAMELEN];
72 char remote_name[SMB_NLS_MAXNAMELEN];
73};
74
75
76#define SMB_MAXNAMELEN 255
77#define SMB_MAXPATHLEN 1024
78
79/*
80 * Contains all relevant data on a SMB networked file.
81 */
82struct smb_fattr {
83 __u16 attr;
84
85 unsigned long f_ino;
86 umode_t f_mode;
87 nlink_t f_nlink;
88 uid_t f_uid;
89 gid_t f_gid;
90 dev_t f_rdev;
91 loff_t f_size;
92 struct timespec f_atime;
93 struct timespec f_mtime;
94 struct timespec f_ctime;
95 unsigned long f_blocks;
96 int f_unix;
97};
98
99enum smb_conn_state {
100 CONN_VALID, /* everything's fine */
101 CONN_INVALID, /* Something went wrong, but did not
102 try to reconnect yet. */
103 CONN_RETRIED, /* Tried a reconnection, but was refused */
104 CONN_RETRYING /* Currently trying to reconnect */
105};
106
107#define SMB_HEADER_LEN 37 /* includes everything up to, but not
108 * including smb_bcc */
109
110#define SMB_INITIAL_PACKET_SIZE 4000
111#define SMB_MAX_PACKET_SIZE 32768
112
113/* reserve this much space for trans2 parameters. Shouldn't have to be more
114 than 10 or so, but OS/2 seems happier like this. */
115#define SMB_TRANS2_MAX_PARAM 64
116
117#endif
118#endif
diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h
deleted file mode 100644
index 923cd8a247b1..000000000000
--- a/include/linux/smb_fs.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * smb_fs.h
3 *
4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _LINUX_SMB_FS_H
10#define _LINUX_SMB_FS_H
11
12#include <linux/smb.h>
13
14/*
15 * ioctl commands
16 */
17#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t)
18#define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt)
19
20/* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */
21#define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t)
22
23
24#ifdef __KERNEL__
25#include <linux/smb_fs_i.h>
26#include <linux/smb_fs_sb.h>
27
28#include <linux/fs.h>
29#include <linux/pagemap.h>
30#include <linux/vmalloc.h>
31#include <linux/smb_mount.h>
32#include <linux/jiffies.h>
33#include <asm/unaligned.h>
34
35static inline struct smb_sb_info *SMB_SB(struct super_block *sb)
36{
37 return sb->s_fs_info;
38}
39
40static inline struct smb_inode_info *SMB_I(struct inode *inode)
41{
42 return container_of(inode, struct smb_inode_info, vfs_inode);
43}
44
45/* macro names are short for word, double-word, long value (?) */
46#define WVAL(buf, pos) (get_unaligned_le16((u8 *)(buf) + (pos)))
47#define DVAL(buf, pos) (get_unaligned_le32((u8 *)(buf) + (pos)))
48#define LVAL(buf, pos) (get_unaligned_le64((u8 *)(buf) + (pos)))
49
50#define WSET(buf, pos, val) put_unaligned_le16((val), (u8 *)(buf) + (pos))
51#define DSET(buf, pos, val) put_unaligned_le32((val), (u8 *)(buf) + (pos))
52#define LSET(buf, pos, val) put_unaligned_le64((val), (u8 *)(buf) + (pos))
53
54/* where to find the base of the SMB packet proper */
55#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
56
57/*
58 * Flags for the in-memory inode
59 */
60#define SMB_F_LOCALWRITE 0x02 /* file modified locally */
61
62
63/* NT1 protocol capability bits */
64#define SMB_CAP_RAW_MODE 0x00000001
65#define SMB_CAP_MPX_MODE 0x00000002
66#define SMB_CAP_UNICODE 0x00000004
67#define SMB_CAP_LARGE_FILES 0x00000008
68#define SMB_CAP_NT_SMBS 0x00000010
69#define SMB_CAP_RPC_REMOTE_APIS 0x00000020
70#define SMB_CAP_STATUS32 0x00000040
71#define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080
72#define SMB_CAP_LOCK_AND_READ 0x00000100
73#define SMB_CAP_NT_FIND 0x00000200
74#define SMB_CAP_DFS 0x00001000
75#define SMB_CAP_LARGE_READX 0x00004000
76#define SMB_CAP_LARGE_WRITEX 0x00008000
77#define SMB_CAP_UNIX 0x00800000 /* unofficial ... */
78
79
80/*
81 * This is the time we allow an inode, dentry or dir cache to live. It is bad
82 * for performance to have shorter ttl on an inode than on the cache. It can
83 * cause refresh on each inode for a dir listing ... one-by-one
84 */
85#define SMB_MAX_AGE(server) (((server)->mnt->ttl * HZ) / 1000)
86
87static inline void
88smb_age_dentry(struct smb_sb_info *server, struct dentry *dentry)
89{
90 dentry->d_time = jiffies - SMB_MAX_AGE(server);
91}
92
93struct smb_cache_head {
94 time_t mtime; /* unused */
95 unsigned long time; /* cache age */
96 unsigned long end; /* last valid fpos in cache */
97 int eof;
98};
99
100#define SMB_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *)))
101union smb_dir_cache {
102 struct smb_cache_head head;
103 struct dentry *dentry[SMB_DIRCACHE_SIZE];
104};
105
106#define SMB_FIRSTCACHE_SIZE ((int)((SMB_DIRCACHE_SIZE * \
107 sizeof(struct dentry *) - sizeof(struct smb_cache_head)) / \
108 sizeof(struct dentry *)))
109
110#define SMB_DIRCACHE_START (SMB_DIRCACHE_SIZE - SMB_FIRSTCACHE_SIZE)
111
112struct smb_cache_control {
113 struct smb_cache_head head;
114 struct page *page;
115 union smb_dir_cache *cache;
116 unsigned long fpos, ofs;
117 int filled, valid, idx;
118};
119
120#define SMB_OPS_NUM_STATIC 5
121struct smb_ops {
122 int (*read)(struct inode *inode, loff_t offset, int count,
123 char *data);
124 int (*write)(struct inode *inode, loff_t offset, int count, const
125 char *data);
126 int (*readdir)(struct file *filp, void *dirent, filldir_t filldir,
127 struct smb_cache_control *ctl);
128
129 int (*getattr)(struct smb_sb_info *server, struct dentry *dir,
130 struct smb_fattr *fattr);
131 /* int (*setattr)(...); */ /* setattr is really icky! */
132
133 int (*truncate)(struct inode *inode, loff_t length);
134
135
136 /* --- --- --- end of "static" entries --- --- --- */
137
138 int (*convert)(unsigned char *output, int olen,
139 const unsigned char *input, int ilen,
140 struct nls_table *nls_from,
141 struct nls_table *nls_to);
142};
143
144static inline int
145smb_is_open(struct inode *i)
146{
147 return (SMB_I(i)->open == server_from_inode(i)->generation);
148}
149
150extern void smb_install_null_ops(struct smb_ops *);
151#endif /* __KERNEL__ */
152
153#endif /* _LINUX_SMB_FS_H */
diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h
deleted file mode 100644
index 8ccf4eca2c3d..000000000000
--- a/include/linux/smb_fs_i.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * smb_fs_i.h
3 *
4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _LINUX_SMB_FS_I
10#define _LINUX_SMB_FS_I
11
12#include <linux/types.h>
13#include <linux/fs.h>
14
15/*
16 * smb fs inode data (in memory only)
17 */
18struct smb_inode_info {
19
20 /*
21 * file handles are local to a connection. A file is open if
22 * (open == generation).
23 */
24 unsigned int open; /* open generation */
25 __u16 fileid; /* What id to handle a file with? */
26 __u16 attr; /* Attribute fields, DOS value */
27
28 __u16 access; /* Access mode */
29 __u16 flags;
30 unsigned long oldmtime; /* last time refreshed */
31 unsigned long closed; /* timestamp when closed */
32 unsigned openers; /* number of fileid users */
33
34 struct inode vfs_inode; /* must be at the end */
35};
36
37#endif
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
deleted file mode 100644
index bb947dd1fba9..000000000000
--- a/include/linux/smb_fs_sb.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * smb_fs_sb.h
3 *
4 * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _SMB_FS_SB
10#define _SMB_FS_SB
11
12#include <linux/types.h>
13#include <linux/backing-dev.h>
14#include <linux/smb.h>
15
16/*
17 * Upper limit on the total number of active smb_request structs.
18 */
19#define MAX_REQUEST_HARD 256
20
21enum smb_receive_state {
22 SMB_RECV_START, /* No data read, looking for length + sig */
23 SMB_RECV_HEADER, /* Reading the header data */
24 SMB_RECV_HCOMPLETE, /* Done with the header */
25 SMB_RECV_PARAM, /* Reading parameter words */
26 SMB_RECV_DATA, /* Reading data bytes */
27 SMB_RECV_END, /* End of request */
28 SMB_RECV_DROP, /* Dropping this SMB */
29 SMB_RECV_REQUEST, /* Received a request and not a reply */
30};
31
32/* structure access macros */
33#define server_from_inode(inode) SMB_SB((inode)->i_sb)
34#define server_from_dentry(dentry) SMB_SB((dentry)->d_sb)
35#define SB_of(server) ((server)->super_block)
36
37struct smb_sb_info {
38 /* List of all smbfs superblocks */
39 struct list_head entry;
40
41 enum smb_conn_state state;
42 struct file * sock_file;
43 int conn_error;
44 enum smb_receive_state rstate;
45
46 atomic_t nr_requests;
47 struct list_head xmitq;
48 struct list_head recvq;
49 u16 mid;
50
51 struct smb_mount_data_kernel *mnt;
52
53 /* Connections are counted. Each time a new socket arrives,
54 * generation is incremented.
55 */
56 unsigned int generation;
57 struct pid *conn_pid;
58 struct smb_conn_opt opt;
59 wait_queue_head_t conn_wq;
60 int conn_complete;
61 struct semaphore sem;
62
63 unsigned char header[SMB_HEADER_LEN + 20*2 + 2];
64 u32 header_len;
65 u32 smb_len;
66 u32 smb_read;
67
68 /* We use our own data_ready callback, but need the original one */
69 void *data_ready;
70
71 /* nls pointers for codepage conversions */
72 struct nls_table *remote_nls;
73 struct nls_table *local_nls;
74
75 struct smb_ops *ops;
76
77 struct super_block *super_block;
78
79 struct backing_dev_info bdi;
80};
81
82static inline int
83smb_lock_server_interruptible(struct smb_sb_info *server)
84{
85 return down_interruptible(&(server->sem));
86}
87
88static inline void
89smb_lock_server(struct smb_sb_info *server)
90{
91 down(&(server->sem));
92}
93
94static inline void
95smb_unlock_server(struct smb_sb_info *server)
96{
97 up(&(server->sem));
98}
99
100#endif
diff --git a/include/linux/smb_mount.h b/include/linux/smb_mount.h
deleted file mode 100644
index d10f00cb5703..000000000000
--- a/include/linux/smb_mount.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * smb_mount.h
3 *
4 * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
6 *
7 */
8
9#ifndef _LINUX_SMB_MOUNT_H
10#define _LINUX_SMB_MOUNT_H
11
12#include <linux/types.h>
13
14#define SMB_MOUNT_VERSION 6
15
16struct smb_mount_data {
17 int version;
18 __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */
19 __kernel_uid_t uid;
20 __kernel_gid_t gid;
21 __kernel_mode_t file_mode;
22 __kernel_mode_t dir_mode;
23};
24
25
26#ifdef __KERNEL__
27
28/* "vers" in big-endian */
29#define SMB_MOUNT_ASCII 0x76657273
30
31#define SMB_MOUNT_OLDVERSION 6
32#undef SMB_MOUNT_VERSION
33#define SMB_MOUNT_VERSION 7
34
35/* flags */
36#define SMB_MOUNT_WIN95 0x0001 /* Win 95 server */
37#define SMB_MOUNT_OLDATTR 0x0002 /* Use core getattr (Win 95 speedup) */
38#define SMB_MOUNT_DIRATTR 0x0004 /* Use find_first for getattr */
39#define SMB_MOUNT_CASE 0x0008 /* Be case sensitive */
40#define SMB_MOUNT_UNICODE 0x0010 /* Server talks unicode */
41#define SMB_MOUNT_UID 0x0020 /* Use user specified uid */
42#define SMB_MOUNT_GID 0x0040 /* Use user specified gid */
43#define SMB_MOUNT_FMODE 0x0080 /* Use user specified file mode */
44#define SMB_MOUNT_DMODE 0x0100 /* Use user specified dir mode */
45
46struct smb_mount_data_kernel {
47 int version;
48
49 uid_t mounted_uid; /* Who may umount() this filesystem? */
50 uid_t uid;
51 gid_t gid;
52 mode_t file_mode;
53 mode_t dir_mode;
54
55 u32 flags;
56
57 /* maximum age in jiffies (inode, dentry and dircache) */
58 int ttl;
59
60 struct smb_nls_codepage codepage;
61};
62
63#endif
64
65#endif
diff --git a/include/linux/smbno.h b/include/linux/smbno.h
deleted file mode 100644
index f99e02d9ffe2..000000000000
--- a/include/linux/smbno.h
+++ /dev/null
@@ -1,363 +0,0 @@
1#ifndef _SMBNO_H_
2#define _SMBNO_H_
3
4/* these define the attribute byte as seen by DOS */
5#define aRONLY (1L<<0)
6#define aHIDDEN (1L<<1)
7#define aSYSTEM (1L<<2)
8#define aVOLID (1L<<3)
9#define aDIR (1L<<4)
10#define aARCH (1L<<5)
11
12/* error classes */
13#define SUCCESS 0 /* The request was successful. */
14#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */
15#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/
16#define ERRHRD 0x03 /* Error is an hardware error. */
17#define ERRCMD 0xFF /* Command was not in the "SMB" format. */
18
19/* SMB X/Open error codes for the ERRdos error class */
20
21#define ERRbadfunc 1 /* Invalid function (or system call) */
22#define ERRbadfile 2 /* File not found (pathname error) */
23#define ERRbadpath 3 /* Directory not found */
24#define ERRnofids 4 /* Too many open files */
25#define ERRnoaccess 5 /* Access denied */
26#define ERRbadfid 6 /* Invalid fid */
27#define ERRbadmcb 7 /* Memory control blocks destroyed */
28#define ERRnomem 8 /* Out of memory */
29#define ERRbadmem 9 /* Invalid memory block address */
30#define ERRbadenv 10 /* Invalid environment */
31#define ERRbadformat 11 /* Invalid format */
32#define ERRbadaccess 12 /* Invalid open mode */
33#define ERRbaddata 13 /* Invalid data (only from ioctl call) */
34#define ERRres 14 /* reserved */
35#define ERRbaddrive 15 /* Invalid drive */
36#define ERRremcd 16 /* Attempt to delete current directory */
37#define ERRdiffdevice 17 /* rename/move across different filesystems */
38#define ERRnofiles 18 /* no more files found in file search */
39#define ERRbadshare 32 /* Share mode on file conflict with open mode */
40#define ERRlock 33 /* Lock request conflicts with existing lock */
41#define ERRfilexists 80 /* File in operation already exists */
42#define ERRbadpipe 230 /* Named pipe invalid */
43#define ERRpipebusy 231 /* All instances of pipe are busy */
44#define ERRpipeclosing 232 /* named pipe close in progress */
45#define ERRnotconnected 233 /* No process on other end of named pipe */
46#define ERRmoredata 234 /* More data to be returned */
47
48#define ERROR_INVALID_PARAMETER 87
49#define ERROR_DISK_FULL 112
50#define ERROR_INVALID_NAME 123
51#define ERROR_DIR_NOT_EMPTY 145
52#define ERROR_NOT_LOCKED 158
53#define ERROR_ALREADY_EXISTS 183 /* see also 80 ? */
54#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */
55#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
56
57/* Error codes for the ERRSRV class */
58
59#define ERRerror 1 /* Non specific error code */
60#define ERRbadpw 2 /* Bad password */
61#define ERRbadtype 3 /* reserved */
62#define ERRaccess 4 /* No permissions to do the requested operation */
63#define ERRinvnid 5 /* tid invalid */
64#define ERRinvnetname 6 /* Invalid servername */
65#define ERRinvdevice 7 /* Invalid device */
66#define ERRqfull 49 /* Print queue full */
67#define ERRqtoobig 50 /* Queued item too big */
68#define ERRinvpfid 52 /* Invalid print file in smb_fid */
69#define ERRsmbcmd 64 /* Unrecognised command */
70#define ERRsrverror 65 /* smb server internal error */
71#define ERRfilespecs 67 /* fid and pathname invalid combination */
72#define ERRbadlink 68 /* reserved */
73#define ERRbadpermits 69 /* Access specified for a file is not valid */
74#define ERRbadpid 70 /* reserved */
75#define ERRsetattrmode 71 /* attribute mode invalid */
76#define ERRpaused 81 /* Message server paused */
77#define ERRmsgoff 82 /* Not receiving messages */
78#define ERRnoroom 83 /* No room for message */
79#define ERRrmuns 87 /* too many remote usernames */
80#define ERRtimeout 88 /* operation timed out */
81#define ERRnoresource 89 /* No resources currently available for request. */
82#define ERRtoomanyuids 90 /* too many userids */
83#define ERRbaduid 91 /* bad userid */
84#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */
85#define ERRuseSTD 251 /* temporarily unable to use raw mode, use std.mode */
86#define ERRcontMPX 252 /* resume MPX mode */
87#define ERRbadPW /* reserved */
88#define ERRnosupport 0xFFFF
89
90/* Error codes for the ERRHRD class */
91
92#define ERRnowrite 19 /* read only media */
93#define ERRbadunit 20 /* Unknown device */
94#define ERRnotready 21 /* Drive not ready */
95#define ERRbadcmd 22 /* Unknown command */
96#define ERRdata 23 /* Data (CRC) error */
97#define ERRbadreq 24 /* Bad request structure length */
98#define ERRseek 25
99#define ERRbadmedia 26
100#define ERRbadsector 27
101#define ERRnopaper 28
102#define ERRwrite 29 /* write fault */
103#define ERRread 30 /* read fault */
104#define ERRgeneral 31 /* General hardware failure */
105#define ERRwrongdisk 34
106#define ERRFCBunavail 35
107#define ERRsharebufexc 36 /* share buffer exceeded */
108#define ERRdiskfull 39
109
110/*
111 * Access modes when opening a file
112 */
113#define SMB_ACCMASK 0x0003
114#define SMB_O_RDONLY 0x0000
115#define SMB_O_WRONLY 0x0001
116#define SMB_O_RDWR 0x0002
117
118/* offsets into message for common items */
119#define smb_com 8
120#define smb_rcls 9
121#define smb_reh 10
122#define smb_err 11
123#define smb_flg 13
124#define smb_flg2 14
125#define smb_reb 13
126#define smb_tid 28
127#define smb_pid 30
128#define smb_uid 32
129#define smb_mid 34
130#define smb_wct 36
131#define smb_vwv 37
132#define smb_vwv0 37
133#define smb_vwv1 39
134#define smb_vwv2 41
135#define smb_vwv3 43
136#define smb_vwv4 45
137#define smb_vwv5 47
138#define smb_vwv6 49
139#define smb_vwv7 51
140#define smb_vwv8 53
141#define smb_vwv9 55
142#define smb_vwv10 57
143#define smb_vwv11 59
144#define smb_vwv12 61
145#define smb_vwv13 63
146#define smb_vwv14 65
147
148/* these are the trans2 sub fields for primary requests */
149#define smb_tpscnt smb_vwv0
150#define smb_tdscnt smb_vwv1
151#define smb_mprcnt smb_vwv2
152#define smb_mdrcnt smb_vwv3
153#define smb_msrcnt smb_vwv4
154#define smb_flags smb_vwv5
155#define smb_timeout smb_vwv6
156#define smb_pscnt smb_vwv9
157#define smb_psoff smb_vwv10
158#define smb_dscnt smb_vwv11
159#define smb_dsoff smb_vwv12
160#define smb_suwcnt smb_vwv13
161#define smb_setup smb_vwv14
162#define smb_setup0 smb_setup
163#define smb_setup1 (smb_setup+2)
164#define smb_setup2 (smb_setup+4)
165
166/* these are for the secondary requests */
167#define smb_spscnt smb_vwv2
168#define smb_spsoff smb_vwv3
169#define smb_spsdisp smb_vwv4
170#define smb_sdscnt smb_vwv5
171#define smb_sdsoff smb_vwv6
172#define smb_sdsdisp smb_vwv7
173#define smb_sfid smb_vwv8
174
175/* and these for responses */
176#define smb_tprcnt smb_vwv0
177#define smb_tdrcnt smb_vwv1
178#define smb_prcnt smb_vwv3
179#define smb_proff smb_vwv4
180#define smb_prdisp smb_vwv5
181#define smb_drcnt smb_vwv6
182#define smb_droff smb_vwv7
183#define smb_drdisp smb_vwv8
184
185/* the complete */
186#define SMBmkdir 0x00 /* create directory */
187#define SMBrmdir 0x01 /* delete directory */
188#define SMBopen 0x02 /* open file */
189#define SMBcreate 0x03 /* create file */
190#define SMBclose 0x04 /* close file */
191#define SMBflush 0x05 /* flush file */
192#define SMBunlink 0x06 /* delete file */
193#define SMBmv 0x07 /* rename file */
194#define SMBgetatr 0x08 /* get file attributes */
195#define SMBsetatr 0x09 /* set file attributes */
196#define SMBread 0x0A /* read from file */
197#define SMBwrite 0x0B /* write to file */
198#define SMBlock 0x0C /* lock byte range */
199#define SMBunlock 0x0D /* unlock byte range */
200#define SMBctemp 0x0E /* create temporary file */
201#define SMBmknew 0x0F /* make new file */
202#define SMBchkpth 0x10 /* check directory path */
203#define SMBexit 0x11 /* process exit */
204#define SMBlseek 0x12 /* seek */
205#define SMBtcon 0x70 /* tree connect */
206#define SMBtconX 0x75 /* tree connect and X*/
207#define SMBtdis 0x71 /* tree disconnect */
208#define SMBnegprot 0x72 /* negotiate protocol */
209#define SMBdskattr 0x80 /* get disk attributes */
210#define SMBsearch 0x81 /* search directory */
211#define SMBsplopen 0xC0 /* open print spool file */
212#define SMBsplwr 0xC1 /* write to print spool file */
213#define SMBsplclose 0xC2 /* close print spool file */
214#define SMBsplretq 0xC3 /* return print queue */
215#define SMBsends 0xD0 /* send single block message */
216#define SMBsendb 0xD1 /* send broadcast message */
217#define SMBfwdname 0xD2 /* forward user name */
218#define SMBcancelf 0xD3 /* cancel forward */
219#define SMBgetmac 0xD4 /* get machine name */
220#define SMBsendstrt 0xD5 /* send start of multi-block message */
221#define SMBsendend 0xD6 /* send end of multi-block message */
222#define SMBsendtxt 0xD7 /* send text of multi-block message */
223
224/* Core+ protocol */
225#define SMBlockread 0x13 /* Lock a range and read */
226#define SMBwriteunlock 0x14 /* Unlock a range then write */
227#define SMBreadbraw 0x1a /* read a block of data with no smb header */
228#define SMBwritebraw 0x1d /* write a block of data with no smb header */
229#define SMBwritec 0x20 /* secondary write request */
230#define SMBwriteclose 0x2c /* write a file then close it */
231
232/* dos extended protocol */
233#define SMBreadBraw 0x1A /* read block raw */
234#define SMBreadBmpx 0x1B /* read block multiplexed */
235#define SMBreadBs 0x1C /* read block (secondary response) */
236#define SMBwriteBraw 0x1D /* write block raw */
237#define SMBwriteBmpx 0x1E /* write block multiplexed */
238#define SMBwriteBs 0x1F /* write block (secondary request) */
239#define SMBwriteC 0x20 /* write complete response */
240#define SMBsetattrE 0x22 /* set file attributes expanded */
241#define SMBgetattrE 0x23 /* get file attributes expanded */
242#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
243#define SMBtrans 0x25 /* transaction - name, bytes in/out */
244#define SMBtranss 0x26 /* transaction (secondary request/response) */
245#define SMBioctl 0x27 /* IOCTL */
246#define SMBioctls 0x28 /* IOCTL (secondary request/response) */
247#define SMBcopy 0x29 /* copy */
248#define SMBmove 0x2A /* move */
249#define SMBecho 0x2B /* echo */
250#define SMBopenX 0x2D /* open and X */
251#define SMBreadX 0x2E /* read and X */
252#define SMBwriteX 0x2F /* write and X */
253#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
254#define SMBtconX 0x75 /* tree connect and X */
255#define SMBffirst 0x82 /* find first */
256#define SMBfunique 0x83 /* find unique */
257#define SMBfclose 0x84 /* find close */
258#define SMBinvalid 0xFE /* invalid command */
259
260
261/* Extended 2.0 protocol */
262#define SMBtrans2 0x32 /* TRANS2 protocol set */
263#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
264#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
265#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
266#define SMBulogoffX 0x74 /* user logoff */
267
268/* these are the TRANS2 sub commands */
269#define TRANSACT2_OPEN 0
270#define TRANSACT2_FINDFIRST 1
271#define TRANSACT2_FINDNEXT 2
272#define TRANSACT2_QFSINFO 3
273#define TRANSACT2_SETFSINFO 4
274#define TRANSACT2_QPATHINFO 5
275#define TRANSACT2_SETPATHINFO 6
276#define TRANSACT2_QFILEINFO 7
277#define TRANSACT2_SETFILEINFO 8
278#define TRANSACT2_FSCTL 9
279#define TRANSACT2_IOCTL 10
280#define TRANSACT2_FINDNOTIFYFIRST 11
281#define TRANSACT2_FINDNOTIFYNEXT 12
282#define TRANSACT2_MKDIR 13
283
284/* Information Levels - Shared? */
285#define SMB_INFO_STANDARD 1
286#define SMB_INFO_QUERY_EA_SIZE 2
287#define SMB_INFO_QUERY_EAS_FROM_LIST 3
288#define SMB_INFO_QUERY_ALL_EAS 4
289#define SMB_INFO_IS_NAME_VALID 6
290
291/* Information Levels - TRANSACT2_FINDFIRST */
292#define SMB_FIND_FILE_DIRECTORY_INFO 0x101
293#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
294#define SMB_FIND_FILE_NAMES_INFO 0x103
295#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
296
297/* Information Levels - TRANSACT2_QPATHINFO */
298#define SMB_QUERY_FILE_BASIC_INFO 0x101
299#define SMB_QUERY_FILE_STANDARD_INFO 0x102
300#define SMB_QUERY_FILE_EA_INFO 0x103
301#define SMB_QUERY_FILE_NAME_INFO 0x104
302#define SMB_QUERY_FILE_ALL_INFO 0x107
303#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108
304#define SMB_QUERY_FILE_STREAM_INFO 0x109
305#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10b
306
307/* Information Levels - TRANSACT2_SETFILEINFO */
308#define SMB_SET_FILE_BASIC_INFO 0x101
309#define SMB_SET_FILE_DISPOSITION_INFO 0x102
310#define SMB_SET_FILE_ALLOCATION_INFO 0x103
311#define SMB_SET_FILE_END_OF_FILE_INFO 0x104
312
313/* smb_flg field flags */
314#define SMB_FLAGS_SUPPORT_LOCKREAD 0x01
315#define SMB_FLAGS_CLIENT_BUF_AVAIL 0x02
316#define SMB_FLAGS_RESERVED 0x04
317#define SMB_FLAGS_CASELESS_PATHNAMES 0x08
318#define SMB_FLAGS_CANONICAL_PATHNAMES 0x10
319#define SMB_FLAGS_REQUEST_OPLOCK 0x20
320#define SMB_FLAGS_REQUEST_BATCH_OPLOCK 0x40
321#define SMB_FLAGS_REPLY 0x80
322
323/* smb_flg2 field flags (samba-2.2.0/source/include/smb.h) */
324#define SMB_FLAGS2_LONG_PATH_COMPONENTS 0x0001
325#define SMB_FLAGS2_EXTENDED_ATTRIBUTES 0x0002
326#define SMB_FLAGS2_DFS_PATHNAMES 0x1000
327#define SMB_FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000
328#define SMB_FLAGS2_32_BIT_ERROR_CODES 0x4000
329#define SMB_FLAGS2_UNICODE_STRINGS 0x8000
330
331
332/*
333 * UNIX stuff (from samba trans2.h)
334 */
335#define MIN_UNIX_INFO_LEVEL 0x200
336#define MAX_UNIX_INFO_LEVEL 0x2FF
337#define SMB_FIND_FILE_UNIX 0x202
338#define SMB_QUERY_FILE_UNIX_BASIC 0x200
339#define SMB_QUERY_FILE_UNIX_LINK 0x201
340#define SMB_QUERY_FILE_UNIX_HLINK 0x202
341#define SMB_SET_FILE_UNIX_BASIC 0x200
342#define SMB_SET_FILE_UNIX_LINK 0x201
343#define SMB_SET_FILE_UNIX_HLINK 0x203
344#define SMB_QUERY_CIFS_UNIX_INFO 0x200
345
346/* values which means "don't change it" */
347#define SMB_MODE_NO_CHANGE 0xFFFFFFFF
348#define SMB_UID_NO_CHANGE 0xFFFFFFFF
349#define SMB_GID_NO_CHANGE 0xFFFFFFFF
350#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL
351#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL
352
353/* UNIX filetype mappings. */
354#define UNIX_TYPE_FILE 0
355#define UNIX_TYPE_DIR 1
356#define UNIX_TYPE_SYMLINK 2
357#define UNIX_TYPE_CHARDEV 3
358#define UNIX_TYPE_BLKDEV 4
359#define UNIX_TYPE_FIFO 5
360#define UNIX_TYPE_SOCKET 6
361#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
362
363#endif /* _SMBNO_H_ */
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
index bc21db598c06..76199b75d584 100644
--- a/include/linux/smc91x.h
+++ b/include/linux/smc91x.h
@@ -21,7 +21,7 @@
21#define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */ 21#define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */
22#define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */ 22#define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */
23#define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */ 23#define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */
24#define RPC_LED_100 (0x05) /* LED = 100Mbps link dectect */ 24#define RPC_LED_100 (0x05) /* LED = 100Mbps link detect */
25#define RPC_LED_TX (0x06) /* LED = TX packet occurred */ 25#define RPC_LED_TX (0x06) /* LED = TX packet occurred */
26#define RPC_LED_RX (0x07) /* LED = RX packet occurred */ 26#define RPC_LED_RX (0x07) /* LED = RX packet occurred */
27 27
diff --git a/include/linux/smp.h b/include/linux/smp.h
index cfa2d20e35f1..74243c86ba39 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -10,12 +10,14 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/init.h>
13 14
14extern void cpu_idle(void); 15extern void cpu_idle(void);
15 16
17typedef void (*smp_call_func_t)(void *info);
16struct call_single_data { 18struct call_single_data {
17 struct list_head list; 19 struct list_head list;
18 void (*func) (void *info); 20 smp_call_func_t func;
19 void *info; 21 void *info;
20 u16 flags; 22 u16 flags;
21 u16 priv; 23 u16 priv;
@@ -24,8 +26,8 @@ struct call_single_data {
24/* total number of cpus in this system (may exceed NR_CPUS) */ 26/* total number of cpus in this system (may exceed NR_CPUS) */
25extern unsigned int total_cpus; 27extern unsigned int total_cpus;
26 28
27int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 29int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
28 int wait); 30 int wait);
29 31
30#ifdef CONFIG_SMP 32#ifdef CONFIG_SMP
31 33
@@ -69,15 +71,15 @@ extern void smp_cpus_done(unsigned int max_cpus);
69/* 71/*
70 * Call a function on all other processors 72 * Call a function on all other processors
71 */ 73 */
72int smp_call_function(void(*func)(void *info), void *info, int wait); 74int smp_call_function(smp_call_func_t func, void *info, int wait);
73void smp_call_function_many(const struct cpumask *mask, 75void smp_call_function_many(const struct cpumask *mask,
74 void (*func)(void *info), void *info, bool wait); 76 smp_call_func_t func, void *info, bool wait);
75 77
76void __smp_call_function_single(int cpuid, struct call_single_data *data, 78void __smp_call_function_single(int cpuid, struct call_single_data *data,
77 int wait); 79 int wait);
78 80
79int smp_call_function_any(const struct cpumask *mask, 81int smp_call_function_any(const struct cpumask *mask,
80 void (*func)(void *info), void *info, int wait); 82 smp_call_func_t func, void *info, int wait);
81 83
82/* 84/*
83 * Generic and arch helpers 85 * Generic and arch helpers
@@ -94,7 +96,7 @@ void ipi_call_unlock_irq(void);
94/* 96/*
95 * Call a function on all processors 97 * Call a function on all processors
96 */ 98 */
97int on_each_cpu(void (*func) (void *info), void *info, int wait); 99int on_each_cpu(smp_call_func_t func, void *info, int wait);
98 100
99#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ 101#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
100#define MSG_ALL 0x8001 102#define MSG_ALL 0x8001
@@ -113,6 +115,8 @@ int on_each_cpu(void (*func) (void *info), void *info, int wait);
113void smp_prepare_boot_cpu(void); 115void smp_prepare_boot_cpu(void);
114 116
115extern unsigned int setup_max_cpus; 117extern unsigned int setup_max_cpus;
118extern void __init setup_nr_cpu_ids(void);
119extern void __init smp_init(void);
116 120
117#else /* !SMP */ 121#else /* !SMP */
118 122
@@ -122,7 +126,7 @@ static inline void smp_send_stop(void) { }
122 * These macros fold the SMP functionality into a single CPU system 126 * These macros fold the SMP functionality into a single CPU system
123 */ 127 */
124#define raw_smp_processor_id() 0 128#define raw_smp_processor_id() 0
125static inline int up_smp_call_function(void (*func)(void *), void *info) 129static inline int up_smp_call_function(smp_call_func_t func, void *info)
126{ 130{
127 return 0; 131 return 0;
128} 132}
@@ -143,7 +147,7 @@ static inline void smp_send_reschedule(int cpu) { }
143static inline void init_call_single_data(void) { } 147static inline void init_call_single_data(void) { }
144 148
145static inline int 149static inline int
146smp_call_function_any(const struct cpumask *mask, void (*func)(void *info), 150smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
147 void *info, int wait) 151 void *info, int wait)
148{ 152{
149 return smp_call_function_single(0, func, info, wait); 153 return smp_call_function_single(0, func, info, wait);
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
deleted file mode 100644
index 291f721144c2..000000000000
--- a/include/linux/smp_lock.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef __LINUX_SMPLOCK_H
2#define __LINUX_SMPLOCK_H
3
4#ifdef CONFIG_LOCK_KERNEL
5#include <linux/sched.h>
6
7#define kernel_locked() (current->lock_depth >= 0)
8
9extern int __lockfunc __reacquire_kernel_lock(void);
10extern void __lockfunc __release_kernel_lock(void);
11
12/*
13 * Release/re-acquire global kernel lock for the scheduler
14 */
15#define release_kernel_lock(tsk) do { \
16 if (unlikely((tsk)->lock_depth >= 0)) \
17 __release_kernel_lock(); \
18} while (0)
19
20static inline int reacquire_kernel_lock(struct task_struct *task)
21{
22 if (unlikely(task->lock_depth >= 0))
23 return __reacquire_kernel_lock();
24 return 0;
25}
26
27extern void __lockfunc
28_lock_kernel(const char *func, const char *file, int line)
29__acquires(kernel_lock);
30
31extern void __lockfunc
32_unlock_kernel(const char *func, const char *file, int line)
33__releases(kernel_lock);
34
35#define lock_kernel() do { \
36 _lock_kernel(__func__, __FILE__, __LINE__); \
37} while (0)
38
39#define unlock_kernel() do { \
40 _unlock_kernel(__func__, __FILE__, __LINE__); \
41} while (0)
42
43/*
44 * Various legacy drivers don't really need the BKL in a specific
45 * function, but they *do* need to know that the BKL became available.
46 * This function just avoids wrapping a bunch of lock/unlock pairs
47 * around code which doesn't really need it.
48 */
49static inline void cycle_kernel_lock(void)
50{
51 lock_kernel();
52 unlock_kernel();
53}
54
55#else
56
57#ifdef CONFIG_BKL /* provoke build bug if not set */
58#define lock_kernel()
59#define unlock_kernel()
60#define cycle_kernel_lock() do { } while(0)
61#define kernel_locked() 1
62#endif /* CONFIG_BKL */
63
64#define release_kernel_lock(task) do { } while(0)
65#define reacquire_kernel_lock(task) 0
66
67#endif /* CONFIG_LOCK_KERNEL */
68#endif /* __LINUX_SMPLOCK_H */
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 7144e8aa1e41..4dde70e74822 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -29,6 +29,7 @@ struct smsc911x_platform_config {
29 unsigned int irq_polarity; 29 unsigned int irq_polarity;
30 unsigned int irq_type; 30 unsigned int irq_type;
31 unsigned int flags; 31 unsigned int flags;
32 unsigned int shift;
32 phy_interface_t phy_interface; 33 phy_interface_t phy_interface;
33 unsigned char mac[6]; 34 unsigned char mac[6];
34}; 35};
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index ebb0c80ffd6e..12b2b18e50c1 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -230,6 +230,7 @@ enum
230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ 230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP, 231 LINUX_MIB_TCPDEFERACCEPTDROP,
232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ 232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
233 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */
233 __LINUX_MIB_MAX 234 __LINUX_MIB_MAX
234}; 235};
235 236
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5146b50202ce..4ef98e422fde 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -30,12 +30,10 @@ struct cred;
30#define __sockaddr_check_size(size) \ 30#define __sockaddr_check_size(size) \
31 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) 31 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage)))
32 32
33#ifdef __KERNEL__ 33#ifdef CONFIG_PROC_FS
34# ifdef CONFIG_PROC_FS
35struct seq_file; 34struct seq_file;
36extern void socket_seq_show(struct seq_file *seq); 35extern void socket_seq_show(struct seq_file *seq);
37# endif 36#endif
38#endif /* __KERNEL__ */
39 37
40typedef unsigned short sa_family_t; 38typedef unsigned short sa_family_t;
41 39
@@ -90,7 +88,7 @@ struct cmsghdr {
90}; 88};
91 89
92/* 90/*
93 * Ancilliary data object information MACROS 91 * Ancillary data object information MACROS
94 * Table 5-14 of POSIX 1003.1g 92 * Table 5-14 of POSIX 1003.1g
95 */ 93 */
96 94
@@ -193,7 +191,8 @@ struct ucred {
193#define AF_PHONET 35 /* Phonet sockets */ 191#define AF_PHONET 35 /* Phonet sockets */
194#define AF_IEEE802154 36 /* IEEE802154 sockets */ 192#define AF_IEEE802154 36 /* IEEE802154 sockets */
195#define AF_CAIF 37 /* CAIF sockets */ 193#define AF_CAIF 37 /* CAIF sockets */
196#define AF_MAX 38 /* For now.. */ 194#define AF_ALG 38 /* Algorithm sockets */
195#define AF_MAX 39 /* For now.. */
197 196
198/* Protocol families, same as address families. */ 197/* Protocol families, same as address families. */
199#define PF_UNSPEC AF_UNSPEC 198#define PF_UNSPEC AF_UNSPEC
@@ -234,6 +233,7 @@ struct ucred {
234#define PF_PHONET AF_PHONET 233#define PF_PHONET AF_PHONET
235#define PF_IEEE802154 AF_IEEE802154 234#define PF_IEEE802154 AF_IEEE802154
236#define PF_CAIF AF_CAIF 235#define PF_CAIF AF_CAIF
236#define PF_ALG AF_ALG
237#define PF_MAX AF_MAX 237#define PF_MAX AF_MAX
238 238
239/* Maximum queue length specifiable by listen. */ 239/* Maximum queue length specifiable by listen. */
@@ -307,11 +307,11 @@ struct ucred {
307#define SOL_RDS 276 307#define SOL_RDS 276
308#define SOL_IUCV 277 308#define SOL_IUCV 277
309#define SOL_CAIF 278 309#define SOL_CAIF 278
310#define SOL_ALG 279
310 311
311/* IPX options */ 312/* IPX options */
312#define IPX_TYPE 1 313#define IPX_TYPE 1
313 314
314#ifdef __KERNEL__
315extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred); 315extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred);
316 316
317extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 317extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
@@ -322,7 +322,7 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
322 int offset, 322 int offset,
323 unsigned int len, __wsum *csump); 323 unsigned int len, __wsum *csump);
324 324
325extern long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 325extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode);
326extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 326extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
327extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 327extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
328 int offset, int len); 328 int offset, int len);
@@ -333,6 +333,7 @@ struct timespec;
333 333
334extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 334extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
335 unsigned int flags, struct timespec *timeout); 335 unsigned int flags, struct timespec *timeout);
336#endif 336extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
337 unsigned int vlen, unsigned int flags);
337#endif /* not kernel and not glibc */ 338#endif /* not kernel and not glibc */
338#endif /* _LINUX_SOCKET_H */ 339#endif /* _LINUX_SOCKET_H */
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 241f179347d9..7997a506ad41 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -22,7 +22,7 @@
22 22
23/* Linux-specific socket ioctls */ 23/* Linux-specific socket ioctls */
24#define SIOCINQ FIONREAD 24#define SIOCINQ FIONREAD
25#define SIOCOUTQ TIOCOUTQ 25#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */
26 26
27/* Routing table calls. */ 27/* Routing table calls. */
28#define SIOCADDRT 0x890B /* add routing table entry */ 28#define SIOCADDRT 0x890B /* add routing table entry */
@@ -83,6 +83,8 @@
83 83
84#define SIOCWANDEV 0x894A /* get/set netdev parameters */ 84#define SIOCWANDEV 0x894A /* get/set netdev parameters */
85 85
86#define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */
87
86/* ARP cache control calls. */ 88/* ARP cache control calls. */
87 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ 89 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
88#define SIOCDARP 0x8953 /* delete ARP table entry */ 90#define SIOCDARP 0x8953 /* delete ARP table entry */
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 4f95c1aac2fd..c0f87da78f8a 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -40,6 +40,7 @@
40 40
41/* events the user application reading /dev/sonypi can use */ 41/* events the user application reading /dev/sonypi can use */
42 42
43#define SONYPI_EVENT_IGNORE 0
43#define SONYPI_EVENT_JOGDIAL_DOWN 1 44#define SONYPI_EVENT_JOGDIAL_DOWN 1
44#define SONYPI_EVENT_JOGDIAL_UP 2 45#define SONYPI_EVENT_JOGDIAL_UP 2
45#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 46#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
@@ -112,6 +113,7 @@
112#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 113#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
113#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 114#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
114#define SONYPI_EVENT_MEDIA_PRESSED 72 115#define SONYPI_EVENT_MEDIA_PRESSED 72
116#define SONYPI_EVENT_VENDOR_PRESSED 73
115 117
116/* get/set brightness */ 118/* get/set brightness */
117#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 119#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index 1904afedb82f..fe204fe39f7c 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -1231,7 +1231,7 @@ void seqbuf_dump(void); /* This function must be provided by programs */
1231#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) 1231#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
1232 1232
1233/* 1233/*
1234 * Timing and syncronization macros 1234 * Timing and synchronization macros
1235 */ 1235 */
1236 1236
1237#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ 1237#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
diff --git a/include/linux/spi/74x164.h b/include/linux/spi/74x164.h
new file mode 100644
index 000000000000..d85c52f294a0
--- /dev/null
+++ b/include/linux/spi/74x164.h
@@ -0,0 +1,11 @@
1#ifndef LINUX_SPI_74X164_H
2#define LINUX_SPI_74X164_H
3
4#define GEN_74X164_DRIVER_NAME "74x164"
5
6struct gen_74x164_chip_platform_data {
7 /* number assigned to the first GPIO */
8 unsigned base;
9};
10
11#endif
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
deleted file mode 100644
index c91302f3a257..000000000000
--- a/include/linux/spi/dw_spi.h
+++ /dev/null
@@ -1,219 +0,0 @@
1#ifndef DW_SPI_HEADER_H
2#define DW_SPI_HEADER_H
3#include <linux/io.h>
4
5/* Bit fields in CTRLR0 */
6#define SPI_DFS_OFFSET 0
7
8#define SPI_FRF_OFFSET 4
9#define SPI_FRF_SPI 0x0
10#define SPI_FRF_SSP 0x1
11#define SPI_FRF_MICROWIRE 0x2
12#define SPI_FRF_RESV 0x3
13
14#define SPI_MODE_OFFSET 6
15#define SPI_SCPH_OFFSET 6
16#define SPI_SCOL_OFFSET 7
17
18#define SPI_TMOD_OFFSET 8
19#define SPI_TMOD_MASK (0x3 << SPI_TMOD_OFFSET)
20#define SPI_TMOD_TR 0x0 /* xmit & recv */
21#define SPI_TMOD_TO 0x1 /* xmit only */
22#define SPI_TMOD_RO 0x2 /* recv only */
23#define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */
24
25#define SPI_SLVOE_OFFSET 10
26#define SPI_SRL_OFFSET 11
27#define SPI_CFS_OFFSET 12
28
29/* Bit fields in SR, 7 bits */
30#define SR_MASK 0x7f /* cover 7 bits */
31#define SR_BUSY (1 << 0)
32#define SR_TF_NOT_FULL (1 << 1)
33#define SR_TF_EMPT (1 << 2)
34#define SR_RF_NOT_EMPT (1 << 3)
35#define SR_RF_FULL (1 << 4)
36#define SR_TX_ERR (1 << 5)
37#define SR_DCOL (1 << 6)
38
39/* Bit fields in ISR, IMR, RISR, 7 bits */
40#define SPI_INT_TXEI (1 << 0)
41#define SPI_INT_TXOI (1 << 1)
42#define SPI_INT_RXUI (1 << 2)
43#define SPI_INT_RXOI (1 << 3)
44#define SPI_INT_RXFI (1 << 4)
45#define SPI_INT_MSTI (1 << 5)
46
47/* TX RX interrupt level threshhold, max can be 256 */
48#define SPI_INT_THRESHOLD 32
49
50enum dw_ssi_type {
51 SSI_MOTO_SPI = 0,
52 SSI_TI_SSP,
53 SSI_NS_MICROWIRE,
54};
55
56struct dw_spi_reg {
57 u32 ctrl0;
58 u32 ctrl1;
59 u32 ssienr;
60 u32 mwcr;
61 u32 ser;
62 u32 baudr;
63 u32 txfltr;
64 u32 rxfltr;
65 u32 txflr;
66 u32 rxflr;
67 u32 sr;
68 u32 imr;
69 u32 isr;
70 u32 risr;
71 u32 txoicr;
72 u32 rxoicr;
73 u32 rxuicr;
74 u32 msticr;
75 u32 icr;
76 u32 dmacr;
77 u32 dmatdlr;
78 u32 dmardlr;
79 u32 idr;
80 u32 version;
81 u32 dr; /* Currently oper as 32 bits,
82 though only low 16 bits matters */
83} __packed;
84
85struct dw_spi {
86 struct spi_master *master;
87 struct spi_device *cur_dev;
88 struct device *parent_dev;
89 enum dw_ssi_type type;
90
91 void __iomem *regs;
92 unsigned long paddr;
93 u32 iolen;
94 int irq;
95 u32 fifo_len; /* depth of the FIFO buffer */
96 u32 max_freq; /* max bus freq supported */
97
98 u16 bus_num;
99 u16 num_cs; /* supported slave numbers */
100
101 /* Driver message queue */
102 struct workqueue_struct *workqueue;
103 struct work_struct pump_messages;
104 spinlock_t lock;
105 struct list_head queue;
106 int busy;
107 int run;
108
109 /* Message Transfer pump */
110 struct tasklet_struct pump_transfers;
111
112 /* Current message transfer state info */
113 struct spi_message *cur_msg;
114 struct spi_transfer *cur_transfer;
115 struct chip_data *cur_chip;
116 struct chip_data *prev_chip;
117 size_t len;
118 void *tx;
119 void *tx_end;
120 void *rx;
121 void *rx_end;
122 int dma_mapped;
123 dma_addr_t rx_dma;
124 dma_addr_t tx_dma;
125 size_t rx_map_len;
126 size_t tx_map_len;
127 u8 n_bytes; /* current is a 1/2 bytes op */
128 u8 max_bits_per_word; /* maxim is 16b */
129 u32 dma_width;
130 int cs_change;
131 int (*write)(struct dw_spi *dws);
132 int (*read)(struct dw_spi *dws);
133 irqreturn_t (*transfer_handler)(struct dw_spi *dws);
134 void (*cs_control)(u32 command);
135
136 /* Dma info */
137 int dma_inited;
138 struct dma_chan *txchan;
139 struct dma_chan *rxchan;
140 int txdma_done;
141 int rxdma_done;
142 u64 tx_param;
143 u64 rx_param;
144 struct device *dma_dev;
145 dma_addr_t dma_addr;
146
147 /* Bus interface info */
148 void *priv;
149#ifdef CONFIG_DEBUG_FS
150 struct dentry *debugfs;
151#endif
152};
153
154#define dw_readl(dw, name) \
155 __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name))
156#define dw_writel(dw, name, val) \
157 __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name))
158#define dw_readw(dw, name) \
159 __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name))
160#define dw_writew(dw, name, val) \
161 __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name))
162
163static inline void spi_enable_chip(struct dw_spi *dws, int enable)
164{
165 dw_writel(dws, ssienr, (enable ? 1 : 0));
166}
167
168static inline void spi_set_clk(struct dw_spi *dws, u16 div)
169{
170 dw_writel(dws, baudr, div);
171}
172
173static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
174{
175 if (cs > dws->num_cs)
176 return;
177
178 if (dws->cs_control)
179 dws->cs_control(1);
180
181 dw_writel(dws, ser, 1 << cs);
182}
183
184/* Disable IRQ bits */
185static inline void spi_mask_intr(struct dw_spi *dws, u32 mask)
186{
187 u32 new_mask;
188
189 new_mask = dw_readl(dws, imr) & ~mask;
190 dw_writel(dws, imr, new_mask);
191}
192
193/* Enable IRQ bits */
194static inline void spi_umask_intr(struct dw_spi *dws, u32 mask)
195{
196 u32 new_mask;
197
198 new_mask = dw_readl(dws, imr) | mask;
199 dw_writel(dws, imr, new_mask);
200}
201
202/*
203 * Each SPI slave device to work with dw_api controller should
204 * has such a structure claiming its working mode (PIO/DMA etc),
205 * which can be save in the "controller_data" member of the
206 * struct spi_device
207 */
208struct dw_spi_chip {
209 u8 poll_mode; /* 0 for contoller polling mode */
210 u8 type; /* SPI/SSP/Micrwire */
211 u8 enable_dma;
212 void (*cs_control)(u32 command);
213};
214
215extern int dw_spi_add_host(struct dw_spi *dws);
216extern void dw_spi_remove_host(struct dw_spi *dws);
217extern int dw_spi_suspend_host(struct dw_spi *dws);
218extern int dw_spi_resume_host(struct dw_spi *dws);
219#endif /* DW_SPI_HEADER_H */
diff --git a/include/linux/spi/ifx_modem.h b/include/linux/spi/ifx_modem.h
new file mode 100644
index 000000000000..394fec9e7722
--- /dev/null
+++ b/include/linux/spi/ifx_modem.h
@@ -0,0 +1,19 @@
1#ifndef LINUX_IFX_MODEM_H
2#define LINUX_IFX_MODEM_H
3
4struct ifx_modem_platform_data {
5 unsigned short rst_out; /* modem reset out */
6 unsigned short pwr_on; /* power on */
7 unsigned short rst_pmu; /* reset modem */
8 unsigned short tx_pwr; /* modem power threshold */
9 unsigned short srdy; /* SRDY */
10 unsigned short mrdy; /* MRDY */
11 unsigned char modem_type; /* Modem type */
12 unsigned long max_hz; /* max SPI frequency */
13 unsigned short use_dma:1; /* spi protocol driver supplies
14 dma-able addrs */
15};
16#define IFX_MODEM_6160 1
17#define IFX_MODEM_6260 2
18
19#endif
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 22ef107d7704..c42cff8ca191 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -2,21 +2,24 @@
2/* FIXME driver should be able to handle IRQs... */ 2/* FIXME driver should be able to handle IRQs... */
3 3
4struct mcp23s08_chip_info { 4struct mcp23s08_chip_info {
5 bool is_present; /* true iff populated */ 5 bool is_present; /* true if populated */
6 u8 pullups; /* BIT(x) means enable pullup x */ 6 unsigned pullups; /* BIT(x) means enable pullup x */
7}; 7};
8 8
9struct mcp23s08_platform_data { 9struct mcp23s08_platform_data {
10 /* Four slaves (numbered 0..3) can share one SPI chipselect, and 10 /* For mcp23s08, up to 4 slaves (numbered 0..3) can share one SPI
11 * will provide 8..32 GPIOs using 1..4 gpio_chip instances. 11 * chipselect, each providing 1 gpio_chip instance with 8 gpios.
12 * For mpc23s17, up to 8 slaves (numbered 0..7) can share one SPI
13 * chipselect, each providing 1 gpio_chip (port A + port B) with
14 * 16 gpios.
12 */ 15 */
13 struct mcp23s08_chip_info chip[4]; 16 struct mcp23s08_chip_info chip[8];
14 17
15 /* "base" is the number of the first GPIO. Dynamic assignment is 18 /* "base" is the number of the first GPIO. Dynamic assignment is
16 * not currently supported, and even if there are gaps in chip 19 * not currently supported, and even if there are gaps in chip
17 * addressing the GPIO numbers are sequential .. so for example 20 * addressing the GPIO numbers are sequential .. so for example
18 * if only slaves 0 and 3 are present, their GPIOs range from 21 * if only slaves 0 and 3 are present, their GPIOs range from
19 * base to base+15. 22 * base to base+15 (or base+31 for s17 variant).
20 */ 23 */
21 unsigned base; 24 unsigned base;
22 25
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
new file mode 100644
index 000000000000..d3e1075f7b60
--- /dev/null
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18#ifndef __linux_pxa2xx_spi_h
19#define __linux_pxa2xx_spi_h
20
21#include <linux/pxa2xx_ssp.h>
22
23#define PXA2XX_CS_ASSERT (0x01)
24#define PXA2XX_CS_DEASSERT (0x02)
25
26/* device.platform_data for SSP controller devices */
27struct pxa2xx_spi_master {
28 u32 clock_enable;
29 u16 num_chipselect;
30 u8 enable_dma;
31};
32
33/* spi_board_info.controller_data for SPI slave devices,
34 * copied to spi_device.platform_data ... mostly for dma tuning
35 */
36struct pxa2xx_spi_chip {
37 u8 tx_threshold;
38 u8 rx_threshold;
39 u8 dma_burst_size;
40 u32 timeout;
41 u8 enable_loopback;
42 int gpio_cs;
43 void (*cs_control)(u32 command);
44};
45
46#ifdef CONFIG_ARCH_PXA
47
48#include <linux/clk.h>
49#include <mach/dma.h>
50
51extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info);
52
53#else
54/*
55 * This is the implemtation for CE4100 on x86. ARM defines them in mach/ or
56 * plat/ include path.
57 * The CE4100 does not provide DMA support. This bits are here to let the driver
58 * compile and will never be used. Maybe we get DMA support at a later point in
59 * time.
60 */
61
62#define DCSR(n) (n)
63#define DSADR(n) (n)
64#define DTADR(n) (n)
65#define DCMD(n) (n)
66#define DRCMR(n) (n)
67
68#define DCSR_RUN (1 << 31) /* Run Bit */
69#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch */
70#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable */
71#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
72#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
73#define DCSR_ENDINTR (1 << 2) /* End Interrupt */
74#define DCSR_STARTINTR (1 << 1) /* Start Interrupt */
75#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt */
76
77#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable */
78#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
79#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
80#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
81#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
82#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
83#define DCSR_EORINTR (1 << 9) /* The end of Receive */
84
85#define DRCMR_MAPVLD (1 << 7) /* Map Valid */
86#define DRCMR_CHLNUM 0x1f /* mask for Channel Number */
87
88#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor */
89#define DDADR_STOP (1 << 0) /* Stop */
90
91#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
92#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
93#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
94#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
95#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
96#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
97#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
98#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
99#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
100#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
101#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
102#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
103#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
104#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
105
106/*
107 * Descriptor structure for PXA's DMA engine
108 * Note: this structure must always be aligned to a 16-byte boundary.
109 */
110
111typedef enum {
112 DMA_PRIO_HIGH = 0,
113 DMA_PRIO_MEDIUM = 1,
114 DMA_PRIO_LOW = 2
115} pxa_dma_prio;
116
117/*
118 * DMA registration
119 */
120
121static inline int pxa_request_dma(char *name,
122 pxa_dma_prio prio,
123 void (*irq_handler)(int, void *),
124 void *data)
125{
126 return -ENODEV;
127}
128
129static inline void pxa_free_dma(int dma_ch)
130{
131}
132
133/*
134 * The CE4100 does not have the clk framework implemented and SPI clock can
135 * not be switched on/off or the divider changed.
136 */
137static inline void clk_disable(struct clk *clk)
138{
139}
140
141static inline int clk_enable(struct clk *clk)
142{
143 return 0;
144}
145
146static inline unsigned long clk_get_rate(struct clk *clk)
147{
148 return 3686400;
149}
150
151#endif
152#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 92e52a1e6af3..b4d7710bc38d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -204,6 +204,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
204/** 204/**
205 * struct spi_master - interface to SPI master controller 205 * struct spi_master - interface to SPI master controller
206 * @dev: device interface to this driver 206 * @dev: device interface to this driver
207 * @list: link with the global spi_master list
207 * @bus_num: board-specific (and often SOC-specific) identifier for a 208 * @bus_num: board-specific (and often SOC-specific) identifier for a
208 * given SPI controller. 209 * given SPI controller.
209 * @num_chipselect: chipselects are used to distinguish individual 210 * @num_chipselect: chipselects are used to distinguish individual
@@ -238,6 +239,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
238struct spi_master { 239struct spi_master {
239 struct device dev; 240 struct device dev;
240 241
242 struct list_head list;
243
241 /* other than negative (== assign one dynamically), bus_num is fully 244 /* other than negative (== assign one dynamically), bus_num is fully
242 * board-specific. usually that simplifies to being SOC-specific. 245 * board-specific. usually that simplifies to being SOC-specific.
243 * example: one SOC has three SPI controllers, numbered 0..2, 246 * example: one SOC has three SPI controllers, numbered 0..2,
diff --git a/include/linux/spi/spi_oc_tiny.h b/include/linux/spi/spi_oc_tiny.h
new file mode 100644
index 000000000000..1ac529cf4f06
--- /dev/null
+++ b/include/linux/spi/spi_oc_tiny.h
@@ -0,0 +1,20 @@
1#ifndef _LINUX_SPI_SPI_OC_TINY_H
2#define _LINUX_SPI_SPI_OC_TINY_H
3
4/**
5 * struct tiny_spi_platform_data - platform data of the OpenCores tiny SPI
6 * @freq: input clock freq to the core.
7 * @baudwidth: baud rate divider width of the core.
8 * @gpio_cs_count: number of gpio pins used for chipselect.
9 * @gpio_cs: array of gpio pins used for chipselect.
10 *
11 * freq and baudwidth are used only if the divider is programmable.
12 */
13struct tiny_spi_platform_data {
14 unsigned int freq;
15 unsigned int baudwidth;
16 unsigned int gpio_cs_count;
17 int *gpio_cs;
18};
19
20#endif /* _LINUX_SPI_SPI_OC_TINY_H */
diff --git a/include/linux/spi/spidev.h b/include/linux/spi/spidev.h
index bf0570a84f7a..52d9ed01855f 100644
--- a/include/linux/spi/spidev.h
+++ b/include/linux/spi/spidev.h
@@ -66,7 +66,7 @@
66 * are in a different address space (and may be of different sizes in some 66 * are in a different address space (and may be of different sizes in some
67 * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel). 67 * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel).
68 * Zero-initialize the structure, including currently unused fields, to 68 * Zero-initialize the structure, including currently unused fields, to
69 * accomodate potential future updates. 69 * accommodate potential future updates.
70 * 70 *
71 * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync(). 71 * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync().
72 * Pass it an array of related transfers, they'll execute together. 72 * Pass it an array of related transfers, they'll execute together.
diff --git a/include/linux/spi/tsc2005.h b/include/linux/spi/tsc2005.h
new file mode 100644
index 000000000000..d9b0c84220c7
--- /dev/null
+++ b/include/linux/spi/tsc2005.h
@@ -0,0 +1,41 @@
1/*
2 * This file is part of TSC2005 touchscreen driver
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation
5 *
6 * Contact: Aaro Koskinen <aaro.koskinen@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef _LINUX_SPI_TSC2005_H
25#define _LINUX_SPI_TSC2005_H
26
27#include <linux/types.h>
28
29struct tsc2005_platform_data {
30 int ts_pressure_max;
31 int ts_pressure_fudge;
32 int ts_x_max;
33 int ts_x_fudge;
34 int ts_y_max;
35 int ts_y_fudge;
36 int ts_x_plate_ohm;
37 unsigned int esd_timeout_ms;
38 void (*set_reset)(bool enable);
39};
40
41#endif
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 80e535897de6..0b22d51258e6 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -81,7 +81,7 @@
81#include <linux/spinlock_types.h> 81#include <linux/spinlock_types.h>
82 82
83/* 83/*
84 * Pull the arch_spin*() functions/declarations (UP-nondebug doesnt need them): 84 * Pull the arch_spin*() functions/declarations (UP-nondebug doesn't need them):
85 */ 85 */
86#ifdef CONFIG_SMP 86#ifdef CONFIG_SMP
87# include <asm/spinlock.h> 87# include <asm/spinlock.h>
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 851b7783720d..73548eb13a5d 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -81,14 +81,6 @@ typedef struct spinlock {
81#define __SPIN_LOCK_UNLOCKED(lockname) \ 81#define __SPIN_LOCK_UNLOCKED(lockname) \
82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) 82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
83 83
84/*
85 * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence
86 * deprecated.
87 * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as
88 * appropriate.
89 */
90#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
91
92#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) 84#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
93 85
94#include <linux/rwlock_types.h> 86#include <linux/rwlock_types.h>
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index b14f6a91e19f..a26e2fb604e6 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -5,6 +5,8 @@
5# error "please don't include this file directly" 5# error "please don't include this file directly"
6#endif 6#endif
7 7
8#include <asm/processor.h> /* for cpu_relax() */
9
8/* 10/*
9 * include/linux/spinlock_up.h - UP-debug version of spinlocks. 11 * include/linux/spinlock_up.h - UP-debug version of spinlocks.
10 * 12 *
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 623b704fdc42..252e44821787 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -55,6 +55,10 @@ struct ssb_sprom {
55 u8 tri5gl; /* 5.2GHz TX isolation */ 55 u8 tri5gl; /* 5.2GHz TX isolation */
56 u8 tri5g; /* 5.3GHz TX isolation */ 56 u8 tri5g; /* 5.3GHz TX isolation */
57 u8 tri5gh; /* 5.8GHz TX isolation */ 57 u8 tri5gh; /* 5.8GHz TX isolation */
58 u8 txpid2g[4]; /* 2GHz TX power index */
59 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
60 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
61 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
58 u8 rxpo2g; /* 2GHz RX power offset */ 62 u8 rxpo2g; /* 2GHz RX power offset */
59 u8 rxpo5g; /* 5GHz RX power offset */ 63 u8 rxpo5g; /* 5GHz RX power offset */
60 u8 rssisav2g; /* 2GHz RSSI params */ 64 u8 rssisav2g; /* 2GHz RSSI params */
@@ -304,7 +308,7 @@ struct ssb_bus {
304 308
305 /* ID information about the Chip. */ 309 /* ID information about the Chip. */
306 u16 chip_id; 310 u16 chip_id;
307 u16 chip_rev; 311 u8 chip_rev;
308 u16 sprom_offset; 312 u16 sprom_offset;
309 u16 sprom_size; /* number of words in sprom */ 313 u16 sprom_size; /* number of words in sprom */
310 u8 chip_package; 314 u8 chip_package;
@@ -400,7 +404,9 @@ extern bool ssb_is_sprom_available(struct ssb_bus *bus);
400 404
401/* Set a fallback SPROM. 405/* Set a fallback SPROM.
402 * See kdoc at the function definition for complete documentation. */ 406 * See kdoc at the function definition for complete documentation. */
403extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom); 407extern int ssb_arch_register_fallback_sprom(
408 int (*sprom_callback)(struct ssb_bus *bus,
409 struct ssb_sprom *out));
404 410
405/* Suspend a SSB bus. 411/* Suspend a SSB bus.
406 * Call this from the parent bus suspend routine. */ 412 * Call this from the parent bus suspend routine. */
@@ -514,6 +520,7 @@ extern int ssb_bus_may_powerdown(struct ssb_bus *bus);
514 * Otherwise static always-on powercontrol will be used. */ 520 * Otherwise static always-on powercontrol will be used. */
515extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); 521extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
516 522
523extern void ssb_commit_settings(struct ssb_bus *bus);
517 524
518/* Various helper functions */ 525/* Various helper functions */
519extern u32 ssb_admatch_base(u32 adm); 526extern u32 ssb_admatch_base(u32 adm);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 2cdf249b4e5f..a08d693d8324 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -123,6 +123,8 @@
123#define SSB_CHIPCO_FLASHDATA 0x0048 123#define SSB_CHIPCO_FLASHDATA 0x0048
124#define SSB_CHIPCO_BCAST_ADDR 0x0050 124#define SSB_CHIPCO_BCAST_ADDR 0x0050
125#define SSB_CHIPCO_BCAST_DATA 0x0054 125#define SSB_CHIPCO_BCAST_DATA 0x0054
126#define SSB_CHIPCO_GPIOPULLUP 0x0058 /* Rev >= 20 only */
127#define SSB_CHIPCO_GPIOPULLDOWN 0x005C /* Rev >= 20 only */
126#define SSB_CHIPCO_GPIOIN 0x0060 128#define SSB_CHIPCO_GPIOIN 0x0060
127#define SSB_CHIPCO_GPIOOUT 0x0064 129#define SSB_CHIPCO_GPIOOUT 0x0064
128#define SSB_CHIPCO_GPIOOUTEN 0x0068 130#define SSB_CHIPCO_GPIOOUTEN 0x0068
@@ -131,6 +133,9 @@
131#define SSB_CHIPCO_GPIOIRQ 0x0074 133#define SSB_CHIPCO_GPIOIRQ 0x0074
132#define SSB_CHIPCO_WATCHDOG 0x0080 134#define SSB_CHIPCO_WATCHDOG 0x0080
133#define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */ 135#define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
136#define SSB_CHIPCO_GPIOTIMER_OFFTIME 0x0000FFFF
137#define SSB_CHIPCO_GPIOTIMER_OFFTIME_SHIFT 0
138#define SSB_CHIPCO_GPIOTIMER_ONTIME 0xFFFF0000
134#define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16 139#define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16
135#define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */ 140#define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
136#define SSB_CHIPCO_CLOCK_N 0x0090 141#define SSB_CHIPCO_CLOCK_N 0x0090
@@ -189,8 +194,10 @@
189#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */ 194#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
190#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ 195#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
191#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ 196#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
192#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */ 197#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
193#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */ 198#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00020000 /* HT available */
199#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
200#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
194#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 201#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
195#define SSB_CHIPCO_UART0_DATA 0x0300 202#define SSB_CHIPCO_UART0_DATA 0x0300
196#define SSB_CHIPCO_UART0_IMR 0x0304 203#define SSB_CHIPCO_UART0_IMR 0x0304
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 942e38736901..eba52a100533 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
96 return 0; 96 return 0;
97} 97}
98 98
99extern char * nvram_get(const char *name); 99#ifdef CONFIG_BCM47XX
100#include <asm/mach-bcm47xx/nvram.h>
100/* Get the device MAC address */ 101/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 102static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{ 103{
103#ifdef CONFIG_BCM47XX 104 char buf[20];
104 char *res = nvram_get("et0macaddr"); 105 if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
105 if (res) 106 return;
106 memcpy(macaddr, res, 6); 107 nvram_parse_macaddr(buf, macaddr);
107#endif
108} 108}
109#else
110static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
111{
112}
113#endif
109 114
110extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 115extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
111 struct pci_dev *pdev); 116 struct pci_dev *pdev);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 11daf9c140e7..efbf459d571c 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -85,6 +85,8 @@
85#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ 85#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */
86#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ 86#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */
87#define SSB_IMSTATE_TO 0x00040000 /* Timeout */ 87#define SSB_IMSTATE_TO 0x00040000 /* Timeout */
88#define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */
89#define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */
88#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ 90#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */
89#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ 91#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */
90#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ 92#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */
@@ -95,9 +97,8 @@
95#define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */ 97#define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */
96#define SSB_TMSLOW 0x0F98 /* SB Target State Low */ 98#define SSB_TMSLOW 0x0F98 /* SB Target State Low */
97#define SSB_TMSLOW_RESET 0x00000001 /* Reset */ 99#define SSB_TMSLOW_RESET 0x00000001 /* Reset */
98#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ 100#define SSB_TMSLOW_REJECT 0x00000002 /* Reject (Standard Backplane) */
99#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ 101#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */
100#define SSB_TMSLOW_PHYCLK 0x00000010 /* MAC PHY Clock Control Enable */
101#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ 102#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */
102#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ 103#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
103#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ 104#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */
@@ -268,6 +269,8 @@
268/* SPROM Revision 4 */ 269/* SPROM Revision 4 */
269#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ 270#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
270#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ 271#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
272#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
273#define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */
271#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ 274#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
272#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ 275#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
273#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ 276#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
@@ -299,6 +302,46 @@
299#define SSB_SPROM4_AGAIN2_SHIFT 0 302#define SSB_SPROM4_AGAIN2_SHIFT 0
300#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 303#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
301#define SSB_SPROM4_AGAIN3_SHIFT 8 304#define SSB_SPROM4_AGAIN3_SHIFT 8
305#define SSB_SPROM4_TXPID2G01 0x0062 /* TX Power Index 2GHz */
306#define SSB_SPROM4_TXPID2G0 0x00FF
307#define SSB_SPROM4_TXPID2G0_SHIFT 0
308#define SSB_SPROM4_TXPID2G1 0xFF00
309#define SSB_SPROM4_TXPID2G1_SHIFT 8
310#define SSB_SPROM4_TXPID2G23 0x0064 /* TX Power Index 2GHz */
311#define SSB_SPROM4_TXPID2G2 0x00FF
312#define SSB_SPROM4_TXPID2G2_SHIFT 0
313#define SSB_SPROM4_TXPID2G3 0xFF00
314#define SSB_SPROM4_TXPID2G3_SHIFT 8
315#define SSB_SPROM4_TXPID5G01 0x0066 /* TX Power Index 5GHz middle subband */
316#define SSB_SPROM4_TXPID5G0 0x00FF
317#define SSB_SPROM4_TXPID5G0_SHIFT 0
318#define SSB_SPROM4_TXPID5G1 0xFF00
319#define SSB_SPROM4_TXPID5G1_SHIFT 8
320#define SSB_SPROM4_TXPID5G23 0x0068 /* TX Power Index 5GHz middle subband */
321#define SSB_SPROM4_TXPID5G2 0x00FF
322#define SSB_SPROM4_TXPID5G2_SHIFT 0
323#define SSB_SPROM4_TXPID5G3 0xFF00
324#define SSB_SPROM4_TXPID5G3_SHIFT 8
325#define SSB_SPROM4_TXPID5GL01 0x006A /* TX Power Index 5GHz low subband */
326#define SSB_SPROM4_TXPID5GL0 0x00FF
327#define SSB_SPROM4_TXPID5GL0_SHIFT 0
328#define SSB_SPROM4_TXPID5GL1 0xFF00
329#define SSB_SPROM4_TXPID5GL1_SHIFT 8
330#define SSB_SPROM4_TXPID5GL23 0x006C /* TX Power Index 5GHz low subband */
331#define SSB_SPROM4_TXPID5GL2 0x00FF
332#define SSB_SPROM4_TXPID5GL2_SHIFT 0
333#define SSB_SPROM4_TXPID5GL3 0xFF00
334#define SSB_SPROM4_TXPID5GL3_SHIFT 8
335#define SSB_SPROM4_TXPID5GH01 0x006E /* TX Power Index 5GHz high subband */
336#define SSB_SPROM4_TXPID5GH0 0x00FF
337#define SSB_SPROM4_TXPID5GH0_SHIFT 0
338#define SSB_SPROM4_TXPID5GH1 0xFF00
339#define SSB_SPROM4_TXPID5GH1_SHIFT 8
340#define SSB_SPROM4_TXPID5GH23 0x0070 /* TX Power Index 5GHz high subband */
341#define SSB_SPROM4_TXPID5GH2 0x00FF
342#define SSB_SPROM4_TXPID5GH2_SHIFT 0
343#define SSB_SPROM4_TXPID5GH3 0xFF00
344#define SSB_SPROM4_TXPID5GH3_SHIFT 8
302#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ 345#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
303#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 346#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
304#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 347#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
@@ -318,6 +361,8 @@
318#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ 361#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
319#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ 362#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
320#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ 363#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
364#define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */
365#define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */
321#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ 366#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
322#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ 367#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
323#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ 368#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 51efbef38fb0..25310f1d7f37 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -2,6 +2,7 @@
2#define __LINUX_STACKTRACE_H 2#define __LINUX_STACKTRACE_H
3 3
4struct task_struct; 4struct task_struct;
5struct pt_regs;
5 6
6#ifdef CONFIG_STACKTRACE 7#ifdef CONFIG_STACKTRACE
7struct task_struct; 8struct task_struct;
@@ -13,7 +14,8 @@ struct stack_trace {
13}; 14};
14 15
15extern void save_stack_trace(struct stack_trace *trace); 16extern void save_stack_trace(struct stack_trace *trace);
16extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp); 17extern void save_stack_trace_regs(struct stack_trace *trace,
18 struct pt_regs *regs);
17extern void save_stack_trace_tsk(struct task_struct *tsk, 19extern void save_stack_trace_tsk(struct task_struct *tsk,
18 struct stack_trace *trace); 20 struct stack_trace *trace);
19 21
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index d66c61774d95..9529e49b0385 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -26,7 +26,9 @@
26#ifndef __STMMAC_PLATFORM_DATA 26#ifndef __STMMAC_PLATFORM_DATA
27#define __STMMAC_PLATFORM_DATA 27#define __STMMAC_PLATFORM_DATA
28 28
29/* platfrom data for platfrom device structure's platfrom_data field */ 29#include <linux/platform_device.h>
30
31/* platform data for platform device structure's platform_data field */
30 32
31/* Private data for the STM on-board ethernet driver */ 33/* Private data for the STM on-board ethernet driver */
32struct plat_stmmacenet_data { 34struct plat_stmmacenet_data {
@@ -40,9 +42,9 @@ struct plat_stmmacenet_data {
40 int pmt; 42 int pmt;
41 void (*fix_mac_speed)(void *priv, unsigned int speed); 43 void (*fix_mac_speed)(void *priv, unsigned int speed);
42 void (*bus_setup)(void __iomem *ioaddr); 44 void (*bus_setup)(void __iomem *ioaddr);
43#ifdef CONFIG_STM_DRIVERS 45 int (*init)(struct platform_device *pdev);
44 struct stm_pad_config *pad_config; 46 void (*exit)(struct platform_device *pdev);
45#endif 47 void *custom_cfg;
46 void *bsp_priv; 48 void *bsp_priv;
47}; 49};
48 50
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 1808960c5059..092dc9b1ce7d 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -105,7 +105,7 @@ static inline int try_stop_cpus(const struct cpumask *cpumask,
105 * @cpus: the cpus to run the @fn() on (NULL = any online cpu) 105 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
106 * 106 *
107 * Description: This causes a thread to be scheduled on every cpu, 107 * Description: This causes a thread to be scheduled on every cpu,
108 * each of which disables interrupts. The result is that noone is 108 * each of which disables interrupts. The result is that no one is
109 * holding a spinlock or inside any other preempt-disabled region when 109 * holding a spinlock or inside any other preempt-disabled region when
110 * @fn() runs. 110 * @fn() runs.
111 * 111 *
diff --git a/include/linux/string.h b/include/linux/string.h
index a716ee2a8adb..a176db2f2c85 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -123,6 +123,7 @@ extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
123extern void argv_free(char **argv); 123extern void argv_free(char **argv);
124 124
125extern bool sysfs_streq(const char *s1, const char *s2); 125extern bool sysfs_streq(const char *s1, const char *s2);
126extern int strtobool(const char *s, bool *res);
126 127
127#ifdef CONFIG_BINARY_PRINTF 128#ifdef CONFIG_BINARY_PRINTF
128int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); 129int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 5bbc447175dc..8521067ed4f7 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -110,9 +110,9 @@ struct rpc_credops {
110 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 110 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
111 int (*crrefresh)(struct rpc_task *); 111 int (*crrefresh)(struct rpc_task *);
112 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 112 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
113 int (*crwrap_req)(struct rpc_task *, kxdrproc_t, 113 int (*crwrap_req)(struct rpc_task *, kxdreproc_t,
114 void *, __be32 *, void *); 114 void *, __be32 *, void *);
115 int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, 115 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t,
116 void *, __be32 *, void *); 116 void *, __be32 *, void *);
117}; 117};
118 118
@@ -122,8 +122,8 @@ extern const struct rpc_authops authnull_ops;
122int __init rpc_init_authunix(void); 122int __init rpc_init_authunix(void);
123int __init rpc_init_generic_auth(void); 123int __init rpc_init_generic_auth(void);
124int __init rpcauth_init_module(void); 124int __init rpcauth_init_module(void);
125void __exit rpcauth_remove_module(void); 125void rpcauth_remove_module(void);
126void __exit rpc_destroy_generic_auth(void); 126void rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void); 127void rpc_destroy_authunix(void);
128 128
129struct rpc_cred * rpc_lookup_cred(void); 129struct rpc_cred * rpc_lookup_cred(void);
@@ -139,8 +139,8 @@ struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *
139void put_rpccred(struct rpc_cred *); 139void put_rpccred(struct rpc_cred *);
140__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 140__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
141__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); 141__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
142int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj); 142int rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, __be32 *data, void *obj);
143int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj); 143int rpcauth_unwrap_resp(struct rpc_task *task, kxdrdproc_t decode, void *rqstp, __be32 *data, void *obj);
144int rpcauth_refreshcred(struct rpc_task *); 144int rpcauth_refreshcred(struct rpc_task *);
145void rpcauth_invalcred(struct rpc_task *); 145void rpcauth_invalcred(struct rpc_task *);
146int rpcauth_uptodatecred(struct rpc_task *); 146int rpcauth_uptodatecred(struct rpc_task *);
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index 7c91260c44a9..082884295f80 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -43,7 +43,7 @@ int bc_send(struct rpc_rqst *req);
43 */ 43 */
44static inline int svc_is_backchannel(const struct svc_rqst *rqstp) 44static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
45{ 45{
46 if (rqstp->rq_server->bc_xprt) 46 if (rqstp->rq_server->sv_bc_xprt)
47 return 1; 47 return 1;
48 return 0; 48 return 0;
49} 49}
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 7bf3e84b92f4..8d2eef1a8582 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -13,6 +13,7 @@
13#ifndef _LINUX_SUNRPC_CACHE_H_ 13#ifndef _LINUX_SUNRPC_CACHE_H_
14#define _LINUX_SUNRPC_CACHE_H_ 14#define _LINUX_SUNRPC_CACHE_H_
15 15
16#include <linux/kref.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <asm/atomic.h> 18#include <asm/atomic.h>
18#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
@@ -34,10 +35,10 @@
34 * Each cache must be registered so that it can be cleaned regularly. 35 * Each cache must be registered so that it can be cleaned regularly.
35 * When the cache is unregistered, it is flushed completely. 36 * When the cache is unregistered, it is flushed completely.
36 * 37 *
37 * Entries have a ref count and a 'hashed' flag which counts the existance 38 * Entries have a ref count and a 'hashed' flag which counts the existence
38 * in the hash table. 39 * in the hash table.
39 * We only expire entries when refcount is zero. 40 * We only expire entries when refcount is zero.
40 * Existance in the cache is counted the refcount. 41 * Existence in the cache is counted the refcount.
41 */ 42 */
42 43
43/* Every cache item has a common header that is used 44/* Every cache item has a common header that is used
@@ -125,12 +126,15 @@ struct cache_detail {
125 */ 126 */
126struct cache_req { 127struct cache_req {
127 struct cache_deferred_req *(*defer)(struct cache_req *req); 128 struct cache_deferred_req *(*defer)(struct cache_req *req);
129 int thread_wait; /* How long (jiffies) we can block the
130 * current thread to wait for updates.
131 */
128}; 132};
129/* this must be embedded in a deferred_request that is being 133/* this must be embedded in a deferred_request that is being
130 * delayed awaiting cache-fill 134 * delayed awaiting cache-fill
131 */ 135 */
132struct cache_deferred_req { 136struct cache_deferred_req {
133 struct list_head hash; /* on hash chain */ 137 struct hlist_node hash; /* on hash chain */
134 struct list_head recent; /* on fifo */ 138 struct list_head recent; /* on fifo */
135 struct cache_head *item; /* cache item we wait on */ 139 struct cache_head *item; /* cache item we wait on */
136 void *owner; /* we might need to discard all defered requests 140 void *owner; /* we might need to discard all defered requests
@@ -194,7 +198,9 @@ extern void cache_purge(struct cache_detail *detail);
194#define NEVER (0x7FFFFFFF) 198#define NEVER (0x7FFFFFFF)
195extern void __init cache_initialize(void); 199extern void __init cache_initialize(void);
196extern int cache_register(struct cache_detail *cd); 200extern int cache_register(struct cache_detail *cd);
201extern int cache_register_net(struct cache_detail *cd, struct net *net);
197extern void cache_unregister(struct cache_detail *cd); 202extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
198 204
199extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
200 mode_t, struct cache_detail *); 206 mode_t, struct cache_detail *);
@@ -218,14 +224,45 @@ static inline int get_int(char **bpp, int *anint)
218 return 0; 224 return 0;
219} 225}
220 226
227/*
228 * timestamps kept in the cache are expressed in seconds
229 * since boot. This is the best for measuring differences in
230 * real time.
231 */
232static inline time_t seconds_since_boot(void)
233{
234 struct timespec boot;
235 getboottime(&boot);
236 return get_seconds() - boot.tv_sec;
237}
238
239static inline time_t convert_to_wallclock(time_t sinceboot)
240{
241 struct timespec boot;
242 getboottime(&boot);
243 return boot.tv_sec + sinceboot;
244}
245
221static inline time_t get_expiry(char **bpp) 246static inline time_t get_expiry(char **bpp)
222{ 247{
223 int rv; 248 int rv;
249 struct timespec boot;
250
224 if (get_int(bpp, &rv)) 251 if (get_int(bpp, &rv))
225 return 0; 252 return 0;
226 if (rv < 0) 253 if (rv < 0)
227 return 0; 254 return 0;
228 return rv; 255 getboottime(&boot);
256 return rv - boot.tv_sec;
257}
258
259#ifdef CONFIG_NFSD_DEPRECATED
260static inline void sunrpc_invalidate(struct cache_head *h,
261 struct cache_detail *detail)
262{
263 h->expiry_time = seconds_since_boot() - 1;
264 detail->nextcheck = seconds_since_boot();
229} 265}
266#endif /* CONFIG_NFSD_DEPRECATED */
230 267
231#endif /* _LINUX_SUNRPC_CACHE_H_ */ 268#endif /* _LINUX_SUNRPC_CACHE_H_ */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c83df09a8e2b..db7bcaf7c5bd 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -89,8 +89,8 @@ struct rpc_version {
89 */ 89 */
90struct rpc_procinfo { 90struct rpc_procinfo {
91 u32 p_proc; /* RPC procedure number */ 91 u32 p_proc; /* RPC procedure number */
92 kxdrproc_t p_encode; /* XDR encode function */ 92 kxdreproc_t p_encode; /* XDR encode function */
93 kxdrproc_t p_decode; /* XDR decode function */ 93 kxdrdproc_t p_decode; /* XDR decode function */
94 unsigned int p_arglen; /* argument hdr length (u32) */ 94 unsigned int p_arglen; /* argument hdr length (u32) */
95 unsigned int p_replen; /* reply hdr length (u32) */ 95 unsigned int p_replen; /* reply hdr length (u32) */
96 unsigned int p_count; /* call count */ 96 unsigned int p_count; /* call count */
@@ -102,6 +102,7 @@ struct rpc_procinfo {
102#ifdef __KERNEL__ 102#ifdef __KERNEL__
103 103
104struct rpc_create_args { 104struct rpc_create_args {
105 struct net *net;
105 int protocol; 106 int protocol;
106 struct sockaddr *address; 107 struct sockaddr *address;
107 size_t addrsize; 108 size_t addrsize;
@@ -128,6 +129,7 @@ struct rpc_create_args {
128struct rpc_clnt *rpc_create(struct rpc_create_args *args); 129struct rpc_clnt *rpc_create(struct rpc_create_args *args);
129struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 130struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
130 struct rpc_program *, u32); 131 struct rpc_program *, u32);
132void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
131struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 133struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
132void rpc_shutdown_client(struct rpc_clnt *); 134void rpc_shutdown_client(struct rpc_clnt *);
133void rpc_release_client(struct rpc_clnt *); 135void rpc_release_client(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 5d8048beb051..332da61cf8b7 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -126,6 +126,9 @@ struct gss_api_mech *gss_mech_get_by_name(const char *);
126/* Similar, but get by pseudoflavor. */ 126/* Similar, but get by pseudoflavor. */
127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); 127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
128 128
129/* Fill in an array with a list of supported pseudoflavors */
130int gss_mech_list_pseudoflavors(u32 *);
131
129/* Just increments the mechanism's reference count and returns its input: */ 132/* Just increments the mechanism's reference count and returns its input: */
130struct gss_api_mech * gss_mech_get(struct gss_api_mech *); 133struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
131 134
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
deleted file mode 100644
index e3e6a3437f8b..000000000000
--- a/include/linux/sunrpc/gss_spkm3.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * linux/include/linux/sunrpc/gss_spkm3.h
3 *
4 * Copyright (c) 2000 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Andy Adamson <andros@umich.edu>
8 */
9
10#include <linux/sunrpc/auth_gss.h>
11#include <linux/sunrpc/gss_err.h>
12#include <linux/sunrpc/gss_asn1.h>
13
14struct spkm3_ctx {
15 struct xdr_netobj ctx_id; /* per message context id */
16 int endtime; /* endtime of the context */
17 struct xdr_netobj mech_used;
18 unsigned int ret_flags ;
19 struct xdr_netobj conf_alg;
20 struct xdr_netobj derived_conf_key;
21 struct xdr_netobj intg_alg;
22 struct xdr_netobj derived_integ_key;
23};
24
25/* OIDs declarations for K-ALG, I-ALG, C-ALG, and OWF-ALG */
26extern const struct xdr_netobj hmac_md5_oid;
27extern const struct xdr_netobj cast5_cbc_oid;
28
29/* SPKM InnerContext Token types */
30
31#define SPKM_ERROR_TOK 3
32#define SPKM_MIC_TOK 4
33#define SPKM_WRAP_TOK 5
34#define SPKM_DEL_TOK 6
35
36u32 spkm3_make_token(struct spkm3_ctx *ctx, struct xdr_buf * text, struct xdr_netobj * token, int toktype);
37
38u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int toktype);
39
40#define CKSUMTYPE_RSA_MD5 0x0007
41#define CKSUMTYPE_HMAC_MD5 0x0008
42
43s32 make_spkm3_checksum(s32 cksumtype, struct xdr_netobj *key, char *header,
44 unsigned int hdrlen, struct xdr_buf *body,
45 unsigned int body_offset, struct xdr_netobj *cksum);
46void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
47int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen,
48 int explen);
49void spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen,
50 unsigned char *ctxhdr, int elen, int zbit);
51void spkm3_make_mic_token(unsigned char **tokp, int toklen,
52 struct xdr_netobj *mic_hdr,
53 struct xdr_netobj *md5cksum, int md5elen, int md5zbit);
54u32 spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen,
55 unsigned char **cksum);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 88513fd8e208..f73c482ec9c6 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -127,13 +127,16 @@ struct rpc_task_setup {
127#define RPC_TASK_KILLED 0x0100 /* task was killed */ 127#define RPC_TASK_KILLED 0x0100 /* task was killed */
128#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ 128#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
129#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ 129#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
130#define RPC_TASK_SENT 0x0800 /* message was sent */
131#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
130 132
131#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 133#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
132#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
133#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 135#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
134#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
135#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 137#define RPC_IS_SOFT(t) ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT))
136#define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) 138#define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN)
139#define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT)
137 140
138#define RPC_TASK_RUNNING 0 141#define RPC_TASK_RUNNING 0
139#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
@@ -212,6 +215,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
212struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, 215struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
213 const struct rpc_call_ops *ops); 216 const struct rpc_call_ops *ops);
214void rpc_put_task(struct rpc_task *); 217void rpc_put_task(struct rpc_task *);
218void rpc_put_task_async(struct rpc_task *);
215void rpc_exit_task(struct rpc_task *); 219void rpc_exit_task(struct rpc_task *);
216void rpc_exit(struct rpc_task *, int); 220void rpc_exit(struct rpc_task *, int);
217void rpc_release_calldata(const struct rpc_call_ops *, void *); 221void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 5fa0f2084307..680471d1f28a 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -38,8 +38,21 @@ struct svc_stat {
38 rpcbadclnt; 38 rpcbadclnt;
39}; 39};
40 40
41void rpc_proc_init(void); 41struct net;
42void rpc_proc_exit(void); 42#ifdef CONFIG_PROC_FS
43int rpc_proc_init(struct net *);
44void rpc_proc_exit(struct net *);
45#else
46static inline int rpc_proc_init(struct net *net)
47{
48 return 0;
49}
50
51static inline void rpc_proc_exit(struct net *net)
52{
53}
54#endif
55
43#ifdef MODULE 56#ifdef MODULE
44void rpc_modcount(struct inode *, int); 57void rpc_modcount(struct inode *, int);
45#endif 58#endif
@@ -54,9 +67,6 @@ void svc_proc_unregister(const char *);
54 67
55void svc_seq_show(struct seq_file *, 68void svc_seq_show(struct seq_file *,
56 const struct svc_stat *); 69 const struct svc_stat *);
57
58extern struct proc_dir_entry *proc_net_rpc;
59
60#else 70#else
61 71
62static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } 72static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; }
@@ -69,9 +79,6 @@ static inline void svc_proc_unregister(const char *p) {}
69 79
70static inline void svc_seq_show(struct seq_file *seq, 80static inline void svc_seq_show(struct seq_file *seq,
71 const struct svc_stat *st) {} 81 const struct svc_stat *st) {}
72
73#define proc_net_rpc NULL
74
75#endif 82#endif
76 83
77#endif /* _LINUX_SUNRPC_STATS_H */ 84#endif /* _LINUX_SUNRPC_STATS_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 5a3085b9b394..ea29330b78bd 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -99,7 +99,7 @@ struct svc_serv {
99 spinlock_t sv_cb_lock; /* protects the svc_cb_list */ 99 spinlock_t sv_cb_lock; /* protects the svc_cb_list */
100 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no 100 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no
101 * entries in the svc_cb_list */ 101 * entries in the svc_cb_list */
102 struct svc_xprt *bc_xprt; 102 struct svc_xprt *sv_bc_xprt; /* callback on fore channel */
103#endif /* CONFIG_NFS_V4_1 */ 103#endif /* CONFIG_NFS_V4_1 */
104}; 104};
105 105
@@ -269,6 +269,7 @@ struct svc_rqst {
269 struct cache_req rq_chandle; /* handle passed to caches for 269 struct cache_req rq_chandle; /* handle passed to caches for
270 * request delaying 270 * request delaying
271 */ 271 */
272 bool rq_dropme;
272 /* Catering to nfsd */ 273 /* Catering to nfsd */
273 struct auth_domain * rq_client; /* RPC peer info */ 274 struct auth_domain * rq_client; /* RPC peer info */
274 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 275 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 5f4e18b3ce73..7ad9751a0d87 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -12,6 +12,7 @@
12 12
13struct svc_xprt_ops { 13struct svc_xprt_ops {
14 struct svc_xprt *(*xpo_create)(struct svc_serv *, 14 struct svc_xprt *(*xpo_create)(struct svc_serv *,
15 struct net *net,
15 struct sockaddr *, int, 16 struct sockaddr *, int,
16 int); 17 int);
17 struct svc_xprt *(*xpo_accept)(struct svc_xprt *); 18 struct svc_xprt *(*xpo_accept)(struct svc_xprt *);
@@ -32,6 +33,16 @@ struct svc_xprt_class {
32 u32 xcl_max_payload; 33 u32 xcl_max_payload;
33}; 34};
34 35
36/*
37 * This is embedded in an object that wants a callback before deleting
38 * an xprt; intended for use by NFSv4.1, which needs to know when a
39 * client's tcp connection (and hence possibly a backchannel) goes away.
40 */
41struct svc_xpt_user {
42 struct list_head list;
43 void (*callback)(struct svc_xpt_user *);
44};
45
35struct svc_xprt { 46struct svc_xprt {
36 struct svc_xprt_class *xpt_class; 47 struct svc_xprt_class *xpt_class;
37 struct svc_xprt_ops *xpt_ops; 48 struct svc_xprt_ops *xpt_ops;
@@ -52,7 +63,6 @@ struct svc_xprt {
52#define XPT_LISTENER 11 /* listening endpoint */ 63#define XPT_LISTENER 11 /* listening endpoint */
53#define XPT_CACHE_AUTH 12 /* cache auth info */ 64#define XPT_CACHE_AUTH 12 /* cache auth info */
54 65
55 struct svc_pool *xpt_pool; /* current pool iff queued */
56 struct svc_serv *xpt_server; /* service for transport */ 66 struct svc_serv *xpt_server; /* service for transport */
57 atomic_t xpt_reserved; /* space on outq that is rsvd */ 67 atomic_t xpt_reserved; /* space on outq that is rsvd */
58 struct mutex xpt_mutex; /* to serialize sending data */ 68 struct mutex xpt_mutex; /* to serialize sending data */
@@ -66,14 +76,42 @@ struct svc_xprt {
66 struct sockaddr_storage xpt_remote; /* remote peer's address */ 76 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */ 77 size_t xpt_remotelen; /* length of address */
68 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */ 78 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
79 struct list_head xpt_users; /* callbacks on free */
80
81 struct net *xpt_net;
82 struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */
69}; 83};
70 84
85static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u)
86{
87 spin_lock(&xpt->xpt_lock);
88 list_del_init(&u->list);
89 spin_unlock(&xpt->xpt_lock);
90}
91
92static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u)
93{
94 spin_lock(&xpt->xpt_lock);
95 if (test_bit(XPT_CLOSE, &xpt->xpt_flags)) {
96 /*
97 * The connection is about to be deleted soon (or,
98 * worse, may already be deleted--in which case we've
99 * already notified the xpt_users).
100 */
101 spin_unlock(&xpt->xpt_lock);
102 return -ENOTCONN;
103 }
104 list_add(&u->list, &xpt->xpt_users);
105 spin_unlock(&xpt->xpt_lock);
106 return 0;
107}
108
71int svc_reg_xprt_class(struct svc_xprt_class *); 109int svc_reg_xprt_class(struct svc_xprt_class *);
72void svc_unreg_xprt_class(struct svc_xprt_class *); 110void svc_unreg_xprt_class(struct svc_xprt_class *);
73void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 111void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
74 struct svc_serv *); 112 struct svc_serv *);
75int svc_create_xprt(struct svc_serv *, const char *, const int, 113int svc_create_xprt(struct svc_serv *, const char *, struct net *,
76 const unsigned short, int); 114 const int, const unsigned short, int);
77void svc_xprt_enqueue(struct svc_xprt *xprt); 115void svc_xprt_enqueue(struct svc_xprt *xprt);
78void svc_xprt_received(struct svc_xprt *); 116void svc_xprt_received(struct svc_xprt *);
79void svc_xprt_put(struct svc_xprt *xprt); 117void svc_xprt_put(struct svc_xprt *xprt);
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index d39dbdc7b10f..25d333c1b571 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -108,10 +108,15 @@ struct auth_ops {
108#define SVC_NEGATIVE 4 108#define SVC_NEGATIVE 4
109#define SVC_OK 5 109#define SVC_OK 5
110#define SVC_DROP 6 110#define SVC_DROP 6
111#define SVC_DENIED 7 111#define SVC_CLOSE 7 /* Like SVC_DROP, but request is definitely
112#define SVC_PENDING 8 112 * lost so if there is a tcp connection, it
113#define SVC_COMPLETE 9 113 * should be closed
114 */
115#define SVC_DENIED 8
116#define SVC_PENDING 9
117#define SVC_COMPLETE 10
114 118
119struct svc_xprt;
115 120
116extern int svc_authenticate(struct svc_rqst *rqstp, __be32 *authp); 121extern int svc_authenticate(struct svc_rqst *rqstp, __be32 *authp);
117extern int svc_authorise(struct svc_rqst *rqstp); 122extern int svc_authorise(struct svc_rqst *rqstp);
@@ -121,13 +126,13 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
121 126
122extern struct auth_domain *unix_domain_find(char *name); 127extern struct auth_domain *unix_domain_find(char *name);
123extern void auth_domain_put(struct auth_domain *item); 128extern void auth_domain_put(struct auth_domain *item);
124extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom); 129extern int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom);
125extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new); 130extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
126extern struct auth_domain *auth_domain_find(char *name); 131extern struct auth_domain *auth_domain_find(char *name);
127extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr); 132extern struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr);
128extern int auth_unix_forget_old(struct auth_domain *dom); 133extern int auth_unix_forget_old(struct auth_domain *dom);
129extern void svcauth_unix_purge(void); 134extern void svcauth_unix_purge(void);
130extern void svcauth_unix_info_release(void *); 135extern void svcauth_unix_info_release(struct svc_xprt *xpt);
131extern int svcauth_unix_set_client(struct svc_rqst *rqstp); 136extern int svcauth_unix_set_client(struct svc_rqst *rqstp);
132 137
133static inline unsigned long hash_str(char *name, int bits) 138static inline unsigned long hash_str(char *name, int bits)
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index ca7d725861fc..83bbee3f089c 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -2,7 +2,7 @@
2 * linux/include/linux/sunrpc/svcauth_gss.h 2 * linux/include/linux/sunrpc/svcauth_gss.h
3 * 3 *
4 * Bruce Fields <bfields@umich.edu> 4 * Bruce Fields <bfields@umich.edu>
5 * Copyright (c) 2002 The Regents of the Unviersity of Michigan 5 * Copyright (c) 2002 The Regents of the University of Michigan
6 */ 6 */
7 7
8#ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H 8#ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 1b353a76c304..04dba23c59f2 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -28,7 +28,6 @@ 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 */
32}; 31};
33 32
34/* 33/*
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index ab91d86565fd..fc84b7a19ca3 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -33,8 +33,8 @@ struct xdr_netobj {
33}; 33};
34 34
35/* 35/*
36 * This is the generic XDR function. rqstp is either a rpc_rqst (client 36 * This is the legacy generic XDR function. rqstp is either a rpc_rqst
37 * side) or svc_rqst pointer (server side). 37 * (client side) or svc_rqst pointer (server side).
38 * Encode functions always assume there's enough room in the buffer. 38 * Encode functions always assume there's enough room in the buffer.
39 */ 39 */
40typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 40typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
@@ -132,6 +132,13 @@ xdr_decode_hyper(__be32 *p, __u64 *valp)
132 return p + 2; 132 return p + 2;
133} 133}
134 134
135static inline __be32 *
136xdr_decode_opaque_fixed(__be32 *p, void *ptr, unsigned int len)
137{
138 memcpy(ptr, p, len);
139 return p + XDR_QUADLEN(len);
140}
141
135/* 142/*
136 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR) 143 * Adjust kvec to reflect end of xdr'ed data (RPC client XDR)
137 */ 144 */
@@ -194,14 +201,22 @@ struct xdr_stream {
194 201
195 __be32 *end; /* end of available buffer space */ 202 __be32 *end; /* end of available buffer space */
196 struct kvec *iov; /* pointer to the current kvec */ 203 struct kvec *iov; /* pointer to the current kvec */
204 struct kvec scratch; /* Scratch buffer */
205 struct page **page_ptr; /* pointer to the current page */
197}; 206};
198 207
208/*
209 * These are the xdr_stream style generic XDR encode and decode functions.
210 */
211typedef void (*kxdreproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj);
212typedef int (*kxdrdproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj);
213
199extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); 214extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
200extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 215extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
201extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, 216extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
202 unsigned int base, unsigned int len); 217 unsigned int base, unsigned int len);
203extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); 218extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
204extern __be32 *xdr_inline_peek(struct xdr_stream *xdr, size_t nbytes); 219extern void xdr_set_scratch_buffer(struct xdr_stream *xdr, void *buf, size_t buflen);
205extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 220extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
206extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 221extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
207extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); 222extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index ff5a77b28c50..a0f998c07c65 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -12,7 +12,6 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h>
16#include <linux/ktime.h> 15#include <linux/ktime.h>
17#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
18#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
@@ -146,7 +145,7 @@ enum xprt_transports {
146}; 145};
147 146
148struct rpc_xprt { 147struct rpc_xprt {
149 struct kref kref; /* Reference count */ 148 atomic_t count; /* Reference count */
150 struct rpc_xprt_ops * ops; /* transport methods */ 149 struct rpc_xprt_ops * ops; /* transport methods */
151 150
152 const struct rpc_timeout *timeout; /* timeout parms */ 151 const struct rpc_timeout *timeout; /* timeout parms */
@@ -224,6 +223,7 @@ struct rpc_xprt {
224 bklog_u; /* backlog queue utilization */ 223 bklog_u; /* backlog queue utilization */
225 } stat; 224 } stat;
226 225
226 struct net *xprt_net;
227 const char *address_strings[RPC_DISPLAY_MAX]; 227 const char *address_strings[RPC_DISPLAY_MAX];
228}; 228};
229 229
@@ -249,6 +249,7 @@ static inline int bc_prealloc(struct rpc_rqst *req)
249 249
250struct xprt_create { 250struct xprt_create {
251 int ident; /* XPRT_TRANSPORT identifier */ 251 int ident; /* XPRT_TRANSPORT identifier */
252 struct net * net;
252 struct sockaddr * srcaddr; /* optional local address */ 253 struct sockaddr * srcaddr; /* optional local address */
253 struct sockaddr * dstaddr; /* remote peer address */ 254 struct sockaddr * dstaddr; /* remote peer address */
254 size_t addrlen; 255 size_t addrlen;
@@ -280,6 +281,8 @@ void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
280void xprt_release(struct rpc_task *task); 281void xprt_release(struct rpc_task *task);
281struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); 282struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
282void xprt_put(struct rpc_xprt *xprt); 283void xprt_put(struct rpc_xprt *xprt);
284struct rpc_xprt * xprt_alloc(struct net *net, int size, int max_req);
285void xprt_free(struct rpc_xprt *);
283 286
284static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) 287static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
285{ 288{
@@ -317,6 +320,7 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
317#define XPRT_CLOSING (6) 320#define XPRT_CLOSING (6)
318#define XPRT_CONNECTION_ABORT (7) 321#define XPRT_CONNECTION_ABORT (7)
319#define XPRT_CONNECTION_CLOSE (8) 322#define XPRT_CONNECTION_CLOSE (8)
323#define XPRT_INITIALIZED (9)
320 324
321static inline void xprt_set_connected(struct rpc_xprt *xprt) 325static inline void xprt_set_connected(struct rpc_xprt *xprt)
322{ 326{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 26697514c5ec..083ffea7ba18 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -122,7 +122,7 @@ struct platform_suspend_ops {
122 * suspend_set_ops - set platform dependent suspend operations 122 * suspend_set_ops - set platform dependent suspend operations
123 * @ops: The new suspend operations to set. 123 * @ops: The new suspend operations to set.
124 */ 124 */
125extern void suspend_set_ops(struct platform_suspend_ops *ops); 125extern void suspend_set_ops(const struct platform_suspend_ops *ops);
126extern int suspend_valid_only_mem(suspend_state_t state); 126extern int suspend_valid_only_mem(suspend_state_t state);
127 127
128/** 128/**
@@ -147,7 +147,7 @@ extern int pm_suspend(suspend_state_t state);
147#else /* !CONFIG_SUSPEND */ 147#else /* !CONFIG_SUSPEND */
148#define suspend_valid_only_mem NULL 148#define suspend_valid_only_mem NULL
149 149
150static inline void suspend_set_ops(struct platform_suspend_ops *ops) {} 150static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
151static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 151static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
152#endif /* !CONFIG_SUSPEND */ 152#endif /* !CONFIG_SUSPEND */
153 153
@@ -245,36 +245,21 @@ extern void swsusp_set_page_free(struct page *);
245extern void swsusp_unset_page_free(struct page *); 245extern void swsusp_unset_page_free(struct page *);
246extern unsigned long get_safe_page(gfp_t gfp_mask); 246extern unsigned long get_safe_page(gfp_t gfp_mask);
247 247
248extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 248extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
249extern int hibernate(void); 249extern int hibernate(void);
250extern bool system_entering_hibernation(void); 250extern bool system_entering_hibernation(void);
251#else /* CONFIG_HIBERNATION */ 251#else /* CONFIG_HIBERNATION */
252static inline void register_nosave_region(unsigned long b, unsigned long e) {}
253static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
252static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 254static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
253static inline void swsusp_set_page_free(struct page *p) {} 255static inline void swsusp_set_page_free(struct page *p) {}
254static inline void swsusp_unset_page_free(struct page *p) {} 256static inline void swsusp_unset_page_free(struct page *p) {}
255 257
256static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 258static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
257static inline int hibernate(void) { return -ENOSYS; } 259static inline int hibernate(void) { return -ENOSYS; }
258static inline bool system_entering_hibernation(void) { return false; } 260static inline bool system_entering_hibernation(void) { return false; }
259#endif /* CONFIG_HIBERNATION */ 261#endif /* CONFIG_HIBERNATION */
260 262
261#ifdef CONFIG_SUSPEND_NVS
262extern int suspend_nvs_register(unsigned long start, unsigned long size);
263extern int suspend_nvs_alloc(void);
264extern void suspend_nvs_free(void);
265extern void suspend_nvs_save(void);
266extern void suspend_nvs_restore(void);
267#else /* CONFIG_SUSPEND_NVS */
268static inline int suspend_nvs_register(unsigned long a, unsigned long b)
269{
270 return 0;
271}
272static inline int suspend_nvs_alloc(void) { return 0; }
273static inline void suspend_nvs_free(void) {}
274static inline void suspend_nvs_save(void) {}
275static inline void suspend_nvs_restore(void) {}
276#endif /* CONFIG_SUSPEND_NVS */
277
278#ifdef CONFIG_PM_SLEEP 263#ifdef CONFIG_PM_SLEEP
279void save_processor_state(void); 264void save_processor_state(void);
280void restore_processor_state(void); 265void restore_processor_state(void);
@@ -292,7 +277,7 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
292/* drivers/base/power/wakeup.c */ 277/* drivers/base/power/wakeup.c */
293extern bool events_check_enabled; 278extern bool events_check_enabled;
294 279
295extern bool pm_check_wakeup_events(void); 280extern bool pm_wakeup_pending(void);
296extern bool pm_get_wakeup_count(unsigned int *count); 281extern bool pm_get_wakeup_count(unsigned int *count);
297extern bool pm_save_wakeup_count(unsigned int count); 282extern bool pm_save_wakeup_count(unsigned int count);
298#else /* !CONFIG_PM_SLEEP */ 283#else /* !CONFIG_PM_SLEEP */
@@ -309,19 +294,12 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
309 294
310#define pm_notifier(fn, pri) do { (void)(fn); } while (0) 295#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
311 296
312static inline bool pm_check_wakeup_events(void) { return true; } 297static inline bool pm_wakeup_pending(void) { return false; }
313#endif /* !CONFIG_PM_SLEEP */ 298#endif /* !CONFIG_PM_SLEEP */
314 299
315extern struct mutex pm_mutex; 300extern struct mutex pm_mutex;
316 301
317#ifndef CONFIG_HIBERNATION 302#ifndef CONFIG_HIBERNATE_CALLBACKS
318static inline void register_nosave_region(unsigned long b, unsigned long e)
319{
320}
321static inline void register_nosave_region_late(unsigned long b, unsigned long e)
322{
323}
324
325static inline void lock_system_sleep(void) {} 303static inline void lock_system_sleep(void) {}
326static inline void unlock_system_sleep(void) {} 304static inline void unlock_system_sleep(void) {}
327 305
diff --git a/include/linux/svga.h b/include/linux/svga.h
index c59a51a2b0e7..bfa68e837d6a 100644
--- a/include/linux/svga.h
+++ b/include/linux/svga.h
@@ -67,25 +67,25 @@ struct svga_pll {
67 67
68/* Write a value to the attribute register */ 68/* Write a value to the attribute register */
69 69
70static inline void svga_wattr(u8 index, u8 data) 70static inline void svga_wattr(void __iomem *regbase, u8 index, u8 data)
71{ 71{
72 inb(0x3DA); 72 vga_r(regbase, VGA_IS1_RC);
73 outb(index, 0x3C0); 73 vga_w(regbase, VGA_ATT_IW, index);
74 outb(data, 0x3C0); 74 vga_w(regbase, VGA_ATT_W, data);
75} 75}
76 76
77/* Write a value to a sequence register with a mask */ 77/* Write a value to a sequence register with a mask */
78 78
79static inline void svga_wseq_mask(u8 index, u8 data, u8 mask) 79static inline void svga_wseq_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
80{ 80{
81 vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask)); 81 vga_wseq(regbase, index, (data & mask) | (vga_rseq(regbase, index) & ~mask));
82} 82}
83 83
84/* Write a value to a CRT register with a mask */ 84/* Write a value to a CRT register with a mask */
85 85
86static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask) 86static inline void svga_wcrt_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
87{ 87{
88 vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask)); 88 vga_wcrt(regbase, index, (data & mask) | (vga_rcrt(regbase, index) & ~mask));
89} 89}
90 90
91static inline int svga_primary_device(struct pci_dev *dev) 91static inline int svga_primary_device(struct pci_dev *dev)
@@ -96,27 +96,27 @@ static inline int svga_primary_device(struct pci_dev *dev)
96} 96}
97 97
98 98
99void svga_wcrt_multi(const struct vga_regset *regset, u32 value); 99void svga_wcrt_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
100void svga_wseq_multi(const struct vga_regset *regset, u32 value); 100void svga_wseq_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
101 101
102void svga_set_default_gfx_regs(void); 102void svga_set_default_gfx_regs(void __iomem *regbase);
103void svga_set_default_atc_regs(void); 103void svga_set_default_atc_regs(void __iomem *regbase);
104void svga_set_default_seq_regs(void); 104void svga_set_default_seq_regs(void __iomem *regbase);
105void svga_set_default_crt_regs(void); 105void svga_set_default_crt_regs(void __iomem *regbase);
106void svga_set_textmode_vga_regs(void); 106void svga_set_textmode_vga_regs(void __iomem *regbase);
107 107
108void svga_settile(struct fb_info *info, struct fb_tilemap *map); 108void svga_settile(struct fb_info *info, struct fb_tilemap *map);
109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area); 109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect); 110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit); 111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
112void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor); 112void svga_tilecursor(void __iomem *regbase, struct fb_info *info, struct fb_tilecursor *cursor);
113int svga_get_tilemax(struct fb_info *info); 113int svga_get_tilemax(struct fb_info *info);
114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps, 114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
115 struct fb_var_screeninfo *var); 115 struct fb_var_screeninfo *var);
116 116
117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node); 117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node); 118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
119void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node); 119void svga_set_timings(void __iomem *regbase, const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
120 120
121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
122 122
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7cdd63366f88..a5c6da5d8df8 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -155,6 +155,15 @@ enum {
155#define SWAP_CLUSTER_MAX 32 155#define SWAP_CLUSTER_MAX 32
156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
157 157
158/*
159 * Ratio between the present memory in the zone and the "gap" that
160 * we're allowing kswapd to shrink in addition to the per-zone high
161 * wmark, even for zones that already have the high wmark satisfied,
162 * in order to provide better per-zone lru behavior. We are ok to
163 * spend not more than 1% of the memory for this zone balancing "gap".
164 */
165#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
166
158#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 167#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
159#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 168#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
160#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ 169#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */
@@ -208,11 +217,14 @@ extern unsigned int nr_free_pagecache_pages(void);
208/* linux/mm/swap.c */ 217/* linux/mm/swap.c */
209extern void __lru_cache_add(struct page *, enum lru_list lru); 218extern void __lru_cache_add(struct page *, enum lru_list lru);
210extern void lru_cache_add_lru(struct page *, enum lru_list lru); 219extern void lru_cache_add_lru(struct page *, enum lru_list lru);
220extern void lru_add_page_tail(struct zone* zone,
221 struct page *page, struct page *page_tail);
211extern void activate_page(struct page *); 222extern void activate_page(struct page *);
212extern void mark_page_accessed(struct page *); 223extern void mark_page_accessed(struct page *);
213extern void lru_add_drain(void); 224extern void lru_add_drain(void);
214extern int lru_add_drain_all(void); 225extern int lru_add_drain_all(void);
215extern void rotate_reclaimable_page(struct page *page); 226extern void rotate_reclaimable_page(struct page *page);
227extern void deactivate_page(struct page *page);
216extern void swap_setup(void); 228extern void swap_setup(void);
217 229
218extern void add_page_to_unevictable_list(struct page *page); 230extern void add_page_to_unevictable_list(struct page *page);
@@ -271,8 +283,18 @@ extern void scan_mapping_unevictable_pages(struct address_space *);
271extern unsigned long scan_unevictable_pages; 283extern unsigned long scan_unevictable_pages;
272extern int scan_unevictable_handler(struct ctl_table *, int, 284extern int scan_unevictable_handler(struct ctl_table *, int,
273 void __user *, size_t *, loff_t *); 285 void __user *, size_t *, loff_t *);
286#ifdef CONFIG_NUMA
274extern int scan_unevictable_register_node(struct node *node); 287extern int scan_unevictable_register_node(struct node *node);
275extern void scan_unevictable_unregister_node(struct node *node); 288extern void scan_unevictable_unregister_node(struct node *node);
289#else
290static inline int scan_unevictable_register_node(struct node *node)
291{
292 return 0;
293}
294static inline void scan_unevictable_unregister_node(struct node *node)
295{
296}
297#endif
276 298
277extern int kswapd_run(int nid); 299extern int kswapd_run(int nid);
278extern void kswapd_stop(int nid); 300extern void kswapd_stop(int nid);
@@ -287,8 +309,6 @@ extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
287 struct page **pagep, swp_entry_t *ent); 309 struct page **pagep, swp_entry_t *ent);
288#endif 310#endif
289 311
290extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
291
292#ifdef CONFIG_SWAP 312#ifdef CONFIG_SWAP
293/* linux/mm/page_io.c */ 313/* linux/mm/page_io.c */
294extern int swap_readpage(struct page *); 314extern int swap_readpage(struct page *);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 0ff2779c44d0..2e7d81c4e5ad 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -126,6 +126,7 @@
126#define MGSL_MODE_BISYNC 4 126#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6 127#define MGSL_MODE_RAW 6
128#define MGSL_MODE_BASE_CLOCK 7 128#define MGSL_MODE_BASE_CLOCK 7
129#define MGSL_MODE_XSYNC 8
129 130
130#define MGSL_BUS_TYPE_ISA 1 131#define MGSL_BUS_TYPE_ISA 1
131#define MGSL_BUS_TYPE_EISA 2 132#define MGSL_BUS_TYPE_EISA 2
@@ -290,6 +291,10 @@ struct gpio_desc {
290#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc) 291#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
291#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc) 292#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
292#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc) 293#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
294#define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19)
295#define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20)
296#define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21)
297#define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22)
293 298
294#ifdef __KERNEL__ 299#ifdef __KERNEL__
295/* provide 32 bit ioctl compatibility on 64 bit systems */ 300/* provide 32 bit ioctl compatibility on 64 bit systems */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index e6319d18a55d..ab71447d0c5a 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -62,6 +62,7 @@ struct robust_list_head;
62struct getcpu_cache; 62struct getcpu_cache;
63struct old_linux_dirent; 63struct old_linux_dirent;
64struct perf_event_attr; 64struct perf_event_attr;
65struct file_handle;
65 66
66#include <linux/types.h> 67#include <linux/types.h>
67#include <linux/aio_abi.h> 68#include <linux/aio_abi.h>
@@ -125,64 +126,66 @@ extern struct trace_event_functions enter_syscall_print_funcs;
125extern struct trace_event_functions exit_syscall_print_funcs; 126extern struct trace_event_functions exit_syscall_print_funcs;
126 127
127#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 128#define SYSCALL_TRACE_ENTER_EVENT(sname) \
128 static struct syscall_metadata \ 129 static struct syscall_metadata __syscall_meta_##sname; \
129 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
130 static struct ftrace_event_call \
131 __attribute__((__aligned__(4))) event_enter_##sname; \
132 static struct ftrace_event_call __used \ 130 static struct ftrace_event_call __used \
133 __attribute__((__aligned__(4))) \
134 __attribute__((section("_ftrace_events"))) \
135 event_enter_##sname = { \ 131 event_enter_##sname = { \
136 .name = "sys_enter"#sname, \ 132 .name = "sys_enter"#sname, \
137 .class = &event_class_syscall_enter, \ 133 .class = &event_class_syscall_enter, \
138 .event.funcs = &enter_syscall_print_funcs, \ 134 .event.funcs = &enter_syscall_print_funcs, \
139 .data = (void *)&__syscall_meta_##sname,\ 135 .data = (void *)&__syscall_meta_##sname,\
140 } 136 .flags = TRACE_EVENT_FL_CAP_ANY, \
137 }; \
138 static struct ftrace_event_call __used \
139 __attribute__((section("_ftrace_events"))) \
140 *__event_enter_##sname = &event_enter_##sname;
141 141
142#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 142#define SYSCALL_TRACE_EXIT_EVENT(sname) \
143 static struct syscall_metadata \ 143 static struct syscall_metadata __syscall_meta_##sname; \
144 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
145 static struct ftrace_event_call \
146 __attribute__((__aligned__(4))) event_exit_##sname; \
147 static struct ftrace_event_call __used \ 144 static struct ftrace_event_call __used \
148 __attribute__((__aligned__(4))) \
149 __attribute__((section("_ftrace_events"))) \
150 event_exit_##sname = { \ 145 event_exit_##sname = { \
151 .name = "sys_exit"#sname, \ 146 .name = "sys_exit"#sname, \
152 .class = &event_class_syscall_exit, \ 147 .class = &event_class_syscall_exit, \
153 .event.funcs = &exit_syscall_print_funcs, \ 148 .event.funcs = &exit_syscall_print_funcs, \
154 .data = (void *)&__syscall_meta_##sname,\ 149 .data = (void *)&__syscall_meta_##sname,\
155 } 150 .flags = TRACE_EVENT_FL_CAP_ANY, \
151 }; \
152 static struct ftrace_event_call __used \
153 __attribute__((section("_ftrace_events"))) \
154 *__event_exit_##sname = &event_exit_##sname;
156 155
157#define SYSCALL_METADATA(sname, nb) \ 156#define SYSCALL_METADATA(sname, nb) \
158 SYSCALL_TRACE_ENTER_EVENT(sname); \ 157 SYSCALL_TRACE_ENTER_EVENT(sname); \
159 SYSCALL_TRACE_EXIT_EVENT(sname); \ 158 SYSCALL_TRACE_EXIT_EVENT(sname); \
160 static struct syscall_metadata __used \ 159 static struct syscall_metadata __used \
161 __attribute__((__aligned__(4))) \
162 __attribute__((section("__syscalls_metadata"))) \
163 __syscall_meta_##sname = { \ 160 __syscall_meta_##sname = { \
164 .name = "sys"#sname, \ 161 .name = "sys"#sname, \
162 .syscall_nr = -1, /* Filled in at boot */ \
165 .nb_args = nb, \ 163 .nb_args = nb, \
166 .types = types_##sname, \ 164 .types = types_##sname, \
167 .args = args_##sname, \ 165 .args = args_##sname, \
168 .enter_event = &event_enter_##sname, \ 166 .enter_event = &event_enter_##sname, \
169 .exit_event = &event_exit_##sname, \ 167 .exit_event = &event_exit_##sname, \
170 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 168 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
171 }; 169 }; \
170 static struct syscall_metadata __used \
171 __attribute__((section("__syscalls_metadata"))) \
172 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
172 173
173#define SYSCALL_DEFINE0(sname) \ 174#define SYSCALL_DEFINE0(sname) \
174 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 175 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
175 SYSCALL_TRACE_EXIT_EVENT(_##sname); \ 176 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
176 static struct syscall_metadata __used \ 177 static struct syscall_metadata __used \
177 __attribute__((__aligned__(4))) \
178 __attribute__((section("__syscalls_metadata"))) \
179 __syscall_meta__##sname = { \ 178 __syscall_meta__##sname = { \
180 .name = "sys_"#sname, \ 179 .name = "sys_"#sname, \
180 .syscall_nr = -1, /* Filled in at boot */ \
181 .nb_args = 0, \ 181 .nb_args = 0, \
182 .enter_event = &event_enter__##sname, \ 182 .enter_event = &event_enter__##sname, \
183 .exit_event = &event_exit__##sname, \ 183 .exit_event = &event_exit__##sname, \
184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ 184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
185 }; \ 185 }; \
186 static struct syscall_metadata __used \
187 __attribute__((section("__syscalls_metadata"))) \
188 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
186 asmlinkage long sys_##sname(void) 189 asmlinkage long sys_##sname(void)
187#else 190#else
188#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 191#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
@@ -313,6 +316,8 @@ asmlinkage long sys_clock_settime(clockid_t which_clock,
313 const struct timespec __user *tp); 316 const struct timespec __user *tp);
314asmlinkage long sys_clock_gettime(clockid_t which_clock, 317asmlinkage long sys_clock_gettime(clockid_t which_clock,
315 struct timespec __user *tp); 318 struct timespec __user *tp);
319asmlinkage long sys_clock_adjtime(clockid_t which_clock,
320 struct timex __user *tx);
316asmlinkage long sys_clock_getres(clockid_t which_clock, 321asmlinkage long sys_clock_getres(clockid_t which_clock,
317 struct timespec __user *tp); 322 struct timespec __user *tp);
318asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, 323asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags,
@@ -605,6 +610,8 @@ asmlinkage long sys_send(int, void __user *, size_t, unsigned);
605asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, 610asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
606 struct sockaddr __user *, int); 611 struct sockaddr __user *, int);
607asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 612asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
613asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
614 unsigned int vlen, unsigned flags);
608asmlinkage long sys_recv(int, void __user *, size_t, unsigned); 615asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
609asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, 616asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
610 struct sockaddr __user *, int __user *); 617 struct sockaddr __user *, int __user *);
@@ -701,7 +708,8 @@ asmlinkage long sys_nfsservctl(int cmd,
701asmlinkage long sys_syslog(int type, char __user *buf, int len); 708asmlinkage long sys_syslog(int type, char __user *buf, int len);
702asmlinkage long sys_uselib(const char __user *library); 709asmlinkage long sys_uselib(const char __user *library);
703asmlinkage long sys_ni_syscall(void); 710asmlinkage long sys_ni_syscall(void);
704asmlinkage long sys_ptrace(long request, long pid, long addr, long data); 711asmlinkage long sys_ptrace(long request, long pid, unsigned long addr,
712 unsigned long data);
705 713
706asmlinkage long sys_add_key(const char __user *_type, 714asmlinkage long sys_add_key(const char __user *_type,
707 const char __user *_description, 715 const char __user *_description,
@@ -819,6 +827,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags
819asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 827asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd, 828 u64 mask, int fd,
821 const char __user *pathname); 829 const char __user *pathname);
830asmlinkage long sys_syncfs(int fd);
822 831
823int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 832int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
824 833
@@ -831,5 +840,10 @@ asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
831 unsigned long prot, unsigned long flags, 840 unsigned long prot, unsigned long flags,
832 unsigned long fd, unsigned long pgoff); 841 unsigned long fd, unsigned long pgoff);
833asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); 842asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
834 843asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name,
844 struct file_handle __user *handle,
845 int __user *mnt_id, int flag);
846asmlinkage long sys_open_by_handle_at(int mountdirfd,
847 struct file_handle __user *handle,
848 int flags);
835#endif 849#endif
diff --git a/include/linux/syscore_ops.h b/include/linux/syscore_ops.h
new file mode 100644
index 000000000000..27b3b0bc41a9
--- /dev/null
+++ b/include/linux/syscore_ops.h
@@ -0,0 +1,29 @@
1/*
2 * syscore_ops.h - System core operations.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_SYSCORE_OPS_H
10#define _LINUX_SYSCORE_OPS_H
11
12#include <linux/list.h>
13
14struct syscore_ops {
15 struct list_head node;
16 int (*suspend)(void);
17 void (*resume)(void);
18 void (*shutdown)(void);
19};
20
21extern void register_syscore_ops(struct syscore_ops *ops);
22extern void unregister_syscore_ops(struct syscore_ops *ops);
23#ifdef CONFIG_PM_SLEEP
24extern int syscore_suspend(void);
25extern void syscore_resume(void);
26#endif
27extern void syscore_shutdown(void);
28
29#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 7bb5cb64f3b8..11684d9e6bd2 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -930,6 +930,7 @@ enum
930 930
931#ifdef __KERNEL__ 931#ifdef __KERNEL__
932#include <linux/list.h> 932#include <linux/list.h>
933#include <linux/rcupdate.h>
933 934
934/* For the /proc/sys support */ 935/* For the /proc/sys support */
935struct ctl_table; 936struct ctl_table;
@@ -1037,10 +1038,15 @@ struct ctl_table_root {
1037 struct ctl_table trees. */ 1038 struct ctl_table trees. */
1038struct ctl_table_header 1039struct ctl_table_header
1039{ 1040{
1040 struct ctl_table *ctl_table; 1041 union {
1041 struct list_head ctl_entry; 1042 struct {
1042 int used; 1043 struct ctl_table *ctl_table;
1043 int count; 1044 struct list_head ctl_entry;
1045 int used;
1046 int count;
1047 };
1048 struct rcu_head rcu;
1049 };
1044 struct completion *unregistering; 1050 struct completion *unregistering;
1045 struct ctl_table *ctl_table_arg; 1051 struct ctl_table *ctl_table_arg;
1046 struct ctl_table_root *root; 1052 struct ctl_table_root *root;
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 1154c29f4101..d35e783a598c 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -7,13 +7,13 @@
7 * We still have a notion of a driver for a system device, because we still 7 * We still have a notion of a driver for a system device, because we still
8 * want to perform basic operations on these devices. 8 * want to perform basic operations on these devices.
9 * 9 *
10 * We also support auxillary drivers binding to devices of a certain class. 10 * We also support auxiliary drivers binding to devices of a certain class.
11 * 11 *
12 * This allows configurable drivers to register themselves for devices of 12 * This allows configurable drivers to register themselves for devices of
13 * a certain type. And, it allows class definitions to reside in generic 13 * a certain type. And, it allows class definitions to reside in generic
14 * code while arch-specific code can register specific drivers. 14 * code while arch-specific code can register specific drivers.
15 * 15 *
16 * Auxillary drivers registered with a NULL cls are registered as drivers 16 * Auxiliary drivers registered with a NULL cls are registered as drivers
17 * for all system devices, and get notification calls for each device. 17 * for all system devices, and get notification calls for each device.
18 */ 18 */
19 19
@@ -33,11 +33,6 @@ struct sysdev_class {
33 const char *name; 33 const char *name;
34 struct list_head drivers; 34 struct list_head drivers;
35 struct sysdev_class_attribute **attrs; 35 struct sysdev_class_attribute **attrs;
36
37 /* Default operations for these types of devices */
38 int (*shutdown)(struct sys_device *);
39 int (*suspend)(struct sys_device *, pm_message_t state);
40 int (*resume)(struct sys_device *);
41 struct kset kset; 36 struct kset kset;
42}; 37};
43 38
@@ -69,16 +64,13 @@ extern int sysdev_class_create_file(struct sysdev_class *,
69extern void sysdev_class_remove_file(struct sysdev_class *, 64extern void sysdev_class_remove_file(struct sysdev_class *,
70 struct sysdev_class_attribute *); 65 struct sysdev_class_attribute *);
71/** 66/**
72 * Auxillary system device drivers. 67 * Auxiliary system device drivers.
73 */ 68 */
74 69
75struct sysdev_driver { 70struct sysdev_driver {
76 struct list_head entry; 71 struct list_head entry;
77 int (*add)(struct sys_device *); 72 int (*add)(struct sys_device *);
78 int (*remove)(struct sys_device *); 73 int (*remove)(struct sys_device *);
79 int (*shutdown)(struct sys_device *);
80 int (*suspend)(struct sys_device *, pm_message_t state);
81 int (*resume)(struct sys_device *);
82}; 74};
83 75
84 76
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 30b881555fa5..c3acda60eee0 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -176,7 +176,6 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
176 const unsigned char *name); 176 const unsigned char *name);
177struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 177struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
178void sysfs_put(struct sysfs_dirent *sd); 178void sysfs_put(struct sysfs_dirent *sd);
179void sysfs_printk_last_file(void);
180 179
181/* Called to clear a ns tag when it is no longer valid */ 180/* Called to clear a ns tag when it is no longer valid */
182void sysfs_exit_ns(enum kobj_ns_type type, const void *tag); 181void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
@@ -348,10 +347,6 @@ static inline int __must_check sysfs_init(void)
348 return 0; 347 return 0;
349} 348}
350 349
351static inline void sysfs_printk_last_file(void)
352{
353}
354
355#endif /* CONFIG_SYSFS */ 350#endif /* CONFIG_SYSFS */
356 351
357#endif /* _SYSFS_H_ */ 352#endif /* _SYSFS_H_ */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 387fa7d05c98..7faf933cced7 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -17,6 +17,9 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
21#define SYSRQ_DEFAULT_ENABLE 1
22
20/* Possible values of bitmask for enabling sysrq functions */ 23/* Possible values of bitmask for enabling sysrq functions */
21/* 0x0001 is reserved for enable everything */ 24/* 0x0001 is reserved for enable everything */
22#define SYSRQ_ENABLE_LOG 0x0002 25#define SYSRQ_ENABLE_LOG 0x0002
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index 341dddb55090..2466e550a41d 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35 35
36#define TASKSTATS_VERSION 7 36#define TASKSTATS_VERSION 8
37#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 37#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
38 * in linux/sched.h */ 38 * in linux/sched.h */
39 39
@@ -188,6 +188,7 @@ enum {
188 TASKSTATS_TYPE_STATS, /* taskstats structure */ 188 TASKSTATS_TYPE_STATS, /* taskstats structure */
189 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */ 189 TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
190 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */ 190 TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
191 TASKSTATS_TYPE_NULL, /* contains nothing */
191 __TASKSTATS_TYPE_MAX, 192 __TASKSTATS_TYPE_MAX,
192}; 193};
193 194
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 1de8b9eb841b..d3ec89fb4122 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -77,7 +77,7 @@ struct thermal_cooling_device {
77 char type[THERMAL_NAME_LENGTH]; 77 char type[THERMAL_NAME_LENGTH];
78 struct device device; 78 struct device device;
79 void *devdata; 79 void *devdata;
80 struct thermal_cooling_device_ops *ops; 80 const struct thermal_cooling_device_ops *ops;
81 struct list_head node; 81 struct list_head node;
82}; 82};
83 83
@@ -114,7 +114,7 @@ struct thermal_zone_device {
114 int last_temperature; 114 int last_temperature;
115 bool passive; 115 bool passive;
116 unsigned int forced_passive; 116 unsigned int forced_passive;
117 struct thermal_zone_device_ops *ops; 117 const struct thermal_zone_device_ops *ops;
118 struct list_head cooling_devices; 118 struct list_head cooling_devices;
119 struct idr idr; 119 struct idr idr;
120 struct mutex lock; /* protect cooling devices list */ 120 struct mutex lock; /* protect cooling devices list */
@@ -127,13 +127,41 @@ struct thermal_zone_device {
127 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ 127 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
128#endif 128#endif
129}; 129};
130/* Adding event notification support elements */
131#define THERMAL_GENL_FAMILY_NAME "thermal_event"
132#define THERMAL_GENL_VERSION 0x01
133#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
134
135enum events {
136 THERMAL_AUX0,
137 THERMAL_AUX1,
138 THERMAL_CRITICAL,
139 THERMAL_DEV_FAULT,
140};
141
142struct thermal_genl_event {
143 u32 orig;
144 enum events event;
145};
146/* attributes of thermal_genl_family */
147enum {
148 THERMAL_GENL_ATTR_UNSPEC,
149 THERMAL_GENL_ATTR_EVENT,
150 __THERMAL_GENL_ATTR_MAX,
151};
152#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
153
154/* commands supported by the thermal_genl_family */
155enum {
156 THERMAL_GENL_CMD_UNSPEC,
157 THERMAL_GENL_CMD_EVENT,
158 __THERMAL_GENL_CMD_MAX,
159};
160#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
130 161
131struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, 162struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
132 struct 163 const struct thermal_zone_device_ops *, int tc1, int tc2,
133 thermal_zone_device_ops 164 int passive_freq, int polling_freq);
134 *, int tc1, int tc2,
135 int passive_freq,
136 int polling_freq);
137void thermal_zone_device_unregister(struct thermal_zone_device *); 165void thermal_zone_device_unregister(struct thermal_zone_device *);
138 166
139int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 167int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
@@ -142,9 +170,16 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
142 struct thermal_cooling_device *); 170 struct thermal_cooling_device *);
143void thermal_zone_device_update(struct thermal_zone_device *); 171void thermal_zone_device_update(struct thermal_zone_device *);
144struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 172struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
145 struct 173 const struct thermal_cooling_device_ops *);
146 thermal_cooling_device_ops
147 *);
148void thermal_cooling_device_unregister(struct thermal_cooling_device *); 174void thermal_cooling_device_unregister(struct thermal_cooling_device *);
149 175
176#ifdef CONFIG_NET
177extern int generate_netlink_event(u32 orig, enum events event);
178#else
179static inline int generate_netlink_event(u32 orig, enum events event)
180{
181 return 0;
182}
183#endif
184
150#endif /* __THERMAL_H__ */ 185#endif /* __THERMAL_H__ */
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index c90696544176..20fc303947d3 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -18,9 +18,6 @@ struct compat_timespec;
18struct restart_block { 18struct restart_block {
19 long (*fn)(struct restart_block *); 19 long (*fn)(struct restart_block *);
20 union { 20 union {
21 struct {
22 unsigned long arg0, arg1, arg2, arg3;
23 };
24 /* For futex_wait and futex_wait_requeue_pi */ 21 /* For futex_wait and futex_wait_requeue_pi */
25 struct { 22 struct {
26 u32 __user *uaddr; 23 u32 __user *uaddr;
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
new file mode 100644
index 000000000000..b004e557caa9
--- /dev/null
+++ b/include/linux/ti_wilink_st.h
@@ -0,0 +1,423 @@
1/*
2 * Shared Transport Header file
3 * To be included by the protocol stack drivers for
4 * Texas Instruments BT,FM and GPS combo chip drivers
5 * and also serves the sub-modules of the shared transport driver.
6 *
7 * Copyright (C) 2009-2010 Texas Instruments
8 * Author: Pavan Savoy <pavan_savoy@ti.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 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef TI_WILINK_ST_H
26#define TI_WILINK_ST_H
27
28/**
29 * enum proto-type - The protocol on WiLink chips which share a
30 * common physical interface like UART.
31 */
32enum proto_type {
33 ST_BT,
34 ST_FM,
35 ST_GPS,
36 ST_MAX_CHANNELS = 16,
37};
38
39/**
40 * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST
41 * @type: type of the protocol being registered among the
42 * available proto_type(BT, FM, GPS the protocol which share TTY).
43 * @recv: the receiver callback pointing to a function in the
44 * protocol drivers called by the ST driver upon receiving
45 * relevant data.
46 * @match_packet: reserved for future use, to make ST more generic
47 * @reg_complete_cb: callback handler pointing to a function in protocol
48 * handler called by ST when the pending registrations are complete.
49 * The registrations are marked pending, in situations when fw
50 * download is in progress.
51 * @write: pointer to function in ST provided to protocol drivers from ST,
52 * to be made use when protocol drivers have data to send to TTY.
53 * @priv_data: privdate data holder for the protocol drivers, sent
54 * from the protocol drivers during registration, and sent back on
55 * reg_complete_cb and recv.
56 * @chnl_id: channel id the protocol driver is interested in, the channel
57 * id is nothing but the 1st byte of the packet in UART frame.
58 * @max_frame_size: size of the largest frame the protocol can receive.
59 * @hdr_len: length of the header structure of the protocol.
60 * @offset_len_in_hdr: this provides the offset of the length field in the
61 * header structure of the protocol header, to assist ST to know
62 * how much to receive, if the data is split across UART frames.
63 * @len_size: whether the length field inside the header is 2 bytes
64 * or 1 byte.
65 * @reserve: the number of bytes ST needs to reserve in the skb being
66 * prepared for the protocol driver.
67 */
68struct st_proto_s {
69 enum proto_type type;
70 long (*recv) (void *, struct sk_buff *);
71 unsigned char (*match_packet) (const unsigned char *data);
72 void (*reg_complete_cb) (void *, char data);
73 long (*write) (struct sk_buff *skb);
74 void *priv_data;
75
76 unsigned char chnl_id;
77 unsigned short max_frame_size;
78 unsigned char hdr_len;
79 unsigned char offset_len_in_hdr;
80 unsigned char len_size;
81 unsigned char reserve;
82};
83
84extern long st_register(struct st_proto_s *);
85extern long st_unregister(struct st_proto_s *);
86
87
88/*
89 * header information used by st_core.c
90 */
91
92/* states of protocol list */
93#define ST_NOTEMPTY 1
94#define ST_EMPTY 0
95
96/*
97 * possible st_states
98 */
99#define ST_INITIALIZING 1
100#define ST_REG_IN_PROGRESS 2
101#define ST_REG_PENDING 3
102#define ST_WAITING_FOR_RESP 4
103
104/**
105 * struct st_data_s - ST core internal structure
106 * @st_state: different states of ST like initializing, registration
107 * in progress, this is mainly used to return relevant err codes
108 * when protocol drivers are registering. It is also used to track
109 * the recv function, as in during fw download only HCI events
110 * can occur , where as during other times other events CH8, CH9
111 * can occur.
112 * @tty: tty provided by the TTY core for line disciplines.
113 * @tx_skb: If for some reason the tty's write returns lesser bytes written
114 * then to maintain the rest of data to be written on next instance.
115 * This needs to be protected, hence the lock inside wakeup func.
116 * @tx_state: if the data is being written onto the TTY and protocol driver
117 * wants to send more, queue up data and mark that there is
118 * more data to send.
119 * @list: the list of protocols registered, only MAX can exist, one protocol
120 * can register only once.
121 * @rx_state: states to be maintained inside st's tty receive
122 * @rx_count: count to be maintained inside st's tty receieve
123 * @rx_skb: the skb where all data for a protocol gets accumulated,
124 * since tty might not call receive when a complete event packet
125 * is received, the states, count and the skb needs to be maintained.
126 * @rx_chnl: the channel ID for which the data is getting accumalated for.
127 * @txq: the list of skbs which needs to be sent onto the TTY.
128 * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued
129 * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs
130 * from waitq can be moved onto the txq.
131 * Needs locking too.
132 * @lock: the lock to protect skbs, queues, and ST states.
133 * @protos_registered: count of the protocols registered, also when 0 the
134 * chip enable gpio can be toggled, and when it changes to 1 the fw
135 * needs to be downloaded to initialize chip side ST.
136 * @ll_state: the various PM states the chip can be, the states are notified
137 * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND).
138 * @kim_data: reference to the parent encapsulating structure.
139 *
140 */
141struct st_data_s {
142 unsigned long st_state;
143 struct sk_buff *tx_skb;
144#define ST_TX_SENDING 1
145#define ST_TX_WAKEUP 2
146 unsigned long tx_state;
147 struct st_proto_s *list[ST_MAX_CHANNELS];
148 bool is_registered[ST_MAX_CHANNELS];
149 unsigned long rx_state;
150 unsigned long rx_count;
151 struct sk_buff *rx_skb;
152 unsigned char rx_chnl;
153 struct sk_buff_head txq, tx_waitq;
154 spinlock_t lock;
155 unsigned char protos_registered;
156 unsigned long ll_state;
157 void *kim_data;
158 struct tty_struct *tty;
159};
160
161/*
162 * wrapper around tty->ops->write_room to check
163 * availability during firmware download
164 */
165int st_get_uart_wr_room(struct st_data_s *st_gdata);
166/**
167 * st_int_write -
168 * point this to tty->driver->write or tty->ops->write
169 * depending upon the kernel version
170 */
171int st_int_write(struct st_data_s*, const unsigned char*, int);
172
173/**
174 * st_write -
175 * internal write function, passed onto protocol drivers
176 * via the write function ptr of protocol struct
177 */
178long st_write(struct sk_buff *);
179
180/* function to be called from ST-LL */
181void st_ll_send_frame(enum proto_type, struct sk_buff *);
182
183/* internal wake up function */
184void st_tx_wakeup(struct st_data_s *st_data);
185
186/* init, exit entry funcs called from KIM */
187int st_core_init(struct st_data_s **);
188void st_core_exit(struct st_data_s *);
189
190/* ask for reference from KIM */
191void st_kim_ref(struct st_data_s **, int);
192
193#define GPS_STUB_TEST
194#ifdef GPS_STUB_TEST
195int gps_chrdrv_stub_write(const unsigned char*, int);
196void gps_chrdrv_stub_init(void);
197#endif
198
199/*
200 * header information used by st_kim.c
201 */
202
203/* time in msec to wait for
204 * line discipline to be installed
205 */
206#define LDISC_TIME 1000
207#define CMD_RESP_TIME 800
208#define CMD_WR_TIME 5000
209#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \
210 | ((unsigned short)((unsigned char)(b))) << 8))
211
212#define GPIO_HIGH 1
213#define GPIO_LOW 0
214
215/* the Power-On-Reset logic, requires to attempt
216 * to download firmware onto chip more than once
217 * since the self-test for chip takes a while
218 */
219#define POR_RETRY_COUNT 5
220
221/**
222 * struct chip_version - save the chip version
223 */
224struct chip_version {
225 unsigned short full;
226 unsigned short chip;
227 unsigned short min_ver;
228 unsigned short maj_ver;
229};
230
231#define UART_DEV_NAME_LEN 32
232/**
233 * struct kim_data_s - the KIM internal data, embedded as the
234 * platform's drv data. One for each ST device in the system.
235 * @uim_pid: KIM needs to communicate with UIM to request to install
236 * the ldisc by opening UART when protocol drivers register.
237 * @kim_pdev: the platform device added in one of the board-XX.c file
238 * in arch/XX/ directory, 1 for each ST device.
239 * @kim_rcvd: completion handler to notify when data was received,
240 * mainly used during fw download, which involves multiple send/wait
241 * for each of the HCI-VS commands.
242 * @ldisc_installed: completion handler to notify that the UIM accepted
243 * the request to install ldisc, notify from tty_open which suggests
244 * the ldisc was properly installed.
245 * @resp_buffer: data buffer for the .bts fw file name.
246 * @fw_entry: firmware class struct to request/release the fw.
247 * @rx_state: the rx state for kim's receive func during fw download.
248 * @rx_count: the rx count for the kim's receive func during fw download.
249 * @rx_skb: all of fw data might not come at once, and hence data storage for
250 * whole of the fw response, only HCI_EVENTs and hence diff from ST's
251 * response.
252 * @core_data: ST core's data, which mainly is the tty's disc_data
253 * @version: chip version available via a sysfs entry.
254 *
255 */
256struct kim_data_s {
257 long uim_pid;
258 struct platform_device *kim_pdev;
259 struct completion kim_rcvd, ldisc_installed;
260 char resp_buffer[30];
261 const struct firmware *fw_entry;
262 long nshutdown;
263 unsigned long rx_state;
264 unsigned long rx_count;
265 struct sk_buff *rx_skb;
266 struct st_data_s *core_data;
267 struct chip_version version;
268 unsigned char ldisc_install;
269 unsigned char dev_name[UART_DEV_NAME_LEN];
270 unsigned char flow_cntrl;
271 unsigned long baud_rate;
272};
273
274/**
275 * functions called when 1 of the protocol drivers gets
276 * registered, these need to communicate with UIM to request
277 * ldisc installed, read chip_version, download relevant fw
278 */
279long st_kim_start(void *);
280long st_kim_stop(void *);
281
282void st_kim_recv(void *, const unsigned char *, long count);
283void st_kim_complete(void *);
284void kim_st_list_protocols(struct st_data_s *, void *);
285
286/*
287 * BTS headers
288 */
289#define ACTION_SEND_COMMAND 1
290#define ACTION_WAIT_EVENT 2
291#define ACTION_SERIAL 3
292#define ACTION_DELAY 4
293#define ACTION_RUN_SCRIPT 5
294#define ACTION_REMARKS 6
295
296/**
297 * struct bts_header - the fw file is NOT binary which can
298 * be sent onto TTY as is. The .bts is more a script
299 * file which has different types of actions.
300 * Each such action needs to be parsed by the KIM and
301 * relevant procedure to be called.
302 */
303struct bts_header {
304 u32 magic;
305 u32 version;
306 u8 future[24];
307 u8 actions[0];
308} __attribute__ ((packed));
309
310/**
311 * struct bts_action - Each .bts action has its own type of
312 * data.
313 */
314struct bts_action {
315 u16 type;
316 u16 size;
317 u8 data[0];
318} __attribute__ ((packed));
319
320struct bts_action_send {
321 u8 data[0];
322} __attribute__ ((packed));
323
324struct bts_action_wait {
325 u32 msec;
326 u32 size;
327 u8 data[0];
328} __attribute__ ((packed));
329
330struct bts_action_delay {
331 u32 msec;
332} __attribute__ ((packed));
333
334struct bts_action_serial {
335 u32 baud;
336 u32 flow_control;
337} __attribute__ ((packed));
338
339/**
340 * struct hci_command - the HCI-VS for intrepreting
341 * the change baud rate of host-side UART, which
342 * needs to be ignored, since UIM would do that
343 * when it receives request from KIM for ldisc installation.
344 */
345struct hci_command {
346 u8 prefix;
347 u16 opcode;
348 u8 plen;
349 u32 speed;
350} __attribute__ ((packed));
351
352/*
353 * header information used by st_ll.c
354 */
355
356/* ST LL receiver states */
357#define ST_W4_PACKET_TYPE 0
358#define ST_W4_HEADER 1
359#define ST_W4_DATA 2
360
361/* ST LL state machines */
362#define ST_LL_ASLEEP 0
363#define ST_LL_ASLEEP_TO_AWAKE 1
364#define ST_LL_AWAKE 2
365#define ST_LL_AWAKE_TO_ASLEEP 3
366#define ST_LL_INVALID 4
367
368/* different PM notifications coming from chip */
369#define LL_SLEEP_IND 0x30
370#define LL_SLEEP_ACK 0x31
371#define LL_WAKE_UP_IND 0x32
372#define LL_WAKE_UP_ACK 0x33
373
374/* initialize and de-init ST LL */
375long st_ll_init(struct st_data_s *);
376long st_ll_deinit(struct st_data_s *);
377
378/**
379 * enable/disable ST LL along with KIM start/stop
380 * called by ST Core
381 */
382void st_ll_enable(struct st_data_s *);
383void st_ll_disable(struct st_data_s *);
384
385/**
386 * various funcs used by ST core to set/get the various PM states
387 * of the chip.
388 */
389unsigned long st_ll_getstate(struct st_data_s *);
390unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char);
391void st_ll_wakeup(struct st_data_s *);
392
393/*
394 * header information used by st_core.c for FM and GPS
395 * packet parsing, the bluetooth headers are already available
396 * at net/bluetooth/
397 */
398
399struct fm_event_hdr {
400 u8 plen;
401} __attribute__ ((packed));
402
403#define FM_MAX_FRAME_SIZE 0xFF /* TODO: */
404#define FM_EVENT_HDR_SIZE 1 /* size of fm_event_hdr */
405#define ST_FM_CH8_PKT 0x8
406
407/* gps stuff */
408struct gps_event_hdr {
409 u8 opcode;
410 u16 plen;
411} __attribute__ ((packed));
412
413/* platform data */
414struct ti_st_plat_data {
415 long nshutdown_gpio;
416 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
417 unsigned char flow_cntrl; /* flow control flag */
418 unsigned long baud_rate;
419 int (*suspend)(struct platform_device *, pm_message_t);
420 int (*resume)(struct platform_device *);
421};
422
423#endif /* TI_WILINK_ST_H */
diff --git a/include/linux/time.h b/include/linux/time.h
index 9f15ac7ab92a..b3061782dec3 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
113#define timespec_valid(ts) \ 113#define timespec_valid(ts) \
114 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 114 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
115 115
116extern seqlock_t xtime_lock;
117
118extern void read_persistent_clock(struct timespec *ts); 116extern void read_persistent_clock(struct timespec *ts);
119extern void read_boot_clock(struct timespec *ts); 117extern void read_boot_clock(struct timespec *ts);
120extern int update_persistent_clock(struct timespec now); 118extern int update_persistent_clock(struct timespec now);
@@ -125,8 +123,10 @@ extern int timekeeping_suspended;
125unsigned long get_seconds(void); 123unsigned long get_seconds(void);
126struct timespec current_kernel_time(void); 124struct timespec current_kernel_time(void);
127struct timespec __current_kernel_time(void); /* does not take xtime_lock */ 125struct timespec __current_kernel_time(void); /* does not take xtime_lock */
128struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
129struct timespec get_monotonic_coarse(void); 126struct timespec get_monotonic_coarse(void);
127void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
128 struct timespec *wtom, struct timespec *sleep);
129void timekeeping_inject_sleeptime(struct timespec *delta);
130 130
131#define CURRENT_TIME (current_kernel_time()) 131#define CURRENT_TIME (current_kernel_time())
132#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 132#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -147,8 +147,9 @@ static inline u32 arch_gettimeoffset(void) { return 0; }
147#endif 147#endif
148 148
149extern void do_gettimeofday(struct timeval *tv); 149extern void do_gettimeofday(struct timeval *tv);
150extern int do_settimeofday(struct timespec *tv); 150extern int do_settimeofday(const struct timespec *tv);
151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 151extern int do_sys_settimeofday(const struct timespec *tv,
152 const struct timezone *tz);
152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 153#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); 154extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
154struct itimerval; 155struct itimerval;
@@ -158,14 +159,17 @@ extern unsigned int alarm_setitimer(unsigned int seconds);
158extern int do_getitimer(int which, struct itimerval *value); 159extern int do_getitimer(int which, struct itimerval *value);
159extern void getnstimeofday(struct timespec *tv); 160extern void getnstimeofday(struct timespec *tv);
160extern void getrawmonotonic(struct timespec *ts); 161extern void getrawmonotonic(struct timespec *ts);
162extern void getnstime_raw_and_real(struct timespec *ts_raw,
163 struct timespec *ts_real);
161extern void getboottime(struct timespec *ts); 164extern void getboottime(struct timespec *ts);
162extern void monotonic_to_bootbased(struct timespec *ts); 165extern void monotonic_to_bootbased(struct timespec *ts);
166extern void get_monotonic_boottime(struct timespec *ts);
163 167
164extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 168extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
165extern int timekeeping_valid_for_hres(void); 169extern int timekeeping_valid_for_hres(void);
166extern u64 timekeeping_max_deferment(void); 170extern u64 timekeeping_max_deferment(void);
167extern void update_wall_time(void);
168extern void timekeeping_leap_insert(int leapsecond); 171extern void timekeeping_leap_insert(int leapsecond);
172extern int timekeeping_inject_offset(struct timespec *ts);
169 173
170struct tms; 174struct tms;
171extern void do_sys_times(struct tms *); 175extern void do_sys_times(struct tms *);
@@ -290,6 +294,9 @@ struct itimerval {
290#define CLOCK_MONOTONIC_RAW 4 294#define CLOCK_MONOTONIC_RAW 4
291#define CLOCK_REALTIME_COARSE 5 295#define CLOCK_REALTIME_COARSE 5
292#define CLOCK_MONOTONIC_COARSE 6 296#define CLOCK_MONOTONIC_COARSE 6
297#define CLOCK_BOOTTIME 7
298#define CLOCK_REALTIME_ALARM 8
299#define CLOCK_BOOTTIME_ALARM 9
293 300
294/* 301/*
295 * The IDs of various hardware clocks: 302 * The IDs of various hardware clocks:
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 38cf093ef62c..6abd9138beda 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -24,9 +24,9 @@ struct timer_list {
24 int slack; 24 int slack;
25 25
26#ifdef CONFIG_TIMER_STATS 26#ifdef CONFIG_TIMER_STATS
27 int start_pid;
27 void *start_site; 28 void *start_site;
28 char start_comm[16]; 29 char start_comm[16];
29 int start_pid;
30#endif 30#endif
31#ifdef CONFIG_LOCKDEP 31#ifdef CONFIG_LOCKDEP
32 struct lockdep_map lockdep_map; 32 struct lockdep_map lockdep_map;
@@ -48,12 +48,38 @@ extern struct tvec_base boot_tvec_bases;
48#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) 48#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)
49#endif 49#endif
50 50
51/*
52 * Note that all tvec_bases are 2 byte aligned and lower bit of
53 * base in timer_list is guaranteed to be zero. Use the LSB to
54 * indicate whether the timer is deferrable.
55 *
56 * A deferrable timer will work normally when the system is busy, but
57 * will not cause a CPU to come out of idle just to service it; instead,
58 * the timer will be serviced when the CPU eventually wakes up with a
59 * subsequent non-deferrable timer.
60 */
61#define TBASE_DEFERRABLE_FLAG (0x1)
62
51#define TIMER_INITIALIZER(_function, _expires, _data) { \ 63#define TIMER_INITIALIZER(_function, _expires, _data) { \
52 .entry = { .prev = TIMER_ENTRY_STATIC }, \ 64 .entry = { .prev = TIMER_ENTRY_STATIC }, \
53 .function = (_function), \ 65 .function = (_function), \
54 .expires = (_expires), \ 66 .expires = (_expires), \
55 .data = (_data), \ 67 .data = (_data), \
56 .base = &boot_tvec_bases, \ 68 .base = &boot_tvec_bases, \
69 .slack = -1, \
70 __TIMER_LOCKDEP_MAP_INITIALIZER( \
71 __FILE__ ":" __stringify(__LINE__)) \
72 }
73
74#define TBASE_MAKE_DEFERRED(ptr) ((struct tvec_base *) \
75 ((unsigned char *)(ptr) + TBASE_DEFERRABLE_FLAG))
76
77#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) {\
78 .entry = { .prev = TIMER_ENTRY_STATIC }, \
79 .function = (_function), \
80 .expires = (_expires), \
81 .data = (_data), \
82 .base = TBASE_MAKE_DEFERRED(&boot_tvec_bases), \
57 __TIMER_LOCKDEP_MAP_INITIALIZER( \ 83 __TIMER_LOCKDEP_MAP_INITIALIZER( \
58 __FILE__ ":" __stringify(__LINE__)) \ 84 __FILE__ ":" __stringify(__LINE__)) \
59 } 85 }
@@ -248,11 +274,11 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
248 274
249extern void add_timer(struct timer_list *timer); 275extern void add_timer(struct timer_list *timer);
250 276
277extern int try_to_del_timer_sync(struct timer_list *timer);
278
251#ifdef CONFIG_SMP 279#ifdef CONFIG_SMP
252 extern int try_to_del_timer_sync(struct timer_list *timer);
253 extern int del_timer_sync(struct timer_list *timer); 280 extern int del_timer_sync(struct timer_list *timer);
254#else 281#else
255# define try_to_del_timer_sync(t) del_timer(t)
256# define del_timer_sync(t) del_timer(t) 282# define del_timer_sync(t) del_timer(t)
257#endif 283#endif
258 284
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h
new file mode 100644
index 000000000000..5088727478fd
--- /dev/null
+++ b/include/linux/timerqueue.h
@@ -0,0 +1,50 @@
1#ifndef _LINUX_TIMERQUEUE_H
2#define _LINUX_TIMERQUEUE_H
3
4#include <linux/rbtree.h>
5#include <linux/ktime.h>
6
7
8struct timerqueue_node {
9 struct rb_node node;
10 ktime_t expires;
11};
12
13struct timerqueue_head {
14 struct rb_root head;
15 struct timerqueue_node *next;
16};
17
18
19extern void timerqueue_add(struct timerqueue_head *head,
20 struct timerqueue_node *node);
21extern void timerqueue_del(struct timerqueue_head *head,
22 struct timerqueue_node *node);
23extern struct timerqueue_node *timerqueue_iterate_next(
24 struct timerqueue_node *node);
25
26/**
27 * timerqueue_getnext - Returns the timer with the earliest expiration time
28 *
29 * @head: head of timerqueue
30 *
31 * Returns a pointer to the timer node that has the
32 * earliest expiration time.
33 */
34static inline
35struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head)
36{
37 return head->next;
38}
39
40static inline void timerqueue_init(struct timerqueue_node *node)
41{
42 rb_init_node(&node->node);
43}
44
45static inline void timerqueue_init_head(struct timerqueue_head *head)
46{
47 head->head = RB_ROOT;
48 head->next = NULL;
49}
50#endif /* _LINUX_TIMERQUEUE_H */
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 32d852f8cbe4..aa60fe7b6ed6 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -73,7 +73,7 @@ struct timex {
73 long tolerance; /* clock frequency tolerance (ppm) 73 long tolerance; /* clock frequency tolerance (ppm)
74 * (read only) 74 * (read only)
75 */ 75 */
76 struct timeval time; /* (read only) */ 76 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
77 long tick; /* (modified) usecs between clock ticks */ 77 long tick; /* (modified) usecs between clock ticks */
78 78
79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */ 79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
@@ -102,6 +102,7 @@ struct timex {
102#define ADJ_STATUS 0x0010 /* clock status */ 102#define ADJ_STATUS 0x0010 /* clock status */
103#define ADJ_TIMECONST 0x0020 /* pll time constant */ 103#define ADJ_TIMECONST 0x0020 /* pll time constant */
104#define ADJ_TAI 0x0080 /* set TAI offset */ 104#define ADJ_TAI 0x0080 /* set TAI offset */
105#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
105#define ADJ_MICRO 0x1000 /* select microsecond resolution */ 106#define ADJ_MICRO 0x1000 /* select microsecond resolution */
106#define ADJ_NANO 0x2000 /* select nanosecond resolution */ 107#define ADJ_NANO 0x2000 /* select nanosecond resolution */
107#define ADJ_TICK 0x4000 /* tick value */ 108#define ADJ_TICK 0x4000 /* tick value */
@@ -268,6 +269,7 @@ extern u64 tick_length;
268extern void second_overflow(void); 269extern void second_overflow(void);
269extern void update_ntp_one_tick(void); 270extern void update_ntp_one_tick(void);
270extern int do_adjtimex(struct timex *); 271extern int do_adjtimex(struct timex *);
272extern void hardpps(const struct timespec *, const struct timespec *);
271 273
272int read_current_timer(unsigned long *timer_val); 274int read_current_timer(unsigned long *timer_val);
273 275
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index d10614b29d59..f2d90091cc20 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface 2 * include/linux/tipc.h: Include file for TIPC socket interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
42/* 42/*
43 * TIPC addressing primitives 43 * TIPC addressing primitives
44 */ 44 */
45 45
46struct tipc_portid { 46struct tipc_portid {
47 __u32 ref; 47 __u32 ref;
48 __u32 node; 48 __u32 node;
@@ -89,7 +89,7 @@ static inline unsigned int tipc_node(__u32 addr)
89#define TIPC_TOP_SRV 1 /* topology service name type */ 89#define TIPC_TOP_SRV 1 /* topology service name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ 90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91 91
92/* 92/*
93 * Publication scopes when binding port names and port name sequences 93 * Publication scopes when binding port names and port name sequences
94 */ 94 */
95 95
@@ -101,7 +101,7 @@ static inline unsigned int tipc_node(__u32 addr)
101 * Limiting values for messages 101 * Limiting values for messages
102 */ 102 */
103 103
104#define TIPC_MAX_USER_MSG_SIZE 66000 104#define TIPC_MAX_USER_MSG_SIZE 66000U
105 105
106/* 106/*
107 * Message importance levels 107 * Message importance levels
@@ -112,7 +112,7 @@ static inline unsigned int tipc_node(__u32 addr)
112#define TIPC_HIGH_IMPORTANCE 2 112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3 113#define TIPC_CRITICAL_IMPORTANCE 3
114 114
115/* 115/*
116 * Msg rejection/connection shutdown reasons 116 * Msg rejection/connection shutdown reasons
117 */ 117 */
118 118
@@ -127,22 +127,16 @@ static inline unsigned int tipc_node(__u32 addr)
127 * TIPC topology subscription service definitions 127 * TIPC topology subscription service definitions
128 */ 128 */
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ 132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */
133#if 0
134/* The following filter options are not currently implemented */
135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
136#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
137#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
138#endif
139 133
140#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ 134#define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */
141 135
142struct tipc_subscr { 136struct tipc_subscr {
143 struct tipc_name_seq seq; /* name sequence of interest */ 137 struct tipc_name_seq seq; /* name sequence of interest */
144 __u32 timeout; /* subscription duration (in ms) */ 138 __u32 timeout; /* subscription duration (in ms) */
145 __u32 filter; /* bitmask of filter options */ 139 __u32 filter; /* bitmask of filter options */
146 char usr_handle[8]; /* available for subscriber use */ 140 char usr_handle[8]; /* available for subscriber use */
147}; 141};
148 142
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 9cde86c32412..0db239590b4d 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2007, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -54,19 +54,19 @@
54 * which specify parameters or results for the operation. 54 * which specify parameters or results for the operation.
55 * 55 *
56 * For many operations, the request and reply messages have a fixed number 56 * For many operations, the request and reply messages have a fixed number
57 * of TLVs (usually zero or one); however, some reply messages may return 57 * of TLVs (usually zero or one); however, some reply messages may return
58 * a variable number of TLVs. A failed request is denoted by the presence 58 * a variable number of TLVs. A failed request is denoted by the presence
59 * of an "error string" TLV in the reply message instead of the TLV(s) the 59 * of an "error string" TLV in the reply message instead of the TLV(s) the
60 * reply should contain if the request succeeds. 60 * reply should contain if the request succeeds.
61 */ 61 */
62 62
63/* 63/*
64 * Public commands: 64 * Public commands:
65 * May be issued by any process. 65 * May be issued by any process.
66 * Accepted by own node, or by remote node only if remote management enabled. 66 * Accepted by own node, or by remote node only if remote management enabled.
67 */ 67 */
68 68
69#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */ 69#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */
70#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */ 70#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */
71#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */ 71#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */
72#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */ 72#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */
@@ -76,28 +76,21 @@
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ 76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ 77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
78 78
79#if 0 79/*
80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
81#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
82#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
83#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
84#endif
85
86/*
87 * Protected commands: 80 * Protected commands:
88 * May only be issued by "network administration capable" process. 81 * May only be issued by "network administration capable" process.
89 * Accepted by own node, or by remote node only if remote management enabled 82 * Accepted by own node, or by remote node only if remote management enabled
90 * and this node is zone manager. 83 * and this node is zone manager.
91 */ 84 */
92 85
93#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ 86#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
94#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ 87#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
95#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ 88#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
96#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 89#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */ 90#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
98#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */ 91#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
99#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
100#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */ 93#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */
101#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ 94#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
102 95
103#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */ 96#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */
@@ -109,31 +102,21 @@
109#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ 102#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
110#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ 103#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
111 104
112#if 0 105/*
113#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
114#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
115#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
116#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
117#endif
118
119/*
120 * Private commands: 106 * Private commands:
121 * May only be issued by "network administration capable" process. 107 * May only be issued by "network administration capable" process.
122 * Accepted by own node only; cannot be used on a remote node. 108 * Accepted by own node only; cannot be used on a remote node.
123 */ 109 */
124 110
125#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 111#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
126#if 0
127#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
128#endif
129#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 112#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 113#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 114#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 115#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */ 116#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
134#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */ 117#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
135#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
136#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */ 119#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */
137#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ 120#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
138 121
139/* 122/*
@@ -156,20 +139,20 @@
156#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */ 139#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */
157 140
158#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */ 141#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */
159#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */ 142#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */
160#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */ 143#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */
161#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */ 144#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */
162#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */ 145#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */
163#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */ 146#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */
164#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */ 147#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */
165#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */ 148#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */
166#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */ 149#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */
167#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */ 150#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */
168#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ 151#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
169 152
170/* 153/*
171 * Maximum sizes of TIPC bearer-related names (including terminating NUL) 154 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
172 */ 155 */
173 156
174#define TIPC_MAX_MEDIA_NAME 16 /* format = media */ 157#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
175#define TIPC_MAX_IF_NAME 16 /* format = interface */ 158#define TIPC_MAX_IF_NAME 16 /* format = interface */
@@ -193,6 +176,10 @@
193#define TIPC_DEF_LINK_TOL 1500 176#define TIPC_DEF_LINK_TOL 1500
194#define TIPC_MAX_LINK_TOL 30000 177#define TIPC_MAX_LINK_TOL 30000
195 178
179#if (TIPC_MIN_LINK_TOL < 16)
180#error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)"
181#endif
182
196/* 183/*
197 * Link window limits (min, default, max), in packets 184 * Link window limits (min, default, max), in packets
198 */ 185 */
@@ -215,7 +202,7 @@ struct tipc_link_info {
215 202
216struct tipc_bearer_config { 203struct tipc_bearer_config {
217 __be32 priority; /* Range [1,31]. Override per link */ 204 __be32 priority; /* Range [1,31]. Override per link */
218 __be32 detect_scope; 205 __be32 disc_domain; /* <Z.C.N> describing desired nodes */
219 char name[TIPC_MAX_BEARER_NAME]; 206 char name[TIPC_MAX_BEARER_NAME];
220}; 207};
221 208
@@ -234,7 +221,7 @@ struct tipc_name_table_query {
234}; 221};
235 222
236/* 223/*
237 * The error string TLV is a null-terminated string describing the cause 224 * The error string TLV is a null-terminated string describing the cause
238 * of the request failure. To simplify error processing (and to save space) 225 * of the request failure. To simplify error processing (and to save space)
239 * the first character of the string can be a special error code character 226 * the first character of the string can be a special error code character
240 * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason. 227 * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason.
@@ -247,23 +234,9 @@ struct tipc_name_table_query {
247#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ 234#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
248#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ 235#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
249 236
250#if 0
251/* prototypes TLV structures for proposed commands */
252struct tipc_link_create {
253 __u32 domain;
254 struct tipc_media_addr peer_addr;
255 char bearer_name[TIPC_MAX_BEARER_NAME];
256};
257
258struct tipc_route_info {
259 __u32 dest;
260 __u32 router;
261};
262#endif
263
264/* 237/*
265 * A TLV consists of a descriptor, followed by the TLV value. 238 * A TLV consists of a descriptor, followed by the TLV value.
266 * TLV descriptor fields are stored in network byte order; 239 * TLV descriptor fields are stored in network byte order;
267 * TLV values must also be stored in network byte order (where applicable). 240 * TLV values must also be stored in network byte order (where applicable).
268 * TLV descriptors must be aligned to addresses which are multiple of 4, 241 * TLV descriptors must be aligned to addresses which are multiple of 4,
269 * so up to 3 bytes of padding may exist at the end of the TLV value area. 242 * so up to 3 bytes of padding may exist at the end of the TLV value area.
@@ -299,7 +272,7 @@ static inline int TLV_OK(const void *tlv, __u16 space)
299 272
300static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type) 273static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
301{ 274{
302 return TLV_OK(tlv, space) && 275 return TLV_OK(tlv, space) &&
303 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type); 276 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
304} 277}
305 278
@@ -318,7 +291,7 @@ static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
318} 291}
319 292
320/* 293/*
321 * A TLV list descriptor simplifies processing of messages 294 * A TLV list descriptor simplifies processing of messages
322 * containing multiple TLVs. 295 * containing multiple TLVs.
323 */ 296 */
324 297
@@ -327,15 +300,15 @@ struct tlv_list_desc {
327 __u32 tlv_space; /* # bytes from curr TLV to list end */ 300 __u32 tlv_space; /* # bytes from curr TLV to list end */
328}; 301};
329 302
330static inline void TLV_LIST_INIT(struct tlv_list_desc *list, 303static inline void TLV_LIST_INIT(struct tlv_list_desc *list,
331 void *data, __u32 space) 304 void *data, __u32 space)
332{ 305{
333 list->tlv_ptr = (struct tlv_desc *)data; 306 list->tlv_ptr = (struct tlv_desc *)data;
334 list->tlv_space = space; 307 list->tlv_space = space;
335} 308}
336 309
337static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list) 310static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list)
338{ 311{
339 return (list->tlv_space == 0); 312 return (list->tlv_space == 0);
340} 313}
341 314
@@ -353,7 +326,7 @@ static inline void TLV_LIST_STEP(struct tlv_list_desc *list)
353{ 326{
354 __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len)); 327 __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len));
355 328
356 list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space); 329 list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
357 list->tlv_space -= tlv_space; 330 list->tlv_space -= tlv_space;
358} 331}
359 332
@@ -377,15 +350,14 @@ struct tipc_genlmsghdr {
377#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr)) 350#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr))
378 351
379/* 352/*
380 * Configuration messages exchanged via TIPC sockets use the TIPC configuration 353 * Configuration messages exchanged via TIPC sockets use the TIPC configuration
381 * message header, which is defined below. This structure is analogous 354 * message header, which is defined below. This structure is analogous
382 * to the Netlink message header, but fields are stored in network byte order 355 * to the Netlink message header, but fields are stored in network byte order
383 * and no padding is permitted between the header and the message data 356 * and no padding is permitted between the header and the message data
384 * that follows. 357 * that follows.
385 */ 358 */
386 359
387struct tipc_cfg_msg_hdr 360struct tipc_cfg_msg_hdr {
388{
389 __be32 tcm_len; /* Message length (including header) */ 361 __be32 tcm_len; /* Message length (including header) */
390 __be16 tcm_type; /* Command type */ 362 __be16 tcm_type; /* Command type */
391 __be16 tcm_flags; /* Additional flags */ 363 __be16 tcm_flags; /* Additional flags */
diff --git a/include/linux/toshiba.h b/include/linux/toshiba.h
index 6a7c4edf0e13..772dedbc3a22 100644
--- a/include/linux/toshiba.h
+++ b/include/linux/toshiba.h
@@ -33,6 +33,8 @@ typedef struct {
33 unsigned int edi __attribute__ ((packed)); 33 unsigned int edi __attribute__ ((packed));
34} SMMRegisters; 34} SMMRegisters;
35 35
36#ifdef __KERNEL__
36int tosh_smm(SMMRegisters *regs); 37int tosh_smm(SMMRegisters *regs);
38#endif /* __KERNEL__ */
37 39
38#endif 40#endif
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index ac5d1c1285d9..fdc718abf83b 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -31,6 +31,7 @@
31 31
32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); 32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf);
33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); 33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash);
34extern int tpm_send(u32 chip_num, void *cmd, size_t buflen);
34#else 35#else
35static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { 36static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) {
36 return -ENODEV; 37 return -ENODEV;
@@ -38,5 +39,8 @@ static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) {
38static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { 39static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) {
39 return -ENODEV; 40 return -ENODEV;
40} 41}
42static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) {
43 return -ENODEV;
44}
41#endif 45#endif
42#endif 46#endif
diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h
new file mode 100644
index 000000000000..727512e249b5
--- /dev/null
+++ b/include/linux/tpm_command.h
@@ -0,0 +1,28 @@
1#ifndef __LINUX_TPM_COMMAND_H__
2#define __LINUX_TPM_COMMAND_H__
3
4/*
5 * TPM Command constants from specifications at
6 * http://www.trustedcomputinggroup.org
7 */
8
9/* Command TAGS */
10#define TPM_TAG_RQU_COMMAND 193
11#define TPM_TAG_RQU_AUTH1_COMMAND 194
12#define TPM_TAG_RQU_AUTH2_COMMAND 195
13#define TPM_TAG_RSP_COMMAND 196
14#define TPM_TAG_RSP_AUTH1_COMMAND 197
15#define TPM_TAG_RSP_AUTH2_COMMAND 198
16
17/* Command Ordinals */
18#define TPM_ORD_GETRANDOM 70
19#define TPM_ORD_OSAP 11
20#define TPM_ORD_OIAP 10
21#define TPM_ORD_SEAL 23
22#define TPM_ORD_UNSEAL 24
23
24/* Other constants */
25#define SRKHANDLE 0x40000000
26#define TPM_NONCE_SIZE 20
27
28#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 10db0102a890..e95f5236611f 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -150,7 +150,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
150 * 150 *
151 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing. 151 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
152 * 152 *
153 * @task->cred_guard_mutex is held by the caller through the do_execve(). 153 * @task->signal->cred_guard_mutex is held by the caller through the do_execve().
154 */ 154 */
155static inline int tracehook_unsafe_exec(struct task_struct *task) 155static inline int tracehook_unsafe_exec(struct task_struct *task)
156{ 156{
@@ -169,7 +169,7 @@ static inline int tracehook_unsafe_exec(struct task_struct *task)
169 * tracehook_tracer_task - return the task that is tracing the given task 169 * tracehook_tracer_task - return the task that is tracing the given task
170 * @tsk: task to consider 170 * @tsk: task to consider
171 * 171 *
172 * Returns NULL if noone is tracing @task, or the &struct task_struct 172 * Returns NULL if no one is tracing @task, or the &struct task_struct
173 * pointer to its tracer. 173 * pointer to its tracer.
174 * 174 *
175 * Must called under rcu_read_lock(). The pointer returned might be kept 175 * Must called under rcu_read_lock(). The pointer returned might be kept
@@ -448,7 +448,7 @@ static inline int tracehook_force_sigpending(void)
448 * 448 *
449 * Return zero to check for a real pending signal normally. 449 * Return zero to check for a real pending signal normally.
450 * Return -1 after releasing the siglock to repeat the check. 450 * Return -1 after releasing the siglock to repeat the check.
451 * Return a signal number to induce an artifical signal delivery, 451 * Return a signal number to induce an artificial signal delivery,
452 * setting *@info and *@return_ka to specify its details and behavior. 452 * setting *@info and *@return_ka to specify its details and behavior.
453 * 453 *
454 * The @return_ka->sa_handler value controls the disposition of the 454 * The @return_ka->sa_handler value controls the disposition of the
@@ -469,33 +469,6 @@ static inline int tracehook_get_signal(struct task_struct *task,
469} 469}
470 470
471/** 471/**
472 * tracehook_notify_jctl - report about job control stop/continue
473 * @notify: zero, %CLD_STOPPED or %CLD_CONTINUED
474 * @why: %CLD_STOPPED or %CLD_CONTINUED
475 *
476 * This is called when we might call do_notify_parent_cldstop().
477 *
478 * @notify is zero if we would not ordinarily send a %SIGCHLD,
479 * or is the %CLD_STOPPED or %CLD_CONTINUED .si_code for %SIGCHLD.
480 *
481 * @why is %CLD_STOPPED when about to stop for job control;
482 * we are already in %TASK_STOPPED state, about to call schedule().
483 * It might also be that we have just exited (check %PF_EXITING),
484 * but need to report that a group-wide stop is complete.
485 *
486 * @why is %CLD_CONTINUED when waking up after job control stop and
487 * ready to make a delayed @notify report.
488 *
489 * Return the %CLD_* value for %SIGCHLD, or zero to generate no signal.
490 *
491 * Called with the siglock held.
492 */
493static inline int tracehook_notify_jctl(int notify, int why)
494{
495 return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
496}
497
498/**
499 * tracehook_finish_jctl - report about return from job control stop 472 * tracehook_finish_jctl - report about return from job control stop
500 * 473 *
501 * This is called by do_signal_stop() after wakeup. 474 * This is called by do_signal_stop() after wakeup.
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index a4a90b6726ce..d530a4460a0b 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -29,16 +29,11 @@ struct tracepoint_func {
29 29
30struct tracepoint { 30struct tracepoint {
31 const char *name; /* Tracepoint name */ 31 const char *name; /* Tracepoint name */
32 int state; /* State. */ 32 struct jump_label_key key;
33 void (*regfunc)(void); 33 void (*regfunc)(void);
34 void (*unregfunc)(void); 34 void (*unregfunc)(void);
35 struct tracepoint_func *funcs; 35 struct tracepoint_func __rcu *funcs;
36} __attribute__((aligned(32))); /* 36};
37 * Aligned on 32 bytes because it is
38 * globally visible and gcc happily
39 * align these on the structure size.
40 * Keep in sync with vmlinux.lds.h.
41 */
42 37
43/* 38/*
44 * Connect a probe to a tracepoint. 39 * Connect a probe to a tracepoint.
@@ -61,15 +56,15 @@ extern void tracepoint_probe_update_all(void);
61 56
62struct tracepoint_iter { 57struct tracepoint_iter {
63 struct module *module; 58 struct module *module;
64 struct tracepoint *tracepoint; 59 struct tracepoint * const *tracepoint;
65}; 60};
66 61
67extern void tracepoint_iter_start(struct tracepoint_iter *iter); 62extern void tracepoint_iter_start(struct tracepoint_iter *iter);
68extern void tracepoint_iter_next(struct tracepoint_iter *iter); 63extern void tracepoint_iter_next(struct tracepoint_iter *iter);
69extern void tracepoint_iter_stop(struct tracepoint_iter *iter); 64extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
70extern void tracepoint_iter_reset(struct tracepoint_iter *iter); 65extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
71extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, 66extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
72 struct tracepoint *begin, struct tracepoint *end); 67 struct tracepoint * const *begin, struct tracepoint * const *end);
73 68
74/* 69/*
75 * tracepoint_synchronize_unregister must be called between the last tracepoint 70 * tracepoint_synchronize_unregister must be called between the last tracepoint
@@ -84,11 +79,13 @@ static inline void tracepoint_synchronize_unregister(void)
84#define PARAMS(args...) args 79#define PARAMS(args...) args
85 80
86#ifdef CONFIG_TRACEPOINTS 81#ifdef CONFIG_TRACEPOINTS
87extern void tracepoint_update_probe_range(struct tracepoint *begin, 82extern
88 struct tracepoint *end); 83void tracepoint_update_probe_range(struct tracepoint * const *begin,
84 struct tracepoint * const *end);
89#else 85#else
90static inline void tracepoint_update_probe_range(struct tracepoint *begin, 86static inline
91 struct tracepoint *end) 87void tracepoint_update_probe_range(struct tracepoint * const *begin,
88 struct tracepoint * const *end)
92{ } 89{ }
93#endif /* CONFIG_TRACEPOINTS */ 90#endif /* CONFIG_TRACEPOINTS */
94 91
@@ -106,6 +103,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
106 103
107#define TP_PROTO(args...) args 104#define TP_PROTO(args...) args
108#define TP_ARGS(args...) args 105#define TP_ARGS(args...) args
106#define TP_CONDITION(args...) args
109 107
110#ifdef CONFIG_TRACEPOINTS 108#ifdef CONFIG_TRACEPOINTS
111 109
@@ -119,12 +117,14 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
119 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just 117 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
120 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". 118 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
121 */ 119 */
122#define __DO_TRACE(tp, proto, args) \ 120#define __DO_TRACE(tp, proto, args, cond) \
123 do { \ 121 do { \
124 struct tracepoint_func *it_func_ptr; \ 122 struct tracepoint_func *it_func_ptr; \
125 void *it_func; \ 123 void *it_func; \
126 void *__data; \ 124 void *__data; \
127 \ 125 \
126 if (!(cond)) \
127 return; \
128 rcu_read_lock_sched_notrace(); \ 128 rcu_read_lock_sched_notrace(); \
129 it_func_ptr = rcu_dereference_sched((tp)->funcs); \ 129 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
130 if (it_func_ptr) { \ 130 if (it_func_ptr) { \
@@ -142,16 +142,15 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
142 * not add unwanted padding between the beginning of the section and the 142 * not add unwanted padding between the beginning of the section and the
143 * structure. Force alignment to the same alignment as the section start. 143 * structure. Force alignment to the same alignment as the section start.
144 */ 144 */
145#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ 145#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
146 extern struct tracepoint __tracepoint_##name; \ 146 extern struct tracepoint __tracepoint_##name; \
147 static inline void trace_##name(proto) \ 147 static inline void trace_##name(proto) \
148 { \ 148 { \
149 JUMP_LABEL(&__tracepoint_##name.state, do_trace); \ 149 if (static_branch(&__tracepoint_##name.key)) \
150 return; \
151do_trace: \
152 __DO_TRACE(&__tracepoint_##name, \ 150 __DO_TRACE(&__tracepoint_##name, \
153 TP_PROTO(data_proto), \ 151 TP_PROTO(data_proto), \
154 TP_ARGS(data_args)); \ 152 TP_ARGS(data_args), \
153 TP_CONDITION(cond)); \
155 } \ 154 } \
156 static inline int \ 155 static inline int \
157 register_trace_##name(void (*probe)(data_proto), void *data) \ 156 register_trace_##name(void (*probe)(data_proto), void *data) \
@@ -170,12 +169,20 @@ do_trace: \
170 { \ 169 { \
171 } 170 }
172 171
173#define DEFINE_TRACE_FN(name, reg, unreg) \ 172/*
174 static const char __tpstrtab_##name[] \ 173 * We have no guarantee that gcc and the linker won't up-align the tracepoint
175 __attribute__((section("__tracepoints_strings"))) = #name; \ 174 * structures, so we create an array of pointers that will be used for iteration
176 struct tracepoint __tracepoint_##name \ 175 * on the tracepoints.
177 __attribute__((section("__tracepoints"), aligned(32))) = \ 176 */
178 { __tpstrtab_##name, 0, reg, unreg, NULL } 177#define DEFINE_TRACE_FN(name, reg, unreg) \
178 static const char __tpstrtab_##name[] \
179 __attribute__((section("__tracepoints_strings"))) = #name; \
180 struct tracepoint __tracepoint_##name \
181 __attribute__((section("__tracepoints"))) = \
182 { __tpstrtab_##name, JUMP_LABEL_INIT, reg, unreg, NULL };\
183 static struct tracepoint * const __tracepoint_ptr_##name __used \
184 __attribute__((section("__tracepoints_ptrs"))) = \
185 &__tracepoint_##name;
179 186
180#define DEFINE_TRACE(name) \ 187#define DEFINE_TRACE(name) \
181 DEFINE_TRACE_FN(name, NULL, NULL); 188 DEFINE_TRACE_FN(name, NULL, NULL);
@@ -186,7 +193,7 @@ do_trace: \
186 EXPORT_SYMBOL(__tracepoint_##name) 193 EXPORT_SYMBOL(__tracepoint_##name)
187 194
188#else /* !CONFIG_TRACEPOINTS */ 195#else /* !CONFIG_TRACEPOINTS */
189#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \ 196#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
190 static inline void trace_##name(proto) \ 197 static inline void trace_##name(proto) \
191 { } \ 198 { } \
192 static inline int \ 199 static inline int \
@@ -227,13 +234,20 @@ do_trace: \
227 * "void *__data, proto" as the callback prototype. 234 * "void *__data, proto" as the callback prototype.
228 */ 235 */
229#define DECLARE_TRACE_NOARGS(name) \ 236#define DECLARE_TRACE_NOARGS(name) \
230 __DECLARE_TRACE(name, void, , void *__data, __data) 237 __DECLARE_TRACE(name, void, , 1, void *__data, __data)
231 238
232#define DECLARE_TRACE(name, proto, args) \ 239#define DECLARE_TRACE(name, proto, args) \
233 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ 240 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
234 PARAMS(void *__data, proto), \ 241 PARAMS(void *__data, proto), \
235 PARAMS(__data, args)) 242 PARAMS(__data, args))
236 243
244#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
245 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
246 PARAMS(void *__data, proto), \
247 PARAMS(__data, args))
248
249#define TRACE_EVENT_FLAGS(event, flag)
250
237#endif /* DECLARE_TRACE */ 251#endif /* DECLARE_TRACE */
238 252
239#ifndef TRACE_EVENT 253#ifndef TRACE_EVENT
@@ -315,7 +329,7 @@ do_trace: \
315 * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); 329 * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
316 * __entry->next_pid = next->pid; 330 * __entry->next_pid = next->pid;
317 * __entry->next_prio = next->prio; 331 * __entry->next_prio = next->prio;
318 * ) 332 * ),
319 * 333 *
320 * * 334 * *
321 * * Formatted output of a trace record via TP_printk(). 335 * * Formatted output of a trace record via TP_printk().
@@ -347,11 +361,21 @@ do_trace: \
347 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 361 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
348#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 362#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
349 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 363 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
364#define DEFINE_EVENT_CONDITION(template, name, proto, \
365 args, cond) \
366 DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
367 PARAMS(args), PARAMS(cond))
350 368
351#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 369#define TRACE_EVENT(name, proto, args, struct, assign, print) \
352 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 370 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
353#define TRACE_EVENT_FN(name, proto, args, struct, \ 371#define TRACE_EVENT_FN(name, proto, args, struct, \
354 assign, print, reg, unreg) \ 372 assign, print, reg, unreg) \
355 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 373 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
374#define TRACE_EVENT_CONDITION(name, proto, args, cond, \
375 struct, assign, print) \
376 DECLARE_TRACE_CONDITION(name, PARAMS(proto), \
377 PARAMS(args), PARAMS(cond))
378
379#define TRACE_EVENT_FLAGS(event, flag)
356 380
357#endif /* ifdef TRACE_EVENT (see note above) */ 381#endif /* ifdef TRACE_EVENT (see note above) */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 86be0cdeb11b..9f469c700550 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,7 +13,6 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
17 16
18#include <asm/system.h> 17#include <asm/system.h>
19 18
@@ -50,6 +49,7 @@
50#define N_V253 19 /* Codec control over voice modem */ 49#define N_V253 19 /* Codec control over voice modem */
51#define N_CAIF 20 /* CAIF protocol for talking to modems */ 50#define N_CAIF 20 /* CAIF protocol for talking to modems */
52#define N_GSM0710 21 /* GSM 0710 Mux */ 51#define N_GSM0710 21 /* GSM 0710 Mux */
52#define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */
53 53
54/* 54/*
55 * This character is the same as _POSIX_VDISABLE: it cannot be used as 55 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -82,7 +82,7 @@ struct tty_buffer {
82 82
83 83
84struct tty_bufhead { 84struct tty_bufhead {
85 struct delayed_work work; 85 struct work_struct work;
86 spinlock_t lock; 86 spinlock_t lock;
87 struct tty_buffer *head; /* Queue head */ 87 struct tty_buffer *head; /* Queue head */
88 struct tty_buffer *tail; /* Active buffer */ 88 struct tty_buffer *tail; /* Active buffer */
@@ -366,6 +366,7 @@ struct tty_file_private {
366#define TTY_HUPPED 18 /* Post driver->hangup() */ 366#define TTY_HUPPED 18 /* Post driver->hangup() */
367#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */ 367#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
368#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */ 368#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
369#define TTY_HUPPING 21 /* ->hangup() in progress */
369 370
370#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 371#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
371 372
@@ -447,6 +448,7 @@ extern void tty_encode_baud_rate(struct tty_struct *tty,
447 speed_t ibaud, speed_t obaud); 448 speed_t ibaud, speed_t obaud);
448extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 449extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
449extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 450extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
451extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
450 452
451extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 453extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
452extern void tty_ldisc_deref(struct tty_ldisc *); 454extern void tty_ldisc_deref(struct tty_ldisc *);
@@ -540,8 +542,8 @@ extern void tty_audit_exit(void);
540extern void tty_audit_fork(struct signal_struct *sig); 542extern void tty_audit_fork(struct signal_struct *sig);
541extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 543extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
542extern void tty_audit_push(struct tty_struct *tty); 544extern void tty_audit_push(struct tty_struct *tty);
543extern void tty_audit_push_task(struct task_struct *tsk, 545extern int tty_audit_push_task(struct task_struct *tsk,
544 uid_t loginuid, u32 sessionid); 546 uid_t loginuid, u32 sessionid);
545#else 547#else
546static inline void tty_audit_add_data(struct tty_struct *tty, 548static inline void tty_audit_add_data(struct tty_struct *tty,
547 unsigned char *data, size_t size) 549 unsigned char *data, size_t size)
@@ -559,9 +561,10 @@ static inline void tty_audit_fork(struct signal_struct *sig)
559static inline void tty_audit_push(struct tty_struct *tty) 561static inline void tty_audit_push(struct tty_struct *tty)
560{ 562{
561} 563}
562static inline void tty_audit_push_task(struct task_struct *tsk, 564static inline int tty_audit_push_task(struct task_struct *tsk,
563 uid_t loginuid, u32 sessionid) 565 uid_t loginuid, u32 sessionid)
564{ 566{
567 return 0;
565} 568}
566#endif 569#endif
567 570
@@ -582,10 +585,10 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp);
582 585
583/* vt.c */ 586/* vt.c */
584 587
585extern int vt_ioctl(struct tty_struct *tty, struct file *file, 588extern int vt_ioctl(struct tty_struct *tty,
586 unsigned int cmd, unsigned long arg); 589 unsigned int cmd, unsigned long arg);
587 590
588extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 591extern long vt_compat_ioctl(struct tty_struct *tty,
589 unsigned int cmd, unsigned long arg); 592 unsigned int cmd, unsigned long arg);
590 593
591/* tty_mutex.c */ 594/* tty_mutex.c */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index db2d227694da..9deeac855240 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -98,16 +98,15 @@
98 * 98 *
99 * Note: Do not call this function directly, call tty_write_room 99 * Note: Do not call this function directly, call tty_write_room
100 * 100 *
101 * int (*ioctl)(struct tty_struct *tty, struct file * file, 101 * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
102 * unsigned int cmd, unsigned long arg);
103 * 102 *
104 * This routine allows the tty driver to implement 103 * This routine allows the tty driver to implement
105 * device-specific ioctl's. If the ioctl number passed in cmd 104 * device-specific ioctls. If the ioctl number passed in cmd
106 * is not recognized by the driver, it should return ENOIOCTLCMD. 105 * is not recognized by the driver, it should return ENOIOCTLCMD.
107 * 106 *
108 * Optional 107 * Optional
109 * 108 *
110 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 109 * long (*compat_ioctl)(struct tty_struct *tty,,
111 * unsigned int cmd, unsigned long arg); 110 * unsigned int cmd, unsigned long arg);
112 * 111 *
113 * implement ioctl processing for 32 bit process on 64 bit system 112 * implement ioctl processing for 32 bit process on 64 bit system
@@ -167,12 +166,12 @@
167 * 166 *
168 * void (*hangup)(struct tty_struct *tty); 167 * void (*hangup)(struct tty_struct *tty);
169 * 168 *
170 * This routine notifies the tty driver that it should hangup the 169 * This routine notifies the tty driver that it should hang up the
171 * tty device. 170 * tty device.
172 * 171 *
173 * Optional: 172 * Optional:
174 * 173 *
175 * int (*break_ctl)(struct tty_stuct *tty, int state); 174 * int (*break_ctl)(struct tty_struct *tty, int state);
176 * 175 *
177 * This optional routine requests the tty driver to turn on or 176 * This optional routine requests the tty driver to turn on or
178 * off BREAK status on the RS-232 port. If state is -1, 177 * off BREAK status on the RS-232 port. If state is -1,
@@ -235,6 +234,7 @@
235#include <linux/fs.h> 234#include <linux/fs.h>
236#include <linux/list.h> 235#include <linux/list.h>
237#include <linux/cdev.h> 236#include <linux/cdev.h>
237#include <linux/termios.h>
238 238
239struct tty_struct; 239struct tty_struct;
240struct tty_driver; 240struct tty_driver;
@@ -255,9 +255,9 @@ struct tty_operations {
255 void (*flush_chars)(struct tty_struct *tty); 255 void (*flush_chars)(struct tty_struct *tty);
256 int (*write_room)(struct tty_struct *tty); 256 int (*write_room)(struct tty_struct *tty);
257 int (*chars_in_buffer)(struct tty_struct *tty); 257 int (*chars_in_buffer)(struct tty_struct *tty);
258 int (*ioctl)(struct tty_struct *tty, struct file * file, 258 int (*ioctl)(struct tty_struct *tty,
259 unsigned int cmd, unsigned long arg); 259 unsigned int cmd, unsigned long arg);
260 long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 260 long (*compat_ioctl)(struct tty_struct *tty,
261 unsigned int cmd, unsigned long arg); 261 unsigned int cmd, unsigned long arg);
262 void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 262 void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
263 void (*throttle)(struct tty_struct * tty); 263 void (*throttle)(struct tty_struct * tty);
@@ -270,8 +270,8 @@ struct tty_operations {
270 void (*set_ldisc)(struct tty_struct *tty); 270 void (*set_ldisc)(struct tty_struct *tty);
271 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 271 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
272 void (*send_xchar)(struct tty_struct *tty, char ch); 272 void (*send_xchar)(struct tty_struct *tty, char ch);
273 int (*tiocmget)(struct tty_struct *tty, struct file *file); 273 int (*tiocmget)(struct tty_struct *tty);
274 int (*tiocmset)(struct tty_struct *tty, struct file *file, 274 int (*tiocmset)(struct tty_struct *tty,
275 unsigned int set, unsigned int clear); 275 unsigned int set, unsigned int clear);
276 int (*resize)(struct tty_struct *tty, struct winsize *ws); 276 int (*resize)(struct tty_struct *tty, struct winsize *ws);
277 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); 277 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
@@ -357,7 +357,7 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
357 * overruns, either.) 357 * overruns, either.)
358 * 358 *
359 * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need 359 * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
360 * to be registered with a call to tty_register_driver() when the 360 * to be registered with a call to tty_register_device() when the
361 * device is found in the system and unregistered with a call to 361 * device is found in the system and unregistered with a call to
362 * tty_unregister_device() so the devices will be show up 362 * tty_unregister_device() so the devices will be show up
363 * properly in sysfs. If not set, driver->num entries will be 363 * properly in sysfs. If not set, driver->num entries will be
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 526d66f066a3..ff7dc08696a8 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -101,14 +101,15 @@
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status, 103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status,
104 * struct timespec *ts) 104 * struct pps_event_time *ts)
105 * 105 *
106 * Tells the discipline that the DCD pin has changed its status and 106 * Tells the discipline that the DCD pin has changed its status and
107 * the relative timestamp. Pointer ts can be NULL. 107 * the relative timestamp. Pointer ts cannot be NULL.
108 */ 108 */
109 109
110#include <linux/fs.h> 110#include <linux/fs.h>
111#include <linux/wait.h> 111#include <linux/wait.h>
112#include <linux/pps_kernel.h>
112 113
113struct tty_ldisc_ops { 114struct tty_ldisc_ops {
114 int magic; 115 int magic;
@@ -143,7 +144,7 @@ struct tty_ldisc_ops {
143 char *fp, int count); 144 char *fp, int count);
144 void (*write_wakeup)(struct tty_struct *); 145 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int, 146 void (*dcd_change)(struct tty_struct *, unsigned int,
146 struct timespec *); 147 struct pps_event_time *);
147 148
148 struct module *owner; 149 struct module *owner;
149 150
diff --git a/include/linux/types.h b/include/linux/types.h
index 357dbc19606f..176da8c1fbb1 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -121,15 +121,7 @@ typedef __u64 u_int64_t;
121typedef __s64 int64_t; 121typedef __s64 int64_t;
122#endif 122#endif
123 123
124/* 124/* this is a special 64bit data type that is 8-byte aligned */
125 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
126 * common 32/64-bit compat problems.
127 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
128 * architectures) and to 8-byte boundaries on 64-bit architetures. The new
129 * aligned_64 type enforces 8-byte alignment so that structs containing
130 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
131 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
132 */
133#define aligned_u64 __u64 __attribute__((aligned(8))) 125#define aligned_u64 __u64 __attribute__((aligned(8)))
134#define aligned_be64 __be64 __attribute__((aligned(8))) 126#define aligned_be64 __be64 __attribute__((aligned(8)))
135#define aligned_le64 __le64 __attribute__((aligned(8))) 127#define aligned_le64 __le64 __attribute__((aligned(8)))
@@ -158,6 +150,12 @@ typedef unsigned long blkcnt_t;
158#define pgoff_t unsigned long 150#define pgoff_t unsigned long
159#endif 151#endif
160 152
153#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
154typedef u64 dma_addr_t;
155#else
156typedef u32 dma_addr_t;
157#endif /* dma_addr_t */
158
161#endif /* __KERNEL__ */ 159#endif /* __KERNEL__ */
162 160
163/* 161/*
@@ -186,7 +184,15 @@ typedef __u64 __bitwise __be64;
186typedef __u16 __bitwise __sum16; 184typedef __u16 __bitwise __sum16;
187typedef __u32 __bitwise __wsum; 185typedef __u32 __bitwise __wsum;
188 186
189/* this is a special 64bit data type that is 8-byte aligned */ 187/*
188 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
189 * common 32/64-bit compat problems.
190 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
191 * architectures) and to 8-byte boundaries on 64-bit architetures. The new
192 * aligned_64 type enforces 8-byte alignment so that structs containing
193 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
194 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
195 */
190#define __aligned_u64 __u64 __attribute__((aligned(8))) 196#define __aligned_u64 __u64 __attribute__((aligned(8)))
191#define __aligned_be64 __be64 __attribute__((aligned(8))) 197#define __aligned_be64 __be64 __attribute__((aligned(8)))
192#define __aligned_le64 __le64 __attribute__((aligned(8))) 198#define __aligned_le64 __le64 __attribute__((aligned(8)))
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index fa261a0da280..8da8c4e87da3 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -67,21 +67,21 @@ struct u64_stats_sync {
67#endif 67#endif
68}; 68};
69 69
70static void inline u64_stats_update_begin(struct u64_stats_sync *syncp) 70static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
71{ 71{
72#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 72#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
73 write_seqcount_begin(&syncp->seq); 73 write_seqcount_begin(&syncp->seq);
74#endif 74#endif
75} 75}
76 76
77static void inline u64_stats_update_end(struct u64_stats_sync *syncp) 77static inline void u64_stats_update_end(struct u64_stats_sync *syncp)
78{ 78{
79#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 79#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
80 write_seqcount_end(&syncp->seq); 80 write_seqcount_end(&syncp->seq);
81#endif 81#endif
82} 82}
83 83
84static unsigned int inline u64_stats_fetch_begin(const struct u64_stats_sync *syncp) 84static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
85{ 85{
86#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 86#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
87 return read_seqcount_begin(&syncp->seq); 87 return read_seqcount_begin(&syncp->seq);
@@ -93,7 +93,7 @@ static unsigned int inline u64_stats_fetch_begin(const struct u64_stats_sync *sy
93#endif 93#endif
94} 94}
95 95
96static bool inline u64_stats_fetch_retry(const struct u64_stats_sync *syncp, 96static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
97 unsigned int start) 97 unsigned int start)
98{ 98{
99#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 99#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
@@ -112,7 +112,7 @@ static bool inline u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
112 * - UP 32bit must disable BH. 112 * - UP 32bit must disable BH.
113 * - 64bit have no problem atomically reading u64 values, irq safe. 113 * - 64bit have no problem atomically reading u64 values, irq safe.
114 */ 114 */
115static unsigned int inline u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp) 115static inline unsigned int u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp)
116{ 116{
117#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 117#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
118 return read_seqcount_begin(&syncp->seq); 118 return read_seqcount_begin(&syncp->seq);
@@ -124,7 +124,7 @@ static unsigned int inline u64_stats_fetch_begin_bh(const struct u64_stats_sync
124#endif 124#endif
125} 125}
126 126
127static bool inline u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp, 127static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp,
128 unsigned int start) 128 unsigned int start)
129{ 129{
130#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 130#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 1b4790911052..5c75153f9441 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -8,7 +8,7 @@
8 * Copyright: MontaVista Software, Inc. 8 * Copyright: MontaVista Software, Inc.
9 * 9 *
10 * Spliting done by: Marek Vasut <marek.vasut@gmail.com> 10 * Spliting done by: Marek Vasut <marek.vasut@gmail.com>
11 * If something doesnt work and it worked before spliting, e-mail me, 11 * If something doesn't work and it worked before spliting, e-mail me,
12 * dont bother Nicolas please ;-) 12 * dont bother Nicolas please ;-)
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 05f7fed2b173..d28c726ede4f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -104,6 +104,7 @@ struct uinput_ff_erase {
104#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) 104#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
105#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) 105#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
106#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) 106#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
107#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
107 108
108#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) 109#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
109#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) 110#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index d6188e5a52df..665517c05eaf 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de> 4 * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de>
5 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> 5 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
6 * Copyright(C) 2006, Hans J. Koch <hjk@linutronix.de> 6 * Copyright(C) 2006, Hans J. Koch <hjk@hansjkoch.de>
7 * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com> 7 * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com>
8 * 8 *
9 * Userspace IO driver. 9 * Userspace IO driver.
diff --git a/include/linux/unaligned/packed_struct.h b/include/linux/unaligned/packed_struct.h
index 2498bb9fe002..c0d817de4df2 100644
--- a/include/linux/unaligned/packed_struct.h
+++ b/include/linux/unaligned/packed_struct.h
@@ -3,9 +3,9 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6struct __una_u16 { u16 x __attribute__((packed)); }; 6struct __una_u16 { u16 x; } __packed;
7struct __una_u32 { u32 x __attribute__((packed)); }; 7struct __una_u32 { u32 x; } __packed;
8struct __una_u64 { u64 x __attribute__((packed)); }; 8struct __una_u64 { u64 x; } __packed;
9 9
10static inline u16 __get_unaligned_cpu16(const void *p) 10static inline u16 __get_unaligned_cpu16(const void *p)
11{ 11{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 35fe6ab222bb..65f78ca5d88e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -20,6 +20,7 @@
20#include <linux/completion.h> /* for struct completion */ 20#include <linux/completion.h> /* for struct completion */
21#include <linux/sched.h> /* for current && schedule_timeout */ 21#include <linux/sched.h> /* for current && schedule_timeout */
22#include <linux/mutex.h> /* for struct mutex */ 22#include <linux/mutex.h> /* for struct mutex */
23#include <linux/pm_runtime.h> /* for runtime PM */
23 24
24struct usb_device; 25struct usb_device;
25struct usb_driver; 26struct usb_driver;
@@ -313,6 +314,10 @@ struct usb_bus {
313 int busnum; /* Bus number (in order of reg) */ 314 int busnum; /* Bus number (in order of reg) */
314 const char *bus_name; /* stable id (PCI slot_name etc) */ 315 const char *bus_name; /* stable id (PCI slot_name etc) */
315 u8 uses_dma; /* Does the host controller use DMA? */ 316 u8 uses_dma; /* Does the host controller use DMA? */
317 u8 uses_pio_for_control; /*
318 * Does the host controller use PIO
319 * for control transfers?
320 */
316 u8 otg_port; /* 0, or number of OTG/HNP port */ 321 u8 otg_port; /* 0, or number of OTG/HNP port */
317 unsigned is_b_host:1; /* true during some HNP roleswitches */ 322 unsigned is_b_host:1; /* true during some HNP roleswitches */
318 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 323 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
@@ -407,8 +412,6 @@ struct usb_tt;
407 * @quirks: quirks of the whole device 412 * @quirks: quirks of the whole device
408 * @urbnum: number of URBs submitted for the whole device 413 * @urbnum: number of URBs submitted for the whole device
409 * @active_duration: total time device is not suspended 414 * @active_duration: total time device is not suspended
410 * @last_busy: time of last use
411 * @autosuspend_delay: in jiffies
412 * @connect_time: time device was first connected 415 * @connect_time: time device was first connected
413 * @do_remote_wakeup: remote wakeup should be enabled 416 * @do_remote_wakeup: remote wakeup should be enabled
414 * @reset_resume: needs reset instead of resume 417 * @reset_resume: needs reset instead of resume
@@ -481,8 +484,6 @@ struct usb_device {
481 unsigned long active_duration; 484 unsigned long active_duration;
482 485
483#ifdef CONFIG_PM 486#ifdef CONFIG_PM
484 unsigned long last_busy;
485 int autosuspend_delay;
486 unsigned long connect_time; 487 unsigned long connect_time;
487 488
488 unsigned do_remote_wakeup:1; 489 unsigned do_remote_wakeup:1;
@@ -527,7 +528,7 @@ extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf);
527 528
528static inline void usb_mark_last_busy(struct usb_device *udev) 529static inline void usb_mark_last_busy(struct usb_device *udev)
529{ 530{
530 udev->last_busy = jiffies; 531 pm_runtime_mark_last_busy(&udev->dev);
531} 532}
532 533
533#else 534#else
@@ -622,7 +623,7 @@ extern struct usb_host_interface *usb_find_alt_setting(
622 * USB hubs. That makes it stay the same until systems are physically 623 * USB hubs. That makes it stay the same until systems are physically
623 * reconfigured, by re-cabling a tree of USB devices or by moving USB host 624 * reconfigured, by re-cabling a tree of USB devices or by moving USB host
624 * controllers. Adding and removing devices, including virtual root hubs 625 * controllers. Adding and removing devices, including virtual root hubs
625 * in host controller driver modules, does not change these path identifers; 626 * in host controller driver modules, does not change these path identifiers;
626 * neither does rebooting or re-enumerating. These are more useful identifiers 627 * neither does rebooting or re-enumerating. These are more useful identifiers
627 * than changeable ("unstable") ones like bus numbers or device addresses. 628 * than changeable ("unstable") ones like bus numbers or device addresses.
628 * 629 *
@@ -792,12 +793,12 @@ struct usbdrv_wrap {
792 * usb_set_intfdata() to associate driver-specific data with the 793 * usb_set_intfdata() to associate driver-specific data with the
793 * interface. It may also use usb_set_interface() to specify the 794 * interface. It may also use usb_set_interface() to specify the
794 * appropriate altsetting. If unwilling to manage the interface, 795 * appropriate altsetting. If unwilling to manage the interface,
795 * return -ENODEV, if genuine IO errors occured, an appropriate 796 * return -ENODEV, if genuine IO errors occurred, an appropriate
796 * negative errno value. 797 * negative errno value.
797 * @disconnect: Called when the interface is no longer accessible, usually 798 * @disconnect: Called when the interface is no longer accessible, usually
798 * because its device has been (or is being) disconnected or the 799 * because its device has been (or is being) disconnected or the
799 * driver module is being unloaded. 800 * driver module is being unloaded.
800 * @ioctl: Used for drivers that want to talk to userspace through 801 * @unlocked_ioctl: Used for drivers that want to talk to userspace through
801 * the "usbfs" filesystem. This lets devices provide ways to 802 * the "usbfs" filesystem. This lets devices provide ways to
802 * expose information to user space regardless of where they 803 * expose information to user space regardless of where they
803 * do (or don't) show up otherwise in the filesystem. 804 * do (or don't) show up otherwise in the filesystem.
@@ -975,6 +976,7 @@ extern int usb_disabled(void);
975#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ 976#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
976#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ 977#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
977#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ 978#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
979#define URB_ALIGNED_TEMP_BUFFER 0x00800000 /* Temp buffer was alloc'd */
978 980
979struct usb_iso_packet_descriptor { 981struct usb_iso_packet_descriptor {
980 unsigned int offset; 982 unsigned int offset;
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 51410e0200cf..ed91fb62674b 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -2,6 +2,7 @@ header-y += audio.h
2header-y += cdc.h 2header-y += cdc.h
3header-y += ch9.h 3header-y += ch9.h
4header-y += ch11.h 4header-y += ch11.h
5header-y += functionfs.h
5header-y += gadgetfs.h 6header-y += gadgetfs.h
6header-y += midi.h 7header-y += midi.h
7header-y += g_printer.h 8header-y += g_printer.h
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 5e86dc771da4..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -89,7 +89,7 @@ struct usb_cdc_acm_descriptor {
89 89
90#define USB_CDC_COMM_FEATURE 0x01 90#define USB_CDC_COMM_FEATURE 0x01
91#define USB_CDC_CAP_LINE 0x02 91#define USB_CDC_CAP_LINE 0x02
92#define USB_CDC_CAP_BRK 0x04 92#define USB_CDC_CAP_BRK 0x04
93#define USB_CDC_CAP_NOTIFY 0x08 93#define USB_CDC_CAP_NOTIFY 0x08
94 94
95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
@@ -271,6 +271,11 @@ struct usb_cdc_notification {
271 __le16 wLength; 271 __le16 wLength;
272} __attribute__ ((packed)); 272} __attribute__ ((packed));
273 273
274struct usb_cdc_speed_change {
275 __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */
276 __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */
277} __attribute__ ((packed));
278
274/*-------------------------------------------------------------------------*/ 279/*-------------------------------------------------------------------------*/
275 280
276/* 281/*
@@ -292,7 +297,7 @@ struct usb_cdc_ncm_ntb_parameters {
292 __le16 wNdpOutDivisor; 297 __le16 wNdpOutDivisor;
293 __le16 wNdpOutPayloadRemainder; 298 __le16 wNdpOutPayloadRemainder;
294 __le16 wNdpOutAlignment; 299 __le16 wNdpOutAlignment;
295 __le16 wPadding2; 300 __le16 wNtbOutMaxDatagrams;
296} __attribute__ ((packed)); 301} __attribute__ ((packed));
297 302
298/* 303/*
@@ -307,7 +312,7 @@ struct usb_cdc_ncm_nth16 {
307 __le16 wHeaderLength; 312 __le16 wHeaderLength;
308 __le16 wSequence; 313 __le16 wSequence;
309 __le16 wBlockLength; 314 __le16 wBlockLength;
310 __le16 wFpIndex; 315 __le16 wNdpIndex;
311} __attribute__ ((packed)); 316} __attribute__ ((packed));
312 317
313struct usb_cdc_ncm_nth32 { 318struct usb_cdc_ncm_nth32 {
@@ -315,7 +320,7 @@ struct usb_cdc_ncm_nth32 {
315 __le16 wHeaderLength; 320 __le16 wHeaderLength;
316 __le16 wSequence; 321 __le16 wSequence;
317 __le32 dwBlockLength; 322 __le32 dwBlockLength;
318 __le32 dwFpIndex; 323 __le32 dwNdpIndex;
319} __attribute__ ((packed)); 324} __attribute__ ((packed));
320 325
321/* 326/*
@@ -337,7 +342,7 @@ struct usb_cdc_ncm_dpe16 {
337struct usb_cdc_ncm_ndp16 { 342struct usb_cdc_ncm_ndp16 {
338 __le32 dwSignature; 343 __le32 dwSignature;
339 __le16 wLength; 344 __le16 wLength;
340 __le16 wNextFpIndex; 345 __le16 wNextNdpIndex;
341 struct usb_cdc_ncm_dpe16 dpe16[0]; 346 struct usb_cdc_ncm_dpe16 dpe16[0];
342} __attribute__ ((packed)); 347} __attribute__ ((packed));
343 348
@@ -375,6 +380,7 @@ struct usb_cdc_ncm_ndp32 {
375#define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) 380#define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2)
376#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) 381#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3)
377#define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) 382#define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4)
383#define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5)
378 384
379/* CDC NCM subclass Table 6-3: NTB Parameter Structure */ 385/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
380#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) 386#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0)
@@ -392,6 +398,13 @@ struct usb_cdc_ncm_ndp32 {
392#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 398#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048
393#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 399#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048
394 400
401/* NTB Input Size Structure */
402struct usb_cdc_ncm_ndp_input_size {
403 __le32 dwNtbInMaxSize;
404 __le16 wNtbInMaxDatagrams;
405 __le16 wReserved;
406} __attribute__ ((packed));
407
395/* CDC NCM subclass 6.2.11 SetCrcMode */ 408/* CDC NCM subclass 6.2.11 SetCrcMode */
396#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 409#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00
397#define USB_CDC_NCM_CRC_APPENDED 0x01 410#define USB_CDC_NCM_CRC_APPENDED 0x01
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 119194c85d10..4ebaf0824179 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,6 +26,14 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
30
31/*
32 * Hub class additional requests defined by USB 3.0 spec
33 * See USB 3.0 spec Table 10-6
34 */
35#define HUB_SET_DEPTH 12
36#define HUB_GET_PORT_ERR_COUNT 13
29 37
30/* 38/*
31 * Hub Class feature numbers 39 * Hub Class feature numbers
@@ -54,6 +62,26 @@
54#define USB_PORT_FEAT_TEST 21 62#define USB_PORT_FEAT_TEST 21
55#define USB_PORT_FEAT_INDICATOR 22 63#define USB_PORT_FEAT_INDICATOR 22
56#define USB_PORT_FEAT_C_PORT_L1 23 64#define USB_PORT_FEAT_C_PORT_L1 23
65#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
66#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
67#define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27
68#define USB_PORT_FEAT_BH_PORT_RESET 28
69#define USB_PORT_FEAT_C_BH_PORT_RESET 29
70#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
71
72/*
73 * Port feature selectors added by USB 3.0 spec.
74 * See USB 3.0 spec Table 10-7
75 */
76#define USB_PORT_FEAT_LINK_STATE 5
77#define USB_PORT_FEAT_U1_TIMEOUT 23
78#define USB_PORT_FEAT_U2_TIMEOUT 24
79#define USB_PORT_FEAT_C_LINK_STATE 25
80#define USB_PORT_FEAT_C_CONFIG_ERR 26
81#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
82#define USB_PORT_FEAT_BH_PORT_RESET 28
83#define USB_PORT_FEAT_C_BH_PORT_RESET 29
84#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
57 85
58/* 86/*
59 * Hub Status and Hub Change results 87 * Hub Status and Hub Change results
@@ -81,12 +109,43 @@ struct usb_port_status {
81#define USB_PORT_STAT_TEST 0x0800 109#define USB_PORT_STAT_TEST 0x0800
82#define USB_PORT_STAT_INDICATOR 0x1000 110#define USB_PORT_STAT_INDICATOR 0x1000
83/* bits 13 to 15 are reserved */ 111/* bits 13 to 15 are reserved */
84#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */ 112
113/*
114 * Additions to wPortStatus bit field from USB 3.0
115 * See USB 3.0 spec Table 10-10
116 */
117#define USB_PORT_STAT_LINK_STATE 0x01e0
118#define USB_SS_PORT_STAT_POWER 0x0200
119#define USB_SS_PORT_STAT_SPEED 0x1c00
120#define USB_PORT_STAT_SPEED_5GBPS 0x0000
121/* Valid only if port is enabled */
122/* Bits that are the same from USB 2.0 */
123#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
124 USB_PORT_STAT_ENABLE | \
125 USB_PORT_STAT_OVERCURRENT | \
126 USB_PORT_STAT_RESET)
127
128/*
129 * Definitions for PORT_LINK_STATE values
130 * (bits 5-8) in wPortStatus
131 */
132#define USB_SS_PORT_LS_U0 0x0000
133#define USB_SS_PORT_LS_U1 0x0020
134#define USB_SS_PORT_LS_U2 0x0040
135#define USB_SS_PORT_LS_U3 0x0060
136#define USB_SS_PORT_LS_SS_DISABLED 0x0080
137#define USB_SS_PORT_LS_RX_DETECT 0x00a0
138#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
139#define USB_SS_PORT_LS_POLLING 0x00e0
140#define USB_SS_PORT_LS_RECOVERY 0x0100
141#define USB_SS_PORT_LS_HOT_RESET 0x0120
142#define USB_SS_PORT_LS_COMP_MOD 0x0140
143#define USB_SS_PORT_LS_LOOPBACK 0x0160
85 144
86/* 145/*
87 * wPortChange bit field 146 * wPortChange bit field
88 * See USB 2.0 spec Table 11-22 147 * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
89 * Bits 0 to 4 shown, bits 5 to 15 are reserved 148 * Bits 0 to 5 shown, bits 6 to 15 are reserved
90 */ 149 */
91#define USB_PORT_STAT_C_CONNECTION 0x0001 150#define USB_PORT_STAT_C_CONNECTION 0x0001
92#define USB_PORT_STAT_C_ENABLE 0x0002 151#define USB_PORT_STAT_C_ENABLE 0x0002
@@ -94,6 +153,13 @@ struct usb_port_status {
94#define USB_PORT_STAT_C_OVERCURRENT 0x0008 153#define USB_PORT_STAT_C_OVERCURRENT 0x0008
95#define USB_PORT_STAT_C_RESET 0x0010 154#define USB_PORT_STAT_C_RESET 0x0010
96#define USB_PORT_STAT_C_L1 0x0020 155#define USB_PORT_STAT_C_L1 0x0020
156/*
157 * USB 3.0 wPortChange bit fields
158 * See USB 3.0 spec Table 10-11
159 */
160#define USB_PORT_STAT_C_BH_RESET 0x0020
161#define USB_PORT_STAT_C_LINK_STATE 0x0040
162#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
97 163
98/* 164/*
99 * wHubCharacteristics (masks) 165 * wHubCharacteristics (masks)
@@ -128,7 +194,9 @@ struct usb_hub_status {
128 */ 194 */
129 195
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09) 196#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
197#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
131#define USB_DT_HUB_NONVAR_SIZE 7 198#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12
132 200
133struct usb_hub_descriptor { 201struct usb_hub_descriptor {
134 __u8 bDescLength; 202 __u8 bDescLength;
@@ -137,11 +205,22 @@ struct usb_hub_descriptor {
137 __le16 wHubCharacteristics; 205 __le16 wHubCharacteristics;
138 __u8 bPwrOn2PwrGood; 206 __u8 bPwrOn2PwrGood;
139 __u8 bHubContrCurrent; 207 __u8 bHubContrCurrent;
140 /* add 1 bit for hub status change; round to bytes */
141 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
142 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
143} __attribute__ ((packed));
144 208
209 /* 2.0 and 3.0 hubs differ here */
210 union {
211 struct {
212 /* add 1 bit for hub status change; round to bytes */
213 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
214 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
215 } __attribute__ ((packed)) hs;
216
217 struct {
218 __u8 bHubHdrDecLat;
219 __u16 wHubDelay;
220 __u16 DeviceRemovable;
221 } __attribute__ ((packed)) ss;
222 } u;
223} __attribute__ ((packed));
145 224
146/* port indicator status selectors, tables 11-7 and 11-25 */ 225/* port indicator status selectors, tables 11-7 and 11-25 */
147#define HUB_LED_AUTO 0 226#define HUB_LED_AUTO 0
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index f917bbbc8901..b72f305ce6bd 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -124,6 +124,16 @@
124#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ 124#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
125 125
126/* 126/*
127 * Test Mode Selectors
128 * See USB 2.0 spec Table 9-7
129 */
130#define TEST_J 1
131#define TEST_K 2
132#define TEST_SE0_NAK 3
133#define TEST_PACKET 4
134#define TEST_FORCE_EN 5
135
136/*
127 * New Feature Selectors as added by USB 3.0 137 * New Feature Selectors as added by USB 3.0
128 * See USB 3.0 spec Table 9-6 138 * See USB 3.0 spec Table 9-6
129 */ 139 */
@@ -574,7 +584,9 @@ struct usb_ss_ep_comp_descriptor {
574 584
575#define USB_DT_SS_EP_COMP_SIZE 6 585#define USB_DT_SS_EP_COMP_SIZE 6
576/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
577#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f)) 587#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
588/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
589#define USB_SS_MULT(p) (1 + ((p) & 0x3))
578 590
579/*-------------------------------------------------------------------------*/ 591/*-------------------------------------------------------------------------*/
580 592
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3d29a7dcac2d..882a084a8411 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -188,7 +188,7 @@ ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
188 * @bind() method is then used to initialize all the functions and then 188 * @bind() method is then used to initialize all the functions and then
189 * call @usb_add_function() for them. 189 * call @usb_add_function() for them.
190 * 190 *
191 * Those functions would normally be independant of each other, but that's 191 * Those functions would normally be independent of each other, but that's
192 * not mandatory. CDC WMC devices are an example where functions often 192 * not mandatory. CDC WMC devices are an example where functions often
193 * depend on other functions, with some functions subsidiary to others. 193 * depend on other functions, with some functions subsidiary to others.
194 * Such interdependency may be managed in any way, so long as all of the 194 * Such interdependency may be managed in any way, so long as all of the
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 2e262cb15425..e49dfd45baa4 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -127,7 +127,9 @@ struct ehci_regs {
127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
128#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 128#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
129/* 19:16 for port testing */ 129/* 19:16 for port testing */
130#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */ 130#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
131#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
132#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
131#define PORT_LED_OFF (0<<14) 133#define PORT_LED_OFF (0<<14)
132#define PORT_LED_AMBER (1<<14) 134#define PORT_LED_AMBER (1<<14)
133#define PORT_LED_GREEN (2<<14) 135#define PORT_LED_GREEN (2<<14)
@@ -157,7 +159,7 @@ struct ehci_regs {
157#define USBMODE_CM_IDLE (0<<0) /* idle state */ 159#define USBMODE_CM_IDLE (0<<0) /* idle state */
158 160
159/* Moorestown has some non-standard registers, partially due to the fact that 161/* Moorestown has some non-standard registers, partially due to the fact that
160 * its EHCI controller has both TT and LPM support. HOSTPCx are extentions to 162 * its EHCI controller has both TT and LPM support. HOSTPCx are extensions to
161 * PORTSCx 163 * PORTSCx
162 */ 164 */
163#define HOSTPC0 0x84 /* HOSTPC extension */ 165#define HOSTPC0 0x84 /* HOSTPC extension */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 6f649c13193b..7587ef934ba8 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -45,7 +45,7 @@ struct usb_functionfs_descs_head {
45 * | off | name | type | description | 45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------| 46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC | 47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | lenght | LE32 | length of the whole data chunk | 48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors | 49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors | 50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | 51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
@@ -86,7 +86,7 @@ struct usb_functionfs_strings_head {
86 * | 0 | lang | LE16 | language code | 86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language | 87 * | 2 | strings | String[str_count] | array of strings in given language |
88 * 88 *
89 * For each string ther is one strings entry (ie. there are str_count 89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in 90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8. 91 * UTF-8.
92 */ 92 */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 006412ce2303..e538172c0f64 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -72,7 +72,7 @@ struct usb_ep;
72 * Bulk endpoints can use any size buffers, and can also be used for interrupt 72 * Bulk endpoints can use any size buffers, and can also be used for interrupt
73 * transfers. interrupt-only endpoints can be much less functional. 73 * transfers. interrupt-only endpoints can be much less functional.
74 * 74 *
75 * NOTE: this is analagous to 'struct urb' on the host side, except that 75 * NOTE: this is analogous to 'struct urb' on the host side, except that
76 * it's thinner and promotes more pre-allocation. 76 * it's thinner and promotes more pre-allocation.
77 */ 77 */
78 78
@@ -269,7 +269,7 @@ static inline void usb_ep_free_request(struct usb_ep *ep,
269 * 269 *
270 * Control endpoints ... after getting a setup() callback, the driver queues 270 * Control endpoints ... after getting a setup() callback, the driver queues
271 * one response (even if it would be zero length). That enables the 271 * one response (even if it would be zero length). That enables the
272 * status ack, after transfering data as specified in the response. Setup 272 * status ack, after transferring data as specified in the response. Setup
273 * functions may return negative error codes to generate protocol stalls. 273 * functions may return negative error codes to generate protocol stalls.
274 * (Note that some USB device controllers disallow protocol stall responses 274 * (Note that some USB device controllers disallow protocol stall responses
275 * in some cases.) When control responses are deferred (the response is 275 * in some cases.) When control responses are deferred (the response is
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 0b6e751ea0b1..0097136ba45d 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -76,6 +76,10 @@ struct usb_hcd {
76 struct kref kref; /* reference counter */ 76 struct kref kref; /* reference counter */
77 77
78 const char *product_desc; /* product/vendor string */ 78 const char *product_desc; /* product/vendor string */
79 int speed; /* Speed for this roothub.
80 * May be different from
81 * hcd->driver->flags & HCD_MASK
82 */
79 char irq_descr[24]; /* driver + bus # */ 83 char irq_descr[24]; /* driver + bus # */
80 84
81 struct timer_list rh_timer; /* drives root-hub polling */ 85 struct timer_list rh_timer; /* drives root-hub polling */
@@ -99,6 +103,8 @@ struct usb_hcd {
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
106#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
107#define HCD_FLAG_DEAD 6 /* controller has died? */
102 108
103 /* The flags can be tested using these macros; they are likely to 109 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit(). 110 * be slightly faster than test_bit().
@@ -108,10 +114,13 @@ struct usb_hcd {
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 114#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) 115#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
117#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
118#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
111 119
112 /* Flags that get set only during HCD registration or removal. */ 120 /* Flags that get set only during HCD registration or removal. */
113 unsigned rh_registered:1;/* is root hub registered? */ 121 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */ 122 unsigned rh_pollable:1; /* may we poll the root hub? */
123 unsigned msix_enabled:1; /* driver has MSI-X enabled? */
115 124
116 /* The next flag is a stopgap, to be removed when all the HCDs 125 /* The next flag is a stopgap, to be removed when all the HCDs
117 * support the new root-hub polling mechanism. */ 126 * support the new root-hub polling mechanism. */
@@ -137,7 +146,9 @@ struct usb_hcd {
137 * bandwidth_mutex should be dropped after a successful control message 146 * bandwidth_mutex should be dropped after a successful control message
138 * to the device, or resetting the bandwidth after a failed attempt. 147 * to the device, or resetting the bandwidth after a failed attempt.
139 */ 148 */
140 struct mutex bandwidth_mutex; 149 struct mutex *bandwidth_mutex;
150 struct usb_hcd *shared_hcd;
151 struct usb_hcd *primary_hcd;
141 152
142 153
143#define HCD_BUFFER_POOLS 4 154#define HCD_BUFFER_POOLS 4
@@ -200,6 +211,7 @@ struct hc_driver {
200 int flags; 211 int flags;
201#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ 212#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
202#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ 213#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
214#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
203#define HCD_USB11 0x0010 /* USB 1.1 */ 215#define HCD_USB11 0x0010 /* USB 1.1 */
204#define HCD_USB2 0x0020 /* USB 2.0 */ 216#define HCD_USB2 0x0020 /* USB 2.0 */
205#define HCD_USB3 0x0040 /* USB 3.0 */ 217#define HCD_USB3 0x0040 /* USB 3.0 */
@@ -233,6 +245,19 @@ struct hc_driver {
233 int (*urb_dequeue)(struct usb_hcd *hcd, 245 int (*urb_dequeue)(struct usb_hcd *hcd,
234 struct urb *urb, int status); 246 struct urb *urb, int status);
235 247
248 /*
249 * (optional) these hooks allow an HCD to override the default DMA
250 * mapping and unmapping routines. In general, they shouldn't be
251 * necessary unless the host controller has special DMA requirements,
252 * such as alignment contraints. If these are not specified, the
253 * general usb_hcd_(un)?map_urb_for_dma functions will be used instead
254 * (and it may be a good idea to call these functions in your HCD
255 * implementation)
256 */
257 int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
258 gfp_t mem_flags);
259 void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
260
236 /* hw synch, freeing endpoint resources that urb_dequeue can't */ 261 /* hw synch, freeing endpoint resources that urb_dequeue can't */
237 void (*endpoint_disable)(struct usb_hcd *hcd, 262 void (*endpoint_disable)(struct usb_hcd *hcd,
238 struct usb_host_endpoint *ep); 263 struct usb_host_endpoint *ep);
@@ -329,8 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
329extern int usb_hcd_unlink_urb(struct urb *urb, int status); 354extern int usb_hcd_unlink_urb(struct urb *urb, int status);
330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, 355extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
331 int status); 356 int status);
332extern void unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); 357extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
333extern void unmap_urb_for_dma(struct usb_hcd *, struct urb *); 358 gfp_t mem_flags);
359extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
360extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
334extern void usb_hcd_flush_endpoint(struct usb_device *udev, 361extern void usb_hcd_flush_endpoint(struct usb_device *udev,
335 struct usb_host_endpoint *ep); 362 struct usb_host_endpoint *ep);
336extern void usb_hcd_disable_endpoint(struct usb_device *udev, 363extern void usb_hcd_disable_endpoint(struct usb_device *udev,
@@ -346,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev);
346 373
347extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 374extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
348 struct device *dev, const char *bus_name); 375 struct device *dev, const char *bus_name);
376extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
377 struct device *dev, const char *bus_name,
378 struct usb_hcd *shared_hcd);
349extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); 379extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
350extern void usb_put_hcd(struct usb_hcd *hcd); 380extern void usb_put_hcd(struct usb_hcd *hcd);
381extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
351extern int usb_add_hcd(struct usb_hcd *hcd, 382extern int usb_add_hcd(struct usb_hcd *hcd,
352 unsigned int irqnum, unsigned long irqflags); 383 unsigned int irqnum, unsigned long irqflags);
353extern void usb_remove_hcd(struct usb_hcd *hcd); 384extern void usb_remove_hcd(struct usb_hcd *hcd);
@@ -471,6 +502,10 @@ extern void usb_ep0_reinit(struct usb_device *);
471 502
472/*-------------------------------------------------------------------------*/ 503/*-------------------------------------------------------------------------*/
473 504
505/* class requests from USB 3.0 hub spec, table 10-5 */
506#define SetHubDepth (0x3000 | HUB_SET_DEPTH)
507#define GetPortErrorCount (0x8000 | HUB_GET_PORT_ERR_COUNT)
508
474/* 509/*
475 * Generic bandwidth allocation constants/support 510 * Generic bandwidth allocation constants/support
476 */ 511 */
@@ -617,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
617 652
618/*-------------------------------------------------------------------------*/ 653/*-------------------------------------------------------------------------*/
619 654
620/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
621/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
622#define bitmap DeviceRemovable
623
624
625/*-------------------------------------------------------------------------*/
626
627/* random stuff */ 655/* random stuff */
628 656
629#define RUN_CONTEXT (in_irq() ? "in_irq" \ 657#define RUN_CONTEXT (in_irq() ? "in_irq" \
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 1d1040865661..c8c52e3c91de 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -70,7 +70,7 @@ struct usb_midi_out_jack_descriptor {
70 __u8 bJackID; 70 __u8 bJackID;
71 __u8 bNrInputPins; /* p */ 71 __u8 bNrInputPins; /* p */
72 struct usb_midi_source_pin pins[]; /* [p] */ 72 struct usb_midi_source_pin pins[]; /* [p] */
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */ 73 /*__u8 iJack; -- omitted due to variable-sized pins[] */
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) 76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
new file mode 100644
index 000000000000..3657403eac18
--- /dev/null
+++ b/include/linux/usb/msm_hsusb.h
@@ -0,0 +1,112 @@
1/* linux/include/asm-arm/arch-msm/hsusb.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ASM_ARCH_MSM_HSUSB_H
19#define __ASM_ARCH_MSM_HSUSB_H
20
21#include <linux/types.h>
22#include <linux/usb/otg.h>
23
24/**
25 * Supported USB modes
26 *
27 * USB_PERIPHERAL Only peripheral mode is supported.
28 * USB_HOST Only host mode is supported.
29 * USB_OTG OTG mode is supported.
30 *
31 */
32enum usb_mode_type {
33 USB_NONE = 0,
34 USB_PERIPHERAL,
35 USB_HOST,
36 USB_OTG,
37};
38
39/**
40 * OTG control
41 *
42 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
43 * only configuration.
44 * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
45 * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
46 * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
47 *
48 */
49enum otg_control_type {
50 OTG_NO_CONTROL = 0,
51 OTG_PHY_CONTROL,
52 OTG_PMIC_CONTROL,
53 OTG_USER_CONTROL,
54};
55
56/**
57 * struct msm_otg_platform_data - platform device data
58 * for msm_otg driver.
59 * @phy_init_seq: PHY configuration sequence. val, reg pairs
60 * terminated by -1.
61 * @vbus_power: VBUS power on/off routine.
62 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
63 * @mode: Supported mode (OTG/peripheral/host).
64 * @otg_control: OTG switch controlled by user/Id pin
65 * @default_mode: Default operational mode. Applicable only if
66 * OTG switch is controller by user.
67 *
68 */
69struct msm_otg_platform_data {
70 int *phy_init_seq;
71 void (*vbus_power)(bool on);
72 unsigned power_budget;
73 enum usb_mode_type mode;
74 enum otg_control_type otg_control;
75 enum usb_mode_type default_mode;
76 void (*setup_gpio)(enum usb_otg_state state);
77};
78
79/**
80 * struct msm_otg: OTG driver data. Shared by HCD and DCD.
81 * @otg: USB OTG Transceiver structure.
82 * @pdata: otg device platform data.
83 * @irq: IRQ number assigned for HSUSB controller.
84 * @clk: clock struct of usb_hs_clk.
85 * @pclk: clock struct of usb_hs_pclk.
86 * @phy_reset_clk: clock struct of usb_phy_clk.
87 * @core_clk: clock struct of usb_hs_core_clk.
88 * @regs: ioremapped register base address.
89 * @inputs: OTG state machine inputs(Id, SessValid etc).
90 * @sm_work: OTG state machine work.
91 * @in_lpm: indicates low power mode (LPM) state.
92 * @async_int: Async interrupt arrived.
93 *
94 */
95struct msm_otg {
96 struct otg_transceiver otg;
97 struct msm_otg_platform_data *pdata;
98 int irq;
99 struct clk *clk;
100 struct clk *pclk;
101 struct clk *phy_reset_clk;
102 struct clk *core_clk;
103 void __iomem *regs;
104#define ID 0
105#define B_SESS_VLD 1
106 unsigned long inputs;
107 struct work_struct sm_work;
108 atomic_t in_lpm;
109 int async_int;
110};
111
112#endif
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
new file mode 100644
index 000000000000..7d1babbff071
--- /dev/null
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Author: Brian Swetland <swetland@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18
19#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
20#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
21#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
22
23#define USB_USBCMD (MSM_USB_BASE + 0x0140)
24#define USB_PORTSC (MSM_USB_BASE + 0x0184)
25#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
26#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
27
28#define USBCMD_RESET 2
29#define USB_USBINTR (MSM_USB_BASE + 0x0148)
30
31#define PORTSC_PHCD (1 << 23) /* phy suspend mode */
32#define PORTSC_PTS_MASK (3 << 30)
33#define PORTSC_PTS_ULPI (3 << 30)
34
35#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
36#define ULPI_RUN (1 << 30)
37#define ULPI_WRITE (1 << 29)
38#define ULPI_READ (0 << 29)
39#define ULPI_ADDR(n) (((n) & 255) << 16)
40#define ULPI_DATA(n) ((n) & 255)
41#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
42
43#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */
44#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */
45
46/* OTG definitions */
47#define OTGSC_INTSTS_MASK (0x7f << 16)
48#define OTGSC_ID (1 << 8)
49#define OTGSC_BSV (1 << 11)
50#define OTGSC_IDIS (1 << 16)
51#define OTGSC_BSVIS (1 << 19)
52#define OTGSC_IDIE (1 << 24)
53#define OTGSC_BSVIE (1 << 27)
54
55#endif /* __LINUX_USB_GADGET_MSM72K_UDC_H__ */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index ee2dd1d506ed..eb505250940a 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -3,7 +3,7 @@
3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC. 3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
4 * 4 *
5 * Board initialization should put one of these into dev->platform_data, 5 * Board initialization should put one of these into dev->platform_data,
6 * probably on some platform_device named "musb_hdrc". It encapsulates 6 * probably on some platform_device named "musb-hdrc". It encapsulates
7 * key configuration differences between boards. 7 * key configuration differences between boards.
8 */ 8 */
9 9
@@ -89,6 +89,8 @@ struct musb_hdrc_config {
89 /* A GPIO controlling VRSEL in Blackfin */ 89 /* A GPIO controlling VRSEL in Blackfin */
90 unsigned int gpio_vrsel; 90 unsigned int gpio_vrsel;
91 unsigned int gpio_vrsel_active; 91 unsigned int gpio_vrsel_active;
92 /* musb CLKIN in Blackfin in MHZ */
93 unsigned char clkin;
92#endif 94#endif
93 95
94}; 96};
@@ -118,14 +120,14 @@ struct musb_hdrc_platform_data {
118 /* Power the device on or off */ 120 /* Power the device on or off */
119 int (*set_power)(int state); 121 int (*set_power)(int state);
120 122
121 /* Turn device clock on or off */
122 int (*set_clock)(struct clk *clock, int is_on);
123
124 /* MUSB configuration-specific details */ 123 /* MUSB configuration-specific details */
125 struct musb_hdrc_config *config; 124 struct musb_hdrc_config *config;
126 125
127 /* Architecture specific board data */ 126 /* Architecture specific board data */
128 void *board_data; 127 void *board_data;
128
129 /* Platform specific struct musb_ops pointer */
130 const void *platform_ops;
129}; 131};
130 132
131 133
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 0a5b3711e502..6e40718f5abe 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -66,6 +66,7 @@ struct otg_transceiver {
66 66
67 u8 default_a; 67 u8 default_a;
68 enum usb_otg_state state; 68 enum usb_otg_state state;
69 enum usb_xceiv_events last_event;
69 70
70 struct usb_bus *host; 71 struct usb_bus *host;
71 struct usb_gadget *gadget; 72 struct usb_gadget *gadget;
@@ -74,7 +75,7 @@ struct otg_transceiver {
74 void __iomem *io_priv; 75 void __iomem *io_priv;
75 76
76 /* for notification of usb_xceiv_events */ 77 /* for notification of usb_xceiv_events */
77 struct blocking_notifier_head notifier; 78 struct atomic_notifier_head notifier;
78 79
79 /* to pass extra port status to the root hub */ 80 /* to pass extra port status to the root hub */
80 u16 port_status; 81 u16 port_status;
@@ -116,7 +117,7 @@ struct otg_transceiver {
116/* for board-specific init logic */ 117/* for board-specific init logic */
117extern int otg_set_transceiver(struct otg_transceiver *); 118extern int otg_set_transceiver(struct otg_transceiver *);
118 119
119#if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE) 120#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
120/* sometimes transceivers are accessed only through e.g. ULPI */ 121/* sometimes transceivers are accessed only through e.g. ULPI */
121extern void usb_nop_xceiv_register(void); 122extern void usb_nop_xceiv_register(void);
122extern void usb_nop_xceiv_unregister(void); 123extern void usb_nop_xceiv_unregister(void);
@@ -234,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg)
234static inline int 235static inline int
235otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 236otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
236{ 237{
237 return blocking_notifier_chain_register(&otg->notifier, nb); 238 return atomic_notifier_chain_register(&otg->notifier, nb);
238} 239}
239 240
240static inline void 241static inline void
241otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 242otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
242{ 243{
243 blocking_notifier_chain_unregister(&otg->notifier, nb); 244 atomic_notifier_chain_unregister(&otg->notifier, nb);
244} 245}
245 246
246/* for OTG controller drivers (and maybe other stuff) */ 247/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 05ef52861988..88fceb718c77 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -256,6 +256,8 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
256#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001 256#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001
257#define FLAG_RNDIS_PHYM_WIRELESS 0x0002 257#define FLAG_RNDIS_PHYM_WIRELESS 0x0002
258 258
259/* Flags for driver_info::data */
260#define RNDIS_DRIVER_DATA_POLL_STATUS 1 /* poll status before control */
259 261
260extern void rndis_status(struct usbnet *dev, struct urb *urb); 262extern void rndis_status(struct usbnet *dev, struct urb *urb);
261extern int 263extern int
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 16d682f4f7c3..b29f70b2ecae 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -191,7 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
191 * @id_table: pointer to a list of usb_device_id structures that define all 191 * @id_table: pointer to a list of usb_device_id structures that define all
192 * of the devices this structure can support. 192 * of the devices this structure can support.
193 * @num_ports: the number of different ports this device will have. 193 * @num_ports: the number of different ports this device will have.
194 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size) 194 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
195 * (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 196 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
196 * @calc_num_ports: pointer to a function to determine how many ports this 197 * @calc_num_ports: pointer to a function to determine how many ports this
197 * device has dynamically. It will be called after the probe() 198 * device has dynamically. It will be called after the probe()
@@ -260,7 +261,7 @@ struct usb_serial_driver {
260 const unsigned char *buf, int count); 261 const unsigned char *buf, int count);
261 /* Called only by the tty layer */ 262 /* Called only by the tty layer */
262 int (*write_room)(struct tty_struct *tty); 263 int (*write_room)(struct tty_struct *tty);
263 int (*ioctl)(struct tty_struct *tty, struct file *file, 264 int (*ioctl)(struct tty_struct *tty,
264 unsigned int cmd, unsigned long arg); 265 unsigned int cmd, unsigned long arg);
265 void (*set_termios)(struct tty_struct *tty, 266 void (*set_termios)(struct tty_struct *tty,
266 struct usb_serial_port *port, struct ktermios *old); 267 struct usb_serial_port *port, struct ktermios *old);
@@ -268,8 +269,8 @@ struct usb_serial_driver {
268 int (*chars_in_buffer)(struct tty_struct *tty); 269 int (*chars_in_buffer)(struct tty_struct *tty);
269 void (*throttle)(struct tty_struct *tty); 270 void (*throttle)(struct tty_struct *tty);
270 void (*unthrottle)(struct tty_struct *tty); 271 void (*unthrottle)(struct tty_struct *tty);
271 int (*tiocmget)(struct tty_struct *tty, struct file *file); 272 int (*tiocmget)(struct tty_struct *tty);
272 int (*tiocmset)(struct tty_struct *tty, struct file *file, 273 int (*tiocmset)(struct tty_struct *tty,
273 unsigned int set, unsigned int clear); 274 unsigned int set, unsigned int clear);
274 int (*get_icount)(struct tty_struct *tty, 275 int (*get_icount)(struct tty_struct *tty,
275 struct serial_icounter_struct *icount); 276 struct serial_icounter_struct *icount);
@@ -347,6 +348,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
347extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, 348extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
348 unsigned int ch); 349 unsigned int ch);
349extern int usb_serial_handle_break(struct usb_serial_port *port); 350extern int usb_serial_handle_break(struct usb_serial_port *port);
351extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
352 struct tty_struct *tty,
353 unsigned int status);
350 354
351 355
352extern int usb_serial_bus_register(struct usb_serial_driver *device); 356extern int usb_serial_bus_register(struct usb_serial_driver *device);
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 82b1507f4735..9595796d62ed 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -184,4 +184,9 @@
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops;
190#endif
191
187#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 7ae27a473818..605b0aa8d852 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -68,6 +68,7 @@ struct usbnet {
68# define EVENT_RX_PAUSED 5 68# define EVENT_RX_PAUSED 5
69# define EVENT_DEV_WAKING 6 69# define EVENT_DEV_WAKING 6
70# define EVENT_DEV_ASLEEP 7 70# define EVENT_DEV_ASLEEP 7
71# define EVENT_DEV_OPEN 8
71}; 72};
72 73
73static inline struct usb_driver *driver_of(struct usb_interface *intf) 74static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -97,6 +98,15 @@ struct driver_info {
97 98
98#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 99#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
99 100
101#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
102
103/*
104 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
105 * Affects statistic (counters) and short packet handling.
106 */
107#define FLAG_MULTI_PACKET 0x2000
108#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
109
100 /* init device ... can sleep, or cause probe() failure */ 110 /* init device ... can sleep, or cause probe() failure */
101 int (*bind)(struct usbnet *, struct usb_interface *); 111 int (*bind)(struct usbnet *, struct usb_interface *);
102 112
@@ -166,7 +176,9 @@ struct cdc_state {
166}; 176};
167 177
168extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); 178extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
179extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
169extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); 180extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
181extern void usbnet_cdc_status(struct usbnet *, struct urb *);
170 182
171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 183/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 184#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 63ebdcc5dda6..0c4d4ca370ec 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -126,7 +126,7 @@ enum {
126/** 126/**
127 * WUSB IE: Channel Stop (WUSB1.0[7.5.8]) 127 * WUSB IE: Channel Stop (WUSB1.0[7.5.8])
128 * 128 *
129 * Tells devices the host is going to stop sending MMCs and will dissapear. 129 * Tells devices the host is going to stop sending MMCs and will disappear.
130 */ 130 */
131struct wuie_channel_stop { 131struct wuie_channel_stop {
132 struct wuie_hdr hdr; 132 struct wuie_hdr hdr;
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 8178156711f9..faf467944baf 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -6,7 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/err.h> 7#include <linux/err.h>
8 8
9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8) 9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7)
10#define UIDHASH_SZ (1 << UIDHASH_BITS) 10#define UIDHASH_SZ (1 << UIDHASH_BITS)
11 11
12struct user_namespace { 12struct user_namespace {
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 69f39974c041..4e5b0213fdc1 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -37,9 +37,13 @@ struct new_utsname {
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39 39
40struct user_namespace;
41extern struct user_namespace init_user_ns;
42
40struct uts_namespace { 43struct uts_namespace {
41 struct kref kref; 44 struct kref kref;
42 struct new_utsname name; 45 struct new_utsname name;
46 struct user_namespace *user_ns;
43}; 47};
44extern struct uts_namespace init_uts_ns; 48extern struct uts_namespace init_uts_ns;
45 49
@@ -50,7 +54,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
50} 54}
51 55
52extern struct uts_namespace *copy_utsname(unsigned long flags, 56extern struct uts_namespace *copy_utsname(unsigned long flags,
53 struct uts_namespace *ns); 57 struct task_struct *tsk);
54extern void free_uts_ns(struct kref *kref); 58extern void free_uts_ns(struct kref *kref);
55 59
56static inline void put_uts_ns(struct uts_namespace *ns) 60static inline void put_uts_ns(struct uts_namespace *ns)
@@ -67,12 +71,12 @@ static inline void put_uts_ns(struct uts_namespace *ns)
67} 71}
68 72
69static inline struct uts_namespace *copy_utsname(unsigned long flags, 73static inline struct uts_namespace *copy_utsname(unsigned long flags,
70 struct uts_namespace *ns) 74 struct task_struct *tsk)
71{ 75{
72 if (flags & CLONE_NEWUTS) 76 if (flags & CLONE_NEWUTS)
73 return ERR_PTR(-EINVAL); 77 return ERR_PTR(-EINVAL);
74 78
75 return ns; 79 return tsk->nsproxy->uts_ns;
76} 80}
77#endif 81#endif
78 82
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
index 7fc9746f22cd..b0c564ec2160 100644
--- a/include/linux/uwb.h
+++ b/include/linux/uwb.h
@@ -274,7 +274,7 @@ static inline void uwb_mas_bm_copy_le(void *dst, const struct uwb_mas_bm *mas)
274 274
275/** 275/**
276 * struct uwb_drp_avail - a radio controller's view of MAS usage 276 * struct uwb_drp_avail - a radio controller's view of MAS usage
277 * @global: MAS unused by neighbors (excluding reservations targetted 277 * @global: MAS unused by neighbors (excluding reservations targeted
278 * or owned by the local radio controller) or the beaon period 278 * or owned by the local radio controller) or the beaon period
279 * @local: MAS unused by local established reservations 279 * @local: MAS unused by local established reservations
280 * @pending: MAS unused by local pending reservations 280 * @pending: MAS unused by local pending reservations
@@ -702,10 +702,10 @@ void edc_init(struct edc *edc)
702 edc->timestart = jiffies; 702 edc->timestart = jiffies;
703} 703}
704 704
705/* Called when an error occured. 705/* Called when an error occurred.
706 * This is way to determine if the number of acceptable errors per time 706 * This is way to determine if the number of acceptable errors per time
707 * period has been exceeded. It is not accurate as there are cases in which 707 * period has been exceeded. It is not accurate as there are cases in which
708 * this scheme will not work, for example if there are periodic occurences 708 * this scheme will not work, for example if there are periodic occurrences
709 * of errors that straddle updates to the start time. This scheme is 709 * of errors that straddle updates to the start time. This scheme is
710 * sufficient for our usage. 710 * sufficient for our usage.
711 * 711 *
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index 4b4fc0f43855..7b4842028ca7 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -132,7 +132,7 @@ int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc);
132 * 132 *
133 * FIXME: This is as dirty as it gets, but we need some way to check 133 * FIXME: This is as dirty as it gets, but we need some way to check
134 * the correct type of umc_dev->parent (so that for example, we can 134 * the correct type of umc_dev->parent (so that for example, we can
135 * cast to pci_dev). Casting to pci_dev is necesary because at some 135 * cast to pci_dev). Casting to pci_dev is necessary because at some
136 * point we need to request resources from the device. Mapping is 136 * point we need to request resources from the device. Mapping is
137 * easily over come (ioremap and stuff are bus agnostic), but hooking 137 * easily over come (ioremap and stuff are bus agnostic), but hooking
138 * up to some error handlers (such as pci error handlers) might need 138 * up to some error handlers (such as pci error handlers) might need
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
new file mode 100644
index 000000000000..de5c15921025
--- /dev/null
+++ b/include/linux/v4l2-mediabus.h
@@ -0,0 +1,111 @@
1/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_V4L2_MEDIABUS_H
12#define __LINUX_V4L2_MEDIABUS_H
13
14#include <linux/types.h>
15#include <linux/videodev2.h>
16
17/*
18 * These pixel codes uniquely identify data formats on the media bus. Mostly
19 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
20 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
21 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
22 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
23 * transferred over the bus: "LE" means that the least significant bits are
24 * transferred first, "BE" means that the most significant bits are transferred
25 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
26 * incomplete high byte, are filled with padding bits.
27 *
28 * The pixel codes are grouped by type, bus_width, bits per component, samples
29 * per pixel and order of subsamples. Numerical values are sorted using generic
30 * numerical sort order (8 thus comes before 10).
31 *
32 * As their value can't change when a new pixel code is inserted in the
33 * enumeration, the pixel codes are explicitly given a numerical value. The next
34 * free values for each category are listed below, update them when inserting
35 * new pixel codes.
36 */
37enum v4l2_mbus_pixelcode {
38 V4L2_MBUS_FMT_FIXED = 0x0001,
39
40 /* RGB - next is 0x1009 */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
45 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49
50 /* YUV (including grey) - next is 0x2014 */
51 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
52 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
53 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
54 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
55 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
56 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
57 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
58 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
59 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
60 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
61 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
62 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
63 V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
64 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
65 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
66 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
67 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
68 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
69 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
70
71 /* Bayer - next is 0x3015 */
72 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
73 V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
74 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
75 V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
76 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
77 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
78 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
79 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
80 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
81 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
82 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
83 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
84 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
85 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
86 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
87 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
88 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
89 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
90 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
91 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
92};
93
94/**
95 * struct v4l2_mbus_framefmt - frame format on the media bus
96 * @width: frame width
97 * @height: frame height
98 * @code: data format code (from enum v4l2_mbus_pixelcode)
99 * @field: used interlacing type (from enum v4l2_field)
100 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
101 */
102struct v4l2_mbus_framefmt {
103 __u32 width;
104 __u32 height;
105 __u32 code;
106 __u32 field;
107 __u32 colorspace;
108 __u32 reserved[7];
109};
110
111#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
new file mode 100644
index 000000000000..ed29cbbebfef
--- /dev/null
+++ b/include/linux/v4l2-subdev.h
@@ -0,0 +1,141 @@
1/*
2 * V4L2 subdev userspace API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_V4L2_SUBDEV_H
24#define __LINUX_V4L2_SUBDEV_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/v4l2-mediabus.h>
29
30/**
31 * enum v4l2_subdev_format_whence - Media bus format type
32 * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
33 * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
34 */
35enum v4l2_subdev_format_whence {
36 V4L2_SUBDEV_FORMAT_TRY = 0,
37 V4L2_SUBDEV_FORMAT_ACTIVE = 1,
38};
39
40/**
41 * struct v4l2_subdev_format - Pad-level media bus format
42 * @which: format type (from enum v4l2_subdev_format_whence)
43 * @pad: pad number, as reported by the media API
44 * @format: media bus format (format code and frame size)
45 */
46struct v4l2_subdev_format {
47 __u32 which;
48 __u32 pad;
49 struct v4l2_mbus_framefmt format;
50 __u32 reserved[8];
51};
52
53/**
54 * struct v4l2_subdev_crop - Pad-level crop settings
55 * @which: format type (from enum v4l2_subdev_format_whence)
56 * @pad: pad number, as reported by the media API
57 * @rect: pad crop rectangle boundaries
58 */
59struct v4l2_subdev_crop {
60 __u32 which;
61 __u32 pad;
62 struct v4l2_rect rect;
63 __u32 reserved[8];
64};
65
66/**
67 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
68 * @pad: pad number, as reported by the media API
69 * @index: format index during enumeration
70 * @code: format code (from enum v4l2_mbus_pixelcode)
71 */
72struct v4l2_subdev_mbus_code_enum {
73 __u32 pad;
74 __u32 index;
75 __u32 code;
76 __u32 reserved[9];
77};
78
79/**
80 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
81 * @pad: pad number, as reported by the media API
82 * @index: format index during enumeration
83 * @code: format code (from enum v4l2_mbus_pixelcode)
84 */
85struct v4l2_subdev_frame_size_enum {
86 __u32 index;
87 __u32 pad;
88 __u32 code;
89 __u32 min_width;
90 __u32 max_width;
91 __u32 min_height;
92 __u32 max_height;
93 __u32 reserved[9];
94};
95
96/**
97 * struct v4l2_subdev_frame_interval - Pad-level frame rate
98 * @pad: pad number, as reported by the media API
99 * @interval: frame interval in seconds
100 */
101struct v4l2_subdev_frame_interval {
102 __u32 pad;
103 struct v4l2_fract interval;
104 __u32 reserved[9];
105};
106
107/**
108 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
109 * @pad: pad number, as reported by the media API
110 * @index: frame interval index during enumeration
111 * @code: format code (from enum v4l2_mbus_pixelcode)
112 * @width: frame width in pixels
113 * @height: frame height in pixels
114 * @interval: frame interval in seconds
115 */
116struct v4l2_subdev_frame_interval_enum {
117 __u32 index;
118 __u32 pad;
119 __u32 code;
120 __u32 width;
121 __u32 height;
122 struct v4l2_fract interval;
123 __u32 reserved[9];
124};
125
126#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
127#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
129 _IOWR('V', 21, struct v4l2_subdev_frame_interval)
130#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
131 _IOWR('V', 22, struct v4l2_subdev_frame_interval)
132#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
133 _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
134#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
135 _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
136#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
137 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
138#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
139#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
140
141#endif
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index ae9ab13b963d..4b9a7f596f92 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -33,6 +33,7 @@ struct vga_switcheroo_handler {
33void vga_switcheroo_unregister_client(struct pci_dev *dev); 33void vga_switcheroo_unregister_client(struct pci_dev *dev);
34int vga_switcheroo_register_client(struct pci_dev *dev, 34int vga_switcheroo_register_client(struct pci_dev *dev,
35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
36 void (*reprobe)(struct pci_dev *dev),
36 bool (*can_switch)(struct pci_dev *dev)); 37 bool (*can_switch)(struct pci_dev *dev));
37 38
38void vga_switcheroo_client_fb_set(struct pci_dev *dev, 39void vga_switcheroo_client_fb_set(struct pci_dev *dev,
@@ -48,6 +49,7 @@ int vga_switcheroo_process_delayed_switch(void);
48static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 49static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
49static inline int vga_switcheroo_register_client(struct pci_dev *dev, 50static inline int vga_switcheroo_register_client(struct pci_dev *dev,
50 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 51 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
52 void (*reprobe)(struct pci_dev *dev),
51 bool (*can_switch)(struct pci_dev *dev)) { return 0; } 53 bool (*can_switch)(struct pci_dev *dev)) { return 0; }
52static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 54static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
53static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 55static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index e9e1524b582c..9c3120dca294 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -78,7 +78,7 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev,
78 * wether the card is doing legacy decoding for that type of resource. If 78 * wether the card is doing legacy decoding for that type of resource. If
79 * yes, the lock is "converted" into a legacy resource lock. 79 * yes, the lock is "converted" into a legacy resource lock.
80 * The arbiter will first look for all VGA cards that might conflict 80 * The arbiter will first look for all VGA cards that might conflict
81 * and disable their IOs and/or Memory access, inlcuding VGA forwarding 81 * and disable their IOs and/or Memory access, including VGA forwarding
82 * on P2P bridges if necessary, so that the requested resources can 82 * on P2P bridges if necessary, so that the requested resources can
83 * be used. Then, the card is marked as locking these resources and 83 * be used. Then, the card is marked as locking these resources and
84 * the IO and/or Memory accesse are enabled on the card (including 84 * the IO and/or Memory accesse are enabled on the card (including
@@ -187,7 +187,7 @@ extern struct pci_dev *vga_default_device(void);
187 * vga_conflicts 187 * vga_conflicts
188 * 188 *
189 * Architectures should define this if they have several 189 * Architectures should define this if they have several
190 * independant PCI domains that can afford concurrent VGA 190 * independent PCI domains that can afford concurrent VGA
191 * decoding 191 * decoding
192 */ 192 */
193 193
diff --git a/include/linux/via-core.h b/include/linux/via-core.h
index 7ffb521e1a7a..9c21cdf3e3b3 100644
--- a/include/linux/via-core.h
+++ b/include/linux/via-core.h
@@ -60,6 +60,21 @@ struct via_port_cfg {
60}; 60};
61 61
62/* 62/*
63 * Allow subdevs to register suspend/resume hooks.
64 */
65#ifdef CONFIG_PM
66struct viafb_pm_hooks {
67 struct list_head list;
68 int (*suspend)(void *private);
69 int (*resume)(void *private);
70 void *private;
71};
72
73void viafb_pm_register(struct viafb_pm_hooks *hooks);
74void viafb_pm_unregister(struct viafb_pm_hooks *hooks);
75#endif /* CONFIG_PM */
76
77/*
63 * This is the global viafb "device" containing stuff needed by 78 * This is the global viafb "device" containing stuff needed by
64 * all subdevs. 79 * all subdevs.
65 */ 80 */
@@ -81,7 +96,7 @@ struct viafb_dev {
81 unsigned long fbmem_start; 96 unsigned long fbmem_start;
82 long fbmem_len; 97 long fbmem_len;
83 void __iomem *fbmem; 98 void __iomem *fbmem;
84#if defined(CONFIG_FB_VIA_CAMERA) || defined(CONFIG_FB_VIA_CAMERA_MODULE) 99#if defined(CONFIG_VIDEO_VIA_CAMERA) || defined(CONFIG_VIDEO_VIA_CAMERA_MODULE)
85 long camera_fbmem_offset; 100 long camera_fbmem_offset;
86 long camera_fbmem_size; 101 long camera_fbmem_size;
87#endif 102#endif
@@ -138,6 +153,7 @@ void viafb_irq_disable(u32 mask);
138#define VDE_I_LVDSSIEN 0x40000000 /* LVDS Sense enable */ 153#define VDE_I_LVDSSIEN 0x40000000 /* LVDS Sense enable */
139#define VDE_I_ENABLE 0x80000000 /* Global interrupt enable */ 154#define VDE_I_ENABLE 0x80000000 /* Global interrupt enable */
140 155
156#if defined(CONFIG_VIDEO_VIA_CAMERA) || defined(CONFIG_VIDEO_VIA_CAMERA_MODULE)
141/* 157/*
142 * DMA management. 158 * DMA management.
143 */ 159 */
@@ -172,6 +188,7 @@ int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
172 */ 188 */
173#define VGA_WIDTH 640 189#define VGA_WIDTH 640
174#define VGA_HEIGHT 480 190#define VGA_HEIGHT 480
191#endif /* CONFIG_VIDEO_VIA_CAMERA */
175 192
176/* 193/*
177 * Indexed port operations. Note that these are all multi-op 194 * Indexed port operations. Note that these are all multi-op
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
index 2fb46bc9340d..ed5cdeb3604d 100644
--- a/include/linux/video_output.h
+++ b/include/linux/video_output.h
@@ -23,6 +23,7 @@
23#ifndef _LINUX_VIDEO_OUTPUT_H 23#ifndef _LINUX_VIDEO_OUTPUT_H
24#define _LINUX_VIDEO_OUTPUT_H 24#define _LINUX_VIDEO_OUTPUT_H
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/err.h>
26struct output_device; 27struct output_device;
27struct output_properties { 28struct output_properties {
28 int (*set_state)(struct output_device *); 29 int (*set_state)(struct output_device *);
@@ -34,9 +35,23 @@ struct output_device {
34 struct device dev; 35 struct device dev;
35}; 36};
36#define to_output_device(obj) container_of(obj, struct output_device, dev) 37#define to_output_device(obj) container_of(obj, struct output_device, dev)
38#if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE)
37struct output_device *video_output_register(const char *name, 39struct output_device *video_output_register(const char *name,
38 struct device *dev, 40 struct device *dev,
39 void *devdata, 41 void *devdata,
40 struct output_properties *op); 42 struct output_properties *op);
41void video_output_unregister(struct output_device *dev); 43void video_output_unregister(struct output_device *dev);
44#else
45static struct output_device *video_output_register(const char *name,
46 struct device *dev,
47 void *devdata,
48 struct output_properties *op)
49{
50 return ERR_PTR(-ENODEV);
51}
52static void video_output_unregister(struct output_device *dev)
53{
54 return;
55}
56#endif
42#endif 57#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
deleted file mode 100644
index b19eab140977..000000000000
--- a/include/linux/videodev.h
+++ /dev/null
@@ -1,340 +0,0 @@
1/*
2 * Video for Linux version 1 - OBSOLETE
3 *
4 * Header file for v4l1 drivers and applications, for
5 * Linux kernels 2.2.x or 2.4.x.
6 *
7 * Provides header for legacy drivers and applications
8 *
9 * See http://linuxtv.org for more info
10 *
11 */
12#ifndef __LINUX_VIDEODEV_H
13#define __LINUX_VIDEODEV_H
14
15#include <linux/types.h>
16#include <linux/ioctl.h>
17#include <linux/videodev2.h>
18
19#if defined(__MIN_V4L1) && defined (__KERNEL__)
20
21/*
22 * Used by those V4L2 core functions that need a minimum V4L1 support,
23 * in order to allow V4L1 Compatibilty code compilation.
24 */
25
26struct video_mbuf
27{
28 int size; /* Total memory to map */
29 int frames; /* Frames */
30 int offsets[VIDEO_MAX_FRAME];
31};
32
33#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
34
35#else
36#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
37
38#define VID_TYPE_CAPTURE 1 /* Can capture */
39#define VID_TYPE_TUNER 2 /* Can tune */
40#define VID_TYPE_TELETEXT 4 /* Does teletext */
41#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
42#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
43#define VID_TYPE_CLIPPING 32 /* Can clip */
44#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
45#define VID_TYPE_SCALES 128 /* Scalable */
46#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
47#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
48#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
49#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
50#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
51#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
52
53struct video_capability
54{
55 char name[32];
56 int type;
57 int channels; /* Num channels */
58 int audios; /* Num audio devices */
59 int maxwidth; /* Supported width */
60 int maxheight; /* And height */
61 int minwidth; /* Supported width */
62 int minheight; /* And height */
63};
64
65
66struct video_channel
67{
68 int channel;
69 char name[32];
70 int tuners;
71 __u32 flags;
72#define VIDEO_VC_TUNER 1 /* Channel has a tuner */
73#define VIDEO_VC_AUDIO 2 /* Channel has audio */
74 __u16 type;
75#define VIDEO_TYPE_TV 1
76#define VIDEO_TYPE_CAMERA 2
77 __u16 norm; /* Norm set by channel */
78};
79
80struct video_tuner
81{
82 int tuner;
83 char name[32];
84 unsigned long rangelow, rangehigh; /* Tuner range */
85 __u32 flags;
86#define VIDEO_TUNER_PAL 1
87#define VIDEO_TUNER_NTSC 2
88#define VIDEO_TUNER_SECAM 4
89#define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */
90#define VIDEO_TUNER_NORM 16 /* Tuner can set norm */
91#define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */
92#define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */
93#define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */
94 __u16 mode; /* PAL/NTSC/SECAM/OTHER */
95#define VIDEO_MODE_PAL 0
96#define VIDEO_MODE_NTSC 1
97#define VIDEO_MODE_SECAM 2
98#define VIDEO_MODE_AUTO 3
99 __u16 signal; /* Signal strength 16bit scale */
100};
101
102struct video_picture
103{
104 __u16 brightness;
105 __u16 hue;
106 __u16 colour;
107 __u16 contrast;
108 __u16 whiteness; /* Black and white only */
109 __u16 depth; /* Capture depth */
110 __u16 palette; /* Palette in use */
111#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */
112#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */
113#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */
114#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */
115#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */
116#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */
117#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */
118#define VIDEO_PALETTE_YUYV 8
119#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */
120#define VIDEO_PALETTE_YUV420 10
121#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */
122#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */
123#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */
124#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */
125#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */
126#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */
127#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */
128#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */
129};
130
131struct video_audio
132{
133 int audio; /* Audio channel */
134 __u16 volume; /* If settable */
135 __u16 bass, treble;
136 __u32 flags;
137#define VIDEO_AUDIO_MUTE 1
138#define VIDEO_AUDIO_MUTABLE 2
139#define VIDEO_AUDIO_VOLUME 4
140#define VIDEO_AUDIO_BASS 8
141#define VIDEO_AUDIO_TREBLE 16
142#define VIDEO_AUDIO_BALANCE 32
143 char name[16];
144#define VIDEO_SOUND_MONO 1
145#define VIDEO_SOUND_STEREO 2
146#define VIDEO_SOUND_LANG1 4
147#define VIDEO_SOUND_LANG2 8
148 __u16 mode;
149 __u16 balance; /* Stereo balance */
150 __u16 step; /* Step actual volume uses */
151};
152
153struct video_clip
154{
155 __s32 x,y;
156 __s32 width, height;
157 struct video_clip *next; /* For user use/driver use only */
158};
159
160struct video_window
161{
162 __u32 x,y; /* Position of window */
163 __u32 width,height; /* Its size */
164 __u32 chromakey;
165 __u32 flags;
166 struct video_clip __user *clips; /* Set only */
167 int clipcount;
168#define VIDEO_WINDOW_INTERLACE 1
169#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
170#define VIDEO_CLIP_BITMAP -1
171/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
172#define VIDEO_CLIPMAP_SIZE (128 * 625)
173};
174
175struct video_capture
176{
177 __u32 x,y; /* Offsets into image */
178 __u32 width, height; /* Area to capture */
179 __u16 decimation; /* Decimation divider */
180 __u16 flags; /* Flags for capture */
181#define VIDEO_CAPTURE_ODD 0 /* Temporal */
182#define VIDEO_CAPTURE_EVEN 1
183};
184
185struct video_buffer
186{
187 void *base;
188 int height,width;
189 int depth;
190 int bytesperline;
191};
192
193struct video_mmap
194{
195 unsigned int frame; /* Frame (0 - n) for double buffer */
196 int height,width;
197 unsigned int format; /* should be VIDEO_PALETTE_* */
198};
199
200struct video_key
201{
202 __u8 key[8];
203 __u32 flags;
204};
205
206struct video_mbuf
207{
208 int size; /* Total memory to map */
209 int frames; /* Frames */
210 int offsets[VIDEO_MAX_FRAME];
211};
212
213#define VIDEO_NO_UNIT (-1)
214
215struct video_unit
216{
217 int video; /* Video minor */
218 int vbi; /* VBI minor */
219 int radio; /* Radio minor */
220 int audio; /* Audio minor */
221 int teletext; /* Teletext minor */
222};
223
224struct vbi_format {
225 __u32 sampling_rate; /* in Hz */
226 __u32 samples_per_line;
227 __u32 sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */
228 __s32 start[2]; /* starting line for each frame */
229 __u32 count[2]; /* count of lines for each frame */
230 __u32 flags;
231#define VBI_UNSYNC 1 /* can distingues between top/bottom field */
232#define VBI_INTERLACED 2 /* lines are interlaced */
233};
234
235/* video_info is biased towards hardware mpeg encode/decode */
236/* but it could apply generically to any hardware compressor/decompressor */
237struct video_info
238{
239 __u32 frame_count; /* frames output since decode/encode began */
240 __u32 h_size; /* current unscaled horizontal size */
241 __u32 v_size; /* current unscaled veritcal size */
242 __u32 smpte_timecode; /* current SMPTE timecode (for current GOP) */
243 __u32 picture_type; /* current picture type */
244 __u32 temporal_reference; /* current temporal reference */
245 __u8 user_data[256]; /* user data last found in compressed stream */
246 /* user_data[0] contains user data flags, user_data[1] has count */
247};
248
249/* generic structure for setting playback modes */
250struct video_play_mode
251{
252 int mode;
253 int p1;
254 int p2;
255};
256
257/* for loading microcode / fpga programming */
258struct video_code
259{
260 char loadwhat[16]; /* name or tag of file being passed */
261 int datasize;
262 __u8 *data;
263};
264
265#define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */
266#define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */
267#define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */
268#define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */
269#define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */
270#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
271#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
272#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
273#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
274#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
275#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
276#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */
277#define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
278#define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */
279#define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */
280#define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */
281#define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */
282#define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */
283#define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */
284#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
285#define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */
286#define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */
287#define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */
288#define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */
289#define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */
290#define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */
291#define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */
292#define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */
293#define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */
294
295
296#define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */
297
298/* VIDIOCSWRITEMODE */
299#define VID_WRITE_MPEG_AUD 0
300#define VID_WRITE_MPEG_VID 1
301#define VID_WRITE_OSD 2
302#define VID_WRITE_TTX 3
303#define VID_WRITE_CC 4
304#define VID_WRITE_MJPEG 5
305
306/* VIDIOCSPLAYMODE */
307#define VID_PLAY_VID_OUT_MODE 0
308 /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
309#define VID_PLAY_GENLOCK 1
310 /* p1: 0 = OFF, 1 = ON */
311 /* p2: GENLOCK FINE DELAY value */
312#define VID_PLAY_NORMAL 2
313#define VID_PLAY_PAUSE 3
314#define VID_PLAY_SINGLE_FRAME 4
315#define VID_PLAY_FAST_FORWARD 5
316#define VID_PLAY_SLOW_MOTION 6
317#define VID_PLAY_IMMEDIATE_NORMAL 7
318#define VID_PLAY_SWITCH_CHANNELS 8
319#define VID_PLAY_FREEZE_FRAME 9
320#define VID_PLAY_STILL_MODE 10
321#define VID_PLAY_MASTER_MODE 11
322 /* p1: see below */
323#define VID_PLAY_MASTER_NONE 1
324#define VID_PLAY_MASTER_VIDEO 2
325#define VID_PLAY_MASTER_AUDIO 3
326#define VID_PLAY_ACTIVE_SCANLINES 12
327 /* p1 = first active; p2 = last active */
328#define VID_PLAY_RESET 13
329#define VID_PLAY_END_MARK 14
330
331#endif /* CONFIG_VIDEO_V4L1_COMPAT */
332#endif /* __MIN_V4L1 */
333
334#endif /* __LINUX_VIDEODEV_H */
335
336/*
337 * Local variables:
338 * c-basic-offset: 8
339 * End:
340 */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 61490c6dcdbd..be82c8ead1af 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -70,6 +70,7 @@
70 * Moved from videodev.h 70 * Moved from videodev.h
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73#define VIDEO_MAX_PLANES 8
73 74
74#ifndef __KERNEL__ 75#ifndef __KERNEL__
75 76
@@ -157,9 +158,23 @@ enum v4l2_buf_type {
157 /* Experimental */ 158 /* Experimental */
158 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, 159 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
159#endif 160#endif
161 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
162 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 163 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 164};
162 165
166#define V4L2_TYPE_IS_MULTIPLANAR(type) \
167 ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
168 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
169
170#define V4L2_TYPE_IS_OUTPUT(type) \
171 ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
172 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
173 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
174 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
175 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
176 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
177
163enum v4l2_tuner_type { 178enum v4l2_tuner_type {
164 V4L2_TUNER_RADIO = 1, 179 V4L2_TUNER_RADIO = 1,
165 V4L2_TUNER_ANALOG_TV = 2, 180 V4L2_TUNER_ANALOG_TV = 2,
@@ -245,6 +260,11 @@ struct v4l2_capability {
245#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ 260#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
246#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ 261#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
247 262
263/* Is a video capture device that supports multiplanar formats */
264#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
265/* Is a video output device that supports multiplanar formats */
266#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
267
248#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 268#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
249#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 269#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
250#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 270#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
@@ -288,6 +308,7 @@ struct v4l2_pix_format {
288#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ 308#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
289#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ 309#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
290#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ 310#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
311#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */
291#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 312#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
292 313
293/* Palette formats */ 314/* Palette formats */
@@ -319,6 +340,13 @@ struct v4l2_pix_format {
319#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 340#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
320#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 341#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
321 342
343/* two non contiguous planes - one Y, one Cr + Cb interleaved */
344#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
345#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
346
347/* three non contiguous planes - Y, Cb, Cr */
348#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
349
322/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 350/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
323#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 351#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
324#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 352#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
@@ -328,6 +356,10 @@ struct v4l2_pix_format {
328#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ 356#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
329#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ 357#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
330#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ 358#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
359#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
360#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
361#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
362#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
331 /* 10bit raw bayer DPCM compressed to 8 bits */ 363 /* 10bit raw bayer DPCM compressed to 8 bits */
332#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 364#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
333 /* 365 /*
@@ -363,6 +395,9 @@ struct v4l2_pix_format {
363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 395#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
364#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ 396#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
365#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ 397#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
398#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
399#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
400#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
366 401
367/* 402/*
368 * F O R M A T E N U M E R A T I O N 403 * F O R M A T E N U M E R A T I O N
@@ -515,6 +550,62 @@ struct v4l2_requestbuffers {
515 __u32 reserved[2]; 550 __u32 reserved[2];
516}; 551};
517 552
553/**
554 * struct v4l2_plane - plane info for multi-planar buffers
555 * @bytesused: number of bytes occupied by data in the plane (payload)
556 * @length: size of this plane (NOT the payload) in bytes
557 * @mem_offset: when memory in the associated struct v4l2_buffer is
558 * V4L2_MEMORY_MMAP, equals the offset from the start of
559 * the device memory for this plane (or is a "cookie" that
560 * should be passed to mmap() called on the video node)
561 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
562 * pointing to this plane
563 * @data_offset: offset in the plane to the start of data; usually 0,
564 * unless there is a header in front of the data
565 *
566 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
567 * with two planes can have one plane for Y, and another for interleaved CbCr
568 * components. Each plane can reside in a separate memory buffer, or even in
569 * a completely separate memory node (e.g. in embedded devices).
570 */
571struct v4l2_plane {
572 __u32 bytesused;
573 __u32 length;
574 union {
575 __u32 mem_offset;
576 unsigned long userptr;
577 } m;
578 __u32 data_offset;
579 __u32 reserved[11];
580};
581
582/**
583 * struct v4l2_buffer - video buffer info
584 * @index: id number of the buffer
585 * @type: buffer type (type == *_MPLANE for multiplanar buffers)
586 * @bytesused: number of bytes occupied by data in the buffer (payload);
587 * unused (set to 0) for multiplanar buffers
588 * @flags: buffer informational flags
589 * @field: field order of the image in the buffer
590 * @timestamp: frame timestamp
591 * @timecode: frame timecode
592 * @sequence: sequence count of this frame
593 * @memory: the method, in which the actual video data is passed
594 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
595 * offset from the start of the device memory for this plane,
596 * (or a "cookie" that should be passed to mmap() as offset)
597 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
598 * a userspace pointer pointing to this buffer
599 * @planes: for multiplanar buffers; userspace pointer to the array of plane
600 * info structs for this buffer
601 * @length: size in bytes of the buffer (NOT its payload) for single-plane
602 * buffers (when type != *_MPLANE); number of elements in the
603 * planes array for multi-plane buffers
604 * @input: input number from which the video data has has been captured
605 *
606 * Contains data exchanged by application and driver using one of the Streaming
607 * I/O methods.
608 */
518struct v4l2_buffer { 609struct v4l2_buffer {
519 __u32 index; 610 __u32 index;
520 enum v4l2_buf_type type; 611 enum v4l2_buf_type type;
@@ -530,6 +621,7 @@ struct v4l2_buffer {
530 union { 621 union {
531 __u32 offset; 622 __u32 offset;
532 unsigned long userptr; 623 unsigned long userptr;
624 struct v4l2_plane *planes;
533 } m; 625 } m;
534 __u32 length; 626 __u32 length;
535 __u32 input; 627 __u32 input;
@@ -1045,8 +1137,11 @@ enum v4l2_colorfx {
1045 1137
1046#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) 1138#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1047 1139
1140#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
1141#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
1142
1048/* last CID + 1 */ 1143/* last CID + 1 */
1049#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37) 1144#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39)
1050 1145
1051/* MPEG-class control IDs defined by V4L2 */ 1146/* MPEG-class control IDs defined by V4L2 */
1052#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1147#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1363,6 +1458,8 @@ struct v4l2_modulator {
1363#define V4L2_TUNER_CAP_SAP 0x0020 1458#define V4L2_TUNER_CAP_SAP 0x0020
1364#define V4L2_TUNER_CAP_LANG1 0x0040 1459#define V4L2_TUNER_CAP_LANG1 0x0040
1365#define V4L2_TUNER_CAP_RDS 0x0080 1460#define V4L2_TUNER_CAP_RDS 0x0080
1461#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
1462#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
1366 1463
1367/* Flags for the 'rxsubchans' field */ 1464/* Flags for the 'rxsubchans' field */
1368#define V4L2_TUNER_SUB_MONO 0x0001 1465#define V4L2_TUNER_SUB_MONO 0x0001
@@ -1392,7 +1489,8 @@ struct v4l2_hw_freq_seek {
1392 enum v4l2_tuner_type type; 1489 enum v4l2_tuner_type type;
1393 __u32 seek_upward; 1490 __u32 seek_upward;
1394 __u32 wrap_around; 1491 __u32 wrap_around;
1395 __u32 reserved[8]; 1492 __u32 spacing;
1493 __u32 reserved[7];
1396}; 1494};
1397 1495
1398/* 1496/*
@@ -1614,12 +1712,56 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
1614 * A G G R E G A T E S T R U C T U R E S 1712 * A G G R E G A T E S T R U C T U R E S
1615 */ 1713 */
1616 1714
1617/* Stream data format 1715/**
1716 * struct v4l2_plane_pix_format - additional, per-plane format definition
1717 * @sizeimage: maximum size in bytes required for data, for which
1718 * this plane will be used
1719 * @bytesperline: distance in bytes between the leftmost pixels in two
1720 * adjacent lines
1721 */
1722struct v4l2_plane_pix_format {
1723 __u32 sizeimage;
1724 __u16 bytesperline;
1725 __u16 reserved[7];
1726} __attribute__ ((packed));
1727
1728/**
1729 * struct v4l2_pix_format_mplane - multiplanar format definition
1730 * @width: image width in pixels
1731 * @height: image height in pixels
1732 * @pixelformat: little endian four character code (fourcc)
1733 * @field: field order (for interlaced video)
1734 * @colorspace: supplemental to pixelformat
1735 * @plane_fmt: per-plane information
1736 * @num_planes: number of planes for this format
1737 */
1738struct v4l2_pix_format_mplane {
1739 __u32 width;
1740 __u32 height;
1741 __u32 pixelformat;
1742 enum v4l2_field field;
1743 enum v4l2_colorspace colorspace;
1744
1745 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1746 __u8 num_planes;
1747 __u8 reserved[11];
1748} __attribute__ ((packed));
1749
1750/**
1751 * struct v4l2_format - stream data format
1752 * @type: type of the data stream
1753 * @pix: definition of an image format
1754 * @pix_mp: definition of a multiplanar image format
1755 * @win: definition of an overlaid image
1756 * @vbi: raw VBI capture or output parameters
1757 * @sliced: sliced VBI capture or output parameters
1758 * @raw_data: placeholder for future extensions and custom formats
1618 */ 1759 */
1619struct v4l2_format { 1760struct v4l2_format {
1620 enum v4l2_buf_type type; 1761 enum v4l2_buf_type type;
1621 union { 1762 union {
1622 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 1763 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1764 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
1623 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ 1765 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1624 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ 1766 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1625 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ 1767 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
@@ -1627,7 +1769,6 @@ struct v4l2_format {
1627 } fmt; 1769 } fmt;
1628}; 1770};
1629 1771
1630
1631/* Stream type-dependent parameters 1772/* Stream type-dependent parameters
1632 */ 1773 */
1633struct v4l2_streamparm { 1774struct v4l2_streamparm {
@@ -1800,16 +1941,6 @@ struct v4l2_dbg_chip_ident {
1800/* Reminder: when adding new ioctls please add support for them to 1941/* Reminder: when adding new ioctls please add support for them to
1801 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1942 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1802 1943
1803#ifdef __OLD_VIDIOC_
1804/* for compatibility, will go away some day */
1805#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1806#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1807#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1808#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1809#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1810#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1811#endif
1812
1813#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1944#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1814 1945
1815#endif /* __LINUX_VIDEODEV2_H */ 1946#endif /* __LINUX_VIDEODEV2_H */
diff --git a/include/linux/videotext.h b/include/linux/videotext.h
deleted file mode 100644
index 3e68c8d1c7f7..000000000000
--- a/include/linux/videotext.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef _VTX_H
2#define _VTX_H
3
4/*
5 * Teletext (=Videotext) hardware decoders using interface /dev/vtx
6 * Do not confuse with drivers using /dev/vbi which decode videotext by software
7 *
8 * Videotext IOCTLs changed in order to use _IO() macros defined in <linux/ioctl.h>,
9 * unused tuner IOCTLs cleaned up by
10 * Michael Geng <linux@MichaelGeng.de>
11 *
12 * Copyright (c) 1994-97 Martin Buck <martin-2.buck@student.uni-ulm.de>
13 * Read COPYING for more information
14 *
15 */
16
17
18/*
19 * Videotext ioctls
20 */
21#define VTXIOCGETINFO _IOR (0x81, 1, vtx_info_t)
22#define VTXIOCCLRPAGE _IOW (0x81, 2, vtx_pagereq_t)
23#define VTXIOCCLRFOUND _IOW (0x81, 3, vtx_pagereq_t)
24#define VTXIOCPAGEREQ _IOW (0x81, 4, vtx_pagereq_t)
25#define VTXIOCGETSTAT _IOW (0x81, 5, vtx_pagereq_t)
26#define VTXIOCGETPAGE _IOW (0x81, 6, vtx_pagereq_t)
27#define VTXIOCSTOPDAU _IOW (0x81, 7, vtx_pagereq_t)
28#define VTXIOCPUTPAGE _IO (0x81, 8)
29#define VTXIOCSETDISP _IO (0x81, 9)
30#define VTXIOCPUTSTAT _IO (0x81, 10)
31#define VTXIOCCLRCACHE _IO (0x81, 11)
32#define VTXIOCSETVIRT _IOW (0x81, 12, long)
33
34/* for compatibility, will go away some day */
35#define VTXIOCGETINFO_OLD 0x7101 /* get version of driver & capabilities of vtx-chipset */
36#define VTXIOCCLRPAGE_OLD 0x7102 /* clear page-buffer */
37#define VTXIOCCLRFOUND_OLD 0x7103 /* clear bits indicating that page was found */
38#define VTXIOCPAGEREQ_OLD 0x7104 /* search for page */
39#define VTXIOCGETSTAT_OLD 0x7105 /* get status of page-buffer */
40#define VTXIOCGETPAGE_OLD 0x7106 /* get contents of page-buffer */
41#define VTXIOCSTOPDAU_OLD 0x7107 /* stop data acquisition unit */
42#define VTXIOCPUTPAGE_OLD 0x7108 /* display page on TV-screen */
43#define VTXIOCSETDISP_OLD 0x7109 /* set TV-mode */
44#define VTXIOCPUTSTAT_OLD 0x710a /* set status of TV-output-buffer */
45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */
46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */
47
48/*
49 * Definitions for VTXIOCGETINFO
50 */
51
52#define SAA5243 0
53#define SAA5246 1
54#define SAA5249 2
55#define SAA5248 3
56#define XSTV5346 4
57
58typedef struct {
59 int version_major, version_minor; /* version of driver; if version_major changes, driver */
60 /* is not backward compatible!!! CHECK THIS!!! */
61 int numpages; /* number of page-buffers of vtx-chipset */
62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or
63 * SAA5249) */
64}
65vtx_info_t;
66
67
68/*
69 * Definitions for VTXIOC{CLRPAGE,CLRFOUND,PAGEREQ,GETSTAT,GETPAGE,STOPDAU,PUTPAGE,SETDISP}
70 */
71
72#define MIN_UNIT (1<<0)
73#define MIN_TEN (1<<1)
74#define HR_UNIT (1<<2)
75#define HR_TEN (1<<3)
76#define PG_UNIT (1<<4)
77#define PG_TEN (1<<5)
78#define PG_HUND (1<<6)
79#define PGMASK_MAX (1<<7)
80#define PGMASK_PAGE (PG_HUND | PG_TEN | PG_UNIT)
81#define PGMASK_HOUR (HR_TEN | HR_UNIT)
82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT)
83
84typedef struct
85{
86 int page; /* number of requested page (hexadecimal) */
87 int hour; /* requested hour (hexadecimal) */
88 int minute; /* requested minute (hexadecimal) */
89 int pagemask; /* mask defining which values of the above are set */
90 int pgbuf; /* buffer where page will be stored */
91 int start; /* start of requested part of page */
92 int end; /* end of requested part of page */
93 void __user *buffer; /* pointer to beginning of destination buffer */
94}
95vtx_pagereq_t;
96
97
98/*
99 * Definitions for VTXIOC{GETSTAT,PUTSTAT}
100 */
101
102#define VTX_PAGESIZE (40 * 24)
103#define VTX_VIRTUALSIZE (40 * 49)
104
105typedef struct
106{
107 int pagenum; /* number of page (hexadecimal) */
108 int hour; /* hour (hexadecimal) */
109 int minute; /* minute (hexadecimal) */
110 int charset; /* national charset */
111 unsigned delete : 1; /* delete page (C4) */
112 unsigned headline : 1; /* insert headline (C5) */
113 unsigned subtitle : 1; /* insert subtitle (C6) */
114 unsigned supp_header : 1; /* suppress header (C7) */
115 unsigned update : 1; /* update page (C8) */
116 unsigned inter_seq : 1; /* interrupted sequence (C9) */
117 unsigned dis_disp : 1; /* disable/suppress display (C10) */
118 unsigned serial : 1; /* serial mode (C11) */
119 unsigned notfound : 1; /* /FOUND */
120 unsigned pblf : 1; /* PBLF */
121 unsigned hamming : 1; /* hamming-error occurred */
122}
123vtx_pageinfo_t;
124
125#endif /* _VTX_H */
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 1faa80d92f05..e68b439b2860 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -5,7 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_ids.h> 6#include <linux/virtio_ids.h>
7#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
8#include <linux/types.h>
9 8
10/* The feature bitmap for virtio 9P */ 9/* The feature bitmap for virtio 9P */
11 10
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 0093dd7c1d6f..800617b4ddd5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -109,7 +109,10 @@ 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 MAYBE_BUILD_BUG_ON(fbit >= 32); 112 if (__builtin_constant_p(fbit))
113 BUILD_BUG_ON(fbit >= 32);
114 else
115 BUG_ON(fbit >= 32);
113 116
114 if (fbit < VIRTIO_TRANSPORT_F_START) 117 if (fbit < VIRTIO_TRANSPORT_F_START)
115 virtio_check_driver_offered_feature(vdev, fbit); 118 virtio_check_driver_offered_feature(vdev, fbit);
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index a85064db8f94..e4d333543a33 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -7,7 +7,8 @@
7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
8 * anyone can use the definitions to implement compatible drivers/servers. 8 * anyone can use the definitions to implement compatible drivers/servers.
9 * 9 *
10 * Copyright (C) Red Hat, Inc., 2009, 2010 10 * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
11 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
11 */ 12 */
12 13
13/* Feature bits */ 14/* Feature bits */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 63a4fe6d51bd..9332e52ea8c2 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -7,8 +7,6 @@
7 7
8struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 8struct vm_area_struct; /* vma defining user mapping in mm_types.h */
9 9
10extern bool vmap_lazy_unmap;
11
12/* bits in flags of vmalloc's vm_struct below */ 10/* bits in flags of vmalloc's vm_struct below */
13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 11#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
14#define VM_ALLOC 0x00000002 /* vmalloc() */ 12#define VM_ALLOC 0x00000002 /* vmalloc() */
@@ -53,14 +51,17 @@ static inline void vmalloc_init(void)
53#endif 51#endif
54 52
55extern void *vmalloc(unsigned long size); 53extern void *vmalloc(unsigned long size);
54extern void *vzalloc(unsigned long size);
56extern void *vmalloc_user(unsigned long size); 55extern void *vmalloc_user(unsigned long size);
57extern void *vmalloc_node(unsigned long size, int node); 56extern void *vmalloc_node(unsigned long size, int node);
57extern void *vzalloc_node(unsigned long size, int node);
58extern void *vmalloc_exec(unsigned long size); 58extern void *vmalloc_exec(unsigned long size);
59extern void *vmalloc_32(unsigned long size); 59extern void *vmalloc_32(unsigned long size);
60extern void *vmalloc_32_user(unsigned long size); 60extern void *vmalloc_32_user(unsigned long size);
61extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 61extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
62extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 62extern void *__vmalloc_node_range(unsigned long size, unsigned long align,
63 pgprot_t prot); 63 unsigned long start, unsigned long end, gfp_t gfp_mask,
64 pgprot_t prot, int node, void *caller);
64extern void vfree(const void *addr); 65extern void vfree(const void *addr);
65 66
66extern void *vmap(struct page **pages, unsigned int count, 67extern void *vmap(struct page **pages, unsigned int count,
@@ -90,17 +91,31 @@ extern struct vm_struct *__get_vm_area_caller(unsigned long size,
90 unsigned long flags, 91 unsigned long flags,
91 unsigned long start, unsigned long end, 92 unsigned long start, unsigned long end,
92 void *caller); 93 void *caller);
93extern struct vm_struct *get_vm_area_node(unsigned long size,
94 unsigned long flags, int node,
95 gfp_t gfp_mask);
96extern struct vm_struct *remove_vm_area(const void *addr); 94extern struct vm_struct *remove_vm_area(const void *addr);
97 95
98extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 96extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
99 struct page ***pages); 97 struct page ***pages);
98#ifdef CONFIG_MMU
100extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 99extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
101 pgprot_t prot, struct page **pages); 100 pgprot_t prot, struct page **pages);
102extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); 101extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);
103extern void unmap_kernel_range(unsigned long addr, unsigned long size); 102extern void unmap_kernel_range(unsigned long addr, unsigned long size);
103#else
104static inline int
105map_kernel_range_noflush(unsigned long start, unsigned long size,
106 pgprot_t prot, struct page **pages)
107{
108 return size >> PAGE_SHIFT;
109}
110static inline void
111unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
112{
113}
114static inline void
115unmap_kernel_range(unsigned long addr, unsigned long size)
116{
117}
118#endif
104 119
105/* Allocate/destroy a 'vmalloc' VM area. */ 120/* Allocate/destroy a 'vmalloc' VM area. */
106extern struct vm_struct *alloc_vm_area(size_t size); 121extern struct vm_struct *alloc_vm_area(size_t size);
@@ -118,11 +133,26 @@ extern struct vm_struct *vmlist;
118extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 133extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
119 134
120#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
136# ifdef CONFIG_MMU
121struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, 137struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
122 const size_t *sizes, int nr_vms, 138 const size_t *sizes, int nr_vms,
123 size_t align, gfp_t gfp_mask); 139 size_t align);
124 140
125void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); 141void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
142# else
143static inline struct vm_struct **
144pcpu_get_vm_areas(const unsigned long *offsets,
145 const size_t *sizes, int nr_vms,
146 size_t align)
147{
148 return NULL;
149}
150
151static inline void
152pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
153{
154}
155# endif
126#endif 156#endif
127 157
128#endif /* _LINUX_VMALLOC_H */ 158#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index eaaea37b3b75..2b3831b58aa4 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -58,6 +58,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
58 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 58 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
59 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 59 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
60 UNEVICTABLE_MLOCKFREED, 60 UNEVICTABLE_MLOCKFREED,
61#ifdef CONFIG_TRANSPARENT_HUGEPAGE
62 THP_FAULT_ALLOC,
63 THP_FAULT_FALLBACK,
64 THP_COLLAPSE_ALLOC,
65 THP_COLLAPSE_ALLOC_FAILED,
66 THP_SPLIT,
67#endif
61 NR_VM_EVENT_ITEMS 68 NR_VM_EVENT_ITEMS
62}; 69};
63 70
@@ -220,12 +227,12 @@ static inline unsigned long node_page_state(int node,
220 zone_page_state(&zones[ZONE_MOVABLE], item); 227 zone_page_state(&zones[ZONE_MOVABLE], item);
221} 228}
222 229
223extern void zone_statistics(struct zone *, struct zone *); 230extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
224 231
225#else 232#else
226 233
227#define node_page_state(node, item) global_page_state(item) 234#define node_page_state(node, item) global_page_state(item)
228#define zone_statistics(_zl,_z) do { } while (0) 235#define zone_statistics(_zl, _z, gfp) do { } while (0)
229 236
230#endif /* CONFIG_NUMA */ 237#endif /* CONFIG_NUMA */
231 238
@@ -254,6 +261,11 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item);
254extern void __dec_zone_state(struct zone *, enum zone_stat_item); 261extern void __dec_zone_state(struct zone *, enum zone_stat_item);
255 262
256void refresh_cpu_vm_stats(int); 263void refresh_cpu_vm_stats(int);
264
265int calculate_pressure_threshold(struct zone *zone);
266int calculate_normal_threshold(struct zone *zone);
267void set_pgdat_percpu_threshold(pg_data_t *pgdat,
268 int (*calculate_pressure)(struct zone *));
257#else /* CONFIG_SMP */ 269#else /* CONFIG_SMP */
258 270
259/* 271/*
@@ -298,6 +310,8 @@ static inline void __dec_zone_page_state(struct page *page,
298#define dec_zone_page_state __dec_zone_page_state 310#define dec_zone_page_state __dec_zone_page_state
299#define mod_zone_page_state __mod_zone_page_state 311#define mod_zone_page_state __mod_zone_page_state
300 312
313#define set_pgdat_percpu_threshold(pgdat, callback) { }
314
301static inline void refresh_cpu_vm_stats(int cpu) { } 315static inline void refresh_cpu_vm_stats(int cpu) { }
302#endif 316#endif
303 317
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 6625cc1ab758..4d05e14ea60c 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -142,14 +142,6 @@ static inline bool vt_force_oops_output(struct vc_data *vc)
142 return false; 142 return false;
143} 143}
144 144
145/*
146 * vc_screen.c shares this temporary buffer with the console write code so that
147 * we can easily avoid touching user space while holding the console spinlock.
148 */
149
150#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
151extern char con_buf[CON_BUF_SIZE];
152extern struct mutex con_buf_mtx;
153extern char vt_dont_switch; 145extern char vt_dont_switch;
154extern int default_utf8; 146extern int default_utf8;
155extern int global_cursor_default; 147extern int global_cursor_default;
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
index 4fdcc5635518..9f6b77af2f6d 100644
--- a/include/linux/wimax.h
+++ b/include/linux/wimax.h
@@ -114,7 +114,7 @@ enum {
114 WIMAX_GNL_RESET_IFIDX = 1, 114 WIMAX_GNL_RESET_IFIDX = 1,
115}; 115};
116 116
117/* Atributes for wimax_state_get() */ 117/* Attributes for wimax_state_get() */
118enum { 118enum {
119 WIMAX_GNL_STGET_IFIDX = 1, 119 WIMAX_GNL_STGET_IFIDX = 1,
120}; 120};
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4f902e1908aa..4b697395326e 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -24,14 +24,41 @@
24#ifndef _LINUX_WL12XX_H 24#ifndef _LINUX_WL12XX_H
25#define _LINUX_WL12XX_H 25#define _LINUX_WL12XX_H
26 26
27/* Reference clock values */
28enum {
29 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
30 WL12XX_REFCLOCK_26 = 1, /* 26 MHz */
31 WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */
32 WL12XX_REFCLOCK_52 = 3, /* 52 MHz */
33 WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
34 WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
35};
36
37/* TCXO clock values */
38enum {
39 WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */
40 WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */
41 WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */
42 WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */
43 WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */
44 WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */
45 WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */
46 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
47};
48
27struct wl12xx_platform_data { 49struct wl12xx_platform_data {
28 void (*set_power)(bool enable); 50 void (*set_power)(bool enable);
29 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 51 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
30 int irq; 52 int irq;
31 bool use_eeprom; 53 bool use_eeprom;
32 int board_ref_clock; 54 int board_ref_clock;
55 int board_tcxo_clock;
56 unsigned long platform_quirks;
33}; 57};
34 58
59/* Platform does not support level trigger interrupts */
60#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
61
35#ifdef CONFIG_WL12XX_PLATFORM_DATA 62#ifdef CONFIG_WL12XX_PLATFORM_DATA
36 63
37int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); 64int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 070bb7a88936..f584aba78ca9 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -127,12 +127,20 @@ struct execute_work {
127 .timer = TIMER_INITIALIZER(NULL, 0, 0), \ 127 .timer = TIMER_INITIALIZER(NULL, 0, 0), \
128 } 128 }
129 129
130#define __DEFERRED_WORK_INITIALIZER(n, f) { \
131 .work = __WORK_INITIALIZER((n).work, (f)), \
132 .timer = TIMER_DEFERRED_INITIALIZER(NULL, 0, 0), \
133 }
134
130#define DECLARE_WORK(n, f) \ 135#define DECLARE_WORK(n, f) \
131 struct work_struct n = __WORK_INITIALIZER(n, f) 136 struct work_struct n = __WORK_INITIALIZER(n, f)
132 137
133#define DECLARE_DELAYED_WORK(n, f) \ 138#define DECLARE_DELAYED_WORK(n, f) \
134 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) 139 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f)
135 140
141#define DECLARE_DEFERRED_WORK(n, f) \
142 struct delayed_work n = __DEFERRED_WORK_INITIALIZER(n, f)
143
136/* 144/*
137 * initialize a work item's function pointer 145 * initialize a work item's function pointer
138 */ 146 */
@@ -190,7 +198,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
190 __INIT_WORK((_work), (_func), 0); \ 198 __INIT_WORK((_work), (_func), 0); \
191 } while (0) 199 } while (0)
192 200
193#define INIT_WORK_ON_STACK(_work, _func) \ 201#define INIT_WORK_ONSTACK(_work, _func) \
194 do { \ 202 do { \
195 __INIT_WORK((_work), (_func), 1); \ 203 __INIT_WORK((_work), (_func), 1); \
196 } while (0) 204 } while (0)
@@ -201,9 +209,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
201 init_timer(&(_work)->timer); \ 209 init_timer(&(_work)->timer); \
202 } while (0) 210 } while (0)
203 211
204#define INIT_DELAYED_WORK_ON_STACK(_work, _func) \ 212#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \
205 do { \ 213 do { \
206 INIT_WORK_ON_STACK(&(_work)->work, (_func)); \ 214 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
207 init_timer_on_stack(&(_work)->timer); \ 215 init_timer_on_stack(&(_work)->timer); \
208 } while (0) 216 } while (0)
209 217
@@ -242,7 +250,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
242enum { 250enum {
243 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 251 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */
244 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 252 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
245 WQ_FREEZEABLE = 1 << 2, /* freeze during suspend */ 253 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
246 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 254 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
247 WQ_HIGHPRI = 1 << 4, /* high priority */ 255 WQ_HIGHPRI = 1 << 4, /* high priority */
248 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 256 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
@@ -278,11 +286,15 @@ enum {
278 * any specific CPU, not concurrency managed, and all queued works are 286 * any specific CPU, not concurrency managed, and all queued works are
279 * executed immediately as long as max_active limit is not reached and 287 * executed immediately as long as max_active limit is not reached and
280 * resources are available. 288 * resources are available.
289 *
290 * system_freezable_wq is equivalent to system_wq except that it's
291 * freezable.
281 */ 292 */
282extern struct workqueue_struct *system_wq; 293extern struct workqueue_struct *system_wq;
283extern struct workqueue_struct *system_long_wq; 294extern struct workqueue_struct *system_long_wq;
284extern struct workqueue_struct *system_nrt_wq; 295extern struct workqueue_struct *system_nrt_wq;
285extern struct workqueue_struct *system_unbound_wq; 296extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq;
286 298
287extern struct workqueue_struct * 299extern struct workqueue_struct *
288__alloc_workqueue_key(const char *name, unsigned int flags, int max_active, 300__alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
@@ -310,7 +322,7 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
310/** 322/**
311 * alloc_ordered_workqueue - allocate an ordered workqueue 323 * alloc_ordered_workqueue - allocate an ordered workqueue
312 * @name: name of the workqueue 324 * @name: name of the workqueue
313 * @flags: WQ_* flags (only WQ_FREEZEABLE and WQ_MEM_RECLAIM are meaningful) 325 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
314 * 326 *
315 * Allocate an ordered workqueue. An ordered workqueue executes at 327 * Allocate an ordered workqueue. An ordered workqueue executes at
316 * most one work item at any given time in the queued order. They are 328 * most one work item at any given time in the queued order. They are
@@ -327,8 +339,8 @@ alloc_ordered_workqueue(const char *name, unsigned int flags)
327 339
328#define create_workqueue(name) \ 340#define create_workqueue(name) \
329 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 341 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
330#define create_freezeable_workqueue(name) \ 342#define create_freezable_workqueue(name) \
331 alloc_workqueue((name), WQ_FREEZEABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 343 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
332#define create_singlethread_workqueue(name) \ 344#define create_singlethread_workqueue(name) \
333 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 345 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
334 346
@@ -401,7 +413,7 @@ static inline bool __cancel_delayed_work(struct delayed_work *work)
401} 413}
402 414
403/* Obsolete. use cancel_delayed_work_sync() */ 415/* Obsolete. use cancel_delayed_work_sync() */
404static inline 416static inline __deprecated
405void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, 417void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
406 struct delayed_work *work) 418 struct delayed_work *work)
407{ 419{
@@ -409,7 +421,7 @@ void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
409} 421}
410 422
411/* Obsolete. use cancel_delayed_work_sync() */ 423/* Obsolete. use cancel_delayed_work_sync() */
412static inline 424static inline __deprecated
413void cancel_rearming_delayed_work(struct delayed_work *work) 425void cancel_rearming_delayed_work(struct delayed_work *work)
414{ 426{
415 cancel_delayed_work_sync(work); 427 cancel_delayed_work_sync(work);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 72a5d647a5f2..17e7ccc322a5 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -9,9 +9,7 @@
9 9
10struct backing_dev_info; 10struct backing_dev_info;
11 11
12extern spinlock_t inode_lock; 12extern spinlock_t inode_wb_list_lock;
13extern struct list_head inode_in_use;
14extern struct list_head inode_unused;
15 13
16/* 14/*
17 * fs/fs-writeback.c 15 * fs/fs-writeback.c
@@ -60,7 +58,9 @@ struct writeback_control {
60struct bdi_writeback; 58struct bdi_writeback;
61int inode_wait(void *); 59int inode_wait(void *);
62void writeback_inodes_sb(struct super_block *); 60void writeback_inodes_sb(struct super_block *);
61void writeback_inodes_sb_nr(struct super_block *, unsigned long nr);
63int writeback_inodes_sb_if_idle(struct super_block *); 62int writeback_inodes_sb_if_idle(struct super_block *);
63int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr);
64void sync_inodes_sb(struct super_block *); 64void sync_inodes_sb(struct super_block *);
65void writeback_inodes_wb(struct bdi_writeback *wb, 65void writeback_inodes_wb(struct bdi_writeback *wb,
66 struct writeback_control *wbc); 66 struct writeback_control *wbc);
@@ -143,12 +143,16 @@ typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
143 143
144int generic_writepages(struct address_space *mapping, 144int generic_writepages(struct address_space *mapping,
145 struct writeback_control *wbc); 145 struct writeback_control *wbc);
146void tag_pages_for_writeback(struct address_space *mapping,
147 pgoff_t start, pgoff_t end);
146int write_cache_pages(struct address_space *mapping, 148int write_cache_pages(struct address_space *mapping,
147 struct writeback_control *wbc, writepage_t writepage, 149 struct writeback_control *wbc, writepage_t writepage,
148 void *data); 150 void *data);
149int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 151int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
150void set_page_dirty_balance(struct page *page, int page_mkwrite); 152void set_page_dirty_balance(struct page *page, int page_mkwrite);
151void writeback_set_ratelimit(void); 153void writeback_set_ratelimit(void);
154void tag_pages_for_writeback(struct address_space *mapping,
155 pgoff_t start, pgoff_t end);
152 156
153/* pdflush.c */ 157/* pdflush.c */
154extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 158extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index f1e5bde4b35a..6050783005bd 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -40,9 +40,15 @@
40#define XATTR_SMACK_SUFFIX "SMACK64" 40#define XATTR_SMACK_SUFFIX "SMACK64"
41#define XATTR_SMACK_IPIN "SMACK64IPIN" 41#define XATTR_SMACK_IPIN "SMACK64IPIN"
42#define XATTR_SMACK_IPOUT "SMACK64IPOUT" 42#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
43#define XATTR_SMACK_EXEC "SMACK64EXEC"
44#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE"
45#define XATTR_SMACK_MMAP "SMACK64MMAP"
43#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX 46#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
44#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN 47#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
45#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT 48#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
49#define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC
50#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE
51#define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP
46 52
47#define XATTR_CAPS_SUFFIX "capability" 53#define XATTR_CAPS_SUFFIX "capability"
48#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 54#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b971e3848493..22e61fdf75a2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,16 @@ struct xfrm_replay_state {
84 __u32 bitmap; 84 __u32 bitmap;
85}; 85};
86 86
87struct xfrm_replay_state_esn {
88 unsigned int bmp_len;
89 __u32 oseq;
90 __u32 seq;
91 __u32 oseq_hi;
92 __u32 seq_hi;
93 __u32 replay_window;
94 __u32 bmp[0];
95};
96
87struct xfrm_algo { 97struct xfrm_algo {
88 char alg_name[64]; 98 char alg_name[64];
89 unsigned int alg_key_len; /* in bits */ 99 unsigned int alg_key_len; /* in bits */
@@ -283,6 +293,8 @@ enum xfrm_attr_type_t {
283 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */ 293 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */
284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 294 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
285 XFRMA_MARK, /* struct xfrm_mark */ 295 XFRMA_MARK, /* struct xfrm_mark */
296 XFRMA_TFCPAD, /* __u32 */
297 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
286 __XFRMA_MAX 298 __XFRMA_MAX
287 299
288#define XFRMA_MAX (__XFRMA_MAX - 1) 300#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -349,6 +361,8 @@ struct xfrm_usersa_info {
349#define XFRM_STATE_WILDRECV 8 361#define XFRM_STATE_WILDRECV 8
350#define XFRM_STATE_ICMP 16 362#define XFRM_STATE_ICMP 16
351#define XFRM_STATE_AF_UNSPEC 32 363#define XFRM_STATE_AF_UNSPEC 32
364#define XFRM_STATE_ALIGN4 64
365#define XFRM_STATE_ESN 128
352}; 366};
353 367
354struct xfrm_usersa_id { 368struct xfrm_usersa_id {
diff --git a/include/linux/xilinxfb.h b/include/linux/xilinxfb.h
index f2463f559fb9..5a155a968054 100644
--- a/include/linux/xilinxfb.h
+++ b/include/linux/xilinxfb.h
@@ -16,7 +16,7 @@
16/* ML300/403 reference design framebuffer driver platform data struct */ 16/* ML300/403 reference design framebuffer driver platform data struct */
17struct xilinxfb_platform_data { 17struct xilinxfb_platform_data {
18 u32 rotate_screen; /* Flag to rotate display 180 degrees */ 18 u32 rotate_screen; /* Flag to rotate display 180 degrees */
19 u32 screen_height_mm; /* Physical dimentions of screen in mm */ 19 u32 screen_height_mm; /* Physical dimensions of screen in mm */
20 u32 screen_width_mm; 20 u32 screen_width_mm;
21 u32 xres, yres; /* resolution of screen in pixels */ 21 u32 xres, yres; /* resolution of screen in pixels */
22 u32 xvirt, yvirt; /* resolution of memory buffer */ 22 u32 xvirt, yvirt; /* resolution of memory buffer */
diff --git a/include/linux/xz.h b/include/linux/xz.h
new file mode 100644
index 000000000000..64cffa6ddfce
--- /dev/null
+++ b/include/linux/xz.h
@@ -0,0 +1,264 @@
1/*
2 * XZ decompressor
3 *
4 * Authors: Lasse Collin <lasse.collin@tukaani.org>
5 * Igor Pavlov <http://7-zip.org/>
6 *
7 * This file has been put into the public domain.
8 * You can do whatever you want with this file.
9 */
10
11#ifndef XZ_H
12#define XZ_H
13
14#ifdef __KERNEL__
15# include <linux/stddef.h>
16# include <linux/types.h>
17#else
18# include <stddef.h>
19# include <stdint.h>
20#endif
21
22/* In Linux, this is used to make extern functions static when needed. */
23#ifndef XZ_EXTERN
24# define XZ_EXTERN extern
25#endif
26
27/**
28 * enum xz_mode - Operation mode
29 *
30 * @XZ_SINGLE: Single-call mode. This uses less RAM than
31 * than multi-call modes, because the LZMA2
32 * dictionary doesn't need to be allocated as
33 * part of the decoder state. All required data
34 * structures are allocated at initialization,
35 * so xz_dec_run() cannot return XZ_MEM_ERROR.
36 * @XZ_PREALLOC: Multi-call mode with preallocated LZMA2
37 * dictionary buffer. All data structures are
38 * allocated at initialization, so xz_dec_run()
39 * cannot return XZ_MEM_ERROR.
40 * @XZ_DYNALLOC: Multi-call mode. The LZMA2 dictionary is
41 * allocated once the required size has been
42 * parsed from the stream headers. If the
43 * allocation fails, xz_dec_run() will return
44 * XZ_MEM_ERROR.
45 *
46 * It is possible to enable support only for a subset of the above
47 * modes at compile time by defining XZ_DEC_SINGLE, XZ_DEC_PREALLOC,
48 * or XZ_DEC_DYNALLOC. The xz_dec kernel module is always compiled
49 * with support for all operation modes, but the preboot code may
50 * be built with fewer features to minimize code size.
51 */
52enum xz_mode {
53 XZ_SINGLE,
54 XZ_PREALLOC,
55 XZ_DYNALLOC
56};
57
58/**
59 * enum xz_ret - Return codes
60 * @XZ_OK: Everything is OK so far. More input or more
61 * output space is required to continue. This
62 * return code is possible only in multi-call mode
63 * (XZ_PREALLOC or XZ_DYNALLOC).
64 * @XZ_STREAM_END: Operation finished successfully.
65 * @XZ_UNSUPPORTED_CHECK: Integrity check type is not supported. Decoding
66 * is still possible in multi-call mode by simply
67 * calling xz_dec_run() again.
68 * Note that this return value is used only if
69 * XZ_DEC_ANY_CHECK was defined at build time,
70 * which is not used in the kernel. Unsupported
71 * check types return XZ_OPTIONS_ERROR if
72 * XZ_DEC_ANY_CHECK was not defined at build time.
73 * @XZ_MEM_ERROR: Allocating memory failed. This return code is
74 * possible only if the decoder was initialized
75 * with XZ_DYNALLOC. The amount of memory that was
76 * tried to be allocated was no more than the
77 * dict_max argument given to xz_dec_init().
78 * @XZ_MEMLIMIT_ERROR: A bigger LZMA2 dictionary would be needed than
79 * allowed by the dict_max argument given to
80 * xz_dec_init(). This return value is possible
81 * only in multi-call mode (XZ_PREALLOC or
82 * XZ_DYNALLOC); the single-call mode (XZ_SINGLE)
83 * ignores the dict_max argument.
84 * @XZ_FORMAT_ERROR: File format was not recognized (wrong magic
85 * bytes).
86 * @XZ_OPTIONS_ERROR: This implementation doesn't support the requested
87 * compression options. In the decoder this means
88 * that the header CRC32 matches, but the header
89 * itself specifies something that we don't support.
90 * @XZ_DATA_ERROR: Compressed data is corrupt.
91 * @XZ_BUF_ERROR: Cannot make any progress. Details are slightly
92 * different between multi-call and single-call
93 * mode; more information below.
94 *
95 * In multi-call mode, XZ_BUF_ERROR is returned when two consecutive calls
96 * to XZ code cannot consume any input and cannot produce any new output.
97 * This happens when there is no new input available, or the output buffer
98 * is full while at least one output byte is still pending. Assuming your
99 * code is not buggy, you can get this error only when decoding a compressed
100 * stream that is truncated or otherwise corrupt.
101 *
102 * In single-call mode, XZ_BUF_ERROR is returned only when the output buffer
103 * is too small or the compressed input is corrupt in a way that makes the
104 * decoder produce more output than the caller expected. When it is
105 * (relatively) clear that the compressed input is truncated, XZ_DATA_ERROR
106 * is used instead of XZ_BUF_ERROR.
107 */
108enum xz_ret {
109 XZ_OK,
110 XZ_STREAM_END,
111 XZ_UNSUPPORTED_CHECK,
112 XZ_MEM_ERROR,
113 XZ_MEMLIMIT_ERROR,
114 XZ_FORMAT_ERROR,
115 XZ_OPTIONS_ERROR,
116 XZ_DATA_ERROR,
117 XZ_BUF_ERROR
118};
119
120/**
121 * struct xz_buf - Passing input and output buffers to XZ code
122 * @in: Beginning of the input buffer. This may be NULL if and only
123 * if in_pos is equal to in_size.
124 * @in_pos: Current position in the input buffer. This must not exceed
125 * in_size.
126 * @in_size: Size of the input buffer
127 * @out: Beginning of the output buffer. This may be NULL if and only
128 * if out_pos is equal to out_size.
129 * @out_pos: Current position in the output buffer. This must not exceed
130 * out_size.
131 * @out_size: Size of the output buffer
132 *
133 * Only the contents of the output buffer from out[out_pos] onward, and
134 * the variables in_pos and out_pos are modified by the XZ code.
135 */
136struct xz_buf {
137 const uint8_t *in;
138 size_t in_pos;
139 size_t in_size;
140
141 uint8_t *out;
142 size_t out_pos;
143 size_t out_size;
144};
145
146/**
147 * struct xz_dec - Opaque type to hold the XZ decoder state
148 */
149struct xz_dec;
150
151/**
152 * xz_dec_init() - Allocate and initialize a XZ decoder state
153 * @mode: Operation mode
154 * @dict_max: Maximum size of the LZMA2 dictionary (history buffer) for
155 * multi-call decoding. This is ignored in single-call mode
156 * (mode == XZ_SINGLE). LZMA2 dictionary is always 2^n bytes
157 * or 2^n + 2^(n-1) bytes (the latter sizes are less common
158 * in practice), so other values for dict_max don't make sense.
159 * In the kernel, dictionary sizes of 64 KiB, 128 KiB, 256 KiB,
160 * 512 KiB, and 1 MiB are probably the only reasonable values,
161 * except for kernel and initramfs images where a bigger
162 * dictionary can be fine and useful.
163 *
164 * Single-call mode (XZ_SINGLE): xz_dec_run() decodes the whole stream at
165 * once. The caller must provide enough output space or the decoding will
166 * fail. The output space is used as the dictionary buffer, which is why
167 * there is no need to allocate the dictionary as part of the decoder's
168 * internal state.
169 *
170 * Because the output buffer is used as the workspace, streams encoded using
171 * a big dictionary are not a problem in single-call mode. It is enough that
172 * the output buffer is big enough to hold the actual uncompressed data; it
173 * can be smaller than the dictionary size stored in the stream headers.
174 *
175 * Multi-call mode with preallocated dictionary (XZ_PREALLOC): dict_max bytes
176 * of memory is preallocated for the LZMA2 dictionary. This way there is no
177 * risk that xz_dec_run() could run out of memory, since xz_dec_run() will
178 * never allocate any memory. Instead, if the preallocated dictionary is too
179 * small for decoding the given input stream, xz_dec_run() will return
180 * XZ_MEMLIMIT_ERROR. Thus, it is important to know what kind of data will be
181 * decoded to avoid allocating excessive amount of memory for the dictionary.
182 *
183 * Multi-call mode with dynamically allocated dictionary (XZ_DYNALLOC):
184 * dict_max specifies the maximum allowed dictionary size that xz_dec_run()
185 * may allocate once it has parsed the dictionary size from the stream
186 * headers. This way excessive allocations can be avoided while still
187 * limiting the maximum memory usage to a sane value to prevent running the
188 * system out of memory when decompressing streams from untrusted sources.
189 *
190 * On success, xz_dec_init() returns a pointer to struct xz_dec, which is
191 * ready to be used with xz_dec_run(). If memory allocation fails,
192 * xz_dec_init() returns NULL.
193 */
194XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max);
195
196/**
197 * xz_dec_run() - Run the XZ decoder
198 * @s: Decoder state allocated using xz_dec_init()
199 * @b: Input and output buffers
200 *
201 * The possible return values depend on build options and operation mode.
202 * See enum xz_ret for details.
203 *
204 * Note that if an error occurs in single-call mode (return value is not
205 * XZ_STREAM_END), b->in_pos and b->out_pos are not modified and the
206 * contents of the output buffer from b->out[b->out_pos] onward are
207 * undefined. This is true even after XZ_BUF_ERROR, because with some filter
208 * chains, there may be a second pass over the output buffer, and this pass
209 * cannot be properly done if the output buffer is truncated. Thus, you
210 * cannot give the single-call decoder a too small buffer and then expect to
211 * get that amount valid data from the beginning of the stream. You must use
212 * the multi-call decoder if you don't want to uncompress the whole stream.
213 */
214XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b);
215
216/**
217 * xz_dec_reset() - Reset an already allocated decoder state
218 * @s: Decoder state allocated using xz_dec_init()
219 *
220 * This function can be used to reset the multi-call decoder state without
221 * freeing and reallocating memory with xz_dec_end() and xz_dec_init().
222 *
223 * In single-call mode, xz_dec_reset() is always called in the beginning of
224 * xz_dec_run(). Thus, explicit call to xz_dec_reset() is useful only in
225 * multi-call mode.
226 */
227XZ_EXTERN void xz_dec_reset(struct xz_dec *s);
228
229/**
230 * xz_dec_end() - Free the memory allocated for the decoder state
231 * @s: Decoder state allocated using xz_dec_init(). If s is NULL,
232 * this function does nothing.
233 */
234XZ_EXTERN void xz_dec_end(struct xz_dec *s);
235
236/*
237 * Standalone build (userspace build or in-kernel build for boot time use)
238 * needs a CRC32 implementation. For normal in-kernel use, kernel's own
239 * CRC32 module is used instead, and users of this module don't need to
240 * care about the functions below.
241 */
242#ifndef XZ_INTERNAL_CRC32
243# ifdef __KERNEL__
244# define XZ_INTERNAL_CRC32 0
245# else
246# define XZ_INTERNAL_CRC32 1
247# endif
248#endif
249
250#if XZ_INTERNAL_CRC32
251/*
252 * This must be called before any other xz_* function to initialize
253 * the CRC32 lookup table.
254 */
255XZ_EXTERN void xz_crc32_init(void);
256
257/*
258 * Update CRC32 value using the polynomial from IEEE-802.3. To start a new
259 * calculation, the third argument must be zero. To continue the calculation,
260 * the previously returned value is passed as the third argument.
261 */
262XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc);
263#endif
264#endif
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 40c49cb3eb51..9c5a6b4de0a3 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -179,11 +179,16 @@ typedef z_stream *z_streamp;
179 179
180 /* basic functions */ 180 /* basic functions */
181 181
182extern int zlib_deflate_workspacesize (void); 182extern int zlib_deflate_workspacesize (int windowBits, int memLevel);
183/* 183/*
184 Returns the number of bytes that needs to be allocated for a per- 184 Returns the number of bytes that needs to be allocated for a per-
185 stream workspace. A pointer to this number of bytes should be 185 stream workspace with the specified parameters. A pointer to this
186 returned in stream->workspace before calling zlib_deflateInit(). 186 number of bytes should be returned in stream->workspace before
187 you call zlib_deflateInit() or zlib_deflateInit2(). If you call
188 zlib_deflateInit(), specify windowBits = MAX_WBITS and memLevel =
189 MAX_MEM_LEVEL here. If you call zlib_deflateInit2(), the windowBits
190 and memLevel parameters passed to zlib_deflateInit2() must not
191 exceed those passed here.
187*/ 192*/
188 193
189/* 194/*