aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
commitcf9b59e9d3e008591d1f54830f570982bb307a0d (patch)
tree113478ce8fd8c832ba726ffdf59b82cb46356476 /include
parent44504b2bebf8b5823c59484e73096a7d6574471d (diff)
parentf4b87dee923342505e1ddba8d34ce9de33e75050 (diff)
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/acpixf.h43
-rw-r--r--include/acpi/actbl2.h27
-rw-r--r--include/acpi/actypes.h44
-rw-r--r--include/asm-generic/atomic.h2
-rw-r--r--include/asm-generic/bitops/arch_hweight.h25
-rw-r--r--include/asm-generic/bitops/const_hweight.h42
-rw-r--r--include/asm-generic/bitops/hweight.h8
-rw-r--r--include/asm-generic/bug.h34
-rw-r--r--include/asm-generic/dma-mapping-common.h4
-rw-r--r--include/asm-generic/kmap_types.h3
-rw-r--r--include/crypto/algapi.h40
-rw-r--r--include/drm/drmP.h3
-rw-r--r--include/drm/drm_crtc.h43
-rw-r--r--include/drm/drm_crtc_helper.h9
-rw-r--r--include/drm/drm_edid.h5
-rw-r--r--include/drm/drm_fb_helper.h67
-rw-r--r--include/drm/drm_fixed.h67
-rw-r--r--include/drm/radeon_drm.h1
-rw-r--r--include/drm/ttm/ttm_bo_api.h46
-rw-r--r--include/drm/ttm/ttm_bo_driver.h85
-rw-r--r--include/drm/ttm/ttm_page_alloc.h74
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h5
-rw-r--r--include/linux/ahci_platform.h29
-rw-r--r--include/linux/altera_jtaguart.h16
-rw-r--r--include/linux/altera_uart.h14
-rw-r--r--include/linux/amba/mmci.h23
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/backing-dev.h8
-rw-r--r--include/linux/bitops.h30
-rw-r--r--include/linux/blkdev.h72
-rw-r--r--include/linux/caif/caif_socket.h165
-rw-r--r--include/linux/caif/if_caif.h34
-rw-r--r--include/linux/can/dev.h1
-rw-r--r--include/linux/can/platform/mcp251x.h4
-rw-r--r--include/linux/can/platform/sja1000.h2
-rw-r--r--include/linux/cgroup.h1
-rw-r--r--include/linux/clocksource.h19
-rw-r--r--include/linux/coda_psdev.h3
-rw-r--r--include/linux/cpufreq.h30
-rw-r--r--include/linux/cpuset.h16
-rw-r--r--include/linux/dcache.h14
-rw-r--r--include/linux/dcbnl.h2
-rw-r--r--include/linux/debugobjects.h11
-rw-r--r--include/linux/device.h16
-rw-r--r--include/linux/dmaengine.h127
-rw-r--r--include/linux/dqblk_xfs.h9
-rw-r--r--include/linux/drbd.h5
-rw-r--r--include/linux/drbd_limits.h16
-rw-r--r--include/linux/drbd_nl.h5
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/elfcore.h4
-rw-r--r--include/linux/ethtool.h116
-rw-r--r--include/linux/ext2_fs_sb.h9
-rw-r--r--include/linux/fb.h19
-rw-r--r--include/linux/fcntl.h6
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/firewire-cdev.h2
-rw-r--r--include/linux/firewire-constants.h2
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/fs.h40
-rw-r--r--include/linux/ftrace.h61
-rw-r--r--include/linux/ftrace_event.h4
-rw-r--r--include/linux/generic_acl.h4
-rw-r--r--include/linux/genetlink.h8
-rw-r--r--include/linux/gsmmux.h25
-rw-r--r--include/linux/hdpu_features.h26
-rw-r--r--include/linux/hid.h10
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hw_breakpoint.h25
-rw-r--r--include/linux/i2c-omap.h9
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/i2c/twl.h14
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/ieee80211.h4
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_link.h131
-rw-r--r--include/linux/if_macvlan.h3
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_pppol2tp.h16
-rw-r--r--include/linux/if_pppox.h9
-rw-r--r--include/linux/if_tun.h2
-rw-r--r--include/linux/if_x25.h26
-rw-r--r--include/linux/in6.h5
-rw-r--r--include/linux/init_task.h1
-rw-r--r--include/linux/input.h1
-rw-r--r--include/linux/input/ad714x.h63
-rw-r--r--include/linux/interrupt.h32
-rw-r--r--include/linux/iommu.h24
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/ipv6.h18
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isapnp.h8
-rw-r--r--include/linux/jbd.h3
-rw-r--r--include/linux/jffs2.h4
-rw-r--r--include/linux/kdb.h117
-rw-r--r--include/linux/kernel.h18
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/kgdb.h55
-rw-r--r--include/linux/kobj_map.h9
-rw-r--r--include/linux/kobject.h38
-rw-r--r--include/linux/kref.h3
-rw-r--r--include/linux/ks8842.h34
-rw-r--r--include/linux/ktime.h10
-rw-r--r--include/linux/kvm.h26
-rw-r--r--include/linux/kvm_host.h23
-rw-r--r--include/linux/l2tp.h163
-rw-r--r--include/linux/libata.h80
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/lsm_audit.h2
-rw-r--r--include/linux/meye.h12
-rw-r--r--include/linux/mfd/davinci_voicecodec.h126
-rw-r--r--include/linux/mfd/wm8350/audio.h2
-rw-r--r--include/linux/mfd/wm8994/core.h53
-rw-r--r--include/linux/mfd/wm8994/pdata.h1
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mlx4/qp.h7
-rw-r--r--include/linux/mm.h4
-rw-r--r--include/linux/mmc/sdio.h2
-rw-r--r--include/linux/mod_devicetable.h42
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/mroute.h20
-rw-r--r--include/linux/mroute6.h35
-rw-r--r--include/linux/msm_mdp.h78
-rw-r--r--include/linux/mtd/blktrans.h15
-rw-r--r--include/linux/mtd/cfi.h30
-rw-r--r--include/linux/mtd/flashchip.h4
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/mtdram.h2
-rw-r--r--include/linux/mtd/nand.h25
-rw-r--r--include/linux/mtd/onenand.h9
-rw-r--r--include/linux/mtd/sh_flctl.h7
-rw-r--r--include/linux/ncp_fs_sb.h2
-rw-r--r--include/linux/net.h14
-rw-r--r--include/linux/netdevice.h296
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h3
-rw-r--r--include/linux/netfilter/x_tables.h95
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h22
-rw-r--r--include/linux/netfilter/xt_MARK.h6
-rw-r--r--include/linux/netfilter/xt_TEE.h12
-rw-r--r--include/linux/netfilter/xt_connmark.h11
-rw-r--r--include/linux/netfilter/xt_mark.h4
-rw-r--r--include/linux/netfilter/xt_recent.h7
-rw-r--r--include/linux/netfilter_bridge.h29
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h4
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/netpoll.h13
-rw-r--r--include/linux/nfs_fs.h15
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_xdr.h7
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nilfs2_fs.h17
-rw-r--r--include/linux/nl80211.h76
-rw-r--r--include/linux/notifier.h10
-rw-r--r--include/linux/padata.h55
-rw-r--r--include/linux/pci.h10
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/pci_regs.h6
-rw-r--r--include/linux/perf_event.h83
-rw-r--r--include/linux/phy.h13
-rw-r--r--include/linux/pipe_fs_i.h13
-rw-r--r--include/linux/platform_device.h6
-rw-r--r--include/linux/pm_qos_params.h14
-rw-r--r--include/linux/pm_runtime.h7
-rw-r--r--include/linux/pm_wakeup.h38
-rw-r--r--include/linux/poison.h9
-rw-r--r--include/linux/ppp_channel.h3
-rw-r--r--include/linux/ptrace.h12
-rw-r--r--include/linux/quota.h48
-rw-r--r--include/linux/quotaops.h15
-rw-r--r--include/linux/ramfs.h5
-rw-r--r--include/linux/rbtree.h5
-rw-r--r--include/linux/rculist.h42
-rw-r--r--include/linux/rcupdate.h52
-rw-r--r--include/linux/rcutiny.h31
-rw-r--r--include/linux/rcutree.h7
-rw-r--r--include/linux/regulator/consumer.h8
-rw-r--r--include/linux/reiserfs_acl.h4
-rw-r--r--include/linux/reiserfs_xattr.h6
-rw-r--r--include/linux/ring_buffer.h10
-rw-r--r--include/linux/rtc-v3020.h2
-rw-r--r--include/linux/rtnetlink.h7
-rw-r--r--include/linux/sched.h80
-rw-r--r--include/linux/security.h180
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_sci.h4
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/sh_clk.h150
-rw-r--r--include/linux/sh_dma.h102
-rw-r--r--include/linux/sh_intc.h26
-rw-r--r--include/linux/skbuff.h83
-rw-r--r--include/linux/smb_fs_sb.h3
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/spi/wl12xx.h2
-rw-r--r--include/linux/splice.h7
-rw-r--r--include/linux/srcu.h6
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h15
-rw-r--r--include/linux/ssb/ssb_regs.h239
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/stop_machine.h122
-rw-r--r--include/linux/sunrpc/auth.h1
-rw-r--r--include/linux/sunrpc/auth_gss.h1
-rw-r--r--include/linux/sunrpc/gss_api.h8
-rw-r--r--include/linux/sunrpc/gss_krb5.h184
-rw-r--r--include/linux/sunrpc/metrics.h7
-rw-r--r--include/linux/sunrpc/sched.h20
-rw-r--r--include/linux/sunrpc/xdr.h8
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/swap.h1
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h26
-rw-r--r--include/linux/sysrq.h23
-rw-r--r--include/linux/tboot.h1
-rw-r--r--include/linux/tca6416_keypad.h34
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/timb_dma.h55
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timer.h10
-rw-r--r--include/linux/timex.h5
-rw-r--r--include/linux/tipc.h36
-rw-r--r--include/linux/tipc_config.h1
-rw-r--r--include/linux/tracepoint.h114
-rw-r--r--include/linux/tty.h5
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/usb.h131
-rw-r--r--include/linux/usb/Kbuild1
-rw-r--r--include/linux/usb/atmel_usba_udc.h2
-rw-r--r--include/linux/usb/audio-v2.h378
-rw-r--r--include/linux/usb/audio.h233
-rw-r--r--include/linux/usb/cdc.h94
-rw-r--r--include/linux/usb/ch11.h167
-rw-r--r--include/linux/usb/ch9.h16
-rw-r--r--include/linux/usb/composite.h1
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/functionfs.h199
-rw-r--r--include/linux/usb/g_hid.h32
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/gadgetfs.h2
-rw-r--r--include/linux/usb/hcd.h625
-rw-r--r--include/linux/usb/langwell_udc.h2
-rw-r--r--include/linux/usb/musb.h40
-rw-r--r--include/linux/usb/ncm.h114
-rw-r--r--include/linux/usb/net2280.h6
-rw-r--r--include/linux/usb/quirks.h4
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/serial.h36
-rw-r--r--include/linux/usb/ulpi.h140
-rw-r--r--include/linux/usb/usbnet.h40
-rw-r--r--include/linux/usb/wusb-wa.h2
-rw-r--r--include/linux/via-core.h219
-rw-r--r--include/linux/via-gpio.h14
-rw-r--r--include/linux/via_i2c.h42
-rw-r--r--include/linux/videodev2.h75
-rw-r--r--include/linux/virtio.h55
-rw-r--r--include/linux/virtio_blk.h5
-rw-r--r--include/linux/virtio_console.h25
-rw-r--r--include/linux/wait.h184
-rw-r--r--include/linux/wireless.h4
-rw-r--r--include/linux/writeback.h18
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/zorro.h22
-rw-r--r--include/media/ak881x.h25
-rw-r--r--include/media/davinci/vpfe_capture.h2
-rw-r--r--include/media/ir-common.h74
-rw-r--r--include/media/ir-core.h142
-rw-r--r--include/media/ir-kbd-i2c.h6
-rw-r--r--include/media/rc-map.h121
-rw-r--r--include/media/saa7146_vv.h1
-rw-r--r--include/media/sh_vou.h34
-rw-r--r--include/media/soc_camera.h12
-rw-r--r--include/media/v4l2-chip-ident.h127
-rw-r--r--include/media/v4l2-common.h27
-rw-r--r--include/media/v4l2-dev.h5
-rw-r--r--include/media/v4l2-event.h67
-rw-r--r--include/media/v4l2-fh.h65
-rw-r--r--include/media/v4l2-ioctl.h7
-rw-r--r--include/media/v4l2-mem2mem.h201
-rw-r--r--include/media/v4l2-subdev.h70
-rw-r--r--include/media/videobuf-core.h35
-rw-r--r--include/media/videobuf-dma-sg.h26
-rw-r--r--include/media/videobuf-vmalloc.h12
-rw-r--r--include/net/af_unix.h20
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--include/net/bluetooth/l2cap.h41
-rw-r--r--include/net/caif/caif_dev.h103
-rw-r--r--include/net/caif/caif_device.h55
-rw-r--r--include/net/caif/caif_layer.h283
-rw-r--r--include/net/caif/cfcnfg.h140
-rw-r--r--include/net/caif/cfctrl.h139
-rw-r--r--include/net/caif/cffrml.h16
-rw-r--r--include/net/caif/cfmuxl.h22
-rw-r--r--include/net/caif/cfpkt.h274
-rw-r--r--include/net/caif/cfserl.h12
-rw-r--r--include/net/caif/cfsrvl.h56
-rw-r--r--include/net/cfg80211.h47
-rw-r--r--include/net/dn_fib.h4
-rw-r--r--include/net/dst.h83
-rw-r--r--include/net/fib_rules.h3
-rw-r--r--include/net/flow.h23
-rw-r--r--include/net/icmp.h11
-rw-r--r--include/net/if_inet6.h25
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/inet_timewait_sock.h4
-rw-r--r--include/net/ip.h9
-rw-r--r--include/net/ip6_fib.h29
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/ipv6.h10
-rw-r--r--include/net/iw_handler.h2
-rw-r--r--include/net/mac80211.h149
-rw-r--r--include/net/mld.h75
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/netns/generic.h9
-rw-r--r--include/net/netns/ipv4.h15
-rw-r--r--include/net/netns/ipv6.h14
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/raw.h13
-rw-r--r--include/net/route.h17
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/sm.h3
-rw-r--r--include/net/sctp/structs.h70
-rw-r--r--include/net/snmp.h31
-rw-r--r--include/net/sock.h194
-rw-r--r--include/net/tcp.h34
-rw-r--r--include/net/tipc/tipc.h16
-rw-r--r--include/net/transp_v6.h3
-rw-r--r--include/net/x25.h10
-rw-r--r--include/net/x25device.h1
-rw-r--r--include/net/xfrm.h19
-rw-r--r--include/pcmcia/cs.h19
-rw-r--r--include/pcmcia/ds.h36
-rw-r--r--include/pcmcia/mem_op.h116
-rw-r--r--include/pcmcia/ss.h15
-rw-r--r--include/rdma/ib_verbs.h7
-rw-r--r--include/scsi/Kbuild1
-rw-r--r--include/scsi/fc/fc_fcp.h1
-rw-r--r--include/scsi/fc_encode.h18
-rw-r--r--include/scsi/libfc.h29
-rw-r--r--include/scsi/libfcoe.h10
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_transport_fc.h2
-rw-r--r--include/sound/asound.h20
-rw-r--r--include/sound/es1688.h11
-rw-r--r--include/sound/info.h24
-rw-r--r--include/sound/jack.h8
-rw-r--r--include/sound/pcm.h3
-rw-r--r--include/sound/soc-dai.h7
-rw-r--r--include/sound/soc-dapm.h8
-rw-r--r--include/sound/soc.h61
-rw-r--r--include/sound/tlv320aic3x.h17
-rw-r--r--include/sound/tlv320dac33-plat.h1
-rw-r--r--include/sound/uda134x.h1
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm8903.h249
-rw-r--r--include/sound/wm8904.h110
-rw-r--r--include/sound/wm8960.h24
-rw-r--r--include/sound/wm9090.h28
-rw-r--r--include/trace/define_trace.h5
-rw-r--r--include/trace/events/kvm.h1
-rw-r--r--include/trace/events/lock.h55
-rw-r--r--include/trace/events/module.h18
-rw-r--r--include/trace/events/napi.h10
-rw-r--r--include/trace/events/sched.h32
-rw-r--r--include/trace/events/scsi.h345
-rw-r--r--include/trace/events/signal.h52
-rw-r--r--include/trace/ftrace.h59
380 files changed, 10996 insertions, 2583 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 5b2e5e80ecb0..5958d7845bd5 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -87,7 +87,7 @@
87#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) 87#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
88#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) 88#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) 89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
90#define AE_WAKE_ONLY_GPE (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) 90#define AE_NO_HANDLER (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) 91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
92 92
93#define AE_CODE_ENV_MAX 0x001B 93#define AE_CODE_ENV_MAX 0x001B
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index d7726685797e..5e952262d6ee 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -206,6 +206,7 @@
206#define ACPI_WARNING(plist) acpi_warning plist 206#define ACPI_WARNING(plist) acpi_warning plist
207#define ACPI_EXCEPTION(plist) acpi_exception plist 207#define ACPI_EXCEPTION(plist) acpi_exception plist
208#define ACPI_ERROR(plist) acpi_error plist 208#define ACPI_ERROR(plist) acpi_error plist
209#define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i)
209 210
210#else 211#else
211 212
@@ -215,6 +216,7 @@
215#define ACPI_WARNING(plist) 216#define ACPI_WARNING(plist)
216#define ACPI_EXCEPTION(plist) 217#define ACPI_EXCEPTION(plist)
217#define ACPI_ERROR(plist) 218#define ACPI_ERROR(plist)
219#define ACPI_DEBUG_OBJECT(obj,l,i)
218 220
219#endif /* ACPI_NO_ERROR_MESSAGES */ 221#endif /* ACPI_NO_ERROR_MESSAGES */
220 222
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index b396854b83b0..29bf945143e8 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -233,8 +233,8 @@ acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
233 * Interim function needed for PCI IRQ routing 233 * Interim function needed for PCI IRQ routing
234 */ 234 */
235void 235void
236acpi_os_derive_pci_id(acpi_handle rhandle, 236acpi_os_derive_pci_id(acpi_handle device,
237 acpi_handle chandle, struct acpi_pci_id **pci_id); 237 acpi_handle region, struct acpi_pci_id **pci_id);
238 238
239/* 239/*
240 * Miscellaneous 240 * Miscellaneous
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 4447a0461bae..0e4ab1fe5966 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20100121 50#define ACPI_CA_VERSION 0x20100428
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -67,6 +67,8 @@ extern u8 acpi_gbl_leave_wake_gpes_disabled;
67extern u8 acpi_gbl_use_default_register_widths; 67extern u8 acpi_gbl_use_default_register_widths;
68extern acpi_name acpi_gbl_trace_method_name; 68extern acpi_name acpi_gbl_trace_method_name;
69extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
70extern u8 acpi_gbl_enable_aml_debug_object;
71extern u8 acpi_gbl_copy_dsdt_locally;
70 72
71extern u32 acpi_current_gpe_count; 73extern u32 acpi_current_gpe_count;
72extern struct acpi_table_fadt acpi_gbl_FADT; 74extern struct acpi_table_fadt acpi_gbl_FADT;
@@ -164,7 +166,7 @@ acpi_get_devices(const char *HID,
164 void *context, void **return_value); 166 void *context, void **return_value);
165 167
166acpi_status 168acpi_status
167acpi_get_name(acpi_handle handle, 169acpi_get_name(acpi_handle object,
168 u32 name_type, struct acpi_buffer *ret_path_ptr); 170 u32 name_type, struct acpi_buffer *ret_path_ptr);
169 171
170acpi_status 172acpi_status
@@ -172,14 +174,12 @@ acpi_get_handle(acpi_handle parent,
172 acpi_string pathname, acpi_handle * ret_handle); 174 acpi_string pathname, acpi_handle * ret_handle);
173 175
174acpi_status 176acpi_status
175acpi_attach_data(acpi_handle obj_handle, 177acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
176 acpi_object_handler handler, void *data);
177 178
178acpi_status 179acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
179acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler);
180 180
181acpi_status 181acpi_status
182acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data); 182acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
183 183
184acpi_status 184acpi_status
185acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); 185acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
@@ -201,7 +201,7 @@ acpi_evaluate_object_typed(acpi_handle object,
201 acpi_object_type return_type); 201 acpi_object_type return_type);
202 202
203acpi_status 203acpi_status
204acpi_get_object_info(acpi_handle handle, 204acpi_get_object_info(acpi_handle object,
205 struct acpi_device_info **return_buffer); 205 struct acpi_device_info **return_buffer);
206 206
207acpi_status acpi_install_method(u8 *buffer); 207acpi_status acpi_install_method(u8 *buffer);
@@ -283,16 +283,17 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
283 */ 283 */
284acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action); 284acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action);
285 285
286acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type); 286acpi_status
287acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
287 288
288acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type); 289acpi_status
290acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type);
289 291
290acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); 292acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number);
291 293
292acpi_status 294acpi_status
293acpi_get_gpe_status(acpi_handle gpe_device, 295acpi_get_gpe_status(acpi_handle gpe_device,
294 u32 gpe_number, 296 u32 gpe_number, acpi_event_status *event_status);
295 u32 flags, acpi_event_status * event_status);
296 297
297acpi_status acpi_disable_all_gpes(void); 298acpi_status acpi_disable_all_gpes(void);
298 299
@@ -315,33 +316,29 @@ acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
315 void *context); 316 void *context);
316 317
317acpi_status 318acpi_status
318acpi_get_vendor_resource(acpi_handle device_handle, 319acpi_get_vendor_resource(acpi_handle device,
319 char *name, 320 char *name,
320 struct acpi_vendor_uuid *uuid, 321 struct acpi_vendor_uuid *uuid,
321 struct acpi_buffer *ret_buffer); 322 struct acpi_buffer *ret_buffer);
322 323
323acpi_status 324acpi_status
324acpi_get_current_resources(acpi_handle device_handle, 325acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
325 struct acpi_buffer *ret_buffer);
326 326
327#ifdef ACPI_FUTURE_USAGE 327#ifdef ACPI_FUTURE_USAGE
328acpi_status 328acpi_status
329acpi_get_possible_resources(acpi_handle device_handle, 329acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
330 struct acpi_buffer *ret_buffer);
331#endif 330#endif
332 331
333acpi_status 332acpi_status
334acpi_walk_resources(acpi_handle device_handle, 333acpi_walk_resources(acpi_handle device,
335 char *name, 334 char *name,
336 acpi_walk_resource_callback user_function, void *context); 335 acpi_walk_resource_callback user_function, void *context);
337 336
338acpi_status 337acpi_status
339acpi_set_current_resources(acpi_handle device_handle, 338acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer);
340 struct acpi_buffer *in_buffer);
341 339
342acpi_status 340acpi_status
343acpi_get_irq_routing_table(acpi_handle bus_device_handle, 341acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer);
344 struct acpi_buffer *ret_buffer);
345 342
346acpi_status 343acpi_status
347acpi_resource_to_address64(struct acpi_resource *resource, 344acpi_resource_to_address64(struct acpi_resource *resource,
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 5b02e307bff3..95f4d0ef4819 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -69,6 +69,7 @@
69#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ 69#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */
70#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 70#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
71#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 71#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
72#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
72#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 73#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
73#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 74#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
74#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 75#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
@@ -679,6 +680,32 @@ struct acpi_mcfg_allocation {
679 680
680/******************************************************************************* 681/*******************************************************************************
681 * 682 *
683 * MCHI - Management Controller Host Interface Table
684 * Version 1
685 *
686 * Conforms to "Management Component Transport Protocol (MCTP) Host
687 * Interface Specification", Revision 1.0.0a, October 13, 2009
688 *
689 ******************************************************************************/
690
691struct acpi_table_mchi {
692 struct acpi_table_header header; /* Common ACPI table header */
693 u8 interface_type;
694 u8 protocol;
695 u64 protocol_data;
696 u8 interrupt_type;
697 u8 gpe;
698 u8 pci_device_flag;
699 u32 global_interrupt;
700 struct acpi_generic_address control_register;
701 u8 pci_segment;
702 u8 pci_bus;
703 u8 pci_device;
704 u8 pci_function;
705};
706
707/*******************************************************************************
708 *
682 * SPCR - Serial Port Console Redirection table 709 * SPCR - Serial Port Console Redirection table
683 * Version 1 710 * Version 1
684 * 711 *
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3f08e64962f8..bade172cad47 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -663,44 +663,42 @@ typedef u32 acpi_event_status;
663#define ACPI_GPE_MAX 0xFF 663#define ACPI_GPE_MAX 0xFF
664#define ACPI_NUM_GPE 256 664#define ACPI_NUM_GPE 256
665 665
666/* Actions for acpi_set_gpe */
667
666#define ACPI_GPE_ENABLE 0 668#define ACPI_GPE_ENABLE 0
667#define ACPI_GPE_DISABLE 1 669#define ACPI_GPE_DISABLE 1
668 670
671/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */
672
673#define ACPI_GPE_TYPE_WAKE (u8) 0x01
674#define ACPI_GPE_TYPE_RUNTIME (u8) 0x02
675#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x03
676
669/* 677/*
670 * GPE info flags - Per GPE 678 * GPE info flags - Per GPE
671 * +-+-+-+---+-+-+-+ 679 * +-------+---+-+-+
672 * |7|6|5|4:3|2|1|0| 680 * | 7:4 |3:2|1|0|
673 * +-+-+-+---+-+-+-+ 681 * +-------+---+-+-+
674 * | | | | | | | 682 * | | | |
675 * | | | | | | +--- Interrupt type: Edge or Level Triggered 683 * | | | +--- Interrupt type: edge or level triggered
676 * | | | | | +--- GPE can wake the system 684 * | | +----- GPE can wake the system
677 * | | | | +--- Unused 685 * | +-------- Type of dispatch:to method, handler, or none
678 * | | | +--- Type of dispatch -- to method, handler, or none 686 * +-------------- <Reserved>
679 * | | +--- Unused
680 * | +--- Unused
681 * +--- Unused
682 */ 687 */
683#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 688#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
684#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 689#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
685#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 690#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00
686 691
687#define ACPI_GPE_TYPE_MASK (u8) 0x06
688#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06
689#define ACPI_GPE_TYPE_WAKE (u8) 0x02
690#define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */
691#define ACPI_GPE_CAN_WAKE (u8) 0x02 692#define ACPI_GPE_CAN_WAKE (u8) 0x02
692 693
693#define ACPI_GPE_DISPATCH_MASK (u8) 0x18 694#define ACPI_GPE_DISPATCH_MASK (u8) 0x0C
694#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 695#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x04
695#define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 696#define ACPI_GPE_DISPATCH_METHOD (u8) 0x08
696#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ 697#define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00
697 698
698/* 699/*
699 * Flags for GPE and Lock interfaces 700 * Flags for GPE and Lock interfaces
700 */ 701 */
701#define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */
702#define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */
703
704#define ACPI_NOT_ISR 0x1 702#define ACPI_NOT_ISR 0x1
705#define ACPI_ISR 0x0 703#define ACPI_ISR 0x0
706 704
@@ -953,7 +951,7 @@ acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
953#define ACPI_REGION_DEACTIVATE 1 951#define ACPI_REGION_DEACTIVATE 1
954 952
955typedef 953typedef
956acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, 954acpi_status(*acpi_walk_callback) (acpi_handle object,
957 u32 nesting_level, 955 u32 nesting_level,
958 void *context, void **return_value); 956 void *context, void **return_value);
959 957
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index c99c64dc5f3d..c33749f95b32 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -33,7 +33,7 @@
33 * Atomically reads the value of @v. Note that the guaranteed 33 * Atomically reads the value of @v. Note that the guaranteed
34 * useful range of an atomic_t is only 24 bits. 34 * useful range of an atomic_t is only 24 bits.
35 */ 35 */
36#define atomic_read(v) ((v)->counter) 36#define atomic_read(v) (*(volatile int *)&(v)->counter)
37 37
38/** 38/**
39 * atomic_set - set atomic variable 39 * atomic_set - set atomic variable
diff --git a/include/asm-generic/bitops/arch_hweight.h b/include/asm-generic/bitops/arch_hweight.h
new file mode 100644
index 000000000000..6a211f40665c
--- /dev/null
+++ b/include/asm-generic/bitops/arch_hweight.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
3
4#include <asm/types.h>
5
6static inline unsigned int __arch_hweight32(unsigned int w)
7{
8 return __sw_hweight32(w);
9}
10
11static inline unsigned int __arch_hweight16(unsigned int w)
12{
13 return __sw_hweight16(w);
14}
15
16static inline unsigned int __arch_hweight8(unsigned int w)
17{
18 return __sw_hweight8(w);
19}
20
21static inline unsigned long __arch_hweight64(__u64 w)
22{
23 return __sw_hweight64(w);
24}
25#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h
new file mode 100644
index 000000000000..fa2a50b7ee66
--- /dev/null
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
3
4/*
5 * Compile time versions of __arch_hweightN()
6 */
7#define __const_hweight8(w) \
8 ( (!!((w) & (1ULL << 0))) + \
9 (!!((w) & (1ULL << 1))) + \
10 (!!((w) & (1ULL << 2))) + \
11 (!!((w) & (1ULL << 3))) + \
12 (!!((w) & (1ULL << 4))) + \
13 (!!((w) & (1ULL << 5))) + \
14 (!!((w) & (1ULL << 6))) + \
15 (!!((w) & (1ULL << 7))) )
16
17#define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
18#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
19#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
20
21/*
22 * Generic interface.
23 */
24#define hweight8(w) (__builtin_constant_p(w) ? __const_hweight8(w) : __arch_hweight8(w))
25#define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w))
26#define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
27#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
28
29/*
30 * Interface for known constant arguments
31 */
32#define HWEIGHT8(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w))
33#define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w))
34#define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w))
35#define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w))
36
37/*
38 * Type invariant interface to the compile time constant hweight functions.
39 */
40#define HWEIGHT(w) HWEIGHT64((u64)w)
41
42#endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */
diff --git a/include/asm-generic/bitops/hweight.h b/include/asm-generic/bitops/hweight.h
index fbbc383771da..a94d6519c7ed 100644
--- a/include/asm-generic/bitops/hweight.h
+++ b/include/asm-generic/bitops/hweight.h
@@ -1,11 +1,7 @@
1#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_ 1#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_HWEIGHT_H_ 2#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
3 3
4#include <asm/types.h> 4#include <asm-generic/bitops/arch_hweight.h>
5 5#include <asm-generic/bitops/const_hweight.h>
6extern unsigned int hweight32(unsigned int w);
7extern unsigned int hweight16(unsigned int w);
8extern unsigned int hweight8(unsigned int w);
9extern unsigned long hweight64(__u64 w);
10 6
11#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */ 7#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 18c435d7c082..c2c9ba032d46 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -25,7 +25,10 @@ struct bug_entry {
25}; 25};
26#endif /* __ASSEMBLY__ */ 26#endif /* __ASSEMBLY__ */
27 27
28#define BUGFLAG_WARNING (1<<0) 28#define BUGFLAG_WARNING (1 << 0)
29#define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8))
30#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
31
29#endif /* CONFIG_GENERIC_BUG */ 32#endif /* CONFIG_GENERIC_BUG */
30 33
31/* 34/*
@@ -56,17 +59,25 @@ struct bug_entry {
56 * appear at runtime. Use the versions with printk format strings 59 * appear at runtime. Use the versions with printk format strings
57 * to provide better diagnostics. 60 * to provide better diagnostics.
58 */ 61 */
59#ifndef __WARN 62#ifndef __WARN_TAINT
60#ifndef __ASSEMBLY__ 63#ifndef __ASSEMBLY__
61extern void warn_slowpath_fmt(const char *file, const int line, 64extern void warn_slowpath_fmt(const char *file, const int line,
62 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 65 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
66extern void warn_slowpath_fmt_taint(const char *file, const int line,
67 unsigned taint, const char *fmt, ...)
68 __attribute__((format(printf, 4, 5)));
63extern void warn_slowpath_null(const char *file, const int line); 69extern void warn_slowpath_null(const char *file, const int line);
64#define WANT_WARN_ON_SLOWPATH 70#define WANT_WARN_ON_SLOWPATH
65#endif 71#endif
66#define __WARN() warn_slowpath_null(__FILE__, __LINE__) 72#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
67#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) 73#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
74#define __WARN_printf_taint(taint, arg...) \
75 warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
68#else 76#else
77#define __WARN() __WARN_TAINT(TAINT_WARN)
69#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 78#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
79#define __WARN_printf_taint(taint, arg...) \
80 do { printk(arg); __WARN_TAINT(taint); } while (0)
70#endif 81#endif
71 82
72#ifndef WARN_ON 83#ifndef WARN_ON
@@ -87,6 +98,13 @@ extern void warn_slowpath_null(const char *file, const int line);
87}) 98})
88#endif 99#endif
89 100
101#define WARN_TAINT(condition, taint, format...) ({ \
102 int __ret_warn_on = !!(condition); \
103 if (unlikely(__ret_warn_on)) \
104 __WARN_printf_taint(taint, format); \
105 unlikely(__ret_warn_on); \
106})
107
90#else /* !CONFIG_BUG */ 108#else /* !CONFIG_BUG */
91#ifndef HAVE_ARCH_BUG 109#ifndef HAVE_ARCH_BUG
92#define BUG() do {} while(0) 110#define BUG() do {} while(0)
@@ -110,6 +128,8 @@ extern void warn_slowpath_null(const char *file, const int line);
110}) 128})
111#endif 129#endif
112 130
131#define WARN_TAINT(condition, taint, format...) WARN_ON(condition)
132
113#endif 133#endif
114 134
115#define WARN_ON_ONCE(condition) ({ \ 135#define WARN_ON_ONCE(condition) ({ \
@@ -132,6 +152,16 @@ extern void warn_slowpath_null(const char *file, const int line);
132 unlikely(__ret_warn_once); \ 152 unlikely(__ret_warn_once); \
133}) 153})
134 154
155#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
156 static bool __warned; \
157 int __ret_warn_once = !!(condition); \
158 \
159 if (unlikely(__ret_warn_once)) \
160 if (WARN_TAINT(!__warned, taint, format)) \
161 __warned = true; \
162 unlikely(__ret_warn_once); \
163})
164
135#define WARN_ON_RATELIMIT(condition, state) \ 165#define WARN_ON_RATELIMIT(condition, state) \
136 WARN_ON((condition) && __ratelimit(state)) 166 WARN_ON((condition) && __ratelimit(state))
137 167
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index e694263445f7..69206957b72c 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -131,7 +131,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
131 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir); 131 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
132 132
133 } else 133 } else
134 dma_sync_single_for_cpu(dev, addr, size, dir); 134 dma_sync_single_for_cpu(dev, addr + offset, size, dir);
135} 135}
136 136
137static inline void dma_sync_single_range_for_device(struct device *dev, 137static inline void dma_sync_single_range_for_device(struct device *dev,
@@ -148,7 +148,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
148 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir); 148 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
149 149
150 } else 150 } else
151 dma_sync_single_for_device(dev, addr, size, dir); 151 dma_sync_single_for_device(dev, addr + offset, size, dir);
152} 152}
153 153
154static inline void 154static inline void
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
index e5f234a08540..97e807c8c812 100644
--- a/include/asm-generic/kmap_types.h
+++ b/include/asm-generic/kmap_types.h
@@ -28,7 +28,8 @@ KMAP_D(15) KM_UML_USERCOPY,
28KMAP_D(16) KM_IRQ_PTE, 28KMAP_D(16) KM_IRQ_PTE,
29KMAP_D(17) KM_NMI, 29KMAP_D(17) KM_NMI,
30KMAP_D(18) KM_NMI_PTE, 30KMAP_D(18) KM_NMI_PTE,
31KMAP_D(19) KM_TYPE_NR 31KMAP_D(19) KM_KDB,
32KMAP_D(20) KM_TYPE_NR
32}; 33};
33 34
34#undef KMAP_D 35#undef KMAP_D
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index fc0d575c71e0..59c3e5bd2c06 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -103,6 +103,23 @@ struct blkcipher_walk {
103 unsigned int blocksize; 103 unsigned int blocksize;
104}; 104};
105 105
106struct ablkcipher_walk {
107 struct {
108 struct page *page;
109 unsigned int offset;
110 } src, dst;
111
112 struct scatter_walk in;
113 unsigned int nbytes;
114 struct scatter_walk out;
115 unsigned int total;
116 struct list_head buffers;
117 u8 *iv_buffer;
118 u8 *iv;
119 int flags;
120 unsigned int blocksize;
121};
122
106extern const struct crypto_type crypto_ablkcipher_type; 123extern const struct crypto_type crypto_ablkcipher_type;
107extern const struct crypto_type crypto_aead_type; 124extern const struct crypto_type crypto_aead_type;
108extern const struct crypto_type crypto_blkcipher_type; 125extern const struct crypto_type crypto_blkcipher_type;
@@ -173,6 +190,12 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
173 struct blkcipher_walk *walk, 190 struct blkcipher_walk *walk,
174 unsigned int blocksize); 191 unsigned int blocksize);
175 192
193int ablkcipher_walk_done(struct ablkcipher_request *req,
194 struct ablkcipher_walk *walk, int err);
195int ablkcipher_walk_phys(struct ablkcipher_request *req,
196 struct ablkcipher_walk *walk);
197void __ablkcipher_walk_complete(struct ablkcipher_walk *walk);
198
176static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) 199static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
177{ 200{
178 return PTR_ALIGN(crypto_tfm_ctx(tfm), 201 return PTR_ALIGN(crypto_tfm_ctx(tfm),
@@ -283,6 +306,23 @@ static inline void blkcipher_walk_init(struct blkcipher_walk *walk,
283 walk->total = nbytes; 306 walk->total = nbytes;
284} 307}
285 308
309static inline void ablkcipher_walk_init(struct ablkcipher_walk *walk,
310 struct scatterlist *dst,
311 struct scatterlist *src,
312 unsigned int nbytes)
313{
314 walk->in.sg = src;
315 walk->out.sg = dst;
316 walk->total = nbytes;
317 INIT_LIST_HEAD(&walk->buffers);
318}
319
320static inline void ablkcipher_walk_complete(struct ablkcipher_walk *walk)
321{
322 if (unlikely(!list_empty(&walk->buffers)))
323 __ablkcipher_walk_complete(walk);
324}
325
286static inline struct crypto_async_request *crypto_get_backlog( 326static inline struct crypto_async_request *crypto_get_backlog(
287 struct crypto_queue *queue) 327 struct crypto_queue *queue)
288{ 328{
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2f3b3a00b7a3..c1b987158dfa 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1428,10 +1428,13 @@ extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1428/* Graphics Execution Manager library functions (drm_gem.c) */ 1428/* Graphics Execution Manager library functions (drm_gem.c) */
1429int drm_gem_init(struct drm_device *dev); 1429int drm_gem_init(struct drm_device *dev);
1430void drm_gem_destroy(struct drm_device *dev); 1430void drm_gem_destroy(struct drm_device *dev);
1431void drm_gem_object_release(struct drm_gem_object *obj);
1431void drm_gem_object_free(struct kref *kref); 1432void drm_gem_object_free(struct kref *kref);
1432void drm_gem_object_free_unlocked(struct kref *kref); 1433void drm_gem_object_free_unlocked(struct kref *kref);
1433struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1434struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1434 size_t size); 1435 size_t size);
1436int drm_gem_object_init(struct drm_device *dev,
1437 struct drm_gem_object *obj, size_t size);
1435void drm_gem_object_handle_free(struct kref *kref); 1438void drm_gem_object_handle_free(struct kref *kref);
1436void drm_gem_vm_open(struct vm_area_struct *vma); 1439void drm_gem_vm_open(struct vm_area_struct *vma);
1437void drm_gem_vm_close(struct vm_area_struct *vma); 1440void drm_gem_vm_close(struct vm_area_struct *vma);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 1347524a8e30..93a1a31b9c2d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -31,6 +31,7 @@
31#include <linux/idr.h> 31#include <linux/idr.h>
32 32
33#include <linux/fb.h> 33#include <linux/fb.h>
34#include <linux/slow-work.h>
34 35
35struct drm_device; 36struct drm_device;
36struct drm_mode_set; 37struct drm_mode_set;
@@ -271,8 +272,6 @@ struct drm_framebuffer {
271 unsigned int depth; 272 unsigned int depth;
272 int bits_per_pixel; 273 int bits_per_pixel;
273 int flags; 274 int flags;
274 struct fb_info *fbdev;
275 u32 pseudo_palette[17];
276 struct list_head filp_head; 275 struct list_head filp_head;
277 /* if you are using the helper */ 276 /* if you are using the helper */
278 void *helper_private; 277 void *helper_private;
@@ -369,9 +368,6 @@ struct drm_crtc_funcs {
369 * @enabled: is this CRTC enabled? 368 * @enabled: is this CRTC enabled?
370 * @x: x position on screen 369 * @x: x position on screen
371 * @y: y position on screen 370 * @y: y position on screen
372 * @desired_mode: new desired mode
373 * @desired_x: desired x for desired_mode
374 * @desired_y: desired y for desired_mode
375 * @funcs: CRTC control functions 371 * @funcs: CRTC control functions
376 * 372 *
377 * Each CRTC may have one or more connectors associated with it. This structure 373 * Each CRTC may have one or more connectors associated with it. This structure
@@ -391,8 +387,6 @@ struct drm_crtc {
391 struct drm_display_mode mode; 387 struct drm_display_mode mode;
392 388
393 int x, y; 389 int x, y;
394 struct drm_display_mode *desired_mode;
395 int desired_x, desired_y;
396 const struct drm_crtc_funcs *funcs; 390 const struct drm_crtc_funcs *funcs;
397 391
398 /* CRTC gamma size for reporting to userspace */ 392 /* CRTC gamma size for reporting to userspace */
@@ -467,6 +461,15 @@ enum drm_connector_force {
467 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */ 461 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
468}; 462};
469 463
464/* should we poll this connector for connects and disconnects */
465/* hot plug detectable */
466#define DRM_CONNECTOR_POLL_HPD (1 << 0)
467/* poll for connections */
468#define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
469/* can cleanly poll for disconnections without flickering the screen */
470/* DACs should rarely do this without a lot of testing */
471#define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
472
470/** 473/**
471 * drm_connector - central DRM connector control structure 474 * drm_connector - central DRM connector control structure
472 * @crtc: CRTC this connector is currently connected to, NULL if none 475 * @crtc: CRTC this connector is currently connected to, NULL if none
@@ -511,6 +514,8 @@ struct drm_connector {
511 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 514 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
512 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; 515 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
513 516
517 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
518
514 /* requested DPMS state */ 519 /* requested DPMS state */
515 int dpms; 520 int dpms;
516 521
@@ -521,7 +526,6 @@ struct drm_connector {
521 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 526 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
522 uint32_t force_encoder_id; 527 uint32_t force_encoder_id;
523 struct drm_encoder *encoder; /* currently active encoder */ 528 struct drm_encoder *encoder; /* currently active encoder */
524 void *fb_helper_private;
525}; 529};
526 530
527/** 531/**
@@ -548,16 +552,10 @@ struct drm_mode_set {
548 552
549/** 553/**
550 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 554 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout
551 * @resize: adjust CRTCs as necessary for the proposed layout
552 *
553 * Currently only a resize hook is available. DRM will call back into the
554 * driver with a new screen width and height. If the driver can't support
555 * the proposed size, it can return false. Otherwise it should adjust
556 * the CRTC<->connector mappings as needed and update its view of the screen.
557 */ 555 */
558struct drm_mode_config_funcs { 556struct drm_mode_config_funcs {
559 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 557 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd);
560 int (*fb_changed)(struct drm_device *dev); 558 void (*output_poll_changed)(struct drm_device *dev);
561}; 559};
562 560
563struct drm_mode_group { 561struct drm_mode_group {
@@ -590,14 +588,15 @@ struct drm_mode_config {
590 588
591 struct list_head property_list; 589 struct list_head property_list;
592 590
593 /* in-kernel framebuffers - hung of filp_head in drm_framebuffer */
594 struct list_head fb_kernel_list;
595
596 int min_width, min_height; 591 int min_width, min_height;
597 int max_width, max_height; 592 int max_width, max_height;
598 struct drm_mode_config_funcs *funcs; 593 struct drm_mode_config_funcs *funcs;
599 resource_size_t fb_base; 594 resource_size_t fb_base;
600 595
596 /* output poll support */
597 bool poll_enabled;
598 struct delayed_slow_work output_poll_slow_work;
599
601 /* pointers to standard properties */ 600 /* pointers to standard properties */
602 struct list_head property_blob_list; 601 struct list_head property_blob_list;
603 struct drm_property *edid_property; 602 struct drm_property *edid_property;
@@ -666,8 +665,6 @@ extern void drm_fb_release(struct drm_file *file_priv);
666extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 665extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
667extern struct edid *drm_get_edid(struct drm_connector *connector, 666extern struct edid *drm_get_edid(struct drm_connector *connector,
668 struct i2c_adapter *adapter); 667 struct i2c_adapter *adapter);
669extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
670 unsigned char *buf, int len);
671extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 668extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
672extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 669extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
673extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 670extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -799,8 +796,14 @@ extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
799extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, 796extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
800 int hdisplay, int vdisplay, int vrefresh, 797 int hdisplay, int vdisplay, int vrefresh,
801 bool interlaced, int margins); 798 bool interlaced, int margins);
799extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
800 int hdisplay, int vdisplay, int vrefresh,
801 bool interlaced, int margins, int GTF_M,
802 int GTF_2C, int GTF_K, int GTF_2J);
802extern int drm_add_modes_noedid(struct drm_connector *connector, 803extern int drm_add_modes_noedid(struct drm_connector *connector,
803 int hdisplay, int vdisplay); 804 int hdisplay, int vdisplay);
804 805
805extern bool drm_edid_is_valid(struct edid *edid); 806extern bool drm_edid_is_valid(struct edid *edid);
807struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
808 int hsize, int vsize, int fresh);
806#endif /* __DRM_CRTC_H__ */ 809#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b29e20168b5f..dc5873c21e45 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -39,7 +39,6 @@
39 39
40#include <linux/fb.h> 40#include <linux/fb.h>
41 41
42#include "drm_fb_helper.h"
43struct drm_crtc_helper_funcs { 42struct drm_crtc_helper_funcs {
44 /* 43 /*
45 * Control power levels on the CRTC. If the mode passed in is 44 * Control power levels on the CRTC. If the mode passed in is
@@ -96,8 +95,6 @@ struct drm_connector_helper_funcs {
96 95
97extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 96extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
98extern void drm_helper_disable_unused_functions(struct drm_device *dev); 97extern void drm_helper_disable_unused_functions(struct drm_device *dev);
99extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
100extern bool drm_helper_initial_config(struct drm_device *dev);
101extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 98extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
102extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 99extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
103 struct drm_display_mode *mode, 100 struct drm_display_mode *mode,
@@ -123,12 +120,14 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder,
123 encoder->helper_private = (void *)funcs; 120 encoder->helper_private = (void *)funcs;
124} 121}
125 122
126static inline int drm_connector_helper_add(struct drm_connector *connector, 123static inline void drm_connector_helper_add(struct drm_connector *connector,
127 const struct drm_connector_helper_funcs *funcs) 124 const struct drm_connector_helper_funcs *funcs)
128{ 125{
129 connector->helper_private = (void *)funcs; 126 connector->helper_private = (void *)funcs;
130 return drm_fb_helper_add_connector(connector);
131} 127}
132 128
133extern int drm_helper_resume_force_mode(struct drm_device *dev); 129extern int drm_helper_resume_force_mode(struct drm_device *dev);
130extern void drm_kms_helper_poll_init(struct drm_device *dev);
131extern void drm_kms_helper_poll_fini(struct drm_device *dev);
132extern void drm_helper_hpd_irq_event(struct drm_device *dev);
134#endif 133#endif
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b4209898f115..39e2cc5c7e66 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -120,7 +120,7 @@ struct detailed_non_pixel {
120 struct detailed_data_string str; 120 struct detailed_data_string str;
121 struct detailed_data_monitor_range range; 121 struct detailed_data_monitor_range range;
122 struct detailed_data_wpindex color; 122 struct detailed_data_wpindex color;
123 struct std_timing timings[5]; 123 struct std_timing timings[6];
124 struct cvt_timing cvt[4]; 124 struct cvt_timing cvt[4];
125 } data; 125 } data;
126} __attribute__((packed)); 126} __attribute__((packed));
@@ -201,7 +201,4 @@ struct edid {
201 201
202#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) 202#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
203 203
204/* define the number of Extension EDID block */
205#define DRM_MAX_EDID_EXT_NUM 4
206
207#endif /* __DRM_EDID_H__ */ 204#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 58c892a2cbfa..f0a6afc47e76 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -30,17 +30,12 @@
30#ifndef DRM_FB_HELPER_H 30#ifndef DRM_FB_HELPER_H
31#define DRM_FB_HELPER_H 31#define DRM_FB_HELPER_H
32 32
33struct drm_fb_helper;
34
33struct drm_fb_helper_crtc { 35struct drm_fb_helper_crtc {
34 uint32_t crtc_id; 36 uint32_t crtc_id;
35 struct drm_mode_set mode_set; 37 struct drm_mode_set mode_set;
36}; 38 struct drm_display_mode *desired_mode;
37
38
39struct drm_fb_helper_funcs {
40 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
41 u16 blue, int regno);
42 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
43 u16 *blue, int regno);
44}; 39};
45 40
46/* mode specified on the command line */ 41/* mode specified on the command line */
@@ -57,8 +52,28 @@ struct drm_fb_helper_cmdline_mode {
57 bool margins; 52 bool margins;
58}; 53};
59 54
55struct drm_fb_helper_surface_size {
56 u32 fb_width;
57 u32 fb_height;
58 u32 surface_width;
59 u32 surface_height;
60 u32 surface_bpp;
61 u32 surface_depth;
62};
63
64struct drm_fb_helper_funcs {
65 void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green,
66 u16 blue, int regno);
67 void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green,
68 u16 *blue, int regno);
69
70 int (*fb_probe)(struct drm_fb_helper *helper,
71 struct drm_fb_helper_surface_size *sizes);
72};
73
60struct drm_fb_helper_connector { 74struct drm_fb_helper_connector {
61 struct drm_fb_helper_cmdline_mode cmdline_mode; 75 struct drm_fb_helper_cmdline_mode cmdline_mode;
76 struct drm_connector *connector;
62}; 77};
63 78
64struct drm_fb_helper { 79struct drm_fb_helper {
@@ -67,24 +82,26 @@ struct drm_fb_helper {
67 struct drm_display_mode *mode; 82 struct drm_display_mode *mode;
68 int crtc_count; 83 int crtc_count;
69 struct drm_fb_helper_crtc *crtc_info; 84 struct drm_fb_helper_crtc *crtc_info;
85 int connector_count;
86 struct drm_fb_helper_connector **connector_info;
70 struct drm_fb_helper_funcs *funcs; 87 struct drm_fb_helper_funcs *funcs;
71 int conn_limit; 88 int conn_limit;
89 struct fb_info *fbdev;
90 u32 pseudo_palette[17];
72 struct list_head kernel_fb_list; 91 struct list_head kernel_fb_list;
92
93 /* we got a hotplug but fbdev wasn't running the console
94 delay until next set_par */
95 bool delayed_hotplug;
73}; 96};
74 97
75int drm_fb_helper_single_fb_probe(struct drm_device *dev, 98int drm_fb_helper_single_fb_probe(struct drm_fb_helper *helper,
76 int preferred_bpp, 99 int preferred_bpp);
77 int (*fb_create)(struct drm_device *dev, 100
78 uint32_t fb_width, 101int drm_fb_helper_init(struct drm_device *dev,
79 uint32_t fb_height, 102 struct drm_fb_helper *helper, int crtc_count,
80 uint32_t surface_width, 103 int max_conn);
81 uint32_t surface_height, 104void drm_fb_helper_fini(struct drm_fb_helper *helper);
82 uint32_t surface_depth,
83 uint32_t surface_bpp,
84 struct drm_framebuffer **fb_ptr));
85int drm_fb_helper_init_crtc_count(struct drm_fb_helper *helper, int crtc_count,
86 int max_conn);
87void drm_fb_helper_free(struct drm_fb_helper *helper);
88int drm_fb_helper_blank(int blank, struct fb_info *info); 105int drm_fb_helper_blank(int blank, struct fb_info *info);
89int drm_fb_helper_pan_display(struct fb_var_screeninfo *var, 106int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
90 struct fb_info *info); 107 struct fb_info *info);
@@ -99,13 +116,15 @@ int drm_fb_helper_setcolreg(unsigned regno,
99 struct fb_info *info); 116 struct fb_info *info);
100 117
101void drm_fb_helper_restore(void); 118void drm_fb_helper_restore(void);
102void drm_fb_helper_fill_var(struct fb_info *info, struct drm_framebuffer *fb, 119void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
103 uint32_t fb_width, uint32_t fb_height); 120 uint32_t fb_width, uint32_t fb_height);
104void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 121void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
105 uint32_t depth); 122 uint32_t depth);
106 123
107int drm_fb_helper_add_connector(struct drm_connector *connector);
108int drm_fb_helper_parse_command_line(struct drm_device *dev);
109int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 124int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
110 125
126bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
127bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
128int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
129
111#endif 130#endif
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
new file mode 100644
index 000000000000..4a08a664ff1f
--- /dev/null
+++ b/include/drm/drm_fixed.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2009 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Dave Airlie
23 */
24#ifndef DRM_FIXED_H
25#define DRM_FIXED_H
26
27typedef union dfixed {
28 u32 full;
29} fixed20_12;
30
31
32#define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */
33#define dfixed_const_half(A) (u32)(((A) << 12) + 2048)
34#define dfixed_const_666(A) (u32)(((A) << 12) + 2731)
35#define dfixed_const_8(A) (u32)(((A) << 12) + 3277)
36#define dfixed_mul(A, B) ((u64)((u64)(A).full * (B).full + 2048) >> 12)
37#define dfixed_init(A) { .full = dfixed_const((A)) }
38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
39#define dfixed_trunc(A) ((A).full >> 12)
40
41static inline u32 dfixed_floor(fixed20_12 A)
42{
43 u32 non_frac = dfixed_trunc(A);
44
45 return dfixed_const(non_frac);
46}
47
48static inline u32 dfixed_ceil(fixed20_12 A)
49{
50 u32 non_frac = dfixed_trunc(A);
51
52 if (A.full > dfixed_const(non_frac))
53 return dfixed_const(non_frac + 1);
54 else
55 return dfixed_const(non_frac);
56}
57
58static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B)
59{
60 u64 tmp = ((u64)A.full << 13);
61
62 do_div(tmp, B.full);
63 tmp += 1;
64 tmp /= 2;
65 return lower_32_bits(tmp);
66}
67#endif
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 81e614bf2dc3..3ff9fc071dfe 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -902,6 +902,7 @@ struct drm_radeon_cs {
902#define RADEON_INFO_NUM_GB_PIPES 0x01 902#define RADEON_INFO_NUM_GB_PIPES 0x01
903#define RADEON_INFO_NUM_Z_PIPES 0x02 903#define RADEON_INFO_NUM_Z_PIPES 0x02
904#define RADEON_INFO_ACCEL_WORKING 0x03 904#define RADEON_INFO_ACCEL_WORKING 0x03
905#define RADEON_INFO_CRTC_FROM_ID 0x04
905 906
906struct drm_radeon_info { 907struct drm_radeon_info {
907 uint32_t request; 908 uint32_t request;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 81eb9f45883c..267a86c74e2e 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -66,6 +66,26 @@ struct ttm_placement {
66 const uint32_t *busy_placement; 66 const uint32_t *busy_placement;
67}; 67};
68 68
69/**
70 * struct ttm_bus_placement
71 *
72 * @addr: mapped virtual address
73 * @base: bus base address
74 * @is_iomem: is this io memory ?
75 * @size: size in byte
76 * @offset: offset from the base address
77 *
78 * Structure indicating the bus placement of an object.
79 */
80struct ttm_bus_placement {
81 void *addr;
82 unsigned long base;
83 unsigned long size;
84 unsigned long offset;
85 bool is_iomem;
86 bool io_reserved;
87};
88
69 89
70/** 90/**
71 * struct ttm_mem_reg 91 * struct ttm_mem_reg
@@ -75,6 +95,7 @@ struct ttm_placement {
75 * @num_pages: Actual size of memory region in pages. 95 * @num_pages: Actual size of memory region in pages.
76 * @page_alignment: Page alignment. 96 * @page_alignment: Page alignment.
77 * @placement: Placement flags. 97 * @placement: Placement flags.
98 * @bus: Placement on io bus accessible to the CPU
78 * 99 *
79 * Structure indicating the placement and space resources used by a 100 * Structure indicating the placement and space resources used by a
80 * buffer object. 101 * buffer object.
@@ -87,6 +108,7 @@ struct ttm_mem_reg {
87 uint32_t page_alignment; 108 uint32_t page_alignment;
88 uint32_t mem_type; 109 uint32_t mem_type;
89 uint32_t placement; 110 uint32_t placement;
111 struct ttm_bus_placement bus;
90}; 112};
91 113
92/** 114/**
@@ -274,6 +296,7 @@ struct ttm_bo_kmap_obj {
274 ttm_bo_map_kmap = 3, 296 ttm_bo_map_kmap = 3,
275 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, 297 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
276 } bo_kmap_type; 298 } bo_kmap_type;
299 struct ttm_buffer_object *bo;
277}; 300};
278 301
279/** 302/**
@@ -313,7 +336,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
313 * @bo: The buffer object. 336 * @bo: The buffer object.
314 * @placement: Proposed placement for the buffer object. 337 * @placement: Proposed placement for the buffer object.
315 * @interruptible: Sleep interruptible if sleeping. 338 * @interruptible: Sleep interruptible if sleeping.
316 * @no_wait: Return immediately if the buffer is busy. 339 * @no_wait_reserve: Return immediately if other buffers are busy.
340 * @no_wait_gpu: Return immediately if the GPU is busy.
317 * 341 *
318 * Changes placement and caching policy of the buffer object 342 * Changes placement and caching policy of the buffer object
319 * according proposed placement. 343 * according proposed placement.
@@ -325,7 +349,8 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
325 */ 349 */
326extern int ttm_bo_validate(struct ttm_buffer_object *bo, 350extern int ttm_bo_validate(struct ttm_buffer_object *bo,
327 struct ttm_placement *placement, 351 struct ttm_placement *placement,
328 bool interruptible, bool no_wait); 352 bool interruptible, bool no_wait_reserve,
353 bool no_wait_gpu);
329 354
330/** 355/**
331 * ttm_bo_unref 356 * ttm_bo_unref
@@ -337,6 +362,23 @@ extern int ttm_bo_validate(struct ttm_buffer_object *bo,
337extern void ttm_bo_unref(struct ttm_buffer_object **bo); 362extern void ttm_bo_unref(struct ttm_buffer_object **bo);
338 363
339/** 364/**
365 * ttm_bo_lock_delayed_workqueue
366 *
367 * Prevent the delayed workqueue from running.
368 * Returns
369 * True if the workqueue was queued at the time
370 */
371extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
372
373/**
374 * ttm_bo_unlock_delayed_workqueue
375 *
376 * Allows the delayed workqueue to run.
377 */
378extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
379 int resched);
380
381/**
340 * ttm_bo_synccpu_write_grab 382 * ttm_bo_synccpu_write_grab
341 * 383 *
342 * @bo: The buffer object: 384 * @bo: The buffer object:
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index e929c27ede22..0ea602da43e7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -176,8 +176,6 @@ struct ttm_tt {
176 176
177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 177#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ 178#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
179#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
180 before kernel access. */
181#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ 179#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
182 180
183/** 181/**
@@ -189,13 +187,6 @@ struct ttm_tt {
189 * managed by this memory type. 187 * managed by this memory type.
190 * @gpu_offset: If used, the GPU offset of the first managed page of 188 * @gpu_offset: If used, the GPU offset of the first managed page of
191 * fixed memory or the first managed location in an aperture. 189 * fixed memory or the first managed location in an aperture.
192 * @io_offset: The io_offset of the first managed page of IO memory or
193 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
194 * memory, this should be set to NULL.
195 * @io_size: The size of a managed IO region (fixed memory or aperture).
196 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
197 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
198 * @io_addr should be set to NULL.
199 * @size: Size of the managed region. 190 * @size: Size of the managed region.
200 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, 191 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
201 * as defined in ttm_placement_common.h 192 * as defined in ttm_placement_common.h
@@ -221,9 +212,6 @@ struct ttm_mem_type_manager {
221 bool use_type; 212 bool use_type;
222 uint32_t flags; 213 uint32_t flags;
223 unsigned long gpu_offset; 214 unsigned long gpu_offset;
224 unsigned long io_offset;
225 unsigned long io_size;
226 void *io_addr;
227 uint64_t size; 215 uint64_t size;
228 uint32_t available_caching; 216 uint32_t available_caching;
229 uint32_t default_caching; 217 uint32_t default_caching;
@@ -311,7 +299,8 @@ struct ttm_bo_driver {
311 */ 299 */
312 int (*move) (struct ttm_buffer_object *bo, 300 int (*move) (struct ttm_buffer_object *bo,
313 bool evict, bool interruptible, 301 bool evict, bool interruptible,
314 bool no_wait, struct ttm_mem_reg *new_mem); 302 bool no_wait_reserve, bool no_wait_gpu,
303 struct ttm_mem_reg *new_mem);
315 304
316 /** 305 /**
317 * struct ttm_bo_driver_member verify_access 306 * struct ttm_bo_driver_member verify_access
@@ -351,12 +340,21 @@ struct ttm_bo_driver {
351 struct ttm_mem_reg *new_mem); 340 struct ttm_mem_reg *new_mem);
352 /* notify the driver we are taking a fault on this BO 341 /* notify the driver we are taking a fault on this BO
353 * and have reserved it */ 342 * and have reserved it */
354 void (*fault_reserve_notify)(struct ttm_buffer_object *bo); 343 int (*fault_reserve_notify)(struct ttm_buffer_object *bo);
355 344
356 /** 345 /**
357 * notify the driver that we're about to swap out this bo 346 * notify the driver that we're about to swap out this bo
358 */ 347 */
359 void (*swap_notify) (struct ttm_buffer_object *bo); 348 void (*swap_notify) (struct ttm_buffer_object *bo);
349
350 /**
351 * Driver callback on when mapping io memory (for bo_move_memcpy
352 * for instance). TTM will take care to call io_mem_free whenever
353 * the mapping is not use anymore. io_mem_reserve & io_mem_free
354 * are balanced.
355 */
356 int (*io_mem_reserve)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
357 void (*io_mem_free)(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem);
360}; 358};
361 359
362/** 360/**
@@ -633,7 +631,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
633 * @proposed_placement: Proposed new placement for the buffer object. 631 * @proposed_placement: Proposed new placement for the buffer object.
634 * @mem: A struct ttm_mem_reg. 632 * @mem: A struct ttm_mem_reg.
635 * @interruptible: Sleep interruptible when sliping. 633 * @interruptible: Sleep interruptible when sliping.
636 * @no_wait: Don't sleep waiting for space to become available. 634 * @no_wait_reserve: Return immediately if other buffers are busy.
635 * @no_wait_gpu: Return immediately if the GPU is busy.
637 * 636 *
638 * Allocate memory space for the buffer object pointed to by @bo, using 637 * Allocate memory space for the buffer object pointed to by @bo, using
639 * the placement flags in @mem, potentially evicting other idle buffer objects. 638 * the placement flags in @mem, potentially evicting other idle buffer objects.
@@ -647,7 +646,8 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
647extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, 646extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
648 struct ttm_placement *placement, 647 struct ttm_placement *placement,
649 struct ttm_mem_reg *mem, 648 struct ttm_mem_reg *mem,
650 bool interruptible, bool no_wait); 649 bool interruptible,
650 bool no_wait_reserve, bool no_wait_gpu);
651/** 651/**
652 * ttm_bo_wait_for_cpu 652 * ttm_bo_wait_for_cpu
653 * 653 *
@@ -682,6 +682,11 @@ extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
682 unsigned long *bus_offset, 682 unsigned long *bus_offset,
683 unsigned long *bus_size); 683 unsigned long *bus_size);
684 684
685extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
686 struct ttm_mem_reg *mem);
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem);
689
685extern void ttm_bo_global_release(struct ttm_global_reference *ref); 690extern void ttm_bo_global_release(struct ttm_global_reference *ref);
686extern int ttm_bo_global_init(struct ttm_global_reference *ref); 691extern int ttm_bo_global_init(struct ttm_global_reference *ref);
687 692
@@ -789,34 +794,6 @@ extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
789extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, 794extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
790 bool interruptible); 795 bool interruptible);
791 796
792/**
793 * ttm_bo_block_reservation
794 *
795 * @bo: A pointer to a struct ttm_buffer_object.
796 * @interruptible: Use interruptible sleep when waiting.
797 * @no_wait: Don't sleep, but rather return -EBUSY.
798 *
799 * Block reservation for validation by simply reserving the buffer.
800 * This is intended for single buffer use only without eviction,
801 * and thus needs no deadlock protection.
802 *
803 * Returns:
804 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
805 * -ERESTARTSYS: If interruptible == 1 and the process received a signal
806 * while sleeping.
807 */
808extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
809 bool interruptible, bool no_wait);
810
811/**
812 * ttm_bo_unblock_reservation
813 *
814 * @bo: A pointer to a struct ttm_buffer_object.
815 *
816 * Unblocks reservation leaving lru lists untouched.
817 */
818extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
819
820/* 797/*
821 * ttm_bo_util.c 798 * ttm_bo_util.c
822 */ 799 */
@@ -826,7 +803,8 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
826 * 803 *
827 * @bo: A pointer to a struct ttm_buffer_object. 804 * @bo: A pointer to a struct ttm_buffer_object.
828 * @evict: 1: This is an eviction. Don't try to pipeline. 805 * @evict: 1: This is an eviction. Don't try to pipeline.
829 * @no_wait: Never sleep, but rather return with -EBUSY. 806 * @no_wait_reserve: Return immediately if other buffers are busy.
807 * @no_wait_gpu: Return immediately if the GPU is busy.
830 * @new_mem: struct ttm_mem_reg indicating where to move. 808 * @new_mem: struct ttm_mem_reg indicating where to move.
831 * 809 *
832 * Optimized move function for a buffer object with both old and 810 * Optimized move function for a buffer object with both old and
@@ -840,15 +818,16 @@ extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
840 */ 818 */
841 819
842extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 820extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
843 bool evict, bool no_wait, 821 bool evict, bool no_wait_reserve,
844 struct ttm_mem_reg *new_mem); 822 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
845 823
846/** 824/**
847 * ttm_bo_move_memcpy 825 * ttm_bo_move_memcpy
848 * 826 *
849 * @bo: A pointer to a struct ttm_buffer_object. 827 * @bo: A pointer to a struct ttm_buffer_object.
850 * @evict: 1: This is an eviction. Don't try to pipeline. 828 * @evict: 1: This is an eviction. Don't try to pipeline.
851 * @no_wait: Never sleep, but rather return with -EBUSY. 829 * @no_wait_reserve: Return immediately if other buffers are busy.
830 * @no_wait_gpu: Return immediately if the GPU is busy.
852 * @new_mem: struct ttm_mem_reg indicating where to move. 831 * @new_mem: struct ttm_mem_reg indicating where to move.
853 * 832 *
854 * Fallback move function for a mappable buffer object in mappable memory. 833 * Fallback move function for a mappable buffer object in mappable memory.
@@ -862,8 +841,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
862 */ 841 */
863 842
864extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 843extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
865 bool evict, 844 bool evict, bool no_wait_reserve,
866 bool no_wait, struct ttm_mem_reg *new_mem); 845 bool no_wait_gpu, struct ttm_mem_reg *new_mem);
867 846
868/** 847/**
869 * ttm_bo_free_old_node 848 * ttm_bo_free_old_node
@@ -882,7 +861,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
882 * @sync_obj_arg: An argument to pass to the sync object idle / wait 861 * @sync_obj_arg: An argument to pass to the sync object idle / wait
883 * functions. 862 * functions.
884 * @evict: This is an evict move. Don't return until the buffer is idle. 863 * @evict: This is an evict move. Don't return until the buffer is idle.
885 * @no_wait: Never sleep, but rather return with -EBUSY. 864 * @no_wait_reserve: Return immediately if other buffers are busy.
865 * @no_wait_gpu: Return immediately if the GPU is busy.
886 * @new_mem: struct ttm_mem_reg indicating where to move. 866 * @new_mem: struct ttm_mem_reg indicating where to move.
887 * 867 *
888 * Accelerated move function to be called when an accelerated move 868 * Accelerated move function to be called when an accelerated move
@@ -896,7 +876,8 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
896extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, 876extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
897 void *sync_obj, 877 void *sync_obj,
898 void *sync_obj_arg, 878 void *sync_obj_arg,
899 bool evict, bool no_wait, 879 bool evict, bool no_wait_reserve,
880 bool no_wait_gpu,
900 struct ttm_mem_reg *new_mem); 881 struct ttm_mem_reg *new_mem);
901/** 882/**
902 * ttm_io_prot 883 * ttm_io_prot
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
new file mode 100644
index 000000000000..8bb4de567b2c
--- /dev/null
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -0,0 +1,74 @@
1/*
2 * Copyright (c) Red Hat Inc.
3
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Dave Airlie <airlied@redhat.com>
24 * Jerome Glisse <jglisse@redhat.com>
25 */
26#ifndef TTM_PAGE_ALLOC
27#define TTM_PAGE_ALLOC
28
29#include "ttm_bo_driver.h"
30#include "ttm_memory.h"
31
32/**
33 * Get count number of pages from pool to pages list.
34 *
35 * @pages: heado of empty linked list where pages are filled.
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 */
40int ttm_get_pages(struct list_head *pages,
41 int flags,
42 enum ttm_caching_state cstate,
43 unsigned count);
44/**
45 * Put linked list of pages to pool.
46 *
47 * @pages: list of pages to free.
48 * @page_count: number of pages in the list. Zero can be passed for unknown
49 * count.
50 * @flags: ttm flags for page allocation.
51 * @cstate: ttm caching state.
52 */
53void ttm_put_pages(struct list_head *pages,
54 unsigned page_count,
55 int flags,
56 enum ttm_caching_state cstate);
57/**
58 * Initialize pool allocator.
59 *
60 * Pool allocator is internaly reference counted so it can be initialized
61 * multiple times but ttm_page_alloc_fini has to be called same number of
62 * times.
63 */
64int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
65/**
66 * Free pool allocator.
67 */
68void ttm_page_alloc_fini(void);
69
70/**
71 * Output the state of pools to debugfs file
72 */
73extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
74#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e2ea0b2159cd..2fc8e14cc24a 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -94,6 +94,7 @@ header-y += if_ppp.h
94header-y += if_slip.h 94header-y += if_slip.h
95header-y += if_strip.h 95header-y += if_strip.h
96header-y += if_tun.h 96header-y += if_tun.h
97header-y += if_x25.h
97header-y += in_route.h 98header-y += in_route.h
98header-y += ioctl.h 99header-y += ioctl.h
99header-y += ip6_tunnel.h 100header-y += ip6_tunnel.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b926afe8c03e..3da73f5f0ae9 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,11 +116,12 @@ extern unsigned long acpi_realmode_flags;
116 116
117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); 117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
119int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
119 120
120#ifdef CONFIG_X86_IO_APIC 121#ifdef CONFIG_X86_IO_APIC
121extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity); 122extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
122#else 123#else
123#define acpi_get_override_irq(bus, trigger, polarity) (-1) 124#define acpi_get_override_irq(gsi, trigger, polarity) (-1)
124#endif 125#endif
125/* 126/*
126 * This function undoes the effect of one call to acpi_register_gsi(). 127 * This function undoes the effect of one call to acpi_register_gsi().
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
new file mode 100644
index 000000000000..f7dd576dd5a4
--- /dev/null
+++ b/include/linux/ahci_platform.h
@@ -0,0 +1,29 @@
1/*
2 * AHCI SATA platform driver
3 *
4 * Copyright 2004-2005 Red Hat, Inc.
5 * Jeff Garzik <jgarzik@pobox.com>
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@ru.mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 */
14
15#ifndef _AHCI_PLATFORM_H
16#define _AHCI_PLATFORM_H
17
18struct device;
19struct ata_port_info;
20
21struct ahci_platform_data {
22 int (*init)(struct device *dev);
23 void (*exit)(struct device *dev);
24 const struct ata_port_info *ata_port_info;
25 unsigned int force_port_map;
26 unsigned int mask_port_map;
27};
28
29#endif /* _AHCI_PLATFORM_H */
diff --git a/include/linux/altera_jtaguart.h b/include/linux/altera_jtaguart.h
new file mode 100644
index 000000000000..953b178a1650
--- /dev/null
+++ b/include/linux/altera_jtaguart.h
@@ -0,0 +1,16 @@
1/*
2 * altera_jtaguart.h -- Altera JTAG UART driver defines.
3 */
4
5#ifndef __ALTJUART_H
6#define __ALTJUART_H
7
8#define ALTERA_JTAGUART_MAJOR 204
9#define ALTERA_JTAGUART_MINOR 186
10
11struct altera_jtaguart_platform_uart {
12 unsigned long mapbase; /* Physical address base */
13 unsigned int irq; /* Interrupt vector */
14};
15
16#endif /* __ALTJUART_H */
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
new file mode 100644
index 000000000000..8d441064a30d
--- /dev/null
+++ b/include/linux/altera_uart.h
@@ -0,0 +1,14 @@
1/*
2 * altera_uart.h -- Altera UART driver defines.
3 */
4
5#ifndef __ALTUART_H
6#define __ALTUART_H
7
8struct altera_uart_platform_uart {
9 unsigned long mapbase; /* Physical address base */
10 unsigned int irq; /* Interrupt vector */
11 unsigned int uartclk; /* UART clock rate */
12};
13
14#endif /* __ALTUART_H */
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 6b4241748dda..7e466fe72025 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,8 +6,29 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/**
10 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block.
12 * @f_max: the maximum operational frequency for this host in this
13 * platform configuration. When this is specified it takes precedence
14 * over the module parameter for the same frequency.
15 * @ocr_mask: available voltages on the 4 pins from the block, this
16 * is ignored if a regulator is used, see the MMC_VDD_* masks in
17 * mmc/host.h
18 * @translate_vdd: a callback function to translate a MMC_VDD_*
19 * mask into a value to be binary or:ed and written into the
20 * MMCIPWR register of the block
21 * @status: if no GPIO read function was given to the block in
22 * gpio_wp (below) this function will be called to determine
23 * whether a card is present in the MMC slot or not
24 * @gpio_wp: read this GPIO pin to see if the card is write protected
25 * @gpio_cd: read this GPIO pin to detect card insertion
26 * @capabilities: the capabilities of the block as implemented in
27 * this platform, signify anything MMC_CAP_* from mmc/host.h
28 */
9struct mmci_platform_data { 29struct mmci_platform_data {
10 unsigned int ocr_mask; /* available voltages */ 30 unsigned int f_max;
31 unsigned int ocr_mask;
11 u32 (*translate_vdd)(struct device *, unsigned int); 32 u32 (*translate_vdd)(struct device *, unsigned int);
12 unsigned int (*status)(struct device *); 33 unsigned int (*status)(struct device *);
13 int gpio_wp; 34 int gpio_wp;
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 700c5b9b3583..fe6e681a9d74 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -467,7 +467,7 @@ enum ata_ioctls {
467 467
468/* core structures */ 468/* core structures */
469 469
470struct ata_prd { 470struct ata_bmdma_prd {
471 __le32 addr; 471 __le32 addr;
472 __le32 flags_len; 472 __le32 flags_len;
473}; 473};
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index fcbc26af00e4..e6e0cb5437e6 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/timer.h>
17#include <linux/writeback.h> 18#include <linux/writeback.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
@@ -88,6 +89,8 @@ struct backing_dev_info {
88 89
89 struct device *dev; 90 struct device *dev;
90 91
92 struct timer_list laptop_mode_wb_timer;
93
91#ifdef CONFIG_DEBUG_FS 94#ifdef CONFIG_DEBUG_FS
92 struct dentry *debug_dir; 95 struct dentry *debug_dir;
93 struct dentry *debug_stats; 96 struct dentry *debug_stats;
@@ -101,10 +104,12 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
101 const char *fmt, ...); 104 const char *fmt, ...);
102int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 105int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
103void bdi_unregister(struct backing_dev_info *bdi); 106void bdi_unregister(struct backing_dev_info *bdi);
107int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
104void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 108void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
105 long nr_pages); 109 long nr_pages, int sb_locked);
106int bdi_writeback_task(struct bdi_writeback *wb); 110int bdi_writeback_task(struct bdi_writeback *wb);
107int bdi_has_dirty_io(struct backing_dev_info *bdi); 111int bdi_has_dirty_io(struct backing_dev_info *bdi);
112void bdi_arm_supers_timer(void);
108 113
109extern spinlock_t bdi_lock; 114extern spinlock_t bdi_lock;
110extern struct list_head bdi_list; 115extern struct list_head bdi_list;
@@ -246,6 +251,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
246#endif 251#endif
247 252
248extern struct backing_dev_info default_backing_dev_info; 253extern struct backing_dev_info default_backing_dev_info;
254extern struct backing_dev_info noop_backing_dev_info;
249void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); 255void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
250 256
251int writeback_in_progress(struct backing_dev_info *bdi); 257int writeback_in_progress(struct backing_dev_info *bdi);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index b796eab5ca75..fc68053378ce 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,11 @@
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w);
16extern unsigned long __sw_hweight64(__u64 w);
17
13/* 18/*
14 * Include this here because some architectures need generic_ffs/fls in 19 * Include this here because some architectures need generic_ffs/fls in
15 * scope 20 * scope
@@ -44,31 +49,6 @@ static inline unsigned long hweight_long(unsigned long w)
44 return sizeof(w) == 4 ? hweight32(w) : hweight64(w); 49 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
45} 50}
46 51
47/*
48 * Clearly slow versions of the hweightN() functions, their benefit is
49 * of course compile time evaluation of constant arguments.
50 */
51#define HWEIGHT8(w) \
52 ( BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + \
53 (!!((w) & (1ULL << 0))) + \
54 (!!((w) & (1ULL << 1))) + \
55 (!!((w) & (1ULL << 2))) + \
56 (!!((w) & (1ULL << 3))) + \
57 (!!((w) & (1ULL << 4))) + \
58 (!!((w) & (1ULL << 5))) + \
59 (!!((w) & (1ULL << 6))) + \
60 (!!((w) & (1ULL << 7))) )
61
62#define HWEIGHT16(w) (HWEIGHT8(w) + HWEIGHT8((w) >> 8))
63#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
64#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
65
66/*
67 * Type invariant version that simply casts things to the
68 * largest type.
69 */
70#define HWEIGHT(w) HWEIGHT64((u64)(w))
71
72/** 52/**
73 * rol32 - rotate a 32-bit value left 53 * rol32 - rotate a 32-bit value left
74 * @word: value to rotate 54 * @word: value to rotate
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6690e8bae7bb..8b7f5e0914ad 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -186,15 +186,19 @@ struct request {
186 }; 186 };
187 187
188 /* 188 /*
189 * two pointers are available for the IO schedulers, if they need 189 * Three pointers are available for the IO schedulers, if they need
190 * more they have to dynamically allocate it. 190 * more they have to dynamically allocate it.
191 */ 191 */
192 void *elevator_private; 192 void *elevator_private;
193 void *elevator_private2; 193 void *elevator_private2;
194 void *elevator_private3;
194 195
195 struct gendisk *rq_disk; 196 struct gendisk *rq_disk;
196 unsigned long start_time; 197 unsigned long start_time;
197 198#ifdef CONFIG_BLK_CGROUP
199 unsigned long long start_time_ns;
200 unsigned long long io_start_time_ns; /* when passed to hardware */
201#endif
198 /* Number of scatter-gather DMA addr+len pairs after 202 /* Number of scatter-gather DMA addr+len pairs after
199 * physical address coalescing is performed. 203 * physical address coalescing is performed.
200 */ 204 */
@@ -917,7 +921,12 @@ extern void blk_abort_queue(struct request_queue *);
917 */ 921 */
918extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 922extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
919 spinlock_t *lock, int node_id); 923 spinlock_t *lock, int node_id);
924extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
925 request_fn_proc *,
926 spinlock_t *, int node_id);
920extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 927extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
928extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
929 request_fn_proc *, spinlock_t *);
921extern void blk_cleanup_queue(struct request_queue *); 930extern void blk_cleanup_queue(struct request_queue *);
922extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 931extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
923extern void blk_queue_bounce_limit(struct request_queue *, u64); 932extern void blk_queue_bounce_limit(struct request_queue *, u64);
@@ -994,20 +1003,25 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
994 return NULL; 1003 return NULL;
995 return bqt->tag_index[tag]; 1004 return bqt->tag_index[tag];
996} 1005}
997 1006enum{
998extern int blkdev_issue_flush(struct block_device *, sector_t *); 1007 BLKDEV_WAIT, /* wait for completion */
999#define DISCARD_FL_WAIT 0x01 /* wait for completion */ 1008 BLKDEV_BARRIER, /*issue request with barrier */
1000#define DISCARD_FL_BARRIER 0x02 /* issue DISCARD_BARRIER request */ 1009};
1001extern int blkdev_issue_discard(struct block_device *, sector_t sector, 1010#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
1002 sector_t nr_sects, gfp_t, int flags); 1011#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
1003 1012extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
1013 unsigned long);
1014extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
1015 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1016extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
1017 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1004static inline int sb_issue_discard(struct super_block *sb, 1018static inline int sb_issue_discard(struct super_block *sb,
1005 sector_t block, sector_t nr_blocks) 1019 sector_t block, sector_t nr_blocks)
1006{ 1020{
1007 block <<= (sb->s_blocksize_bits - 9); 1021 block <<= (sb->s_blocksize_bits - 9);
1008 nr_blocks <<= (sb->s_blocksize_bits - 9); 1022 nr_blocks <<= (sb->s_blocksize_bits - 9);
1009 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 1023 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL,
1010 DISCARD_FL_BARRIER); 1024 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1011} 1025}
1012 1026
1013extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 1027extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
@@ -1196,6 +1210,39 @@ static inline void put_dev_sector(Sector p)
1196struct work_struct; 1210struct work_struct;
1197int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1211int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1198 1212
1213#ifdef CONFIG_BLK_CGROUP
1214static inline void set_start_time_ns(struct request *req)
1215{
1216 req->start_time_ns = sched_clock();
1217}
1218
1219static inline void set_io_start_time_ns(struct request *req)
1220{
1221 req->io_start_time_ns = sched_clock();
1222}
1223
1224static inline uint64_t rq_start_time_ns(struct request *req)
1225{
1226 return req->start_time_ns;
1227}
1228
1229static inline uint64_t rq_io_start_time_ns(struct request *req)
1230{
1231 return req->io_start_time_ns;
1232}
1233#else
1234static inline void set_start_time_ns(struct request *req) {}
1235static inline void set_io_start_time_ns(struct request *req) {}
1236static inline uint64_t rq_start_time_ns(struct request *req)
1237{
1238 return 0;
1239}
1240static inline uint64_t rq_io_start_time_ns(struct request *req)
1241{
1242 return 0;
1243}
1244#endif
1245
1199#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1246#define MODULE_ALIAS_BLOCKDEV(major,minor) \
1200 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 1247 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
1201#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 1248#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
@@ -1283,10 +1330,11 @@ struct block_device_operations {
1283 int (*direct_access) (struct block_device *, sector_t, 1330 int (*direct_access) (struct block_device *, sector_t,
1284 void **, unsigned long *); 1331 void **, unsigned long *);
1285 int (*media_changed) (struct gendisk *); 1332 int (*media_changed) (struct gendisk *);
1286 unsigned long long (*set_capacity) (struct gendisk *, 1333 void (*unlock_native_capacity) (struct gendisk *);
1287 unsigned long long);
1288 int (*revalidate_disk) (struct gendisk *); 1334 int (*revalidate_disk) (struct gendisk *);
1289 int (*getgeo)(struct block_device *, struct hd_geometry *); 1335 int (*getgeo)(struct block_device *, struct hd_geometry *);
1336 /* this callback is with swap_lock and sometimes page table lock held */
1337 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
1290 struct module *owner; 1338 struct module *owner;
1291}; 1339};
1292 1340
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
new file mode 100644
index 000000000000..2a61eb1beb85
--- /dev/null
+++ b/include/linux/caif/caif_socket.h
@@ -0,0 +1,165 @@
1/* linux/caif_socket.h
2 * CAIF Definitions for CAIF socket and network layer
3 * Copyright (C) ST-Ericsson AB 2010
4 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef _LINUX_CAIF_SOCKET_H
9#define _LINUX_CAIF_SOCKET_H
10
11#include <linux/types.h>
12
13#ifdef __KERNEL__
14#include <linux/socket.h>
15#else
16#include <sys/socket.h>
17#endif
18
19/**
20 * enum caif_link_selector - Physical Link Selection.
21 * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
22 * traffic.
23 * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
24 * traffic.
25 *
26 * CAIF Link Layers can register their link properties.
27 * This enum is used for choosing between CAIF Link Layers when
28 * setting up CAIF Channels when multiple CAIF Link Layers exists.
29 */
30enum caif_link_selector {
31 CAIF_LINK_HIGH_BANDW,
32 CAIF_LINK_LOW_LATENCY
33};
34
35/**
36 * enum caif_channel_priority - CAIF channel priorities.
37 *
38 * @CAIF_PRIO_MIN: Min priority for a channel.
39 * @CAIF_PRIO_LOW: Low-priority channel.
40 * @CAIF_PRIO_NORMAL: Normal/default priority level.
41 * @CAIF_PRIO_HIGH: High priority level
42 * @CAIF_PRIO_MAX: Max priority for channel
43 *
44 * Priority can be set on CAIF Channels in order to
45 * prioritize between traffic on different CAIF Channels.
46 * These priority levels are recommended, but the priority value
47 * is not restricted to the values defined in this enum, any value
48 * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
49 */
50enum caif_channel_priority {
51 CAIF_PRIO_MIN = 0x01,
52 CAIF_PRIO_LOW = 0x04,
53 CAIF_PRIO_NORMAL = 0x0f,
54 CAIF_PRIO_HIGH = 0x14,
55 CAIF_PRIO_MAX = 0x1F
56};
57
58/**
59 * enum caif_protocol_type - CAIF Channel type.
60 * @CAIFPROTO_AT: Classic AT channel.
61 * @CAIFPROTO_DATAGRAM: Datagram channel.
62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
63 * @CAIFPROTO_UTIL: Utility (Psock) channel.
64 * @CAIFPROTO_RFM: Remote File Manager
65 *
66 * This enum defines the CAIF Channel type to be used. This defines
67 * the service to connect to on the modem.
68 */
69enum caif_protocol_type {
70 CAIFPROTO_AT,
71 CAIFPROTO_DATAGRAM,
72 CAIFPROTO_DATAGRAM_LOOP,
73 CAIFPROTO_UTIL,
74 CAIFPROTO_RFM,
75 _CAIFPROTO_MAX
76};
77#define CAIFPROTO_MAX _CAIFPROTO_MAX
78
79/**
80 * enum caif_at_type - AT Service Endpoint
81 * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
82 */
83enum caif_at_type {
84 CAIF_ATTYPE_PLAIN = 2
85};
86
87/**
88 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
89 * @family: Address family number, must be AF_CAIF.
90 * @u: Union of address data 'switched' by family.
91 * :
92 * @u.at: Applies when family = CAIFPROTO_AT.
93 *
94 * @u.at.type: Type of AT link to set up (enum caif_at_type).
95 *
96 * @u.util: Applies when family = CAIFPROTO_UTIL
97 *
98 * @u.util.service: Utility service name.
99 *
100 * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
101 *
102 * @u.dgm.connection_id: Datagram connection id.
103 *
104 * @u.dgm.nsapi: NSAPI of the PDP-Context.
105 *
106 * @u.rfm: Applies when family = CAIFPROTO_RFM
107 *
108 * @u.rfm.connection_id: Connection ID for RFM.
109 *
110 * @u.rfm.volume: Volume to mount.
111 *
112 * Description:
113 * This structure holds the connect parameters used for setting up a
114 * CAIF Channel. It defines the service to connect to on the modem.
115 */
116struct sockaddr_caif {
117 sa_family_t family;
118 union {
119 struct {
120 __u8 type; /* type: enum caif_at_type */
121 } at; /* CAIFPROTO_AT */
122 struct {
123 char service[16];
124 } util; /* CAIFPROTO_UTIL */
125 union {
126 __u32 connection_id;
127 __u8 nsapi;
128 } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
129 struct {
130 __u32 connection_id;
131 char volume[16];
132 } rfm; /* CAIFPROTO_RFM */
133 } u;
134};
135
136/**
137 * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
138 *
139 * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
140 * available. Either a high bandwidth
141 * link can be selected (CAIF_LINK_HIGH_BANDW) or
142 * or a low latency link (CAIF_LINK_LOW_LATENCY).
143 * This option is of type __u32.
144 * Alternatively SO_BINDTODEVICE can be used.
145 *
146 * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
147 * utility channel. (maximum 256 bytes). This
148 * option must be set before connecting.
149 *
150 * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
151 * channel. (maximum 256 bytes). This option
152 * is valid after a successful connect.
153 *
154 *
155 * This enum defines the CAIF Socket options to be used on a socket
156 * of type PF_CAIF.
157 *
158 */
159enum caif_socket_opts {
160 CAIFSO_LINK_SELECT = 127,
161 CAIFSO_REQ_PARAM = 128,
162 CAIFSO_RSP_PARAM = 129,
163};
164
165#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h
new file mode 100644
index 000000000000..5e7eed4edf51
--- /dev/null
+++ b/include/linux/caif/if_caif.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef IF_CAIF_H_
8#define IF_CAIF_H_
9#include <linux/sockios.h>
10#include <linux/types.h>
11#include <linux/socket.h>
12
13/**
14 * enum ifla_caif - CAIF NetlinkRT parameters.
15 * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context.
16 * The type of attribute is NLA_U32.
17 * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context.
18 * The type of attribute is NLA_U32.
19 * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback
20 * The type of attribute is NLA_U8.
21 *
22 * When using RT Netlink to create, destroy or configure a CAIF IP interface,
23 * enum ifla_caif is used to specify the configuration attributes.
24 */
25enum ifla_caif {
26 __IFLA_CAIF_UNSPEC,
27 IFLA_CAIF_IPV4_CONNID,
28 IFLA_CAIF_IPV6_CONNID,
29 IFLA_CAIF_LOOPBACK,
30 __IFLA_CAIF_MAX
31};
32#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
33
34#endif /*IF_CAIF_H_*/
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 6e5a7f00223d..cc0bb4961669 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -14,6 +14,7 @@
14#ifndef CAN_DEV_H 14#ifndef CAN_DEV_H
15#define CAN_DEV_H 15#define CAN_DEV_H
16 16
17#include <linux/can.h>
17#include <linux/can/netlink.h> 18#include <linux/can/netlink.h>
18#include <linux/can/error.h> 19#include <linux/can/error.h>
19 20
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 1448177d86d5..dba28268e651 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -26,8 +26,8 @@
26struct mcp251x_platform_data { 26struct mcp251x_platform_data {
27 unsigned long oscillator_frequency; 27 unsigned long oscillator_frequency;
28 int model; 28 int model;
29#define CAN_MCP251X_MCP2510 0 29#define CAN_MCP251X_MCP2510 0x2510
30#define CAN_MCP251X_MCP2515 1 30#define CAN_MCP251X_MCP2515 0x2515
31 int (*board_specific_setup)(struct spi_device *spi); 31 int (*board_specific_setup)(struct spi_device *spi);
32 int (*transceiver_enable)(int enable); 32 int (*transceiver_enable)(int enable);
33 int (*power_enable) (int enable); 33 int (*power_enable) (int enable);
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
index 01ee2aeb048d..96f8fcc78d78 100644
--- a/include/linux/can/platform/sja1000.h
+++ b/include/linux/can/platform/sja1000.h
@@ -26,7 +26,7 @@
26#define OCR_TX_SHIFT 2 26#define OCR_TX_SHIFT 2
27 27
28struct sja1000_platform_data { 28struct sja1000_platform_data {
29 u32 clock; /* CAN bus oscillator frequency in Hz */ 29 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
30 30
31 u8 ocr; /* output control register */ 31 u8 ocr; /* output control register */
32 u8 cdr; /* clock divider register */ 32 u8 cdr; /* clock divider register */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b8ad1ea99586..8f78073d7caa 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -530,6 +530,7 @@ static inline struct cgroup_subsys_state *task_subsys_state(
530{ 530{
531 return rcu_dereference_check(task->cgroups->subsys[subsys_id], 531 return rcu_dereference_check(task->cgroups->subsys[subsys_id],
532 rcu_read_lock_held() || 532 rcu_read_lock_held() ||
533 lockdep_is_held(&task->alloc_lock) ||
533 cgroup_lock_is_held()); 534 cgroup_lock_is_held());
534} 535}
535 536
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 4bca8b60cdf7..5ea3c60c160c 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -273,7 +273,6 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
273} 273}
274 274
275 275
276/* used to install a new clocksource */
277extern int clocksource_register(struct clocksource*); 276extern int clocksource_register(struct clocksource*);
278extern void clocksource_unregister(struct clocksource*); 277extern void clocksource_unregister(struct clocksource*);
279extern void clocksource_touch_watchdog(void); 278extern void clocksource_touch_watchdog(void);
@@ -287,6 +286,24 @@ extern void clocksource_mark_unstable(struct clocksource *cs);
287extern void 286extern void
288clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 287clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
289 288
289/*
290 * Don't call __clocksource_register_scale directly, use
291 * clocksource_register_hz/khz
292 */
293extern int
294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
295
296static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
297{
298 return __clocksource_register_scale(cs, 1, hz);
299}
300
301static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
302{
303 return __clocksource_register_scale(cs, 1000, khz);
304}
305
306
290static inline void 307static inline void
291clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 308clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
292{ 309{
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 5b5d4731f956..8859e2ede9fe 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -7,6 +7,8 @@
7#define MAX_CODADEVS 5 /* how many do we allow */ 7#define MAX_CODADEVS 5 /* how many do we allow */
8 8
9#ifdef __KERNEL__ 9#ifdef __KERNEL__
10#include <linux/backing-dev.h>
11
10struct kstatfs; 12struct kstatfs;
11 13
12/* communication pending/processing queues */ 14/* communication pending/processing queues */
@@ -17,6 +19,7 @@ struct venus_comm {
17 struct list_head vc_processing; 19 struct list_head vc_processing;
18 int vc_inuse; 20 int vc_inuse;
19 struct super_block *vc_sb; 21 struct super_block *vc_sb;
22 struct backing_dev_info bdi;
20}; 23};
21 24
22 25
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4de02b10007f..9f15150ce8d6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -278,6 +278,27 @@ struct freq_attr {
278 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 278 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
279}; 279};
280 280
281#define cpufreq_freq_attr_ro(_name) \
282static struct freq_attr _name = \
283__ATTR(_name, 0444, show_##_name, NULL)
284
285#define cpufreq_freq_attr_ro_perm(_name, _perm) \
286static struct freq_attr _name = \
287__ATTR(_name, _perm, show_##_name, NULL)
288
289#define cpufreq_freq_attr_ro_old(_name) \
290static struct freq_attr _name##_old = \
291__ATTR(_name, 0444, show_##_name##_old, NULL)
292
293#define cpufreq_freq_attr_rw(_name) \
294static struct freq_attr _name = \
295__ATTR(_name, 0644, show_##_name, store_##_name)
296
297#define cpufreq_freq_attr_rw_old(_name) \
298static struct freq_attr _name##_old = \
299__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
300
301
281struct global_attr { 302struct global_attr {
282 struct attribute attr; 303 struct attribute attr;
283 ssize_t (*show)(struct kobject *kobj, 304 ssize_t (*show)(struct kobject *kobj,
@@ -286,6 +307,15 @@ struct global_attr {
286 const char *c, size_t count); 307 const char *c, size_t count);
287}; 308};
288 309
310#define define_one_global_ro(_name) \
311static struct global_attr _name = \
312__ATTR(_name, 0444, show_##_name, NULL)
313
314#define define_one_global_rw(_name) \
315static struct global_attr _name = \
316__ATTR(_name, 0644, show_##_name, store_##_name)
317
318
289/********************************************************************* 319/*********************************************************************
290 * CPUFREQ 2.6. INTERFACE * 320 * CPUFREQ 2.6. INTERFACE *
291 *********************************************************************/ 321 *********************************************************************/
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index a5740fc4d04b..a73454aec333 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -21,8 +21,7 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, 24extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
25 struct cpumask *mask);
26extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
27#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
28void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
@@ -69,9 +68,6 @@ struct seq_file;
69extern void cpuset_task_status_allowed(struct seq_file *m, 68extern void cpuset_task_status_allowed(struct seq_file *m,
70 struct task_struct *task); 69 struct task_struct *task);
71 70
72extern void cpuset_lock(void);
73extern void cpuset_unlock(void);
74
75extern int cpuset_mem_spread_node(void); 71extern int cpuset_mem_spread_node(void);
76 72
77static inline int cpuset_do_page_mem_spread(void) 73static inline int cpuset_do_page_mem_spread(void)
@@ -105,10 +101,11 @@ static inline void cpuset_cpus_allowed(struct task_struct *p,
105{ 101{
106 cpumask_copy(mask, cpu_possible_mask); 102 cpumask_copy(mask, cpu_possible_mask);
107} 103}
108static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 104
109 struct cpumask *mask) 105static inline int cpuset_cpus_allowed_fallback(struct task_struct *p)
110{ 106{
111 cpumask_copy(mask, cpu_possible_mask); 107 cpumask_copy(&p->cpus_allowed, cpu_possible_mask);
108 return cpumask_any(cpu_active_mask);
112} 109}
113 110
114static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 111static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -157,9 +154,6 @@ static inline void cpuset_task_status_allowed(struct seq_file *m,
157{ 154{
158} 155}
159 156
160static inline void cpuset_lock(void) {}
161static inline void cpuset_unlock(void) {}
162
163static inline int cpuset_mem_spread_node(void) 157static inline int cpuset_mem_spread_node(void)
164{ 158{
165 return 0; 159 return 0;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 30b93b2a01a4..eebb617c17d8 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -186,6 +186,8 @@ d_iput: no no no yes
186 186
187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ 187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */
188 188
189#define DCACHE_CANT_MOUNT 0x0100
190
189extern spinlock_t dcache_lock; 191extern spinlock_t dcache_lock;
190extern seqlock_t rename_lock; 192extern seqlock_t rename_lock;
191 193
@@ -358,6 +360,18 @@ static inline int d_unlinked(struct dentry *dentry)
358 return d_unhashed(dentry) && !IS_ROOT(dentry); 360 return d_unhashed(dentry) && !IS_ROOT(dentry);
359} 361}
360 362
363static inline int cant_mount(struct dentry *dentry)
364{
365 return (dentry->d_flags & DCACHE_CANT_MOUNT);
366}
367
368static inline void dont_mount(struct dentry *dentry)
369{
370 spin_lock(&dentry->d_lock);
371 dentry->d_flags |= DCACHE_CANT_MOUNT;
372 spin_unlock(&dentry->d_lock);
373}
374
361static inline struct dentry *dget_parent(struct dentry *dentry) 375static inline struct dentry *dget_parent(struct dentry *dentry)
362{ 376{
363 struct dentry *ret; 377 struct dentry *ret;
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index b7cdbb4373df..8723491f7dfd 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -22,8 +22,6 @@
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#define DCB_PROTO_VERSION 1
26
27struct dcbmsg { 25struct dcbmsg {
28 __u8 dcb_family; 26 __u8 dcb_family;
29 __u8 cmd; 27 __u8 cmd;
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 8c243aaa86a7..597692f1fc8d 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -20,12 +20,14 @@ struct debug_obj_descr;
20 * struct debug_obj - representaion of an tracked object 20 * struct debug_obj - representaion of an tracked object
21 * @node: hlist node to link the object into the tracker list 21 * @node: hlist node to link the object into the tracker list
22 * @state: tracked object state 22 * @state: tracked object state
23 * @astate: current active state
23 * @object: pointer to the real object 24 * @object: pointer to the real object
24 * @descr: pointer to an object type specific debug description structure 25 * @descr: pointer to an object type specific debug description structure
25 */ 26 */
26struct debug_obj { 27struct debug_obj {
27 struct hlist_node node; 28 struct hlist_node node;
28 enum debug_obj_state state; 29 enum debug_obj_state state;
30 unsigned int astate;
29 void *object; 31 void *object;
30 struct debug_obj_descr *descr; 32 struct debug_obj_descr *descr;
31}; 33};
@@ -60,6 +62,15 @@ extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
60extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 62extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
61extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
62 64
65/*
66 * Active state:
67 * - Set at 0 upon initialization.
68 * - Must return to 0 before deactivation.
69 */
70extern void
71debug_object_active_state(void *addr, struct debug_obj_descr *descr,
72 unsigned int expect, unsigned int next);
73
63extern void debug_objects_early_init(void); 74extern void debug_objects_early_init(void);
64extern void debug_objects_mem_init(void); 75extern void debug_objects_mem_init(void);
65#else 76#else
diff --git a/include/linux/device.h b/include/linux/device.h
index cd7534cc42ab..0713e10571dd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,6 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/semaphore.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27#include <asm/device.h> 26#include <asm/device.h>
28 27
@@ -208,6 +207,9 @@ struct class {
208 int (*suspend)(struct device *dev, pm_message_t state); 207 int (*suspend)(struct device *dev, pm_message_t state);
209 int (*resume)(struct device *dev); 208 int (*resume)(struct device *dev);
210 209
210 const struct kobj_ns_type_operations *ns_type;
211 const void *(*namespace)(struct device *dev);
212
211 const struct dev_pm_ops *pm; 213 const struct dev_pm_ops *pm;
212 214
213 struct class_private *p; 215 struct class_private *p;
@@ -409,7 +411,7 @@ struct device {
409 const char *init_name; /* initial name of the device */ 411 const char *init_name; /* initial name of the device */
410 struct device_type *type; 412 struct device_type *type;
411 413
412 struct semaphore sem; /* semaphore to synchronize calls to 414 struct mutex mutex; /* mutex to synchronize calls to
413 * its driver. 415 * its driver.
414 */ 416 */
415 417
@@ -459,6 +461,10 @@ struct device {
459 461
460static inline const char *dev_name(const struct device *dev) 462static inline const char *dev_name(const struct device *dev)
461{ 463{
464 /* Use the init name until the kobject becomes available */
465 if (dev->init_name)
466 return dev->init_name;
467
462 return kobject_name(&dev->kobj); 468 return kobject_name(&dev->kobj);
463} 469}
464 470
@@ -518,17 +524,17 @@ static inline bool device_async_suspend_enabled(struct device *dev)
518 524
519static inline void device_lock(struct device *dev) 525static inline void device_lock(struct device *dev)
520{ 526{
521 down(&dev->sem); 527 mutex_lock(&dev->mutex);
522} 528}
523 529
524static inline int device_trylock(struct device *dev) 530static inline int device_trylock(struct device *dev)
525{ 531{
526 return down_trylock(&dev->sem); 532 return mutex_trylock(&dev->mutex);
527} 533}
528 534
529static inline void device_unlock(struct device *dev) 535static inline void device_unlock(struct device *dev)
530{ 536{
531 up(&dev->sem); 537 mutex_unlock(&dev->mutex);
532} 538}
533 539
534void driver_init(void); 540void driver_init(void);
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 20ea12c86fd0..5204f018931b 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -40,11 +40,13 @@ typedef s32 dma_cookie_t;
40 * enum dma_status - DMA transaction status 40 * enum dma_status - DMA transaction status
41 * @DMA_SUCCESS: transaction completed successfully 41 * @DMA_SUCCESS: transaction completed successfully
42 * @DMA_IN_PROGRESS: transaction not yet processed 42 * @DMA_IN_PROGRESS: transaction not yet processed
43 * @DMA_PAUSED: transaction is paused
43 * @DMA_ERROR: transaction failed 44 * @DMA_ERROR: transaction failed
44 */ 45 */
45enum dma_status { 46enum dma_status {
46 DMA_SUCCESS, 47 DMA_SUCCESS,
47 DMA_IN_PROGRESS, 48 DMA_IN_PROGRESS,
49 DMA_PAUSED,
48 DMA_ERROR, 50 DMA_ERROR,
49}; 51};
50 52
@@ -107,6 +109,19 @@ enum dma_ctrl_flags {
107}; 109};
108 110
109/** 111/**
112 * enum dma_ctrl_cmd - DMA operations that can optionally be exercised
113 * on a running channel.
114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers
115 * @DMA_PAUSE: pause ongoing transfers
116 * @DMA_RESUME: resume paused transfer
117 */
118enum dma_ctrl_cmd {
119 DMA_TERMINATE_ALL,
120 DMA_PAUSE,
121 DMA_RESUME,
122};
123
124/**
110 * enum sum_check_bits - bit position of pq_check_flags 125 * enum sum_check_bits - bit position of pq_check_flags
111 */ 126 */
112enum sum_check_bits { 127enum sum_check_bits {
@@ -230,9 +245,84 @@ struct dma_async_tx_descriptor {
230 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 245 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
231 dma_async_tx_callback callback; 246 dma_async_tx_callback callback;
232 void *callback_param; 247 void *callback_param;
248#ifndef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
233 struct dma_async_tx_descriptor *next; 249 struct dma_async_tx_descriptor *next;
234 struct dma_async_tx_descriptor *parent; 250 struct dma_async_tx_descriptor *parent;
235 spinlock_t lock; 251 spinlock_t lock;
252#endif
253};
254
255#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
256static inline void txd_lock(struct dma_async_tx_descriptor *txd)
257{
258}
259static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
260{
261}
262static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
263{
264 BUG();
265}
266static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
267{
268}
269static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
270{
271}
272static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
273{
274 return NULL;
275}
276static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
277{
278 return NULL;
279}
280
281#else
282static inline void txd_lock(struct dma_async_tx_descriptor *txd)
283{
284 spin_lock_bh(&txd->lock);
285}
286static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
287{
288 spin_unlock_bh(&txd->lock);
289}
290static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
291{
292 txd->next = next;
293 next->parent = txd;
294}
295static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
296{
297 txd->parent = NULL;
298}
299static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
300{
301 txd->next = NULL;
302}
303static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
304{
305 return txd->parent;
306}
307static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
308{
309 return txd->next;
310}
311#endif
312
313/**
314 * struct dma_tx_state - filled in to report the status of
315 * a transfer.
316 * @last: last completed DMA cookie
317 * @used: last issued DMA cookie (i.e. the one in progress)
318 * @residue: the remaining number of bytes left to transmit
319 * on the selected transfer for states DMA_IN_PROGRESS and
320 * DMA_PAUSED if this is implemented in the driver, else 0
321 */
322struct dma_tx_state {
323 dma_cookie_t last;
324 dma_cookie_t used;
325 u32 residue;
236}; 326};
237 327
238/** 328/**
@@ -261,8 +351,12 @@ struct dma_async_tx_descriptor {
261 * @device_prep_dma_memset: prepares a memset operation 351 * @device_prep_dma_memset: prepares a memset operation
262 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 352 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
263 * @device_prep_slave_sg: prepares a slave dma operation 353 * @device_prep_slave_sg: prepares a slave dma operation
264 * @device_terminate_all: terminate all pending operations 354 * @device_control: manipulate all pending operations on a channel, returns
265 * @device_is_tx_complete: poll for transaction completion 355 * zero or error code
356 * @device_tx_status: poll for transaction completion, the optional
357 * txstate parameter can be supplied with a pointer to get a
358 * struct with auxilary transfer status information, otherwise the call
359 * will just return a simple status code
266 * @device_issue_pending: push pending transactions to hardware 360 * @device_issue_pending: push pending transactions to hardware
267 */ 361 */
268struct dma_device { 362struct dma_device {
@@ -313,11 +407,12 @@ struct dma_device {
313 struct dma_chan *chan, struct scatterlist *sgl, 407 struct dma_chan *chan, struct scatterlist *sgl,
314 unsigned int sg_len, enum dma_data_direction direction, 408 unsigned int sg_len, enum dma_data_direction direction,
315 unsigned long flags); 409 unsigned long flags);
316 void (*device_terminate_all)(struct dma_chan *chan); 410 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
411 unsigned long arg);
317 412
318 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 413 enum dma_status (*device_tx_status)(struct dma_chan *chan,
319 dma_cookie_t cookie, dma_cookie_t *last, 414 dma_cookie_t cookie,
320 dma_cookie_t *used); 415 struct dma_tx_state *txstate);
321 void (*device_issue_pending)(struct dma_chan *chan); 416 void (*device_issue_pending)(struct dma_chan *chan);
322}; 417};
323 418
@@ -558,7 +653,15 @@ static inline void dma_async_issue_pending(struct dma_chan *chan)
558static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, 653static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan,
559 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) 654 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used)
560{ 655{
561 return chan->device->device_is_tx_complete(chan, cookie, last, used); 656 struct dma_tx_state state;
657 enum dma_status status;
658
659 status = chan->device->device_tx_status(chan, cookie, &state);
660 if (last)
661 *last = state.last;
662 if (used)
663 *used = state.used;
664 return status;
562} 665}
563 666
564#define dma_async_memcpy_complete(chan, cookie, last, used)\ 667#define dma_async_memcpy_complete(chan, cookie, last, used)\
@@ -586,6 +689,16 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
586 return DMA_IN_PROGRESS; 689 return DMA_IN_PROGRESS;
587} 690}
588 691
692static inline void
693dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
694{
695 if (st) {
696 st->last = last;
697 st->used = used;
698 st->residue = residue;
699 }
700}
701
589enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 702enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
590#ifdef CONFIG_DMA_ENGINE 703#ifdef CONFIG_DMA_ENGINE
591enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 704enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 527504c11c5e..4389ae72024e 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -110,6 +110,15 @@ typedef struct fs_disk_quota {
110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) 110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
111 111
112/* 112/*
113 * Accounting values. These can only be set for filesystem with
114 * non-transactional quotas that require quotacheck(8) in userspace.
115 */
116#define FS_DQ_BCOUNT (1<<12)
117#define FS_DQ_ICOUNT (1<<13)
118#define FS_DQ_RTBCOUNT (1<<14)
119#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
120
121/*
113 * Various flags related to quotactl(2). Only relevant to XFS filesystems. 122 * Various flags related to quotactl(2). Only relevant to XFS filesystems.
114 */ 123 */
115#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ 124#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 4341b1a97a34..68530521ad00 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,10 +53,10 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.7" 56#define REL_VERSION "8.3.8rc1"
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 92 59#define PRO_VERSION_MAX 94
60 60
61 61
62enum drbd_io_error_p { 62enum drbd_io_error_p {
@@ -139,6 +139,7 @@ enum drbd_ret_codes {
139 ERR_DATA_NOT_CURRENT = 150, 139 ERR_DATA_NOT_CURRENT = 150,
140 ERR_CONNECTED = 151, /* DRBD 8.3 only */ 140 ERR_CONNECTED = 151, /* DRBD 8.3 only */
141 ERR_PERM = 152, 141 ERR_PERM = 152,
142 ERR_NEED_APV_93 = 153,
142 143
143 /* insert new ones above this line */ 144 /* insert new ones above this line */
144 AFTER_LAST_ERR_CODE 145 AFTER_LAST_ERR_CODE
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 51f47a586ad8..440b42e38e89 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -133,5 +133,21 @@
133#define DRBD_MAX_BIO_BVECS_MAX 128 133#define DRBD_MAX_BIO_BVECS_MAX 128
134#define DRBD_MAX_BIO_BVECS_DEF 0 134#define DRBD_MAX_BIO_BVECS_DEF 0
135 135
136#define DRBD_DP_VOLUME_MIN 4
137#define DRBD_DP_VOLUME_MAX 1048576
138#define DRBD_DP_VOLUME_DEF 16384
139
140#define DRBD_DP_INTERVAL_MIN 1
141#define DRBD_DP_INTERVAL_MAX 600
142#define DRBD_DP_INTERVAL_DEF 5
143
144#define DRBD_RS_THROTTLE_TH_MIN 1
145#define DRBD_RS_THROTTLE_TH_MAX 600
146#define DRBD_RS_THROTTLE_TH_DEF 20
147
148#define DRBD_RS_HOLD_OFF_TH_MIN 1
149#define DRBD_RS_HOLD_OFF_TH_MAX 6000
150#define DRBD_RS_HOLD_OFF_TH_DEF 100
151
136#undef RANGE 152#undef RANGE
137#endif 153#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index f7431a4ca608..ce77a746fc9d 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -71,12 +71,17 @@ NL_PACKET(disconnect, 6, )
71NL_PACKET(resize, 7, 71NL_PACKET(resize, 7,
72 NL_INT64( 29, T_MAY_IGNORE, resize_size) 72 NL_INT64( 29, T_MAY_IGNORE, resize_size)
73 NL_BIT( 68, T_MAY_IGNORE, resize_force) 73 NL_BIT( 68, T_MAY_IGNORE, resize_force)
74 NL_BIT( 69, T_MANDATORY, no_resync)
74) 75)
75 76
76NL_PACKET(syncer_conf, 8, 77NL_PACKET(syncer_conf, 8,
77 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
78 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
79 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81 NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
80 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 85 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
81 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 86 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
82 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 87 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1cb3372e65d8..2c958f4fce1e 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -14,6 +14,9 @@ typedef void (elevator_merged_fn) (struct request_queue *, struct request *, int
14 14
15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *); 15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *);
16 16
17typedef void (elevator_bio_merged_fn) (struct request_queue *,
18 struct request *, struct bio *);
19
17typedef int (elevator_dispatch_fn) (struct request_queue *, int); 20typedef int (elevator_dispatch_fn) (struct request_queue *, int);
18 21
19typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); 22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
@@ -36,6 +39,7 @@ struct elevator_ops
36 elevator_merged_fn *elevator_merged_fn; 39 elevator_merged_fn *elevator_merged_fn;
37 elevator_merge_req_fn *elevator_merge_req_fn; 40 elevator_merge_req_fn *elevator_merge_req_fn;
38 elevator_allow_merge_fn *elevator_allow_merge_fn; 41 elevator_allow_merge_fn *elevator_allow_merge_fn;
42 elevator_bio_merged_fn *elevator_bio_merged_fn;
39 43
40 elevator_dispatch_fn *elevator_dispatch_fn; 44 elevator_dispatch_fn *elevator_dispatch_fn;
41 elevator_add_req_fn *elevator_add_req_fn; 45 elevator_add_req_fn *elevator_add_req_fn;
@@ -103,6 +107,8 @@ extern int elv_merge(struct request_queue *, struct request **, struct bio *);
103extern void elv_merge_requests(struct request_queue *, struct request *, 107extern void elv_merge_requests(struct request_queue *, struct request *,
104 struct request *); 108 struct request *);
105extern void elv_merged_request(struct request_queue *, struct request *, int); 109extern void elv_merged_request(struct request_queue *, struct request *, int);
110extern void elv_bio_merged(struct request_queue *q, struct request *,
111 struct bio *);
106extern void elv_requeue_request(struct request_queue *, struct request *); 112extern void elv_requeue_request(struct request_queue *, struct request *);
107extern int elv_queue_empty(struct request_queue *); 113extern int elv_queue_empty(struct request_queue *);
108extern struct request *elv_former_request(struct request_queue *, struct request *); 114extern struct request *elv_former_request(struct request_queue *, struct request *);
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 597858418051..4d608014753a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -394,6 +394,7 @@ typedef struct elf64_shdr {
394#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 394#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
395#define NT_S390_CTRS 0x304 /* s390 control registers */ 395#define NT_S390_CTRS 0x304 /* s390 control registers */
396#define NT_S390_PREFIX 0x305 /* s390 prefix register */ 396#define NT_S390_PREFIX 0x305 /* s390 prefix register */
397#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
397 398
398 399
399/* Note header in a PT_NOTE section */ 400/* Note header in a PT_NOTE section */
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index e687bc3ba4da..394a3e0e4a6b 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -150,8 +150,6 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse
150} 150}
151#endif 151#endif
152 152
153#endif /* __KERNEL__ */
154
155/* 153/*
156 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out 154 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
157 * extra segments containing the gate DSO contents. Dumping its 155 * extra segments containing the gate DSO contents. Dumping its
@@ -168,4 +166,6 @@ extern int
168elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); 166elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit);
169extern size_t elf_core_extra_data_size(void); 167extern size_t elf_core_extra_data_size(void);
170 168
169#endif /* __KERNEL__ */
170
171#endif /* _LINUX_ELFCORE_H */ 171#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b33f316bb92e..276b40a16835 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -310,6 +310,7 @@ struct ethtool_perm_addr {
310enum ethtool_flags { 310enum ethtool_flags {
311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ 312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
313 ETH_FLAG_RXHASH = (1 << 28),
313}; 314};
314 315
315/* The following structures are for supporting RX network flow 316/* The following structures are for supporting RX network flow
@@ -490,12 +491,12 @@ void ethtool_ntuple_flush(struct net_device *dev);
490 * get_ufo: Report whether UDP fragmentation offload is enabled 491 * get_ufo: Report whether UDP fragmentation offload is enabled
491 * set_ufo: Turn UDP fragmentation offload on or off 492 * set_ufo: Turn UDP fragmentation offload on or off
492 * self_test: Run specified self-tests 493 * self_test: Run specified self-tests
493 * get_strings: Return a set of strings that describe the requested objects 494 * get_strings: Return a set of strings that describe the requested objects
494 * phys_id: Identify the device 495 * phys_id: Identify the device
495 * get_stats: Return statistics about the device 496 * get_stats: Return statistics about the device
496 * get_flags: get 32-bit flags bitmap 497 * get_flags: get 32-bit flags bitmap
497 * set_flags: set 32-bit flags bitmap 498 * set_flags: set 32-bit flags bitmap
498 * 499 *
499 * Description: 500 * Description:
500 * 501 *
501 * get_settings: 502 * get_settings:
@@ -531,14 +532,20 @@ struct ethtool_ops {
531 int (*nway_reset)(struct net_device *); 532 int (*nway_reset)(struct net_device *);
532 u32 (*get_link)(struct net_device *); 533 u32 (*get_link)(struct net_device *);
533 int (*get_eeprom_len)(struct net_device *); 534 int (*get_eeprom_len)(struct net_device *);
534 int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 535 int (*get_eeprom)(struct net_device *,
535 int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 536 struct ethtool_eeprom *, u8 *);
537 int (*set_eeprom)(struct net_device *,
538 struct ethtool_eeprom *, u8 *);
536 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); 539 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
537 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); 540 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
538 void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); 541 void (*get_ringparam)(struct net_device *,
539 int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); 542 struct ethtool_ringparam *);
540 void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 543 int (*set_ringparam)(struct net_device *,
541 int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 544 struct ethtool_ringparam *);
545 void (*get_pauseparam)(struct net_device *,
546 struct ethtool_pauseparam*);
547 int (*set_pauseparam)(struct net_device *,
548 struct ethtool_pauseparam*);
542 u32 (*get_rx_csum)(struct net_device *); 549 u32 (*get_rx_csum)(struct net_device *);
543 int (*set_rx_csum)(struct net_device *, u32); 550 int (*set_rx_csum)(struct net_device *, u32);
544 u32 (*get_tx_csum)(struct net_device *); 551 u32 (*get_tx_csum)(struct net_device *);
@@ -550,21 +557,24 @@ struct ethtool_ops {
550 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 557 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
551 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 558 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
552 int (*phys_id)(struct net_device *, u32); 559 int (*phys_id)(struct net_device *, u32);
553 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 560 void (*get_ethtool_stats)(struct net_device *,
561 struct ethtool_stats *, u64 *);
554 int (*begin)(struct net_device *); 562 int (*begin)(struct net_device *);
555 void (*complete)(struct net_device *); 563 void (*complete)(struct net_device *);
556 u32 (*get_ufo)(struct net_device *); 564 u32 (*get_ufo)(struct net_device *);
557 int (*set_ufo)(struct net_device *, u32); 565 int (*set_ufo)(struct net_device *, u32);
558 u32 (*get_flags)(struct net_device *); 566 u32 (*get_flags)(struct net_device *);
559 int (*set_flags)(struct net_device *, u32); 567 int (*set_flags)(struct net_device *, u32);
560 u32 (*get_priv_flags)(struct net_device *); 568 u32 (*get_priv_flags)(struct net_device *);
561 int (*set_priv_flags)(struct net_device *, u32); 569 int (*set_priv_flags)(struct net_device *, u32);
562 int (*get_sset_count)(struct net_device *, int); 570 int (*get_sset_count)(struct net_device *, int);
563 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 571 int (*get_rxnfc)(struct net_device *,
572 struct ethtool_rxnfc *, void *);
564 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 573 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
565 int (*flash_device)(struct net_device *, struct ethtool_flash *); 574 int (*flash_device)(struct net_device *, struct ethtool_flash *);
566 int (*reset)(struct net_device *, u32 *); 575 int (*reset)(struct net_device *, u32 *);
567 int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); 576 int (*set_rx_ntuple)(struct net_device *,
577 struct ethtool_rx_ntuple *);
568 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *); 578 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
569}; 579};
570#endif /* __KERNEL__ */ 580#endif /* __KERNEL__ */
@@ -576,29 +586,29 @@ struct ethtool_ops {
576#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 586#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
577#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 587#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
578#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */ 588#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
579#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ 589#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
580#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */ 590#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
581#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */ 591#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
582#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ 592#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */
583#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ 593#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
584#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */ 594#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
585#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ 595#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
586#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */ 596#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
587#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ 597#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
588#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */ 598#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
589#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ 599#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
590#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */ 600#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
591#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ 601#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
592#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ 602#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
593#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ 603#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
594#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ 604#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
595#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable 605#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
596 * (ethtool_value) */ 606 * (ethtool_value) */
597#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable 607#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
598 * (ethtool_value). */ 608 * (ethtool_value). */
599#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */ 609#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
600#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ 610#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
601#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ 611#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
602#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */ 612#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
603#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */ 613#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
604#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */ 614#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
@@ -609,24 +619,24 @@ struct ethtool_ops {
609#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ 619#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
610#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */ 620#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
611#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */ 621#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
612#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 622#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
613#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 623#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
614 624
615#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 625#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
616#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 626#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
617#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 627#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
618#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 628#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
619#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 629#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
620#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 630#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
621#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 631#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
622#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 632#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
623#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 633#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
624#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 634#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
625#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 635#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
626#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 636#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
627#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 637#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
628#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ 638#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */
629#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 639#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
630 640
631/* compatibility with older code */ 641/* compatibility with older code */
632#define SPARC_ETH_GSET ETHTOOL_GSET 642#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -635,18 +645,18 @@ struct ethtool_ops {
635/* Indicates what features are supported by the interface. */ 645/* Indicates what features are supported by the interface. */
636#define SUPPORTED_10baseT_Half (1 << 0) 646#define SUPPORTED_10baseT_Half (1 << 0)
637#define SUPPORTED_10baseT_Full (1 << 1) 647#define SUPPORTED_10baseT_Full (1 << 1)
638#define SUPPORTED_100baseT_Half (1 << 2) 648#define SUPPORTED_100baseT_Half (1 << 2)
639#define SUPPORTED_100baseT_Full (1 << 3) 649#define SUPPORTED_100baseT_Full (1 << 3)
640#define SUPPORTED_1000baseT_Half (1 << 4) 650#define SUPPORTED_1000baseT_Half (1 << 4)
641#define SUPPORTED_1000baseT_Full (1 << 5) 651#define SUPPORTED_1000baseT_Full (1 << 5)
642#define SUPPORTED_Autoneg (1 << 6) 652#define SUPPORTED_Autoneg (1 << 6)
643#define SUPPORTED_TP (1 << 7) 653#define SUPPORTED_TP (1 << 7)
644#define SUPPORTED_AUI (1 << 8) 654#define SUPPORTED_AUI (1 << 8)
645#define SUPPORTED_MII (1 << 9) 655#define SUPPORTED_MII (1 << 9)
646#define SUPPORTED_FIBRE (1 << 10) 656#define SUPPORTED_FIBRE (1 << 10)
647#define SUPPORTED_BNC (1 << 11) 657#define SUPPORTED_BNC (1 << 11)
648#define SUPPORTED_10000baseT_Full (1 << 12) 658#define SUPPORTED_10000baseT_Full (1 << 12)
649#define SUPPORTED_Pause (1 << 13) 659#define SUPPORTED_Pause (1 << 13)
650#define SUPPORTED_Asym_Pause (1 << 14) 660#define SUPPORTED_Asym_Pause (1 << 14)
651#define SUPPORTED_2500baseX_Full (1 << 15) 661#define SUPPORTED_2500baseX_Full (1 << 15)
652#define SUPPORTED_Backplane (1 << 16) 662#define SUPPORTED_Backplane (1 << 16)
@@ -656,8 +666,8 @@ struct ethtool_ops {
656#define SUPPORTED_10000baseR_FEC (1 << 20) 666#define SUPPORTED_10000baseR_FEC (1 << 20)
657 667
658/* Indicates what features are advertised by the interface. */ 668/* Indicates what features are advertised by the interface. */
659#define ADVERTISED_10baseT_Half (1 << 0) 669#define ADVERTISED_10baseT_Half (1 << 0)
660#define ADVERTISED_10baseT_Full (1 << 1) 670#define ADVERTISED_10baseT_Full (1 << 1)
661#define ADVERTISED_100baseT_Half (1 << 2) 671#define ADVERTISED_100baseT_Half (1 << 2)
662#define ADVERTISED_100baseT_Full (1 << 3) 672#define ADVERTISED_100baseT_Full (1 << 3)
663#define ADVERTISED_1000baseT_Half (1 << 4) 673#define ADVERTISED_1000baseT_Half (1 << 4)
@@ -696,12 +706,12 @@ struct ethtool_ops {
696#define DUPLEX_FULL 0x01 706#define DUPLEX_FULL 0x01
697 707
698/* Which connector port. */ 708/* Which connector port. */
699#define PORT_TP 0x00 709#define PORT_TP 0x00
700#define PORT_AUI 0x01 710#define PORT_AUI 0x01
701#define PORT_MII 0x02 711#define PORT_MII 0x02
702#define PORT_FIBRE 0x03 712#define PORT_FIBRE 0x03
703#define PORT_BNC 0x04 713#define PORT_BNC 0x04
704#define PORT_DA 0x05 714#define PORT_DA 0x05
705#define PORT_NONE 0xef 715#define PORT_NONE 0xef
706#define PORT_OTHER 0xff 716#define PORT_OTHER 0xff
707 717
@@ -715,7 +725,7 @@ struct ethtool_ops {
715/* Enable or disable autonegotiation. If this is set to enable, 725/* Enable or disable autonegotiation. If this is set to enable,
716 * the forced link modes above are completely ignored. 726 * the forced link modes above are completely ignored.
717 */ 727 */
718#define AUTONEG_DISABLE 0x00 728#define AUTONEG_DISABLE 0x00
719#define AUTONEG_ENABLE 0x01 729#define AUTONEG_ENABLE 0x01
720 730
721/* Mode MDI or MDI-X */ 731/* Mode MDI or MDI-X */
@@ -746,8 +756,8 @@ struct ethtool_ops {
746#define AH_V6_FLOW 0x0b 756#define AH_V6_FLOW 0x0b
747#define ESP_V6_FLOW 0x0c 757#define ESP_V6_FLOW 0x0c
748#define IP_USER_FLOW 0x0d 758#define IP_USER_FLOW 0x0d
749#define IPV4_FLOW 0x10 759#define IPV4_FLOW 0x10
750#define IPV6_FLOW 0x11 760#define IPV6_FLOW 0x11
751 761
752/* L3-L4 network traffic flow hash options */ 762/* L3-L4 network traffic flow hash options */
753#define RXH_L2DA (1 << 1) 763#define RXH_L2DA (1 << 1)
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index 1cdb66367c98..db4d9f586bb6 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -106,6 +106,15 @@ struct ext2_sb_info {
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head; 108 struct ext2_reserve_window_node s_rsv_window_head;
109 /*
110 * s_lock protects against concurrent modifications of s_mount_state,
111 * s_blocks_last, s_overhead_last and the content of superblock's
112 * buffer pointed to by sbi->s_es.
113 *
114 * Note: It is used in ext2_show_options() to provide a consistent view
115 * of the mount options.
116 */
117 spinlock_t s_lock;
109}; 118};
110 119
111static inline spinlock_t * 120static inline spinlock_t *
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c10163b4c40e..1296af45169d 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -403,6 +403,7 @@ struct fb_cursor {
403#include <linux/notifier.h> 403#include <linux/notifier.h>
404#include <linux/list.h> 404#include <linux/list.h>
405#include <linux/backlight.h> 405#include <linux/backlight.h>
406#include <linux/slab.h>
406#include <asm/io.h> 407#include <asm/io.h>
407 408
408struct vm_area_struct; 409struct vm_area_struct;
@@ -862,10 +863,22 @@ struct fb_info {
862 /* we need the PCI or similiar aperture base/size not 863 /* we need the PCI or similiar aperture base/size not
863 smem_start/size as smem_start may just be an object 864 smem_start/size as smem_start may just be an object
864 allocated inside the aperture so may not actually overlap */ 865 allocated inside the aperture so may not actually overlap */
865 resource_size_t aperture_base; 866 struct apertures_struct {
866 resource_size_t aperture_size; 867 unsigned int count;
868 struct aperture {
869 resource_size_t base;
870 resource_size_t size;
871 } ranges[0];
872 } *apertures;
867}; 873};
868 874
875static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
876 struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
877 + max_num * sizeof(struct aperture), GFP_KERNEL);
878 a->count = max_num;
879 return a;
880}
881
869#ifdef MODULE 882#ifdef MODULE
870#define FBINFO_DEFAULT FBINFO_MODULE 883#define FBINFO_DEFAULT FBINFO_MODULE
871#else 884#else
@@ -958,6 +971,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
958/* drivers/video/fbmem.c */ 971/* drivers/video/fbmem.c */
959extern int register_framebuffer(struct fb_info *fb_info); 972extern int register_framebuffer(struct fb_info *fb_info);
960extern int unregister_framebuffer(struct fb_info *fb_info); 973extern int unregister_framebuffer(struct fb_info *fb_info);
974extern void remove_conflicting_framebuffers(struct apertures_struct *a,
975 const char *name, bool primary);
961extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 976extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
962extern int fb_show_logo(struct fb_info *fb_info, int rotate); 977extern int fb_show_logo(struct fb_info *fb_info, int rotate);
963extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 978extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 86037400a6e3..afc00af3229b 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -22,6 +22,12 @@
22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) 22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23 23
24/* 24/*
25 * Set and get of pipe page size array
26 */
27#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29
30/*
25 * Types of directory notifications that may be requested. 31 * Types of directory notifications that may be requested.
26 */ 32 */
27#define DN_ACCESS 0x00000001 /* File accessed */ 33#define DN_ACCESS 0x00000001 /* File accessed */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 29a0e3db9f43..151f5d703b7e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -123,7 +123,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
123#define SKF_AD_NLATTR_NEST 16 123#define SKF_AD_NLATTR_NEST 16
124#define SKF_AD_MARK 20 124#define SKF_AD_MARK 20
125#define SKF_AD_QUEUE 24 125#define SKF_AD_QUEUE 24
126#define SKF_AD_MAX 28 126#define SKF_AD_HATYPE 28
127#define SKF_AD_MAX 32
127#define SKF_NET_OFF (-0x100000) 128#define SKF_NET_OFF (-0x100000)
128#define SKF_LL_OFF (-0x200000) 129#define SKF_LL_OFF (-0x200000)
129 130
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 81f3b14d5d76..68f883b30a53 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -17,7 +17,7 @@
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE. 23 * DEALINGS IN THE SOFTWARE.
diff --git a/include/linux/firewire-constants.h b/include/linux/firewire-constants.h
index 9c63f06e67f2..9b4bb5fbba4b 100644
--- a/include/linux/firewire-constants.h
+++ b/include/linux/firewire-constants.h
@@ -17,7 +17,7 @@
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE. 23 * DEALINGS IN THE SOFTWARE.
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 043811f0d277..53d1e6c4f848 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -12,6 +12,7 @@
12struct firmware { 12struct firmware {
13 size_t size; 13 size_t size;
14 const u8 *data; 14 const u8 *data;
15 struct page **pages;
15}; 16};
16 17
17struct device; 18struct device;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 39d57bc6cc71..b336cb9ca9a0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -651,6 +651,7 @@ struct block_device {
651 int bd_openers; 651 int bd_openers;
652 struct mutex bd_mutex; /* open/close mutex */ 652 struct mutex bd_mutex; /* open/close mutex */
653 struct list_head bd_inodes; 653 struct list_head bd_inodes;
654 void * bd_claiming;
654 void * bd_holder; 655 void * bd_holder;
655 int bd_holders; 656 int bd_holders;
656#ifdef CONFIG_SYSFS 657#ifdef CONFIG_SYSFS
@@ -1280,10 +1281,12 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1280 1281
1281 1282
1282struct fasync_struct { 1283struct fasync_struct {
1283 int magic; 1284 spinlock_t fa_lock;
1284 int fa_fd; 1285 int magic;
1285 struct fasync_struct *fa_next; /* singly linked list */ 1286 int fa_fd;
1286 struct file *fa_file; 1287 struct fasync_struct *fa_next; /* singly linked list */
1288 struct file *fa_file;
1289 struct rcu_head fa_rcu;
1287}; 1290};
1288 1291
1289#define FASYNC_MAGIC 0x4601 1292#define FASYNC_MAGIC 0x4601
@@ -1292,8 +1295,6 @@ struct fasync_struct {
1292extern int fasync_helper(int, struct file *, int, struct fasync_struct **); 1295extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1293/* can be called from interrupts */ 1296/* can be called from interrupts */
1294extern void kill_fasync(struct fasync_struct **, int, int); 1297extern void kill_fasync(struct fasync_struct **, int, int);
1295/* only for net: no internal synchronization */
1296extern void __kill_fasync(struct fasync_struct *, int, int);
1297 1298
1298extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1299extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1299extern int f_setown(struct file *filp, unsigned long arg, int force); 1300extern int f_setown(struct file *filp, unsigned long arg, int force);
@@ -1314,8 +1315,6 @@ extern int send_sigurg(struct fown_struct *fown);
1314extern struct list_head super_blocks; 1315extern struct list_head super_blocks;
1315extern spinlock_t sb_lock; 1316extern spinlock_t sb_lock;
1316 1317
1317#define sb_entry(list) list_entry((list), struct super_block, s_list)
1318#define S_BIAS (1<<30)
1319struct super_block { 1318struct super_block {
1320 struct list_head s_list; /* Keep this first */ 1319 struct list_head s_list; /* Keep this first */
1321 dev_t s_dev; /* search index; _not_ kdev_t */ 1320 dev_t s_dev; /* search index; _not_ kdev_t */
@@ -1334,12 +1333,11 @@ struct super_block {
1334 struct rw_semaphore s_umount; 1333 struct rw_semaphore s_umount;
1335 struct mutex s_lock; 1334 struct mutex s_lock;
1336 int s_count; 1335 int s_count;
1337 int s_need_sync;
1338 atomic_t s_active; 1336 atomic_t s_active;
1339#ifdef CONFIG_SECURITY 1337#ifdef CONFIG_SECURITY
1340 void *s_security; 1338 void *s_security;
1341#endif 1339#endif
1342 struct xattr_handler **s_xattr; 1340 const struct xattr_handler **s_xattr;
1343 1341
1344 struct list_head s_inodes; /* all inodes */ 1342 struct list_head s_inodes; /* all inodes */
1345 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1343 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
@@ -1431,7 +1429,8 @@ extern void dentry_unhash(struct dentry *dentry);
1431 * VFS file helper functions. 1429 * VFS file helper functions.
1432 */ 1430 */
1433extern int file_permission(struct file *, int); 1431extern int file_permission(struct file *, int);
1434 1432extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1433 mode_t mode);
1435/* 1434/*
1436 * VFS FS_IOC_FIEMAP helper definitions. 1435 * VFS FS_IOC_FIEMAP helper definitions.
1437 */ 1436 */
@@ -1744,6 +1743,7 @@ struct file_system_type {
1744 1743
1745 struct lock_class_key s_lock_key; 1744 struct lock_class_key s_lock_key;
1746 struct lock_class_key s_umount_key; 1745 struct lock_class_key s_umount_key;
1746 struct lock_class_key s_vfs_rename_key;
1747 1747
1748 struct lock_class_key i_lock_key; 1748 struct lock_class_key i_lock_key;
1749 struct lock_class_key i_mutex_key; 1749 struct lock_class_key i_mutex_key;
@@ -1781,8 +1781,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1781 const struct super_operations *ops, unsigned long, 1781 const struct super_operations *ops, unsigned long,
1782 struct vfsmount *mnt); 1782 struct vfsmount *mnt);
1783extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1783extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1784int __put_super_and_need_restart(struct super_block *sb);
1785void put_super(struct super_block *sb);
1786 1784
1787/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1785/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1788#define fops_get(fops) \ 1786#define fops_get(fops) \
@@ -1802,6 +1800,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1802extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1800extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1803 struct vfsmount *); 1801 struct vfsmount *);
1804extern int vfs_statfs(struct dentry *, struct kstatfs *); 1802extern int vfs_statfs(struct dentry *, struct kstatfs *);
1803extern int freeze_super(struct super_block *super);
1804extern int thaw_super(struct super_block *super);
1805 1805
1806extern int current_umask(void); 1806extern int current_umask(void);
1807 1807
@@ -2087,9 +2087,9 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2087extern int filemap_fdatawrite_range(struct address_space *mapping, 2087extern int filemap_fdatawrite_range(struct address_space *mapping,
2088 loff_t start, loff_t end); 2088 loff_t start, loff_t end);
2089 2089
2090extern int vfs_fsync_range(struct file *file, struct dentry *dentry, 2090extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2091 loff_t start, loff_t end, int datasync); 2091 int datasync);
2092extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2092extern int vfs_fsync(struct file *file, int datasync);
2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2094extern void sync_supers(void); 2094extern void sync_supers(void);
2095extern void emergency_sync(void); 2095extern void emergency_sync(void);
@@ -2315,8 +2315,9 @@ extern int vfs_fstatat(int , char __user *, struct kstat *, int);
2315extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2315extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2316 unsigned long arg); 2316 unsigned long arg);
2317extern int __generic_block_fiemap(struct inode *inode, 2317extern int __generic_block_fiemap(struct inode *inode,
2318 struct fiemap_extent_info *fieinfo, u64 start, 2318 struct fiemap_extent_info *fieinfo,
2319 u64 len, get_block_t *get_block); 2319 loff_t start, loff_t len,
2320 get_block_t *get_block);
2320extern int generic_block_fiemap(struct inode *inode, 2321extern int generic_block_fiemap(struct inode *inode,
2321 struct fiemap_extent_info *fieinfo, u64 start, 2322 struct fiemap_extent_info *fieinfo, u64 start,
2322 u64 len, get_block_t *get_block); 2323 u64 len, get_block_t *get_block);
@@ -2328,6 +2329,7 @@ extern struct super_block *get_super(struct block_device *);
2328extern struct super_block *get_active_super(struct block_device *bdev); 2329extern struct super_block *get_active_super(struct block_device *bdev);
2329extern struct super_block *user_get_super(dev_t); 2330extern struct super_block *user_get_super(dev_t);
2330extern void drop_super(struct super_block *sb); 2331extern void drop_super(struct super_block *sb);
2332extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2331 2333
2332extern int dcache_dir_open(struct inode *, struct file *); 2334extern int dcache_dir_open(struct inode *, struct file *);
2333extern int dcache_dir_close(struct inode *, struct file *); 2335extern int dcache_dir_close(struct inode *, struct file *);
@@ -2361,6 +2363,8 @@ extern void simple_release_fs(struct vfsmount **mount, int *count);
2361 2363
2362extern ssize_t simple_read_from_buffer(void __user *to, size_t count, 2364extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2363 loff_t *ppos, const void *from, size_t available); 2365 loff_t *ppos, const void *from, size_t available);
2366extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2367 const void __user *from, size_t count);
2364 2368
2365extern int simple_fsync(struct file *, struct dentry *, int); 2369extern int simple_fsync(struct file *, struct dentry *, int);
2366 2370
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 01e6adea07ec..41e46330d9be 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -82,9 +82,13 @@ void clear_ftrace_function(void);
82extern void ftrace_stub(unsigned long a0, unsigned long a1); 82extern void ftrace_stub(unsigned long a0, unsigned long a1);
83 83
84#else /* !CONFIG_FUNCTION_TRACER */ 84#else /* !CONFIG_FUNCTION_TRACER */
85# define register_ftrace_function(ops) do { } while (0) 85/*
86# define unregister_ftrace_function(ops) do { } while (0) 86 * (un)register_ftrace_function must be a macro since the ops parameter
87# define clear_ftrace_function(ops) do { } while (0) 87 * must not be evaluated.
88 */
89#define register_ftrace_function(ops) ({ 0; })
90#define unregister_ftrace_function(ops) ({ 0; })
91static inline void clear_ftrace_function(void) { }
88static inline void ftrace_kill(void) { } 92static inline void ftrace_kill(void) { }
89static inline void ftrace_stop(void) { } 93static inline void ftrace_stop(void) { }
90static inline void ftrace_start(void) { } 94static inline void ftrace_start(void) { }
@@ -237,11 +241,13 @@ extern int skip_trace(unsigned long ip);
237extern void ftrace_disable_daemon(void); 241extern void ftrace_disable_daemon(void);
238extern void ftrace_enable_daemon(void); 242extern void ftrace_enable_daemon(void);
239#else 243#else
240# define skip_trace(ip) ({ 0; }) 244static inline int skip_trace(unsigned long ip) { return 0; }
241# define ftrace_force_update() ({ 0; }) 245static inline int ftrace_force_update(void) { return 0; }
242# define ftrace_set_filter(buf, len, reset) do { } while (0) 246static inline void ftrace_set_filter(unsigned char *buf, int len, int reset)
243# define ftrace_disable_daemon() do { } while (0) 247{
244# define ftrace_enable_daemon() do { } while (0) 248}
249static inline void ftrace_disable_daemon(void) { }
250static inline void ftrace_enable_daemon(void) { }
245static inline void ftrace_release_mod(struct module *mod) {} 251static inline void ftrace_release_mod(struct module *mod) {}
246static inline int register_ftrace_command(struct ftrace_func_command *cmd) 252static inline int register_ftrace_command(struct ftrace_func_command *cmd)
247{ 253{
@@ -314,16 +320,16 @@ static inline void __ftrace_enabled_restore(int enabled)
314 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 320 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
315 extern void time_hardirqs_off(unsigned long a0, unsigned long a1); 321 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
316#else 322#else
317# define time_hardirqs_on(a0, a1) do { } while (0) 323 static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { }
318# define time_hardirqs_off(a0, a1) do { } while (0) 324 static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }
319#endif 325#endif
320 326
321#ifdef CONFIG_PREEMPT_TRACER 327#ifdef CONFIG_PREEMPT_TRACER
322 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 328 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
323 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 329 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
324#else 330#else
325# define trace_preempt_on(a0, a1) do { } while (0) 331 static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { }
326# define trace_preempt_off(a0, a1) do { } while (0) 332 static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { }
327#endif 333#endif
328 334
329#ifdef CONFIG_FTRACE_MCOUNT_RECORD 335#ifdef CONFIG_FTRACE_MCOUNT_RECORD
@@ -352,6 +358,10 @@ struct ftrace_graph_ret {
352 int depth; 358 int depth;
353}; 359};
354 360
361/* Type of the callback handlers for tracing function graph*/
362typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
363typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
364
355#ifdef CONFIG_FUNCTION_GRAPH_TRACER 365#ifdef CONFIG_FUNCTION_GRAPH_TRACER
356 366
357/* for init task */ 367/* for init task */
@@ -400,10 +410,6 @@ extern char __irqentry_text_end[];
400 410
401#define FTRACE_RETFUNC_DEPTH 50 411#define FTRACE_RETFUNC_DEPTH 50
402#define FTRACE_RETSTACK_ALLOC_SIZE 32 412#define FTRACE_RETSTACK_ALLOC_SIZE 32
403/* Type of the callback handlers for tracing function graph*/
404typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
405typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
406
407extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 413extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
408 trace_func_graph_ent_t entryfunc); 414 trace_func_graph_ent_t entryfunc);
409 415
@@ -441,6 +447,13 @@ static inline void unpause_graph_tracing(void)
441static inline void ftrace_graph_init_task(struct task_struct *t) { } 447static inline void ftrace_graph_init_task(struct task_struct *t) { }
442static inline void ftrace_graph_exit_task(struct task_struct *t) { } 448static inline void ftrace_graph_exit_task(struct task_struct *t) { }
443 449
450static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
451 trace_func_graph_ent_t entryfunc)
452{
453 return -1;
454}
455static inline void unregister_ftrace_graph(void) { }
456
444static inline int task_curr_ret_stack(struct task_struct *tsk) 457static inline int task_curr_ret_stack(struct task_struct *tsk)
445{ 458{
446 return -1; 459 return -1;
@@ -492,7 +505,9 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
492 return tsk->trace & TSK_TRACE_FL_GRAPH; 505 return tsk->trace & TSK_TRACE_FL_GRAPH;
493} 506}
494 507
495extern int ftrace_dump_on_oops; 508enum ftrace_dump_mode;
509
510extern enum ftrace_dump_mode ftrace_dump_on_oops;
496 511
497#ifdef CONFIG_PREEMPT 512#ifdef CONFIG_PREEMPT
498#define INIT_TRACE_RECURSION .trace_recursion = 0, 513#define INIT_TRACE_RECURSION .trace_recursion = 0,
@@ -504,18 +519,6 @@ extern int ftrace_dump_on_oops;
504#define INIT_TRACE_RECURSION 519#define INIT_TRACE_RECURSION
505#endif 520#endif
506 521
507#ifdef CONFIG_HW_BRANCH_TRACER
508
509void trace_hw_branch(u64 from, u64 to);
510void trace_hw_branch_oops(void);
511
512#else /* CONFIG_HW_BRANCH_TRACER */
513
514static inline void trace_hw_branch(u64 from, u64 to) {}
515static inline void trace_hw_branch_oops(void) {}
516
517#endif /* CONFIG_HW_BRANCH_TRACER */
518
519#ifdef CONFIG_FTRACE_SYSCALLS 522#ifdef CONFIG_FTRACE_SYSCALLS
520 523
521unsigned long arch_syscall_addr(int nr); 524unsigned long arch_syscall_addr(int nr);
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c0f4b364c711..c082f223e2fe 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -25,6 +25,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
26 const struct trace_print_flags *symbol_array); 26 const struct trace_print_flags *symbol_array);
27 27
28const char *ftrace_print_hex_seq(struct trace_seq *p,
29 const unsigned char *buf, int len);
30
28/* 31/*
29 * The trace entry - the most basic unit of tracing. This is what 32 * The trace entry - the most basic unit of tracing. This is what
30 * is printed in the end as a single line in the trace output, such as: 33 * is printed in the end as a single line in the trace output, such as:
@@ -58,6 +61,7 @@ struct trace_iterator {
58 /* The below is zeroed out in pipe_read */ 61 /* The below is zeroed out in pipe_read */
59 struct trace_seq seq; 62 struct trace_seq seq;
60 struct trace_entry *ent; 63 struct trace_entry *ent;
64 unsigned long lost_events;
61 int leftover; 65 int leftover;
62 int cpu; 66 int cpu;
63 u64 ts; 67 u64 ts;
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index ca666d18ed67..574bea4013b6 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -5,8 +5,8 @@
5 5
6struct inode; 6struct inode;
7 7
8extern struct xattr_handler generic_acl_access_handler; 8extern const struct xattr_handler generic_acl_access_handler;
9extern struct xattr_handler generic_acl_default_handler; 9extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index b834ef6d59fa..61549b26ad6f 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -80,4 +80,12 @@ enum {
80 80
81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
82 82
83#ifdef __KERNEL__
84
85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void);
87extern void genl_unlock(void);
88
89#endif /* __KERNEL__ */
90
83#endif /* __LINUX_GENERIC_NETLINK_H */ 91#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/gsmmux.h b/include/linux/gsmmux.h
new file mode 100644
index 000000000000..378de4195caf
--- /dev/null
+++ b/include/linux/gsmmux.h
@@ -0,0 +1,25 @@
1#ifndef _LINUX_GSMMUX_H
2#define _LINUX_GSMMUX_H
3
4struct gsm_config
5{
6 unsigned int adaption;
7 unsigned int encapsulation;
8 unsigned int initiator;
9 unsigned int t1;
10 unsigned int t2;
11 unsigned int t3;
12 unsigned int n2;
13 unsigned int mru;
14 unsigned int mtu;
15 unsigned int k;
16 unsigned int i;
17 unsigned int unused[8]; /* Padding for expansion without
18 breaking stuff */
19};
20
21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
23
24
25#endif
diff --git a/include/linux/hdpu_features.h b/include/linux/hdpu_features.h
deleted file mode 100644
index 6a8715431ae4..000000000000
--- a/include/linux/hdpu_features.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#include <linux/spinlock.h>
2
3struct cpustate_t {
4 spinlock_t lock;
5 int excl;
6 int open_count;
7 unsigned char cached_val;
8 int inited;
9 unsigned long *set_addr;
10 unsigned long *clr_addr;
11};
12
13
14#define HDPU_CPUSTATE_NAME "hdpu cpustate"
15#define HDPU_NEXUS_NAME "hdpu nexus"
16
17#define CPUSTATE_KERNEL_MAJOR 0x10
18
19#define CPUSTATE_KERNEL_INIT_DRV 0 /* CPU State Driver Initialized */
20#define CPUSTATE_KERNEL_INIT_PCI 1 /* 64360 PCI Busses Init */
21#define CPUSTATE_KERNEL_INIT_REG 2 /* 64360 Bridge Init */
22#define CPUSTATE_KERNEL_CPU1_KICK 3 /* Boot cpu 1 */
23#define CPUSTATE_KERNEL_CPU1_OK 4 /* Cpu 1 has checked in */
24#define CPUSTATE_KERNEL_OK 5 /* Terminal state */
25#define CPUSTATE_KERNEL_RESET 14 /* Board reset via SW*/
26#define CPUSTATE_KERNEL_HALT 15 /* Board halted via SW*/
diff --git a/include/linux/hid.h b/include/linux/hid.h
index b1344ec4b7fc..895001f7f4b2 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -308,11 +308,13 @@ struct hid_item {
308#define HID_QUIRK_NOTOUCH 0x00000002 308#define HID_QUIRK_NOTOUCH 0x00000002
309#define HID_QUIRK_IGNORE 0x00000004 309#define HID_QUIRK_IGNORE 0x00000004
310#define HID_QUIRK_NOGET 0x00000008 310#define HID_QUIRK_NOGET 0x00000008
311#define HID_QUIRK_HIDDEV_FORCE 0x00000010
311#define HID_QUIRK_BADPAD 0x00000020 312#define HID_QUIRK_BADPAD 0x00000020
312#define HID_QUIRK_MULTI_INPUT 0x00000040 313#define HID_QUIRK_MULTI_INPUT 0x00000040
313#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 314#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
314#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 315#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
315#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 316#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
317#define HID_QUIRK_NO_IGNORE 0x40000000
316 318
317/* 319/*
318 * This is the global environment of the parser. This information is 320 * This is the global environment of the parser. This information is
@@ -589,6 +591,9 @@ struct hid_usage_id {
589 * @report_fixup: called before report descriptor parsing (NULL means nop) 591 * @report_fixup: called before report descriptor parsing (NULL means nop)
590 * @input_mapping: invoked on input registering before mapping an usage 592 * @input_mapping: invoked on input registering before mapping an usage
591 * @input_mapped: invoked on input registering after mapping an usage 593 * @input_mapped: invoked on input registering after mapping an usage
594 * @suspend: invoked on suspend (NULL means nop)
595 * @resume: invoked on resume if device was not reset (NULL means nop)
596 * @reset_resume: invoked on resume if device was reset (NULL means nop)
592 * 597 *
593 * raw_event and event should return 0 on no action performed, 1 when no 598 * raw_event and event should return 0 on no action performed, 1 when no
594 * further processing should be done and negative on error 599 * further processing should be done and negative on error
@@ -629,6 +634,11 @@ struct hid_driver {
629 int (*input_mapped)(struct hid_device *hdev, 634 int (*input_mapped)(struct hid_device *hdev,
630 struct hid_input *hidinput, struct hid_field *field, 635 struct hid_input *hidinput, struct hid_field *field,
631 struct hid_usage *usage, unsigned long **bit, int *max); 636 struct hid_usage *usage, unsigned long **bit, int *max);
637#ifdef CONFIG_PM
638 int (*suspend)(struct hid_device *hdev, pm_message_t message);
639 int (*resume)(struct hid_device *hdev);
640 int (*reset_resume)(struct hid_device *hdev);
641#endif
632/* private: */ 642/* private: */
633 struct device_driver driver; 643 struct device_driver driver;
634}; 644};
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5d86fb2309d2..fd0c1b857d3d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -422,6 +422,8 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
422 422
423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, 423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta,
424 const enum hrtimer_mode mode); 424 const enum hrtimer_mode mode);
425extern int schedule_hrtimeout_range_clock(ktime_t *expires,
426 unsigned long delta, const enum hrtimer_mode mode, int clock);
425extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); 427extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
426 428
427/* Soft interrupt function to run the hrtimer queues: */ 429/* Soft interrupt function to run the hrtimer queues: */
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index c70d27af03f9..a2d6ea49ec56 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -9,9 +9,22 @@ enum {
9}; 9};
10 10
11enum { 11enum {
12 HW_BREAKPOINT_R = 1, 12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_W = 2, 13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_X = 4, 14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
18};
19
20enum bp_type_idx {
21 TYPE_INST = 0,
22#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24#else
25 TYPE_DATA = 1,
26#endif
27 TYPE_MAX
15}; 28};
16 29
17#ifdef __KERNEL__ 30#ifdef __KERNEL__
@@ -34,6 +47,12 @@ static inline void hw_breakpoint_init(struct perf_event_attr *attr)
34 attr->sample_period = 1; 47 attr->sample_period = 1;
35} 48}
36 49
50static inline void ptrace_breakpoint_init(struct perf_event_attr *attr)
51{
52 hw_breakpoint_init(attr);
53 attr->exclude_kernel = 1;
54}
55
37static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 56static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
38{ 57{
39 return bp->attr.bp_addr; 58 return bp->attr.bp_addr;
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
new file mode 100644
index 000000000000..78ebf507ce56
--- /dev/null
+++ b/include/linux/i2c-omap.h
@@ -0,0 +1,9 @@
1#ifndef __I2C_OMAP_H__
2#define __I2C_OMAP_H__
3
4struct omap_i2c_bus_platform_data {
5 u32 clkrate;
6 void (*set_mpu_wkup_lat)(struct device *dev, long set);
7};
8
9#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4f37ff1de7e1..21067b418536 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -359,6 +359,8 @@ struct i2c_adapter {
359 int nr; 359 int nr;
360 char name[48]; 360 char name[48];
361 struct completion dev_released; 361 struct completion dev_released;
362
363 struct list_head userspace_clients;
362}; 364};
363#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 365#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
364 366
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index fb6784e86d5f..6de90bfc6acd 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -496,7 +496,7 @@ struct twl4030_madc_platform_data {
496 int irq_line; 496 int irq_line;
497}; 497};
498 498
499/* Boards have uniqe mappings of {row, col} --> keycode. 499/* Boards have unique mappings of {row, col} --> keycode.
500 * Column and row are 8 bits each, but range only from 0..7. 500 * Column and row are 8 bits each, but range only from 0..7.
501 * a PERSISTENT_KEY is "always on" and never reported. 501 * a PERSISTENT_KEY is "always on" and never reported.
502 */ 502 */
@@ -569,9 +569,9 @@ struct twl4030_codec_data {
569 struct twl4030_codec_audio_data *audio; 569 struct twl4030_codec_audio_data *audio;
570 struct twl4030_codec_vibra_data *vibra; 570 struct twl4030_codec_vibra_data *vibra;
571 571
572 /* twl6030 */ 572 /* twl6040 */
573 int audpwron_gpio; /* audio power-on gpio */ 573 int audpwron_gpio; /* audio power-on gpio */
574 int naudint_irq; /* audio interrupt */ 574 int naudint_irq; /* audio interrupt */
575}; 575};
576 576
577struct twl4030_platform_data { 577struct twl4030_platform_data {
@@ -664,15 +664,15 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
664#define TWL4030_REG_VUSB3V1 19 664#define TWL4030_REG_VUSB3V1 19
665 665
666/* TWL6030 SMPS/LDO's */ 666/* TWL6030 SMPS/LDO's */
667/* EXTERNAL dc-to-dc buck convertor contollable via SR */ 667/* EXTERNAL dc-to-dc buck convertor controllable via SR */
668#define TWL6030_REG_VDD1 30 668#define TWL6030_REG_VDD1 30
669#define TWL6030_REG_VDD2 31 669#define TWL6030_REG_VDD2 31
670#define TWL6030_REG_VDD3 32 670#define TWL6030_REG_VDD3 32
671 671
672/* Non SR compliant dc-to-dc buck convertors */ 672/* Non SR compliant dc-to-dc buck convertors */
673#define TWL6030_REG_VMEM 33 673#define TWL6030_REG_VMEM 33
674#define TWL6030_REG_V2V1 34 674#define TWL6030_REG_V2V1 34
675#define TWL6030_REG_V1V29 35 675#define TWL6030_REG_V1V29 35
676#define TWL6030_REG_V1V8 36 676#define TWL6030_REG_V1V8 36
677 677
678/* EXTERNAL LDOs */ 678/* EXTERNAL LDOs */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3239d1c10acb..b6d448048ae2 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -362,7 +362,7 @@ struct ide_drive_s;
362struct ide_disk_ops { 362struct ide_disk_ops {
363 int (*check)(struct ide_drive_s *, const char *); 363 int (*check)(struct ide_drive_s *, const char *);
364 int (*get_capacity)(struct ide_drive_s *); 364 int (*get_capacity)(struct ide_drive_s *);
365 u64 (*set_capacity)(struct ide_drive_s *, u64); 365 void (*unlock_native_capacity)(struct ide_drive_s *);
366 void (*setup)(struct ide_drive_s *); 366 void (*setup)(struct ide_drive_s *);
367 void (*flush)(struct ide_drive_s *); 367 void (*flush)(struct ide_drive_s *);
368 int (*init_media)(struct ide_drive_s *, struct gendisk *); 368 int (*init_media)(struct ide_drive_s *, struct gendisk *);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 19984958ab7b..97b2eae6a22c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -876,6 +876,7 @@ struct ieee80211_ht_cap {
876#define IEEE80211_HT_CAP_SGI_40 0x0040 876#define IEEE80211_HT_CAP_SGI_40 0x0040
877#define IEEE80211_HT_CAP_TX_STBC 0x0080 877#define IEEE80211_HT_CAP_TX_STBC 0x0080
878#define IEEE80211_HT_CAP_RX_STBC 0x0300 878#define IEEE80211_HT_CAP_RX_STBC 0x0300
879#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8
879#define IEEE80211_HT_CAP_DELAY_BA 0x0400 880#define IEEE80211_HT_CAP_DELAY_BA 0x0400
880#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 881#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
881#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 882#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
@@ -1211,6 +1212,8 @@ enum ieee80211_category {
1211 WLAN_CATEGORY_SA_QUERY = 8, 1212 WLAN_CATEGORY_SA_QUERY = 8,
1212 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1213 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1213 WLAN_CATEGORY_WMM = 17, 1214 WLAN_CATEGORY_WMM = 17,
1215 WLAN_CATEGORY_MESH_PLINK = 30, /* Pending ANA approval */
1216 WLAN_CATEGORY_MESH_PATH_SEL = 32, /* Pending ANA approval */
1214 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1217 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1215 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1218 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1216}; 1219};
@@ -1324,7 +1327,6 @@ enum ieee80211_back_actioncode {
1324enum ieee80211_back_parties { 1327enum ieee80211_back_parties {
1325 WLAN_BACK_RECIPIENT = 0, 1328 WLAN_BACK_RECIPIENT = 0,
1326 WLAN_BACK_INITIATOR = 1, 1329 WLAN_BACK_INITIATOR = 1,
1327 WLAN_BACK_TIMER = 2,
1328}; 1330};
1329 1331
1330/* SA Query action */ 1332/* SA Query action */
diff --git a/include/linux/if.h b/include/linux/if.h
index 3a9f410a296b..be350e62a905 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,6 +71,8 @@
71 * release skb->dst 71 * release skb->dst
72 */ 72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
74 76
75#define IF_GET_IFACE 0x0001 /* for querying only */ 77#define IF_GET_IFACE 0x0001 /* for querying only */
76#define IF_GET_PROTO 0x0002 78#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index e80b7f88f7c6..6d722f41ee7c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -90,6 +90,7 @@
90 90
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 91#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
93#define ARPHRD_CAIF 822 /* CAIF media type */
93 94
94#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 95#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
95#define ARPHRD_NONE 0xFFFE /* zero header length */ 96#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 299b4121f914..bed7a4682b90 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -109,6 +109,7 @@
109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ 109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ 111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
112#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
112 113
113/* 114/*
114 * This is an Ethernet frame header. 115 * This is an Ethernet frame header.
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c9bf92cd7653..85c812db5a3f 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -37,6 +37,38 @@ struct rtnl_link_stats {
37 __u32 tx_compressed; 37 __u32 tx_compressed;
38}; 38};
39 39
40struct rtnl_link_stats64 {
41 __u64 rx_packets; /* total packets received */
42 __u64 tx_packets; /* total packets transmitted */
43 __u64 rx_bytes; /* total bytes received */
44 __u64 tx_bytes; /* total bytes transmitted */
45 __u64 rx_errors; /* bad packets received */
46 __u64 tx_errors; /* packet transmit problems */
47 __u64 rx_dropped; /* no space in linux buffers */
48 __u64 tx_dropped; /* no space available in linux */
49 __u64 multicast; /* multicast packets received */
50 __u64 collisions;
51
52 /* detailed rx_errors: */
53 __u64 rx_length_errors;
54 __u64 rx_over_errors; /* receiver ring buff overflow */
55 __u64 rx_crc_errors; /* recved pkt with crc error */
56 __u64 rx_frame_errors; /* recv'd frame alignment error */
57 __u64 rx_fifo_errors; /* recv'r fifo overrun */
58 __u64 rx_missed_errors; /* receiver missed packet */
59
60 /* detailed tx_errors */
61 __u64 tx_aborted_errors;
62 __u64 tx_carrier_errors;
63 __u64 tx_fifo_errors;
64 __u64 tx_heartbeat_errors;
65 __u64 tx_window_errors;
66
67 /* for cslip etc */
68 __u64 rx_compressed;
69 __u64 tx_compressed;
70};
71
40/* The struct should be in sync with struct ifmap */ 72/* The struct should be in sync with struct ifmap */
41struct rtnl_link_ifmap { 73struct rtnl_link_ifmap {
42 __u64 mem_start; 74 __u64 mem_start;
@@ -79,10 +111,10 @@ enum {
79 IFLA_NET_NS_PID, 111 IFLA_NET_NS_PID,
80 IFLA_IFALIAS, 112 IFLA_IFALIAS,
81 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ 113 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
82 IFLA_VF_MAC, /* Hardware queue specific attributes */ 114 IFLA_VFINFO_LIST,
83 IFLA_VF_VLAN, 115 IFLA_STATS64,
84 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 116 IFLA_VF_PORTS,
85 IFLA_VFINFO, 117 IFLA_PORT_SELF,
86 __IFLA_MAX 118 __IFLA_MAX
87}; 119};
88 120
@@ -203,6 +235,24 @@ enum macvlan_mode {
203 235
204/* SR-IOV virtual function managment section */ 236/* SR-IOV virtual function managment section */
205 237
238enum {
239 IFLA_VF_INFO_UNSPEC,
240 IFLA_VF_INFO,
241 __IFLA_VF_INFO_MAX,
242};
243
244#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
245
246enum {
247 IFLA_VF_UNSPEC,
248 IFLA_VF_MAC, /* Hardware queue specific attributes */
249 IFLA_VF_VLAN,
250 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
251 __IFLA_VF_MAX,
252};
253
254#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
255
206struct ifla_vf_mac { 256struct ifla_vf_mac {
207 __u32 vf; 257 __u32 vf;
208 __u8 mac[32]; /* MAX_ADDR_LEN */ 258 __u8 mac[32]; /* MAX_ADDR_LEN */
@@ -226,4 +276,77 @@ struct ifla_vf_info {
226 __u32 qos; 276 __u32 qos;
227 __u32 tx_rate; 277 __u32 tx_rate;
228}; 278};
279
280/* VF ports management section
281 *
282 * Nested layout of set/get msg is:
283 *
284 * [IFLA_NUM_VF]
285 * [IFLA_VF_PORTS]
286 * [IFLA_VF_PORT]
287 * [IFLA_PORT_*], ...
288 * [IFLA_VF_PORT]
289 * [IFLA_PORT_*], ...
290 * ...
291 * [IFLA_PORT_SELF]
292 * [IFLA_PORT_*], ...
293 */
294
295enum {
296 IFLA_VF_PORT_UNSPEC,
297 IFLA_VF_PORT, /* nest */
298 __IFLA_VF_PORT_MAX,
299};
300
301#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
302
303enum {
304 IFLA_PORT_UNSPEC,
305 IFLA_PORT_VF, /* __u32 */
306 IFLA_PORT_PROFILE, /* string */
307 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
308 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
309 IFLA_PORT_HOST_UUID, /* binary UUID */
310 IFLA_PORT_REQUEST, /* __u8 */
311 IFLA_PORT_RESPONSE, /* __u16, output only */
312 __IFLA_PORT_MAX,
313};
314
315#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
316
317#define PORT_PROFILE_MAX 40
318#define PORT_UUID_MAX 16
319#define PORT_SELF_VF -1
320
321enum {
322 PORT_REQUEST_PREASSOCIATE = 0,
323 PORT_REQUEST_PREASSOCIATE_RR,
324 PORT_REQUEST_ASSOCIATE,
325 PORT_REQUEST_DISASSOCIATE,
326};
327
328enum {
329 PORT_VDP_RESPONSE_SUCCESS = 0,
330 PORT_VDP_RESPONSE_INVALID_FORMAT,
331 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
332 PORT_VDP_RESPONSE_UNUSED_VTID,
333 PORT_VDP_RESPONSE_VTID_VIOLATION,
334 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
335 PORT_VDP_RESPONSE_OUT_OF_SYNC,
336 /* 0x08-0xFF reserved for future VDP use */
337 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
338 PORT_PROFILE_RESPONSE_INPROGRESS,
339 PORT_PROFILE_RESPONSE_INVALID,
340 PORT_PROFILE_RESPONSE_BADSTATE,
341 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
342 PORT_PROFILE_RESPONSE_ERROR,
343};
344
345struct ifla_port_vsi {
346 __u8 vsi_mgr_id;
347 __u8 vsi_type_id[3];
348 __u8 vsi_type_version;
349 __u8 pad[3];
350};
351
229#endif /* _LINUX_IF_LINK_H */ 352#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index b78a712247da..9ea047aca795 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -85,6 +85,7 @@ extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
85 struct net_device *dev); 85 struct net_device *dev);
86 86
87 87
88extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); 88extern struct sk_buff *(*macvlan_handle_frame_hook)(struct macvlan_port *,
89 struct sk_buff *);
89 90
90#endif /* _LINUX_IF_MACVLAN_H */ 91#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index aa57a5f993fc..6ac23ef1801a 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -47,6 +47,7 @@ struct sockaddr_ll {
47#define PACKET_TX_RING 13 47#define PACKET_TX_RING 13
48#define PACKET_LOSS 14 48#define PACKET_LOSS 14
49#define PACKET_VNET_HDR 15 49#define PACKET_VNET_HDR 15
50#define PACKET_TX_TIMESTAMP 16
50 51
51struct tpacket_stats { 52struct tpacket_stats {
52 unsigned int tp_packets; 53 unsigned int tp_packets;
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index c58baea4a25b..184bc5566207 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -2,7 +2,7 @@
2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) 2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
3 * 3 *
4 * This file supplies definitions required by the PPP over L2TP driver 4 * This file supplies definitions required by the PPP over L2TP driver
5 * (pppol2tp.c). All version information wrt this file is located in pppol2tp.c 5 * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c
6 * 6 *
7 * License: 7 * License:
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
@@ -35,6 +35,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 35 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 36};
37 37
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure.
40 */
41struct pppol2tpv3_addr {
42 pid_t pid; /* pid that owns the fd.
43 * 0 => current */
44 int fd; /* FD of UDP or IP socket to use */
45
46 struct sockaddr_in addr; /* IP address and port to send to */
47
48 __u32 s_tunnel, s_session; /* For matching incoming packets */
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50};
51
38/* Socket options: 52/* Socket options:
39 * DEBUG - bitmask of debug message categories 53 * DEBUG - bitmask of debug message categories
40 * SENDSEQ - 0 => don't send packets with sequence numbers 54 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 90b5fae5d714..a6577af0c4e6 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -72,6 +72,15 @@ struct sockaddr_pppol2tp {
72 struct pppol2tp_addr pppol2tp; 72 struct pppol2tp_addr pppol2tp;
73}__attribute__ ((packed)); 73}__attribute__ ((packed));
74 74
75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
76 * bits. So we need a different sockaddr structure.
77 */
78struct sockaddr_pppol2tpv3 {
79 sa_family_t sa_family; /* address family, AF_PPPOX */
80 unsigned int sa_protocol; /* protocol identifier */
81 struct pppol2tpv3_addr pppol2tp;
82} __attribute__ ((packed));
83
75/********************************************************************* 84/*********************************************************************
76 * 85 *
77 * ioctl interface for defining forwarding of connections 86 * ioctl interface for defining forwarding of connections
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 1350a246893a..06b1829731fd 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -51,6 +51,8 @@
51#define TUNSETSNDBUF _IOW('T', 212, int) 51#define TUNSETSNDBUF _IOW('T', 212, int)
52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) 52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) 53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int)
54 56
55/* TUNSETIFF ifr flags */ 57/* TUNSETIFF ifr flags */
56#define IFF_TUN 0x0001 58#define IFF_TUN 0x0001
diff --git a/include/linux/if_x25.h b/include/linux/if_x25.h
new file mode 100644
index 000000000000..897765f5feb8
--- /dev/null
+++ b/include/linux/if_x25.h
@@ -0,0 +1,26 @@
1/*
2 * Linux X.25 packet to device interface
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _IF_X25_H
16#define _IF_X25_H
17
18#include <linux/types.h>
19
20/* Documentation/networking/x25-iface.txt */
21#define X25_IFACE_DATA 0x00
22#define X25_IFACE_CONNECT 0x01
23#define X25_IFACE_DISCONNECT 0x02
24#define X25_IFACE_PARAMS 0x03
25
26#endif /* _IF_X25_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index bd55c6e46b2e..c4bf46f764bf 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -221,10 +221,10 @@ struct in6_flowlabel_req {
221#define IPV6_RTHDR 57 221#define IPV6_RTHDR 57
222#define IPV6_RECVDSTOPTS 58 222#define IPV6_RECVDSTOPTS 58
223#define IPV6_DSTOPTS 59 223#define IPV6_DSTOPTS 59
224#if 0 /* not yet */
225#define IPV6_RECVPATHMTU 60 224#define IPV6_RECVPATHMTU 60
226#define IPV6_PATHMTU 61 225#define IPV6_PATHMTU 61
227#define IPV6_DONTFRAG 62 226#define IPV6_DONTFRAG 62
227#if 0 /* not yet */
228#define IPV6_USE_MIN_MTU 63 228#define IPV6_USE_MIN_MTU 63
229#endif 229#endif
230 230
@@ -265,6 +265,9 @@ struct in6_flowlabel_req {
265#define IPV6_PREFER_SRC_CGA 0x0008 265#define IPV6_PREFER_SRC_CGA 0x0008
266#define IPV6_PREFER_SRC_NONCGA 0x0800 266#define IPV6_PREFER_SRC_NONCGA 0x0800
267 267
268/* RFC5082: Generalized Ttl Security Mechanism */
269#define IPV6_MINHOPCOUNT 73
270
268/* 271/*
269 * Multicast Routing: 272 * Multicast Routing:
270 * see include/linux/mroute6.h. 273 * see include/linux/mroute6.h.
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index b1ed1cd8e2a8..7996fc2c9ba9 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -49,7 +49,6 @@ extern struct group_info init_groups;
49 { .first = &init_task.pids[PIDTYPE_PGID].node }, \ 49 { .first = &init_task.pids[PIDTYPE_PGID].node }, \
50 { .first = &init_task.pids[PIDTYPE_SID].node }, \ 50 { .first = &init_task.pids[PIDTYPE_SID].node }, \
51 }, \ 51 }, \
52 .rcu = RCU_HEAD_INIT, \
53 .level = 0, \ 52 .level = 0, \
54 .numbers = { { \ 53 .numbers = { { \
55 .nr = 0, \ 54 .nr = 0, \
diff --git a/include/linux/input.h b/include/linux/input.h
index 7ed2251b33f1..83524e4f3290 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -806,6 +806,7 @@ struct input_absinfo {
806#define BUS_HOST 0x19 806#define BUS_HOST 0x19
807#define BUS_GSC 0x1A 807#define BUS_GSC 0x1A
808#define BUS_ATARI 0x1B 808#define BUS_ATARI 0x1B
809#define BUS_SPI 0x1C
809 810
810/* 811/*
811 * MT_TOOL types 812 * MT_TOOL types
diff --git a/include/linux/input/ad714x.h b/include/linux/input/ad714x.h
new file mode 100644
index 000000000000..0cbe5e81482e
--- /dev/null
+++ b/include/linux/input/ad714x.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/input/ad714x.h
3 *
4 * AD714x is very flexible, it can be used as buttons, scrollwheel,
5 * slider, touchpad at the same time. That depends on the boards.
6 * The platform_data for the device's "struct device" holds this
7 * information.
8 *
9 * Copyright 2009 Analog Devices Inc.
10 *
11 * Licensed under the GPL-2 or later.
12 */
13
14#ifndef __LINUX_INPUT_AD714X_H__
15#define __LINUX_INPUT_AD714X_H__
16
17#define STAGE_NUM 12
18#define STAGE_CFGREG_NUM 8
19#define SYS_CFGREG_NUM 8
20
21/* board information which need be initialized in arch/mach... */
22struct ad714x_slider_plat {
23 int start_stage;
24 int end_stage;
25 int max_coord;
26};
27
28struct ad714x_wheel_plat {
29 int start_stage;
30 int end_stage;
31 int max_coord;
32};
33
34struct ad714x_touchpad_plat {
35 int x_start_stage;
36 int x_end_stage;
37 int x_max_coord;
38
39 int y_start_stage;
40 int y_end_stage;
41 int y_max_coord;
42};
43
44struct ad714x_button_plat {
45 int keycode;
46 unsigned short l_mask;
47 unsigned short h_mask;
48};
49
50struct ad714x_platform_data {
51 int slider_num;
52 int wheel_num;
53 int touchpad_num;
54 int button_num;
55 struct ad714x_slider_plat *slider;
56 struct ad714x_wheel_plat *wheel;
57 struct ad714x_touchpad_plat *touchpad;
58 struct ad714x_button_plat *button;
59 unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
60 unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
61};
62
63#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 75f3f00ac1e5..c2331138ca1b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -39,7 +39,8 @@
39 * These flags used only by the kernel as part of the 39 * These flags used only by the kernel as part of the
40 * irq handling routines. 40 * irq handling routines.
41 * 41 *
42 * IRQF_DISABLED - keep irqs disabled when calling the action handler 42 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
43 * DEPRECATED. This flag is a NOOP and scheduled to be removed
43 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator 44 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
44 * IRQF_SHARED - allow sharing the irq among several devices 45 * IRQF_SHARED - allow sharing the irq among several devices
45 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 46 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
@@ -77,6 +78,18 @@ enum {
77 IRQTF_AFFINITY, 78 IRQTF_AFFINITY,
78}; 79};
79 80
81/*
82 * These values can be returned by request_any_context_irq() and
83 * describe the context the interrupt will be run in.
84 *
85 * IRQC_IS_HARDIRQ - interrupt runs in hardirq context
86 * IRQC_IS_NESTED - interrupt runs in a nested threaded context
87 */
88enum {
89 IRQC_IS_HARDIRQ = 0,
90 IRQC_IS_NESTED,
91};
92
80typedef irqreturn_t (*irq_handler_t)(int, void *); 93typedef irqreturn_t (*irq_handler_t)(int, void *);
81 94
82/** 95/**
@@ -120,6 +133,10 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
120 return request_threaded_irq(irq, handler, NULL, flags, name, dev); 133 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
121} 134}
122 135
136extern int __must_check
137request_any_context_irq(unsigned int irq, irq_handler_t handler,
138 unsigned long flags, const char *name, void *dev_id);
139
123extern void exit_irq_thread(void); 140extern void exit_irq_thread(void);
124#else 141#else
125 142
@@ -141,6 +158,13 @@ request_threaded_irq(unsigned int irq, irq_handler_t handler,
141 return request_irq(irq, handler, flags, name, dev); 158 return request_irq(irq, handler, flags, name, dev);
142} 159}
143 160
161static inline int __must_check
162request_any_context_irq(unsigned int irq, irq_handler_t handler,
163 unsigned long flags, const char *name, void *dev_id)
164{
165 return request_irq(irq, handler, flags, name, dev_id);
166}
167
144static inline void exit_irq_thread(void) { } 168static inline void exit_irq_thread(void) { }
145#endif 169#endif
146 170
@@ -209,6 +233,7 @@ extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
209extern int irq_can_set_affinity(unsigned int irq); 233extern int irq_can_set_affinity(unsigned int irq);
210extern int irq_select_affinity(unsigned int irq); 234extern int irq_select_affinity(unsigned int irq);
211 235
236extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
212#else /* CONFIG_SMP */ 237#else /* CONFIG_SMP */
213 238
214static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 239static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -223,6 +248,11 @@ static inline int irq_can_set_affinity(unsigned int irq)
223 248
224static inline int irq_select_affinity(unsigned int irq) { return 0; } 249static inline int irq_select_affinity(unsigned int irq) { return 0; }
225 250
251static inline int irq_set_affinity_hint(unsigned int irq,
252 const struct cpumask *m)
253{
254 return -EINVAL;
255}
226#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 256#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
227 257
228#ifdef CONFIG_GENERIC_HARDIRQS 258#ifdef CONFIG_GENERIC_HARDIRQS
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3af4ffd591b9..be22ad83689c 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -37,9 +37,9 @@ struct iommu_ops {
37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
39 int (*map)(struct iommu_domain *domain, unsigned long iova, 39 int (*map)(struct iommu_domain *domain, unsigned long iova,
40 phys_addr_t paddr, size_t size, int prot); 40 phys_addr_t paddr, int gfp_order, int prot);
41 void (*unmap)(struct iommu_domain *domain, unsigned long iova, 41 int (*unmap)(struct iommu_domain *domain, unsigned long iova,
42 size_t size); 42 int gfp_order);
43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
44 unsigned long iova); 44 unsigned long iova);
45 int (*domain_has_cap)(struct iommu_domain *domain, 45 int (*domain_has_cap)(struct iommu_domain *domain,
@@ -56,10 +56,10 @@ extern int iommu_attach_device(struct iommu_domain *domain,
56 struct device *dev); 56 struct device *dev);
57extern void iommu_detach_device(struct iommu_domain *domain, 57extern void iommu_detach_device(struct iommu_domain *domain,
58 struct device *dev); 58 struct device *dev);
59extern int iommu_map_range(struct iommu_domain *domain, unsigned long iova, 59extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
60 phys_addr_t paddr, size_t size, int prot); 60 phys_addr_t paddr, int gfp_order, int prot);
61extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova, 61extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
62 size_t size); 62 int gfp_order);
63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
64 unsigned long iova); 64 unsigned long iova);
65extern int iommu_domain_has_cap(struct iommu_domain *domain, 65extern int iommu_domain_has_cap(struct iommu_domain *domain,
@@ -96,16 +96,16 @@ static inline void iommu_detach_device(struct iommu_domain *domain,
96{ 96{
97} 97}
98 98
99static inline int iommu_map_range(struct iommu_domain *domain, 99static inline int iommu_map(struct iommu_domain *domain, unsigned long iova,
100 unsigned long iova, phys_addr_t paddr, 100 phys_addr_t paddr, int gfp_order, int prot)
101 size_t size, int prot)
102{ 101{
103 return -ENODEV; 102 return -ENODEV;
104} 103}
105 104
106static inline void iommu_unmap_range(struct iommu_domain *domain, 105static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
107 unsigned long iova, size_t size) 106 int gfp_order)
108{ 107{
108 return -ENODEV;
109} 109}
110 110
111static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 111static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 26fad187d661..b22790268b64 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -52,6 +52,7 @@ struct resource_list {
52 52
53#define IORESOURCE_MEM_64 0x00100000 53#define IORESOURCE_MEM_64 0x00100000
54#define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ 54#define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */
55#define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */
55 56
56#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 57#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
57#define IORESOURCE_DISABLED 0x10000000 58#define IORESOURCE_DISABLED 0x10000000
@@ -143,7 +144,8 @@ static inline unsigned long resource_type(const struct resource *res)
143} 144}
144 145
145/* Convenience shorthand with allocation */ 146/* Convenience shorthand with allocation */
146#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 147#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
148#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
147#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) 149#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
148#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) 150#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
149#define request_mem_region_exclusive(start,n,name) \ 151#define request_mem_region_exclusive(start,n,name) \
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0cc9a7db2b5..99e1ab7e3eec 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -21,6 +21,10 @@ struct in6_pktinfo {
21 int ipi6_ifindex; 21 int ipi6_ifindex;
22}; 22};
23 23
24struct ip6_mtuinfo {
25 struct sockaddr_in6 ip6m_addr;
26 __u32 ip6m_mtu;
27};
24 28
25struct in6_ifreq { 29struct in6_ifreq {
26 struct in6_addr ifr6_addr; 30 struct in6_addr ifr6_addr;
@@ -250,9 +254,11 @@ struct inet6_skb_parm {
250 254
251#define IP6SKB_XFRM_TRANSFORMED 1 255#define IP6SKB_XFRM_TRANSFORMED 1
252#define IP6SKB_FORWARDED 2 256#define IP6SKB_FORWARDED 2
257#define IP6SKB_REROUTED 4
253}; 258};
254 259
255#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 260#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
261#define IP6CBMTU(skb) ((struct ip6_mtuinfo *)((skb)->cb))
256 262
257static inline int inet6_iif(const struct sk_buff *skb) 263static inline int inet6_iif(const struct sk_buff *skb)
258{ 264{
@@ -334,21 +340,25 @@ struct ipv6_pinfo {
334 dstopts:1, 340 dstopts:1,
335 odstopts:1, 341 odstopts:1,
336 rxflow:1, 342 rxflow:1,
337 rxtclass:1; 343 rxtclass:1,
344 rxpmtu:1;
338 } bits; 345 } bits;
339 __u16 all; 346 __u16 all;
340 } rxopt; 347 } rxopt;
341 348
342 /* sockopt flags */ 349 /* sockopt flags */
343 __u8 recverr:1, 350 __u16 recverr:1,
344 sndflow:1, 351 sndflow:1,
345 pmtudisc:2, 352 pmtudisc:2,
346 ipv6only:1, 353 ipv6only:1,
347 srcprefs:3; /* 001: prefer temporary address 354 srcprefs:3, /* 001: prefer temporary address
348 * 010: prefer public address 355 * 010: prefer public address
349 * 100: prefer care-of address 356 * 100: prefer care-of address
350 */ 357 */
358 dontfrag:1;
359 __u8 min_hopcount;
351 __u8 tclass; 360 __u8 tclass;
361 __u8 padding;
352 362
353 __u32 dst_cookie; 363 __u32 dst_cookie;
354 364
@@ -358,6 +368,7 @@ struct ipv6_pinfo {
358 368
359 struct ipv6_txoptions *opt; 369 struct ipv6_txoptions *opt;
360 struct sk_buff *pktoptions; 370 struct sk_buff *pktoptions;
371 struct sk_buff *rxpmtu;
361 struct { 372 struct {
362 struct ipv6_txoptions *opt; 373 struct ipv6_txoptions *opt;
363 u8 hop_limit; 374 u8 hop_limit;
@@ -372,6 +383,7 @@ struct raw6_sock {
372 __u32 checksum; /* perform checksum */ 383 __u32 checksum; /* perform checksum */
373 __u32 offset; /* checksum offset */ 384 __u32 offset; /* checksum offset */
374 struct icmp6_filter filter; 385 struct icmp6_filter filter;
386 __u32 ip6mr_table;
375 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ 387 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */
376 struct ipv6_pinfo inet6; 388 struct ipv6_pinfo inet6;
377}; 389};
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 707ab122e2e6..c03243ad84b4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -195,6 +195,7 @@ struct irq_desc {
195 raw_spinlock_t lock; 195 raw_spinlock_t lock;
196#ifdef CONFIG_SMP 196#ifdef CONFIG_SMP
197 cpumask_var_t affinity; 197 cpumask_var_t affinity;
198 const struct cpumask *affinity_hint;
198 unsigned int node; 199 unsigned int node;
199#ifdef CONFIG_GENERIC_PENDING_IRQ 200#ifdef CONFIG_GENERIC_PENDING_IRQ
200 cpumask_var_t pending_mask; 201 cpumask_var_t pending_mask;
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index cd5a269fdb5e..e2d28b026a8c 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -43,10 +43,10 @@
43 */ 43 */
44 44
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/mod_devicetable.h>
46 47
47#define DEVICE_COUNT_COMPATIBLE 4 48#define DEVICE_COUNT_COMPATIBLE 4
48 49
49#define ISAPNP_ANY_ID 0xffff
50#define ISAPNP_CARD_DEVS 8 50#define ISAPNP_CARD_DEVS 8
51 51
52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \ 52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
@@ -74,12 +74,6 @@ struct isapnp_card_id {
74#define ISAPNP_DEVICE_SINGLE_END \ 74#define ISAPNP_DEVICE_SINGLE_END \
75 .card_vendor = 0, .card_device = 0 75 .card_vendor = 0, .card_device = 0
76 76
77struct isapnp_device_id {
78 unsigned short card_vendor, card_device;
79 unsigned short vendor, function;
80 unsigned long driver_data; /* data private to the driver */
81};
82
83#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) 77#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
84 78
85#define __ISAPNP__ 79#define __ISAPNP__
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 516a2a27e87a..e06965081ba5 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -427,9 +427,9 @@ struct transaction_s
427 enum { 427 enum {
428 T_RUNNING, 428 T_RUNNING,
429 T_LOCKED, 429 T_LOCKED,
430 T_RUNDOWN,
431 T_FLUSH, 430 T_FLUSH,
432 T_COMMIT, 431 T_COMMIT,
432 T_COMMIT_RECORD,
433 T_FINISHED 433 T_FINISHED
434 } t_state; 434 } t_state;
435 435
@@ -991,6 +991,7 @@ int journal_start_commit(journal_t *journal, tid_t *tid);
991int journal_force_commit_nested(journal_t *journal); 991int journal_force_commit_nested(journal_t *journal);
992int log_wait_commit(journal_t *journal, tid_t tid); 992int log_wait_commit(journal_t *journal, tid_t tid);
993int log_do_checkpoint(journal_t *journal); 993int log_do_checkpoint(journal_t *journal);
994int journal_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
994 995
995void __log_wait_for_space(journal_t *journal); 996void __log_wait_for_space(journal_t *journal);
996extern void __journal_drop_transaction(journal_t *, transaction_t *); 997extern void __journal_drop_transaction(journal_t *, transaction_t *);
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 2b32d638147d..0874ab59ffef 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -215,8 +215,8 @@ union jffs2_node_union
215 215
216/* Data payload for device nodes. */ 216/* Data payload for device nodes. */
217union jffs2_device_node { 217union jffs2_device_node {
218 jint16_t old; 218 jint16_t old_id;
219 jint32_t new; 219 jint32_t new_id;
220}; 220};
221 221
222#endif /* __LINUX_JFFS2_H__ */ 222#endif /* __LINUX_JFFS2_H__ */
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
new file mode 100644
index 000000000000..ccb2b3ec0fe8
--- /dev/null
+++ b/include/linux/kdb.h
@@ -0,0 +1,117 @@
1#ifndef _KDB_H
2#define _KDB_H
3
4/*
5 * Kernel Debugger Architecture Independent Global Headers
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
12 * Copyright (C) 2000 Stephane Eranian <eranian@hpl.hp.com>
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */
15
16#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h>
18#include <linux/sched.h>
19#include <asm/atomic.h>
20
21#define KDB_POLL_FUNC_MAX 5
22extern int kdb_poll_idx;
23
24/*
25 * kdb_initial_cpu is initialized to -1, and is set to the cpu
26 * number whenever the kernel debugger is entered.
27 */
28extern int kdb_initial_cpu;
29extern atomic_t kdb_event;
30
31/*
32 * kdb_diemsg
33 *
34 * Contains a pointer to the last string supplied to the
35 * kernel 'die' panic function.
36 */
37extern const char *kdb_diemsg;
38
39#define KDB_FLAG_EARLYKDB (1 << 0) /* set from boot parameter kdb=early */
40#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */
41#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */
42#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */
43#define KDB_FLAG_ONLY_DO_DUMP (1 << 4) /* Only do a dump, used when
44 * kdb is off */
45#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available,
46 * kdb is disabled */
47#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do
48 * not use keyboard */
49#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
50 * not use keyboard */
51
52extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */
53
54extern void kdb_save_flags(void);
55extern void kdb_restore_flags(void);
56
57#define KDB_FLAG(flag) (kdb_flags & KDB_FLAG_##flag)
58#define KDB_FLAG_SET(flag) ((void)(kdb_flags |= KDB_FLAG_##flag))
59#define KDB_FLAG_CLEAR(flag) ((void)(kdb_flags &= ~KDB_FLAG_##flag))
60
61/*
62 * External entry point for the kernel debugger. The pt_regs
63 * at the time of entry are supplied along with the reason for
64 * entry to the kernel debugger.
65 */
66
67typedef enum {
68 KDB_REASON_ENTER = 1, /* KDB_ENTER() trap/fault - regs valid */
69 KDB_REASON_ENTER_SLAVE, /* KDB_ENTER_SLAVE() trap/fault - regs valid */
70 KDB_REASON_BREAK, /* Breakpoint inst. - regs valid */
71 KDB_REASON_DEBUG, /* Debug Fault - regs valid */
72 KDB_REASON_OOPS, /* Kernel Oops - regs valid */
73 KDB_REASON_SWITCH, /* CPU switch - regs valid*/
74 KDB_REASON_KEYBOARD, /* Keyboard entry - regs valid */
75 KDB_REASON_NMI, /* Non-maskable interrupt; regs valid */
76 KDB_REASON_RECURSE, /* Recursive entry to kdb;
77 * regs probably valid */
78 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
79} kdb_reason_t;
80
81extern int kdb_trap_printk;
82extern int vkdb_printf(const char *fmt, va_list args)
83 __attribute__ ((format (printf, 1, 0)));
84extern int kdb_printf(const char *, ...)
85 __attribute__ ((format (printf, 1, 2)));
86typedef int (*kdb_printf_t)(const char *, ...)
87 __attribute__ ((format (printf, 1, 2)));
88
89extern void kdb_init(int level);
90
91/* Access to kdb specific polling devices */
92typedef int (*get_char_func)(void);
93extern get_char_func kdb_poll_funcs[];
94extern int kdb_get_kbd_char(void);
95
96static inline
97int kdb_process_cpu(const struct task_struct *p)
98{
99 unsigned int cpu = task_thread_info(p)->cpu;
100 if (cpu > num_possible_cpus())
101 cpu = 0;
102 return cpu;
103}
104
105/* kdb access to register set for stack dumping */
106extern struct pt_regs *kdb_current_regs;
107
108#else /* ! CONFIG_KGDB_KDB */
109#define kdb_printf(...)
110#define kdb_init(x)
111#endif /* CONFIG_KGDB_KDB */
112enum {
113 KDB_NOT_INITIALIZED,
114 KDB_INIT_EARLY,
115 KDB_INIT_FULL,
116};
117#endif /* !_KDB_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9365227dbaf6..cc5e3ffe9fce 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -4,6 +4,8 @@
4/* 4/*
5 * 'kernel.h' contains some often-used function prototypes etc 5 * 'kernel.h' contains some often-used function prototypes etc
6 */ 6 */
7#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
8#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
7 9
8#ifdef __KERNEL__ 10#ifdef __KERNEL__
9 11
@@ -37,8 +39,8 @@ extern const char linux_proc_banner[];
37 39
38#define STACK_MAGIC 0xdeadbeef 40#define STACK_MAGIC 0xdeadbeef
39 41
40#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 42#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
41#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 43#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
42#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 44#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
43#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 45#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
44 46
@@ -344,6 +346,7 @@ extern enum system_states {
344#define TAINT_OVERRIDDEN_ACPI_TABLE 8 346#define TAINT_OVERRIDDEN_ACPI_TABLE 8
345#define TAINT_WARN 9 347#define TAINT_WARN 9
346#define TAINT_CRAP 10 348#define TAINT_CRAP 10
349#define TAINT_FIRMWARE_WORKAROUND 11
347 350
348extern void dump_stack(void) __cold; 351extern void dump_stack(void) __cold;
349 352
@@ -490,6 +493,13 @@ static inline void tracing_off(void) { }
490static inline void tracing_off_permanent(void) { } 493static inline void tracing_off_permanent(void) { }
491static inline int tracing_is_on(void) { return 0; } 494static inline int tracing_is_on(void) { return 0; }
492#endif 495#endif
496
497enum ftrace_dump_mode {
498 DUMP_NONE,
499 DUMP_ALL,
500 DUMP_ORIG,
501};
502
493#ifdef CONFIG_TRACING 503#ifdef CONFIG_TRACING
494extern void tracing_start(void); 504extern void tracing_start(void);
495extern void tracing_stop(void); 505extern void tracing_stop(void);
@@ -571,7 +581,7 @@ __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
571extern int 581extern int
572__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); 582__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
573 583
574extern void ftrace_dump(void); 584extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
575#else 585#else
576static inline void 586static inline void
577ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 587ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
@@ -592,7 +602,7 @@ ftrace_vprintk(const char *fmt, va_list ap)
592{ 602{
593 return 0; 603 return 0;
594} 604}
595static inline void ftrace_dump(void) { } 605static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
596#endif /* CONFIG_TRACING */ 606#endif /* CONFIG_TRACING */
597 607
598/* 608/*
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index e117b1aee69c..9fad0527344f 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -201,7 +201,7 @@ static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo)
201 * @n: the length of the data to be added. 201 * @n: the length of the data to be added.
202 * @lock: pointer to the spinlock to use for locking. 202 * @lock: pointer to the spinlock to use for locking.
203 * 203 *
204 * This function copies at most @len bytes from the @from buffer into 204 * This function copies at most @n bytes from the @from buffer into
205 * the FIFO depending on the free space, and returns the number of 205 * the FIFO depending on the free space, and returns the number of
206 * bytes copied. 206 * bytes copied.
207 */ 207 */
@@ -227,7 +227,7 @@ static inline unsigned int kfifo_in_locked(struct kfifo *fifo,
227 * @n: the size of the destination buffer. 227 * @n: the size of the destination buffer.
228 * @lock: pointer to the spinlock to use for locking. 228 * @lock: pointer to the spinlock to use for locking.
229 * 229 *
230 * This function copies at most @len bytes from the FIFO into the 230 * This function copies at most @n bytes from the FIFO into the
231 * @to buffer and returns the number of copied bytes. 231 * @to buffer and returns the number of copied bytes.
232 */ 232 */
233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, 233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 19ec41a183f5..9340f34d1bb5 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -16,10 +16,12 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/init.h> 18#include <linux/init.h>
19
20#include <asm/atomic.h> 19#include <asm/atomic.h>
20#ifdef CONFIG_HAVE_ARCH_KGDB
21#include <asm/kgdb.h> 21#include <asm/kgdb.h>
22#endif
22 23
24#ifdef CONFIG_KGDB
23struct pt_regs; 25struct pt_regs;
24 26
25/** 27/**
@@ -34,20 +36,6 @@ struct pt_regs;
34extern int kgdb_skipexception(int exception, struct pt_regs *regs); 36extern int kgdb_skipexception(int exception, struct pt_regs *regs);
35 37
36/** 38/**
37 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
38 * @regs: Original pt_regs.
39 * @e_vector: Original error vector.
40 * @err_code: Original error code.
41 *
42 * This is usually needed on architectures which support SMP and
43 * KGDB. This function is called after all the secondary cpus have
44 * been put to a know spin state and the primary CPU has control over
45 * KGDB.
46 */
47extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
48 int err_code);
49
50/**
51 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook 39 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
52 * @regs: Current &struct pt_regs. 40 * @regs: Current &struct pt_regs.
53 * 41 *
@@ -72,6 +60,7 @@ struct uart_port;
72void kgdb_breakpoint(void); 60void kgdb_breakpoint(void);
73 61
74extern int kgdb_connected; 62extern int kgdb_connected;
63extern int kgdb_io_module_registered;
75 64
76extern atomic_t kgdb_setting_breakpoint; 65extern atomic_t kgdb_setting_breakpoint;
77extern atomic_t kgdb_cpu_doing_single_step; 66extern atomic_t kgdb_cpu_doing_single_step;
@@ -202,12 +191,34 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
202 */ 191 */
203extern void kgdb_roundup_cpus(unsigned long flags); 192extern void kgdb_roundup_cpus(unsigned long flags);
204 193
194/**
195 * kgdb_arch_set_pc - Generic call back to the program counter
196 * @regs: Current &struct pt_regs.
197 * @pc: The new value for the program counter
198 *
199 * This function handles updating the program counter and requires an
200 * architecture specific implementation.
201 */
202extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
203
204
205/* Optional functions. */ 205/* Optional functions. */
206extern int kgdb_validate_break_address(unsigned long addr); 206extern int kgdb_validate_break_address(unsigned long addr);
207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); 208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
209 209
210/** 210/**
211 * kgdb_arch_late - Perform any architecture specific initalization.
212 *
213 * This function will handle the late initalization of any
214 * architecture specific callbacks. This is an optional function for
215 * handling things like late initialization of hw breakpoints. The
216 * default implementation does nothing.
217 */
218extern void kgdb_arch_late(void);
219
220
221/**
211 * struct kgdb_arch - Describe architecture specific values. 222 * struct kgdb_arch - Describe architecture specific values.
212 * @gdb_bpt_instr: The instruction to trigger a breakpoint. 223 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
213 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. 224 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
@@ -247,6 +258,8 @@ struct kgdb_arch {
247 * the I/O driver. 258 * the I/O driver.
248 * @post_exception: Pointer to a function that will do any cleanup work 259 * @post_exception: Pointer to a function that will do any cleanup work
249 * for the I/O driver. 260 * for the I/O driver.
261 * @is_console: 1 if the end device is a console 0 if the I/O device is
262 * not a console
250 */ 263 */
251struct kgdb_io { 264struct kgdb_io {
252 const char *name; 265 const char *name;
@@ -256,6 +269,7 @@ struct kgdb_io {
256 int (*init) (void); 269 int (*init) (void);
257 void (*pre_exception) (void); 270 void (*pre_exception) (void);
258 void (*post_exception) (void); 271 void (*post_exception) (void);
272 int is_console;
259}; 273};
260 274
261extern struct kgdb_arch arch_kgdb_ops; 275extern struct kgdb_arch arch_kgdb_ops;
@@ -264,12 +278,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
264 278
265extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 279extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
266extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 280extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
281extern struct kgdb_io *dbg_io_ops;
267 282
268extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 283extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
269extern int kgdb_mem2hex(char *mem, char *buf, int count); 284extern int kgdb_mem2hex(char *mem, char *buf, int count);
270extern int kgdb_hex2mem(char *buf, char *mem, int count); 285extern int kgdb_hex2mem(char *buf, char *mem, int count);
271 286
272extern int kgdb_isremovedbreak(unsigned long addr); 287extern int kgdb_isremovedbreak(unsigned long addr);
288extern void kgdb_schedule_breakpoint(void);
273 289
274extern int 290extern int
275kgdb_handle_exception(int ex_vector, int signo, int err_code, 291kgdb_handle_exception(int ex_vector, int signo, int err_code,
@@ -278,5 +294,12 @@ extern int kgdb_nmicallback(int cpu, void *regs);
278 294
279extern int kgdb_single_step; 295extern int kgdb_single_step;
280extern atomic_t kgdb_active; 296extern atomic_t kgdb_active;
281 297#define in_dbg_master() \
298 (raw_smp_processor_id() == atomic_read(&kgdb_active))
299extern bool dbg_is_early;
300extern void __init dbg_late_init(void);
301#else /* ! CONFIG_KGDB */
302#define in_dbg_master() (0)
303#define dbg_late_init()
304#endif /* ! CONFIG_KGDB */
282#endif /* _KGDB_H_ */ 305#endif /* _KGDB_H_ */
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index 73717ed9ea79..18ca75ffcc5a 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,3 +1,10 @@
1/*
2 * kobj_map.h
3 */
4
5#ifndef _KOBJ_MAP_H_
6#define _KOBJ_MAP_H_
7
1#include <linux/mutex.h> 8#include <linux/mutex.h>
2 9
3typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 10typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
@@ -8,3 +15,5 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
8void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 15void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
9struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 16struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
10struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); 17struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
18
19#endif /* _KOBJ_MAP_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 3950d3c2850d..cf343a852534 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -108,6 +108,8 @@ struct kobj_type {
108 void (*release)(struct kobject *kobj); 108 void (*release)(struct kobject *kobj);
109 const struct sysfs_ops *sysfs_ops; 109 const struct sysfs_ops *sysfs_ops;
110 struct attribute **default_attrs; 110 struct attribute **default_attrs;
111 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
112 const void *(*namespace)(struct kobject *kobj);
111}; 113};
112 114
113struct kobj_uevent_env { 115struct kobj_uevent_env {
@@ -134,6 +136,42 @@ struct kobj_attribute {
134 136
135extern const struct sysfs_ops kobj_sysfs_ops; 137extern const struct sysfs_ops kobj_sysfs_ops;
136 138
139/*
140 * Namespace types which are used to tag kobjects and sysfs entries.
141 * Network namespace will likely be the first.
142 */
143enum kobj_ns_type {
144 KOBJ_NS_TYPE_NONE = 0,
145 KOBJ_NS_TYPE_NET,
146 KOBJ_NS_TYPES
147};
148
149struct sock;
150
151/*
152 * Callbacks so sysfs can determine namespaces
153 * @current_ns: return calling task's namespace
154 * @netlink_ns: return namespace to which a sock belongs (right?)
155 * @initial_ns: return the initial namespace (i.e. init_net_ns)
156 */
157struct kobj_ns_type_operations {
158 enum kobj_ns_type type;
159 const void *(*current_ns)(void);
160 const void *(*netlink_ns)(struct sock *sk);
161 const void *(*initial_ns)(void);
162};
163
164int kobj_ns_type_register(const struct kobj_ns_type_operations *ops);
165int kobj_ns_type_registered(enum kobj_ns_type type);
166const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
167const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
168
169const void *kobj_ns_current(enum kobj_ns_type type);
170const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
171const void *kobj_ns_initial(enum kobj_ns_type type);
172void kobj_ns_exit(enum kobj_ns_type type, const void *ns);
173
174
137/** 175/**
138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 176 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
139 * 177 *
diff --git a/include/linux/kref.h b/include/linux/kref.h
index b0cb0ebad9e6..6cc38fc07ab7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * kref.c - library routines for handling generic reference counted objects 2 * kref.h - library routines for handling generic reference counted objects
3 * 3 *
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Corp. 5 * Copyright (C) 2004 IBM Corp.
@@ -21,7 +21,6 @@ struct kref {
21 atomic_t refcount; 21 atomic_t refcount;
22}; 22};
23 23
24void kref_set(struct kref *kref, int num);
25void kref_init(struct kref *kref); 24void kref_init(struct kref *kref);
26void kref_get(struct kref *kref); 25void kref_get(struct kref *kref);
27int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 26int kref_put(struct kref *kref, void (*release) (struct kref *kref));
diff --git a/include/linux/ks8842.h b/include/linux/ks8842.h
new file mode 100644
index 000000000000..da0341b8ca0a
--- /dev/null
+++ b/include/linux/ks8842.h
@@ -0,0 +1,34 @@
1/*
2 * ks8842.h KS8842 platform data struct definition
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _LINUX_KS8842_H
20#define _LINUX_KS8842_H
21
22#include <linux/if_ether.h>
23
24/**
25 * struct ks8842_platform_data - Platform data of the KS8842 network driver
26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in
27 * the chip.
28 *
29 */
30struct ks8842_platform_data {
31 u8 macaddr[ETH_ALEN];
32};
33
34#endif
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index ce5983225be4..e1ceaa9b36bb 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -130,7 +130,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
131#define ktime_to_ns(kt) ((kt).tv64) 131#define ktime_to_ns(kt) ((kt).tv64)
132 132
133#else 133#else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
134 134
135/* 135/*
136 * Helper macros/inlines to get the ktime_t math right in the timespec 136 * Helper macros/inlines to get the ktime_t math right in the timespec
@@ -275,7 +275,7 @@ static inline s64 ktime_to_ns(const ktime_t kt)
275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; 275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
276} 276}
277 277
278#endif 278#endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
279 279
280/** 280/**
281 * ktime_equal - Compares two ktime_t variables to see if they are equal 281 * ktime_equal - Compares two ktime_t variables to see if they are equal
@@ -295,6 +295,12 @@ static inline s64 ktime_to_us(const ktime_t kt)
295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; 295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
296} 296}
297 297
298static inline s64 ktime_to_ms(const ktime_t kt)
299{
300 struct timeval tv = ktime_to_timeval(kt);
301 return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
302}
303
298static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) 304static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
299{ 305{
300 return ktime_to_us(ktime_sub(later, earlier)); 306 return ktime_to_us(ktime_sub(later, earlier));
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 60df9c84ecae..23ea02253900 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -160,6 +160,7 @@ struct kvm_pit_config {
160#define KVM_EXIT_DCR 15 160#define KVM_EXIT_DCR 15
161#define KVM_EXIT_NMI 16 161#define KVM_EXIT_NMI 16
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18
163 164
164/* For KVM_EXIT_INTERNAL_ERROR */ 165/* For KVM_EXIT_INTERNAL_ERROR */
165#define KVM_INTERNAL_ERROR_EMULATION 1 166#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -259,6 +260,10 @@ struct kvm_run {
259 __u32 ndata; 260 __u32 ndata;
260 __u64 data[16]; 261 __u64 data[16];
261 } internal; 262 } internal;
263 /* KVM_EXIT_OSI */
264 struct {
265 __u64 gprs[32];
266 } osi;
262 /* Fix the size of the union. */ 267 /* Fix the size of the union. */
263 char padding[256]; 268 char padding[256];
264 }; 269 };
@@ -400,6 +405,15 @@ struct kvm_ioeventfd {
400 __u8 pad[36]; 405 __u8 pad[36];
401}; 406};
402 407
408/* for KVM_ENABLE_CAP */
409struct kvm_enable_cap {
410 /* in */
411 __u32 cap;
412 __u32 flags;
413 __u64 args[4];
414 __u8 pad[64];
415};
416
403#define KVMIO 0xAE 417#define KVMIO 0xAE
404 418
405/* 419/*
@@ -501,7 +515,15 @@ struct kvm_ioeventfd {
501#define KVM_CAP_HYPERV_VAPIC 45 515#define KVM_CAP_HYPERV_VAPIC 45
502#define KVM_CAP_HYPERV_SPIN 46 516#define KVM_CAP_HYPERV_SPIN 46
503#define KVM_CAP_PCI_SEGMENT 47 517#define KVM_CAP_PCI_SEGMENT 47
518#define KVM_CAP_PPC_PAIRED_SINGLES 48
519#define KVM_CAP_INTR_SHADOW 49
520#ifdef __KVM_HAVE_DEBUGREGS
521#define KVM_CAP_DEBUGREGS 50
522#endif
504#define KVM_CAP_X86_ROBUST_SINGLESTEP 51 523#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
524#define KVM_CAP_PPC_OSI 52
525#define KVM_CAP_PPC_UNSET_IRQ 53
526#define KVM_CAP_ENABLE_CAP 54
505 527
506#ifdef KVM_CAP_IRQ_ROUTING 528#ifdef KVM_CAP_IRQ_ROUTING
507 529
@@ -688,6 +710,10 @@ struct kvm_clock_data {
688/* Available with KVM_CAP_VCPU_EVENTS */ 710/* Available with KVM_CAP_VCPU_EVENTS */
689#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) 711#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
690#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) 712#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
713/* Available with KVM_CAP_DEBUGREGS */
714#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
715#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
716#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
691 717
692#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 718#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
693 719
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a3fd0f91d943..7cb116afa1cd 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -54,7 +54,7 @@ extern struct kmem_cache *kvm_vcpu_cache;
54 */ 54 */
55struct kvm_io_bus { 55struct kvm_io_bus {
56 int dev_count; 56 int dev_count;
57#define NR_IOBUS_DEVS 6 57#define NR_IOBUS_DEVS 200
58 struct kvm_io_device *devs[NR_IOBUS_DEVS]; 58 struct kvm_io_device *devs[NR_IOBUS_DEVS];
59}; 59};
60 60
@@ -105,6 +105,12 @@ struct kvm_vcpu {
105 struct kvm_vcpu_arch arch; 105 struct kvm_vcpu_arch arch;
106}; 106};
107 107
108/*
109 * Some of the bitops functions do not support too long bitmaps.
110 * This number must be determined not to exceed such limits.
111 */
112#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
113
108struct kvm_memory_slot { 114struct kvm_memory_slot {
109 gfn_t base_gfn; 115 gfn_t base_gfn;
110 unsigned long npages; 116 unsigned long npages;
@@ -119,6 +125,11 @@ struct kvm_memory_slot {
119 int user_alloc; 125 int user_alloc;
120}; 126};
121 127
128static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
129{
130 return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
131}
132
122struct kvm_kernel_irq_routing_entry { 133struct kvm_kernel_irq_routing_entry {
123 u32 gsi; 134 u32 gsi;
124 u32 type; 135 u32 type;
@@ -232,17 +243,23 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
232void vcpu_load(struct kvm_vcpu *vcpu); 243void vcpu_load(struct kvm_vcpu *vcpu);
233void vcpu_put(struct kvm_vcpu *vcpu); 244void vcpu_put(struct kvm_vcpu *vcpu);
234 245
235int kvm_init(void *opaque, unsigned int vcpu_size, 246int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
236 struct module *module); 247 struct module *module);
237void kvm_exit(void); 248void kvm_exit(void);
238 249
239void kvm_get_kvm(struct kvm *kvm); 250void kvm_get_kvm(struct kvm *kvm);
240void kvm_put_kvm(struct kvm *kvm); 251void kvm_put_kvm(struct kvm *kvm);
241 252
253static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
254{
255 return rcu_dereference_check(kvm->memslots,
256 srcu_read_lock_held(&kvm->srcu)
257 || lockdep_is_held(&kvm->slots_lock));
258}
259
242#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 260#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
243#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 261#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
244static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 262static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
245struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
246 263
247extern struct page *bad_page; 264extern struct page *bad_page;
248extern pfn_t bad_pfn; 265extern pfn_t bad_pfn;
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
new file mode 100644
index 000000000000..4bdb31df8e72
--- /dev/null
+++ b/include/linux/l2tp.h
@@ -0,0 +1,163 @@
1/*
2 * L2TP-over-IP socket for L2TPv3.
3 *
4 * Author: James Chapman <jchapman@katalix.com>
5 */
6
7#ifndef _LINUX_L2TP_H_
8#define _LINUX_L2TP_H_
9
10#include <linux/types.h>
11#ifdef __KERNEL__
12#include <linux/socket.h>
13#include <linux/in.h>
14#else
15#include <netinet/in.h>
16#endif
17
18#define IPPROTO_L2TP 115
19
20/**
21 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
22 * @l2tp_family: address family number AF_L2TPIP.
23 * @l2tp_addr: protocol specific address information
24 * @l2tp_conn_id: connection id of tunnel
25 */
26#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
27struct sockaddr_l2tpip {
28 /* The first fields must match struct sockaddr_in */
29 sa_family_t l2tp_family; /* AF_INET */
30 __be16 l2tp_unused; /* INET port number (unused) */
31 struct in_addr l2tp_addr; /* Internet address */
32
33 __u32 l2tp_conn_id; /* Connection ID of tunnel */
34
35 /* Pad to size of `struct sockaddr'. */
36 unsigned char __pad[sizeof(struct sockaddr) - sizeof(sa_family_t) -
37 sizeof(__be16) - sizeof(struct in_addr) -
38 sizeof(__u32)];
39};
40
41/*****************************************************************************
42 * NETLINK_GENERIC netlink family.
43 *****************************************************************************/
44
45/*
46 * Commands.
47 * Valid TLVs of each command are:-
48 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
49 * TUNNEL_DELETE - CONN_ID
50 * TUNNEL_MODIFY - CONN_ID, udpcsum
51 * TUNNEL_GETSTATS - CONN_ID, (stats)
52 * TUNNEL_GET - CONN_ID, (...)
53 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
54 * SESSION_DELETE - SESSION_ID
55 * SESSION_MODIFY - SESSION_ID, data_seq
56 * SESSION_GET - SESSION_ID, (...)
57 * SESSION_GETSTATS - SESSION_ID, (stats)
58 *
59 */
60enum {
61 L2TP_CMD_NOOP,
62 L2TP_CMD_TUNNEL_CREATE,
63 L2TP_CMD_TUNNEL_DELETE,
64 L2TP_CMD_TUNNEL_MODIFY,
65 L2TP_CMD_TUNNEL_GET,
66 L2TP_CMD_SESSION_CREATE,
67 L2TP_CMD_SESSION_DELETE,
68 L2TP_CMD_SESSION_MODIFY,
69 L2TP_CMD_SESSION_GET,
70 __L2TP_CMD_MAX,
71};
72
73#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
74
75/*
76 * ATTR types defined for L2TP
77 */
78enum {
79 L2TP_ATTR_NONE, /* no data */
80 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
81 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
82 L2TP_ATTR_OFFSET, /* u16 */
83 L2TP_ATTR_DATA_SEQ, /* u16 */
84 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
85 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
86 L2TP_ATTR_PROTO_VERSION, /* u8 */
87 L2TP_ATTR_IFNAME, /* string */
88 L2TP_ATTR_CONN_ID, /* u32 */
89 L2TP_ATTR_PEER_CONN_ID, /* u32 */
90 L2TP_ATTR_SESSION_ID, /* u32 */
91 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
92 L2TP_ATTR_UDP_CSUM, /* u8 */
93 L2TP_ATTR_VLAN_ID, /* u16 */
94 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
95 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
96 L2TP_ATTR_DEBUG, /* u32 */
97 L2TP_ATTR_RECV_SEQ, /* u8 */
98 L2TP_ATTR_SEND_SEQ, /* u8 */
99 L2TP_ATTR_LNS_MODE, /* u8 */
100 L2TP_ATTR_USING_IPSEC, /* u8 */
101 L2TP_ATTR_RECV_TIMEOUT, /* msec */
102 L2TP_ATTR_FD, /* int */
103 L2TP_ATTR_IP_SADDR, /* u32 */
104 L2TP_ATTR_IP_DADDR, /* u32 */
105 L2TP_ATTR_UDP_SPORT, /* u16 */
106 L2TP_ATTR_UDP_DPORT, /* u16 */
107 L2TP_ATTR_MTU, /* u16 */
108 L2TP_ATTR_MRU, /* u16 */
109 L2TP_ATTR_STATS, /* nested */
110 __L2TP_ATTR_MAX,
111};
112
113#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
114
115/* Nested in L2TP_ATTR_STATS */
116enum {
117 L2TP_ATTR_STATS_NONE, /* no data */
118 L2TP_ATTR_TX_PACKETS, /* u64 */
119 L2TP_ATTR_TX_BYTES, /* u64 */
120 L2TP_ATTR_TX_ERRORS, /* u64 */
121 L2TP_ATTR_RX_PACKETS, /* u64 */
122 L2TP_ATTR_RX_BYTES, /* u64 */
123 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
124 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
125 L2TP_ATTR_RX_ERRORS, /* u64 */
126 __L2TP_ATTR_STATS_MAX,
127};
128
129#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
130
131enum l2tp_pwtype {
132 L2TP_PWTYPE_NONE = 0x0000,
133 L2TP_PWTYPE_ETH_VLAN = 0x0004,
134 L2TP_PWTYPE_ETH = 0x0005,
135 L2TP_PWTYPE_PPP = 0x0007,
136 L2TP_PWTYPE_PPP_AC = 0x0008,
137 L2TP_PWTYPE_IP = 0x000b,
138 __L2TP_PWTYPE_MAX
139};
140
141enum l2tp_l2spec_type {
142 L2TP_L2SPECTYPE_NONE,
143 L2TP_L2SPECTYPE_DEFAULT,
144};
145
146enum l2tp_encap_type {
147 L2TP_ENCAPTYPE_UDP,
148 L2TP_ENCAPTYPE_IP,
149};
150
151enum l2tp_seqmode {
152 L2TP_SEQ_NONE = 0,
153 L2TP_SEQ_IP = 1,
154 L2TP_SEQ_ALL = 2,
155};
156
157/*
158 * NETLINK_GENERIC related info
159 */
160#define L2TP_GENL_NAME "l2tp"
161#define L2TP_GENL_VERSION 0x1
162
163#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b2f2003b92e5..ee84e7e12039 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -202,12 +202,6 @@ enum {
202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
203 * led */ 203 * led */
204 204
205 /* The following flag belongs to ap->pflags but is kept in
206 * ap->flags because it's referenced in many LLDs and will be
207 * removed in not-too-distant future.
208 */
209 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
210
211 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 205 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
212 206
213 207
@@ -256,12 +250,13 @@ enum {
256 ATA_TMOUT_INTERNAL_QUICK = 5000, 250 ATA_TMOUT_INTERNAL_QUICK = 5000,
257 ATA_TMOUT_MAX_PARK = 30000, 251 ATA_TMOUT_MAX_PARK = 30000,
258 252
259 /* FIXME: GoVault needs 2s but we can't afford that without 253 /*
260 * parallel probing. 800ms is enough for iVDR disk 254 * GoVault needs 2s and iVDR disk HHD424020F7SV00 800ms. 2s
261 * HHD424020F7SV00. Increase to 2secs when parallel probing 255 * is too much without parallel probing. Use 2s if parallel
262 * is in place. 256 * probing is available, 800ms otherwise.
263 */ 257 */
264 ATA_TMOUT_FF_WAIT = 800, 258 ATA_TMOUT_FF_WAIT_LONG = 2000,
259 ATA_TMOUT_FF_WAIT = 800,
265 260
266 /* Spec mandates to wait for ">= 2ms" before checking status 261 /* Spec mandates to wait for ">= 2ms" before checking status
267 * after reset. We wait 150ms, because that was the magic 262 * after reset. We wait 150ms, because that was the magic
@@ -721,15 +716,15 @@ struct ata_port {
721 unsigned int print_id; /* user visible unique port ID */ 716 unsigned int print_id; /* user visible unique port ID */
722 unsigned int port_no; /* 0 based port no. inside the host */ 717 unsigned int port_no; /* 0 based port no. inside the host */
723 718
724 struct ata_prd *prd; /* our SG list */
725 dma_addr_t prd_dma; /* and its DMA mapping */
726
727#ifdef CONFIG_ATA_SFF 719#ifdef CONFIG_ATA_SFF
728 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 720 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
729#endif /* CONFIG_ATA_SFF */
730
731 u8 ctl; /* cache of ATA control register */ 721 u8 ctl; /* cache of ATA control register */
732 u8 last_ctl; /* Cache last written value */ 722 u8 last_ctl; /* Cache last written value */
723 struct delayed_work sff_pio_task;
724 struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */
725 dma_addr_t bmdma_prd_dma; /* and its DMA mapping */
726#endif /* CONFIG_ATA_SFF */
727
733 unsigned int pio_mask; 728 unsigned int pio_mask;
734 unsigned int mwdma_mask; 729 unsigned int mwdma_mask;
735 unsigned int udma_mask; 730 unsigned int udma_mask;
@@ -751,8 +746,6 @@ struct ata_port {
751 struct ata_host *host; 746 struct ata_host *host;
752 struct device *dev; 747 struct device *dev;
753 748
754 void *port_task_data;
755 struct delayed_work port_task;
756 struct delayed_work hotplug_task; 749 struct delayed_work hotplug_task;
757 struct work_struct scsi_rescan_task; 750 struct work_struct scsi_rescan_task;
758 751
@@ -849,6 +842,7 @@ struct ata_port_operations {
849 * SFF / taskfile oriented ops 842 * SFF / taskfile oriented ops
850 */ 843 */
851 void (*sff_dev_select)(struct ata_port *ap, unsigned int device); 844 void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
845 void (*sff_set_devctl)(struct ata_port *ap, u8 ctl);
852 u8 (*sff_check_status)(struct ata_port *ap); 846 u8 (*sff_check_status)(struct ata_port *ap);
853 u8 (*sff_check_altstatus)(struct ata_port *ap); 847 u8 (*sff_check_altstatus)(struct ata_port *ap);
854 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); 848 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -857,16 +851,15 @@ struct ata_port_operations {
857 const struct ata_taskfile *tf); 851 const struct ata_taskfile *tf);
858 unsigned int (*sff_data_xfer)(struct ata_device *dev, 852 unsigned int (*sff_data_xfer)(struct ata_device *dev,
859 unsigned char *buf, unsigned int buflen, int rw); 853 unsigned char *buf, unsigned int buflen, int rw);
860 u8 (*sff_irq_on)(struct ata_port *); 854 void (*sff_irq_on)(struct ata_port *);
861 bool (*sff_irq_check)(struct ata_port *); 855 bool (*sff_irq_check)(struct ata_port *);
862 void (*sff_irq_clear)(struct ata_port *); 856 void (*sff_irq_clear)(struct ata_port *);
857 void (*sff_drain_fifo)(struct ata_queued_cmd *qc);
863 858
864 void (*bmdma_setup)(struct ata_queued_cmd *qc); 859 void (*bmdma_setup)(struct ata_queued_cmd *qc);
865 void (*bmdma_start)(struct ata_queued_cmd *qc); 860 void (*bmdma_start)(struct ata_queued_cmd *qc);
866 void (*bmdma_stop)(struct ata_queued_cmd *qc); 861 void (*bmdma_stop)(struct ata_queued_cmd *qc);
867 u8 (*bmdma_status)(struct ata_port *ap); 862 u8 (*bmdma_status)(struct ata_port *ap);
868
869 void (*drain_fifo)(struct ata_queued_cmd *qc);
870#endif /* CONFIG_ATA_SFF */ 863#endif /* CONFIG_ATA_SFF */
871 864
872 ssize_t (*em_show)(struct ata_port *ap, char *buf); 865 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -935,7 +928,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
935 return ap->ops == &ata_dummy_port_ops; 928 return ap->ops == &ata_dummy_port_ops;
936} 929}
937 930
938extern void ata_port_probe(struct ata_port *);
939extern int sata_set_spd(struct ata_link *link); 931extern int sata_set_spd(struct ata_link *link);
940extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); 932extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
941extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, 933extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
@@ -950,7 +942,6 @@ extern int sata_link_hardreset(struct ata_link *link,
950extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 942extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
951 unsigned long deadline); 943 unsigned long deadline);
952extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 944extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
953extern void ata_port_disable(struct ata_port *);
954 945
955extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 946extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
956extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 947extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
@@ -1006,7 +997,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
1006extern int ata_xfer_mode2shift(unsigned long xfer_mode); 997extern int ata_xfer_mode2shift(unsigned long xfer_mode);
1007extern const char *ata_mode_string(unsigned long xfer_mask); 998extern const char *ata_mode_string(unsigned long xfer_mask);
1008extern unsigned long ata_id_xfermask(const u16 *id); 999extern unsigned long ata_id_xfermask(const u16 *id);
1009extern int ata_port_start(struct ata_port *ap);
1010extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 1000extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
1011extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 1001extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
1012extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 1002extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -1039,9 +1029,6 @@ extern int ata_cable_sata(struct ata_port *ap);
1039extern int ata_cable_ignore(struct ata_port *ap); 1029extern int ata_cable_ignore(struct ata_port *ap);
1040extern int ata_cable_unknown(struct ata_port *ap); 1030extern int ata_cable_unknown(struct ata_port *ap);
1041 1031
1042extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1043 unsigned long delay);
1044
1045/* Timing helpers */ 1032/* Timing helpers */
1046extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1033extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1047extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1034extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1443,7 +1430,11 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1443{ 1430{
1444 memset(tf, 0, sizeof(*tf)); 1431 memset(tf, 0, sizeof(*tf));
1445 1432
1433#ifdef CONFIG_ATA_SFF
1446 tf->ctl = dev->link->ap->ctl; 1434 tf->ctl = dev->link->ap->ctl;
1435#else
1436 tf->ctl = ATA_DEVCTL_OBS;
1437#endif
1447 if (dev->devno == 0) 1438 if (dev->devno == 0)
1448 tf->device = ATA_DEVICE_OBS; 1439 tf->device = ATA_DEVICE_OBS;
1449 else 1440 else
@@ -1578,8 +1569,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops;
1578 .sg_tablesize = LIBATA_MAX_PRD, \ 1569 .sg_tablesize = LIBATA_MAX_PRD, \
1579 .dma_boundary = ATA_DMA_BOUNDARY 1570 .dma_boundary = ATA_DMA_BOUNDARY
1580 1571
1581extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1582extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1583extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1572extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1584extern u8 ata_sff_check_status(struct ata_port *ap); 1573extern u8 ata_sff_check_status(struct ata_port *ap);
1585extern void ata_sff_pause(struct ata_port *ap); 1574extern void ata_sff_pause(struct ata_port *ap);
@@ -1597,10 +1586,11 @@ extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1597 unsigned char *buf, unsigned int buflen, int rw); 1586 unsigned char *buf, unsigned int buflen, int rw);
1598extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1587extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1599 unsigned char *buf, unsigned int buflen, int rw); 1588 unsigned char *buf, unsigned int buflen, int rw);
1600extern u8 ata_sff_irq_on(struct ata_port *ap); 1589extern void ata_sff_irq_on(struct ata_port *ap);
1601extern void ata_sff_irq_clear(struct ata_port *ap); 1590extern void ata_sff_irq_clear(struct ata_port *ap);
1602extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1591extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1603 u8 status, int in_wq); 1592 u8 status, int in_wq);
1593extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay);
1604extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); 1594extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1605extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); 1595extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1606extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1596extern unsigned int ata_sff_host_intr(struct ata_port *ap,
@@ -1621,21 +1611,8 @@ extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1621extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1611extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1622extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); 1612extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1623extern void ata_sff_error_handler(struct ata_port *ap); 1613extern void ata_sff_error_handler(struct ata_port *ap);
1624extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1625extern int ata_sff_port_start(struct ata_port *ap);
1626extern int ata_sff_port_start32(struct ata_port *ap);
1627extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1614extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1628extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1629 unsigned long xfer_mask);
1630extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1631extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1632extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1633extern u8 ata_bmdma_status(struct ata_port *ap);
1634extern void ata_bus_reset(struct ata_port *ap);
1635
1636#ifdef CONFIG_PCI 1615#ifdef CONFIG_PCI
1637extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1638extern int ata_pci_bmdma_init(struct ata_host *host);
1639extern int ata_pci_sff_init_host(struct ata_host *host); 1616extern int ata_pci_sff_init_host(struct ata_host *host);
1640extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, 1617extern int ata_pci_sff_prepare_host(struct pci_dev *pdev,
1641 const struct ata_port_info * const * ppi, 1618 const struct ata_port_info * const * ppi,
@@ -1648,6 +1625,23 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1648 struct scsi_host_template *sht, void *host_priv, int hflags); 1625 struct scsi_host_template *sht, void *host_priv, int hflags);
1649#endif /* CONFIG_PCI */ 1626#endif /* CONFIG_PCI */
1650 1627
1628extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc);
1629extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);
1630extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc);
1631extern void ata_bmdma_error_handler(struct ata_port *ap);
1632extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
1633extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1634extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1635extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1636extern u8 ata_bmdma_status(struct ata_port *ap);
1637extern int ata_bmdma_port_start(struct ata_port *ap);
1638extern int ata_bmdma_port_start32(struct ata_port *ap);
1639
1640#ifdef CONFIG_PCI
1641extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1642extern void ata_pci_bmdma_init(struct ata_host *host);
1643#endif /* CONFIG_PCI */
1644
1651/** 1645/**
1652 * ata_sff_busy_wait - Wait for a port status register 1646 * ata_sff_busy_wait - Wait for a port status register
1653 * @ap: Port to wait for. 1647 * @ap: Port to wait for.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index a03977a96d7e..06aed8305bf3 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -44,6 +44,8 @@ struct lock_class_key {
44 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; 44 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
45}; 45};
46 46
47extern struct lock_class_key __lockdep_no_validate__;
48
47#define LOCKSTAT_POINTS 4 49#define LOCKSTAT_POINTS 4
48 50
49/* 51/*
@@ -270,6 +272,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
270#define lockdep_set_subclass(lock, sub) \ 272#define lockdep_set_subclass(lock, sub) \
271 lockdep_init_map(&(lock)->dep_map, #lock, \ 273 lockdep_init_map(&(lock)->dep_map, #lock, \
272 (lock)->dep_map.key, sub) 274 (lock)->dep_map.key, sub)
275
276#define lockdep_set_novalidate_class(lock) \
277 lockdep_set_class(lock, &__lockdep_no_validate__)
273/* 278/*
274 * Compare locking classes 279 * Compare locking classes
275 */ 280 */
@@ -354,6 +359,9 @@ static inline void lockdep_on(void)
354#define lockdep_set_class_and_subclass(lock, key, sub) \ 359#define lockdep_set_class_and_subclass(lock, key, sub) \
355 do { (void)(key); } while (0) 360 do { (void)(key); } while (0)
356#define lockdep_set_subclass(lock, sub) do { } while (0) 361#define lockdep_set_subclass(lock, sub) do { } while (0)
362
363#define lockdep_set_novalidate_class(lock) do { } while (0)
364
357/* 365/*
358 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP 366 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP
359 * case since the result is not well defined and the caller should rather 367 * case since the result is not well defined and the caller should rather
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index f78f83d7663f..6907251d5200 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -33,7 +33,7 @@ struct common_audit_data {
33#define LSM_AUDIT_DATA_IPC 4 33#define LSM_AUDIT_DATA_IPC 4
34#define LSM_AUDIT_DATA_TASK 5 34#define LSM_AUDIT_DATA_TASK 5
35#define LSM_AUDIT_DATA_KEY 6 35#define LSM_AUDIT_DATA_KEY 6
36#define LSM_AUDIT_NO_AUDIT 7 36#define LSM_AUDIT_DATA_NONE 7
37#define LSM_AUDIT_DATA_KMOD 8 37#define LSM_AUDIT_DATA_KMOD 8
38 struct task_struct *tsk; 38 struct task_struct *tsk;
39 union { 39 union {
diff --git a/include/linux/meye.h b/include/linux/meye.h
index 12010ace1f04..0dd49954f746 100644
--- a/include/linux/meye.h
+++ b/include/linux/meye.h
@@ -44,17 +44,17 @@ struct meye_params {
44}; 44};
45 45
46/* query the extended parameters */ 46/* query the extended parameters */
47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) 47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params)
48/* set the extended parameters */ 48/* set the extended parameters */
49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) 49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params)
50/* queue a buffer for mjpeg capture */ 50/* queue a buffer for mjpeg capture */
51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) 51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int)
52/* sync a previously queued mjpeg buffer */ 52/* sync a previously queued mjpeg buffer */
53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) 53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int)
54/* get a still uncompressed snapshot */ 54/* get a still uncompressed snapshot */
55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) 55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4)
56/* get a jpeg compressed snapshot */ 56/* get a jpeg compressed snapshot */
57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) 57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int)
58 58
59/* V4L2 private controls */ 59/* V4L2 private controls */
60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE 60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
new file mode 100644
index 000000000000..0ab61320ffa8
--- /dev/null
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -0,0 +1,126 @@
1/*
2 * DaVinci Voice Codec Core Interface for TI platforms
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc
5 *
6 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_
25
26#include <linux/kernel.h>
27#include <linux/platform_device.h>
28#include <linux/mfd/core.h>
29
30#include <mach/edma.h>
31
32/*
33 * Register values.
34 */
35#define DAVINCI_VC_PID 0x00
36#define DAVINCI_VC_CTRL 0x04
37#define DAVINCI_VC_INTEN 0x08
38#define DAVINCI_VC_INTSTATUS 0x0c
39#define DAVINCI_VC_INTCLR 0x10
40#define DAVINCI_VC_EMUL_CTRL 0x14
41#define DAVINCI_VC_RFIFO 0x20
42#define DAVINCI_VC_WFIFO 0x24
43#define DAVINCI_VC_FIFOSTAT 0x28
44#define DAVINCI_VC_TST_CTRL 0x2C
45#define DAVINCI_VC_REG05 0x94
46#define DAVINCI_VC_REG09 0xA4
47#define DAVINCI_VC_REG12 0xB0
48
49/* DAVINCI_VC_CTRL bit fields */
50#define DAVINCI_VC_CTRL_MASK 0x5500
51#define DAVINCI_VC_CTRL_RSTADC BIT(0)
52#define DAVINCI_VC_CTRL_RSTDAC BIT(1)
53#define DAVINCI_VC_CTRL_RD_BITS_8 BIT(4)
54#define DAVINCI_VC_CTRL_RD_UNSIGNED BIT(5)
55#define DAVINCI_VC_CTRL_WD_BITS_8 BIT(6)
56#define DAVINCI_VC_CTRL_WD_UNSIGNED BIT(7)
57#define DAVINCI_VC_CTRL_RFIFOEN BIT(8)
58#define DAVINCI_VC_CTRL_RFIFOCL BIT(9)
59#define DAVINCI_VC_CTRL_RFIFOMD_WORD_1 BIT(10)
60#define DAVINCI_VC_CTRL_WFIFOEN BIT(12)
61#define DAVINCI_VC_CTRL_WFIFOCL BIT(13)
62#define DAVINCI_VC_CTRL_WFIFOMD_WORD_1 BIT(14)
63
64/* DAVINCI_VC_INT bit fields */
65#define DAVINCI_VC_INT_MASK 0x3F
66#define DAVINCI_VC_INT_RDRDY_MASK BIT(0)
67#define DAVINCI_VC_INT_RERROVF_MASK BIT(1)
68#define DAVINCI_VC_INT_RERRUDR_MASK BIT(2)
69#define DAVINCI_VC_INT_WDREQ_MASK BIT(3)
70#define DAVINCI_VC_INT_WERROVF_MASKBIT BIT(4)
71#define DAVINCI_VC_INT_WERRUDR_MASK BIT(5)
72
73/* DAVINCI_VC_REG05 bit fields */
74#define DAVINCI_VC_REG05_PGA_GAIN 0x07
75
76/* DAVINCI_VC_REG09 bit fields */
77#define DAVINCI_VC_REG09_MUTE 0x40
78#define DAVINCI_VC_REG09_DIG_ATTEN 0x3F
79
80/* DAVINCI_VC_REG12 bit fields */
81#define DAVINCI_VC_REG12_POWER_ALL_ON 0xFD
82#define DAVINCI_VC_REG12_POWER_ALL_OFF 0x00
83
84#define DAVINCI_VC_CELLS 2
85
86enum davinci_vc_cells {
87 DAVINCI_VC_VCIF_CELL,
88 DAVINCI_VC_CQ93VC_CELL,
89};
90
91struct davinci_vcif {
92 struct platform_device *pdev;
93 u32 dma_tx_channel;
94 u32 dma_rx_channel;
95 dma_addr_t dma_tx_addr;
96 dma_addr_t dma_rx_addr;
97};
98
99struct cq93vc {
100 struct platform_device *pdev;
101 struct snd_soc_codec *codec;
102 u32 sysclk;
103};
104
105struct davinci_vc;
106
107struct davinci_vc {
108 /* Device data */
109 struct device *dev;
110 struct platform_device *pdev;
111 struct clk *clk;
112
113 /* Memory resources */
114 void __iomem *base;
115 resource_size_t pbase;
116 size_t base_size;
117
118 /* MFD cells */
119 struct mfd_cell cells[DAVINCI_VC_CELLS];
120
121 /* Client devices */
122 struct davinci_vcif davinci_vcif;
123 struct cq93vc cq93vc;
124};
125
126#endif
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index d899dc0223ba..a95141eafce3 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -492,6 +492,8 @@
492 */ 492 */
493#define WM8350_JACK_L_LVL 0x0800 493#define WM8350_JACK_L_LVL 0x0800
494#define WM8350_JACK_R_LVL 0x0400 494#define WM8350_JACK_R_LVL 0x0400
495#define WM8350_JACK_MICSCD_LVL 0x0200
496#define WM8350_JACK_MICSD_LVL 0x0100
495 497
496/* 498/*
497 * WM8350 Platform setup 499 * WM8350 Platform setup
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index b06ff2846748..de79baee4925 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,14 +15,38 @@
15#ifndef __MFD_WM8994_CORE_H__ 15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__ 16#define __MFD_WM8994_CORE_H__
17 17
18#include <linux/interrupt.h>
19
18struct regulator_dev; 20struct regulator_dev;
19struct regulator_bulk_data; 21struct regulator_bulk_data;
20 22
21#define WM8994_NUM_GPIO_REGS 11 23#define WM8994_NUM_GPIO_REGS 11
22#define WM8994_NUM_LDO_REGS 2 24#define WM8994_NUM_LDO_REGS 2
25#define WM8994_NUM_IRQ_REGS 2
26
27#define WM8994_IRQ_TEMP_SHUT 0
28#define WM8994_IRQ_MIC1_DET 1
29#define WM8994_IRQ_MIC1_SHRT 2
30#define WM8994_IRQ_MIC2_DET 3
31#define WM8994_IRQ_MIC2_SHRT 4
32#define WM8994_IRQ_FLL1_LOCK 5
33#define WM8994_IRQ_FLL2_LOCK 6
34#define WM8994_IRQ_SRC1_LOCK 7
35#define WM8994_IRQ_SRC2_LOCK 8
36#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
37#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
38#define WM8994_IRQ_AIF2DRC_SIG_DET 11
39#define WM8994_IRQ_FIFOS_ERR 12
40#define WM8994_IRQ_WSEQ_DONE 13
41#define WM8994_IRQ_DCS_DONE 14
42#define WM8994_IRQ_TEMP_WARN 15
43
44/* GPIOs in the chip are numbered from 1-11 */
45#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
23 46
24struct wm8994 { 47struct wm8994 {
25 struct mutex io_lock; 48 struct mutex io_lock;
49 struct mutex irq_lock;
26 50
27 struct device *dev; 51 struct device *dev;
28 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 52 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
@@ -33,6 +57,11 @@ struct wm8994 {
33 void *control_data; 57 void *control_data;
34 58
35 int gpio_base; 59 int gpio_base;
60 int irq_base;
61
62 int irq;
63 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS];
64 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
36 65
37 /* Used over suspend/resume */ 66 /* Used over suspend/resume */
38 u16 ldo_regs[WM8994_NUM_LDO_REGS]; 67 u16 ldo_regs[WM8994_NUM_LDO_REGS];
@@ -51,4 +80,26 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
51int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 80int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
52 int count, u16 *buf); 81 int count, u16 *buf);
53 82
83
84/* Helper to save on boilerplate */
85static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
86 irq_handler_t handler, const char *name,
87 void *data)
88{
89 if (!wm8994->irq_base)
90 return -EINVAL;
91 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
92 IRQF_TRIGGER_RISING, name,
93 data);
94}
95static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
96{
97 if (!wm8994->irq_base)
98 return;
99 free_irq(wm8994->irq_base + irq, data);
100}
101
102int wm8994_irq_init(struct wm8994 *wm8994);
103void wm8994_irq_exit(struct wm8994 *wm8994);
104
54#endif 105#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 70d6a8687dc5..5c51f367c061 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -70,6 +70,7 @@ struct wm8994_pdata {
70 70
71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO]; 71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
72 72
73 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
73 74
74 int num_drc_cfgs; 75 int num_drc_cfgs;
75 struct wm8994_drc_cfg *drc_cfgs; 76 struct wm8994_drc_cfg *drc_cfgs;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e92d1bfdb330..7a7f9c1e679a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -123,8 +123,8 @@ enum {
123 MLX4_OPCODE_RDMA_READ = 0x10, 123 MLX4_OPCODE_RDMA_READ = 0x10,
124 MLX4_OPCODE_ATOMIC_CS = 0x11, 124 MLX4_OPCODE_ATOMIC_CS = 0x11,
125 MLX4_OPCODE_ATOMIC_FA = 0x12, 125 MLX4_OPCODE_ATOMIC_FA = 0x12,
126 MLX4_OPCODE_ATOMIC_MASK_CS = 0x14, 126 MLX4_OPCODE_MASKED_ATOMIC_CS = 0x14,
127 MLX4_OPCODE_ATOMIC_MASK_FA = 0x15, 127 MLX4_OPCODE_MASKED_ATOMIC_FA = 0x15,
128 MLX4_OPCODE_BIND_MW = 0x18, 128 MLX4_OPCODE_BIND_MW = 0x18,
129 MLX4_OPCODE_FMR = 0x19, 129 MLX4_OPCODE_FMR = 0x19,
130 MLX4_OPCODE_LOCAL_INVAL = 0x1b, 130 MLX4_OPCODE_LOCAL_INVAL = 0x1b,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 9f29d86e5dc9..7abe64326f72 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -285,6 +285,13 @@ struct mlx4_wqe_atomic_seg {
285 __be64 compare; 285 __be64 compare;
286}; 286};
287 287
288struct mlx4_wqe_masked_atomic_seg {
289 __be64 swap_add;
290 __be64 compare;
291 __be64 swap_add_mask;
292 __be64 compare_mask;
293};
294
288struct mlx4_wqe_data_seg { 295struct mlx4_wqe_data_seg {
289 __be32 byte_count; 296 __be32 byte_count;
290 __be32 lkey; 297 __be32 lkey;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 462acaf36f3a..fb19bb92b809 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -19,7 +19,6 @@ struct anon_vma;
19struct file_ra_state; 19struct file_ra_state;
20struct user_struct; 20struct user_struct;
21struct writeback_control; 21struct writeback_control;
22struct rlimit;
23 22
24#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 23#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
25extern unsigned long max_mapnr; 24extern unsigned long max_mapnr;
@@ -1449,9 +1448,6 @@ int vmemmap_populate_basepages(struct page *start_page,
1449int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1448int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1450void vmemmap_populate_print_last(void); 1449void vmemmap_populate_print_last(void);
1451 1450
1452extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1453 size_t size);
1454extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1455 1451
1456enum mf_flags { 1452enum mf_flags {
1457 MF_COUNT_INCREASED = 1 << 0, 1453 MF_COUNT_INCREASED = 1 << 0,
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 0ebaef577ff5..329a8faa6e37 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -94,6 +94,8 @@
94 94
95#define SDIO_BUS_WIDTH_1BIT 0x00 95#define SDIO_BUS_WIDTH_1BIT 0x00
96#define SDIO_BUS_WIDTH_4BIT 0x02 96#define SDIO_BUS_WIDTH_4BIT 0x02
97#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
98#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
97 99
98#define SDIO_BUS_ASYNC_INT 0x20 100#define SDIO_BUS_ASYNC_INT 0x20
99 101
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f58e9d836f32..48c007dae476 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -474,4 +474,46 @@ struct platform_device_id {
474 __attribute__((aligned(sizeof(kernel_ulong_t)))); 474 __attribute__((aligned(sizeof(kernel_ulong_t))));
475}; 475};
476 476
477#define MDIO_MODULE_PREFIX "mdio:"
478
479#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d"
480#define MDIO_ID_ARGS(_id) \
481 (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
482 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
483 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
484 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
485 ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
486 ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
487 ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
488 ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
489
490/**
491 * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
492 * @phy_id: The result of
493 * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
494 * for this PHY type
495 * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
496 * is used to terminate an array of struct mdio_device_id.
497 */
498struct mdio_device_id {
499 __u32 phy_id;
500 __u32 phy_id_mask;
501};
502
503struct zorro_device_id {
504 __u32 id; /* Device ID or ZORRO_WILDCARD */
505 kernel_ulong_t driver_data; /* Data private to the driver */
506};
507
508#define ZORRO_WILDCARD (0xffffffff) /* not official */
509
510#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
511
512#define ISAPNP_ANY_ID 0xffff
513struct isapnp_device_id {
514 unsigned short card_vendor, card_device;
515 unsigned short vendor, function;
516 kernel_ulong_t driver_data; /* data private to the driver */
517};
518
477#endif /* LINUX_MOD_DEVICETABLE_H */ 519#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 515d53ae6a79..6914fcad4673 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -465,8 +465,7 @@ static inline void __module_get(struct module *module)
465 if (module) { 465 if (module) {
466 preempt_disable(); 466 preempt_disable();
467 __this_cpu_inc(module->refptr->incs); 467 __this_cpu_inc(module->refptr->incs);
468 trace_module_get(module, _THIS_IP_, 468 trace_module_get(module, _THIS_IP_);
469 __this_cpu_read(module->refptr->incs));
470 preempt_enable(); 469 preempt_enable();
471 } 470 }
472} 471}
@@ -480,8 +479,7 @@ static inline int try_module_get(struct module *module)
480 479
481 if (likely(module_is_live(module))) { 480 if (likely(module_is_live(module))) {
482 __this_cpu_inc(module->refptr->incs); 481 __this_cpu_inc(module->refptr->incs);
483 trace_module_get(module, _THIS_IP_, 482 trace_module_get(module, _THIS_IP_);
484 __this_cpu_read(module->refptr->incs));
485 } else 483 } else
486 ret = 0; 484 ret = 0;
487 485
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index c5f3d53548e2..fa04b246c9ae 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -27,7 +27,8 @@
27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ 27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ 28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
31#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
31 32
32#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
33#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
@@ -191,10 +192,7 @@ struct vif_device {
191#define VIFF_STATIC 0x8000 192#define VIFF_STATIC 0x8000
192 193
193struct mfc_cache { 194struct mfc_cache {
194 struct mfc_cache *next; /* Next entry on cache line */ 195 struct list_head list;
195#ifdef CONFIG_NET_NS
196 struct net *mfc_net;
197#endif
198 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 196 __be32 mfc_mcastgrp; /* Group the entry belongs to */
199 __be32 mfc_origin; /* Source of packet */ 197 __be32 mfc_origin; /* Source of packet */
200 vifi_t mfc_parent; /* Source interface */ 198 vifi_t mfc_parent; /* Source interface */
@@ -217,18 +215,6 @@ struct mfc_cache {
217 } mfc_un; 215 } mfc_un;
218}; 216};
219 217
220static inline
221struct net *mfc_net(const struct mfc_cache *mfc)
222{
223 return read_pnet(&mfc->mfc_net);
224}
225
226static inline
227void mfc_net_set(struct mfc_cache *mfc, struct net *net)
228{
229 write_pnet(&mfc->mfc_net, hold_net(net));
230}
231
232#define MFC_STATIC 1 218#define MFC_STATIC 1
233#define MFC_NOTIFY 2 219#define MFC_NOTIFY 2
234 220
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 2caa1a8e525d..6091ab77f388 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -24,7 +24,8 @@
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ 24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ 25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ 26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ 27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
28 29
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ 30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) 31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
@@ -182,10 +183,7 @@ struct mif_device {
182#define VIFF_STATIC 0x8000 183#define VIFF_STATIC 0x8000
183 184
184struct mfc6_cache { 185struct mfc6_cache {
185 struct mfc6_cache *next; /* Next entry on cache line */ 186 struct list_head list;
186#ifdef CONFIG_NET_NS
187 struct net *mfc6_net;
188#endif
189 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 187 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
190 struct in6_addr mf6c_origin; /* Source of packet */ 188 struct in6_addr mf6c_origin; /* Source of packet */
191 mifi_t mf6c_parent; /* Source interface */ 189 mifi_t mf6c_parent; /* Source interface */
@@ -208,18 +206,6 @@ struct mfc6_cache {
208 } mfc_un; 206 } mfc_un;
209}; 207};
210 208
211static inline
212struct net *mfc6_net(const struct mfc6_cache *mfc)
213{
214 return read_pnet(&mfc->mfc6_net);
215}
216
217static inline
218void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
219{
220 write_pnet(&mfc->mfc6_net, hold_net(net));
221}
222
223#define MFC_STATIC 1 209#define MFC_STATIC 1
224#define MFC_NOTIFY 2 210#define MFC_NOTIFY 2
225 211
@@ -244,14 +230,17 @@ extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
244 struct rtmsg *rtm, int nowait); 230 struct rtmsg *rtm, int nowait);
245 231
246#ifdef CONFIG_IPV6_MROUTE 232#ifdef CONFIG_IPV6_MROUTE
247static inline struct sock *mroute6_socket(struct net *net) 233extern struct sock *mroute6_socket(struct net *net, struct sk_buff *skb);
248{
249 return net->ipv6.mroute6_sk;
250}
251extern int ip6mr_sk_done(struct sock *sk); 234extern int ip6mr_sk_done(struct sock *sk);
252#else 235#else
253static inline struct sock *mroute6_socket(struct net *net) { return NULL; } 236static inline struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
254static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 237{
238 return NULL;
239}
240static inline int ip6mr_sk_done(struct sock *sk)
241{
242 return 0;
243}
255#endif 244#endif
256#endif 245#endif
257 246
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
new file mode 100644
index 000000000000..d11fe0f2f956
--- /dev/null
+++ b/include/linux/msm_mdp.h
@@ -0,0 +1,78 @@
1/* include/linux/msm_mdp.h
2 *
3 * Copyright (C) 2007 Google Incorporated
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef _MSM_MDP_H_
15#define _MSM_MDP_H_
16
17#include <linux/types.h>
18
19#define MSMFB_IOCTL_MAGIC 'm'
20#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
21#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
22
23enum {
24 MDP_RGB_565, /* RGB 565 planar */
25 MDP_XRGB_8888, /* RGB 888 padded */
26 MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planar w/ Cb is in MSB */
27 MDP_ARGB_8888, /* ARGB 888 */
28 MDP_RGB_888, /* RGB 888 planar */
29 MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planar w/ Cr is in MSB */
30 MDP_YCRYCB_H2V1, /* YCrYCb interleave */
31 MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
32 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
33 MDP_RGBA_8888, /* ARGB 888 */
34 MDP_BGRA_8888, /* ABGR 888 */
35 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */
36};
37
38enum {
39 PMEM_IMG,
40 FB_IMG,
41};
42
43/* flag values */
44#define MDP_ROT_NOP 0
45#define MDP_FLIP_LR 0x1
46#define MDP_FLIP_UD 0x2
47#define MDP_ROT_90 0x4
48#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
49#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
50#define MDP_DITHER 0x8
51#define MDP_BLUR 0x10
52
53#define MDP_TRANSP_NOP 0xffffffff
54#define MDP_ALPHA_NOP 0xff
55
56struct mdp_rect {
57 u32 x, y, w, h;
58};
59
60struct mdp_img {
61 u32 width, height, format, offset;
62 int memory_id; /* the file descriptor */
63};
64
65struct mdp_blit_req {
66 struct mdp_img src;
67 struct mdp_img dst;
68 struct mdp_rect src_rect;
69 struct mdp_rect dst_rect;
70 u32 alpha, transp_mask, flags;
71};
72
73struct mdp_blit_req_list {
74 u32 count;
75 struct mdp_blit_req req[];
76};
77
78#endif /* _MSM_MDP_H_ */
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 8b4aa0523db7..b481ccd7ff3c 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -9,6 +9,8 @@
9#define __MTD_TRANS_H__ 9#define __MTD_TRANS_H__
10 10
11#include <linux/mutex.h> 11#include <linux/mutex.h>
12#include <linux/kref.h>
13#include <linux/sysfs.h>
12 14
13struct hd_geometry; 15struct hd_geometry;
14struct mtd_info; 16struct mtd_info;
@@ -24,11 +26,16 @@ struct mtd_blktrans_dev {
24 int devnum; 26 int devnum;
25 unsigned long size; 27 unsigned long size;
26 int readonly; 28 int readonly;
27 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */ 29 int open;
30 struct kref ref;
31 struct gendisk *disk;
32 struct attribute_group *disk_attributes;
33 struct task_struct *thread;
34 struct request_queue *rq;
35 spinlock_t queue_lock;
36 void *priv;
28}; 37};
29 38
30struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
31
32struct mtd_blktrans_ops { 39struct mtd_blktrans_ops {
33 char *name; 40 char *name;
34 int major; 41 int major;
@@ -60,8 +67,6 @@ struct mtd_blktrans_ops {
60 struct list_head devs; 67 struct list_head devs;
61 struct list_head list; 68 struct list_head list;
62 struct module *owner; 69 struct module *owner;
63
64 struct mtd_blkcore_priv *blkcore_priv;
65}; 70};
66 71
67extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); 72extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index df89f4275232..574d9ee066f1 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -253,6 +253,7 @@ struct cfi_bri_query {
253#define P_ID_MITSUBISHI_STD 0x0100 253#define P_ID_MITSUBISHI_STD 0x0100
254#define P_ID_MITSUBISHI_EXT 0x0101 254#define P_ID_MITSUBISHI_EXT 0x0101
255#define P_ID_SST_PAGE 0x0102 255#define P_ID_SST_PAGE 0x0102
256#define P_ID_SST_OLD 0x0701
256#define P_ID_INTEL_PERFORMANCE 0x0200 257#define P_ID_INTEL_PERFORMANCE 0x0200
257#define P_ID_INTEL_DATA 0x0210 258#define P_ID_INTEL_DATA 0x0210
258#define P_ID_RESERVED 0xffff 259#define P_ID_RESERVED 0xffff
@@ -297,7 +298,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
297 * and 32bit devices on 16 bit busses 298 * and 32bit devices on 16 bit busses
298 * set the low bit of the alternating bit sequence of the address. 299 * set the low bit of the alternating bit sequence of the address.
299 */ 300 */
300 if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) 301 if (((type * interleave) > bankwidth) && ((cmd_ofs & 0xff) == 0xaa))
301 addr |= (type >> 1)*interleave; 302 addr |= (type >> 1)*interleave;
302 303
303 return addr; 304 return addr;
@@ -515,14 +516,25 @@ struct cfi_fixup {
515 void* param; 516 void* param;
516}; 517};
517 518
518#define CFI_MFR_ANY 0xffff 519#define CFI_MFR_ANY 0xFFFF
519#define CFI_ID_ANY 0xffff 520#define CFI_ID_ANY 0xFFFF
520 521#define CFI_MFR_CONTINUATION 0x007F
521#define CFI_MFR_AMD 0x0001 522
522#define CFI_MFR_INTEL 0x0089 523#define CFI_MFR_AMD 0x0001
523#define CFI_MFR_ATMEL 0x001F 524#define CFI_MFR_ATMEL 0x001F
524#define CFI_MFR_SAMSUNG 0x00EC 525#define CFI_MFR_EON 0x001C
525#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 526#define CFI_MFR_FUJITSU 0x0004
527#define CFI_MFR_HYUNDAI 0x00AD
528#define CFI_MFR_INTEL 0x0089
529#define CFI_MFR_MACRONIX 0x00C2
530#define CFI_MFR_NEC 0x0010
531#define CFI_MFR_PMC 0x009D
532#define CFI_MFR_SAMSUNG 0x00EC
533#define CFI_MFR_SHARP 0x00B0
534#define CFI_MFR_SST 0x00BF
535#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
536#define CFI_MFR_TOSHIBA 0x0098
537#define CFI_MFR_WINBOND 0x00DA
526 538
527void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 539void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
528 540
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index d0bf422ae374..f43e9b49b751 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -15,6 +15,7 @@
15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h 15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
16 */ 16 */
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/mutex.h>
18 19
19typedef enum { 20typedef enum {
20 FL_READY, 21 FL_READY,
@@ -74,8 +75,7 @@ struct flchip {
74 unsigned int erase_suspended:1; 75 unsigned int erase_suspended:1;
75 unsigned long in_progress_block_addr; 76 unsigned long in_progress_block_addr;
76 77
77 spinlock_t *mutex; 78 struct mutex mutex;
78 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip 79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
80 to be ready */ 80 to be ready */
81 int word_write_time; 81 int word_write_time;
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b8772217..de89eca864ce 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -7,6 +7,7 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/list.h> 8#include <linux/list.h>
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/bug.h>
10 11
11#include <linux/mtd/compatmac.h> 12#include <linux/mtd/compatmac.h>
12 13
@@ -386,6 +387,8 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
386#endif 387#endif
387 else if (map_bankwidth_is_large(map)) 388 else if (map_bankwidth_is_large(map))
388 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); 389 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
390 else
391 BUG();
389 392
390 return r; 393 return r;
391} 394}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0f32a9b6ff55..5326435a7571 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -20,7 +20,6 @@
20 20
21#define MTD_CHAR_MAJOR 90 21#define MTD_CHAR_MAJOR 90
22#define MTD_BLOCK_MAJOR 31 22#define MTD_BLOCK_MAJOR 31
23#define MAX_MTD_DEVICES 32
24 23
25#define MTD_ERASE_PENDING 0x01 24#define MTD_ERASE_PENDING 0x01
26#define MTD_ERASING 0x02 25#define MTD_ERASING 0x02
@@ -61,9 +60,7 @@ struct mtd_erase_region_info {
61 * MTD_OOB_PLACE: oob data are placed at the given offset 60 * MTD_OOB_PLACE: oob data are placed at the given offset
62 * MTD_OOB_AUTO: oob data are automatically placed at the free areas 61 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
63 * which are defined by the ecclayout 62 * which are defined by the ecclayout
64 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data 63 * MTD_OOB_RAW: mode to read oob and data without doing ECC checking
65 * is inserted into the data. Thats a raw image of the
66 * flash contents.
67 */ 64 */
68typedef enum { 65typedef enum {
69 MTD_OOB_PLACE, 66 MTD_OOB_PLACE,
@@ -290,8 +287,9 @@ extern int add_mtd_device(struct mtd_info *mtd);
290extern int del_mtd_device (struct mtd_info *mtd); 287extern int del_mtd_device (struct mtd_info *mtd);
291 288
292extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); 289extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
290extern int __get_mtd_device(struct mtd_info *mtd);
291extern void __put_mtd_device(struct mtd_info *mtd);
293extern struct mtd_info *get_mtd_device_nm(const char *name); 292extern struct mtd_info *get_mtd_device_nm(const char *name);
294
295extern void put_mtd_device(struct mtd_info *mtd); 293extern void put_mtd_device(struct mtd_info *mtd);
296 294
297 295
diff --git a/include/linux/mtd/mtdram.h b/include/linux/mtd/mtdram.h
index 04fdc07b7353..68891313875d 100644
--- a/include/linux/mtd/mtdram.h
+++ b/include/linux/mtd/mtdram.h
@@ -3,6 +3,6 @@
3 3
4#include <linux/mtd/mtd.h> 4#include <linux/mtd/mtd.h>
5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, 5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
6 unsigned long size, char *name); 6 unsigned long size, char *name);
7 7
8#endif /* __MTD_MTDRAM_H__ */ 8#endif /* __MTD_MTDRAM_H__ */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ccab9dfc5217..a81b185e23a7 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -25,11 +25,13 @@
25#include <linux/mtd/bbm.h> 25#include <linux/mtd/bbm.h>
26 26
27struct mtd_info; 27struct mtd_info;
28struct nand_flash_dev;
28/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
29extern int nand_scan (struct mtd_info *mtd, int max_chips); 30extern int nand_scan (struct mtd_info *mtd, int max_chips);
30/* Separate phases of nand_scan(), allowing board driver to intervene 31/* Separate phases of nand_scan(), allowing board driver to intervene
31 * and override command or ECC setup according to flash type */ 32 * and override command or ECC setup according to flash type */
32extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); 33extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
34 struct nand_flash_dev *table);
33extern int nand_scan_tail(struct mtd_info *mtd); 35extern int nand_scan_tail(struct mtd_info *mtd);
34 36
35/* Free resources held by the NAND device */ 37/* Free resources held by the NAND device */
@@ -38,6 +40,12 @@ extern void nand_release (struct mtd_info *mtd);
38/* Internal helper for board drivers which need to override command function */ 40/* Internal helper for board drivers which need to override command function */
39extern void nand_wait_ready(struct mtd_info *mtd); 41extern void nand_wait_ready(struct mtd_info *mtd);
40 42
43/* locks all blockes present in the device */
44extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
45
46/* unlocks specified locked blockes */
47extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
48
41/* The maximum number of NAND chips in an array */ 49/* The maximum number of NAND chips in an array */
42#define NAND_MAX_CHIPS 8 50#define NAND_MAX_CHIPS 8
43 51
@@ -45,7 +53,7 @@ extern void nand_wait_ready(struct mtd_info *mtd);
45 * is supported now. If you add a chip with bigger oobsize/page 53 * is supported now. If you add a chip with bigger oobsize/page
46 * adjust this accordingly. 54 * adjust this accordingly.
47 */ 55 */
48#define NAND_MAX_OOBSIZE 128 56#define NAND_MAX_OOBSIZE 256
49#define NAND_MAX_PAGESIZE 4096 57#define NAND_MAX_PAGESIZE 4096
50 58
51/* 59/*
@@ -82,6 +90,10 @@ extern void nand_wait_ready(struct mtd_info *mtd);
82#define NAND_CMD_ERASE2 0xd0 90#define NAND_CMD_ERASE2 0xd0
83#define NAND_CMD_RESET 0xff 91#define NAND_CMD_RESET 0xff
84 92
93#define NAND_CMD_LOCK 0x2a
94#define NAND_CMD_UNLOCK1 0x23
95#define NAND_CMD_UNLOCK2 0x24
96
85/* Extended commands for large page devices */ 97/* Extended commands for large page devices */
86#define NAND_CMD_READSTART 0x30 98#define NAND_CMD_READSTART 0x30
87#define NAND_CMD_RNDOUTSTART 0xE0 99#define NAND_CMD_RNDOUTSTART 0xE0
@@ -169,6 +181,14 @@ typedef enum {
169#define NAND_NO_READRDY 0x00000100 181#define NAND_NO_READRDY 0x00000100
170/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
171#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184/* Chip stores bad block marker on the last page of the eraseblock */
185#define NAND_BB_LAST_PAGE 0x00000400
186
187/* Device is one of 'new' xD cards that expose fake nand command set */
188#define NAND_BROKEN_XD 0x00000400
189
190/* Device behaves just like nand, but is readonly */
191#define NAND_ROM 0x00000800
172 192
173/* Options valid for Samsung large page devices */ 193/* Options valid for Samsung large page devices */
174#define NAND_SAMSUNG_LP_OPTIONS \ 194#define NAND_SAMSUNG_LP_OPTIONS \
@@ -391,6 +411,7 @@ struct nand_chip {
391 int subpagesize; 411 int subpagesize;
392 uint8_t cellinfo; 412 uint8_t cellinfo;
393 int badblockpos; 413 int badblockpos;
414 int badblockbits;
394 415
395 flstate_t state; 416 flstate_t state;
396 417
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 5509eb06b326..c26ff86ad08a 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -125,6 +125,9 @@ struct onenand_chip {
125 flstate_t state; 125 flstate_t state;
126 unsigned char *page_buf; 126 unsigned char *page_buf;
127 unsigned char *oob_buf; 127 unsigned char *oob_buf;
128#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
129 unsigned char *verify_buf;
130#endif
128 131
129 int subpagesize; 132 int subpagesize;
130 struct nand_ecclayout *ecclayout; 133 struct nand_ecclayout *ecclayout;
@@ -175,10 +178,14 @@ struct onenand_chip {
175#define ONENAND_HAS_CONT_LOCK (0x0001) 178#define ONENAND_HAS_CONT_LOCK (0x0001)
176#define ONENAND_HAS_UNLOCK_ALL (0x0002) 179#define ONENAND_HAS_UNLOCK_ALL (0x0002)
177#define ONENAND_HAS_2PLANE (0x0004) 180#define ONENAND_HAS_2PLANE (0x0004)
181#define ONENAND_HAS_4KB_PAGE (0x0008)
178#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 182#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
179#define ONENAND_PAGEBUF_ALLOC (0x1000) 183#define ONENAND_PAGEBUF_ALLOC (0x1000)
180#define ONENAND_OOBBUF_ALLOC (0x2000) 184#define ONENAND_OOBBUF_ALLOC (0x2000)
181 185
186#define ONENAND_IS_4KB_PAGE(this) \
187 (this->options & ONENAND_HAS_4KB_PAGE)
188
182/* 189/*
183 * OneNAND Flash Manufacturer ID Codes 190 * OneNAND Flash Manufacturer ID Codes
184 */ 191 */
@@ -205,6 +212,8 @@ struct mtd_partition;
205 212
206struct onenand_platform_data { 213struct onenand_platform_data {
207 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 214 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
215 int (*read_bufferram)(struct mtd_info *mtd, int area,
216 unsigned char *buffer, int offset, size_t count);
208 struct mtd_partition *parts; 217 struct mtd_partition *parts;
209 unsigned int nr_parts; 218 unsigned int nr_parts;
210}; 219};
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index ab77609ec337..9cf4c4c79555 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -93,8 +93,6 @@
93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF 93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
94#define LOOP_TIMEOUT_MAX 0x00010000 94#define LOOP_TIMEOUT_MAX 0x00010000
95 95
96#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd)
97
98struct sh_flctl { 96struct sh_flctl {
99 struct mtd_info mtd; 97 struct mtd_info mtd;
100 struct nand_chip chip; 98 struct nand_chip chip;
@@ -125,4 +123,9 @@ struct sh_flctl_platform_data {
125 unsigned has_hwecc:1; 123 unsigned has_hwecc:1;
126}; 124};
127 125
126static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
127{
128 return container_of(mtdinfo, struct sh_flctl, mtd);
129}
130
128#endif /* __SH_FLCTL_H__ */ 131#endif /* __SH_FLCTL_H__ */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index 6330fc76b00f..5ec9ca671687 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -12,6 +12,7 @@
12#include <linux/ncp_mount.h> 12#include <linux/ncp_mount.h>
13#include <linux/net.h> 13#include <linux/net.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/backing-dev.h>
15 16
16#ifdef __KERNEL__ 17#ifdef __KERNEL__
17 18
@@ -127,6 +128,7 @@ struct ncp_server {
127 size_t len; 128 size_t len;
128 __u8 data[128]; 129 __u8 data[128];
129 } unexpected_packet; 130 } unexpected_packet;
131 struct backing_dev_info bdi;
130}; 132};
131 133
132extern void ncp_tcp_rcv_proc(struct work_struct *work); 134extern void ncp_tcp_rcv_proc(struct work_struct *work);
diff --git a/include/linux/net.h b/include/linux/net.h
index 4157b5d42bd6..2b4deeeb8646 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -59,6 +59,7 @@ typedef enum {
59#include <linux/wait.h> 59#include <linux/wait.h>
60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
61#include <linux/kmemcheck.h> 61#include <linux/kmemcheck.h>
62#include <linux/rcupdate.h>
62 63
63struct poll_table_struct; 64struct poll_table_struct;
64struct pipe_inode_info; 65struct pipe_inode_info;
@@ -116,6 +117,12 @@ enum sock_shutdown_cmd {
116 SHUT_RDWR = 2, 117 SHUT_RDWR = 2,
117}; 118};
118 119
120struct socket_wq {
121 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list;
123 struct rcu_head rcu;
124} ____cacheline_aligned_in_smp;
125
119/** 126/**
120 * struct socket - general BSD socket 127 * struct socket - general BSD socket
121 * @state: socket state (%SS_CONNECTED, etc) 128 * @state: socket state (%SS_CONNECTED, etc)
@@ -135,11 +142,8 @@ struct socket {
135 kmemcheck_bitfield_end(type); 142 kmemcheck_bitfield_end(type);
136 143
137 unsigned long flags; 144 unsigned long flags;
138 /* 145
139 * Please keep fasync_list & wait fields in the same cache line 146 struct socket_wq *wq;
140 */
141 struct fasync_struct *fasync_list;
142 wait_queue_head_t wait;
143 147
144 struct file *file; 148 struct file *file;
145 struct sock *sk; 149 struct sock *sk;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index fa8b47637997..a1bff6518166 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -31,6 +31,7 @@
31#include <linux/if_link.h> 31#include <linux/if_link.h>
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34#include <linux/pm_qos_params.h>
34#include <linux/timer.h> 35#include <linux/timer.h>
35#include <linux/delay.h> 36#include <linux/delay.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
@@ -218,34 +219,6 @@ struct neighbour;
218struct neigh_parms; 219struct neigh_parms;
219struct sk_buff; 220struct sk_buff;
220 221
221struct netif_rx_stats {
222 unsigned total;
223 unsigned dropped;
224 unsigned time_squeeze;
225 unsigned cpu_collision;
226};
227
228DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
229
230struct dev_addr_list {
231 struct dev_addr_list *next;
232 u8 da_addr[MAX_ADDR_LEN];
233 u8 da_addrlen;
234 u8 da_synced;
235 int da_users;
236 int da_gusers;
237};
238
239/*
240 * We tag multicasts with these structures.
241 */
242
243#define dev_mc_list dev_addr_list
244#define dmi_addr da_addr
245#define dmi_addrlen da_addrlen
246#define dmi_users da_users
247#define dmi_gusers da_gusers
248
249struct netdev_hw_addr { 222struct netdev_hw_addr {
250 struct list_head list; 223 struct list_head list;
251 unsigned char addr[MAX_ADDR_LEN]; 224 unsigned char addr[MAX_ADDR_LEN];
@@ -254,8 +227,10 @@ struct netdev_hw_addr {
254#define NETDEV_HW_ADDR_T_SAN 2 227#define NETDEV_HW_ADDR_T_SAN 2
255#define NETDEV_HW_ADDR_T_SLAVE 3 228#define NETDEV_HW_ADDR_T_SLAVE 3
256#define NETDEV_HW_ADDR_T_UNICAST 4 229#define NETDEV_HW_ADDR_T_UNICAST 4
230#define NETDEV_HW_ADDR_T_MULTICAST 5
257 int refcount; 231 int refcount;
258 bool synced; 232 bool synced;
233 bool global_use;
259 struct rcu_head rcu_head; 234 struct rcu_head rcu_head;
260}; 235};
261 236
@@ -264,16 +239,20 @@ struct netdev_hw_addr_list {
264 int count; 239 int count;
265}; 240};
266 241
267#define netdev_uc_count(dev) ((dev)->uc.count) 242#define netdev_hw_addr_list_count(l) ((l)->count)
268#define netdev_uc_empty(dev) ((dev)->uc.count == 0) 243#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
269#define netdev_for_each_uc_addr(ha, dev) \ 244#define netdev_hw_addr_list_for_each(ha, l) \
270 list_for_each_entry(ha, &dev->uc.list, list) 245 list_for_each_entry(ha, &(l)->list, list)
271 246
272#define netdev_mc_count(dev) ((dev)->mc_count) 247#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
273#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) 248#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
249#define netdev_for_each_uc_addr(ha, dev) \
250 netdev_hw_addr_list_for_each(ha, &(dev)->uc)
274 251
275#define netdev_for_each_mc_addr(mclist, dev) \ 252#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
276 for (mclist = dev->mc_list; mclist; mclist = mclist->next) 253#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
254#define netdev_for_each_mc_addr(ha, dev) \
255 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
277 256
278struct hh_cache { 257struct hh_cache {
279 struct hh_cache *hh_next; /* Next entry */ 258 struct hh_cache *hh_next; /* Next entry */
@@ -530,6 +509,85 @@ struct netdev_queue {
530 unsigned long tx_dropped; 509 unsigned long tx_dropped;
531} ____cacheline_aligned_in_smp; 510} ____cacheline_aligned_in_smp;
532 511
512#ifdef CONFIG_RPS
513/*
514 * This structure holds an RPS map which can be of variable length. The
515 * map is an array of CPUs.
516 */
517struct rps_map {
518 unsigned int len;
519 struct rcu_head rcu;
520 u16 cpus[0];
521};
522#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
523
524/*
525 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
526 * tail pointer for that CPU's input queue at the time of last enqueue.
527 */
528struct rps_dev_flow {
529 u16 cpu;
530 u16 fill;
531 unsigned int last_qtail;
532};
533
534/*
535 * The rps_dev_flow_table structure contains a table of flow mappings.
536 */
537struct rps_dev_flow_table {
538 unsigned int mask;
539 struct rcu_head rcu;
540 struct work_struct free_work;
541 struct rps_dev_flow flows[0];
542};
543#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
544 (_num * sizeof(struct rps_dev_flow)))
545
546/*
547 * The rps_sock_flow_table contains mappings of flows to the last CPU
548 * on which they were processed by the application (set in recvmsg).
549 */
550struct rps_sock_flow_table {
551 unsigned int mask;
552 u16 ents[0];
553};
554#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
555 (_num * sizeof(u16)))
556
557#define RPS_NO_CPU 0xffff
558
559static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
560 u32 hash)
561{
562 if (table && hash) {
563 unsigned int cpu, index = hash & table->mask;
564
565 /* We only give a hint, preemption can change cpu under us */
566 cpu = raw_smp_processor_id();
567
568 if (table->ents[index] != cpu)
569 table->ents[index] = cpu;
570 }
571}
572
573static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
574 u32 hash)
575{
576 if (table && hash)
577 table->ents[hash & table->mask] = RPS_NO_CPU;
578}
579
580extern struct rps_sock_flow_table *rps_sock_flow_table;
581
582/* This structure contains an instance of an RX queue. */
583struct netdev_rx_queue {
584 struct rps_map *rps_map;
585 struct rps_dev_flow_table *rps_flow_table;
586 struct kobject kobj;
587 struct netdev_rx_queue *first;
588 atomic_t count;
589} ____cacheline_aligned_in_smp;
590#endif /* CONFIG_RPS */
533 591
534/* 592/*
535 * This structure defines the management hooks for network devices. 593 * This structure defines the management hooks for network devices.
@@ -629,6 +687,9 @@ struct netdev_queue {
629 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 687 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
630 * int (*ndo_get_vf_config)(struct net_device *dev, 688 * int (*ndo_get_vf_config)(struct net_device *dev,
631 * int vf, struct ifla_vf_info *ivf); 689 * int vf, struct ifla_vf_info *ivf);
690 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
691 * struct nlattr *port[]);
692 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
632 */ 693 */
633#define HAVE_NET_DEVICE_OPS 694#define HAVE_NET_DEVICE_OPS
634struct net_device_ops { 695struct net_device_ops {
@@ -667,6 +728,7 @@ struct net_device_ops {
667 unsigned short vid); 728 unsigned short vid);
668#ifdef CONFIG_NET_POLL_CONTROLLER 729#ifdef CONFIG_NET_POLL_CONTROLLER
669 void (*ndo_poll_controller)(struct net_device *dev); 730 void (*ndo_poll_controller)(struct net_device *dev);
731 void (*ndo_netpoll_cleanup)(struct net_device *dev);
670#endif 732#endif
671 int (*ndo_set_vf_mac)(struct net_device *dev, 733 int (*ndo_set_vf_mac)(struct net_device *dev,
672 int queue, u8 *mac); 734 int queue, u8 *mac);
@@ -677,6 +739,11 @@ struct net_device_ops {
677 int (*ndo_get_vf_config)(struct net_device *dev, 739 int (*ndo_get_vf_config)(struct net_device *dev,
678 int vf, 740 int vf,
679 struct ifla_vf_info *ivf); 741 struct ifla_vf_info *ivf);
742 int (*ndo_set_vf_port)(struct net_device *dev,
743 int vf,
744 struct nlattr *port[]);
745 int (*ndo_get_vf_port)(struct net_device *dev,
746 int vf, struct sk_buff *skb);
680#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 747#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
681 int (*ndo_fcoe_enable)(struct net_device *dev); 748 int (*ndo_fcoe_enable)(struct net_device *dev);
682 int (*ndo_fcoe_disable)(struct net_device *dev); 749 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -711,6 +778,9 @@ struct net_device {
711 * the interface. 778 * the interface.
712 */ 779 */
713 char name[IFNAMSIZ]; 780 char name[IFNAMSIZ];
781
782 struct pm_qos_request_list *pm_qos_req;
783
714 /* device name hash chain */ 784 /* device name hash chain */
715 struct hlist_node name_hlist; 785 struct hlist_node name_hlist;
716 /* snmp alias */ 786 /* snmp alias */
@@ -764,6 +834,7 @@ struct net_device {
764#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ 834#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
765#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 835#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
766#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ 836#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
837#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
767 838
768 /* Segmentation offload features */ 839 /* Segmentation offload features */
769#define NETIF_F_GSO_SHIFT 16 840#define NETIF_F_GSO_SHIFT 16
@@ -820,7 +891,7 @@ struct net_device {
820 unsigned char operstate; /* RFC2863 operstate */ 891 unsigned char operstate; /* RFC2863 operstate */
821 unsigned char link_mode; /* mapping policy to operstate */ 892 unsigned char link_mode; /* mapping policy to operstate */
822 893
823 unsigned mtu; /* interface MTU value */ 894 unsigned int mtu; /* interface MTU value */
824 unsigned short type; /* interface hardware type */ 895 unsigned short type; /* interface hardware type */
825 unsigned short hard_header_len; /* hardware hdr length */ 896 unsigned short hard_header_len; /* hardware hdr length */
826 897
@@ -840,12 +911,10 @@ struct net_device {
840 unsigned char addr_len; /* hardware address length */ 911 unsigned char addr_len; /* hardware address length */
841 unsigned short dev_id; /* for shared network cards */ 912 unsigned short dev_id; /* for shared network cards */
842 913
843 struct netdev_hw_addr_list uc; /* Secondary unicast
844 mac addresses */
845 int uc_promisc;
846 spinlock_t addr_list_lock; 914 spinlock_t addr_list_lock;
847 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 915 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
848 int mc_count; /* Number of installed mcasts */ 916 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
917 int uc_promisc;
849 unsigned int promiscuity; 918 unsigned int promiscuity;
850 unsigned int allmulti; 919 unsigned int allmulti;
851 920
@@ -878,6 +947,15 @@ struct net_device {
878 947
879 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 948 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
880 949
950#ifdef CONFIG_RPS
951 struct kset *queues_kset;
952
953 struct netdev_rx_queue *_rx;
954
955 /* Number of RX queues allocated at alloc_netdev_mq() time */
956 unsigned int num_rx_queues;
957#endif
958
881 struct netdev_queue rx_queue; 959 struct netdev_queue rx_queue;
882 960
883 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 961 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
@@ -1306,19 +1384,44 @@ static inline int unregister_gifconf(unsigned int family)
1306} 1384}
1307 1385
1308/* 1386/*
1309 * Incoming packets are placed on per-cpu queues so that 1387 * Incoming packets are placed on per-cpu queues
1310 * no locking is needed.
1311 */ 1388 */
1312struct softnet_data { 1389struct softnet_data {
1313 struct Qdisc *output_queue; 1390 struct Qdisc *output_queue;
1314 struct sk_buff_head input_pkt_queue; 1391 struct Qdisc **output_queue_tailp;
1315 struct list_head poll_list; 1392 struct list_head poll_list;
1316 struct sk_buff *completion_queue; 1393 struct sk_buff *completion_queue;
1317 1394 struct sk_buff_head process_queue;
1395
1396 /* stats */
1397 unsigned int processed;
1398 unsigned int time_squeeze;
1399 unsigned int cpu_collision;
1400 unsigned int received_rps;
1401
1402#ifdef CONFIG_RPS
1403 struct softnet_data *rps_ipi_list;
1404
1405 /* Elements below can be accessed between CPUs for RPS */
1406 struct call_single_data csd ____cacheline_aligned_in_smp;
1407 struct softnet_data *rps_ipi_next;
1408 unsigned int cpu;
1409 unsigned int input_queue_head;
1410#endif
1411 unsigned dropped;
1412 struct sk_buff_head input_pkt_queue;
1318 struct napi_struct backlog; 1413 struct napi_struct backlog;
1319}; 1414};
1320 1415
1321DECLARE_PER_CPU(struct softnet_data,softnet_data); 1416static inline void input_queue_head_add(struct softnet_data *sd,
1417 unsigned int len)
1418{
1419#ifdef CONFIG_RPS
1420 sd->input_queue_head += len;
1421#endif
1422}
1423
1424DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1322 1425
1323#define HAVE_NETIF_QUEUE 1426#define HAVE_NETIF_QUEUE
1324 1427
@@ -1945,6 +2048,22 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1945extern int register_netdev(struct net_device *dev); 2048extern int register_netdev(struct net_device *dev);
1946extern void unregister_netdev(struct net_device *dev); 2049extern void unregister_netdev(struct net_device *dev);
1947 2050
2051/* General hardware address lists handling functions */
2052extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2053 struct netdev_hw_addr_list *from_list,
2054 int addr_len, unsigned char addr_type);
2055extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2056 struct netdev_hw_addr_list *from_list,
2057 int addr_len, unsigned char addr_type);
2058extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2059 struct netdev_hw_addr_list *from_list,
2060 int addr_len);
2061extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2062 struct netdev_hw_addr_list *from_list,
2063 int addr_len);
2064extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2065extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2066
1948/* Functions used for device addresses handling */ 2067/* Functions used for device addresses handling */
1949extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2068extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1950 unsigned char addr_type); 2069 unsigned char addr_type);
@@ -1956,26 +2075,34 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,
1956extern int dev_addr_del_multiple(struct net_device *to_dev, 2075extern int dev_addr_del_multiple(struct net_device *to_dev,
1957 struct net_device *from_dev, 2076 struct net_device *from_dev,
1958 unsigned char addr_type); 2077 unsigned char addr_type);
2078extern void dev_addr_flush(struct net_device *dev);
2079extern int dev_addr_init(struct net_device *dev);
2080
2081/* Functions used for unicast addresses handling */
2082extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2083extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2084extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2085extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2086extern void dev_uc_flush(struct net_device *dev);
2087extern void dev_uc_init(struct net_device *dev);
2088
2089/* Functions used for multicast addresses handling */
2090extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2091extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2092extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2093extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2094extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2095extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2096extern void dev_mc_flush(struct net_device *dev);
2097extern void dev_mc_init(struct net_device *dev);
1959 2098
1960/* Functions used for secondary unicast and multicast support */ 2099/* Functions used for secondary unicast and multicast support */
1961extern void dev_set_rx_mode(struct net_device *dev); 2100extern void dev_set_rx_mode(struct net_device *dev);
1962extern void __dev_set_rx_mode(struct net_device *dev); 2101extern void __dev_set_rx_mode(struct net_device *dev);
1963extern int dev_unicast_delete(struct net_device *dev, void *addr);
1964extern int dev_unicast_add(struct net_device *dev, void *addr);
1965extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1966extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1967extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1968extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1969extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1970extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1971extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1972extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1973extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1974extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1975extern int dev_set_promiscuity(struct net_device *dev, int inc); 2102extern int dev_set_promiscuity(struct net_device *dev, int inc);
1976extern int dev_set_allmulti(struct net_device *dev, int inc); 2103extern int dev_set_allmulti(struct net_device *dev, int inc);
1977extern void netdev_state_change(struct net_device *dev); 2104extern void netdev_state_change(struct net_device *dev);
1978extern void netdev_bonding_change(struct net_device *dev, 2105extern int netdev_bonding_change(struct net_device *dev,
1979 unsigned long event); 2106 unsigned long event);
1980extern void netdev_features_change(struct net_device *dev); 2107extern void netdev_features_change(struct net_device *dev);
1981/* Load a device via the kmod */ 2108/* Load a device via the kmod */
@@ -1985,6 +2112,7 @@ extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1985extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2112extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats);
1986 2113
1987extern int netdev_max_backlog; 2114extern int netdev_max_backlog;
2115extern int netdev_tstamp_prequeue;
1988extern int weight_p; 2116extern int weight_p;
1989extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2117extern int netdev_set_master(struct net_device *dev, struct net_device *master);
1990extern int skb_checksum_help(struct sk_buff *skb); 2118extern int skb_checksum_help(struct sk_buff *skb);
@@ -2045,54 +2173,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2045 dev->gso_max_size = size; 2173 dev->gso_max_size = size;
2046} 2174}
2047 2175
2048static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, 2176extern int __skb_bond_should_drop(struct sk_buff *skb,
2049 struct net_device *master) 2177 struct net_device *master);
2050{
2051 if (skb->pkt_type == PACKET_HOST) {
2052 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
2053 2178
2054 memcpy(dest, master->dev_addr, ETH_ALEN);
2055 }
2056}
2057
2058/* On bonding slaves other than the currently active slave, suppress
2059 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
2060 * ARP on active-backup slaves with arp_validate enabled.
2061 */
2062static inline int skb_bond_should_drop(struct sk_buff *skb, 2179static inline int skb_bond_should_drop(struct sk_buff *skb,
2063 struct net_device *master) 2180 struct net_device *master)
2064{ 2181{
2065 if (master) { 2182 if (master)
2066 struct net_device *dev = skb->dev; 2183 return __skb_bond_should_drop(skb, master);
2067
2068 if (master->priv_flags & IFF_MASTER_ARPMON)
2069 dev->last_rx = jiffies;
2070
2071 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
2072 /* Do address unmangle. The local destination address
2073 * will be always the one master has. Provides the right
2074 * functionality in a bridge.
2075 */
2076 skb_bond_set_mac_by_master(skb, master);
2077 }
2078
2079 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
2080 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
2081 skb->protocol == __cpu_to_be16(ETH_P_ARP))
2082 return 0;
2083
2084 if (master->priv_flags & IFF_MASTER_ALB) {
2085 if (skb->pkt_type != PACKET_BROADCAST &&
2086 skb->pkt_type != PACKET_MULTICAST)
2087 return 0;
2088 }
2089 if (master->priv_flags & IFF_MASTER_8023AD &&
2090 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
2091 return 0;
2092
2093 return 1;
2094 }
2095 }
2096 return 0; 2184 return 0;
2097} 2185}
2098 2186
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index a5a63e41b8af..48767cd16453 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -16,6 +16,7 @@ header-y += xt_RATEEST.h
16header-y += xt_SECMARK.h 16header-y += xt_SECMARK.h
17header-y += xt_TCPMSS.h 17header-y += xt_TCPMSS.h
18header-y += xt_TCPOPTSTRIP.h 18header-y += xt_TCPOPTSTRIP.h
19header-y += xt_TEE.h
19header-y += xt_TPROXY.h 20header-y += xt_TPROXY.h
20header-y += xt_comment.h 21header-y += xt_comment.h
21header-y += xt_connbytes.h 22header-y += xt_connbytes.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index c608677dda60..14e6d32002c4 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -113,6 +113,7 @@ struct ip_conntrack_stat {
113 unsigned int expect_new; 113 unsigned int expect_new;
114 unsigned int expect_create; 114 unsigned int expect_create;
115 unsigned int expect_delete; 115 unsigned int expect_delete;
116 unsigned int search_restart;
116}; 117};
117 118
118/* call to create an explicit dependency on nf_conntrack. */ 119/* call to create an explicit dependency on nf_conntrack. */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 8e145f0d61cb..2ea22b018a87 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -1,8 +1,7 @@
1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H 1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
2#define _NF_CONNTRACK_TUPLE_COMMON_H 2#define _NF_CONNTRACK_TUPLE_COMMON_H
3 3
4enum ip_conntrack_dir 4enum ip_conntrack_dir {
5{
6 IP_CT_DIR_ORIGINAL, 5 IP_CT_DIR_ORIGINAL,
7 IP_CT_DIR_REPLY, 6 IP_CT_DIR_REPLY,
8 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 84c7c928e9eb..c2ee5d8550cf 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,9 +1,10 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3 3#include <linux/kernel.h>
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_FUNCTION_MAXNAMELEN 30 6#define XT_FUNCTION_MAXNAMELEN 30
7#define XT_EXTENSION_MAXNAMELEN 29
7#define XT_TABLE_MAXNAMELEN 32 8#define XT_TABLE_MAXNAMELEN 32
8 9
9struct xt_entry_match { 10struct xt_entry_match {
@@ -12,8 +13,7 @@ struct xt_entry_match {
12 __u16 match_size; 13 __u16 match_size;
13 14
14 /* Used by userspace */ 15 /* Used by userspace */
15 char name[XT_FUNCTION_MAXNAMELEN-1]; 16 char name[XT_EXTENSION_MAXNAMELEN];
16
17 __u8 revision; 17 __u8 revision;
18 } user; 18 } user;
19 struct { 19 struct {
@@ -36,8 +36,7 @@ struct xt_entry_target {
36 __u16 target_size; 36 __u16 target_size;
37 37
38 /* Used by userspace */ 38 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1]; 39 char name[XT_EXTENSION_MAXNAMELEN];
40
41 __u8 revision; 40 __u8 revision;
42 } user; 41 } user;
43 struct { 42 struct {
@@ -70,8 +69,7 @@ struct xt_standard_target {
70/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 69/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
71 * kernel supports, if >= revision. */ 70 * kernel supports, if >= revision. */
72struct xt_get_revision { 71struct xt_get_revision {
73 char name[XT_FUNCTION_MAXNAMELEN-1]; 72 char name[XT_EXTENSION_MAXNAMELEN];
74
75 __u8 revision; 73 __u8 revision;
76}; 74};
77 75
@@ -93,7 +91,7 @@ struct _xt_align {
93 __u64 u64; 91 __u64 u64;
94}; 92};
95 93
96#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) 94#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
97 95
98/* Standard return verdict, or do jump. */ 96/* Standard return verdict, or do jump. */
99#define XT_STANDARD_TARGET "" 97#define XT_STANDARD_TARGET ""
@@ -185,40 +183,53 @@ struct xt_counters_info {
185#include <linux/netdevice.h> 183#include <linux/netdevice.h>
186 184
187/** 185/**
188 * struct xt_match_param - parameters for match extensions' match functions 186 * struct xt_action_param - parameters for matches/targets
189 * 187 *
188 * @match: the match extension
189 * @target: the target extension
190 * @matchinfo: per-match data
191 * @targetinfo: per-target data
190 * @in: input netdevice 192 * @in: input netdevice
191 * @out: output netdevice 193 * @out: output netdevice
192 * @match: struct xt_match through which this function was invoked
193 * @matchinfo: per-match data
194 * @fragoff: packet is a fragment, this is the data offset 194 * @fragoff: packet is a fragment, this is the data offset
195 * @thoff: position of transport header relative to skb->data 195 * @thoff: position of transport header relative to skb->data
196 * @hook: hook number given packet came from 196 * @hook: hook number given packet came from
197 * @family: Actual NFPROTO_* through which the function is invoked 197 * @family: Actual NFPROTO_* through which the function is invoked
198 * (helpful when match->family == NFPROTO_UNSPEC) 198 * (helpful when match->family == NFPROTO_UNSPEC)
199 *
200 * Fields written to by extensions:
201 *
199 * @hotdrop: drop packet if we had inspection problems 202 * @hotdrop: drop packet if we had inspection problems
203 * Network namespace obtainable using dev_net(in/out)
200 */ 204 */
201struct xt_match_param { 205struct xt_action_param {
206 union {
207 const struct xt_match *match;
208 const struct xt_target *target;
209 };
210 union {
211 const void *matchinfo, *targinfo;
212 };
202 const struct net_device *in, *out; 213 const struct net_device *in, *out;
203 const struct xt_match *match;
204 const void *matchinfo;
205 int fragoff; 214 int fragoff;
206 unsigned int thoff; 215 unsigned int thoff;
207 unsigned int hooknum; 216 unsigned int hooknum;
208 u_int8_t family; 217 u_int8_t family;
209 bool *hotdrop; 218 bool hotdrop;
210}; 219};
211 220
212/** 221/**
213 * struct xt_mtchk_param - parameters for match extensions' 222 * struct xt_mtchk_param - parameters for match extensions'
214 * checkentry functions 223 * checkentry functions
215 * 224 *
225 * @net: network namespace through which the check was invoked
216 * @table: table the rule is tried to be inserted into 226 * @table: table the rule is tried to be inserted into
217 * @entryinfo: the family-specific rule data 227 * @entryinfo: the family-specific rule data
218 * (struct ipt_ip, ip6t_ip, ebt_entry) 228 * (struct ipt_ip, ip6t_ip, arpt_arp or (note) ebt_entry)
219 * @match: struct xt_match through which this function was invoked 229 * @match: struct xt_match through which this function was invoked
220 * @matchinfo: per-match data 230 * @matchinfo: per-match data
221 * @hook_mask: via which hooks the new rule is reachable 231 * @hook_mask: via which hooks the new rule is reachable
232 * Other fields as above.
222 */ 233 */
223struct xt_mtchk_param { 234struct xt_mtchk_param {
224 struct net *net; 235 struct net *net;
@@ -230,7 +241,10 @@ struct xt_mtchk_param {
230 u_int8_t family; 241 u_int8_t family;
231}; 242};
232 243
233/* Match destructor parameters */ 244/**
245 * struct xt_mdtor_param - match destructor parameters
246 * Fields as above.
247 */
234struct xt_mtdtor_param { 248struct xt_mtdtor_param {
235 struct net *net; 249 struct net *net;
236 const struct xt_match *match; 250 const struct xt_match *match;
@@ -239,23 +253,6 @@ struct xt_mtdtor_param {
239}; 253};
240 254
241/** 255/**
242 * struct xt_target_param - parameters for target extensions' target functions
243 *
244 * @hooknum: hook through which this target was invoked
245 * @target: struct xt_target through which this function was invoked
246 * @targinfo: per-target data
247 *
248 * Other fields see above.
249 */
250struct xt_target_param {
251 const struct net_device *in, *out;
252 const struct xt_target *target;
253 const void *targinfo;
254 unsigned int hooknum;
255 u_int8_t family;
256};
257
258/**
259 * struct xt_tgchk_param - parameters for target extensions' 256 * struct xt_tgchk_param - parameters for target extensions'
260 * checkentry functions 257 * checkentry functions
261 * 258 *
@@ -285,7 +282,7 @@ struct xt_tgdtor_param {
285struct xt_match { 282struct xt_match {
286 struct list_head list; 283 struct list_head list;
287 284
288 const char name[XT_FUNCTION_MAXNAMELEN-1]; 285 const char name[XT_EXTENSION_MAXNAMELEN];
289 u_int8_t revision; 286 u_int8_t revision;
290 287
291 /* Return true or false: return FALSE and set *hotdrop = 1 to 288 /* Return true or false: return FALSE and set *hotdrop = 1 to
@@ -294,10 +291,10 @@ struct xt_match {
294 non-linear skb, using skb_header_pointer and 291 non-linear skb, using skb_header_pointer and
295 skb_ip_make_writable. */ 292 skb_ip_make_writable. */
296 bool (*match)(const struct sk_buff *skb, 293 bool (*match)(const struct sk_buff *skb,
297 const struct xt_match_param *); 294 struct xt_action_param *);
298 295
299 /* Called when user tries to insert an entry of this type. */ 296 /* Called when user tries to insert an entry of this type. */
300 bool (*checkentry)(const struct xt_mtchk_param *); 297 int (*checkentry)(const struct xt_mtchk_param *);
301 298
302 /* Called when entry of this type deleted. */ 299 /* Called when entry of this type deleted. */
303 void (*destroy)(const struct xt_mtdtor_param *); 300 void (*destroy)(const struct xt_mtdtor_param *);
@@ -309,9 +306,6 @@ struct xt_match {
309 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 306 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
310 struct module *me; 307 struct module *me;
311 308
312 /* Free to use by each match */
313 unsigned long data;
314
315 const char *table; 309 const char *table;
316 unsigned int matchsize; 310 unsigned int matchsize;
317#ifdef CONFIG_COMPAT 311#ifdef CONFIG_COMPAT
@@ -327,19 +321,20 @@ struct xt_match {
327struct xt_target { 321struct xt_target {
328 struct list_head list; 322 struct list_head list;
329 323
330 const char name[XT_FUNCTION_MAXNAMELEN-1]; 324 const char name[XT_EXTENSION_MAXNAMELEN];
325 u_int8_t revision;
331 326
332 /* Returns verdict. Argument order changed since 2.6.9, as this 327 /* Returns verdict. Argument order changed since 2.6.9, as this
333 must now handle non-linear skbs, using skb_copy_bits and 328 must now handle non-linear skbs, using skb_copy_bits and
334 skb_ip_make_writable. */ 329 skb_ip_make_writable. */
335 unsigned int (*target)(struct sk_buff *skb, 330 unsigned int (*target)(struct sk_buff *skb,
336 const struct xt_target_param *); 331 const struct xt_action_param *);
337 332
338 /* Called when user tries to insert an entry of this type: 333 /* Called when user tries to insert an entry of this type:
339 hook_mask is a bitmask of hooks from which it can be 334 hook_mask is a bitmask of hooks from which it can be
340 called. */ 335 called. */
341 /* Should return true or false. */ 336 /* Should return true or false, or an error code (-Exxxx). */
342 bool (*checkentry)(const struct xt_tgchk_param *); 337 int (*checkentry)(const struct xt_tgchk_param *);
343 338
344 /* Called when entry of this type deleted. */ 339 /* Called when entry of this type deleted. */
345 void (*destroy)(const struct xt_tgdtor_param *); 340 void (*destroy)(const struct xt_tgdtor_param *);
@@ -360,7 +355,6 @@ struct xt_target {
360 unsigned short proto; 355 unsigned short proto;
361 356
362 unsigned short family; 357 unsigned short family;
363 u_int8_t revision;
364}; 358};
365 359
366/* Furniture shopping... */ 360/* Furniture shopping... */
@@ -398,6 +392,13 @@ struct xt_table_info {
398 unsigned int hook_entry[NF_INET_NUMHOOKS]; 392 unsigned int hook_entry[NF_INET_NUMHOOKS];
399 unsigned int underflow[NF_INET_NUMHOOKS]; 393 unsigned int underflow[NF_INET_NUMHOOKS];
400 394
395 /*
396 * Number of user chains. Since tables cannot have loops, at most
397 * @stacksize jumps (number of user chains) can possibly be made.
398 */
399 unsigned int stacksize;
400 unsigned int *stackptr;
401 void ***jumpstack;
401 /* ipt_entry tables: one per CPU */ 402 /* ipt_entry tables: one per CPU */
402 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ 403 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
403 void *entries[1]; 404 void *entries[1];
@@ -433,6 +434,8 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
433 434
434extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); 435extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
435extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); 436extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
437extern struct xt_match *xt_request_find_match(u8 af, const char *name,
438 u8 revision);
436extern struct xt_target *xt_request_find_target(u8 af, const char *name, 439extern struct xt_target *xt_request_find_target(u8 af, const char *name,
437 u8 revision); 440 u8 revision);
438extern int xt_find_revision(u8 af, const char *name, u8 revision, 441extern int xt_find_revision(u8 af, const char *name, u8 revision,
@@ -598,7 +601,7 @@ struct _compat_xt_align {
598 compat_u64 u64; 601 compat_u64 u64;
599}; 602};
600 603
601#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) 604#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
602 605
603extern void xt_compat_lock(u_int8_t af); 606extern void xt_compat_lock(u_int8_t af);
604extern void xt_compat_unlock(u_int8_t af); 607extern void xt_compat_unlock(u_int8_t af);
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 0a8545866752..2f2e48ec8023 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -1,26 +1,6 @@
1#ifndef _XT_CONNMARK_H_target 1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target 2#define _XT_CONNMARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_connmark.h>
5
6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
7 * by Henrik Nordstrom <hno@marasystems.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25 5
26#endif /*_XT_CONNMARK_H_target*/ 6#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index bc9561bdef79..41c456deba22 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -1,10 +1,6 @@
1#ifndef _XT_MARK_H_target 1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target 2#define _XT_MARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_mark.h>
5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9 5
10#endif /*_XT_MARK_H_target */ 6#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_TEE.h b/include/linux/netfilter/xt_TEE.h
new file mode 100644
index 000000000000..5c21d5c829af
--- /dev/null
+++ b/include/linux/netfilter/xt_TEE.h
@@ -0,0 +1,12 @@
1#ifndef _XT_TEE_TARGET_H
2#define _XT_TEE_TARGET_H
3
4struct xt_tee_tginfo {
5 union nf_inet_addr gw;
6 char oif[16];
7
8 /* used internally by the kernel */
9 struct xt_tee_priv *priv __attribute__((aligned(8)));
10};
11
12#endif /* _XT_TEE_TARGET_H */
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 619e47cde01a..efc17a8305fb 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -12,6 +12,17 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25
15struct xt_connmark_mtinfo1 { 26struct xt_connmark_mtinfo1 {
16 __u32 mark, mask; 27 __u32 mark, mask;
17 __u8 invert; 28 __u8 invert;
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 6607c8f38ea5..ecadc40d5cde 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9
6struct xt_mark_mtinfo1 { 10struct xt_mark_mtinfo1 {
7 __u32 mark, mask; 11 __u32 mark, mask;
8 __u8 invert; 12 __u8 invert;
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index d2c276609925..83318e01425e 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -9,6 +9,7 @@ enum {
9 XT_RECENT_UPDATE = 1 << 2, 9 XT_RECENT_UPDATE = 1 << 2,
10 XT_RECENT_REMOVE = 1 << 3, 10 XT_RECENT_REMOVE = 1 << 3,
11 XT_RECENT_TTL = 1 << 4, 11 XT_RECENT_TTL = 1 << 4,
12 XT_RECENT_REAP = 1 << 5,
12 13
13 XT_RECENT_SOURCE = 0, 14 XT_RECENT_SOURCE = 0,
14 XT_RECENT_DEST = 1, 15 XT_RECENT_DEST = 1,
@@ -16,6 +17,12 @@ enum {
16 XT_RECENT_NAME_LEN = 200, 17 XT_RECENT_NAME_LEN = 200,
17}; 18};
18 19
20/* Only allowed with --rcheck and --update */
21#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
22
23#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
24 XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
25
19struct xt_recent_mtinfo { 26struct xt_recent_mtinfo {
20 __u32 seconds; 27 __u32 seconds;
21 __u32 hit_count; 28 __u32 hit_count;
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index f8105e54716a..0ddd161f3b06 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -41,10 +41,10 @@ enum nf_br_hook_priorities {
41 41
42#define BRNF_PKT_TYPE 0x01 42#define BRNF_PKT_TYPE 0x01
43#define BRNF_BRIDGED_DNAT 0x02 43#define BRNF_BRIDGED_DNAT 0x02
44#define BRNF_DONT_TAKE_PARENT 0x04 44#define BRNF_BRIDGED 0x04
45#define BRNF_BRIDGED 0x08 45#define BRNF_NF_BRIDGE_PREROUTING 0x08
46#define BRNF_NF_BRIDGE_PREROUTING 0x10 46#define BRNF_8021Q 0x10
47 47#define BRNF_PPPoE 0x20
48 48
49/* Only used in br_forward.c */ 49/* Only used in br_forward.c */
50extern int nf_bridge_copy_header(struct sk_buff *skb); 50extern int nf_bridge_copy_header(struct sk_buff *skb);
@@ -68,6 +68,27 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
68 } 68 }
69} 69}
70 70
71static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
72{
73 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
74 return PPPOE_SES_HLEN;
75 return 0;
76}
77
78extern int br_handle_frame_finish(struct sk_buff *skb);
79/* Only used in br_device.c */
80static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
81{
82 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
83
84 skb_pull(skb, ETH_HLEN);
85 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
86 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
87 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
88 skb->dev = nf_bridge->physindev;
89 return br_handle_frame_finish(skb);
90}
91
71/* This is called by the IP fragmenting code and it ensures there is 92/* This is called by the IP fragmenting code and it ensures there is
72 * enough room for the encapsulating header (if there is one). */ 93 * enough room for the encapsulating header (if there is one). */
73static inline unsigned int nf_bridge_pad(const struct sk_buff *skb) 94static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index e5ba03d783c6..18442ff19c07 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -316,10 +316,6 @@ extern int ip6t_ext_hdr(u8 nexthdr);
316extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 316extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
317 int target, unsigned short *fragoff); 317 int target, unsigned short *fragoff);
318 318
319extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
320 const struct in6_addr *mask,
321 const struct in6_addr *addr2);
322
323#define IP6T_ALIGN(s) XT_ALIGN(s) 319#define IP6T_ALIGN(s) XT_ALIGN(s)
324 320
325#ifdef CONFIG_COMPAT 321#ifdef CONFIG_COMPAT
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6eaca5e1e8ca..59d066936ab9 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -188,6 +188,10 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group);
188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
190 __u32 group, gfp_t allocation); 190 __u32 group, gfp_t allocation);
191extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
192 __u32 pid, __u32 group, gfp_t allocation,
193 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
194 void *filter_data);
191extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 195extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
192extern int netlink_register_notifier(struct notifier_block *nb); 196extern int netlink_register_notifier(struct notifier_block *nb);
193extern int netlink_unregister_notifier(struct notifier_block *nb); 197extern int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index a765ea898549..e9e231215865 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -14,6 +14,7 @@
14 14
15struct netpoll { 15struct netpoll {
16 struct net_device *dev; 16 struct net_device *dev;
17 struct net_device *real_dev;
17 char dev_name[IFNAMSIZ]; 18 char dev_name[IFNAMSIZ];
18 const char *name; 19 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 20 void (*rx_hook)(struct netpoll *, int, char *, int);
@@ -36,8 +37,11 @@ struct netpoll_info {
36 struct sk_buff_head txq; 37 struct sk_buff_head txq;
37 38
38 struct delayed_work tx_work; 39 struct delayed_work tx_work;
40
41 struct netpoll *netpoll;
39}; 42};
40 43
44void netpoll_poll_dev(struct net_device *dev);
41void netpoll_poll(struct netpoll *np); 45void netpoll_poll(struct netpoll *np);
42void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 46void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
43void netpoll_print_options(struct netpoll *np); 47void netpoll_print_options(struct netpoll *np);
@@ -47,22 +51,23 @@ int netpoll_trap(void);
47void netpoll_set_trap(int trap); 51void netpoll_set_trap(int trap);
48void netpoll_cleanup(struct netpoll *np); 52void netpoll_cleanup(struct netpoll *np);
49int __netpoll_rx(struct sk_buff *skb); 53int __netpoll_rx(struct sk_buff *skb);
54void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
50 55
51 56
52#ifdef CONFIG_NETPOLL 57#ifdef CONFIG_NETPOLL
53static inline int netpoll_rx(struct sk_buff *skb) 58static inline bool netpoll_rx(struct sk_buff *skb)
54{ 59{
55 struct netpoll_info *npinfo = skb->dev->npinfo; 60 struct netpoll_info *npinfo = skb->dev->npinfo;
56 unsigned long flags; 61 unsigned long flags;
57 int ret = 0; 62 bool ret = false;
58 63
59 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) 64 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
60 return 0; 65 return false;
61 66
62 spin_lock_irqsave(&npinfo->rx_lock, flags); 67 spin_lock_irqsave(&npinfo->rx_lock, flags);
63 /* check rx_flags again with the lock held */ 68 /* check rx_flags again with the lock held */
64 if (npinfo->rx_flags && __netpoll_rx(skb)) 69 if (npinfo->rx_flags && __netpoll_rx(skb))
65 ret = 1; 70 ret = true;
66 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 71 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
67 72
68 return ret; 73 return ret;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1a0b85aa151e..77c2ae53431c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -209,6 +209,7 @@ struct nfs_inode {
209#define NFS_INO_FLUSHING (4) /* inode is flushing out data */ 209#define NFS_INO_FLUSHING (4) /* inode is flushing out data */
210#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 210#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
211#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 211#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
212#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
212 213
213static inline struct nfs_inode *NFS_I(const struct inode *inode) 214static inline struct nfs_inode *NFS_I(const struct inode *inode)
214{ 215{
@@ -355,6 +356,20 @@ extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struc
355extern u64 nfs_compat_user_ino64(u64 fileid); 356extern u64 nfs_compat_user_ino64(u64 fileid);
356extern void nfs_fattr_init(struct nfs_fattr *fattr); 357extern void nfs_fattr_init(struct nfs_fattr *fattr);
357 358
359extern struct nfs_fattr *nfs_alloc_fattr(void);
360
361static inline void nfs_free_fattr(const struct nfs_fattr *fattr)
362{
363 kfree(fattr);
364}
365
366extern struct nfs_fh *nfs_alloc_fhandle(void);
367
368static inline void nfs_free_fhandle(const struct nfs_fh *fh)
369{
370 kfree(fh);
371}
372
358/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 373/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
359extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 374extern __be32 root_nfs_parse_addr(char *name); /*__init*/
360extern unsigned long nfs_inc_attr_generation_counter(void); 375extern unsigned long nfs_inc_attr_generation_counter(void);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index e82957acea56..d6e10a4c06e5 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -44,7 +44,6 @@ struct nfs_client {
44 44
45#ifdef CONFIG_NFS_V4 45#ifdef CONFIG_NFS_V4
46 u64 cl_clientid; /* constant */ 46 u64 cl_clientid; /* constant */
47 nfs4_verifier cl_confirm;
48 unsigned long cl_state; 47 unsigned long cl_state;
49 48
50 struct rb_root cl_openowner_id; 49 struct rb_root cl_openowner_id;
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 89b28812ec24..51914d7d6cc4 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -386,8 +386,8 @@ struct nfs_removeargs {
386 386
387struct nfs_removeres { 387struct nfs_removeres {
388 const struct nfs_server *server; 388 const struct nfs_server *server;
389 struct nfs_fattr *dir_attr;
389 struct nfs4_change_info cinfo; 390 struct nfs4_change_info cinfo;
390 struct nfs_fattr dir_attr;
391 struct nfs4_sequence_res seq_res; 391 struct nfs4_sequence_res seq_res;
392}; 392};
393 393
@@ -824,6 +824,11 @@ struct nfs4_setclientid {
824 u32 sc_cb_ident; 824 u32 sc_cb_ident;
825}; 825};
826 826
827struct nfs4_setclientid_res {
828 u64 clientid;
829 nfs4_verifier confirm;
830};
831
827struct nfs4_statfs_arg { 832struct nfs4_statfs_arg {
828 const struct nfs_fh * fh; 833 const struct nfs_fh * fh;
829 const u32 * bitmask; 834 const u32 * bitmask;
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 65e333afaee4..80d55bbc5365 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -40,12 +40,12 @@ struct nfs_fhbase_old {
40 * This is the new flexible, extensible style NFSv2/v3 file handle. 40 * This is the new flexible, extensible style NFSv2/v3 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 * 42 *
43 * The file handle is seens as a list of 4byte words. 43 * The file handle starts with a sequence of four-byte words.
44 * The first word contains a version number (1) and four descriptor bytes 44 * The first word contains a version number (1) and three descriptor bytes
45 * that tell how the remaining 3 variable length fields should be handled. 45 * that tell how the remaining 3 variable length fields should be handled.
46 * These three bytes are auth_type, fsid_type and fileid_type. 46 * These three bytes are auth_type, fsid_type and fileid_type.
47 * 47 *
48 * All 4byte values are in host-byte-order. 48 * All four-byte values are in host-byte-order.
49 * 49 *
50 * The auth_type field specifies how the filehandle can be authenticated 50 * The auth_type field specifies how the filehandle can be authenticated
51 * This might allow a file to be confirmed to be in a writable part of a 51 * This might allow a file to be confirmed to be in a writable part of a
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 640702e97457..8c2c6116e788 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -199,16 +199,15 @@ struct nilfs_super_block {
199 __le32 s_creator_os; /* OS */ 199 __le32 s_creator_os; /* OS */
200 __le16 s_def_resuid; /* Default uid for reserved blocks */ 200 __le16 s_def_resuid; /* Default uid for reserved blocks */
201 __le16 s_def_resgid; /* Default gid for reserved blocks */ 201 __le16 s_def_resgid; /* Default gid for reserved blocks */
202 __le32 s_first_ino; /* First non-reserved inode */ 202 __le32 s_first_ino; /* First non-reserved inode */
203 203
204 __le16 s_inode_size; /* Size of an inode */ 204 __le16 s_inode_size; /* Size of an inode */
205 __le16 s_dat_entry_size; /* Size of a dat entry */ 205 __le16 s_dat_entry_size; /* Size of a dat entry */
206 __le16 s_checkpoint_size; /* Size of a checkpoint */ 206 __le16 s_checkpoint_size; /* Size of a checkpoint */
207 __le16 s_segment_usage_size; /* Size of a segment usage */ 207 __le16 s_segment_usage_size; /* Size of a segment usage */
208 208
209 __u8 s_uuid[16]; /* 128-bit uuid for volume */ 209 __u8 s_uuid[16]; /* 128-bit uuid for volume */
210 char s_volume_name[16]; /* volume name */ 210 char s_volume_name[80]; /* volume name */
211 char s_last_mounted[64]; /* directory where last mounted */
212 211
213 __le32 s_c_interval; /* Commit interval of segment */ 212 __le32 s_c_interval; /* Commit interval of segment */
214 __le32 s_c_block_max; /* Threshold of data amount for 213 __le32 s_c_block_max; /* Threshold of data amount for
@@ -377,6 +376,7 @@ union nilfs_binfo {
377 * @ss_nfinfo: number of finfo structures 376 * @ss_nfinfo: number of finfo structures
378 * @ss_sumbytes: total size of segment summary in bytes 377 * @ss_sumbytes: total size of segment summary in bytes
379 * @ss_pad: padding 378 * @ss_pad: padding
379 * @ss_cno: checkpoint number
380 */ 380 */
381struct nilfs_segment_summary { 381struct nilfs_segment_summary {
382 __le32 ss_datasum; 382 __le32 ss_datasum;
@@ -391,6 +391,7 @@ struct nilfs_segment_summary {
391 __le32 ss_nfinfo; 391 __le32 ss_nfinfo;
392 __le32 ss_sumbytes; 392 __le32 ss_sumbytes;
393 __le32 ss_pad; 393 __le32 ss_pad;
394 __le64 ss_cno;
394 /* array of finfo structures */ 395 /* array of finfo structures */
395}; 396};
396 397
@@ -437,10 +438,10 @@ struct nilfs_palloc_group_desc {
437 438
438/** 439/**
439 * struct nilfs_dat_entry - disk address translation entry 440 * struct nilfs_dat_entry - disk address translation entry
440 * @dt_blocknr: block number 441 * @de_blocknr: block number
441 * @dt_start: start checkpoint number 442 * @de_start: start checkpoint number
442 * @dt_end: end checkpoint number 443 * @de_end: end checkpoint number
443 * @dt_rsv: reserved for future use 444 * @de_rsv: reserved for future use
444 */ 445 */
445struct nilfs_dat_entry { 446struct nilfs_dat_entry {
446 __le64 de_blocknr; 447 __le64 de_blocknr;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 28ba20fda3e2..b7c77f9712f4 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -52,6 +52,8 @@
52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, 53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. 54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
55 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
56 * instead, the support here is for backward compatibility only.
55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 57 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 58 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
57 * %NL80211_ATTR_WIPHY_NAME. 59 * %NL80211_ATTR_WIPHY_NAME.
@@ -323,6 +325,21 @@
323 * the TX command and %NL80211_ATTR_FRAME includes the contents of the 325 * the TX command and %NL80211_ATTR_FRAME includes the contents of the
324 * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged 326 * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
325 * the frame. 327 * the frame.
328 * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
329 * is used to configure connection quality monitoring notification trigger
330 * levels.
331 * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
332 * command is used as an event to indicate the that a trigger level was
333 * reached.
334 * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
335 * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed
336 * by %NL80211_ATTR_IFINDEX) shall operate on.
337 * In case multiple channels are supported by the device, the mechanism
338 * with which it switches channels is implementation-defined.
339 * When a monitor interface is given, it can only switch channel while
340 * no other interfaces are operating to avoid disturbing the operation
341 * of any other interfaces, and other interfaces will again take
342 * precedence when they are used.
326 * 343 *
327 * @NL80211_CMD_MAX: highest used command number 344 * @NL80211_CMD_MAX: highest used command number
328 * @__NL80211_CMD_AFTER_LAST: internal use 345 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -419,6 +436,11 @@ enum nl80211_commands {
419 NL80211_CMD_SET_POWER_SAVE, 436 NL80211_CMD_SET_POWER_SAVE,
420 NL80211_CMD_GET_POWER_SAVE, 437 NL80211_CMD_GET_POWER_SAVE,
421 438
439 NL80211_CMD_SET_CQM,
440 NL80211_CMD_NOTIFY_CQM,
441
442 NL80211_CMD_SET_CHANNEL,
443
422 /* add new commands above here */ 444 /* add new commands above here */
423 445
424 /* used to define NL80211_CMD_MAX below */ 446 /* used to define NL80211_CMD_MAX below */
@@ -691,6 +713,18 @@ enum nl80211_commands {
691 * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was 713 * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was
692 * acknowledged by the recipient. 714 * acknowledged by the recipient.
693 * 715 *
716 * @NL80211_ATTR_CQM: connection quality monitor configuration in a
717 * nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
718 *
719 * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
720 * is requesting a local authentication/association state change without
721 * invoking actual management frame exchange. This can be used with
722 * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
723 * NL80211_CMD_DISASSOCIATE.
724 *
725 * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
726 * connected to this BSS.
727 *
694 * @NL80211_ATTR_MAX: highest attribute number currently defined 728 * @NL80211_ATTR_MAX: highest attribute number currently defined
695 * @__NL80211_ATTR_AFTER_LAST: internal use 729 * @__NL80211_ATTR_AFTER_LAST: internal use
696 */ 730 */
@@ -842,6 +876,12 @@ enum nl80211_attrs {
842 876
843 NL80211_ATTR_PS_STATE, 877 NL80211_ATTR_PS_STATE,
844 878
879 NL80211_ATTR_CQM,
880
881 NL80211_ATTR_LOCAL_STATE_CHANGE,
882
883 NL80211_ATTR_AP_ISOLATE,
884
845 /* add attributes here, update the policy in nl80211.c */ 885 /* add attributes here, update the policy in nl80211.c */
846 886
847 __NL80211_ATTR_AFTER_LAST, 887 __NL80211_ATTR_AFTER_LAST,
@@ -1583,4 +1623,40 @@ enum nl80211_ps_state {
1583 NL80211_PS_ENABLED, 1623 NL80211_PS_ENABLED,
1584}; 1624};
1585 1625
1626/**
1627 * enum nl80211_attr_cqm - connection quality monitor attributes
1628 * @__NL80211_ATTR_CQM_INVALID: invalid
1629 * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
1630 * the threshold for the RSSI level at which an event will be sent. Zero
1631 * to disable.
1632 * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
1633 * the minimum amount the RSSI level must change after an event before a
1634 * new event may be issued (to reduce effects of RSSI oscillation).
1635 * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
1636 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
1637 * @NL80211_ATTR_CQM_MAX: highest key attribute
1638 */
1639enum nl80211_attr_cqm {
1640 __NL80211_ATTR_CQM_INVALID,
1641 NL80211_ATTR_CQM_RSSI_THOLD,
1642 NL80211_ATTR_CQM_RSSI_HYST,
1643 NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
1644
1645 /* keep last */
1646 __NL80211_ATTR_CQM_AFTER_LAST,
1647 NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
1648};
1649
1650/**
1651 * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event
1652 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW - The RSSI level is lower than the
1653 * configured threshold
1654 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH - The RSSI is higher than the
1655 * configured threshold
1656 */
1657enum nl80211_cqm_rssi_threshold_event {
1658 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
1659 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
1660};
1661
1586#endif /* __LINUX_NL80211_H */ 1662#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index fee6c2f68075..7c3609622334 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -182,7 +182,10 @@ static inline int notifier_to_errno(int ret)
182 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc... 182 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc...
183 */ 183 */
184 184
185/* netdevice notifier chain */ 185/* netdevice notifier chain. Please remember to update the rtnetlink
186 * notification exclusion list in rtnetlink_event() when adding new
187 * types.
188 */
186#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */ 189#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */
187#define NETDEV_DOWN 0x0002 190#define NETDEV_DOWN 0x0002
188#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface 191#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface
@@ -199,10 +202,11 @@ static inline int notifier_to_errno(int ret)
199#define NETDEV_FEAT_CHANGE 0x000B 202#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 203#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D 204#define NETDEV_PRE_UP 0x000D
202#define NETDEV_BONDING_OLDTYPE 0x000E 205#define NETDEV_PRE_TYPE_CHANGE 0x000E
203#define NETDEV_BONDING_NEWTYPE 0x000F 206#define NETDEV_POST_TYPE_CHANGE 0x000F
204#define NETDEV_POST_INIT 0x0010 207#define NETDEV_POST_INIT 0x0010
205#define NETDEV_UNREGISTER_BATCH 0x0011 208#define NETDEV_UNREGISTER_BATCH 0x0011
209#define NETDEV_BONDING_DESLAVE 0x0012
206 210
207#define SYS_DOWN 0x0001 /* Notify of system down */ 211#define SYS_DOWN 0x0001 /* Notify of system down */
208#define SYS_RESTART SYS_DOWN 212#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 51611da9c498..8d8406246eef 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -24,7 +24,19 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/timer.h>
27 28
29/**
30 * struct padata_priv - Embedded to the users data structure.
31 *
32 * @list: List entry, to attach to the padata lists.
33 * @pd: Pointer to the internal control structure.
34 * @cb_cpu: Callback cpu for serializatioon.
35 * @seq_nr: Sequence number of the parallelized data object.
36 * @info: Used to pass information from the parallel to the serial function.
37 * @parallel: Parallel execution function.
38 * @serial: Serial complete function.
39 */
28struct padata_priv { 40struct padata_priv {
29 struct list_head list; 41 struct list_head list;
30 struct parallel_data *pd; 42 struct parallel_data *pd;
@@ -35,11 +47,29 @@ struct padata_priv {
35 void (*serial)(struct padata_priv *padata); 47 void (*serial)(struct padata_priv *padata);
36}; 48};
37 49
50/**
51 * struct padata_list
52 *
53 * @list: List head.
54 * @lock: List lock.
55 */
38struct padata_list { 56struct padata_list {
39 struct list_head list; 57 struct list_head list;
40 spinlock_t lock; 58 spinlock_t lock;
41}; 59};
42 60
61/**
62 * struct padata_queue - The percpu padata queues.
63 *
64 * @parallel: List to wait for parallelization.
65 * @reorder: List to wait for reordering after parallel processing.
66 * @serial: List to wait for serialization after reordering.
67 * @pwork: work struct for parallelization.
68 * @swork: work struct for serialization.
69 * @pd: Backpointer to the internal control structure.
70 * @num_obj: Number of objects that are processed by this cpu.
71 * @cpu_index: Index of the cpu.
72 */
43struct padata_queue { 73struct padata_queue {
44 struct padata_list parallel; 74 struct padata_list parallel;
45 struct padata_list reorder; 75 struct padata_list reorder;
@@ -51,6 +81,20 @@ struct padata_queue {
51 int cpu_index; 81 int cpu_index;
52}; 82};
53 83
84/**
85 * struct parallel_data - Internal control structure, covers everything
86 * that depends on the cpumask in use.
87 *
88 * @pinst: padata instance.
89 * @queue: percpu padata queues.
90 * @seq_nr: The sequence number that will be attached to the next object.
91 * @reorder_objects: Number of objects waiting in the reorder queues.
92 * @refcnt: Number of objects holding a reference on this parallel_data.
93 * @max_seq_nr: Maximal used sequence number.
94 * @cpumask: cpumask in use.
95 * @lock: Reorder lock.
96 * @timer: Reorder timer.
97 */
54struct parallel_data { 98struct parallel_data {
55 struct padata_instance *pinst; 99 struct padata_instance *pinst;
56 struct padata_queue *queue; 100 struct padata_queue *queue;
@@ -60,8 +104,19 @@ struct parallel_data {
60 unsigned int max_seq_nr; 104 unsigned int max_seq_nr;
61 cpumask_var_t cpumask; 105 cpumask_var_t cpumask;
62 spinlock_t lock; 106 spinlock_t lock;
107 struct timer_list timer;
63}; 108};
64 109
110/**
111 * struct padata_instance - The overall control structure.
112 *
113 * @cpu_notifier: cpu hotplug notifier.
114 * @wq: The workqueue in use.
115 * @pd: The internal control structure.
116 * @cpumask: User supplied cpumask.
117 * @lock: padata instance lock.
118 * @flags: padata flags.
119 */
65struct padata_instance { 120struct padata_instance {
66 struct notifier_block cpu_notifier; 121 struct notifier_block cpu_notifier;
67 struct workqueue_struct *wq; 122 struct workqueue_struct *wq;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a788fa12ff31..a327322a33ab 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -334,6 +334,16 @@ struct pci_dev {
334#endif 334#endif
335}; 335};
336 336
337static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
338{
339#ifdef CONFIG_PCI_IOV
340 if (dev->is_virtfn)
341 dev = dev->physfn;
342#endif
343
344 return dev;
345}
346
337extern struct pci_dev *alloc_pci_dev(void); 347extern struct pci_dev *alloc_pci_dev(void);
338 348
339#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) 349#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9f688d243b86..ae66851870be 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2419,8 +2419,8 @@
2419#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2419#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2420#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 2420#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2421#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 2421#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22
2422#define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42 2422#define PCI_DEVICE_ID_INTEL_CPT_LPC_MIN 0x1c41
2423#define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43 2423#define PCI_DEVICE_ID_INTEL_CPT_LPC_MAX 0x1c5f
2424#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2424#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2425#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2425#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2426#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2426#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c8f302991b66..455b9ccdfca7 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -442,7 +442,10 @@
442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ 442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
443#define PCI_EXP_LNKSTA 18 /* Link Status */ 443#define PCI_EXP_LNKSTA 18 /* Link Status */
444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ 444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
445#define PCI_EXP_LNKSTA_CLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */
446#define PCI_EXP_LNKSTA_CLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */
445#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ 447#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
448#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */
446#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ 449#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
447#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 450#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
448#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ 451#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
@@ -563,8 +566,7 @@
563#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ 566#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
564#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ 567#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
565#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ 568#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
566#define PCI_ERR_ROOT_COR_SRC 52 569#define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */
567#define PCI_ERR_ROOT_SRC 54
568 570
569/* Virtual Channel */ 571/* Virtual Channel */
570#define PCI_VC_PORT_REG1 4 572#define PCI_VC_PORT_REG1 4
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c8e375440403..3fd5c82e0e18 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -203,8 +203,19 @@ struct perf_event_attr {
203 enable_on_exec : 1, /* next exec enables */ 203 enable_on_exec : 1, /* next exec enables */
204 task : 1, /* trace fork/exit */ 204 task : 1, /* trace fork/exit */
205 watermark : 1, /* wakeup_watermark */ 205 watermark : 1, /* wakeup_watermark */
206 206 /*
207 __reserved_1 : 49; 207 * precise_ip:
208 *
209 * 0 - SAMPLE_IP can have arbitrary skid
210 * 1 - SAMPLE_IP must have constant skid
211 * 2 - SAMPLE_IP requested to have 0 skid
212 * 3 - SAMPLE_IP must have 0 skid
213 *
214 * See also PERF_RECORD_MISC_EXACT_IP
215 */
216 precise_ip : 2, /* skid constraint */
217
218 __reserved_1 : 47;
208 219
209 union { 220 union {
210 __u32 wakeup_events; /* wakeup every n events */ 221 __u32 wakeup_events; /* wakeup every n events */
@@ -287,11 +298,24 @@ struct perf_event_mmap_page {
287 __u64 data_tail; /* user-space written tail */ 298 __u64 data_tail; /* user-space written tail */
288}; 299};
289 300
290#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) 301#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
291#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) 302#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
292#define PERF_RECORD_MISC_KERNEL (1 << 0) 303#define PERF_RECORD_MISC_KERNEL (1 << 0)
293#define PERF_RECORD_MISC_USER (2 << 0) 304#define PERF_RECORD_MISC_USER (2 << 0)
294#define PERF_RECORD_MISC_HYPERVISOR (3 << 0) 305#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
306#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
307#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
308
309/*
310 * Indicates that the content of PERF_SAMPLE_IP points to
311 * the actual instruction that triggered the event. See also
312 * perf_event_attr::precise_ip.
313 */
314#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
315/*
316 * Reserve the last bit to indicate some extended misc field
317 */
318#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
295 319
296struct perf_event_header { 320struct perf_event_header {
297 __u32 type; 321 __u32 type;
@@ -439,6 +463,12 @@ enum perf_callchain_context {
439# include <asm/perf_event.h> 463# include <asm/perf_event.h>
440#endif 464#endif
441 465
466struct perf_guest_info_callbacks {
467 int (*is_in_guest) (void);
468 int (*is_user_mode) (void);
469 unsigned long (*get_guest_ip) (void);
470};
471
442#ifdef CONFIG_HAVE_HW_BREAKPOINT 472#ifdef CONFIG_HAVE_HW_BREAKPOINT
443#include <asm/hw_breakpoint.h> 473#include <asm/hw_breakpoint.h>
444#endif 474#endif
@@ -468,6 +498,17 @@ struct perf_raw_record {
468 void *data; 498 void *data;
469}; 499};
470 500
501struct perf_branch_entry {
502 __u64 from;
503 __u64 to;
504 __u64 flags;
505};
506
507struct perf_branch_stack {
508 __u64 nr;
509 struct perf_branch_entry entries[0];
510};
511
471struct task_struct; 512struct task_struct;
472 513
473/** 514/**
@@ -506,6 +547,8 @@ struct hw_perf_event {
506 547
507struct perf_event; 548struct perf_event;
508 549
550#define PERF_EVENT_TXN_STARTED 1
551
509/** 552/**
510 * struct pmu - generic performance monitoring unit 553 * struct pmu - generic performance monitoring unit
511 */ 554 */
@@ -516,6 +559,16 @@ struct pmu {
516 void (*stop) (struct perf_event *event); 559 void (*stop) (struct perf_event *event);
517 void (*read) (struct perf_event *event); 560 void (*read) (struct perf_event *event);
518 void (*unthrottle) (struct perf_event *event); 561 void (*unthrottle) (struct perf_event *event);
562
563 /*
564 * group events scheduling is treated as a transaction,
565 * add group events as a whole and perform one schedulability test.
566 * If test fails, roll back the whole group
567 */
568
569 void (*start_txn) (const struct pmu *pmu);
570 void (*cancel_txn) (const struct pmu *pmu);
571 int (*commit_txn) (const struct pmu *pmu);
519}; 572};
520 573
521/** 574/**
@@ -571,6 +624,14 @@ enum perf_group_flag {
571 PERF_GROUP_SOFTWARE = 0x1, 624 PERF_GROUP_SOFTWARE = 0x1,
572}; 625};
573 626
627#define SWEVENT_HLIST_BITS 8
628#define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS)
629
630struct swevent_hlist {
631 struct hlist_head heads[SWEVENT_HLIST_SIZE];
632 struct rcu_head rcu_head;
633};
634
574/** 635/**
575 * struct perf_event - performance event kernel representation: 636 * struct perf_event - performance event kernel representation:
576 */ 637 */
@@ -579,6 +640,7 @@ struct perf_event {
579 struct list_head group_entry; 640 struct list_head group_entry;
580 struct list_head event_entry; 641 struct list_head event_entry;
581 struct list_head sibling_list; 642 struct list_head sibling_list;
643 struct hlist_node hlist_entry;
582 int nr_siblings; 644 int nr_siblings;
583 int group_flags; 645 int group_flags;
584 struct perf_event *group_leader; 646 struct perf_event *group_leader;
@@ -726,6 +788,9 @@ struct perf_cpu_context {
726 int active_oncpu; 788 int active_oncpu;
727 int max_pertask; 789 int max_pertask;
728 int exclusive; 790 int exclusive;
791 struct swevent_hlist *swevent_hlist;
792 struct mutex hlist_mutex;
793 int hlist_refcount;
729 794
730 /* 795 /*
731 * Recursion avoidance: 796 * Recursion avoidance:
@@ -769,9 +834,6 @@ extern void perf_disable(void);
769extern void perf_enable(void); 834extern void perf_enable(void);
770extern int perf_event_task_disable(void); 835extern int perf_event_task_disable(void);
771extern int perf_event_task_enable(void); 836extern int perf_event_task_enable(void);
772extern int hw_perf_group_sched_in(struct perf_event *group_leader,
773 struct perf_cpu_context *cpuctx,
774 struct perf_event_context *ctx);
775extern void perf_event_update_userpage(struct perf_event *event); 837extern void perf_event_update_userpage(struct perf_event *event);
776extern int perf_event_release_kernel(struct perf_event *event); 838extern int perf_event_release_kernel(struct perf_event *event);
777extern struct perf_event * 839extern struct perf_event *
@@ -902,6 +964,10 @@ static inline void perf_event_mmap(struct vm_area_struct *vma)
902 __perf_event_mmap(vma); 964 __perf_event_mmap(vma);
903} 965}
904 966
967extern struct perf_guest_info_callbacks *perf_guest_cbs;
968extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
969extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
970
905extern void perf_event_comm(struct task_struct *tsk); 971extern void perf_event_comm(struct task_struct *tsk);
906extern void perf_event_fork(struct task_struct *tsk); 972extern void perf_event_fork(struct task_struct *tsk);
907 973
@@ -971,6 +1037,11 @@ perf_sw_event(u32 event_id, u64 nr, int nmi,
971static inline void 1037static inline void
972perf_bp_event(struct perf_event *event, void *data) { } 1038perf_bp_event(struct perf_event *event, void *data) { }
973 1039
1040static inline int perf_register_guest_info_callbacks
1041(struct perf_guest_info_callbacks *callbacks) { return 0; }
1042static inline int perf_unregister_guest_info_callbacks
1043(struct perf_guest_info_callbacks *callbacks) { return 0; }
1044
974static inline void perf_event_mmap(struct vm_area_struct *vma) { } 1045static inline void perf_event_mmap(struct vm_area_struct *vma) { }
975static inline void perf_event_comm(struct task_struct *tsk) { } 1046static inline void perf_event_comm(struct task_struct *tsk) { }
976static inline void perf_event_fork(struct task_struct *tsk) { } 1047static inline void perf_event_fork(struct task_struct *tsk) { }
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 14d7fdf6a90a..987e111f7b11 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -24,6 +24,7 @@
24#include <linux/mii.h> 24#include <linux/mii.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/mod_devicetable.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29 30
@@ -81,6 +82,10 @@ typedef enum {
81 */ 82 */
82#define MII_BUS_ID_SIZE (20 - 3) 83#define MII_BUS_ID_SIZE (20 - 3)
83 84
85/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
86 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
87#define MII_ADDR_C45 (1<<30)
88
84/* 89/*
85 * The Bus class for PHYs. Devices which provide access to 90 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure 91 * PHYs should register using this structure
@@ -127,8 +132,8 @@ int mdiobus_register(struct mii_bus *bus);
127void mdiobus_unregister(struct mii_bus *bus); 132void mdiobus_unregister(struct mii_bus *bus);
128void mdiobus_free(struct mii_bus *bus); 133void mdiobus_free(struct mii_bus *bus);
129struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 134struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
130int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); 135int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
131int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); 136int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
132 137
133 138
134#define PHY_INTERRUPT_DISABLED 0x0 139#define PHY_INTERRUPT_DISABLED 0x0
@@ -422,7 +427,7 @@ struct phy_fixup {
422 * because the bus read/write functions may wait for an interrupt 427 * because the bus read/write functions may wait for an interrupt
423 * to conclude the operation. 428 * to conclude the operation.
424 */ 429 */
425static inline int phy_read(struct phy_device *phydev, u16 regnum) 430static inline int phy_read(struct phy_device *phydev, u32 regnum)
426{ 431{
427 return mdiobus_read(phydev->bus, phydev->addr, regnum); 432 return mdiobus_read(phydev->bus, phydev->addr, regnum);
428} 433}
@@ -437,7 +442,7 @@ static inline int phy_read(struct phy_device *phydev, u16 regnum)
437 * because the bus read/write functions may wait for an interrupt 442 * because the bus read/write functions may wait for an interrupt
438 * to conclude the operation. 443 * to conclude the operation.
439 */ 444 */
440static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) 445static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
441{ 446{
442 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 447 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
443} 448}
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index b43a9e039059..16de3933c45e 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -3,7 +3,7 @@
3 3
4#define PIPEFS_MAGIC 0x50495045 4#define PIPEFS_MAGIC 0x50495045
5 5
6#define PIPE_BUFFERS (16) 6#define PIPE_DEF_BUFFERS 16
7 7
8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ 8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ 9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
@@ -44,17 +44,17 @@ struct pipe_buffer {
44 **/ 44 **/
45struct pipe_inode_info { 45struct pipe_inode_info {
46 wait_queue_head_t wait; 46 wait_queue_head_t wait;
47 unsigned int nrbufs, curbuf; 47 unsigned int nrbufs, curbuf, buffers;
48 struct page *tmp_page;
49 unsigned int readers; 48 unsigned int readers;
50 unsigned int writers; 49 unsigned int writers;
51 unsigned int waiting_writers; 50 unsigned int waiting_writers;
52 unsigned int r_counter; 51 unsigned int r_counter;
53 unsigned int w_counter; 52 unsigned int w_counter;
53 struct page *tmp_page;
54 struct fasync_struct *fasync_readers; 54 struct fasync_struct *fasync_readers;
55 struct fasync_struct *fasync_writers; 55 struct fasync_struct *fasync_writers;
56 struct inode *inode; 56 struct inode *inode;
57 struct pipe_buffer bufs[PIPE_BUFFERS]; 57 struct pipe_buffer *bufs;
58}; 58};
59 59
60/* 60/*
@@ -139,6 +139,8 @@ void pipe_lock(struct pipe_inode_info *);
139void pipe_unlock(struct pipe_inode_info *); 139void pipe_unlock(struct pipe_inode_info *);
140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *); 140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
141 141
142extern unsigned int pipe_max_pages;
143
142/* Drop the inode semaphore and wait for a pipe event, atomically */ 144/* Drop the inode semaphore and wait for a pipe event, atomically */
143void pipe_wait(struct pipe_inode_info *pipe); 145void pipe_wait(struct pipe_inode_info *pipe);
144 146
@@ -154,4 +156,7 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
154int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 156int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
155void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); 157void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
156 158
159/* for F_SETPIPE_SZ and F_GETPIPE_SZ */
160long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
161
157#endif 162#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 212da17d06af..5417944d3687 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -44,12 +44,14 @@ extern int platform_get_irq_byname(struct platform_device *, const char *);
44extern int platform_add_devices(struct platform_device **, int); 44extern int platform_add_devices(struct platform_device **, int);
45 45
46extern struct platform_device *platform_device_register_simple(const char *, int id, 46extern struct platform_device *platform_device_register_simple(const char *, int id,
47 struct resource *, unsigned int); 47 const struct resource *, unsigned int);
48extern struct platform_device *platform_device_register_data(struct device *, 48extern struct platform_device *platform_device_register_data(struct device *,
49 const char *, int, const void *, size_t); 49 const char *, int, const void *, size_t);
50 50
51extern struct platform_device *platform_device_alloc(const char *name, int id); 51extern struct platform_device *platform_device_alloc(const char *name, int id);
52extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 52extern int platform_device_add_resources(struct platform_device *pdev,
53 const struct resource *res,
54 unsigned int num);
53extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 55extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size);
54extern int platform_device_add(struct platform_device *pdev); 56extern int platform_device_add(struct platform_device *pdev);
55extern void platform_device_del(struct platform_device *pdev); 57extern void platform_device_del(struct platform_device *pdev);
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index d74f75ed1e47..8ba440e5eb7f 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -14,12 +14,14 @@
14#define PM_QOS_NUM_CLASSES 4 14#define PM_QOS_NUM_CLASSES 4
15#define PM_QOS_DEFAULT_VALUE -1 15#define PM_QOS_DEFAULT_VALUE -1
16 16
17int pm_qos_add_requirement(int qos, char *name, s32 value); 17struct pm_qos_request_list;
18int pm_qos_update_requirement(int qos, char *name, s32 new_value);
19void pm_qos_remove_requirement(int qos, char *name);
20 18
21int pm_qos_requirement(int qos); 19struct pm_qos_request_list *pm_qos_add_request(int pm_qos_class, s32 value);
20void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
21 s32 new_value);
22void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
22 23
23int pm_qos_add_notifier(int qos, struct notifier_block *notifier); 24int pm_qos_request(int pm_qos_class);
24int pm_qos_remove_notifier(int qos, struct notifier_block *notifier); 25int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
26int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
25 27
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index b776db737244..6e81888c6222 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -30,6 +30,9 @@ extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume); 30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31extern void pm_runtime_allow(struct device *dev); 31extern void pm_runtime_allow(struct device *dev);
32extern void pm_runtime_forbid(struct device *dev); 32extern void pm_runtime_forbid(struct device *dev);
33extern int pm_generic_runtime_idle(struct device *dev);
34extern int pm_generic_runtime_suspend(struct device *dev);
35extern int pm_generic_runtime_resume(struct device *dev);
33 36
34static inline bool pm_children_suspended(struct device *dev) 37static inline bool pm_children_suspended(struct device *dev)
35{ 38{
@@ -96,6 +99,10 @@ static inline bool device_run_wake(struct device *dev) { return false; }
96static inline void device_set_run_wake(struct device *dev, bool enable) {} 99static inline void device_set_run_wake(struct device *dev, bool enable) {}
97static inline bool pm_runtime_suspended(struct device *dev) { return false; } 100static inline bool pm_runtime_suspended(struct device *dev) { return false; }
98 101
102static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
103static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
104static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
105
99#endif /* !CONFIG_PM_RUNTIME */ 106#endif /* !CONFIG_PM_RUNTIME */
100 107
101static inline int pm_runtime_get(struct device *dev) 108static inline int pm_runtime_get(struct device *dev)
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 0aae7776185e..22d64c18056c 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -25,32 +25,34 @@
25# error "please don't include this file directly" 25# error "please don't include this file directly"
26#endif 26#endif
27 27
28#include <linux/types.h>
29
28#ifdef CONFIG_PM 30#ifdef CONFIG_PM
29 31
30/* changes to device_may_wakeup take effect on the next pm state change. 32/* changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can. 33 * by default, devices should wakeup if they can.
32 */ 34 */
33static inline void device_init_wakeup(struct device *dev, int val) 35static inline void device_init_wakeup(struct device *dev, bool val)
34{ 36{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val; 37 dev->power.can_wakeup = dev->power.should_wakeup = val;
36} 38}
37 39
38static inline void device_set_wakeup_capable(struct device *dev, int val) 40static inline void device_set_wakeup_capable(struct device *dev, bool capable)
39{ 41{
40 dev->power.can_wakeup = !!val; 42 dev->power.can_wakeup = capable;
41} 43}
42 44
43static inline int device_can_wakeup(struct device *dev) 45static inline bool device_can_wakeup(struct device *dev)
44{ 46{
45 return dev->power.can_wakeup; 47 return dev->power.can_wakeup;
46} 48}
47 49
48static inline void device_set_wakeup_enable(struct device *dev, int val) 50static inline void device_set_wakeup_enable(struct device *dev, bool enable)
49{ 51{
50 dev->power.should_wakeup = !!val; 52 dev->power.should_wakeup = enable;
51} 53}
52 54
53static inline int device_may_wakeup(struct device *dev) 55static inline bool device_may_wakeup(struct device *dev)
54{ 56{
55 return dev->power.can_wakeup && dev->power.should_wakeup; 57 return dev->power.can_wakeup && dev->power.should_wakeup;
56} 58}
@@ -58,20 +60,28 @@ static inline int device_may_wakeup(struct device *dev)
58#else /* !CONFIG_PM */ 60#else /* !CONFIG_PM */
59 61
60/* For some reason the next two routines work even without CONFIG_PM */ 62/* For some reason the next two routines work even without CONFIG_PM */
61static inline void device_init_wakeup(struct device *dev, int val) 63static inline void device_init_wakeup(struct device *dev, bool val)
62{ 64{
63 dev->power.can_wakeup = !!val; 65 dev->power.can_wakeup = val;
64} 66}
65 67
66static inline void device_set_wakeup_capable(struct device *dev, int val) { } 68static inline void device_set_wakeup_capable(struct device *dev, bool capable)
69{
70}
67 71
68static inline int device_can_wakeup(struct device *dev) 72static inline bool device_can_wakeup(struct device *dev)
69{ 73{
70 return dev->power.can_wakeup; 74 return dev->power.can_wakeup;
71} 75}
72 76
73#define device_set_wakeup_enable(dev, val) do {} while (0) 77static inline void device_set_wakeup_enable(struct device *dev, bool enable)
74#define device_may_wakeup(dev) 0 78{
79}
80
81static inline bool device_may_wakeup(struct device *dev)
82{
83 return false;
84}
75 85
76#endif /* !CONFIG_PM */ 86#endif /* !CONFIG_PM */
77 87
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 2110a81c5e2a..34066ffd893d 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -48,6 +48,15 @@
48#define POISON_FREE 0x6b /* for use-after-free poisoning */ 48#define POISON_FREE 0x6b /* for use-after-free poisoning */
49#define POISON_END 0xa5 /* end-byte of poisoning */ 49#define POISON_END 0xa5 /* end-byte of poisoning */
50 50
51/********** mm/hugetlb.c **********/
52/*
53 * Private mappings of hugetlb pages use this poisoned value for
54 * page->mapping. The core VM should not be doing anything with this mapping
55 * but futex requires the existence of some page->mapping value even though it
56 * is unused if PAGE_MAPPING_ANON is set.
57 */
58#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
59
51/********** arch/$ARCH/mm/init.c **********/ 60/********** arch/$ARCH/mm/init.c **********/
52#define POISON_FREE_INITMEM 0xcc 61#define POISON_FREE_INITMEM 0xcc
53 62
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index 0d3fa63e90ea..bff98ec1bfed 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -72,6 +72,9 @@ extern int ppp_channel_index(struct ppp_channel *);
72/* Get the unit number associated with a channel, or -1 if none */ 72/* Get the unit number associated with a channel, or -1 if none */
73extern int ppp_unit_number(struct ppp_channel *); 73extern int ppp_unit_number(struct ppp_channel *);
74 74
75/* Get the device name associated with a channel, or NULL if none */
76extern char *ppp_dev_name(struct ppp_channel *);
77
75/* 78/*
76 * SMP locking notes: 79 * SMP locking notes:
77 * The channel code must ensure that when it calls ppp_unregister_channel, 80 * The channel code must ensure that when it calls ppp_unregister_channel,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index e1fb60729979..4272521e29e9 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -345,18 +345,6 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
345#define arch_ptrace_stop(code, info) do { } while (0) 345#define arch_ptrace_stop(code, info) do { } while (0)
346#endif 346#endif
347 347
348#ifndef arch_ptrace_untrace
349/*
350 * Do machine-specific work before untracing child.
351 *
352 * This is called for a normal detach as well as from ptrace_exit()
353 * when the tracing task dies.
354 *
355 * Called with write_lock(&tasklist_lock) held.
356 */
357#define arch_ptrace_untrace(task) do { } while (0)
358#endif
359
360extern int task_current_syscall(struct task_struct *target, long *callno, 348extern int task_current_syscall(struct task_struct *target, long *callno,
361 unsigned long args[6], unsigned int maxargs, 349 unsigned long args[6], unsigned int maxargs,
362 unsigned long *sp, unsigned long *pc); 350 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index b462916b2a0a..7126a15467f1 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,6 +174,8 @@ enum {
174#include <linux/rwsem.h> 174#include <linux/rwsem.h>
175#include <linux/spinlock.h> 175#include <linux/spinlock.h>
176#include <linux/wait.h> 176#include <linux/wait.h>
177#include <linux/percpu.h>
178#include <linux/smp.h>
177 179
178#include <linux/dqblk_xfs.h> 180#include <linux/dqblk_xfs.h>
179#include <linux/dqblk_v1.h> 181#include <linux/dqblk_v1.h>
@@ -238,19 +240,43 @@ static inline int info_dirty(struct mem_dqinfo *info)
238 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags); 240 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
239} 241}
240 242
243enum {
244 DQST_LOOKUPS,
245 DQST_DROPS,
246 DQST_READS,
247 DQST_WRITES,
248 DQST_CACHE_HITS,
249 DQST_ALLOC_DQUOTS,
250 DQST_FREE_DQUOTS,
251 DQST_SYNCS,
252 _DQST_DQSTAT_LAST
253};
254
241struct dqstats { 255struct dqstats {
242 int lookups; 256 int stat[_DQST_DQSTAT_LAST];
243 int drops;
244 int reads;
245 int writes;
246 int cache_hits;
247 int allocated_dquots;
248 int free_dquots;
249 int syncs;
250}; 257};
251 258
259extern struct dqstats *dqstats_pcpu;
252extern struct dqstats dqstats; 260extern struct dqstats dqstats;
253 261
262static inline void dqstats_inc(unsigned int type)
263{
264#ifdef CONFIG_SMP
265 per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++;
266#else
267 dqstats.stat[type]++;
268#endif
269}
270
271static inline void dqstats_dec(unsigned int type)
272{
273#ifdef CONFIG_SMP
274 per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--;
275#else
276 dqstats.stat[type]--;
277#endif
278}
279
254#define DQ_MOD_B 0 /* dquot modified since read */ 280#define DQ_MOD_B 0 /* dquot modified since read */
255#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */ 281#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */
256#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */ 282#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */
@@ -311,12 +337,10 @@ struct quotactl_ops {
311 int (*quota_sync)(struct super_block *, int, int); 337 int (*quota_sync)(struct super_block *, int, int);
312 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 338 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
313 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 339 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
314 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 340 int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
315 int (*set_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 341 int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
316 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 342 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
317 int (*set_xstate)(struct super_block *, unsigned int, int); 343 int (*set_xstate)(struct super_block *, unsigned int, int);
318 int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
319 int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
320}; 344};
321 345
322struct quota_format_type { 346struct quota_format_type {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index e6fa7acce290..370abb1e99cb 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -14,6 +14,14 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
14 return &sb->s_dquot; 14 return &sb->s_dquot;
15} 15}
16 16
17/* i_mutex must being held */
18static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
19{
20 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
21 (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) ||
22 (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid);
23}
24
17#if defined(CONFIG_QUOTA) 25#if defined(CONFIG_QUOTA)
18 26
19/* 27/*
@@ -63,9 +71,12 @@ int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
63int vfs_quota_sync(struct super_block *sb, int type, int wait); 71int vfs_quota_sync(struct super_block *sb, int type, int wait);
64int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 72int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
65int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 73int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
66int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 74int vfs_get_dqblk(struct super_block *sb, int type, qid_t id,
67int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 75 struct fs_disk_quota *di);
76int vfs_set_dqblk(struct super_block *sb, int type, qid_t id,
77 struct fs_disk_quota *di);
68 78
79int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
69int dquot_transfer(struct inode *inode, struct iattr *iattr); 80int dquot_transfer(struct inode *inode, struct iattr *iattr);
70int vfs_dq_quota_on_remount(struct super_block *sb); 81int vfs_dq_quota_on_remount(struct super_block *sb);
71 82
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 4e768dda87b0..e7320b5e82fb 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_RAMFS_H 1#ifndef _LINUX_RAMFS_H
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev); 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev);
5extern int ramfs_get_sb(struct file_system_type *fs_type, 6extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 8
@@ -20,4 +21,6 @@ extern const struct file_operations ramfs_file_operations;
20extern const struct vm_operations_struct generic_file_vm_ops; 21extern const struct vm_operations_struct generic_file_vm_ops;
21extern int __init init_rootfs(void); 22extern int __init init_rootfs(void);
22 23
24int ramfs_fill_super(struct super_block *sb, void *data, int silent);
25
23#endif 26#endif
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 5210a5c60877..fe1872e5b37e 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -110,6 +110,7 @@ struct rb_node
110struct rb_root 110struct rb_root
111{ 111{
112 struct rb_node *rb_node; 112 struct rb_node *rb_node;
113 void (*augment_cb)(struct rb_node *node);
113}; 114};
114 115
115 116
@@ -129,7 +130,9 @@ static inline void rb_set_color(struct rb_node *rb, int color)
129 rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; 130 rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
130} 131}
131 132
132#define RB_ROOT (struct rb_root) { NULL, } 133#define RB_ROOT (struct rb_root) { NULL, NULL, }
134#define RB_AUGMENT_ROOT(x) (struct rb_root) { NULL, x}
135
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 136#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 137
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) 138#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 2c9b46cff3d7..4ec3b38ce9c5 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -428,5 +428,47 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
428 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 428 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
429 pos = rcu_dereference_raw(pos->next)) 429 pos = rcu_dereference_raw(pos->next))
430 430
431/**
432 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
433 * @tpos: the type * to use as a loop cursor.
434 * @pos: the &struct hlist_node to use as a loop cursor.
435 * @head: the head for your list.
436 * @member: the name of the hlist_node within the struct.
437 *
438 * This list-traversal primitive may safely run concurrently with
439 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
440 * as long as the traversal is guarded by rcu_read_lock().
441 */
442#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \
443 for (pos = rcu_dereference_bh((head)->first); \
444 pos && ({ prefetch(pos->next); 1; }) && \
445 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
446 pos = rcu_dereference_bh(pos->next))
447
448/**
449 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
450 * @tpos: the type * to use as a loop cursor.
451 * @pos: the &struct hlist_node to use as a loop cursor.
452 * @member: the name of the hlist_node within the struct.
453 */
454#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \
455 for (pos = rcu_dereference((pos)->next); \
456 pos && ({ prefetch(pos->next); 1; }) && \
457 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
458 pos = rcu_dereference(pos->next))
459
460/**
461 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
462 * @tpos: the type * to use as a loop cursor.
463 * @pos: the &struct hlist_node to use as a loop cursor.
464 * @member: the name of the hlist_node within the struct.
465 */
466#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \
467 for (pos = rcu_dereference_bh((pos)->next); \
468 pos && ({ prefetch(pos->next); 1; }) && \
469 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
470 pos = rcu_dereference_bh(pos->next))
471
472
431#endif /* __KERNEL__ */ 473#endif /* __KERNEL__ */
432#endif 474#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 07db2feb8572..b653b4aaa8a6 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -56,8 +56,6 @@ struct rcu_head {
56}; 56};
57 57
58/* Exported common interfaces */ 58/* Exported common interfaces */
59extern void synchronize_rcu_bh(void);
60extern void synchronize_sched(void);
61extern void rcu_barrier(void); 59extern void rcu_barrier(void);
62extern void rcu_barrier_bh(void); 60extern void rcu_barrier_bh(void);
63extern void rcu_barrier_sched(void); 61extern void rcu_barrier_sched(void);
@@ -66,8 +64,6 @@ extern int sched_expedited_torture_stats(char *page);
66 64
67/* Internal to kernel */ 65/* Internal to kernel */
68extern void rcu_init(void); 66extern void rcu_init(void);
69extern int rcu_scheduler_active;
70extern void rcu_scheduler_starting(void);
71 67
72#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 68#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
73#include <linux/rcutree.h> 69#include <linux/rcutree.h>
@@ -83,6 +79,14 @@ extern void rcu_scheduler_starting(void);
83 (ptr)->next = NULL; (ptr)->func = NULL; \ 79 (ptr)->next = NULL; (ptr)->func = NULL; \
84} while (0) 80} while (0)
85 81
82static inline void init_rcu_head_on_stack(struct rcu_head *head)
83{
84}
85
86static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
87{
88}
89
86#ifdef CONFIG_DEBUG_LOCK_ALLOC 90#ifdef CONFIG_DEBUG_LOCK_ALLOC
87 91
88extern struct lockdep_map rcu_lock_map; 92extern struct lockdep_map rcu_lock_map;
@@ -106,12 +110,13 @@ extern int debug_lockdep_rcu_enabled(void);
106/** 110/**
107 * rcu_read_lock_held - might we be in RCU read-side critical section? 111 * rcu_read_lock_held - might we be in RCU read-side critical section?
108 * 112 *
109 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in 113 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
110 * an RCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, 114 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
111 * this assumes we are in an RCU read-side critical section unless it can 115 * this assumes we are in an RCU read-side critical section unless it can
112 * prove otherwise. 116 * prove otherwise.
113 * 117 *
114 * Check rcu_scheduler_active to prevent false positives during boot. 118 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
119 * and while lockdep is disabled.
115 */ 120 */
116static inline int rcu_read_lock_held(void) 121static inline int rcu_read_lock_held(void)
117{ 122{
@@ -129,13 +134,15 @@ extern int rcu_read_lock_bh_held(void);
129/** 134/**
130 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section? 135 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
131 * 136 *
132 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an 137 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an
133 * RCU-sched read-side critical section. In absence of CONFIG_PROVE_LOCKING, 138 * RCU-sched read-side critical section. In absence of
134 * this assumes we are in an RCU-sched read-side critical section unless it 139 * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
135 * can prove otherwise. Note that disabling of preemption (including 140 * critical section unless it can prove otherwise. Note that disabling
136 * disabling irqs) counts as an RCU-sched read-side critical section. 141 * of preemption (including disabling irqs) counts as an RCU-sched
142 * read-side critical section.
137 * 143 *
138 * Check rcu_scheduler_active to prevent false positives during boot. 144 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
145 * and while lockdep is disabled.
139 */ 146 */
140#ifdef CONFIG_PREEMPT 147#ifdef CONFIG_PREEMPT
141static inline int rcu_read_lock_sched_held(void) 148static inline int rcu_read_lock_sched_held(void)
@@ -177,7 +184,7 @@ static inline int rcu_read_lock_bh_held(void)
177#ifdef CONFIG_PREEMPT 184#ifdef CONFIG_PREEMPT
178static inline int rcu_read_lock_sched_held(void) 185static inline int rcu_read_lock_sched_held(void)
179{ 186{
180 return !rcu_scheduler_active || preempt_count() != 0 || irqs_disabled(); 187 return preempt_count() != 0 || irqs_disabled();
181} 188}
182#else /* #ifdef CONFIG_PREEMPT */ 189#else /* #ifdef CONFIG_PREEMPT */
183static inline int rcu_read_lock_sched_held(void) 190static inline int rcu_read_lock_sched_held(void)
@@ -190,6 +197,17 @@ static inline int rcu_read_lock_sched_held(void)
190 197
191#ifdef CONFIG_PROVE_RCU 198#ifdef CONFIG_PROVE_RCU
192 199
200extern int rcu_my_thread_group_empty(void);
201
202#define __do_rcu_dereference_check(c) \
203 do { \
204 static bool __warned; \
205 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
206 __warned = true; \
207 lockdep_rcu_dereference(__FILE__, __LINE__); \
208 } \
209 } while (0)
210
193/** 211/**
194 * rcu_dereference_check - rcu_dereference with debug checking 212 * rcu_dereference_check - rcu_dereference with debug checking
195 * @p: The pointer to read, prior to dereferencing 213 * @p: The pointer to read, prior to dereferencing
@@ -219,8 +237,7 @@ static inline int rcu_read_lock_sched_held(void)
219 */ 237 */
220#define rcu_dereference_check(p, c) \ 238#define rcu_dereference_check(p, c) \
221 ({ \ 239 ({ \
222 if (debug_lockdep_rcu_enabled() && !(c)) \ 240 __do_rcu_dereference_check(c); \
223 lockdep_rcu_dereference(__FILE__, __LINE__); \
224 rcu_dereference_raw(p); \ 241 rcu_dereference_raw(p); \
225 }) 242 })
226 243
@@ -237,8 +254,7 @@ static inline int rcu_read_lock_sched_held(void)
237 */ 254 */
238#define rcu_dereference_protected(p, c) \ 255#define rcu_dereference_protected(p, c) \
239 ({ \ 256 ({ \
240 if (debug_lockdep_rcu_enabled() && !(c)) \ 257 __do_rcu_dereference_check(c); \
241 lockdep_rcu_dereference(__FILE__, __LINE__); \
242 (p); \ 258 (p); \
243 }) 259 })
244 260
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index a5195875480a..e2e893144a84 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -29,6 +29,10 @@
29 29
30void rcu_sched_qs(int cpu); 30void rcu_sched_qs(int cpu);
31void rcu_bh_qs(int cpu); 31void rcu_bh_qs(int cpu);
32static inline void rcu_note_context_switch(int cpu)
33{
34 rcu_sched_qs(cpu);
35}
32 36
33#define __rcu_read_lock() preempt_disable() 37#define __rcu_read_lock() preempt_disable()
34#define __rcu_read_unlock() preempt_enable() 38#define __rcu_read_unlock() preempt_enable()
@@ -60,8 +64,6 @@ static inline long rcu_batches_completed_bh(void)
60 return 0; 64 return 0;
61} 65}
62 66
63extern int rcu_expedited_torture_stats(char *page);
64
65static inline void rcu_force_quiescent_state(void) 67static inline void rcu_force_quiescent_state(void)
66{ 68{
67} 69}
@@ -74,7 +76,17 @@ static inline void rcu_sched_force_quiescent_state(void)
74{ 76{
75} 77}
76 78
77#define synchronize_rcu synchronize_sched 79extern void synchronize_sched(void);
80
81static inline void synchronize_rcu(void)
82{
83 synchronize_sched();
84}
85
86static inline void synchronize_rcu_bh(void)
87{
88 synchronize_sched();
89}
78 90
79static inline void synchronize_rcu_expedited(void) 91static inline void synchronize_rcu_expedited(void)
80{ 92{
@@ -114,4 +126,17 @@ static inline int rcu_preempt_depth(void)
114 return 0; 126 return 0;
115} 127}
116 128
129#ifdef CONFIG_DEBUG_LOCK_ALLOC
130
131extern int rcu_scheduler_active __read_mostly;
132extern void rcu_scheduler_starting(void);
133
134#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
135
136static inline void rcu_scheduler_starting(void)
137{
138}
139
140#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
141
117#endif /* __LINUX_RCUTINY_H */ 142#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 42cc3a04779e..c0ed1c056f29 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -34,8 +34,8 @@ struct notifier_block;
34 34
35extern void rcu_sched_qs(int cpu); 35extern void rcu_sched_qs(int cpu);
36extern void rcu_bh_qs(int cpu); 36extern void rcu_bh_qs(int cpu);
37extern void rcu_note_context_switch(int cpu);
37extern int rcu_needs_cpu(int cpu); 38extern int rcu_needs_cpu(int cpu);
38extern int rcu_expedited_torture_stats(char *page);
39 39
40#ifdef CONFIG_TREE_PREEMPT_RCU 40#ifdef CONFIG_TREE_PREEMPT_RCU
41 41
@@ -86,6 +86,8 @@ static inline void __rcu_read_unlock_bh(void)
86 86
87extern void call_rcu_sched(struct rcu_head *head, 87extern void call_rcu_sched(struct rcu_head *head,
88 void (*func)(struct rcu_head *rcu)); 88 void (*func)(struct rcu_head *rcu));
89extern void synchronize_rcu_bh(void);
90extern void synchronize_sched(void);
89extern void synchronize_rcu_expedited(void); 91extern void synchronize_rcu_expedited(void);
90 92
91static inline void synchronize_rcu_bh_expedited(void) 93static inline void synchronize_rcu_bh_expedited(void)
@@ -120,4 +122,7 @@ static inline int rcu_blocking_is_gp(void)
120 return num_online_cpus() == 1; 122 return num_online_cpus() == 1;
121} 123}
122 124
125extern void rcu_scheduler_starting(void);
126extern int rcu_scheduler_active __read_mostly;
127
123#endif /* __LINUX_RCUTREE_H */ 128#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 28c9fd020d39..ebd747265294 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -183,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
183{ 183{
184 /* Nothing except the stubbed out regulator API should be 184 /* Nothing except the stubbed out regulator API should be
185 * looking at the value except to check if it is an error 185 * looking at the value except to check if it is an error
186 * value so the actual return value doesn't matter. 186 * value. Drivers are free to handle NULL specifically by
187 * skipping all regulator API calls, but they don't have to.
188 * Drivers which don't, should make sure they properly handle
189 * corner cases of the API, such as regulator_get_voltage()
190 * returning 0.
187 */ 191 */
188 return (struct regulator *)id; 192 return NULL;
189} 193}
190static inline void regulator_put(struct regulator *regulator) 194static inline void regulator_put(struct regulator *regulator)
191{ 195{
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index b4448853900e..3fd8c4506bbb 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -53,8 +53,8 @@ int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry, 53 struct inode *dir, struct dentry *dentry,
54 struct inode *inode); 54 struct inode *inode);
55int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
56extern struct xattr_handler reiserfs_posix_acl_default_handler; 56extern const struct xattr_handler reiserfs_posix_acl_default_handler;
57extern struct xattr_handler reiserfs_posix_acl_access_handler; 57extern const struct xattr_handler reiserfs_posix_acl_access_handler;
58 58
59#else 59#else
60 60
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 7fa02b4af838..b2cf2089769b 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -58,9 +58,9 @@ int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
58 struct inode *, const char *, const void *, 58 struct inode *, const char *, const void *,
59 size_t, int); 59 size_t, int);
60 60
61extern struct xattr_handler reiserfs_xattr_user_handler; 61extern const struct xattr_handler reiserfs_xattr_user_handler;
62extern struct xattr_handler reiserfs_xattr_trusted_handler; 62extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern struct xattr_handler reiserfs_xattr_security_handler; 63extern const struct xattr_handler reiserfs_xattr_security_handler;
64#ifdef CONFIG_REISERFS_FS_SECURITY 64#ifdef CONFIG_REISERFS_FS_SECURITY
65int reiserfs_security_init(struct inode *dir, struct inode *inode, 65int reiserfs_security_init(struct inode *dir, struct inode *inode,
66 struct reiserfs_security_handle *sec); 66 struct reiserfs_security_handle *sec);
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 5fcc31ed5771..25b4f686d918 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -120,12 +120,16 @@ int ring_buffer_write(struct ring_buffer *buffer,
120 unsigned long length, void *data); 120 unsigned long length, void *data);
121 121
122struct ring_buffer_event * 122struct ring_buffer_event *
123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts); 123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts,
124 unsigned long *lost_events);
124struct ring_buffer_event * 125struct ring_buffer_event *
125ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts); 126ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts,
127 unsigned long *lost_events);
126 128
127struct ring_buffer_iter * 129struct ring_buffer_iter *
128ring_buffer_read_start(struct ring_buffer *buffer, int cpu); 130ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu);
131void ring_buffer_read_prepare_sync(void);
132void ring_buffer_read_start(struct ring_buffer_iter *iter);
129void ring_buffer_read_finish(struct ring_buffer_iter *iter); 133void ring_buffer_read_finish(struct ring_buffer_iter *iter);
130 134
131struct ring_buffer_event * 135struct ring_buffer_event *
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
index 8ba646e610d9..e55d82cebf80 100644
--- a/include/linux/rtc-v3020.h
+++ b/include/linux/rtc-v3020.h
@@ -15,7 +15,7 @@
15struct v3020_platform_data { 15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */ 16 int leftshift; /* (1<<(leftshift)) & readl() */
17 17
18 int use_gpio:1; 18 unsigned int use_gpio:1;
19 unsigned int gpio_cs; 19 unsigned int gpio_cs;
20 unsigned int gpio_wr; 20 unsigned int gpio_wr;
21 unsigned int gpio_rd; 21 unsigned int gpio_rd;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d1c7c90e9cd4..fbc8cb0d48c3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -7,6 +7,13 @@
7#include <linux/if_addr.h> 7#include <linux/if_addr.h>
8#include <linux/neighbour.h> 8#include <linux/neighbour.h>
9 9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_IP6MR 129
15#define RTNL_FAMILY_MAX 129
16
10/**** 17/****
11 * Routing/neighbour discovery messages. 18 * Routing/neighbour discovery messages.
12 ****/ 19 ****/
diff --git a/include/linux/sched.h b/include/linux/sched.h
index dad7f668ebf7..b55e988988b5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -99,7 +99,6 @@ struct futex_pi_state;
99struct robust_list_head; 99struct robust_list_head;
100struct bio_list; 100struct bio_list;
101struct fs_struct; 101struct fs_struct;
102struct bts_context;
103struct perf_event_context; 102struct perf_event_context;
104 103
105/* 104/*
@@ -275,11 +274,17 @@ extern cpumask_var_t nohz_cpu_mask;
275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
276extern int select_nohz_load_balancer(int cpu); 275extern int select_nohz_load_balancer(int cpu);
277extern int get_nohz_load_balancer(void); 276extern int get_nohz_load_balancer(void);
277extern int nohz_ratelimit(int cpu);
278#else 278#else
279static inline int select_nohz_load_balancer(int cpu) 279static inline int select_nohz_load_balancer(int cpu)
280{ 280{
281 return 0; 281 return 0;
282} 282}
283
284static inline int nohz_ratelimit(int cpu)
285{
286 return 0;
287}
283#endif 288#endif
284 289
285/* 290/*
@@ -954,6 +959,7 @@ struct sched_domain {
954 char *name; 959 char *name;
955#endif 960#endif
956 961
962 unsigned int span_weight;
957 /* 963 /*
958 * Span of all CPUs in this domain. 964 * Span of all CPUs in this domain.
959 * 965 *
@@ -1026,12 +1032,17 @@ struct sched_domain;
1026#define WF_SYNC 0x01 /* waker goes to sleep after wakup */ 1032#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1027#define WF_FORK 0x02 /* child wakeup after fork */ 1033#define WF_FORK 0x02 /* child wakeup after fork */
1028 1034
1035#define ENQUEUE_WAKEUP 1
1036#define ENQUEUE_WAKING 2
1037#define ENQUEUE_HEAD 4
1038
1039#define DEQUEUE_SLEEP 1
1040
1029struct sched_class { 1041struct sched_class {
1030 const struct sched_class *next; 1042 const struct sched_class *next;
1031 1043
1032 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup, 1044 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1033 bool head); 1045 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1034 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
1035 void (*yield_task) (struct rq *rq); 1046 void (*yield_task) (struct rq *rq);
1036 1047
1037 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); 1048 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
@@ -1040,7 +1051,8 @@ struct sched_class {
1040 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1051 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1041 1052
1042#ifdef CONFIG_SMP 1053#ifdef CONFIG_SMP
1043 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); 1054 int (*select_task_rq)(struct rq *rq, struct task_struct *p,
1055 int sd_flag, int flags);
1044 1056
1045 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1057 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1046 void (*post_schedule) (struct rq *this_rq); 1058 void (*post_schedule) (struct rq *this_rq);
@@ -1077,36 +1089,8 @@ struct load_weight {
1077 unsigned long weight, inv_weight; 1089 unsigned long weight, inv_weight;
1078}; 1090};
1079 1091
1080/*
1081 * CFS stats for a schedulable entity (task, task-group etc)
1082 *
1083 * Current field usage histogram:
1084 *
1085 * 4 se->block_start
1086 * 4 se->run_node
1087 * 4 se->sleep_start
1088 * 6 se->load.weight
1089 */
1090struct sched_entity {
1091 struct load_weight load; /* for load-balancing */
1092 struct rb_node run_node;
1093 struct list_head group_node;
1094 unsigned int on_rq;
1095
1096 u64 exec_start;
1097 u64 sum_exec_runtime;
1098 u64 vruntime;
1099 u64 prev_sum_exec_runtime;
1100
1101 u64 last_wakeup;
1102 u64 avg_overlap;
1103
1104 u64 nr_migrations;
1105
1106 u64 start_runtime;
1107 u64 avg_wakeup;
1108
1109#ifdef CONFIG_SCHEDSTATS 1092#ifdef CONFIG_SCHEDSTATS
1093struct sched_statistics {
1110 u64 wait_start; 1094 u64 wait_start;
1111 u64 wait_max; 1095 u64 wait_max;
1112 u64 wait_count; 1096 u64 wait_count;
@@ -1138,6 +1122,24 @@ struct sched_entity {
1138 u64 nr_wakeups_affine_attempts; 1122 u64 nr_wakeups_affine_attempts;
1139 u64 nr_wakeups_passive; 1123 u64 nr_wakeups_passive;
1140 u64 nr_wakeups_idle; 1124 u64 nr_wakeups_idle;
1125};
1126#endif
1127
1128struct sched_entity {
1129 struct load_weight load; /* for load-balancing */
1130 struct rb_node run_node;
1131 struct list_head group_node;
1132 unsigned int on_rq;
1133
1134 u64 exec_start;
1135 u64 sum_exec_runtime;
1136 u64 vruntime;
1137 u64 prev_sum_exec_runtime;
1138
1139 u64 nr_migrations;
1140
1141#ifdef CONFIG_SCHEDSTATS
1142 struct sched_statistics statistics;
1141#endif 1143#endif
1142 1144
1143#ifdef CONFIG_FAIR_GROUP_SCHED 1145#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1272,12 +1274,6 @@ struct task_struct {
1272 struct list_head ptraced; 1274 struct list_head ptraced;
1273 struct list_head ptrace_entry; 1275 struct list_head ptrace_entry;
1274 1276
1275 /*
1276 * This is the tracer handle for the ptrace BTS extension.
1277 * This field actually belongs to the ptracer task.
1278 */
1279 struct bts_context *bts;
1280
1281 /* PID/PID hash table linkage. */ 1277 /* PID/PID hash table linkage. */
1282 struct pid_link pids[PIDTYPE_MAX]; 1278 struct pid_link pids[PIDTYPE_MAX];
1283 struct list_head thread_group; 1279 struct list_head thread_group;
@@ -1497,7 +1493,6 @@ struct task_struct {
1497 /* bitmask of trace recursion */ 1493 /* bitmask of trace recursion */
1498 unsigned long trace_recursion; 1494 unsigned long trace_recursion;
1499#endif /* CONFIG_TRACING */ 1495#endif /* CONFIG_TRACING */
1500 unsigned long stack_start;
1501#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ 1496#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
1502 struct memcg_batch_info { 1497 struct memcg_batch_info {
1503 int do_batch; /* incremented when batch uncharge started */ 1498 int do_batch; /* incremented when batch uncharge started */
@@ -1847,6 +1842,7 @@ extern void sched_clock_idle_sleep_event(void);
1847extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1842extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1848 1843
1849#ifdef CONFIG_HOTPLUG_CPU 1844#ifdef CONFIG_HOTPLUG_CPU
1845extern void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p);
1850extern void idle_task_exit(void); 1846extern void idle_task_exit(void);
1851#else 1847#else
1852static inline void idle_task_exit(void) {} 1848static inline void idle_task_exit(void) {}
@@ -2123,10 +2119,8 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
2123extern char *get_task_comm(char *to, struct task_struct *tsk); 2119extern char *get_task_comm(char *to, struct task_struct *tsk);
2124 2120
2125#ifdef CONFIG_SMP 2121#ifdef CONFIG_SMP
2126extern void wait_task_context_switch(struct task_struct *p);
2127extern unsigned long wait_task_inactive(struct task_struct *, long match_state); 2122extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
2128#else 2123#else
2129static inline void wait_task_context_switch(struct task_struct *p) {}
2130static inline unsigned long wait_task_inactive(struct task_struct *p, 2124static inline unsigned long wait_task_inactive(struct task_struct *p,
2131 long match_state) 2125 long match_state)
2132{ 2126{
diff --git a/include/linux/security.h b/include/linux/security.h
index 3158dd982d27..0c8819170463 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -267,49 +267,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
267 * @orig the original mount data copied from userspace. 267 * @orig the original mount data copied from userspace.
268 * @copy copied data which will be passed to the security module. 268 * @copy copied data which will be passed to the security module.
269 * Returns 0 if the copy was successful. 269 * Returns 0 if the copy was successful.
270 * @sb_check_sb:
271 * Check permission before the device with superblock @mnt->sb is mounted
272 * on the mount point named by @nd.
273 * @mnt contains the vfsmount for device being mounted.
274 * @path contains the path for the mount point.
275 * Return 0 if permission is granted.
276 * @sb_umount: 270 * @sb_umount:
277 * Check permission before the @mnt file system is unmounted. 271 * Check permission before the @mnt file system is unmounted.
278 * @mnt contains the mounted file system. 272 * @mnt contains the mounted file system.
279 * @flags contains the unmount flags, e.g. MNT_FORCE. 273 * @flags contains the unmount flags, e.g. MNT_FORCE.
280 * Return 0 if permission is granted. 274 * Return 0 if permission is granted.
281 * @sb_umount_close:
282 * Close any files in the @mnt mounted filesystem that are held open by
283 * the security module. This hook is called during an umount operation
284 * prior to checking whether the filesystem is still busy.
285 * @mnt contains the mounted filesystem.
286 * @sb_umount_busy:
287 * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening
288 * any files that were closed by umount_close. This hook is called during
289 * an umount operation if the umount fails after a call to the
290 * umount_close hook.
291 * @mnt contains the mounted filesystem.
292 * @sb_post_remount:
293 * Update the security module's state when a filesystem is remounted.
294 * This hook is only called if the remount was successful.
295 * @mnt contains the mounted file system.
296 * @flags contains the new filesystem flags.
297 * @data contains the filesystem-specific data.
298 * @sb_post_addmount:
299 * Update the security module's state when a filesystem is mounted.
300 * This hook is called any time a mount is successfully grafetd to
301 * the tree.
302 * @mnt contains the mounted filesystem.
303 * @mountpoint contains the path for the mount point.
304 * @sb_pivotroot: 275 * @sb_pivotroot:
305 * Check permission before pivoting the root filesystem. 276 * Check permission before pivoting the root filesystem.
306 * @old_path contains the path for the new location of the current root (put_old). 277 * @old_path contains the path for the new location of the current root (put_old).
307 * @new_path contains the path for the new root (new_root). 278 * @new_path contains the path for the new root (new_root).
308 * Return 0 if permission is granted. 279 * Return 0 if permission is granted.
309 * @sb_post_pivotroot:
310 * Update module state after a successful pivot.
311 * @old_path contains the path for the old root.
312 * @new_path contains the path for the new root.
313 * @sb_set_mnt_opts: 280 * @sb_set_mnt_opts:
314 * Set the security relevant mount options used for a superblock 281 * Set the security relevant mount options used for a superblock
315 * @sb the superblock to set security mount options for 282 * @sb the superblock to set security mount options for
@@ -511,12 +478,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
511 * @mnt is the vfsmount where the dentry was looked up 478 * @mnt is the vfsmount where the dentry was looked up
512 * @dentry contains the dentry structure for the file. 479 * @dentry contains the dentry structure for the file.
513 * Return 0 if permission is granted. 480 * Return 0 if permission is granted.
514 * @inode_delete:
515 * @inode contains the inode structure for deleted inode.
516 * This hook is called when a deleted inode is released (i.e. an inode
517 * with no hard links has its use count drop to zero). A security module
518 * can use this hook to release any persistent label associated with the
519 * inode.
520 * @inode_setxattr: 481 * @inode_setxattr:
521 * Check permission before setting the extended attributes 482 * Check permission before setting the extended attributes
522 * @value identified by @name for @dentry. 483 * @value identified by @name for @dentry.
@@ -691,10 +652,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
691 * @old points to the original credentials. 652 * @old points to the original credentials.
692 * @gfp indicates the atomicity of any memory allocations. 653 * @gfp indicates the atomicity of any memory allocations.
693 * Prepare a new set of credentials by copying the data from the old set. 654 * Prepare a new set of credentials by copying the data from the old set.
694 * @cred_commit:
695 * @new points to the new credentials.
696 * @old points to the original credentials.
697 * Install a new set of credentials.
698 * @cred_transfer: 655 * @cred_transfer:
699 * @new points to the new credentials. 656 * @new points to the new credentials.
700 * @old points to the original credentials. 657 * @old points to the original credentials.
@@ -717,18 +674,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
717 * userspace to load a kernel module with the given name. 674 * userspace to load a kernel module with the given name.
718 * @kmod_name name of the module requested by the kernel 675 * @kmod_name name of the module requested by the kernel
719 * Return 0 if successful. 676 * Return 0 if successful.
720 * @task_setuid:
721 * Check permission before setting one or more of the user identity
722 * attributes of the current process. The @flags parameter indicates
723 * which of the set*uid system calls invoked this hook and how to
724 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
725 * definitions at the beginning of this file for the @flags values and
726 * their meanings.
727 * @id0 contains a uid.
728 * @id1 contains a uid.
729 * @id2 contains a uid.
730 * @flags contains one of the LSM_SETID_* values.
731 * Return 0 if permission is granted.
732 * @task_fix_setuid: 677 * @task_fix_setuid:
733 * Update the module's state after setting one or more of the user 678 * Update the module's state after setting one or more of the user
734 * identity attributes of the current process. The @flags parameter 679 * identity attributes of the current process. The @flags parameter
@@ -738,18 +683,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
738 * @old is the set of credentials that are being replaces 683 * @old is the set of credentials that are being replaces
739 * @flags contains one of the LSM_SETID_* values. 684 * @flags contains one of the LSM_SETID_* values.
740 * Return 0 on success. 685 * Return 0 on success.
741 * @task_setgid:
742 * Check permission before setting one or more of the group identity
743 * attributes of the current process. The @flags parameter indicates
744 * which of the set*gid system calls invoked this hook and how to
745 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
746 * definitions at the beginning of this file for the @flags values and
747 * their meanings.
748 * @id0 contains a gid.
749 * @id1 contains a gid.
750 * @id2 contains a gid.
751 * @flags contains one of the LSM_SETID_* values.
752 * Return 0 if permission is granted.
753 * @task_setpgid: 686 * @task_setpgid:
754 * Check permission before setting the process group identifier of the 687 * Check permission before setting the process group identifier of the
755 * process @p to @pgid. 688 * process @p to @pgid.
@@ -771,11 +704,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
771 * @p contains the task_struct for the process and place is into @secid. 704 * @p contains the task_struct for the process and place is into @secid.
772 * In case of failure, @secid will be set to zero. 705 * In case of failure, @secid will be set to zero.
773 * 706 *
774 * @task_setgroups:
775 * Check permission before setting the supplementary group set of the
776 * current process.
777 * @group_info contains the new group information.
778 * Return 0 if permission is granted.
779 * @task_setnice: 707 * @task_setnice:
780 * Check permission before setting the nice value of @p to @nice. 708 * Check permission before setting the nice value of @p to @nice.
781 * @p contains the task_struct of process. 709 * @p contains the task_struct of process.
@@ -1139,13 +1067,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1139 * Return the length of the string (including terminating NUL) or -ve if 1067 * Return the length of the string (including terminating NUL) or -ve if
1140 * an error. 1068 * an error.
1141 * May also return 0 (and a NULL buffer pointer) if there is no label. 1069 * May also return 0 (and a NULL buffer pointer) if there is no label.
1142 * @key_session_to_parent:
1143 * Forcibly assign the session keyring from a process to its parent
1144 * process.
1145 * @cred: Pointer to process's credentials
1146 * @parent_cred: Pointer to parent process's credentials
1147 * @keyring: Proposed new session keyring
1148 * Return 0 if permission is granted, -ve error otherwise.
1149 * 1070 *
1150 * Security hooks affecting all System V IPC operations. 1071 * Security hooks affecting all System V IPC operations.
1151 * 1072 *
@@ -1333,13 +1254,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1333 * @cap contains the capability <include/linux/capability.h>. 1254 * @cap contains the capability <include/linux/capability.h>.
1334 * @audit: Whether to write an audit message or not 1255 * @audit: Whether to write an audit message or not
1335 * Return 0 if the capability is granted for @tsk. 1256 * Return 0 if the capability is granted for @tsk.
1336 * @acct:
1337 * Check permission before enabling or disabling process accounting. If
1338 * accounting is being enabled, then @file refers to the open file used to
1339 * store accounting records. If accounting is being disabled, then @file
1340 * is NULL.
1341 * @file contains the file structure for the accounting file (may be NULL).
1342 * Return 0 if permission is granted.
1343 * @sysctl: 1257 * @sysctl:
1344 * Check permission before accessing the @table sysctl variable in the 1258 * Check permission before accessing the @table sysctl variable in the
1345 * manner specified by @op. 1259 * manner specified by @op.
@@ -1462,7 +1376,6 @@ struct security_operations {
1462 const kernel_cap_t *permitted); 1376 const kernel_cap_t *permitted);
1463 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1377 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1464 int cap, int audit); 1378 int cap, int audit);
1465 int (*acct) (struct file *file);
1466 int (*sysctl) (struct ctl_table *table, int op); 1379 int (*sysctl) (struct ctl_table *table, int op);
1467 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1380 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1468 int (*quota_on) (struct dentry *dentry); 1381 int (*quota_on) (struct dentry *dentry);
@@ -1484,18 +1397,9 @@ struct security_operations {
1484 int (*sb_statfs) (struct dentry *dentry); 1397 int (*sb_statfs) (struct dentry *dentry);
1485 int (*sb_mount) (char *dev_name, struct path *path, 1398 int (*sb_mount) (char *dev_name, struct path *path,
1486 char *type, unsigned long flags, void *data); 1399 char *type, unsigned long flags, void *data);
1487 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1488 int (*sb_umount) (struct vfsmount *mnt, int flags); 1400 int (*sb_umount) (struct vfsmount *mnt, int flags);
1489 void (*sb_umount_close) (struct vfsmount *mnt);
1490 void (*sb_umount_busy) (struct vfsmount *mnt);
1491 void (*sb_post_remount) (struct vfsmount *mnt,
1492 unsigned long flags, void *data);
1493 void (*sb_post_addmount) (struct vfsmount *mnt,
1494 struct path *mountpoint);
1495 int (*sb_pivotroot) (struct path *old_path, 1401 int (*sb_pivotroot) (struct path *old_path,
1496 struct path *new_path); 1402 struct path *new_path);
1497 void (*sb_post_pivotroot) (struct path *old_path,
1498 struct path *new_path);
1499 int (*sb_set_mnt_opts) (struct super_block *sb, 1403 int (*sb_set_mnt_opts) (struct super_block *sb,
1500 struct security_mnt_opts *opts); 1404 struct security_mnt_opts *opts);
1501 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1405 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1544,7 +1448,6 @@ struct security_operations {
1544 int (*inode_permission) (struct inode *inode, int mask); 1448 int (*inode_permission) (struct inode *inode, int mask);
1545 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1449 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1546 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1450 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1547 void (*inode_delete) (struct inode *inode);
1548 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1451 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1549 const void *value, size_t size, int flags); 1452 const void *value, size_t size, int flags);
1550 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1453 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1585,20 +1488,16 @@ struct security_operations {
1585 void (*cred_free) (struct cred *cred); 1488 void (*cred_free) (struct cred *cred);
1586 int (*cred_prepare)(struct cred *new, const struct cred *old, 1489 int (*cred_prepare)(struct cred *new, const struct cred *old,
1587 gfp_t gfp); 1490 gfp_t gfp);
1588 void (*cred_commit)(struct cred *new, const struct cred *old);
1589 void (*cred_transfer)(struct cred *new, const struct cred *old); 1491 void (*cred_transfer)(struct cred *new, const struct cred *old);
1590 int (*kernel_act_as)(struct cred *new, u32 secid); 1492 int (*kernel_act_as)(struct cred *new, u32 secid);
1591 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1493 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1592 int (*kernel_module_request)(char *kmod_name); 1494 int (*kernel_module_request)(char *kmod_name);
1593 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1594 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1495 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1595 int flags); 1496 int flags);
1596 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1597 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1497 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1598 int (*task_getpgid) (struct task_struct *p); 1498 int (*task_getpgid) (struct task_struct *p);
1599 int (*task_getsid) (struct task_struct *p); 1499 int (*task_getsid) (struct task_struct *p);
1600 void (*task_getsecid) (struct task_struct *p, u32 *secid); 1500 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1601 int (*task_setgroups) (struct group_info *group_info);
1602 int (*task_setnice) (struct task_struct *p, int nice); 1501 int (*task_setnice) (struct task_struct *p, int nice);
1603 int (*task_setioprio) (struct task_struct *p, int ioprio); 1502 int (*task_setioprio) (struct task_struct *p, int ioprio);
1604 int (*task_getioprio) (struct task_struct *p); 1503 int (*task_getioprio) (struct task_struct *p);
@@ -1728,9 +1627,6 @@ struct security_operations {
1728 const struct cred *cred, 1627 const struct cred *cred,
1729 key_perm_t perm); 1628 key_perm_t perm);
1730 int (*key_getsecurity)(struct key *key, char **_buffer); 1629 int (*key_getsecurity)(struct key *key, char **_buffer);
1731 int (*key_session_to_parent)(const struct cred *cred,
1732 const struct cred *parent_cred,
1733 struct key *key);
1734#endif /* CONFIG_KEYS */ 1630#endif /* CONFIG_KEYS */
1735 1631
1736#ifdef CONFIG_AUDIT 1632#ifdef CONFIG_AUDIT
@@ -1761,7 +1657,6 @@ int security_capset(struct cred *new, const struct cred *old,
1761int security_capable(int cap); 1657int security_capable(int cap);
1762int security_real_capable(struct task_struct *tsk, int cap); 1658int security_real_capable(struct task_struct *tsk, int cap);
1763int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1659int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1764int security_acct(struct file *file);
1765int security_sysctl(struct ctl_table *table, int op); 1660int security_sysctl(struct ctl_table *table, int op);
1766int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1661int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1767int security_quota_on(struct dentry *dentry); 1662int security_quota_on(struct dentry *dentry);
@@ -1783,14 +1678,8 @@ int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1783int security_sb_statfs(struct dentry *dentry); 1678int security_sb_statfs(struct dentry *dentry);
1784int security_sb_mount(char *dev_name, struct path *path, 1679int security_sb_mount(char *dev_name, struct path *path,
1785 char *type, unsigned long flags, void *data); 1680 char *type, unsigned long flags, void *data);
1786int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1787int security_sb_umount(struct vfsmount *mnt, int flags); 1681int security_sb_umount(struct vfsmount *mnt, int flags);
1788void security_sb_umount_close(struct vfsmount *mnt);
1789void security_sb_umount_busy(struct vfsmount *mnt);
1790void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1791void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1792int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1682int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1793void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1794int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1683int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1795void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1684void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1796 struct super_block *newsb); 1685 struct super_block *newsb);
@@ -1816,7 +1705,6 @@ int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1816int security_inode_permission(struct inode *inode, int mask); 1705int security_inode_permission(struct inode *inode, int mask);
1817int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1706int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1818int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1707int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1819void security_inode_delete(struct inode *inode);
1820int security_inode_setxattr(struct dentry *dentry, const char *name, 1708int security_inode_setxattr(struct dentry *dentry, const char *name,
1821 const void *value, size_t size, int flags); 1709 const void *value, size_t size, int flags);
1822void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1710void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -1850,20 +1738,16 @@ int security_task_create(unsigned long clone_flags);
1850int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1738int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1851void security_cred_free(struct cred *cred); 1739void security_cred_free(struct cred *cred);
1852int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1740int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1853void security_commit_creds(struct cred *new, const struct cred *old);
1854void security_transfer_creds(struct cred *new, const struct cred *old); 1741void security_transfer_creds(struct cred *new, const struct cred *old);
1855int security_kernel_act_as(struct cred *new, u32 secid); 1742int security_kernel_act_as(struct cred *new, u32 secid);
1856int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1743int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1857int security_kernel_module_request(char *kmod_name); 1744int security_kernel_module_request(char *kmod_name);
1858int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1859int security_task_fix_setuid(struct cred *new, const struct cred *old, 1745int security_task_fix_setuid(struct cred *new, const struct cred *old,
1860 int flags); 1746 int flags);
1861int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1862int security_task_setpgid(struct task_struct *p, pid_t pgid); 1747int security_task_setpgid(struct task_struct *p, pid_t pgid);
1863int security_task_getpgid(struct task_struct *p); 1748int security_task_getpgid(struct task_struct *p);
1864int security_task_getsid(struct task_struct *p); 1749int security_task_getsid(struct task_struct *p);
1865void security_task_getsecid(struct task_struct *p, u32 *secid); 1750void security_task_getsecid(struct task_struct *p, u32 *secid);
1866int security_task_setgroups(struct group_info *group_info);
1867int security_task_setnice(struct task_struct *p, int nice); 1751int security_task_setnice(struct task_struct *p, int nice);
1868int security_task_setioprio(struct task_struct *p, int ioprio); 1752int security_task_setioprio(struct task_struct *p, int ioprio);
1869int security_task_getioprio(struct task_struct *p); 1753int security_task_getioprio(struct task_struct *p);
@@ -1990,11 +1874,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1990 return ret; 1874 return ret;
1991} 1875}
1992 1876
1993static inline int security_acct(struct file *file)
1994{
1995 return 0;
1996}
1997
1998static inline int security_sysctl(struct ctl_table *table, int op) 1877static inline int security_sysctl(struct ctl_table *table, int op)
1999{ 1878{
2000 return 0; 1879 return 0;
@@ -2099,41 +1978,17 @@ static inline int security_sb_mount(char *dev_name, struct path *path,
2099 return 0; 1978 return 0;
2100} 1979}
2101 1980
2102static inline int security_sb_check_sb(struct vfsmount *mnt,
2103 struct path *path)
2104{
2105 return 0;
2106}
2107
2108static inline int security_sb_umount(struct vfsmount *mnt, int flags) 1981static inline int security_sb_umount(struct vfsmount *mnt, int flags)
2109{ 1982{
2110 return 0; 1983 return 0;
2111} 1984}
2112 1985
2113static inline void security_sb_umount_close(struct vfsmount *mnt)
2114{ }
2115
2116static inline void security_sb_umount_busy(struct vfsmount *mnt)
2117{ }
2118
2119static inline void security_sb_post_remount(struct vfsmount *mnt,
2120 unsigned long flags, void *data)
2121{ }
2122
2123static inline void security_sb_post_addmount(struct vfsmount *mnt,
2124 struct path *mountpoint)
2125{ }
2126
2127static inline int security_sb_pivotroot(struct path *old_path, 1986static inline int security_sb_pivotroot(struct path *old_path,
2128 struct path *new_path) 1987 struct path *new_path)
2129{ 1988{
2130 return 0; 1989 return 0;
2131} 1990}
2132 1991
2133static inline void security_sb_post_pivotroot(struct path *old_path,
2134 struct path *new_path)
2135{ }
2136
2137static inline int security_sb_set_mnt_opts(struct super_block *sb, 1992static inline int security_sb_set_mnt_opts(struct super_block *sb,
2138 struct security_mnt_opts *opts) 1993 struct security_mnt_opts *opts)
2139{ 1994{
@@ -2249,9 +2104,6 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
2249 return 0; 2104 return 0;
2250} 2105}
2251 2106
2252static inline void security_inode_delete(struct inode *inode)
2253{ }
2254
2255static inline int security_inode_setxattr(struct dentry *dentry, 2107static inline int security_inode_setxattr(struct dentry *dentry,
2256 const char *name, const void *value, size_t size, int flags) 2108 const char *name, const void *value, size_t size, int flags)
2257{ 2109{
@@ -2398,11 +2250,6 @@ static inline int security_prepare_creds(struct cred *new,
2398 return 0; 2250 return 0;
2399} 2251}
2400 2252
2401static inline void security_commit_creds(struct cred *new,
2402 const struct cred *old)
2403{
2404}
2405
2406static inline void security_transfer_creds(struct cred *new, 2253static inline void security_transfer_creds(struct cred *new,
2407 const struct cred *old) 2254 const struct cred *old)
2408{ 2255{
@@ -2424,12 +2271,6 @@ static inline int security_kernel_module_request(char *kmod_name)
2424 return 0; 2271 return 0;
2425} 2272}
2426 2273
2427static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2428 int flags)
2429{
2430 return 0;
2431}
2432
2433static inline int security_task_fix_setuid(struct cred *new, 2274static inline int security_task_fix_setuid(struct cred *new,
2434 const struct cred *old, 2275 const struct cred *old,
2435 int flags) 2276 int flags)
@@ -2437,12 +2278,6 @@ static inline int security_task_fix_setuid(struct cred *new,
2437 return cap_task_fix_setuid(new, old, flags); 2278 return cap_task_fix_setuid(new, old, flags);
2438} 2279}
2439 2280
2440static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2441 int flags)
2442{
2443 return 0;
2444}
2445
2446static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) 2281static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2447{ 2282{
2448 return 0; 2283 return 0;
@@ -2463,11 +2298,6 @@ static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2463 *secid = 0; 2298 *secid = 0;
2464} 2299}
2465 2300
2466static inline int security_task_setgroups(struct group_info *group_info)
2467{
2468 return 0;
2469}
2470
2471static inline int security_task_setnice(struct task_struct *p, int nice) 2301static inline int security_task_setnice(struct task_struct *p, int nice)
2472{ 2302{
2473 return cap_task_setnice(p, nice); 2303 return cap_task_setnice(p, nice);
@@ -3064,9 +2894,6 @@ void security_key_free(struct key *key);
3064int security_key_permission(key_ref_t key_ref, 2894int security_key_permission(key_ref_t key_ref,
3065 const struct cred *cred, key_perm_t perm); 2895 const struct cred *cred, key_perm_t perm);
3066int security_key_getsecurity(struct key *key, char **_buffer); 2896int security_key_getsecurity(struct key *key, char **_buffer);
3067int security_key_session_to_parent(const struct cred *cred,
3068 const struct cred *parent_cred,
3069 struct key *key);
3070 2897
3071#else 2898#else
3072 2899
@@ -3094,13 +2921,6 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
3094 return 0; 2921 return 0;
3095} 2922}
3096 2923
3097static inline int security_key_session_to_parent(const struct cred *cred,
3098 const struct cred *parent_cred,
3099 struct key *key)
3100{
3101 return 0;
3102}
3103
3104#endif 2924#endif
3105#endif /* CONFIG_KEYS */ 2925#endif /* CONFIG_KEYS */
3106 2926
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 78dd1e7120a9..f10db6e5f3b5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -182,6 +182,10 @@
182/* Aeroflex Gaisler GRLIB APBUART */ 182/* Aeroflex Gaisler GRLIB APBUART */
183#define PORT_APBUART 90 183#define PORT_APBUART 90
184 184
185/* Altera UARTs */
186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92
188
185#ifdef __KERNEL__ 189#ifdef __KERNEL__
186 190
187#include <linux/compiler.h> 191#include <linux/compiler.h>
@@ -246,6 +250,7 @@ struct uart_ops {
246#endif 250#endif
247}; 251};
248 252
253#define NO_POLL_CHAR 0x00ff0000
249#define UART_CONFIG_TYPE (1 << 0) 254#define UART_CONFIG_TYPE (1 << 0)
250#define UART_CONFIG_IRQ (1 << 1) 255#define UART_CONFIG_IRQ (1 << 1)
251 256
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 193d4bfe42ff..f5364a1de68b 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -33,8 +33,8 @@ struct plat_sci_port {
33 char *clk; /* clock string */ 33 char *clk; /* clock string */
34 struct device *dma_dev; 34 struct device *dma_dev;
35#ifdef CONFIG_SERIAL_SH_SCI_DMA 35#ifdef CONFIG_SERIAL_SH_SCI_DMA
36 enum sh_dmae_slave_chan_id dma_slave_tx; 36 unsigned int dma_slave_tx;
37 enum sh_dmae_slave_chan_id dma_slave_rx; 37 unsigned int dma_slave_rx;
38#endif 38#endif
39}; 39};
40 40
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 64b473066b9a..b5552568178d 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -196,5 +196,6 @@ static inline void serio_continue_rx(struct serio *serio)
196#define SERIO_TOUCHIT213 0x38 196#define SERIO_TOUCHIT213 0x38
197#define SERIO_W8001 0x39 197#define SERIO_W8001 0x39
198#define SERIO_DYNAPRO 0x3a 198#define SERIO_DYNAPRO 0x3a
199#define SERIO_HAMPSHIRE 0x3b
199 200
200#endif 201#endif
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
new file mode 100644
index 000000000000..1636d1e2a5f1
--- /dev/null
+++ b/include/linux/sh_clk.h
@@ -0,0 +1,150 @@
1#ifndef __SH_CLOCK_H
2#define __SH_CLOCK_H
3
4#include <linux/list.h>
5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
7#include <linux/clk.h>
8#include <linux/err.h>
9
10struct clk;
11
12struct clk_ops {
13 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk);
16 unsigned long (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
18 int (*set_parent)(struct clk *clk, struct clk *parent);
19 long (*round_rate)(struct clk *clk, unsigned long rate);
20};
21
22struct clk {
23 struct list_head node;
24 const char *name;
25 int id;
26
27 struct clk *parent;
28 struct clk_ops *ops;
29
30 struct list_head children;
31 struct list_head sibling; /* node for children */
32
33 int usecount;
34
35 unsigned long rate;
36 unsigned long flags;
37
38 void __iomem *enable_reg;
39 unsigned int enable_bit;
40
41 unsigned long arch_flags;
42 void *priv;
43 struct dentry *dentry;
44 struct cpufreq_frequency_table *freq_table;
45};
46
47#define CLK_ENABLE_ON_INIT (1 << 0)
48
49/* drivers/sh/clk.c */
50unsigned long followparent_recalc(struct clk *);
51void recalculate_root_clocks(void);
52void propagate_rate(struct clk *);
53int clk_reparent(struct clk *child, struct clk *parent);
54int clk_register(struct clk *);
55void clk_unregister(struct clk *);
56void clk_enable_init_clocks(void);
57
58/**
59 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
60 * @clk: clock source
61 * @rate: desired clock rate in Hz
62 * @algo_id: algorithm id to be passed down to ops->set_rate
63 *
64 * Returns success (0) or negative errno.
65 */
66int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
67
68enum clk_sh_algo_id {
69 NO_CHANGE = 0,
70
71 IUS_N1_N1,
72 IUS_322,
73 IUS_522,
74 IUS_N11,
75
76 SB_N1,
77
78 SB3_N1,
79 SB3_32,
80 SB3_43,
81 SB3_54,
82
83 BP_N1,
84
85 IP_N1,
86};
87
88struct clk_div_mult_table {
89 unsigned int *divisors;
90 unsigned int nr_divisors;
91 unsigned int *multipliers;
92 unsigned int nr_multipliers;
93};
94
95struct cpufreq_frequency_table;
96void clk_rate_table_build(struct clk *clk,
97 struct cpufreq_frequency_table *freq_table,
98 int nr_freqs,
99 struct clk_div_mult_table *src_table,
100 unsigned long *bitmap);
101
102long clk_rate_table_round(struct clk *clk,
103 struct cpufreq_frequency_table *freq_table,
104 unsigned long rate);
105
106int clk_rate_table_find(struct clk *clk,
107 struct cpufreq_frequency_table *freq_table,
108 unsigned long rate);
109
110#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
111{ \
112 .parent = _parent, \
113 .enable_reg = (void __iomem *)_enable_reg, \
114 .enable_bit = _enable_bit, \
115 .flags = _flags, \
116}
117
118int sh_clk_mstp32_register(struct clk *clks, int nr);
119
120#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
121{ \
122 .parent = _parent, \
123 .enable_reg = (void __iomem *)_reg, \
124 .enable_bit = _shift, \
125 .arch_flags = _div_bitmap, \
126 .flags = _flags, \
127}
128
129struct clk_div4_table {
130 struct clk_div_mult_table *div_mult_table;
131 void (*kick)(struct clk *clk);
132};
133
134int sh_clk_div4_register(struct clk *clks, int nr,
135 struct clk_div4_table *table);
136int sh_clk_div4_enable_register(struct clk *clks, int nr,
137 struct clk_div4_table *table);
138int sh_clk_div4_reparent_register(struct clk *clks, int nr,
139 struct clk_div4_table *table);
140
141#define SH_CLK_DIV6(_parent, _reg, _flags) \
142{ \
143 .parent = _parent, \
144 .enable_reg = (void __iomem *)_reg, \
145 .flags = _flags, \
146}
147
148int sh_clk_div6_register(struct clk *clks, int nr);
149
150#endif /* __SH_CLOCK_H */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
new file mode 100644
index 000000000000..b08cd4efa15c
--- /dev/null
+++ b/include/linux/sh_dma.h
@@ -0,0 +1,102 @@
1/*
2 * Header for the new SH dmaengine driver
3 *
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef SH_DMA_H
11#define SH_DMA_H
12
13#include <linux/list.h>
14#include <linux/dmaengine.h>
15
16/* Used by slave DMA clients to request DMA to/from a specific peripheral */
17struct sh_dmae_slave {
18 unsigned int slave_id; /* Set by the platform */
19 struct device *dma_dev; /* Set by the platform */
20 const struct sh_dmae_slave_config *config; /* Set by the driver */
21};
22
23struct sh_dmae_regs {
24 u32 sar; /* SAR / source address */
25 u32 dar; /* DAR / destination address */
26 u32 tcr; /* TCR / transfer count */
27};
28
29struct sh_desc {
30 struct sh_dmae_regs hw;
31 struct list_head node;
32 struct dma_async_tx_descriptor async_tx;
33 enum dma_data_direction direction;
34 dma_cookie_t cookie;
35 size_t partial;
36 int chunks;
37 int mark;
38};
39
40struct sh_dmae_slave_config {
41 unsigned int slave_id;
42 dma_addr_t addr;
43 u32 chcr;
44 char mid_rid;
45};
46
47struct sh_dmae_channel {
48 unsigned int offset;
49 unsigned int dmars;
50 unsigned int dmars_bit;
51};
52
53struct sh_dmae_pdata {
54 const struct sh_dmae_slave_config *slave;
55 int slave_num;
56 const struct sh_dmae_channel *channel;
57 int channel_num;
58 unsigned int ts_low_shift;
59 unsigned int ts_low_mask;
60 unsigned int ts_high_shift;
61 unsigned int ts_high_mask;
62 const unsigned int *ts_shift;
63 int ts_shift_num;
64 u16 dmaor_init;
65};
66
67/* DMA register */
68#define SAR 0x00
69#define DAR 0x04
70#define TCR 0x08
71#define CHCR 0x0C
72#define DMAOR 0x40
73
74/* DMAOR definitions */
75#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001
78
79/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000
89#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000
92#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004
101
102#endif
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 51d288d8ac88..0d6cd38e673d 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -1,6 +1,8 @@
1#ifndef __SH_INTC_H 1#ifndef __SH_INTC_H
2#define __SH_INTC_H 2#define __SH_INTC_H
3 3
4#include <linux/ioport.h>
5
4typedef unsigned char intc_enum; 6typedef unsigned char intc_enum;
5 7
6struct intc_vect { 8struct intc_vect {
@@ -21,6 +23,9 @@ struct intc_group {
21struct intc_mask_reg { 23struct intc_mask_reg {
22 unsigned long set_reg, clr_reg, reg_width; 24 unsigned long set_reg, clr_reg, reg_width;
23 intc_enum enum_ids[32]; 25 intc_enum enum_ids[32];
26#ifdef CONFIG_INTC_BALANCING
27 unsigned long dist_reg;
28#endif
24#ifdef CONFIG_SMP 29#ifdef CONFIG_SMP
25 unsigned long smp; 30 unsigned long smp;
26#endif 31#endif
@@ -39,8 +44,14 @@ struct intc_sense_reg {
39 intc_enum enum_ids[16]; 44 intc_enum enum_ids[16];
40}; 45};
41 46
47#ifdef CONFIG_INTC_BALANCING
48#define INTC_SMP_BALANCING(reg) .dist_reg = (reg)
49#else
50#define INTC_SMP_BALANCING(reg)
51#endif
52
42#ifdef CONFIG_SMP 53#ifdef CONFIG_SMP
43#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8) 54#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
44#else 55#else
45#define INTC_SMP(stride, nr) 56#define INTC_SMP(stride, nr)
46#endif 57#endif
@@ -71,6 +82,8 @@ struct intc_hw_desc {
71 82
72struct intc_desc { 83struct intc_desc {
73 char *name; 84 char *name;
85 struct resource *resource;
86 unsigned int num_resources;
74 intc_enum force_enable; 87 intc_enum force_enable;
75 intc_enum force_disable; 88 intc_enum force_disable;
76 struct intc_hw_desc hw; 89 struct intc_hw_desc hw;
@@ -92,9 +105,18 @@ struct intc_desc symbol __initdata = { \
92 prio_regs, sense_regs, ack_regs), \ 105 prio_regs, sense_regs, ack_regs), \
93} 106}
94 107
95void __init register_intc_controller(struct intc_desc *desc); 108int __init register_intc_controller(struct intc_desc *desc);
96int intc_set_priority(unsigned int irq, unsigned int prio); 109int intc_set_priority(unsigned int irq, unsigned int prio);
97 110
111#ifdef CONFIG_INTC_USERIMASK
112int register_intc_userimask(unsigned long addr);
113#else
114static inline int register_intc_userimask(unsigned long addr)
115{
116 return 0;
117}
118#endif
119
98int reserve_irq_vector(unsigned int irq); 120int reserve_irq_vector(unsigned int irq);
99void reserve_irq_legacy(void); 121void reserve_irq_legacy(void);
100 122
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 124f90cd5a38..7cdfb4d52847 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -187,7 +187,6 @@ union skb_shared_tx {
187 * the end of the header data, ie. at skb->end. 187 * the end of the header data, ie. at skb->end.
188 */ 188 */
189struct skb_shared_info { 189struct skb_shared_info {
190 atomic_t dataref;
191 unsigned short nr_frags; 190 unsigned short nr_frags;
192 unsigned short gso_size; 191 unsigned short gso_size;
193 /* Warning: this field is not always filled in (UFO)! */ 192 /* Warning: this field is not always filled in (UFO)! */
@@ -197,6 +196,12 @@ struct skb_shared_info {
197 union skb_shared_tx tx_flags; 196 union skb_shared_tx tx_flags;
198 struct sk_buff *frag_list; 197 struct sk_buff *frag_list;
199 struct skb_shared_hwtstamps hwtstamps; 198 struct skb_shared_hwtstamps hwtstamps;
199
200 /*
201 * Warning : all fields before dataref are cleared in __alloc_skb()
202 */
203 atomic_t dataref;
204
200 skb_frag_t frags[MAX_SKB_FRAGS]; 205 skb_frag_t frags[MAX_SKB_FRAGS];
201 /* Intermediate layers must ensure that destructor_arg 206 /* Intermediate layers must ensure that destructor_arg
202 * remains valid until skb destructor */ 207 * remains valid until skb destructor */
@@ -259,7 +264,7 @@ typedef unsigned char *sk_buff_data_t;
259 * @transport_header: Transport layer header 264 * @transport_header: Transport layer header
260 * @network_header: Network layer header 265 * @network_header: Network layer header
261 * @mac_header: Link layer header 266 * @mac_header: Link layer header
262 * @_skb_dst: destination entry 267 * @_skb_refdst: destination entry (with norefcount bit)
263 * @sp: the security path, used for xfrm 268 * @sp: the security path, used for xfrm
264 * @cb: Control buffer. Free for use by every layer. Put private vars here 269 * @cb: Control buffer. Free for use by every layer. Put private vars here
265 * @len: Length of actual data 270 * @len: Length of actual data
@@ -294,6 +299,7 @@ typedef unsigned char *sk_buff_data_t;
294 * @nfct_reasm: netfilter conntrack re-assembly pointer 299 * @nfct_reasm: netfilter conntrack re-assembly pointer
295 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 300 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
296 * @skb_iif: ifindex of device we arrived on 301 * @skb_iif: ifindex of device we arrived on
302 * @rxhash: the packet hash computed on receive
297 * @queue_mapping: Queue mapping for multiqueue devices 303 * @queue_mapping: Queue mapping for multiqueue devices
298 * @tc_index: Traffic control index 304 * @tc_index: Traffic control index
299 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
@@ -322,7 +328,7 @@ struct sk_buff {
322 */ 328 */
323 char cb[48] __aligned(8); 329 char cb[48] __aligned(8);
324 330
325 unsigned long _skb_dst; 331 unsigned long _skb_refdst;
326#ifdef CONFIG_XFRM 332#ifdef CONFIG_XFRM
327 struct sec_path *sp; 333 struct sec_path *sp;
328#endif 334#endif
@@ -369,6 +375,8 @@ struct sk_buff {
369#endif 375#endif
370#endif 376#endif
371 377
378 __u32 rxhash;
379
372 kmemcheck_bitfield_begin(flags2); 380 kmemcheck_bitfield_begin(flags2);
373 __u16 queue_mapping:16; 381 __u16 queue_mapping:16;
374#ifdef CONFIG_IPV6_NDISC_NODETYPE 382#ifdef CONFIG_IPV6_NDISC_NODETYPE
@@ -411,14 +419,64 @@ struct sk_buff {
411 419
412#include <asm/system.h> 420#include <asm/system.h>
413 421
422/*
423 * skb might have a dst pointer attached, refcounted or not.
424 * _skb_refdst low order bit is set if refcount was _not_ taken
425 */
426#define SKB_DST_NOREF 1UL
427#define SKB_DST_PTRMASK ~(SKB_DST_NOREF)
428
429/**
430 * skb_dst - returns skb dst_entry
431 * @skb: buffer
432 *
433 * Returns skb dst_entry, regardless of reference taken or not.
434 */
414static inline struct dst_entry *skb_dst(const struct sk_buff *skb) 435static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
415{ 436{
416 return (struct dst_entry *)skb->_skb_dst; 437 /* If refdst was not refcounted, check we still are in a
438 * rcu_read_lock section
439 */
440 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) &&
441 !rcu_read_lock_held() &&
442 !rcu_read_lock_bh_held());
443 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK);
417} 444}
418 445
446/**
447 * skb_dst_set - sets skb dst
448 * @skb: buffer
449 * @dst: dst entry
450 *
451 * Sets skb dst, assuming a reference was taken on dst and should
452 * be released by skb_dst_drop()
453 */
419static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) 454static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
420{ 455{
421 skb->_skb_dst = (unsigned long)dst; 456 skb->_skb_refdst = (unsigned long)dst;
457}
458
459/**
460 * skb_dst_set_noref - sets skb dst, without a reference
461 * @skb: buffer
462 * @dst: dst entry
463 *
464 * Sets skb dst, assuming a reference was not taken on dst
465 * skb_dst_drop() should not dst_release() this dst
466 */
467static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
468{
469 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
470 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
471}
472
473/**
474 * skb_dst_is_noref - Test if skb dst isnt refcounted
475 * @skb: buffer
476 */
477static inline bool skb_dst_is_noref(const struct sk_buff *skb)
478{
479 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb);
422} 480}
423 481
424static inline struct rtable *skb_rtable(const struct sk_buff *skb) 482static inline struct rtable *skb_rtable(const struct sk_buff *skb)
@@ -467,11 +525,6 @@ extern int skb_cow_data(struct sk_buff *skb, int tailbits,
467 struct sk_buff **trailer); 525 struct sk_buff **trailer);
468extern int skb_pad(struct sk_buff *skb, int pad); 526extern int skb_pad(struct sk_buff *skb, int pad);
469#define dev_kfree_skb(a) consume_skb(a) 527#define dev_kfree_skb(a) consume_skb(a)
470#define dev_consume_skb(a) kfree_skb_clean(a)
471extern void skb_over_panic(struct sk_buff *skb, int len,
472 void *here);
473extern void skb_under_panic(struct sk_buff *skb, int len,
474 void *here);
475 528
476extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 529extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
477 int getfrag(void *from, char *to, int offset, 530 int getfrag(void *from, char *to, int offset,
@@ -1130,6 +1183,11 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
1130 return skb->data += len; 1183 return skb->data += len;
1131} 1184}
1132 1185
1186static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len)
1187{
1188 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1189}
1190
1133extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1191extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1134 1192
1135static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1193static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1353,9 +1411,12 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1353 * 1411 *
1354 * Various parts of the networking layer expect at least 32 bytes of 1412 * Various parts of the networking layer expect at least 32 bytes of
1355 * headroom, you should not reduce this. 1413 * headroom, you should not reduce this.
1414 * With RPS, we raised NET_SKB_PAD to 64 so that get_rps_cpus() fetches span
1415 * a 64 bytes aligned block to fit modern (>= 64 bytes) cache line sizes
1416 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
1356 */ 1417 */
1357#ifndef NET_SKB_PAD 1418#ifndef NET_SKB_PAD
1358#define NET_SKB_PAD 32 1419#define NET_SKB_PAD 64
1359#endif 1420#endif
1360 1421
1361extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1422extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h
index 8a060a7040d8..bb947dd1fba9 100644
--- a/include/linux/smb_fs_sb.h
+++ b/include/linux/smb_fs_sb.h
@@ -10,6 +10,7 @@
10#define _SMB_FS_SB 10#define _SMB_FS_SB
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/backing-dev.h>
13#include <linux/smb.h> 14#include <linux/smb.h>
14 15
15/* 16/*
@@ -74,6 +75,8 @@ struct smb_sb_info {
74 struct smb_ops *ops; 75 struct smb_ops *ops;
75 76
76 struct super_block *super_block; 77 struct super_block *super_block;
78
79 struct backing_dev_info bdi;
77}; 80};
78 81
79static inline int 82static inline int
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 4435d1084755..52797714ade7 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -100,6 +100,7 @@ enum
100 ICMP6_MIB_INMSGS, /* InMsgs */ 100 ICMP6_MIB_INMSGS, /* InMsgs */
101 ICMP6_MIB_INERRORS, /* InErrors */ 101 ICMP6_MIB_INERRORS, /* InErrors */
102 ICMP6_MIB_OUTMSGS, /* OutMsgs */ 102 ICMP6_MIB_OUTMSGS, /* OutMsgs */
103 ICMP6_MIB_OUTERRORS, /* OutErrors */
103 __ICMP6_MIB_MAX 104 __ICMP6_MIB_MAX
104}; 105};
105 106
@@ -227,6 +228,7 @@ enum
227 LINUX_MIB_SACKSHIFTFALLBACK, 228 LINUX_MIB_SACKSHIFTFALLBACK,
228 LINUX_MIB_TCPBACKLOGDROP, 229 LINUX_MIB_TCPBACKLOGDROP,
229 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ 230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP,
230 __LINUX_MIB_MAX 232 __LINUX_MIB_MAX
231}; 233};
232 234
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 354cc5617f8b..032a19eb61b1 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -189,7 +189,8 @@ struct ucred {
189#define AF_ISDN 34 /* mISDN sockets */ 189#define AF_ISDN 34 /* mISDN sockets */
190#define AF_PHONET 35 /* Phonet sockets */ 190#define AF_PHONET 35 /* Phonet sockets */
191#define AF_IEEE802154 36 /* IEEE802154 sockets */ 191#define AF_IEEE802154 36 /* IEEE802154 sockets */
192#define AF_MAX 37 /* For now.. */ 192#define AF_CAIF 37 /* CAIF sockets */
193#define AF_MAX 38 /* For now.. */
193 194
194/* Protocol families, same as address families. */ 195/* Protocol families, same as address families. */
195#define PF_UNSPEC AF_UNSPEC 196#define PF_UNSPEC AF_UNSPEC
@@ -229,6 +230,7 @@ struct ucred {
229#define PF_ISDN AF_ISDN 230#define PF_ISDN AF_ISDN
230#define PF_PHONET AF_PHONET 231#define PF_PHONET AF_PHONET
231#define PF_IEEE802154 AF_IEEE802154 232#define PF_IEEE802154 AF_IEEE802154
233#define PF_CAIF AF_CAIF
232#define PF_MAX AF_MAX 234#define PF_MAX AF_MAX
233 235
234/* Maximum queue length specifiable by listen. */ 236/* Maximum queue length specifiable by listen. */
@@ -301,6 +303,7 @@ struct ucred {
301#define SOL_PNPIPE 275 303#define SOL_PNPIPE 275
302#define SOL_RDS 276 304#define SOL_RDS 276
303#define SOL_IUCV 277 305#define SOL_IUCV 277
306#define SOL_CAIF 278
304 307
305/* IPX options */ 308/* IPX options */
306#define IPX_TYPE 1 309#define IPX_TYPE 1
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
index aed64ed3dc8a..a223ecbc71ef 100644
--- a/include/linux/spi/wl12xx.h
+++ b/include/linux/spi/wl12xx.h
@@ -26,6 +26,8 @@
26 26
27struct wl12xx_platform_data { 27struct wl12xx_platform_data {
28 void (*set_power)(bool enable); 28 void (*set_power)(bool enable);
29 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
30 int irq;
29 bool use_eeprom; 31 bool use_eeprom;
30}; 32};
31 33
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 18e7c7c0cae6..997c3b4c212b 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -82,4 +82,11 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *,
82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
83 splice_direct_actor *); 83 splice_direct_actor *);
84 84
85/*
86 * for dynamic pipe sizing
87 */
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *,
90 struct splice_pipe_desc *);
91
85#endif 92#endif
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 4d5ecb222af9..4d5d2f546dbf 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -27,6 +27,8 @@
27#ifndef _LINUX_SRCU_H 27#ifndef _LINUX_SRCU_H
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h>
31
30struct srcu_struct_array { 32struct srcu_struct_array {
31 int c[2]; 33 int c[2];
32}; 34};
@@ -84,8 +86,8 @@ long srcu_batches_completed(struct srcu_struct *sp);
84/** 86/**
85 * srcu_read_lock_held - might we be in SRCU read-side critical section? 87 * srcu_read_lock_held - might we be in SRCU read-side critical section?
86 * 88 *
87 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in 89 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU
88 * an SRCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, 90 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
89 * this assumes we are in an SRCU read-side critical section unless it can 91 * this assumes we are in an SRCU read-side critical section unless it can
90 * prove otherwise. 92 * prove otherwise.
91 */ 93 */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 24f988547361..a2608bff9c78 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -305,6 +305,7 @@ struct ssb_bus {
305 /* ID information about the Chip. */ 305 /* ID information about the Chip. */
306 u16 chip_id; 306 u16 chip_id;
307 u16 chip_rev; 307 u16 chip_rev;
308 u16 sprom_offset;
308 u16 sprom_size; /* number of words in sprom */ 309 u16 sprom_size; /* number of words in sprom */
309 u8 chip_package; 310 u8 chip_package;
310 311
@@ -394,6 +395,9 @@ extern int ssb_bus_sdiobus_register(struct ssb_bus *bus,
394 395
395extern void ssb_bus_unregister(struct ssb_bus *bus); 396extern void ssb_bus_unregister(struct ssb_bus *bus);
396 397
398/* Does the device have an SPROM? */
399extern bool ssb_is_sprom_available(struct ssb_bus *bus);
400
397/* Set a fallback SPROM. 401/* Set a fallback SPROM.
398 * See kdoc at the function definition for complete documentation. */ 402 * See kdoc at the function definition for complete documentation. */
399extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom); 403extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 4e27acf0a92f..2cdf249b4e5f 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -53,6 +53,7 @@
53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ 53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */
54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ 54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */
55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ 55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */
56#define SSB_CHIPCO_CAP_SPROM 0x40000000 /* SPROM present */
56#define SSB_CHIPCO_CORECTL 0x0008 57#define SSB_CHIPCO_CORECTL 0x0008
57#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ 58#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
58#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ 59#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
@@ -385,6 +386,7 @@
385 386
386 387
387/** Chip specific Chip-Status register contents. */ 388/** Chip specific Chip-Status register contents. */
389#define SSB_CHIPCO_CHST_4322_SPROM_EXISTS 0x00000040 /* SPROM present */
388#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 390#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003
389#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ 391#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */
390#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ 392#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
@@ -398,6 +400,18 @@
398#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 400#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4
399#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ 401#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */
400 402
403/** Macros to determine SPROM presence based on Chip-Status register. */
404#define SSB_CHIPCO_CHST_4312_SPROM_PRESENT(status) \
405 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
406 SSB_CHIPCO_CHST_4325_OTP_SEL)
407#define SSB_CHIPCO_CHST_4322_SPROM_PRESENT(status) \
408 (status & SSB_CHIPCO_CHST_4322_SPROM_EXISTS)
409#define SSB_CHIPCO_CHST_4325_SPROM_PRESENT(status) \
410 (((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
411 SSB_CHIPCO_CHST_4325_DEFCIS_SEL) && \
412 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
413 SSB_CHIPCO_CHST_4325_OTP_SEL))
414
401 415
402 416
403/** Clockcontrol masks and values **/ 417/** Clockcontrol masks and values **/
@@ -564,6 +578,7 @@ struct ssb_chipcommon_pmu {
564struct ssb_chipcommon { 578struct ssb_chipcommon {
565 struct ssb_device *dev; 579 struct ssb_device *dev;
566 u32 capabilities; 580 u32 capabilities;
581 u32 status;
567 /* Fast Powerup Delay constant */ 582 /* Fast Powerup Delay constant */
568 u16 fast_pwrup_delay; 583 u16 fast_pwrup_delay;
569 struct ssb_chipcommon_pmu pmu; 584 struct ssb_chipcommon_pmu pmu;
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 9ae9082eaeb4..a6d5225b9275 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -170,26 +170,27 @@
170#define SSB_SPROMSIZE_WORDS_R4 220 170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
173#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE1 0x1000
174#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_BASE31 0x0800
175#define SSB_SPROM_REVISION 0x007E
175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 176#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 177#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
177#define SSB_SPROM_REVISION_CRC_SHIFT 8 178#define SSB_SPROM_REVISION_CRC_SHIFT 8
178 179
179/* SPROM Revision 1 */ 180/* SPROM Revision 1 */
180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 181#define SSB_SPROM1_SPID 0x0004 /* Subsystem Product ID for PCI */
181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 182#define SSB_SPROM1_SVID 0x0006 /* Subsystem Vendor ID for PCI */
182#define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */ 183#define SSB_SPROM1_PID 0x0008 /* Product ID for PCI */
183#define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */ 184#define SSB_SPROM1_IL0MAC 0x0048 /* 6 bytes MAC address for 802.11b/g */
184#define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */ 185#define SSB_SPROM1_ET0MAC 0x004E /* 6 bytes MAC address for Ethernet */
185#define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */ 186#define SSB_SPROM1_ET1MAC 0x0054 /* 6 bytes MAC address for 802.11a */
186#define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */ 187#define SSB_SPROM1_ETHPHY 0x005A /* Ethernet PHY settings */
187#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 188#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
188#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 189#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
189#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5 190#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5
190#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 191#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
191#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 192#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
192#define SSB_SPROM1_BINF 0x105C /* Board info */ 193#define SSB_SPROM1_BINF 0x005C /* Board info */
193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 194#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 195#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
195#define SSB_SPROM1_BINF_CCODE_SHIFT 8 196#define SSB_SPROM1_BINF_CCODE_SHIFT 8
@@ -197,63 +198,63 @@
197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12 198#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */ 199#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
199#define SSB_SPROM1_BINF_ANTA_SHIFT 14 200#define SSB_SPROM1_BINF_ANTA_SHIFT 14
200#define SSB_SPROM1_PA0B0 0x105E 201#define SSB_SPROM1_PA0B0 0x005E
201#define SSB_SPROM1_PA0B1 0x1060 202#define SSB_SPROM1_PA0B1 0x0060
202#define SSB_SPROM1_PA0B2 0x1062 203#define SSB_SPROM1_PA0B2 0x0062
203#define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */ 204#define SSB_SPROM1_GPIOA 0x0064 /* General Purpose IO pins 0 and 1 */
204#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */ 205#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */
205#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */ 206#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */
206#define SSB_SPROM1_GPIOA_P1_SHIFT 8 207#define SSB_SPROM1_GPIOA_P1_SHIFT 8
207#define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */ 208#define SSB_SPROM1_GPIOB 0x0066 /* General Purpuse IO pins 2 and 3 */
208#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */ 209#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */
209#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */ 210#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
210#define SSB_SPROM1_GPIOB_P3_SHIFT 8 211#define SSB_SPROM1_GPIOB_P3_SHIFT 8
211#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */ 212#define SSB_SPROM1_MAXPWR 0x0068 /* Power Amplifier Max Power */
212#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */ 213#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
213#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */ 214#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
214#define SSB_SPROM1_MAXPWR_A_SHIFT 8 215#define SSB_SPROM1_MAXPWR_A_SHIFT 8
215#define SSB_SPROM1_PA1B0 0x106A 216#define SSB_SPROM1_PA1B0 0x006A
216#define SSB_SPROM1_PA1B1 0x106C 217#define SSB_SPROM1_PA1B1 0x006C
217#define SSB_SPROM1_PA1B2 0x106E 218#define SSB_SPROM1_PA1B2 0x006E
218#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */ 219#define SSB_SPROM1_ITSSI 0x0070 /* Idle TSSI Target */
219#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/ 220#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
220#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */ 221#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
221#define SSB_SPROM1_ITSSI_A_SHIFT 8 222#define SSB_SPROM1_ITSSI_A_SHIFT 8
222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 223#define SSB_SPROM1_BFLLO 0x0072 /* Boardflags (low 16 bits) */
223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 224#define SSB_SPROM1_AGAIN 0x0074 /* Antenna Gain (in dBm Q5.2) */
224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
225#define SSB_SPROM1_AGAIN_BG_SHIFT 0 226#define SSB_SPROM1_AGAIN_BG_SHIFT 0
226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 227#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
227#define SSB_SPROM1_AGAIN_A_SHIFT 8 228#define SSB_SPROM1_AGAIN_A_SHIFT 8
228 229
229/* SPROM Revision 2 (inherits from rev 1) */ 230/* SPROM Revision 2 (inherits from rev 1) */
230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 231#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 232#define SSB_SPROM2_MAXP_A 0x003A /* A-PHY Max Power */
232#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */ 233#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */
233#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */ 234#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */
234#define SSB_SPROM2_MAXP_A_LO_SHIFT 8 235#define SSB_SPROM2_MAXP_A_LO_SHIFT 8
235#define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */ 236#define SSB_SPROM2_PA1LOB0 0x003C /* A-PHY PowerAmplifier Low Settings */
236#define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */ 237#define SSB_SPROM2_PA1LOB1 0x003E /* A-PHY PowerAmplifier Low Settings */
237#define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */ 238#define SSB_SPROM2_PA1LOB2 0x0040 /* A-PHY PowerAmplifier Low Settings */
238#define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */ 239#define SSB_SPROM2_PA1HIB0 0x0042 /* A-PHY PowerAmplifier High Settings */
239#define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */ 240#define SSB_SPROM2_PA1HIB1 0x0044 /* A-PHY PowerAmplifier High Settings */
240#define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */ 241#define SSB_SPROM2_PA1HIB2 0x0046 /* A-PHY PowerAmplifier High Settings */
241#define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */ 242#define SSB_SPROM2_OPO 0x0078 /* OFDM Power Offset from CCK Level */
242#define SSB_SPROM2_OPO_VALUE 0x00FF 243#define SSB_SPROM2_OPO_VALUE 0x00FF
243#define SSB_SPROM2_OPO_UNUSED 0xFF00 244#define SSB_SPROM2_OPO_UNUSED 0xFF00
244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 245#define SSB_SPROM2_CCODE 0x007C /* Two char Country Code */
245 246
246/* SPROM Revision 3 (inherits most data from rev 2) */ 247/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ 248#define SSB_SPROM3_OFDMAPO 0x002C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
248#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 249#define SSB_SPROM3_OFDMALPO 0x0030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
249#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAHPO 0x0034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
250#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_GPIOLDC 0x0042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
251#define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */ 252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */
253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8 253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8
254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */ 254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */
255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16 255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16
256#define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */ 256#define SSB_SPROM3_IL0MAC 0x004A /* 6 bytes MAC address for 802.11b/g */
257#define SSB_SPROM3_CCKPO 0x0078 /* CCK Power Offset */
257#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */ 258#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */
258#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */ 259#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */
259#define SSB_SPROM3_CCKPO_2M_SHIFT 4 260#define SSB_SPROM3_CCKPO_2M_SHIFT 4
@@ -264,100 +265,100 @@
264#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 265#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
265 266
266/* SPROM Revision 4 */ 267/* SPROM Revision 4 */
267#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ 268#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
268#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ 269#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
270#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
271#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
272#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
273#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
274#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
275#define SSB_SPROM4_GPIOA_P1_SHIFT 8
276#define SSB_SPROM4_GPIOB 0x0058 /* Gen. Purpose IO # 2 and 3 */
277#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
278#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
279#define SSB_SPROM4_GPIOB_P3_SHIFT 8
280#define SSB_SPROM4_ETHPHY 0x005A /* Ethernet PHY settings ?? */
269#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 281#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
270#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 282#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
271#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 283#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
272#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 284#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
273#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 285#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
274#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */ 286#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */
275#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */ 287#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
276#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ 288#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
277#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 289#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
278#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ 290#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
279#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 291#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
280#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
281#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
282#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ 292#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
283#define SSB_SPROM4_AGAIN0_SHIFT 0 293#define SSB_SPROM4_AGAIN0_SHIFT 0
284#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */ 294#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
285#define SSB_SPROM4_AGAIN1_SHIFT 8 295#define SSB_SPROM4_AGAIN1_SHIFT 8
286#define SSB_SPROM4_AGAIN23 0x1060 296#define SSB_SPROM4_AGAIN23 0x0060
287#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */ 297#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
288#define SSB_SPROM4_AGAIN2_SHIFT 0 298#define SSB_SPROM4_AGAIN2_SHIFT 0
289#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 299#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
290#define SSB_SPROM4_AGAIN3_SHIFT 8 300#define SSB_SPROM4_AGAIN3_SHIFT 8
291#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */ 301#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
292#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
293#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 302#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
294#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 303#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
295#define SSB_SPROM4_ITSSI_BG_SHIFT 8 304#define SSB_SPROM4_ITSSI_BG_SHIFT 8
296#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */ 305#define SSB_SPROM4_MAXP_A 0x008A /* Max Power A in path 1 */
297#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ 306#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
298#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 307#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
299#define SSB_SPROM4_ITSSI_A_SHIFT 8 308#define SSB_SPROM4_ITSSI_A_SHIFT 8
300#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */ 309#define SSB_SPROM4_PA0B0 0x0082 /* The paXbY locations are */
301#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */ 310#define SSB_SPROM4_PA0B1 0x0084 /* only guesses */
302#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */ 311#define SSB_SPROM4_PA0B2 0x0086
303#define SSB_SPROM4_GPIOA_P1_SHIFT 8 312#define SSB_SPROM4_PA1B0 0x008E
304#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */ 313#define SSB_SPROM4_PA1B1 0x0090
305#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */ 314#define SSB_SPROM4_PA1B2 0x0092
306#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
307#define SSB_SPROM4_GPIOB_P3_SHIFT 8
308#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
309#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
310#define SSB_SPROM4_PA0B2 0x1086
311#define SSB_SPROM4_PA1B0 0x108E
312#define SSB_SPROM4_PA1B1 0x1090
313#define SSB_SPROM4_PA1B2 0x1092
314 315
315/* SPROM Revision 5 (inherits most data from rev 4) */ 316/* SPROM Revision 5 (inherits most data from rev 4) */
316#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ 317#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
317#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ 318#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
318#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ 319#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
319#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ 320#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
320#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ 321#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
321#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ 322#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
322#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ 323#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
323#define SSB_SPROM5_GPIOA_P1_SHIFT 8 324#define SSB_SPROM5_GPIOA_P1_SHIFT 8
324#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ 325#define SSB_SPROM5_GPIOB 0x0078 /* Gen. Purpose IO # 2 and 3 */
325#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ 326#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ 327#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 328#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 329
329/* SPROM Revision 8 */ 330/* SPROM Revision 8 */
330#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */ 331#define SSB_SPROM8_BOARDREV 0x0082 /* Board revision */
331#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */ 332#define SSB_SPROM8_BFLLO 0x0084 /* Board flags (bits 0-15) */
332#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */ 333#define SSB_SPROM8_BFLHI 0x0086 /* Board flags (bits 16-31) */
333#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */ 334#define SSB_SPROM8_BFL2LO 0x0088 /* Board flags (bits 32-47) */
334#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */ 335#define SSB_SPROM8_BFL2HI 0x008A /* Board flags (bits 48-63) */
335#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ 336#define SSB_SPROM8_IL0MAC 0x008C /* 6 byte MAC address */
336#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ 337#define SSB_SPROM8_CCODE 0x0092 /* 2 byte country code */
337#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ 338#define SSB_SPROM8_GPIOA 0x0096 /*Gen. Purpose IO # 0 and 1 */
338#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 339#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
339#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 340#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
340#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ 341#define SSB_SPROM8_GPIOA_P1_SHIFT 8
341#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0 342#define SSB_SPROM8_GPIOB 0x0098 /* Gen. Purpose IO # 2 and 3 */
342#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */ 343#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
344#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
345#define SSB_SPROM8_GPIOB_P3_SHIFT 8
346#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
347#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
348#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
349#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
350#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
351#define SSB_SPROM8_AGAIN01 0x009E /* Antenna Gain (in dBm Q5.2) */
343#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */ 352#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
344#define SSB_SPROM8_AGAIN0_SHIFT 0 353#define SSB_SPROM8_AGAIN0_SHIFT 0
345#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */ 354#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
346#define SSB_SPROM8_AGAIN1_SHIFT 8 355#define SSB_SPROM8_AGAIN1_SHIFT 8
347#define SSB_SPROM8_AGAIN23 0x10A0 356#define SSB_SPROM8_AGAIN23 0x00A0
348#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */ 357#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
349#define SSB_SPROM8_AGAIN2_SHIFT 0 358#define SSB_SPROM8_AGAIN2_SHIFT 0
350#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 359#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
351#define SSB_SPROM8_AGAIN3_SHIFT 8 360#define SSB_SPROM8_AGAIN3_SHIFT 8
352#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */ 361#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
353#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
354#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
355#define SSB_SPROM8_GPIOA_P1_SHIFT 8
356#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
357#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
358#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
359#define SSB_SPROM8_GPIOB_P3_SHIFT 8
360#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
361#define SSB_SPROM8_RSSISMF2G 0x000F 362#define SSB_SPROM8_RSSISMF2G 0x000F
362#define SSB_SPROM8_RSSISMC2G 0x00F0 363#define SSB_SPROM8_RSSISMC2G 0x00F0
363#define SSB_SPROM8_RSSISMC2G_SHIFT 4 364#define SSB_SPROM8_RSSISMC2G_SHIFT 4
@@ -365,7 +366,7 @@
365#define SSB_SPROM8_RSSISAV2G_SHIFT 8 366#define SSB_SPROM8_RSSISAV2G_SHIFT 8
366#define SSB_SPROM8_BXA2G 0x1800 367#define SSB_SPROM8_BXA2G 0x1800
367#define SSB_SPROM8_BXA2G_SHIFT 11 368#define SSB_SPROM8_BXA2G_SHIFT 11
368#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */ 369#define SSB_SPROM8_RSSIPARM5G 0x00A6 /* RSSI params for 5GHz */
369#define SSB_SPROM8_RSSISMF5G 0x000F 370#define SSB_SPROM8_RSSISMF5G 0x000F
370#define SSB_SPROM8_RSSISMC5G 0x00F0 371#define SSB_SPROM8_RSSISMC5G 0x00F0
371#define SSB_SPROM8_RSSISMC5G_SHIFT 4 372#define SSB_SPROM8_RSSISMC5G_SHIFT 4
@@ -373,47 +374,47 @@
373#define SSB_SPROM8_RSSISAV5G_SHIFT 8 374#define SSB_SPROM8_RSSISAV5G_SHIFT 8
374#define SSB_SPROM8_BXA5G 0x1800 375#define SSB_SPROM8_BXA5G 0x1800
375#define SSB_SPROM8_BXA5G_SHIFT 11 376#define SSB_SPROM8_BXA5G_SHIFT 11
376#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */ 377#define SSB_SPROM8_TRI25G 0x00A8 /* TX isolation 2.4&5.3GHz */
377#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */ 378#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
378#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */ 379#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
379#define SSB_SPROM8_TRI5G_SHIFT 8 380#define SSB_SPROM8_TRI5G_SHIFT 8
380#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */ 381#define SSB_SPROM8_TRI5GHL 0x00AA /* TX isolation 5.2/5.8GHz */
381#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */ 382#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
382#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */ 383#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
383#define SSB_SPROM8_TRI5GH_SHIFT 8 384#define SSB_SPROM8_TRI5GH_SHIFT 8
384#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */ 385#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
385#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 386#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
386#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 387#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
387#define SSB_SPROM8_RXPO5G_SHIFT 8 388#define SSB_SPROM8_RXPO5G_SHIFT 8
388#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */ 389#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
389#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 390#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
390#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 391#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
391#define SSB_SPROM8_ITSSI_BG_SHIFT 8 392#define SSB_SPROM8_ITSSI_BG_SHIFT 8
392#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */ 393#define SSB_SPROM8_PA0B0 0x00C2 /* 2GHz power amp settings */
393#define SSB_SPROM8_PA0B1 0x10C4 394#define SSB_SPROM8_PA0B1 0x00C4
394#define SSB_SPROM8_PA0B2 0x10C6 395#define SSB_SPROM8_PA0B2 0x00C6
395#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */ 396#define SSB_SPROM8_MAXP_A 0x00C8 /* Max Power 5.3GHz */
396#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */ 397#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
397#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 398#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
398#define SSB_SPROM8_ITSSI_A_SHIFT 8 399#define SSB_SPROM8_ITSSI_A_SHIFT 8
399#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */ 400#define SSB_SPROM8_MAXP_AHL 0x00CA /* Max Power 5.2/5.8GHz */
400#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */ 401#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */
401#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */ 402#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */
402#define SSB_SPROM8_MAXP_AL_SHIFT 8 403#define SSB_SPROM8_MAXP_AL_SHIFT 8
403#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */ 404#define SSB_SPROM8_PA1B0 0x00CC /* 5.3GHz power amp settings */
404#define SSB_SPROM8_PA1B1 0x10CE 405#define SSB_SPROM8_PA1B1 0x00CE
405#define SSB_SPROM8_PA1B2 0x10D0 406#define SSB_SPROM8_PA1B2 0x00D0
406#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */ 407#define SSB_SPROM8_PA1LOB0 0x00D2 /* 5.2GHz power amp settings */
407#define SSB_SPROM8_PA1LOB1 0x10D4 408#define SSB_SPROM8_PA1LOB1 0x00D4
408#define SSB_SPROM8_PA1LOB2 0x10D6 409#define SSB_SPROM8_PA1LOB2 0x00D6
409#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */ 410#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
410#define SSB_SPROM8_PA1HIB1 0x10DA 411#define SSB_SPROM8_PA1HIB1 0x00DA
411#define SSB_SPROM8_PA1HIB2 0x10DC 412#define SSB_SPROM8_PA1HIB2 0x00DC
412#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */ 413#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
413#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */ 414#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
414#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */ 415#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
415#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */ 416#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
416#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */ 417#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
417 418
418/* Values for SSB_SPROM1_BINF_CCODE */ 419/* Values for SSB_SPROM1_BINF_CCODE */
419enum { 420enum {
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 32bfd1a8a48d..632ff7c03280 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -33,6 +33,7 @@ struct plat_stmmacenet_data {
33 int bus_id; 33 int bus_id;
34 int pbl; 34 int pbl;
35 int has_gmac; 35 int has_gmac;
36 int enh_desc;
36 void (*fix_mac_speed)(void *priv, unsigned int speed); 37 void (*fix_mac_speed)(void *priv, unsigned int speed);
37 void (*bus_setup)(unsigned long ioaddr); 38 void (*bus_setup)(unsigned long ioaddr);
38#ifdef CONFIG_STM_DRIVERS 39#ifdef CONFIG_STM_DRIVERS
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index baba3a23a814..6b524a0d02e4 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -1,13 +1,101 @@
1#ifndef _LINUX_STOP_MACHINE 1#ifndef _LINUX_STOP_MACHINE
2#define _LINUX_STOP_MACHINE 2#define _LINUX_STOP_MACHINE
3/* "Bogolock": stop the entire machine, disable interrupts. This is a 3
4 very heavy lock, which is equivalent to grabbing every spinlock
5 (and more). So the "read" side to such a lock is anything which
6 disables preeempt. */
7#include <linux/cpu.h> 4#include <linux/cpu.h>
8#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/list.h>
9#include <asm/system.h> 7#include <asm/system.h>
10 8
9/*
10 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu
11 * monopolization mechanism. The caller can specify a non-sleeping
12 * function to be executed on a single or multiple cpus preempting all
13 * other processes and monopolizing those cpus until it finishes.
14 *
15 * Resources for this mechanism are preallocated when a cpu is brought
16 * up and requests are guaranteed to be served as long as the target
17 * cpus are online.
18 */
19typedef int (*cpu_stop_fn_t)(void *arg);
20
21#ifdef CONFIG_SMP
22
23struct cpu_stop_work {
24 struct list_head list; /* cpu_stopper->works */
25 cpu_stop_fn_t fn;
26 void *arg;
27 struct cpu_stop_done *done;
28};
29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
34int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
35
36#else /* CONFIG_SMP */
37
38#include <linux/workqueue.h>
39
40struct cpu_stop_work {
41 struct work_struct work;
42 cpu_stop_fn_t fn;
43 void *arg;
44};
45
46static inline int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
47{
48 int ret = -ENOENT;
49 preempt_disable();
50 if (cpu == smp_processor_id())
51 ret = fn(arg);
52 preempt_enable();
53 return ret;
54}
55
56static void stop_one_cpu_nowait_workfn(struct work_struct *work)
57{
58 struct cpu_stop_work *stwork =
59 container_of(work, struct cpu_stop_work, work);
60 preempt_disable();
61 stwork->fn(stwork->arg);
62 preempt_enable();
63}
64
65static inline void stop_one_cpu_nowait(unsigned int cpu,
66 cpu_stop_fn_t fn, void *arg,
67 struct cpu_stop_work *work_buf)
68{
69 if (cpu == smp_processor_id()) {
70 INIT_WORK(&work_buf->work, stop_one_cpu_nowait_workfn);
71 work_buf->fn = fn;
72 work_buf->arg = arg;
73 schedule_work(&work_buf->work);
74 }
75}
76
77static inline int stop_cpus(const struct cpumask *cpumask,
78 cpu_stop_fn_t fn, void *arg)
79{
80 if (cpumask_test_cpu(raw_smp_processor_id(), cpumask))
81 return stop_one_cpu(raw_smp_processor_id(), fn, arg);
82 return -ENOENT;
83}
84
85static inline int try_stop_cpus(const struct cpumask *cpumask,
86 cpu_stop_fn_t fn, void *arg)
87{
88 return stop_cpus(cpumask, fn, arg);
89}
90
91#endif /* CONFIG_SMP */
92
93/*
94 * stop_machine "Bogolock": stop the entire machine, disable
95 * interrupts. This is a very heavy lock, which is equivalent to
96 * grabbing every spinlock (and more). So the "read" side to such a
97 * lock is anything which disables preeempt.
98 */
11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 99#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12 100
13/** 101/**
@@ -36,24 +124,7 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
36 */ 124 */
37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 125int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38 126
39/** 127#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
56#else
57 128
58static inline int stop_machine(int (*fn)(void *), void *data, 129static inline int stop_machine(int (*fn)(void *), void *data,
59 const struct cpumask *cpus) 130 const struct cpumask *cpus)
@@ -65,8 +136,5 @@ static inline int stop_machine(int (*fn)(void *), void *data,
65 return ret; 136 return ret;
66} 137}
67 138
68static inline int stop_machine_create(void) { return 0; } 139#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */
69static inline void stop_machine_destroy(void) { } 140#endif /* _LINUX_STOP_MACHINE */
70
71#endif /* CONFIG_SMP */
72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 996df4dac7d4..87d7ec0bf779 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -54,6 +54,7 @@ struct rpc_cred {
54#define RPCAUTH_CRED_NEW 0 54#define RPCAUTH_CRED_NEW 0
55#define RPCAUTH_CRED_UPTODATE 1 55#define RPCAUTH_CRED_UPTODATE 1
56#define RPCAUTH_CRED_HASHED 2 56#define RPCAUTH_CRED_HASHED 2
57#define RPCAUTH_CRED_NEGATIVE 3
57 58
58#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 59#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
59 60
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index d48d4e605f74..671538d25bc1 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,6 +82,7 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx *gc_ctx; 83 struct gss_cl_ctx *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 unsigned long gc_upcall_timestamp;
85 unsigned char gc_machine_cred : 1; 86 unsigned char gc_machine_cred : 1;
86}; 87};
87 88
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 03f33330ece2..5d8048beb051 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -35,7 +35,8 @@ int gss_import_sec_context(
35 const void* input_token, 35 const void* input_token,
36 size_t bufsize, 36 size_t bufsize,
37 struct gss_api_mech *mech, 37 struct gss_api_mech *mech,
38 struct gss_ctx **ctx_id); 38 struct gss_ctx **ctx_id,
39 gfp_t gfp_mask);
39u32 gss_get_mic( 40u32 gss_get_mic(
40 struct gss_ctx *ctx_id, 41 struct gss_ctx *ctx_id,
41 struct xdr_buf *message, 42 struct xdr_buf *message,
@@ -80,6 +81,8 @@ struct gss_api_mech {
80 /* pseudoflavors supported by this mechanism: */ 81 /* pseudoflavors supported by this mechanism: */
81 int gm_pf_num; 82 int gm_pf_num;
82 struct pf_desc * gm_pfs; 83 struct pf_desc * gm_pfs;
84 /* Should the following be a callback operation instead? */
85 const char *gm_upcall_enctypes;
83}; 86};
84 87
85/* and must provide the following operations: */ 88/* and must provide the following operations: */
@@ -87,7 +90,8 @@ struct gss_api_ops {
87 int (*gss_import_sec_context)( 90 int (*gss_import_sec_context)(
88 const void *input_token, 91 const void *input_token,
89 size_t bufsize, 92 size_t bufsize,
90 struct gss_ctx *ctx_id); 93 struct gss_ctx *ctx_id,
94 gfp_t gfp_mask);
91 u32 (*gss_get_mic)( 95 u32 (*gss_get_mic)(
92 struct gss_ctx *ctx_id, 96 struct gss_ctx *ctx_id,
93 struct xdr_buf *message, 97 struct xdr_buf *message,
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index e7bbdba474d5..5af2931cf58d 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -4,7 +4,7 @@
4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, 4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h,
5 * lib/gssapi/krb5/gssapiP_krb5.h, and others 5 * lib/gssapi/krb5/gssapiP_krb5.h, and others
6 * 6 *
7 * Copyright (c) 2000 The Regents of the University of Michigan. 7 * Copyright (c) 2000-2008 The Regents of the University of Michigan.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Andy Adamson <andros@umich.edu> 10 * Andy Adamson <andros@umich.edu>
@@ -36,17 +36,86 @@
36 * 36 *
37 */ 37 */
38 38
39#include <linux/crypto.h>
39#include <linux/sunrpc/auth_gss.h> 40#include <linux/sunrpc/auth_gss.h>
40#include <linux/sunrpc/gss_err.h> 41#include <linux/sunrpc/gss_err.h>
41#include <linux/sunrpc/gss_asn1.h> 42#include <linux/sunrpc/gss_asn1.h>
42 43
44/* Length of constant used in key derivation */
45#define GSS_KRB5_K5CLENGTH (5)
46
47/* Maximum key length (in bytes) for the supported crypto algorithms*/
48#define GSS_KRB5_MAX_KEYLEN (32)
49
50/* Maximum checksum function output for the supported crypto algorithms */
51#define GSS_KRB5_MAX_CKSUM_LEN (20)
52
53/* Maximum blocksize for the supported crypto algorithms */
54#define GSS_KRB5_MAX_BLOCKSIZE (16)
55
56struct krb5_ctx;
57
58struct gss_krb5_enctype {
59 const u32 etype; /* encryption (key) type */
60 const u32 ctype; /* checksum type */
61 const char *name; /* "friendly" name */
62 const char *encrypt_name; /* crypto encrypt name */
63 const char *cksum_name; /* crypto checksum name */
64 const u16 signalg; /* signing algorithm */
65 const u16 sealalg; /* sealing algorithm */
66 const u32 blocksize; /* encryption blocksize */
67 const u32 conflen; /* confounder length
68 (normally the same as
69 the blocksize) */
70 const u32 cksumlength; /* checksum length */
71 const u32 keyed_cksum; /* is it a keyed cksum? */
72 const u32 keybytes; /* raw key len, in bytes */
73 const u32 keylength; /* final key len, in bytes */
74 u32 (*encrypt) (struct crypto_blkcipher *tfm,
75 void *iv, void *in, void *out,
76 int length); /* encryption function */
77 u32 (*decrypt) (struct crypto_blkcipher *tfm,
78 void *iv, void *in, void *out,
79 int length); /* decryption function */
80 u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,
81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec,
85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip,
88 u32 *tailskip); /* v2 decryption function */
89};
90
91/* krb5_ctx flags definitions */
92#define KRB5_CTX_FLAG_INITIATOR 0x00000001
93#define KRB5_CTX_FLAG_CFX 0x00000002
94#define KRB5_CTX_FLAG_ACCEPTOR_SUBKEY 0x00000004
95
43struct krb5_ctx { 96struct krb5_ctx {
44 int initiate; /* 1 = initiating, 0 = accepting */ 97 int initiate; /* 1 = initiating, 0 = accepting */
98 u32 enctype;
99 u32 flags;
100 const struct gss_krb5_enctype *gk5e; /* enctype-specific info */
45 struct crypto_blkcipher *enc; 101 struct crypto_blkcipher *enc;
46 struct crypto_blkcipher *seq; 102 struct crypto_blkcipher *seq;
103 struct crypto_blkcipher *acceptor_enc;
104 struct crypto_blkcipher *initiator_enc;
105 struct crypto_blkcipher *acceptor_enc_aux;
106 struct crypto_blkcipher *initiator_enc_aux;
107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
108 u8 cksum[GSS_KRB5_MAX_KEYLEN];
47 s32 endtime; 109 s32 endtime;
48 u32 seq_send; 110 u32 seq_send;
111 u64 seq_send64;
49 struct xdr_netobj mech_used; 112 struct xdr_netobj mech_used;
113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
115 u8 initiator_seal[GSS_KRB5_MAX_KEYLEN];
116 u8 acceptor_seal[GSS_KRB5_MAX_KEYLEN];
117 u8 initiator_integ[GSS_KRB5_MAX_KEYLEN];
118 u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN];
50}; 119};
51 120
52extern spinlock_t krb5_seq_lock; 121extern spinlock_t krb5_seq_lock;
@@ -57,6 +126,18 @@ extern spinlock_t krb5_seq_lock;
57#define KG_TOK_MIC_MSG 0x0101 126#define KG_TOK_MIC_MSG 0x0101
58#define KG_TOK_WRAP_MSG 0x0201 127#define KG_TOK_WRAP_MSG 0x0201
59 128
129#define KG2_TOK_INITIAL 0x0101
130#define KG2_TOK_RESPONSE 0x0202
131#define KG2_TOK_MIC 0x0404
132#define KG2_TOK_WRAP 0x0504
133
134#define KG2_TOKEN_FLAG_SENTBYACCEPTOR 0x01
135#define KG2_TOKEN_FLAG_SEALED 0x02
136#define KG2_TOKEN_FLAG_ACCEPTORSUBKEY 0x04
137
138#define KG2_RESP_FLAG_ERROR 0x0001
139#define KG2_RESP_FLAG_DELEG_OK 0x0002
140
60enum sgn_alg { 141enum sgn_alg {
61 SGN_ALG_DES_MAC_MD5 = 0x0000, 142 SGN_ALG_DES_MAC_MD5 = 0x0000,
62 SGN_ALG_MD2_5 = 0x0001, 143 SGN_ALG_MD2_5 = 0x0001,
@@ -81,6 +162,9 @@ enum seal_alg {
81#define CKSUMTYPE_RSA_MD5_DES 0x0008 162#define CKSUMTYPE_RSA_MD5_DES 0x0008
82#define CKSUMTYPE_NIST_SHA 0x0009 163#define CKSUMTYPE_NIST_SHA 0x0009
83#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c 164#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c
165#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f
166#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010
167#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /* Microsoft md5 hmac cksumtype */
84 168
85/* from gssapi_err_krb5.h */ 169/* from gssapi_err_krb5.h */
86#define KG_CCACHE_NOMATCH (39756032L) 170#define KG_CCACHE_NOMATCH (39756032L)
@@ -111,11 +195,56 @@ enum seal_alg {
111#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ 195#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */
112#define ENCTYPE_DES_HMAC_SHA1 0x0008 196#define ENCTYPE_DES_HMAC_SHA1 0x0008
113#define ENCTYPE_DES3_CBC_SHA1 0x0010 197#define ENCTYPE_DES3_CBC_SHA1 0x0010
198#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011
199#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012
200#define ENCTYPE_ARCFOUR_HMAC 0x0017
201#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018
114#define ENCTYPE_UNKNOWN 0x01ff 202#define ENCTYPE_UNKNOWN 0x01ff
115 203
116s32 204/*
117make_checksum(char *, char *header, int hdrlen, struct xdr_buf *body, 205 * Constants used for key derivation
118 int body_offset, struct xdr_netobj *cksum); 206 */
207/* for 3DES */
208#define KG_USAGE_SEAL (22)
209#define KG_USAGE_SIGN (23)
210#define KG_USAGE_SEQ (24)
211
212/* from rfc3961 */
213#define KEY_USAGE_SEED_CHECKSUM (0x99)
214#define KEY_USAGE_SEED_ENCRYPTION (0xAA)
215#define KEY_USAGE_SEED_INTEGRITY (0x55)
216
217/* from rfc4121 */
218#define KG_USAGE_ACCEPTOR_SEAL (22)
219#define KG_USAGE_ACCEPTOR_SIGN (23)
220#define KG_USAGE_INITIATOR_SEAL (24)
221#define KG_USAGE_INITIATOR_SIGN (25)
222
223/*
224 * This compile-time check verifies that we will not exceed the
225 * slack space allotted by the client and server auth_gss code
226 * before they call gss_wrap().
227 */
228#define GSS_KRB5_MAX_SLACK_NEEDED \
229 (GSS_KRB5_TOK_HDR_LEN /* gss token header */ \
230 + GSS_KRB5_MAX_CKSUM_LEN /* gss token checksum */ \
231 + GSS_KRB5_MAX_BLOCKSIZE /* confounder */ \
232 + GSS_KRB5_MAX_BLOCKSIZE /* possible padding */ \
233 + GSS_KRB5_TOK_HDR_LEN /* encrypted hdr in v2 token */\
234 + GSS_KRB5_MAX_CKSUM_LEN /* encryption hmac */ \
235 + 4 + 4 /* RPC verifier */ \
236 + GSS_KRB5_TOK_HDR_LEN \
237 + GSS_KRB5_MAX_CKSUM_LEN)
238
239u32
240make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
241 struct xdr_buf *body, int body_offset, u8 *cksumkey,
242 unsigned int usage, struct xdr_netobj *cksumout);
243
244u32
245make_checksum_v2(struct krb5_ctx *, char *header, int hdrlen,
246 struct xdr_buf *body, int body_offset, u8 *key,
247 unsigned int usage, struct xdr_netobj *cksum);
119 248
120u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, 249u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *,
121 struct xdr_netobj *); 250 struct xdr_netobj *);
@@ -149,11 +278,54 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
149 int offset); 278 int offset);
150 279
151s32 280s32
152krb5_make_seq_num(struct crypto_blkcipher *key, 281krb5_make_seq_num(struct krb5_ctx *kctx,
282 struct crypto_blkcipher *key,
153 int direction, 283 int direction,
154 u32 seqnum, unsigned char *cksum, unsigned char *buf); 284 u32 seqnum, unsigned char *cksum, unsigned char *buf);
155 285
156s32 286s32
157krb5_get_seq_num(struct crypto_blkcipher *key, 287krb5_get_seq_num(struct krb5_ctx *kctx,
158 unsigned char *cksum, 288 unsigned char *cksum,
159 unsigned char *buf, int *direction, u32 *seqnum); 289 unsigned char *buf, int *direction, u32 *seqnum);
290
291int
292xdr_extend_head(struct xdr_buf *buf, unsigned int base, unsigned int shiftlen);
293
294u32
295krb5_derive_key(const struct gss_krb5_enctype *gk5e,
296 const struct xdr_netobj *inkey,
297 struct xdr_netobj *outkey,
298 const struct xdr_netobj *in_constant,
299 gfp_t gfp_mask);
300
301u32
302gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e,
303 struct xdr_netobj *randombits,
304 struct xdr_netobj *key);
305
306u32
307gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
308 struct xdr_netobj *randombits,
309 struct xdr_netobj *key);
310
311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec,
314 struct page **pages);
315
316u32
317gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset,
318 struct xdr_buf *buf, u32 *plainoffset,
319 u32 *plainlen);
320
321int
322krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
323 struct crypto_blkcipher *cipher,
324 unsigned char *cksum);
325
326int
327krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
328 struct crypto_blkcipher *cipher,
329 s32 seqnum);
330void
331gss_krb5_make_confounder(char *p, u32 conflen);
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 77f78e56c481..b6edbc0ea83d 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -26,6 +26,7 @@
26#define _LINUX_SUNRPC_METRICS_H 26#define _LINUX_SUNRPC_METRICS_H
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h>
29 30
30#define RPC_IOSTATS_VERS "1.0" 31#define RPC_IOSTATS_VERS "1.0"
31 32
@@ -58,9 +59,9 @@ struct rpc_iostats {
58 * and the total time the request spent from init to release 59 * and the total time the request spent from init to release
59 * are measured. 60 * are measured.
60 */ 61 */
61 unsigned long long om_queue, /* jiffies queued for xmit */ 62 ktime_t om_queue, /* queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */ 63 om_rtt, /* RPC RTT */
63 om_execute; /* jiffies for RPC execution */ 64 om_execute; /* RPC execution */
64} ____cacheline_aligned; 65} ____cacheline_aligned;
65 66
66struct rpc_task; 67struct rpc_task;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 7bc7fd5291ce..7be4f3a6d246 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -10,6 +10,7 @@
10#define _LINUX_SUNRPC_SCHED_H_ 10#define _LINUX_SUNRPC_SCHED_H_
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/ktime.h>
13#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/wait.h> 16#include <linux/wait.h>
@@ -40,21 +41,15 @@ struct rpc_wait {
40 * This is the RPC task struct 41 * This is the RPC task struct
41 */ 42 */
42struct rpc_task { 43struct rpc_task {
43#ifdef RPC_DEBUG
44 unsigned long tk_magic; /* 0xf00baa */
45#endif
46 atomic_t tk_count; /* Reference count */ 44 atomic_t tk_count; /* Reference count */
47 struct list_head tk_task; /* global list of tasks */ 45 struct list_head tk_task; /* global list of tasks */
48 struct rpc_clnt * tk_client; /* RPC client */ 46 struct rpc_clnt * tk_client; /* RPC client */
49 struct rpc_rqst * tk_rqstp; /* RPC request */ 47 struct rpc_rqst * tk_rqstp; /* RPC request */
50 int tk_status; /* result of last operation */
51 48
52 /* 49 /*
53 * RPC call state 50 * RPC call state
54 */ 51 */
55 struct rpc_message tk_msg; /* RPC call info */ 52 struct rpc_message tk_msg; /* RPC call info */
56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry;
58 53
59 /* 54 /*
60 * callback to be executed after waking up 55 * callback to be executed after waking up
@@ -67,7 +62,6 @@ struct rpc_task {
67 void * tk_calldata; 62 void * tk_calldata;
68 63
69 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 64 unsigned long tk_timeout; /* timeout for rpc_sleep() */
70 unsigned short tk_flags; /* misc flags */
71 unsigned long tk_runstate; /* Task run status */ 65 unsigned long tk_runstate; /* Task run status */
72 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 66 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
73 * be any workqueue 67 * be any workqueue
@@ -78,17 +72,19 @@ struct rpc_task {
78 struct rpc_wait tk_wait; /* RPC wait */ 72 struct rpc_wait tk_wait; /* RPC wait */
79 } u; 73 } u;
80 74
81 unsigned short tk_timeouts; /* maj timeouts */ 75 ktime_t tk_start; /* RPC task init timestamp */
82 size_t tk_bytes_sent; /* total bytes sent */
83 unsigned long tk_start; /* RPC task init timestamp */
84 long tk_rtt; /* round-trip time (jiffies) */
85 76
86 pid_t tk_owner; /* Process id for batching tasks */ 77 pid_t tk_owner; /* Process id for batching tasks */
87 unsigned char tk_priority : 2;/* Task priority */ 78 int tk_status; /* result of last operation */
79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */
88 81
89#ifdef RPC_DEBUG 82#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
91#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */
86 tk_garb_retry : 2,
87 tk_cred_retry : 2;
92}; 88};
93#define tk_xprt tk_client->cl_xprt 89#define tk_xprt tk_client->cl_xprt
94 90
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f5cc0898bc53..35cf2e8cd7c6 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -1,7 +1,10 @@
1/* 1/*
2 * include/linux/sunrpc/xdr.h 2 * XDR standard data types and function declarations
3 * 3 *
4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
5 *
6 * Based on:
7 * RFC 4506 "XDR: External Data Representation Standard", May 2006
5 */ 8 */
6 9
7#ifndef _SUNRPC_XDR_H_ 10#ifndef _SUNRPC_XDR_H_
@@ -62,7 +65,6 @@ struct xdr_buf {
62 65
63 unsigned int buflen, /* Total length of storage buffer */ 66 unsigned int buflen, /* Total length of storage buffer */
64 len; /* Length of XDR encoded message */ 67 len; /* Length of XDR encoded message */
65
66}; 68};
67 69
68/* 70/*
@@ -178,7 +180,7 @@ struct xdr_array2_desc {
178}; 180};
179 181
180extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, 182extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
181 struct xdr_array2_desc *desc); 183 struct xdr_array2_desc *desc);
182extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 184extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
183 struct xdr_array2_desc *desc); 185 struct xdr_array2_desc *desc);
184 186
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6f9457a75b8f..b51470302399 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -13,6 +13,7 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <linux/ktime.h>
16#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
17#include <linux/sunrpc/xdr.h> 18#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/msg_prot.h> 19#include <linux/sunrpc/msg_prot.h>
@@ -65,8 +66,6 @@ struct rpc_rqst {
65 struct rpc_task * rq_task; /* RPC task data */ 66 struct rpc_task * rq_task; /* RPC task data */
66 __be32 rq_xid; /* request XID */ 67 __be32 rq_xid; /* request XID */
67 int rq_cong; /* has incremented xprt->cong */ 68 int rq_cong; /* has incremented xprt->cong */
68 int rq_reply_bytes_recvd; /* number of reply */
69 /* bytes received */
70 u32 rq_seqno; /* gss seq no. used on req. */ 69 u32 rq_seqno; /* gss seq no. used on req. */
71 int rq_enc_pages_num; 70 int rq_enc_pages_num;
72 struct page **rq_enc_pages; /* scratch pages for use by 71 struct page **rq_enc_pages; /* scratch pages for use by
@@ -77,12 +76,16 @@ struct rpc_rqst {
77 __u32 * rq_buffer; /* XDR encode buffer */ 76 __u32 * rq_buffer; /* XDR encode buffer */
78 size_t rq_callsize, 77 size_t rq_callsize,
79 rq_rcvsize; 78 rq_rcvsize;
79 size_t rq_xmit_bytes_sent; /* total bytes sent */
80 size_t rq_reply_bytes_recvd; /* total reply bytes */
81 /* received */
80 82
81 struct xdr_buf rq_private_buf; /* The receive buffer 83 struct xdr_buf rq_private_buf; /* The receive buffer
82 * used in the softirq. 84 * used in the softirq.
83 */ 85 */
84 unsigned long rq_majortimeo; /* major timeout alarm */ 86 unsigned long rq_majortimeo; /* major timeout alarm */
85 unsigned long rq_timeout; /* Current timeout value */ 87 unsigned long rq_timeout; /* Current timeout value */
88 ktime_t rq_rtt; /* round-trip time */
86 unsigned int rq_retries; /* # of retries */ 89 unsigned int rq_retries; /* # of retries */
87 unsigned int rq_connect_cookie; 90 unsigned int rq_connect_cookie;
88 /* A cookie used to track the 91 /* A cookie used to track the
@@ -94,7 +97,7 @@ struct rpc_rqst {
94 */ 97 */
95 u32 rq_bytes_sent; /* Bytes we have sent */ 98 u32 rq_bytes_sent; /* Bytes we have sent */
96 99
97 unsigned long rq_xtime; /* when transmitted */ 100 ktime_t rq_xtime; /* transmit time stamp */
98 int rq_ntrans; 101 int rq_ntrans;
99 102
100#if defined(CONFIG_NFS_V4_1) 103#if defined(CONFIG_NFS_V4_1)
@@ -174,8 +177,7 @@ struct rpc_xprt {
174 /* 177 /*
175 * Connection of transports 178 * Connection of transports
176 */ 179 */
177 unsigned long connect_timeout, 180 unsigned long bind_timeout,
178 bind_timeout,
179 reestablish_timeout; 181 reestablish_timeout;
180 unsigned int connect_cookie; /* A cookie that gets bumped 182 unsigned int connect_cookie; /* A cookie that gets bumped
181 every time the transport 183 every time the transport
@@ -294,7 +296,6 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
294void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 296void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
295void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 297void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
296void xprt_write_space(struct rpc_xprt *xprt); 298void xprt_write_space(struct rpc_xprt *xprt);
297void xprt_update_rtt(struct rpc_task *task);
298void xprt_adjust_cwnd(struct rpc_task *task, int result); 299void xprt_adjust_cwnd(struct rpc_task *task, int result);
299struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 300struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
300void xprt_complete_rqst(struct rpc_task *task, int copied); 301void xprt_complete_rqst(struct rpc_task *task, int copied);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1f59d9340c4d..ec2b7a42b45f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -146,6 +146,7 @@ enum {
146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ 148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
149 SWP_BLKDEV = (1 << 6), /* its a block device */
149 /* add others here before... */ 150 /* add others here before... */
150 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 151 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
151}; 152};
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index f66014c90c9f..7bb5cb64f3b8 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -980,6 +980,8 @@ extern int proc_doulongvec_minmax(struct ctl_table *, int,
980 void __user *, size_t *, loff_t *); 980 void __user *, size_t *, loff_t *);
981extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 981extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
982 void __user *, size_t *, loff_t *); 982 void __user *, size_t *, loff_t *);
983extern int proc_do_large_bitmap(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *);
983 985
984/* 986/*
985 * Register a set of sysctl names by calling register_sysctl_table 987 * Register a set of sysctl names by calling register_sysctl_table
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f0496b3d1811..f2694eb4dd3d 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -20,6 +20,7 @@
20 20
21struct kobject; 21struct kobject;
22struct module; 22struct module;
23enum kobj_ns_type;
23 24
24/* FIXME 25/* FIXME
25 * The *owner field is no longer used. 26 * The *owner field is no longer used.
@@ -86,17 +87,18 @@ struct attribute_group {
86 87
87#define attr_name(_attr) (_attr).attr.name 88#define attr_name(_attr) (_attr).attr.name
88 89
90struct file;
89struct vm_area_struct; 91struct vm_area_struct;
90 92
91struct bin_attribute { 93struct bin_attribute {
92 struct attribute attr; 94 struct attribute attr;
93 size_t size; 95 size_t size;
94 void *private; 96 void *private;
95 ssize_t (*read)(struct kobject *, struct bin_attribute *, 97 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
96 char *, loff_t, size_t); 98 char *, loff_t, size_t);
97 ssize_t (*write)(struct kobject *, struct bin_attribute *, 99 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *,
98 char *, loff_t, size_t); 100 char *, loff_t, size_t);
99 int (*mmap)(struct kobject *, struct bin_attribute *attr, 101 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
100 struct vm_area_struct *vma); 102 struct vm_area_struct *vma);
101}; 103};
102 104
@@ -154,6 +156,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name);
154int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 156int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
155 const char *old_name, const char *new_name); 157 const char *old_name, const char *new_name);
156 158
159void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
160 const char *name);
161
157int __must_check sysfs_create_group(struct kobject *kobj, 162int __must_check sysfs_create_group(struct kobject *kobj,
158 const struct attribute_group *grp); 163 const struct attribute_group *grp);
159int sysfs_update_group(struct kobject *kobj, 164int sysfs_update_group(struct kobject *kobj,
@@ -168,10 +173,15 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
168void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 173void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
169void sysfs_notify_dirent(struct sysfs_dirent *sd); 174void sysfs_notify_dirent(struct sysfs_dirent *sd);
170struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 175struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
176 const void *ns,
171 const unsigned char *name); 177 const unsigned char *name);
172struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 178struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
173void sysfs_put(struct sysfs_dirent *sd); 179void sysfs_put(struct sysfs_dirent *sd);
174void sysfs_printk_last_file(void); 180void sysfs_printk_last_file(void);
181
182/* Called to clear a ns tag when it is no longer valid */
183void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
184
175int __must_check sysfs_init(void); 185int __must_check sysfs_init(void);
176 186
177#else /* CONFIG_SYSFS */ 187#else /* CONFIG_SYSFS */
@@ -264,6 +274,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
264 return 0; 274 return 0;
265} 275}
266 276
277static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
278 const char *name)
279{
280}
281
267static inline int sysfs_create_group(struct kobject *kobj, 282static inline int sysfs_create_group(struct kobject *kobj,
268 const struct attribute_group *grp) 283 const struct attribute_group *grp)
269{ 284{
@@ -301,6 +316,7 @@ static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
301} 316}
302static inline 317static inline
303struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 318struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
319 const void *ns,
304 const unsigned char *name) 320 const unsigned char *name)
305{ 321{
306 return NULL; 322 return NULL;
@@ -313,6 +329,10 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
313{ 329{
314} 330}
315 331
332static inline void sysfs_exit_ns(int type, const void *tag)
333{
334}
335
316static inline int __must_check sysfs_init(void) 336static inline int __must_check sysfs_init(void)
317{ 337{
318 return 0; 338 return 0;
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 99adcdc0d3ca..4496322e28dd 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -39,41 +39,34 @@ struct sysrq_key_op {
39 39
40#ifdef CONFIG_MAGIC_SYSRQ 40#ifdef CONFIG_MAGIC_SYSRQ
41 41
42extern int sysrq_on(void);
43
44/*
45 * Do not use this one directly:
46 */
47extern int __sysrq_enabled;
48
49/* Generic SysRq interface -- you may call it from any device driver, supplying 42/* Generic SysRq interface -- you may call it from any device driver, supplying
50 * ASCII code of the key, pointer to registers and kbd/tty structs (if they 43 * ASCII code of the key, pointer to registers and kbd/tty structs (if they
51 * are available -- else NULL's). 44 * are available -- else NULL's).
52 */ 45 */
53 46
54void handle_sysrq(int key, struct tty_struct *tty); 47void handle_sysrq(int key, struct tty_struct *tty);
55void __handle_sysrq(int key, struct tty_struct *tty, int check_mask);
56int register_sysrq_key(int key, struct sysrq_key_op *op); 48int register_sysrq_key(int key, struct sysrq_key_op *op);
57int unregister_sysrq_key(int key, struct sysrq_key_op *op); 49int unregister_sysrq_key(int key, struct sysrq_key_op *op);
58struct sysrq_key_op *__sysrq_get_key_op(int key); 50struct sysrq_key_op *__sysrq_get_key_op(int key);
59 51
52int sysrq_toggle_support(int enable_mask);
53
60#else 54#else
61 55
62static inline int sysrq_on(void) 56static inline void handle_sysrq(int key, struct tty_struct *tty)
63{ 57{
64 return 0;
65} 58}
66static inline int __reterr(void) 59
60static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
67{ 61{
68 return -EINVAL; 62 return -EINVAL;
69} 63}
70static inline void handle_sysrq(int key, struct tty_struct *tty) 64
65static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
71{ 66{
67 return -EINVAL;
72} 68}
73 69
74#define register_sysrq_key(ig,nore) __reterr()
75#define unregister_sysrq_key(ig,nore) __reterr()
76
77#endif 70#endif
78 71
79#endif /* _LINUX_SYSRQ_H */ 72#endif /* _LINUX_SYSRQ_H */
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
index bf2a0c748878..1dba6ee55203 100644
--- a/include/linux/tboot.h
+++ b/include/linux/tboot.h
@@ -150,6 +150,7 @@ extern int tboot_force_iommu(void);
150 150
151#else 151#else
152 152
153#define tboot_enabled() 0
153#define tboot_probe() do { } while (0) 154#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0) 155#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \ 156#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
diff --git a/include/linux/tca6416_keypad.h b/include/linux/tca6416_keypad.h
new file mode 100644
index 000000000000..7bd266f3525c
--- /dev/null
+++ b/include/linux/tca6416_keypad.h
@@ -0,0 +1,34 @@
1/*
2 * tca6416 keypad platform support
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * Author: Sriramakrishnan <srk@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _TCA6416_KEYS_H
14#define _TCA6416_KEYS_H
15
16#include <linux/types.h>
17
18struct tca6416_button {
19 /* Configuration parameters */
20 int code; /* input event code (KEY_*, SW_*) */
21 int active_low;
22 int type; /* input event type (EV_KEY, EV_SW) */
23};
24
25struct tca6416_keys_platform_data {
26 struct tca6416_button *buttons;
27 int nbuttons;
28 unsigned int rep:1; /* enable input subsystem auto repeat */
29 uint16_t pinmask;
30 uint16_t invert;
31 int irq_is_gpio;
32 int use_polling; /* use polling if Interrupt is not connected*/
33};
34#endif
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d2ae79e21be3..b232ccc0ee29 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -42,6 +42,7 @@ enum tick_nohz_mode {
42 * @idle_waketime: Time when the idle was interrupted 42 * @idle_waketime: Time when the idle was interrupted
43 * @idle_exittime: Time when the idle state was left 43 * @idle_exittime: Time when the idle state was left
44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
45 * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
45 * @sleep_length: Duration of the current idle sleep 46 * @sleep_length: Duration of the current idle sleep
46 * @do_timer_lst: CPU was the last one doing do_timer before going idle 47 * @do_timer_lst: CPU was the last one doing do_timer before going idle
47 */ 48 */
@@ -60,7 +61,7 @@ struct tick_sched {
60 ktime_t idle_waketime; 61 ktime_t idle_waketime;
61 ktime_t idle_exittime; 62 ktime_t idle_exittime;
62 ktime_t idle_sleeptime; 63 ktime_t idle_sleeptime;
63 ktime_t idle_lastupdate; 64 ktime_t iowait_sleeptime;
64 ktime_t sleep_length; 65 ktime_t sleep_length;
65 unsigned long last_jiffies; 66 unsigned long last_jiffies;
66 unsigned long next_jiffies; 67 unsigned long next_jiffies;
@@ -124,6 +125,7 @@ extern void tick_nohz_stop_sched_tick(int inidle);
124extern void tick_nohz_restart_sched_tick(void); 125extern void tick_nohz_restart_sched_tick(void);
125extern ktime_t tick_nohz_get_sleep_length(void); 126extern ktime_t tick_nohz_get_sleep_length(void);
126extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 127extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
128extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
127# else 129# else
128static inline void tick_nohz_stop_sched_tick(int inidle) { } 130static inline void tick_nohz_stop_sched_tick(int inidle) { }
129static inline void tick_nohz_restart_sched_tick(void) { } 131static inline void tick_nohz_restart_sched_tick(void) { }
@@ -134,6 +136,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
134 return len; 136 return len;
135} 137}
136static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 138static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
139static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
137# endif /* !NO_HZ */ 140# endif /* !NO_HZ */
138 141
139#endif 142#endif
diff --git a/include/linux/timb_dma.h b/include/linux/timb_dma.h
new file mode 100644
index 000000000000..bb043e970b96
--- /dev/null
+++ b/include/linux/timb_dma.h
@@ -0,0 +1,55 @@
1/*
2 * timb_dma.h timberdale FPGA DMA driver defines
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/* Supports:
20 * Timberdale FPGA DMA engine
21 */
22
23#ifndef _LINUX_TIMB_DMA_H
24#define _LINUX_TIMB_DMA_H
25
26/**
27 * struct timb_dma_platform_data_channel - Description of each individual
28 * DMA channel for the timberdale DMA driver
29 * @rx: true if this channel handles data in the direction to
30 * the CPU.
31 * @bytes_per_line: Number of bytes per line, this is specific for channels
32 * handling video data. For other channels this shall be left to 0.
33 * @descriptors: Number of descriptors to allocate for this channel.
34 * @descriptor_elements: Number of elements in each descriptor.
35 *
36 */
37struct timb_dma_platform_data_channel {
38 bool rx;
39 unsigned int bytes_per_line;
40 unsigned int descriptors;
41 unsigned int descriptor_elements;
42};
43
44/**
45 * struct timb_dma_platform_data - Platform data of the timberdale DMA driver
46 * @nr_channels: Number of defined channels in the channels array.
47 * @channels: Definition of the each channel.
48 *
49 */
50struct timb_dma_platform_data {
51 unsigned nr_channels;
52 struct timb_dma_platform_data_channel channels[32];
53};
54
55#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index 6e026e45a179..ea3559f0b3f2 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -150,7 +150,6 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void); 151extern u64 timekeeping_max_deferment(void);
152extern void update_wall_time(void); 152extern void update_wall_time(void);
153extern void update_xtime_cache(u64 nsec);
154extern void timekeeping_leap_insert(int leapsecond); 153extern void timekeeping_leap_insert(int leapsecond);
155 154
156struct tms; 155struct tms;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a2d1eb6cb3f0..ea965b857a50 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -10,13 +10,19 @@
10struct tvec_base; 10struct tvec_base;
11 11
12struct timer_list { 12struct timer_list {
13 /*
14 * All fields that change during normal runtime grouped to the
15 * same cacheline
16 */
13 struct list_head entry; 17 struct list_head entry;
14 unsigned long expires; 18 unsigned long expires;
19 struct tvec_base *base;
15 20
16 void (*function)(unsigned long); 21 void (*function)(unsigned long);
17 unsigned long data; 22 unsigned long data;
18 23
19 struct tvec_base *base; 24 int slack;
25
20#ifdef CONFIG_TIMER_STATS 26#ifdef CONFIG_TIMER_STATS
21 void *start_site; 27 void *start_site;
22 char start_comm[16]; 28 char start_comm[16];
@@ -165,6 +171,8 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 171extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires); 172extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
167 173
174extern void set_timer_slack(struct timer_list *time, int slack_hz);
175
168#define TIMER_NOT_PINNED 0 176#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1 177#define TIMER_PINNED 1
170/* 178/*
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 7a082b32d8e1..32d852f8cbe4 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -232,13 +232,11 @@ struct timex {
232 */ 232 */
233extern unsigned long tick_usec; /* USER_HZ period (usec) */ 233extern unsigned long tick_usec; /* USER_HZ period (usec) */
234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */
235extern int tickadj; /* amount of adjustment per tick */
236 235
237/* 236/*
238 * phase-lock loop variables 237 * phase-lock loop variables
239 */ 238 */
240extern int time_status; /* clock synchronization status bits */ 239extern int time_status; /* clock synchronization status bits */
241extern long time_adjust; /* The amount of adjtime left */
242 240
243extern void ntp_init(void); 241extern void ntp_init(void);
244extern void ntp_clear(void); 242extern void ntp_clear(void);
@@ -271,9 +269,6 @@ extern void second_overflow(void);
271extern void update_ntp_one_tick(void); 269extern void update_ntp_one_tick(void);
272extern int do_adjtimex(struct timex *); 270extern int do_adjtimex(struct timex *);
273 271
274/* Don't use! Compatibility define for existing users. */
275#define tickadj (500/HZ ? : 1)
276
277int read_current_timer(unsigned long *timer_val); 272int read_current_timer(unsigned long *timer_val);
278 273
279/* The clock frequency of the i8253/i8254 PIT */ 274/* The clock frequency of the i8253/i8254 PIT */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 3d92396639de..181c8d0e6f73 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -107,7 +107,7 @@ static inline unsigned int tipc_node(__u32 addr)
107 * Message importance levels 107 * Message importance levels
108 */ 108 */
109 109
110#define TIPC_LOW_IMPORTANCE 0 /* default */ 110#define TIPC_LOW_IMPORTANCE 0
111#define TIPC_MEDIUM_IMPORTANCE 1 111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2 112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3 113#define TIPC_CRITICAL_IMPORTANCE 3
@@ -127,23 +127,17 @@ static inline unsigned int tipc_node(__u32 addr)
127 * TIPC topology subscription service definitions 127 * TIPC topology subscription service definitions
128 */ 128 */
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_SERVICE 0x00 /* Filter for service availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_PORTS 0x01 /* Filter for port availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ 132#define TIPC_SUB_CANCEL 0x04 /* Cancel a subscription */
133#if 0
134/* The following filter options are not currently implemented */
135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
136#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
137#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
138#endif
139 133
140#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ 134#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
141 135
142struct tipc_subscr { 136struct tipc_subscr {
143 struct tipc_name_seq seq; /* name sequence of interest */ 137 struct tipc_name_seq seq; /* NBO. Name sequence of interest */
144 __u32 timeout; /* subscription duration (in ms) */ 138 __u32 timeout; /* NBO. Subscription duration (in ms) */
145 __u32 filter; /* bitmask of filter options */ 139 __u32 filter; /* NBO. Bitmask of filter options */
146 char usr_handle[8]; /* available for subscriber use */ 140 char usr_handle[8]; /* Opaque. Available for subscriber use */
147}; 141};
148 142
149#define TIPC_PUBLISHED 1 /* publication event */ 143#define TIPC_PUBLISHED 1 /* publication event */
@@ -151,11 +145,11 @@ struct tipc_subscr {
151#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ 145#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
152 146
153struct tipc_event { 147struct tipc_event {
154 __u32 event; /* event type */ 148 __u32 event; /* NBO. Event type, as defined above */
155 __u32 found_lower; /* matching name seq instances */ 149 __u32 found_lower; /* NBO. Matching name seq instances */
156 __u32 found_upper; /* " " " " */ 150 __u32 found_upper; /* " " " " " */
157 struct tipc_portid port; /* associated port */ 151 struct tipc_portid port; /* NBO. Associated port */
158 struct tipc_subscr s; /* associated subscription */ 152 struct tipc_subscr s; /* Original, associated subscription */
159}; 153};
160 154
161/* 155/*
@@ -188,7 +182,7 @@ struct sockaddr_tipc {
188 struct tipc_name_seq nameseq; 182 struct tipc_name_seq nameseq;
189 struct { 183 struct {
190 struct tipc_name name; 184 struct tipc_name name;
191 __u32 domain; /* 0: own zone */ 185 __u32 domain;
192 } name; 186 } name;
193 } addr; 187 } addr;
194}; 188};
@@ -206,7 +200,7 @@ struct sockaddr_tipc {
206 */ 200 */
207 201
208#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ 202#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 203#define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 204#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 205#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ 206#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 2bc6fa4adeb5..9cde86c32412 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -74,6 +74,7 @@
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ 74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ 75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ 76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
77 78
78#if 0 79#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ 80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 78b4bd3be496..1d85f9a6a199 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -33,6 +33,65 @@ struct tracepoint {
33 * Keep in sync with vmlinux.lds.h. 33 * Keep in sync with vmlinux.lds.h.
34 */ 34 */
35 35
36/*
37 * Connect a probe to a tracepoint.
38 * Internal API, should not be used directly.
39 */
40extern int tracepoint_probe_register(const char *name, void *probe);
41
42/*
43 * Disconnect a probe from a tracepoint.
44 * Internal API, should not be used directly.
45 */
46extern int tracepoint_probe_unregister(const char *name, void *probe);
47
48extern int tracepoint_probe_register_noupdate(const char *name, void *probe);
49extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe);
50extern void tracepoint_probe_update_all(void);
51
52struct tracepoint_iter {
53 struct module *module;
54 struct tracepoint *tracepoint;
55};
56
57extern void tracepoint_iter_start(struct tracepoint_iter *iter);
58extern void tracepoint_iter_next(struct tracepoint_iter *iter);
59extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
60extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
61extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
62 struct tracepoint *begin, struct tracepoint *end);
63
64/*
65 * tracepoint_synchronize_unregister must be called between the last tracepoint
66 * probe unregistration and the end of module exit to make sure there is no
67 * caller executing a probe when it is freed.
68 */
69static inline void tracepoint_synchronize_unregister(void)
70{
71 synchronize_sched();
72}
73
74#define PARAMS(args...) args
75
76#ifdef CONFIG_TRACEPOINTS
77extern void tracepoint_update_probe_range(struct tracepoint *begin,
78 struct tracepoint *end);
79#else
80static inline void tracepoint_update_probe_range(struct tracepoint *begin,
81 struct tracepoint *end)
82{ }
83#endif /* CONFIG_TRACEPOINTS */
84
85#endif /* _LINUX_TRACEPOINT_H */
86
87/*
88 * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include
89 * file ifdef protection.
90 * This is due to the way trace events work. If a file includes two
91 * trace event headers under one "CREATE_TRACE_POINTS" the first include
92 * will override the TRACE_EVENT and break the second include.
93 */
94
36#ifndef DECLARE_TRACE 95#ifndef DECLARE_TRACE
37 96
38#define TP_PROTO(args...) args 97#define TP_PROTO(args...) args
@@ -96,9 +155,6 @@ struct tracepoint {
96#define EXPORT_TRACEPOINT_SYMBOL(name) \ 155#define EXPORT_TRACEPOINT_SYMBOL(name) \
97 EXPORT_SYMBOL(__tracepoint_##name) 156 EXPORT_SYMBOL(__tracepoint_##name)
98 157
99extern void tracepoint_update_probe_range(struct tracepoint *begin,
100 struct tracepoint *end);
101
102#else /* !CONFIG_TRACEPOINTS */ 158#else /* !CONFIG_TRACEPOINTS */
103#define DECLARE_TRACE(name, proto, args) \ 159#define DECLARE_TRACE(name, proto, args) \
104 static inline void _do_trace_##name(struct tracepoint *tp, proto) \ 160 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
@@ -119,61 +175,9 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 175#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
120#define EXPORT_TRACEPOINT_SYMBOL(name) 176#define EXPORT_TRACEPOINT_SYMBOL(name)
121 177
122static inline void tracepoint_update_probe_range(struct tracepoint *begin,
123 struct tracepoint *end)
124{ }
125#endif /* CONFIG_TRACEPOINTS */ 178#endif /* CONFIG_TRACEPOINTS */
126#endif /* DECLARE_TRACE */ 179#endif /* DECLARE_TRACE */
127 180
128/*
129 * Connect a probe to a tracepoint.
130 * Internal API, should not be used directly.
131 */
132extern int tracepoint_probe_register(const char *name, void *probe);
133
134/*
135 * Disconnect a probe from a tracepoint.
136 * Internal API, should not be used directly.
137 */
138extern int tracepoint_probe_unregister(const char *name, void *probe);
139
140extern int tracepoint_probe_register_noupdate(const char *name, void *probe);
141extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe);
142extern void tracepoint_probe_update_all(void);
143
144struct tracepoint_iter {
145 struct module *module;
146 struct tracepoint *tracepoint;
147};
148
149extern void tracepoint_iter_start(struct tracepoint_iter *iter);
150extern void tracepoint_iter_next(struct tracepoint_iter *iter);
151extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
152extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
153extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
154 struct tracepoint *begin, struct tracepoint *end);
155
156/*
157 * tracepoint_synchronize_unregister must be called between the last tracepoint
158 * probe unregistration and the end of module exit to make sure there is no
159 * caller executing a probe when it is freed.
160 */
161static inline void tracepoint_synchronize_unregister(void)
162{
163 synchronize_sched();
164}
165
166#define PARAMS(args...) args
167
168#endif /* _LINUX_TRACEPOINT_H */
169
170/*
171 * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
172 * This is due to the way trace events work. If a file includes two
173 * trace event headers under one "CREATE_TRACE_POINTS" the first include
174 * will override the TRACE_EVENT and break the second include.
175 */
176
177#ifndef TRACE_EVENT 181#ifndef TRACE_EVENT
178/* 182/*
179 * For use with the TRACE_EVENT macro: 183 * For use with the TRACE_EVENT macro:
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4409967db0c4..931078b73226 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 20 26#define NR_LDISCS 30
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -46,8 +46,9 @@
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */ 48#define N_PPS 18 /* Pulse per Second */
49
50#define N_V253 19 /* Codec control over voice modem */ 49#define N_V253 19 /* Codec control over voice modem */
50#define N_CAIF 20 /* CAIF protocol for talking to modems */
51#define N_GSM0710 21 /* GSM 0710 Mux */
51 52
52/* 53/*
53 * This character is the same as _POSIX_VDISABLE: it cannot be used as 54 * This character is the same as _POSIX_VDISABLE: it cannot be used as
diff --git a/include/linux/types.h b/include/linux/types.h
index c42724f8c802..23d237a075e2 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -188,12 +188,12 @@ typedef u32 phys_addr_t;
188typedef phys_addr_t resource_size_t; 188typedef phys_addr_t resource_size_t;
189 189
190typedef struct { 190typedef struct {
191 volatile int counter; 191 int counter;
192} atomic_t; 192} atomic_t;
193 193
194#ifdef CONFIG_64BIT 194#ifdef CONFIG_64BIT
195typedef struct { 195typedef struct {
196 volatile long counter; 196 long counter;
197} atomic64_t; 197} atomic64_t;
198#endif 198#endif
199 199
diff --git a/include/linux/usb.h b/include/linux/usb.h
index ce1323c4e47c..d5922a877994 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -45,27 +45,14 @@ struct wusb_dev;
45 45
46struct ep_device; 46struct ep_device;
47 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
61/** 48/**
62 * struct usb_host_endpoint - host-side endpoint descriptor and queue 49 * struct usb_host_endpoint - host-side endpoint descriptor and queue
63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 50 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
51 * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint
64 * @urb_list: urbs queued to this endpoint; maintained by usbcore 52 * @urb_list: urbs queued to this endpoint; maintained by usbcore
65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 53 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
66 * with one or more transfer descriptors (TDs) per urb 54 * with one or more transfer descriptors (TDs) per urb
67 * @ep_dev: ep_device for sysfs info 55 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
69 * @extra: descriptors following this endpoint in the configuration 56 * @extra: descriptors following this endpoint in the configuration
70 * @extralen: how many bytes of "extra" are valid 57 * @extralen: how many bytes of "extra" are valid
71 * @enabled: URBs may be submitted to this endpoint 58 * @enabled: URBs may be submitted to this endpoint
@@ -74,11 +61,11 @@ struct usb_host_ss_ep_comp {
74 * descriptor within an active interface in a given USB configuration. 61 * descriptor within an active interface in a given USB configuration.
75 */ 62 */
76struct usb_host_endpoint { 63struct usb_host_endpoint {
77 struct usb_endpoint_descriptor desc; 64 struct usb_endpoint_descriptor desc;
65 struct usb_ss_ep_comp_descriptor ss_ep_comp;
78 struct list_head urb_list; 66 struct list_head urb_list;
79 void *hcpriv; 67 void *hcpriv;
80 struct ep_device *ep_dev; /* For sysfs info */ 68 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
82 69
83 unsigned char *extra; /* Extra descriptors */ 70 unsigned char *extra; /* Extra descriptors */
84 int extralen; 71 int extralen;
@@ -109,8 +96,8 @@ enum usb_interface_condition {
109/** 96/**
110 * struct usb_interface - what usb device drivers talk to 97 * struct usb_interface - what usb device drivers talk to
111 * @altsetting: array of interface structures, one for each alternate 98 * @altsetting: array of interface structures, one for each alternate
112 * setting that may be selected. Each one includes a set of 99 * setting that may be selected. Each one includes a set of
113 * endpoint configurations. They will be in no particular order. 100 * endpoint configurations. They will be in no particular order.
114 * @cur_altsetting: the current altsetting. 101 * @cur_altsetting: the current altsetting.
115 * @num_altsetting: number of altsettings defined. 102 * @num_altsetting: number of altsettings defined.
116 * @intf_assoc: interface association descriptor 103 * @intf_assoc: interface association descriptor
@@ -197,8 +184,6 @@ struct usb_interface {
197 struct work_struct reset_ws; /* for resets in atomic context */ 184 struct work_struct reset_ws; /* for resets in atomic context */
198}; 185};
199#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 186#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
200#define interface_to_usbdev(intf) \
201 container_of(intf->dev.parent, struct usb_device, dev)
202 187
203static inline void *usb_get_intfdata(struct usb_interface *intf) 188static inline void *usb_get_intfdata(struct usb_interface *intf)
204{ 189{
@@ -215,7 +200,7 @@ void usb_put_intf(struct usb_interface *intf);
215 200
216/* this maximum is arbitrary */ 201/* this maximum is arbitrary */
217#define USB_MAXINTERFACES 32 202#define USB_MAXINTERFACES 32
218#define USB_MAXIADS USB_MAXINTERFACES/2 203#define USB_MAXIADS (USB_MAXINTERFACES/2)
219 204
220/** 205/**
221 * struct usb_interface_cache - long-term representation of a device interface 206 * struct usb_interface_cache - long-term representation of a device interface
@@ -425,7 +410,6 @@ struct usb_tt;
425 * @connect_time: time device was first connected 410 * @connect_time: time device was first connected
426 * @do_remote_wakeup: remote wakeup should be enabled 411 * @do_remote_wakeup: remote wakeup should be enabled
427 * @reset_resume: needs reset instead of resume 412 * @reset_resume: needs reset instead of resume
428 * @autosuspend_disabled: autosuspend disabled by the user
429 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 413 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
430 * specific data for the device. 414 * specific data for the device.
431 * @slot_id: Slot ID assigned by xHCI 415 * @slot_id: Slot ID assigned by xHCI
@@ -436,7 +420,7 @@ struct usb_tt;
436 */ 420 */
437struct usb_device { 421struct usb_device {
438 int devnum; 422 int devnum;
439 char devpath [16]; 423 char devpath[16];
440 u32 route; 424 u32 route;
441 enum usb_device_state state; 425 enum usb_device_state state;
442 enum usb_device_speed speed; 426 enum usb_device_speed speed;
@@ -469,7 +453,7 @@ struct usb_device {
469 unsigned persist_enabled:1; 453 unsigned persist_enabled:1;
470 unsigned have_langid:1; 454 unsigned have_langid:1;
471 unsigned authorized:1; 455 unsigned authorized:1;
472 unsigned authenticated:1; 456 unsigned authenticated:1;
473 unsigned wusb:1; 457 unsigned wusb:1;
474 int string_langid; 458 int string_langid;
475 459
@@ -501,13 +485,17 @@ struct usb_device {
501 485
502 unsigned do_remote_wakeup:1; 486 unsigned do_remote_wakeup:1;
503 unsigned reset_resume:1; 487 unsigned reset_resume:1;
504 unsigned autosuspend_disabled:1;
505#endif 488#endif
506 struct wusb_dev *wusb_dev; 489 struct wusb_dev *wusb_dev;
507 int slot_id; 490 int slot_id;
508}; 491};
509#define to_usb_device(d) container_of(d, struct usb_device, dev) 492#define to_usb_device(d) container_of(d, struct usb_device, dev)
510 493
494static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
495{
496 return to_usb_device(intf->dev.parent);
497}
498
511extern struct usb_device *usb_get_dev(struct usb_device *dev); 499extern struct usb_device *usb_get_dev(struct usb_device *dev);
512extern void usb_put_dev(struct usb_device *dev); 500extern void usb_put_dev(struct usb_device *dev);
513 501
@@ -522,12 +510,11 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
522extern int usb_reset_device(struct usb_device *dev); 510extern int usb_reset_device(struct usb_device *dev);
523extern void usb_queue_reset_device(struct usb_interface *dev); 511extern void usb_queue_reset_device(struct usb_interface *dev);
524 512
525extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
526 513
527/* USB autosuspend and autoresume */ 514/* USB autosuspend and autoresume */
528#ifdef CONFIG_USB_SUSPEND 515#ifdef CONFIG_USB_SUSPEND
529extern int usb_enable_autosuspend(struct usb_device *udev); 516extern void usb_enable_autosuspend(struct usb_device *udev);
530extern int usb_disable_autosuspend(struct usb_device *udev); 517extern void usb_disable_autosuspend(struct usb_device *udev);
531 518
532extern int usb_autopm_get_interface(struct usb_interface *intf); 519extern int usb_autopm_get_interface(struct usb_interface *intf);
533extern void usb_autopm_put_interface(struct usb_interface *intf); 520extern void usb_autopm_put_interface(struct usb_interface *intf);
@@ -572,6 +559,16 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
572/* for drivers using iso endpoints */ 559/* for drivers using iso endpoints */
573extern int usb_get_current_frame_number(struct usb_device *usb_dev); 560extern int usb_get_current_frame_number(struct usb_device *usb_dev);
574 561
562/* Sets up a group of bulk endpoints to support multiple stream IDs. */
563extern int usb_alloc_streams(struct usb_interface *interface,
564 struct usb_host_endpoint **eps, unsigned int num_eps,
565 unsigned int num_streams, gfp_t mem_flags);
566
567/* Reverts a group of bulk endpoints back to not using stream IDs. */
568extern void usb_free_streams(struct usb_interface *interface,
569 struct usb_host_endpoint **eps, unsigned int num_eps,
570 gfp_t mem_flags);
571
575/* used these for multi-interface device registration */ 572/* used these for multi-interface device registration */
576extern int usb_driver_claim_interface(struct usb_driver *driver, 573extern int usb_driver_claim_interface(struct usb_driver *driver,
577 struct usb_interface *iface, void *priv); 574 struct usb_interface *iface, void *priv);
@@ -667,7 +664,7 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
667 * This macro is used to create a struct usb_device_id that matches a 664 * This macro is used to create a struct usb_device_id that matches a
668 * specific device. 665 * specific device.
669 */ 666 */
670#define USB_DEVICE(vend,prod) \ 667#define USB_DEVICE(vend, prod) \
671 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ 668 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
672 .idVendor = (vend), \ 669 .idVendor = (vend), \
673 .idProduct = (prod) 670 .idProduct = (prod)
@@ -958,17 +955,25 @@ extern int usb_disabled(void);
958#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 955#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
959 * ignored */ 956 * ignored */
960#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 957#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
961#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
962#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 958#define URB_NO_FSBR 0x0020 /* UHCI-specific */
963#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 959#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
964#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt 960#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
965 * needed */ 961 * needed */
966#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 962#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
967 963
964/* The following flags are used internally by usbcore and HCDs */
968#define URB_DIR_IN 0x0200 /* Transfer from device to host */ 965#define URB_DIR_IN 0x0200 /* Transfer from device to host */
969#define URB_DIR_OUT 0 966#define URB_DIR_OUT 0
970#define URB_DIR_MASK URB_DIR_IN 967#define URB_DIR_MASK URB_DIR_IN
971 968
969#define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
970#define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
971#define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
972#define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
973#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
974#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
975#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
976
972struct usb_iso_packet_descriptor { 977struct usb_iso_packet_descriptor {
973 unsigned int offset; 978 unsigned int offset;
974 unsigned int length; /* expected length */ 979 unsigned int length; /* expected length */
@@ -1045,12 +1050,8 @@ typedef void (*usb_complete_t)(struct urb *);
1045 * @setup_packet: Only used for control transfers, this points to eight bytes 1050 * @setup_packet: Only used for control transfers, this points to eight bytes
1046 * of setup data. Control transfers always start by sending this data 1051 * of setup data. Control transfers always start by sending this data
1047 * to the device. Then transfer_buffer is read or written, if needed. 1052 * to the device. Then transfer_buffer is read or written, if needed.
1048 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1053 * @setup_dma: DMA pointer for the setup packet. The caller must not use
1049 * device driver has provided this DMA address for the setup packet. 1054 * this field; setup_packet must point to a valid buffer.
1050 * The host controller driver should use this in preference to
1051 * setup_packet, but the HCD may chose to ignore the address if it must
1052 * copy the setup packet into internal structures. Therefore, setup_packet
1053 * must always point to a valid buffer.
1054 * @start_frame: Returns the initial frame for isochronous transfers. 1055 * @start_frame: Returns the initial frame for isochronous transfers.
1055 * @number_of_packets: Lists the number of ISO transfer buffers. 1056 * @number_of_packets: Lists the number of ISO transfer buffers.
1056 * @interval: Specifies the polling interval for interrupt or isochronous 1057 * @interval: Specifies the polling interval for interrupt or isochronous
@@ -1082,13 +1083,14 @@ typedef void (*usb_complete_t)(struct urb *);
1082 * bounce buffer or talking to an IOMMU), 1083 * bounce buffer or talking to an IOMMU),
1083 * although they're cheap on commodity x86 and ppc hardware. 1084 * although they're cheap on commodity x86 and ppc hardware.
1084 * 1085 *
1085 * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, 1086 * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag,
1086 * which tell the host controller driver that no such mapping is needed since 1087 * which tells the host controller driver that no such mapping is needed for
1088 * the transfer_buffer since
1087 * the device driver is DMA-aware. For example, a device driver might 1089 * the device driver is DMA-aware. For example, a device driver might
1088 * allocate a DMA buffer with usb_buffer_alloc() or call usb_buffer_map(). 1090 * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
1089 * When these transfer flags are provided, host controller drivers will 1091 * When this transfer flag is provided, host controller drivers will
1090 * attempt to use the dma addresses found in the transfer_dma and/or 1092 * attempt to use the dma address found in the transfer_dma
1091 * setup_dma fields rather than determining a dma address themselves. 1093 * field rather than determining a dma address themselves.
1092 * 1094 *
1093 * Note that transfer_buffer must still be set if the controller 1095 * Note that transfer_buffer must still be set if the controller
1094 * does not support DMA (as indicated by bus.uses_dma) and when talking 1096 * does not support DMA (as indicated by bus.uses_dma) and when talking
@@ -1111,11 +1113,9 @@ typedef void (*usb_complete_t)(struct urb *);
1111 * should always terminate with a short packet, even if it means adding an 1113 * should always terminate with a short packet, even if it means adding an
1112 * extra zero length packet. 1114 * extra zero length packet.
1113 * 1115 *
1114 * Control URBs must provide a setup_packet. The setup_packet and 1116 * Control URBs must provide a valid pointer in the setup_packet field.
1115 * transfer_buffer may each be mapped for DMA or not, independently of 1117 * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA
1116 * the other. The transfer_flags bits URB_NO_TRANSFER_DMA_MAP and 1118 * beforehand.
1117 * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped.
1118 * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs.
1119 * 1119 *
1120 * Interrupt URBs must provide an interval, saying how often (in milliseconds 1120 * Interrupt URBs must provide an interval, saying how often (in milliseconds
1121 * or, for highspeed devices, 125 microsecond units) 1121 * or, for highspeed devices, 125 microsecond units)
@@ -1186,14 +1186,15 @@ struct urb {
1186 * current owner */ 1186 * current owner */
1187 struct list_head anchor_list; /* the URB may be anchored */ 1187 struct list_head anchor_list; /* the URB may be anchored */
1188 struct usb_anchor *anchor; 1188 struct usb_anchor *anchor;
1189 struct usb_device *dev; /* (in) pointer to associated device */ 1189 struct usb_device *dev; /* (in) pointer to associated device */
1190 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ 1190 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
1191 unsigned int pipe; /* (in) pipe information */ 1191 unsigned int pipe; /* (in) pipe information */
1192 unsigned int stream_id; /* (in) stream ID */
1192 int status; /* (return) non-ISO status */ 1193 int status; /* (return) non-ISO status */
1193 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1194 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1194 void *transfer_buffer; /* (in) associated data buffer */ 1195 void *transfer_buffer; /* (in) associated data buffer */
1195 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1196 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1196 struct usb_sg_request *sg; /* (in) scatter gather buffer list */ 1197 struct scatterlist *sg; /* (in) scatter gather buffer list */
1197 int num_sgs; /* (in) number of entries in the sg list */ 1198 int num_sgs; /* (in) number of entries in the sg list */
1198 u32 transfer_buffer_length; /* (in) data buffer length */ 1199 u32 transfer_buffer_length; /* (in) data buffer length */
1199 u32 actual_length; /* (return) actual transfer length */ 1200 u32 actual_length; /* (return) actual transfer length */
@@ -1366,9 +1367,9 @@ static inline int usb_urb_dir_out(struct urb *urb)
1366 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1367 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1367} 1368}
1368 1369
1369void *usb_buffer_alloc(struct usb_device *dev, size_t size, 1370void *usb_alloc_coherent(struct usb_device *dev, size_t size,
1370 gfp_t mem_flags, dma_addr_t *dma); 1371 gfp_t mem_flags, dma_addr_t *dma);
1371void usb_buffer_free(struct usb_device *dev, size_t size, 1372void usb_free_coherent(struct usb_device *dev, size_t size,
1372 void *addr, dma_addr_t dma); 1373 void *addr, dma_addr_t dma);
1373 1374
1374#if 0 1375#if 0
@@ -1455,8 +1456,6 @@ struct usb_sg_request {
1455 1456
1456 struct usb_device *dev; 1457 struct usb_device *dev;
1457 int pipe; 1458 int pipe;
1458 struct scatterlist *sg;
1459 int nents;
1460 1459
1461 int entries; 1460 int entries;
1462 struct urb **urbs; 1461 struct urb **urbs;
@@ -1524,23 +1523,31 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
1524} 1523}
1525 1524
1526/* Create various pipes... */ 1525/* Create various pipes... */
1527#define usb_sndctrlpipe(dev,endpoint) \ 1526#define usb_sndctrlpipe(dev, endpoint) \
1528 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) 1527 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
1529#define usb_rcvctrlpipe(dev,endpoint) \ 1528#define usb_rcvctrlpipe(dev, endpoint) \
1530 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1529 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1531#define usb_sndisocpipe(dev,endpoint) \ 1530#define usb_sndisocpipe(dev, endpoint) \
1532 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) 1531 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
1533#define usb_rcvisocpipe(dev,endpoint) \ 1532#define usb_rcvisocpipe(dev, endpoint) \
1534 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1533 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1535#define usb_sndbulkpipe(dev,endpoint) \ 1534#define usb_sndbulkpipe(dev, endpoint) \
1536 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) 1535 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
1537#define usb_rcvbulkpipe(dev,endpoint) \ 1536#define usb_rcvbulkpipe(dev, endpoint) \
1538 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1537 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1539#define usb_sndintpipe(dev,endpoint) \ 1538#define usb_sndintpipe(dev, endpoint) \
1540 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) 1539 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
1541#define usb_rcvintpipe(dev,endpoint) \ 1540#define usb_rcvintpipe(dev, endpoint) \
1542 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1541 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1543 1542
1543static inline struct usb_host_endpoint *
1544usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
1545{
1546 struct usb_host_endpoint **eps;
1547 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
1548 return eps[usb_pipeendpoint(pipe)];
1549}
1550
1544/*-------------------------------------------------------------------------*/ 1551/*-------------------------------------------------------------------------*/
1545 1552
1546static inline __u16 1553static inline __u16
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 29fd73b0bffc..51410e0200cf 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,6 +1,7 @@
1header-y += audio.h 1header-y += audio.h
2header-y += cdc.h 2header-y += cdc.h
3header-y += ch9.h 3header-y += ch9.h
4header-y += ch11.h
4header-y += gadgetfs.h 5header-y += gadgetfs.h
5header-y += midi.h 6header-y += midi.h
6header-y += g_printer.h 7header-y += g_printer.h
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index baf41c8616e9..ba99af275a31 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,7 +15,7 @@ struct usba_ep_data {
15 15
16struct usba_platform_data { 16struct usba_platform_data {
17 int vbus_pin; 17 int vbus_pin;
18 int vbus_pin_inverted; 18 int vbus_pin_inverted;
19 int num_ep; 19 int num_ep;
20 struct usba_ep_data ep[0]; 20 struct usba_ep_data ep[0];
21}; 21};
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
new file mode 100644
index 000000000000..2389f93a28b5
--- /dev/null
+++ b/include/linux/usb/audio-v2.h
@@ -0,0 +1,378 @@
1/*
2 * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de>
3 *
4 * This software is distributed under the terms of the GNU General Public
5 * License ("GPL") version 2, as published by the Free Software Foundation.
6 *
7 * This file holds USB constants and structures defined
8 * by the USB Device Class Definition for Audio Devices in version 2.0.
9 * Comments below reference relevant sections of the documents contained
10 * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip
11 */
12
13#ifndef __LINUX_USB_AUDIO_V2_H
14#define __LINUX_USB_AUDIO_V2_H
15
16#include <linux/types.h>
17
18/* v1.0 and v2.0 of this standard have many things in common. For the rest
19 * of the definitions, please refer to audio.h */
20
21/* 4.7.2.1 Clock Source Descriptor */
22
23struct uac_clock_source_descriptor {
24 __u8 bLength;
25 __u8 bDescriptorType;
26 __u8 bDescriptorSubtype;
27 __u8 bClockID;
28 __u8 bmAttributes;
29 __u8 bmControls;
30 __u8 bAssocTerminal;
31 __u8 iClockSource;
32} __attribute__((packed));
33
34/* 4.7.2.2 Clock Source Descriptor */
35
36struct uac_clock_selector_descriptor {
37 __u8 bLength;
38 __u8 bDescriptorType;
39 __u8 bDescriptorSubtype;
40 __u8 bClockID;
41 __u8 bNrInPins;
42 __u8 bmControls;
43 __u8 baCSourceID[];
44} __attribute__((packed));
45
46/* 4.7.2.4 Input terminal descriptor */
47
48struct uac2_input_terminal_descriptor {
49 __u8 bLength;
50 __u8 bDescriptorType;
51 __u8 bDescriptorSubtype;
52 __u8 bTerminalID;
53 __u16 wTerminalType;
54 __u8 bAssocTerminal;
55 __u8 bCSourceID;
56 __u8 bNrChannels;
57 __u32 bmChannelConfig;
58 __u8 iChannelNames;
59 __u16 bmControls;
60 __u8 iTerminal;
61} __attribute__((packed));
62
63/* 4.7.2.5 Output terminal descriptor */
64
65struct uac2_output_terminal_descriptor {
66 __u8 bLength;
67 __u8 bDescriptorType;
68 __u8 bDescriptorSubtype;
69 __u8 bTerminalID;
70 __u16 wTerminalType;
71 __u8 bAssocTerminal;
72 __u8 bSourceID;
73 __u8 bCSourceID;
74 __u16 bmControls;
75 __u8 iTerminal;
76} __attribute__((packed));
77
78
79
80/* 4.7.2.8 Feature Unit Descriptor */
81
82struct uac2_feature_unit_descriptor {
83 __u8 bLength;
84 __u8 bDescriptorType;
85 __u8 bDescriptorSubtype;
86 __u8 bUnitID;
87 __u8 bSourceID;
88 /* bmaControls is actually u32,
89 * but u8 is needed for the hybrid parser */
90 __u8 bmaControls[0]; /* variable length */
91} __attribute__((packed));
92
93/* 4.9.2 Class-Specific AS Interface Descriptor */
94
95struct uac_as_header_descriptor_v2 {
96 __u8 bLength;
97 __u8 bDescriptorType;
98 __u8 bDescriptorSubtype;
99 __u8 bTerminalLink;
100 __u8 bmControls;
101 __u8 bFormatType;
102 __u32 bmFormats;
103 __u8 bNrChannels;
104 __u32 bmChannelConfig;
105 __u8 iChannelNames;
106} __attribute__((packed));
107
108/* 6.1 Interrupt Data Message */
109
110#define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0)
111#define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1)
112
113struct uac2_interrupt_data_msg {
114 __u8 bInfo;
115 __u8 bAttribute;
116 __le16 wValue;
117 __le16 wIndex;
118} __attribute__((packed));
119
120/* A.7 Audio Function Category Codes */
121#define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00
122#define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01
123#define UAC2_FUNCTION_HOME_THEATER 0x02
124#define UAC2_FUNCTION_MICROPHONE 0x03
125#define UAC2_FUNCTION_HEADSET 0x04
126#define UAC2_FUNCTION_TELEPHONE 0x05
127#define UAC2_FUNCTION_CONVERTER 0x06
128#define UAC2_FUNCTION_SOUND_RECORDER 0x07
129#define UAC2_FUNCTION_IO_BOX 0x08
130#define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09
131#define UAC2_FUNCTION_PRO_AUDIO 0x0a
132#define UAC2_FUNCTION_AUDIO_VIDEO 0x0b
133#define UAC2_FUNCTION_CONTROL_PANEL 0x0c
134#define UAC2_FUNCTION_OTHER 0xff
135
136/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */
137/* see audio.h for the rest, which is identical to v1 */
138#define UAC2_EFFECT_UNIT 0x07
139#define UAC2_PROCESSING_UNIT_V2 0x08
140#define UAC2_EXTENSION_UNIT_V2 0x09
141#define UAC2_CLOCK_SOURCE 0x0a
142#define UAC2_CLOCK_SELECTOR 0x0b
143#define UAC2_CLOCK_MULTIPLIER 0x0c
144#define UAC2_SAMPLE_RATE_CONVERTER 0x0d
145
146/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */
147/* see audio.h for the rest, which is identical to v1 */
148#define UAC2_ENCODER 0x03
149#define UAC2_DECODER 0x04
150
151/* A.11 Effect Unit Effect Types */
152#define UAC2_EFFECT_UNDEFINED 0x00
153#define UAC2_EFFECT_PARAM_EQ 0x01
154#define UAC2_EFFECT_REVERB 0x02
155#define UAC2_EFFECT_MOD_DELAY 0x03
156#define UAC2_EFFECT_DYN_RANGE_COMP 0x04
157
158/* A.12 Processing Unit Process Types */
159#define UAC2_PROCESS_UNDEFINED 0x00
160#define UAC2_PROCESS_UP_DOWNMIX 0x01
161#define UAC2_PROCESS_DOLBY_PROLOCIC 0x02
162#define UAC2_PROCESS_STEREO_EXTENDER 0x03
163
164/* A.14 Audio Class-Specific Request Codes */
165#define UAC2_CS_CUR 0x01
166#define UAC2_CS_RANGE 0x02
167#define UAC2_CS_MEM 0x03
168
169/* A.15 Encoder Type Codes */
170#define UAC2_ENCODER_UNDEFINED 0x00
171#define UAC2_ENCODER_OTHER 0x01
172#define UAC2_ENCODER_MPEG 0x02
173#define UAC2_ENCODER_AC3 0x03
174#define UAC2_ENCODER_WMA 0x04
175#define UAC2_ENCODER_DTS 0x05
176
177/* A.16 Decoder Type Codes */
178#define UAC2_DECODER_UNDEFINED 0x00
179#define UAC2_DECODER_OTHER 0x01
180#define UAC2_DECODER_MPEG 0x02
181#define UAC2_DECODER_AC3 0x03
182#define UAC2_DECODER_WMA 0x04
183#define UAC2_DECODER_DTS 0x05
184
185/* A.17.1 Clock Source Control Selectors */
186#define UAC2_CS_UNDEFINED 0x00
187#define UAC2_CS_CONTROL_SAM_FREQ 0x01
188#define UAC2_CS_CONTROL_CLOCK_VALID 0x02
189
190/* A.17.2 Clock Selector Control Selectors */
191#define UAC2_CX_UNDEFINED 0x00
192#define UAC2_CX_CLOCK_SELECTOR 0x01
193
194/* A.17.3 Clock Multiplier Control Selectors */
195#define UAC2_CM_UNDEFINED 0x00
196#define UAC2_CM_NUMERATOR 0x01
197#define UAC2_CM_DENOMINTATOR 0x02
198
199/* A.17.4 Terminal Control Selectors */
200#define UAC2_TE_UNDEFINED 0x00
201#define UAC2_TE_COPY_PROTECT 0x01
202#define UAC2_TE_CONNECTOR 0x02
203#define UAC2_TE_OVERLOAD 0x03
204#define UAC2_TE_CLUSTER 0x04
205#define UAC2_TE_UNDERFLOW 0x05
206#define UAC2_TE_OVERFLOW 0x06
207#define UAC2_TE_LATENCY 0x07
208
209/* A.17.5 Mixer Control Selectors */
210#define UAC2_MU_UNDEFINED 0x00
211#define UAC2_MU_MIXER 0x01
212#define UAC2_MU_CLUSTER 0x02
213#define UAC2_MU_UNDERFLOW 0x03
214#define UAC2_MU_OVERFLOW 0x04
215#define UAC2_MU_LATENCY 0x05
216
217/* A.17.6 Selector Control Selectors */
218#define UAC2_SU_UNDEFINED 0x00
219#define UAC2_SU_SELECTOR 0x01
220#define UAC2_SU_LATENCY 0x02
221
222/* A.17.7 Feature Unit Control Selectors */
223/* see audio.h for the rest, which is identical to v1 */
224#define UAC2_FU_INPUT_GAIN 0x0b
225#define UAC2_FU_INPUT_GAIN_PAD 0x0c
226#define UAC2_FU_PHASE_INVERTER 0x0d
227#define UAC2_FU_UNDERFLOW 0x0e
228#define UAC2_FU_OVERFLOW 0x0f
229#define UAC2_FU_LATENCY 0x10
230
231/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */
232#define UAC2_PE_UNDEFINED 0x00
233#define UAC2_PE_ENABLE 0x01
234#define UAC2_PE_CENTERFREQ 0x02
235#define UAC2_PE_QFACTOR 0x03
236#define UAC2_PE_GAIN 0x04
237#define UAC2_PE_UNDERFLOW 0x05
238#define UAC2_PE_OVERFLOW 0x06
239#define UAC2_PE_LATENCY 0x07
240
241/* A.17.8.2 Reverberation Effect Unit Control Selectors */
242#define UAC2_RV_UNDEFINED 0x00
243#define UAC2_RV_ENABLE 0x01
244#define UAC2_RV_TYPE 0x02
245#define UAC2_RV_LEVEL 0x03
246#define UAC2_RV_TIME 0x04
247#define UAC2_RV_FEEDBACK 0x05
248#define UAC2_RV_PREDELAY 0x06
249#define UAC2_RV_DENSITY 0x07
250#define UAC2_RV_HIFREQ_ROLLOFF 0x08
251#define UAC2_RV_UNDERFLOW 0x09
252#define UAC2_RV_OVERFLOW 0x0a
253#define UAC2_RV_LATENCY 0x0b
254
255/* A.17.8.3 Modulation Delay Effect Control Selectors */
256#define UAC2_MD_UNDEFINED 0x00
257#define UAC2_MD_ENABLE 0x01
258#define UAC2_MD_BALANCE 0x02
259#define UAC2_MD_RATE 0x03
260#define UAC2_MD_DEPTH 0x04
261#define UAC2_MD_TIME 0x05
262#define UAC2_MD_FEEDBACK 0x06
263#define UAC2_MD_UNDERFLOW 0x07
264#define UAC2_MD_OVERFLOW 0x08
265#define UAC2_MD_LATENCY 0x09
266
267/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */
268#define UAC2_DR_UNDEFINED 0x00
269#define UAC2_DR_ENABLE 0x01
270#define UAC2_DR_COMPRESSION_RATE 0x02
271#define UAC2_DR_MAXAMPL 0x03
272#define UAC2_DR_THRESHOLD 0x04
273#define UAC2_DR_ATTACK_TIME 0x05
274#define UAC2_DR_RELEASE_TIME 0x06
275#define UAC2_DR_UNDEFLOW 0x07
276#define UAC2_DR_OVERFLOW 0x08
277#define UAC2_DR_LATENCY 0x09
278
279/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */
280#define UAC2_UD_UNDEFINED 0x00
281#define UAC2_UD_ENABLE 0x01
282#define UAC2_UD_MODE_SELECT 0x02
283#define UAC2_UD_CLUSTER 0x03
284#define UAC2_UD_UNDERFLOW 0x04
285#define UAC2_UD_OVERFLOW 0x05
286#define UAC2_UD_LATENCY 0x06
287
288/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */
289#define UAC2_DP_UNDEFINED 0x00
290#define UAC2_DP_ENABLE 0x01
291#define UAC2_DP_MODE_SELECT 0x02
292#define UAC2_DP_CLUSTER 0x03
293#define UAC2_DP_UNDERFFLOW 0x04
294#define UAC2_DP_OVERFLOW 0x05
295#define UAC2_DP_LATENCY 0x06
296
297/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */
298#define UAC2_ST_EXT_UNDEFINED 0x00
299#define UAC2_ST_EXT_ENABLE 0x01
300#define UAC2_ST_EXT_WIDTH 0x02
301#define UAC2_ST_EXT_UNDEFLOW 0x03
302#define UAC2_ST_EXT_OVERFLOW 0x04
303#define UAC2_ST_EXT_LATENCY 0x05
304
305/* A.17.10 Extension Unit Control Selectors */
306#define UAC2_XU_UNDEFINED 0x00
307#define UAC2_XU_ENABLE 0x01
308#define UAC2_XU_CLUSTER 0x02
309#define UAC2_XU_UNDERFLOW 0x03
310#define UAC2_XU_OVERFLOW 0x04
311#define UAC2_XU_LATENCY 0x05
312
313/* A.17.11 AudioStreaming Interface Control Selectors */
314#define UAC2_AS_UNDEFINED 0x00
315#define UAC2_AS_ACT_ALT_SETTING 0x01
316#define UAC2_AS_VAL_ALT_SETTINGS 0x02
317#define UAC2_AS_AUDIO_DATA_FORMAT 0x03
318
319/* A.17.12 Encoder Control Selectors */
320#define UAC2_EN_UNDEFINED 0x00
321#define UAC2_EN_BIT_RATE 0x01
322#define UAC2_EN_QUALITY 0x02
323#define UAC2_EN_VBR 0x03
324#define UAC2_EN_TYPE 0x04
325#define UAC2_EN_UNDERFLOW 0x05
326#define UAC2_EN_OVERFLOW 0x06
327#define UAC2_EN_ENCODER_ERROR 0x07
328#define UAC2_EN_PARAM1 0x08
329#define UAC2_EN_PARAM2 0x09
330#define UAC2_EN_PARAM3 0x0a
331#define UAC2_EN_PARAM4 0x0b
332#define UAC2_EN_PARAM5 0x0c
333#define UAC2_EN_PARAM6 0x0d
334#define UAC2_EN_PARAM7 0x0e
335#define UAC2_EN_PARAM8 0x0f
336
337/* A.17.13.1 MPEG Decoder Control Selectors */
338#define UAC2_MPEG_UNDEFINED 0x00
339#define UAC2_MPEG_DUAL_CHANNEL 0x01
340#define UAC2_MPEG_SECOND_STEREO 0x02
341#define UAC2_MPEG_MULTILINGUAL 0x03
342#define UAC2_MPEG_DYN_RANGE 0x04
343#define UAC2_MPEG_SCALING 0x05
344#define UAC2_MPEG_HILO_SCALING 0x06
345#define UAC2_MPEG_UNDERFLOW 0x07
346#define UAC2_MPEG_OVERFLOW 0x08
347#define UAC2_MPEG_DECODER_ERROR 0x09
348
349/* A17.13.2 AC3 Decoder Control Selectors */
350#define UAC2_AC3_UNDEFINED 0x00
351#define UAC2_AC3_MODE 0x01
352#define UAC2_AC3_DYN_RANGE 0x02
353#define UAC2_AC3_SCALING 0x03
354#define UAC2_AC3_HILO_SCALING 0x04
355#define UAC2_AC3_UNDERFLOW 0x05
356#define UAC2_AC3_OVERFLOW 0x06
357#define UAC2_AC3_DECODER_ERROR 0x07
358
359/* A17.13.3 WMA Decoder Control Selectors */
360#define UAC2_WMA_UNDEFINED 0x00
361#define UAC2_WMA_UNDERFLOW 0x01
362#define UAC2_WMA_OVERFLOW 0x02
363#define UAC2_WMA_DECODER_ERROR 0x03
364
365/* A17.13.4 DTS Decoder Control Selectors */
366#define UAC2_DTS_UNDEFINED 0x00
367#define UAC2_DTS_UNDERFLOW 0x01
368#define UAC2_DTS_OVERFLOW 0x02
369#define UAC2_DTS_DECODER_ERROR 0x03
370
371/* A17.14 Endpoint Control Selectors */
372#define UAC2_EP_CS_UNDEFINED 0x00
373#define UAC2_EP_CS_PITCH 0x01
374#define UAC2_EP_CS_DATA_OVERRUN 0x02
375#define UAC2_EP_CS_DATA_UNDERRUN 0x03
376
377#endif /* __LINUX_USB_AUDIO_V2_H */
378
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 4d3e450e2b03..5d646c388752 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -13,6 +13,9 @@
13 * Comments below reference relevant sections of that document: 13 * Comments below reference relevant sections of that document:
14 * 14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf 15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
16 */ 19 */
17 20
18#ifndef __LINUX_USB_AUDIO_H 21#ifndef __LINUX_USB_AUDIO_H
@@ -20,14 +23,15 @@
20 23
21#include <linux/types.h> 24#include <linux/types.h>
22 25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
23/* A.2 Audio Interface Subclass Codes */ 30/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 31#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 33#define USB_SUBCLASS_MIDISTREAMING 0x03
27 34
28#define UAC_VERSION_1 0x00
29#define UAC_VERSION_2 0x20
30
31/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ 35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
32#define UAC_HEADER 0x01 36#define UAC_HEADER 0x01
33#define UAC_INPUT_TERMINAL 0x02 37#define UAC_INPUT_TERMINAL 0x02
@@ -38,15 +42,6 @@
38#define UAC_PROCESSING_UNIT_V1 0x07 42#define UAC_PROCESSING_UNIT_V1 0x07
39#define UAC_EXTENSION_UNIT_V1 0x08 43#define UAC_EXTENSION_UNIT_V1 0x08
40 44
41/* UAC v2.0 types */
42#define UAC_EFFECT_UNIT 0x07
43#define UAC_PROCESSING_UNIT_V2 0x08
44#define UAC_EXTENSION_UNIT_V2 0x09
45#define UAC_CLOCK_SOURCE 0x0a
46#define UAC_CLOCK_SELECTOR 0x0b
47#define UAC_CLOCK_MULTIPLIER 0x0c
48#define UAC_SAMPLE_RATE_CONVERTER 0x0d
49
50/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
51#define UAC_AS_GENERAL 0x01 46#define UAC_AS_GENERAL 0x01
52#define UAC_FORMAT_TYPE 0x02 47#define UAC_FORMAT_TYPE 0x02
@@ -78,10 +73,6 @@
78 73
79#define UAC_GET_STAT 0xff 74#define UAC_GET_STAT 0xff
80 75
81/* Audio class v2.0 handles all the parameter calls differently */
82#define UAC2_CS_CUR 0x01
83#define UAC2_CS_RANGE 0x02
84
85/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ 76/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
86#define UAC_MS_HEADER 0x01 77#define UAC_MS_HEADER 0x01
87#define UAC_MIDI_IN_JACK 0x02 78#define UAC_MIDI_IN_JACK 0x02
@@ -110,7 +101,7 @@ struct uac_ac_header_descriptor_v1 {
110#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) 101#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
111 102
112/* As above, but more useful for defining your own descriptors: */ 103/* As above, but more useful for defining your own descriptors: */
113#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 104#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
114struct uac_ac_header_descriptor_v1_##n { \ 105struct uac_ac_header_descriptor_v1_##n { \
115 __u8 bLength; \ 106 __u8 bLength; \
116 __u8 bDescriptorType; \ 107 __u8 bDescriptorType; \
@@ -178,7 +169,7 @@ struct uac_output_terminal_descriptor_v1 {
178#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 169#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
179 170
180/* As above, but more useful for defining your own descriptors: */ 171/* As above, but more useful for defining your own descriptors: */
181#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ 172#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
182struct uac_feature_unit_descriptor_##ch { \ 173struct uac_feature_unit_descriptor_##ch { \
183 __u8 bLength; \ 174 __u8 bLength; \
184 __u8 bDescriptorType; \ 175 __u8 bDescriptorType; \
@@ -190,6 +181,156 @@ struct uac_feature_unit_descriptor_##ch { \
190 __u8 iFeature; \ 181 __u8 iFeature; \
191} __attribute__ ((packed)) 182} __attribute__ ((packed))
192 183
184/* 4.3.2.3 Mixer Unit Descriptor */
185struct uac_mixer_unit_descriptor {
186 __u8 bLength;
187 __u8 bDescriptorType;
188 __u8 bDescriptorSubtype;
189 __u8 bUnitID;
190 __u8 bNrInPins;
191 __u8 baSourceID[];
192} __attribute__ ((packed));
193
194static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
195{
196 return desc->baSourceID[desc->bNrInPins];
197}
198
199static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
200 int protocol)
201{
202 if (protocol == UAC_VERSION_1)
203 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
204 desc->baSourceID[desc->bNrInPins + 1];
205 else
206 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
207 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
208 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
209 (desc->baSourceID[desc->bNrInPins + 1]);
210}
211
212static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
213 int protocol)
214{
215 return (protocol == UAC_VERSION_1) ?
216 desc->baSourceID[desc->bNrInPins + 3] :
217 desc->baSourceID[desc->bNrInPins + 5];
218}
219
220static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
221 int protocol)
222{
223 return (protocol == UAC_VERSION_1) ?
224 &desc->baSourceID[desc->bNrInPins + 4] :
225 &desc->baSourceID[desc->bNrInPins + 6];
226}
227
228static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
229{
230 __u8 *raw = (__u8 *) desc;
231 return raw[desc->bLength - 1];
232}
233
234/* 4.3.2.4 Selector Unit Descriptor */
235struct uac_selector_unit_descriptor {
236 __u8 bLength;
237 __u8 bDescriptorType;
238 __u8 bDescriptorSubtype;
239 __u8 bUintID;
240 __u8 bNrInPins;
241 __u8 baSourceID[];
242} __attribute__ ((packed));
243
244static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
245{
246 __u8 *raw = (__u8 *) desc;
247 return raw[9 + desc->bLength - 1];
248}
249
250/* 4.3.2.5 Feature Unit Descriptor */
251struct uac_feature_unit_descriptor {
252 __u8 bLength;
253 __u8 bDescriptorType;
254 __u8 bDescriptorSubtype;
255 __u8 bUnitID;
256 __u8 bSourceID;
257 __u8 bControlSize;
258 __u8 bmaControls[0]; /* variable length */
259} __attribute__((packed));
260
261static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
262{
263 __u8 *raw = (__u8 *) desc;
264 return raw[desc->bLength - 1];
265}
266
267/* 4.3.2.6 Processing Unit Descriptors */
268struct uac_processing_unit_descriptor {
269 __u8 bLength;
270 __u8 bDescriptorType;
271 __u8 bDescriptorSubtype;
272 __u8 bUnitID;
273 __u16 wProcessType;
274 __u8 bNrInPins;
275 __u8 baSourceID[];
276} __attribute__ ((packed));
277
278static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
279{
280 return desc->baSourceID[desc->bNrInPins];
281}
282
283static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
284 int protocol)
285{
286 if (protocol == UAC_VERSION_1)
287 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
288 desc->baSourceID[desc->bNrInPins + 1];
289 else
290 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
291 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
292 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
293 (desc->baSourceID[desc->bNrInPins + 1]);
294}
295
296static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
297 int protocol)
298{
299 return (protocol == UAC_VERSION_1) ?
300 desc->baSourceID[desc->bNrInPins + 3] :
301 desc->baSourceID[desc->bNrInPins + 5];
302}
303
304static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
305 int protocol)
306{
307 return (protocol == UAC_VERSION_1) ?
308 desc->baSourceID[desc->bNrInPins + 4] :
309 desc->baSourceID[desc->bNrInPins + 6];
310}
311
312static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
313 int protocol)
314{
315 return (protocol == UAC_VERSION_1) ?
316 &desc->baSourceID[desc->bNrInPins + 5] :
317 &desc->baSourceID[desc->bNrInPins + 7];
318}
319
320static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
321 int protocol)
322{
323 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
324 return desc->baSourceID[desc->bNrInPins + control_size];
325}
326
327static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
328 int protocol)
329{
330 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
331 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
332}
333
193/* 4.5.2 Class-Specific AS Interface Descriptor */ 334/* 4.5.2 Class-Specific AS Interface Descriptor */
194struct uac_as_header_descriptor_v1 { 335struct uac_as_header_descriptor_v1 {
195 __u8 bLength; /* in bytes: 7 */ 336 __u8 bLength; /* in bytes: 7 */
@@ -200,19 +341,6 @@ struct uac_as_header_descriptor_v1 {
200 __le16 wFormatTag; /* The Audio Data Format */ 341 __le16 wFormatTag; /* The Audio Data Format */
201} __attribute__ ((packed)); 342} __attribute__ ((packed));
202 343
203struct uac_as_header_descriptor_v2 {
204 __u8 bLength;
205 __u8 bDescriptorType;
206 __u8 bDescriptorSubtype;
207 __u8 bTerminalLink;
208 __u8 bmControls;
209 __u8 bFormatType;
210 __u32 bmFormats;
211 __u8 bNrChannels;
212 __u32 bmChannelConfig;
213 __u8 iChannelNames;
214} __attribute__((packed));
215
216#define UAC_DT_AS_HEADER_SIZE 7 344#define UAC_DT_AS_HEADER_SIZE 7
217 345
218/* Formats - A.1.1 Audio Data Format Type I Codes */ 346/* Formats - A.1.1 Audio Data Format Type I Codes */
@@ -250,7 +378,7 @@ struct uac_format_type_i_discrete_descriptor {
250 __u8 tSamFreq[][3]; 378 __u8 tSamFreq[][3];
251} __attribute__ ((packed)); 379} __attribute__ ((packed));
252 380
253#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 381#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
254struct uac_format_type_i_discrete_descriptor_##n { \ 382struct uac_format_type_i_discrete_descriptor_##n { \
255 __u8 bLength; \ 383 __u8 bLength; \
256 __u8 bDescriptorType; \ 384 __u8 bDescriptorType; \
@@ -277,7 +405,6 @@ struct uac_format_type_i_ext_descriptor {
277 __u8 bSideBandProtocol; 405 __u8 bSideBandProtocol;
278} __attribute__((packed)); 406} __attribute__((packed));
279 407
280
281/* Formats - Audio Data Format Type I Codes */ 408/* Formats - Audio Data Format Type I Codes */
282 409
283#define UAC_FORMAT_TYPE_II_MPEG 0x1001 410#define UAC_FORMAT_TYPE_II_MPEG 0x1001
@@ -329,38 +456,15 @@ struct uac_iso_endpoint_descriptor {
329 __u8 bmAttributes; 456 __u8 bmAttributes;
330 __u8 bLockDelayUnits; 457 __u8 bLockDelayUnits;
331 __le16 wLockDelay; 458 __le16 wLockDelay;
332}; 459} __attribute__((packed));
333#define UAC_ISO_ENDPOINT_DESC_SIZE 7 460#define UAC_ISO_ENDPOINT_DESC_SIZE 7
334 461
335#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 462#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
336#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 463#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
337#define UAC_EP_CS_ATTR_FILL_MAX 0x80 464#define UAC_EP_CS_ATTR_FILL_MAX 0x80
338 465
339/* Audio class v2.0: CLOCK_SOURCE descriptor */
340
341struct uac_clock_source_descriptor {
342 __u8 bLength;
343 __u8 bDescriptorType;
344 __u8 bDescriptorSubtype;
345 __u8 bClockID;
346 __u8 bmAttributes;
347 __u8 bmControls;
348 __u8 bAssocTerminal;
349 __u8 iClockSource;
350} __attribute__((packed));
351
352/* A.10.2 Feature Unit Control Selectors */ 466/* A.10.2 Feature Unit Control Selectors */
353 467
354struct uac_feature_unit_descriptor {
355 __u8 bLength;
356 __u8 bDescriptorType;
357 __u8 bDescriptorSubtype;
358 __u8 bUnitID;
359 __u8 bSourceID;
360 __u8 bControlSize;
361 __u8 controls[0]; /* variable length */
362} __attribute__((packed));
363
364#define UAC_FU_CONTROL_UNDEFINED 0x00 468#define UAC_FU_CONTROL_UNDEFINED 0x00
365#define UAC_MUTE_CONTROL 0x01 469#define UAC_MUTE_CONTROL 0x01
366#define UAC_VOLUME_CONTROL 0x02 470#define UAC_VOLUME_CONTROL 0x02
@@ -384,6 +488,21 @@ struct uac_feature_unit_descriptor {
384#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) 488#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))
385#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) 489#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1))
386 490
491/* status word format (3.7.1.1) */
492
493#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
494#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
495#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
496#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
497
498#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
499#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
500
501struct uac1_status_word {
502 __u8 bStatusType;
503 __u8 bOriginator;
504} __attribute__((packed));
505
387#ifdef __KERNEL__ 506#ifdef __KERNEL__
388 507
389struct usb_audio_control { 508struct usb_audio_control {
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index c24124a42ce5..c117a68d04a7 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -18,6 +18,7 @@
18#define USB_CDC_SUBCLASS_MDLM 0x0a 18#define USB_CDC_SUBCLASS_MDLM 0x0a
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c 20#define USB_CDC_SUBCLASS_EEM 0x0c
21#define USB_CDC_SUBCLASS_NCM 0x0d
21 22
22#define USB_CDC_PROTO_NONE 0 23#define USB_CDC_PROTO_NONE 0
23 24
@@ -49,6 +50,7 @@
49#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ 50#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
50#define USB_CDC_DMM_TYPE 0x14 51#define USB_CDC_DMM_TYPE 0x14
51#define USB_CDC_OBEX_TYPE 0x15 52#define USB_CDC_OBEX_TYPE 0x15
53#define USB_CDC_NCM_TYPE 0x1a
52 54
53/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 55/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
54struct usb_cdc_header_desc { 56struct usb_cdc_header_desc {
@@ -174,6 +176,15 @@ struct usb_cdc_obex_desc {
174 __le16 bcdVersion; 176 __le16 bcdVersion;
175} __attribute__ ((packed)); 177} __attribute__ ((packed));
176 178
179/* "NCM Control Model Functional Descriptor" */
180struct usb_cdc_ncm_desc {
181 __u8 bLength;
182 __u8 bDescriptorType;
183 __u8 bDescriptorSubType;
184
185 __le16 bcdNcmVersion;
186 __u8 bmNetworkCapabilities;
187} __attribute__ ((packed));
177/*-------------------------------------------------------------------------*/ 188/*-------------------------------------------------------------------------*/
178 189
179/* 190/*
@@ -197,6 +208,17 @@ struct usb_cdc_obex_desc {
197#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 208#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
198#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 209#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
199#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 210#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
211#define USB_CDC_GET_NTB_PARAMETERS 0x80
212#define USB_CDC_GET_NET_ADDRESS 0x81
213#define USB_CDC_SET_NET_ADDRESS 0x82
214#define USB_CDC_GET_NTB_FORMAT 0x83
215#define USB_CDC_SET_NTB_FORMAT 0x84
216#define USB_CDC_GET_NTB_INPUT_SIZE 0x85
217#define USB_CDC_SET_NTB_INPUT_SIZE 0x86
218#define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87
219#define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88
220#define USB_CDC_GET_CRC_MODE 0x89
221#define USB_CDC_SET_CRC_MODE 0x8a
200 222
201/* Line Coding Structure from CDC spec 6.2.13 */ 223/* Line Coding Structure from CDC spec 6.2.13 */
202struct usb_cdc_line_coding { 224struct usb_cdc_line_coding {
@@ -247,4 +269,76 @@ struct usb_cdc_notification {
247 __le16 wLength; 269 __le16 wLength;
248} __attribute__ ((packed)); 270} __attribute__ ((packed));
249 271
272/*-------------------------------------------------------------------------*/
273
274/*
275 * Class Specific structures and constants
276 *
277 * CDC NCM parameter structure, CDC NCM subclass 6.2.1
278 *
279 */
280
281struct usb_cdc_ncm_ntb_parameter {
282 __le16 wLength;
283 __le16 bmNtbFormatSupported;
284 __le32 dwNtbInMaxSize;
285 __le16 wNdpInDivisor;
286 __le16 wNdpInPayloadRemainder;
287 __le16 wNdpInAlignment;
288 __le16 wPadding1;
289 __le32 dwNtbOutMaxSize;
290 __le16 wNdpOutDivisor;
291 __le16 wNdpOutPayloadRemainder;
292 __le16 wNdpOutAlignment;
293 __le16 wPadding2;
294} __attribute__ ((packed));
295
296/*
297 * CDC NCM transfer headers, CDC NCM subclass 3.2
298 */
299
300#define NCM_NTH16_SIGN 0x484D434E /* NCMH */
301#define NCM_NTH32_SIGN 0x686D636E /* ncmh */
302
303struct usb_cdc_ncm_nth16 {
304 __le32 dwSignature;
305 __le16 wHeaderLength;
306 __le16 wSequence;
307 __le16 wBlockLength;
308 __le16 wFpIndex;
309} __attribute__ ((packed));
310
311struct usb_cdc_ncm_nth32 {
312 __le32 dwSignature;
313 __le16 wHeaderLength;
314 __le16 wSequence;
315 __le32 dwBlockLength;
316 __le32 dwFpIndex;
317} __attribute__ ((packed));
318
319/*
320 * CDC NCM datagram pointers, CDC NCM subclass 3.3
321 */
322
323#define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
324#define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
325#define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327
328struct usb_cdc_ncm_ndp16 {
329 __le32 dwSignature;
330 __le16 wLength;
331 __le16 wNextFpIndex;
332 __u8 data[0];
333} __attribute__ ((packed));
334
335struct usb_cdc_ncm_ndp32 {
336 __le32 dwSignature;
337 __le16 wLength;
338 __le16 wReserved6;
339 __le32 dwNextFpIndex;
340 __le32 dwReserved12;
341 __u8 data[0];
342} __attribute__ ((packed));
343
250#endif /* __LINUX_USB_CDC_H */ 344#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
new file mode 100644
index 000000000000..119194c85d10
--- /dev/null
+++ b/include/linux/usb/ch11.h
@@ -0,0 +1,167 @@
1/*
2 * This file holds Hub protocol constants and data structures that are
3 * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
4 *
5 * It is used/shared between the USB core, the HCDs and couple of other USB
6 * drivers.
7 */
8
9#ifndef __LINUX_CH11_H
10#define __LINUX_CH11_H
11
12#include <linux/types.h> /* __u8 etc */
13
14/*
15 * Hub request types
16 */
17
18#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
19#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
20
21/*
22 * Hub class requests
23 * See USB 2.0 spec Table 11-16
24 */
25#define HUB_CLEAR_TT_BUFFER 8
26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11
29
30/*
31 * Hub Class feature numbers
32 * See USB 2.0 spec Table 11-17
33 */
34#define C_HUB_LOCAL_POWER 0
35#define C_HUB_OVER_CURRENT 1
36
37/*
38 * Port feature numbers
39 * See USB 2.0 spec Table 11-17
40 */
41#define USB_PORT_FEAT_CONNECTION 0
42#define USB_PORT_FEAT_ENABLE 1
43#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
44#define USB_PORT_FEAT_OVER_CURRENT 3
45#define USB_PORT_FEAT_RESET 4
46#define USB_PORT_FEAT_L1 5 /* L1 suspend */
47#define USB_PORT_FEAT_POWER 8
48#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
49#define USB_PORT_FEAT_C_CONNECTION 16
50#define USB_PORT_FEAT_C_ENABLE 17
51#define USB_PORT_FEAT_C_SUSPEND 18
52#define USB_PORT_FEAT_C_OVER_CURRENT 19
53#define USB_PORT_FEAT_C_RESET 20
54#define USB_PORT_FEAT_TEST 21
55#define USB_PORT_FEAT_INDICATOR 22
56#define USB_PORT_FEAT_C_PORT_L1 23
57
58/*
59 * Hub Status and Hub Change results
60 * See USB 2.0 spec Table 11-19 and Table 11-20
61 */
62struct usb_port_status {
63 __le16 wPortStatus;
64 __le16 wPortChange;
65} __attribute__ ((packed));
66
67/*
68 * wPortStatus bit field
69 * See USB 2.0 spec Table 11-21
70 */
71#define USB_PORT_STAT_CONNECTION 0x0001
72#define USB_PORT_STAT_ENABLE 0x0002
73#define USB_PORT_STAT_SUSPEND 0x0004
74#define USB_PORT_STAT_OVERCURRENT 0x0008
75#define USB_PORT_STAT_RESET 0x0010
76#define USB_PORT_STAT_L1 0x0020
77/* bits 6 to 7 are reserved */
78#define USB_PORT_STAT_POWER 0x0100
79#define USB_PORT_STAT_LOW_SPEED 0x0200
80#define USB_PORT_STAT_HIGH_SPEED 0x0400
81#define USB_PORT_STAT_TEST 0x0800
82#define USB_PORT_STAT_INDICATOR 0x1000
83/* bits 13 to 15 are reserved */
84#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
85
86/*
87 * wPortChange bit field
88 * See USB 2.0 spec Table 11-22
89 * Bits 0 to 4 shown, bits 5 to 15 are reserved
90 */
91#define USB_PORT_STAT_C_CONNECTION 0x0001
92#define USB_PORT_STAT_C_ENABLE 0x0002
93#define USB_PORT_STAT_C_SUSPEND 0x0004
94#define USB_PORT_STAT_C_OVERCURRENT 0x0008
95#define USB_PORT_STAT_C_RESET 0x0010
96#define USB_PORT_STAT_C_L1 0x0020
97
98/*
99 * wHubCharacteristics (masks)
100 * See USB 2.0 spec Table 11-13, offset 3
101 */
102#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
103#define HUB_CHAR_COMPOUND 0x0004 /* D2 */
104#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
105#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
106#define HUB_CHAR_PORTIND 0x0080 /* D7 */
107
108struct usb_hub_status {
109 __le16 wHubStatus;
110 __le16 wHubChange;
111} __attribute__ ((packed));
112
113/*
114 * Hub Status & Hub Change bit masks
115 * See USB 2.0 spec Table 11-19 and Table 11-20
116 * Bits 0 and 1 for wHubStatus and wHubChange
117 * Bits 2 to 15 are reserved for both
118 */
119#define HUB_STATUS_LOCAL_POWER 0x0001
120#define HUB_STATUS_OVERCURRENT 0x0002
121#define HUB_CHANGE_LOCAL_POWER 0x0001
122#define HUB_CHANGE_OVERCURRENT 0x0002
123
124
125/*
126 * Hub descriptor
127 * See USB 2.0 spec Table 11-13
128 */
129
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
131#define USB_DT_HUB_NONVAR_SIZE 7
132
133struct usb_hub_descriptor {
134 __u8 bDescLength;
135 __u8 bDescriptorType;
136 __u8 bNbrPorts;
137 __le16 wHubCharacteristics;
138 __u8 bPwrOn2PwrGood;
139 __u8 bHubContrCurrent;
140 /* add 1 bit for hub status change; round to bytes */
141 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
142 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
143} __attribute__ ((packed));
144
145
146/* port indicator status selectors, tables 11-7 and 11-25 */
147#define HUB_LED_AUTO 0
148#define HUB_LED_AMBER 1
149#define HUB_LED_GREEN 2
150#define HUB_LED_OFF 3
151
152enum hub_led_mode {
153 INDICATOR_AUTO = 0,
154 INDICATOR_CYCLE,
155 /* software blinks for attention: software, hardware, reserved */
156 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
157 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
158 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
159} __attribute__ ((packed));
160
161/* Transaction Translator Think Times, in bits */
162#define HUB_TTTT_8_BITS 0x00
163#define HUB_TTTT_16_BITS 0x20
164#define HUB_TTTT_24_BITS 0x40
165#define HUB_TTTT_32_BITS 0x60
166
167#endif /* __LINUX_CH11_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index e58369ff8168..da2ed77d3e8d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the T10 UAS specification */
195#define USB_DT_PIPE_USAGE 0x24
194/* From the USB 3.0 spec */ 196/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30 197#define USB_DT_SS_ENDPOINT_COMP 0x30
196 198
@@ -475,7 +477,7 @@ static inline int usb_endpoint_xfer_isoc(
475static inline int usb_endpoint_is_bulk_in( 477static inline int usb_endpoint_is_bulk_in(
476 const struct usb_endpoint_descriptor *epd) 478 const struct usb_endpoint_descriptor *epd)
477{ 479{
478 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 480 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
479} 481}
480 482
481/** 483/**
@@ -488,7 +490,7 @@ static inline int usb_endpoint_is_bulk_in(
488static inline int usb_endpoint_is_bulk_out( 490static inline int usb_endpoint_is_bulk_out(
489 const struct usb_endpoint_descriptor *epd) 491 const struct usb_endpoint_descriptor *epd)
490{ 492{
491 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 493 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
492} 494}
493 495
494/** 496/**
@@ -501,7 +503,7 @@ static inline int usb_endpoint_is_bulk_out(
501static inline int usb_endpoint_is_int_in( 503static inline int usb_endpoint_is_int_in(
502 const struct usb_endpoint_descriptor *epd) 504 const struct usb_endpoint_descriptor *epd)
503{ 505{
504 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 506 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
505} 507}
506 508
507/** 509/**
@@ -514,7 +516,7 @@ static inline int usb_endpoint_is_int_in(
514static inline int usb_endpoint_is_int_out( 516static inline int usb_endpoint_is_int_out(
515 const struct usb_endpoint_descriptor *epd) 517 const struct usb_endpoint_descriptor *epd)
516{ 518{
517 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 519 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
518} 520}
519 521
520/** 522/**
@@ -527,7 +529,7 @@ static inline int usb_endpoint_is_int_out(
527static inline int usb_endpoint_is_isoc_in( 529static inline int usb_endpoint_is_isoc_in(
528 const struct usb_endpoint_descriptor *epd) 530 const struct usb_endpoint_descriptor *epd)
529{ 531{
530 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 532 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
531} 533}
532 534
533/** 535/**
@@ -540,7 +542,7 @@ static inline int usb_endpoint_is_isoc_in(
540static inline int usb_endpoint_is_isoc_out( 542static inline int usb_endpoint_is_isoc_out(
541 const struct usb_endpoint_descriptor *epd) 543 const struct usb_endpoint_descriptor *epd)
542{ 544{
543 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 545 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
544} 546}
545 547
546/*-------------------------------------------------------------------------*/ 548/*-------------------------------------------------------------------------*/
@@ -556,6 +558,8 @@ struct usb_ss_ep_comp_descriptor {
556} __attribute__ ((packed)); 558} __attribute__ ((packed));
557 559
558#define USB_DT_SS_EP_COMP_SIZE 6 560#define USB_DT_SS_EP_COMP_SIZE 6
561/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
562#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f))
559 563
560/*-------------------------------------------------------------------------*/ 564/*-------------------------------------------------------------------------*/
561 565
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 738ea1a691cb..139353efad34 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -326,6 +326,7 @@ struct usb_composite_dev {
326 326
327 /* private: */ 327 /* private: */
328 /* internals */ 328 /* internals */
329 unsigned int suspended:1;
329 struct usb_device_descriptor desc; 330 struct usb_device_descriptor desc;
330 struct list_head configs; 331 struct list_head configs;
331 struct usb_composite_driver *driver; 332 struct usb_composite_driver *driver;
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index af4b86f3aca3..80287af2a738 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -45,7 +45,7 @@ struct ehci_caps {
45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ 45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ 46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ 47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
48 u8 portroute [8]; /* nibbles for routing - offset 0xC */ 48 u8 portroute[8]; /* nibbles for routing - offset 0xC */
49} __attribute__ ((packed)); 49} __attribute__ ((packed));
50 50
51 51
@@ -92,14 +92,14 @@ struct ehci_regs {
92 /* ASYNCLISTADDR: offset 0x18 */ 92 /* ASYNCLISTADDR: offset 0x18 */
93 u32 async_next; /* address of next async queue head */ 93 u32 async_next; /* address of next async queue head */
94 94
95 u32 reserved [9]; 95 u32 reserved[9];
96 96
97 /* CONFIGFLAG: offset 0x40 */ 97 /* CONFIGFLAG: offset 0x40 */
98 u32 configured_flag; 98 u32 configured_flag;
99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */ 99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
100 100
101 /* PORTSC: offset 0x44 */ 101 /* PORTSC: offset 0x44 */
102 u32 port_status [0]; /* up to N_PORTS */ 102 u32 port_status[0]; /* up to N_PORTS */
103/* 31:23 reserved */ 103/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
new file mode 100644
index 000000000000..a34a2a043b21
--- /dev/null
+++ b/include/linux/usb/functionfs.h
@@ -0,0 +1,199 @@
1#ifndef __LINUX_FUNCTIONFS_H__
2#define __LINUX_FUNCTIONFS_H__ 1
3
4
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | lenght | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string ther is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168#ifdef __KERNEL__
169
170struct ffs_data;
171struct usb_composite_dev;
172struct usb_configuration;
173
174
175static int functionfs_init(void) __attribute__((warn_unused_result));
176static void functionfs_cleanup(void);
177
178static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
179 __attribute__((warn_unused_result, nonnull));
180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull));
182
183static int functionfs_add(struct usb_composite_dev *cdev,
184 struct usb_configuration *c,
185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull));
187
188
189static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull));
195
196
197#endif
198
199#endif
diff --git a/include/linux/usb/g_hid.h b/include/linux/usb/g_hid.h
new file mode 100644
index 000000000000..50f5745df28c
--- /dev/null
+++ b/include/linux/usb/g_hid.h
@@ -0,0 +1,32 @@
1/*
2 * g_hid.h -- Header file for USB HID gadget driver
3 *
4 * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_USB_G_HID_H
22#define __LINUX_USB_G_HID_H
23
24struct hidg_func_descriptor {
25 unsigned char subclass;
26 unsigned char protocol;
27 unsigned short report_length;
28 unsigned short report_desc_length;
29 unsigned char report_desc[];
30};
31
32#endif /* __LINUX_USB_G_HID_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f4b7ca516cdd..d3ef42d7d2f0 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -494,9 +494,13 @@ static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
494 { dev_set_drvdata(&gadget->dev, data); } 494 { dev_set_drvdata(&gadget->dev, data); }
495static inline void *get_gadget_data(struct usb_gadget *gadget) 495static inline void *get_gadget_data(struct usb_gadget *gadget)
496 { return dev_get_drvdata(&gadget->dev); } 496 { return dev_get_drvdata(&gadget->dev); }
497static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
498{
499 return container_of(dev, struct usb_gadget, dev);
500}
497 501
498/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ 502/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
499#define gadget_for_each_ep(tmp,gadget) \ 503#define gadget_for_each_ep(tmp, gadget) \
500 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) 504 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
501 505
502 506
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index 612102e4d75e..0bb12e0d4f8f 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -19,7 +19,7 @@
19#define __LINUX_USB_GADGETFS_H 19#define __LINUX_USB_GADGETFS_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <asm/ioctl.h> 22#include <linux/ioctl.h>
23 23
24#include <linux/usb/ch9.h> 24#include <linux/usb/ch9.h>
25 25
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
new file mode 100644
index 000000000000..2e3a4ea1a3da
--- /dev/null
+++ b/include/linux/usb/hcd.h
@@ -0,0 +1,625 @@
1/*
2 * Copyright (c) 2001-2002 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_HCD_H
20#define __USB_CORE_HCD_H
21
22#ifdef __KERNEL__
23
24#include <linux/rwsem.h>
25
26#define MAX_TOPO_LEVEL 6
27
28/* This file contains declarations of usbcore internals that are mostly
29 * used or exposed by Host Controller Drivers.
30 */
31
32/*
33 * USB Packet IDs (PIDs)
34 */
35#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */
36#define USB_PID_OUT 0xe1
37#define USB_PID_ACK 0xd2
38#define USB_PID_DATA0 0xc3
39#define USB_PID_PING 0xb4 /* USB 2.0 */
40#define USB_PID_SOF 0xa5
41#define USB_PID_NYET 0x96 /* USB 2.0 */
42#define USB_PID_DATA2 0x87 /* USB 2.0 */
43#define USB_PID_SPLIT 0x78 /* USB 2.0 */
44#define USB_PID_IN 0x69
45#define USB_PID_NAK 0x5a
46#define USB_PID_DATA1 0x4b
47#define USB_PID_PREAMBLE 0x3c /* Token mode */
48#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
49#define USB_PID_SETUP 0x2d
50#define USB_PID_STALL 0x1e
51#define USB_PID_MDATA 0x0f /* USB 2.0 */
52
53/*-------------------------------------------------------------------------*/
54
55/*
56 * USB Host Controller Driver (usb_hcd) framework
57 *
58 * Since "struct usb_bus" is so thin, you can't share much code in it.
59 * This framework is a layer over that, and should be more sharable.
60 *
61 * @authorized_default: Specifies if new devices are authorized to
62 * connect by default or they require explicit
63 * user space authorization; this bit is settable
64 * through /sys/class/usb_host/X/authorized_default.
65 * For the rest is RO, so we don't lock to r/w it.
66 */
67
68/*-------------------------------------------------------------------------*/
69
70struct usb_hcd {
71
72 /*
73 * housekeeping
74 */
75 struct usb_bus self; /* hcd is-a bus */
76 struct kref kref; /* reference counter */
77
78 const char *product_desc; /* product/vendor string */
79 char irq_descr[24]; /* driver + bus # */
80
81 struct timer_list rh_timer; /* drives root-hub polling */
82 struct urb *status_urb; /* the current status urb */
83#ifdef CONFIG_USB_SUSPEND
84 struct work_struct wakeup_work; /* for remote wakeup */
85#endif
86
87 /*
88 * hardware info/state
89 */
90 const struct hc_driver *driver; /* hw-specific hooks */
91
92 /* Flags that need to be manipulated atomically */
93 unsigned long flags;
94#define HCD_FLAG_HW_ACCESSIBLE 0x00000001
95#define HCD_FLAG_SAW_IRQ 0x00000002
96
97 unsigned rh_registered:1;/* is root hub registered? */
98
99 /* The next flag is a stopgap, to be removed when all the HCDs
100 * support the new root-hub polling mechanism. */
101 unsigned uses_new_polling:1;
102 unsigned poll_rh:1; /* poll for rh status? */
103 unsigned poll_pending:1; /* status has changed? */
104 unsigned wireless:1; /* Wireless USB HCD */
105 unsigned authorized_default:1;
106 unsigned has_tt:1; /* Integrated TT in root hub */
107
108 int irq; /* irq allocated */
109 void __iomem *regs; /* device memory/io */
110 u64 rsrc_start; /* memory/io resource start */
111 u64 rsrc_len; /* memory/io resource length */
112 unsigned power_budget; /* in mA, 0 = no limit */
113
114 /* bandwidth_mutex should be taken before adding or removing
115 * any new bus bandwidth constraints:
116 * 1. Before adding a configuration for a new device.
117 * 2. Before removing the configuration to put the device into
118 * the addressed state.
119 * 3. Before selecting a different configuration.
120 * 4. Before selecting an alternate interface setting.
121 *
122 * bandwidth_mutex should be dropped after a successful control message
123 * to the device, or resetting the bandwidth after a failed attempt.
124 */
125 struct mutex bandwidth_mutex;
126
127
128#define HCD_BUFFER_POOLS 4
129 struct dma_pool *pool[HCD_BUFFER_POOLS];
130
131 int state;
132# define __ACTIVE 0x01
133# define __SUSPEND 0x04
134# define __TRANSIENT 0x80
135
136# define HC_STATE_HALT 0
137# define HC_STATE_RUNNING (__ACTIVE)
138# define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
139# define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT)
140# define HC_STATE_SUSPENDED (__SUSPEND)
141
142#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
143#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
144
145 /* more shared queuing code would be good; it should support
146 * smarter scheduling, handle transaction translators, etc;
147 * input size of periodic table to an interrupt scheduler.
148 * (ohci 32, uhci 1024, ehci 256/512/1024).
149 */
150
151 /* The HC driver's private data is stored at the end of
152 * this structure.
153 */
154 unsigned long hcd_priv[0]
155 __attribute__ ((aligned(sizeof(unsigned long))));
156};
157
158/* 2.4 does this a bit differently ... */
159static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)
160{
161 return &hcd->self;
162}
163
164static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)
165{
166 return container_of(bus, struct usb_hcd, self);
167}
168
169struct hcd_timeout { /* timeouts we allocate */
170 struct list_head timeout_list;
171 struct timer_list timer;
172};
173
174/*-------------------------------------------------------------------------*/
175
176
177struct hc_driver {
178 const char *description; /* "ehci-hcd" etc */
179 const char *product_desc; /* product/vendor string */
180 size_t hcd_priv_size; /* size of private data */
181
182 /* irq handler */
183 irqreturn_t (*irq) (struct usb_hcd *hcd);
184
185 int flags;
186#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
187#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
188#define HCD_USB11 0x0010 /* USB 1.1 */
189#define HCD_USB2 0x0020 /* USB 2.0 */
190#define HCD_USB3 0x0040 /* USB 3.0 */
191#define HCD_MASK 0x0070
192
193 /* called to init HCD and root hub */
194 int (*reset) (struct usb_hcd *hcd);
195 int (*start) (struct usb_hcd *hcd);
196
197 /* NOTE: these suspend/resume calls relate to the HC as
198 * a whole, not just the root hub; they're for PCI bus glue.
199 */
200 /* called after suspending the hub, before entering D3 etc */
201 int (*pci_suspend)(struct usb_hcd *hcd);
202
203 /* called after entering D0 (etc), before resuming the hub */
204 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
205
206 /* cleanly make HCD stop writing memory and doing I/O */
207 void (*stop) (struct usb_hcd *hcd);
208
209 /* shutdown HCD */
210 void (*shutdown) (struct usb_hcd *hcd);
211
212 /* return current frame number */
213 int (*get_frame_number) (struct usb_hcd *hcd);
214
215 /* manage i/o requests, device state */
216 int (*urb_enqueue)(struct usb_hcd *hcd,
217 struct urb *urb, gfp_t mem_flags);
218 int (*urb_dequeue)(struct usb_hcd *hcd,
219 struct urb *urb, int status);
220
221 /* hw synch, freeing endpoint resources that urb_dequeue can't */
222 void (*endpoint_disable)(struct usb_hcd *hcd,
223 struct usb_host_endpoint *ep);
224
225 /* (optional) reset any endpoint state such as sequence number
226 and current window */
227 void (*endpoint_reset)(struct usb_hcd *hcd,
228 struct usb_host_endpoint *ep);
229
230 /* root hub support */
231 int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
232 int (*hub_control) (struct usb_hcd *hcd,
233 u16 typeReq, u16 wValue, u16 wIndex,
234 char *buf, u16 wLength);
235 int (*bus_suspend)(struct usb_hcd *);
236 int (*bus_resume)(struct usb_hcd *);
237 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
238
239 /* force handover of high-speed port to full-speed companion */
240 void (*relinquish_port)(struct usb_hcd *, int);
241 /* has a port been handed over to a companion? */
242 int (*port_handed_over)(struct usb_hcd *, int);
243
244 /* CLEAR_TT_BUFFER completion callback */
245 void (*clear_tt_buffer_complete)(struct usb_hcd *,
246 struct usb_host_endpoint *);
247
248 /* xHCI specific functions */
249 /* Called by usb_alloc_dev to alloc HC device structures */
250 int (*alloc_dev)(struct usb_hcd *, struct usb_device *);
251 /* Called by usb_disconnect to free HC device structures */
252 void (*free_dev)(struct usb_hcd *, struct usb_device *);
253 /* Change a group of bulk endpoints to support multiple stream IDs */
254 int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev,
255 struct usb_host_endpoint **eps, unsigned int num_eps,
256 unsigned int num_streams, gfp_t mem_flags);
257 /* Reverts a group of bulk endpoints back to not using stream IDs.
258 * Can fail if we run out of memory.
259 */
260 int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev,
261 struct usb_host_endpoint **eps, unsigned int num_eps,
262 gfp_t mem_flags);
263
264 /* Bandwidth computation functions */
265 /* Note that add_endpoint() can only be called once per endpoint before
266 * check_bandwidth() or reset_bandwidth() must be called.
267 * drop_endpoint() can only be called once per endpoint also.
268 * A call to xhci_drop_endpoint() followed by a call to
269 * xhci_add_endpoint() will add the endpoint to the schedule with
270 * possibly new parameters denoted by a different endpoint descriptor
271 * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a
272 * call to xhci_drop_endpoint() is not allowed.
273 */
274 /* Allocate endpoint resources and add them to a new schedule */
275 int (*add_endpoint)(struct usb_hcd *, struct usb_device *,
276 struct usb_host_endpoint *);
277 /* Drop an endpoint from a new schedule */
278 int (*drop_endpoint)(struct usb_hcd *, struct usb_device *,
279 struct usb_host_endpoint *);
280 /* Check that a new hardware configuration, set using
281 * endpoint_enable and endpoint_disable, does not exceed bus
282 * bandwidth. This must be called before any set configuration
283 * or set interface requests are sent to the device.
284 */
285 int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
286 /* Reset the device schedule to the last known good schedule,
287 * which was set from a previous successful call to
288 * check_bandwidth(). This reverts any add_endpoint() and
289 * drop_endpoint() calls since that last successful call.
290 * Used for when a check_bandwidth() call fails due to resource
291 * or bandwidth constraints.
292 */
293 void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
294 /* Returns the hardware-chosen device address */
295 int (*address_device)(struct usb_hcd *, struct usb_device *udev);
296 /* Notifies the HCD after a hub descriptor is fetched.
297 * Will block.
298 */
299 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
300 struct usb_tt *tt, gfp_t mem_flags);
301 int (*reset_device)(struct usb_hcd *, struct usb_device *);
302};
303
304extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
305extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
306 int status);
307extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);
308
309extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
310extern int usb_hcd_unlink_urb(struct urb *urb, int status);
311extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
312 int status);
313extern void usb_hcd_flush_endpoint(struct usb_device *udev,
314 struct usb_host_endpoint *ep);
315extern void usb_hcd_disable_endpoint(struct usb_device *udev,
316 struct usb_host_endpoint *ep);
317extern void usb_hcd_reset_endpoint(struct usb_device *udev,
318 struct usb_host_endpoint *ep);
319extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
320extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
321 struct usb_host_config *new_config,
322 struct usb_host_interface *old_alt,
323 struct usb_host_interface *new_alt);
324extern int usb_hcd_get_frame_number(struct usb_device *udev);
325
326extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
327 struct device *dev, const char *bus_name);
328extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
329extern void usb_put_hcd(struct usb_hcd *hcd);
330extern int usb_add_hcd(struct usb_hcd *hcd,
331 unsigned int irqnum, unsigned long irqflags);
332extern void usb_remove_hcd(struct usb_hcd *hcd);
333
334struct platform_device;
335extern void usb_hcd_platform_shutdown(struct platform_device *dev);
336
337#ifdef CONFIG_PCI
338struct pci_dev;
339struct pci_device_id;
340extern int usb_hcd_pci_probe(struct pci_dev *dev,
341 const struct pci_device_id *id);
342extern void usb_hcd_pci_remove(struct pci_dev *dev);
343extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
344
345#ifdef CONFIG_PM_SLEEP
346extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
347#endif
348#endif /* CONFIG_PCI */
349
350/* pci-ish (pdev null is ok) buffer alloc/mapping support */
351int hcd_buffer_create(struct usb_hcd *hcd);
352void hcd_buffer_destroy(struct usb_hcd *hcd);
353
354void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,
355 gfp_t mem_flags, dma_addr_t *dma);
356void hcd_buffer_free(struct usb_bus *bus, size_t size,
357 void *addr, dma_addr_t dma);
358
359/* generic bus glue, needed for host controllers that don't use PCI */
360extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
361
362extern void usb_hc_died(struct usb_hcd *hcd);
363extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
364
365/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
366#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
367#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
368#define usb_settoggle(dev, ep, out, bit) \
369 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
370 ((bit) << (ep)))
371
372/* -------------------------------------------------------------------------- */
373
374/* Enumeration is only for the hub driver, or HCD virtual root hubs */
375extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
376 struct usb_bus *, unsigned port);
377extern int usb_new_device(struct usb_device *dev);
378extern void usb_disconnect(struct usb_device **);
379
380extern int usb_get_configuration(struct usb_device *dev);
381extern void usb_destroy_configuration(struct usb_device *dev);
382
383/*-------------------------------------------------------------------------*/
384
385/*
386 * HCD Root Hub support
387 */
388
389#include <linux/usb/ch11.h>
390
391/*
392 * As of USB 2.0, full/low speed devices are segregated into trees.
393 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
394 * The other type grows from high speed hubs when they connect to
395 * full/low speed devices using "Transaction Translators" (TTs).
396 *
397 * TTs should only be known to the hub driver, and high speed bus
398 * drivers (only EHCI for now). They affect periodic scheduling and
399 * sometimes control/bulk error recovery.
400 */
401
402struct usb_device;
403
404struct usb_tt {
405 struct usb_device *hub; /* upstream highspeed hub */
406 int multi; /* true means one TT per port */
407 unsigned think_time; /* think time in ns */
408
409 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
410 spinlock_t lock;
411 struct list_head clear_list; /* of usb_tt_clear */
412 struct work_struct clear_work;
413};
414
415struct usb_tt_clear {
416 struct list_head clear_list;
417 unsigned tt;
418 u16 devinfo;
419 struct usb_hcd *hcd;
420 struct usb_host_endpoint *ep;
421};
422
423extern int usb_hub_clear_tt_buffer(struct urb *urb);
424extern void usb_ep0_reinit(struct usb_device *);
425
426/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
427#define DeviceRequest \
428 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
429#define DeviceOutRequest \
430 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
431
432#define InterfaceRequest \
433 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
434
435#define EndpointRequest \
436 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
437#define EndpointOutRequest \
438 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
439
440/* class requests from the USB 2.0 hub spec, table 11-15 */
441/* GetBusState and SetHubDescriptor are optional, omitted */
442#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
443#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
444#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
445#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
446#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
447#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
448#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
449
450
451/*-------------------------------------------------------------------------*/
452
453/*
454 * Generic bandwidth allocation constants/support
455 */
456#define FRAME_TIME_USECS 1000L
457#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
458 /* Trying not to use worst-case bit-stuffing
459 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
460 /* bytecount = data payload byte count */
461
462#define NS_TO_US(ns) ((ns + 500L) / 1000L)
463 /* convert & round nanoseconds to microseconds */
464
465
466/*
467 * Full/low speed bandwidth allocation constants/support.
468 */
469#define BW_HOST_DELAY 1000L /* nanoseconds */
470#define BW_HUB_LS_SETUP 333L /* nanoseconds */
471 /* 4 full-speed bit times (est.) */
472
473#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
474#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
475#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
476
477/*
478 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
479 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
480 * to preallocate bandwidth)
481 */
482#define USB2_HOST_DELAY 5 /* nsec, guess */
483#define HS_NSECS(bytes) (((55 * 8 * 2083) \
484 + (2083UL * (3 + BitTime(bytes))))/1000 \
485 + USB2_HOST_DELAY)
486#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \
487 + (2083UL * (3 + BitTime(bytes))))/1000 \
488 + USB2_HOST_DELAY)
489#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes))
490#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes))
491
492extern long usb_calc_bus_time(int speed, int is_input,
493 int isoc, int bytecount);
494
495/*-------------------------------------------------------------------------*/
496
497extern void usb_set_device_state(struct usb_device *udev,
498 enum usb_device_state new_state);
499
500/*-------------------------------------------------------------------------*/
501
502/* exported only within usbcore */
503
504extern struct list_head usb_bus_list;
505extern struct mutex usb_bus_list_lock;
506extern wait_queue_head_t usb_kill_urb_queue;
507
508extern int usb_find_interface_driver(struct usb_device *dev,
509 struct usb_interface *interface);
510
511#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
512
513#ifdef CONFIG_PM
514extern void usb_root_hub_lost_power(struct usb_device *rhdev);
515extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
516extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
517#endif /* CONFIG_PM */
518
519#ifdef CONFIG_USB_SUSPEND
520extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
521#else
522static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
523{
524 return;
525}
526#endif /* CONFIG_USB_SUSPEND */
527
528
529/*
530 * USB device fs stuff
531 */
532
533#ifdef CONFIG_USB_DEVICEFS
534
535/*
536 * these are expected to be called from the USB core/hub thread
537 * with the kernel lock held
538 */
539extern void usbfs_update_special(void);
540extern int usbfs_init(void);
541extern void usbfs_cleanup(void);
542
543#else /* CONFIG_USB_DEVICEFS */
544
545static inline void usbfs_update_special(void) {}
546static inline int usbfs_init(void) { return 0; }
547static inline void usbfs_cleanup(void) { }
548
549#endif /* CONFIG_USB_DEVICEFS */
550
551/*-------------------------------------------------------------------------*/
552
553#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
554
555struct usb_mon_operations {
556 void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
557 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
558 void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
559 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
560};
561
562extern struct usb_mon_operations *mon_ops;
563
564static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
565{
566 if (bus->monitored)
567 (*mon_ops->urb_submit)(bus, urb);
568}
569
570static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
571 int error)
572{
573 if (bus->monitored)
574 (*mon_ops->urb_submit_error)(bus, urb, error);
575}
576
577static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
578 int status)
579{
580 if (bus->monitored)
581 (*mon_ops->urb_complete)(bus, urb, status);
582}
583
584int usb_mon_register(struct usb_mon_operations *ops);
585void usb_mon_deregister(void);
586
587#else
588
589static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
590static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
591 int error) {}
592static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
593 int status) {}
594
595#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
596
597/*-------------------------------------------------------------------------*/
598
599/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
600/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
601#define bitmap DeviceRemovable
602
603
604/*-------------------------------------------------------------------------*/
605
606/* random stuff */
607
608#define RUN_CONTEXT (in_irq() ? "in_irq" \
609 : (in_interrupt() ? "in_interrupt" : "can sleep"))
610
611
612/* This rwsem is for use only by the hub driver and ehci-hcd.
613 * Nobody else should touch it.
614 */
615extern struct rw_semaphore ehci_cf_port_reset_rwsem;
616
617/* Keep track of which host controller drivers are loaded */
618#define USB_UHCI_LOADED 0
619#define USB_OHCI_LOADED 1
620#define USB_EHCI_LOADED 2
621extern unsigned long usb_hcds_loaded;
622
623#endif /* __KERNEL__ */
624
625#endif /* __USB_CORE_HCD_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
index c949178a6530..2d2d1bbad9d2 100644
--- a/include/linux/usb/langwell_udc.h
+++ b/include/linux/usb/langwell_udc.h
@@ -181,7 +181,7 @@ struct langwell_op_regs {
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ 181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */ 182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */ 183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */ 184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */ 185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */ 186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */ 187#define PORTS_SUSP BIT(7) /* suspend */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 7acef0234c0e..ee2dd1d506ed 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -22,12 +22,47 @@ enum musb_mode {
22 22
23struct clk; 23struct clk;
24 24
25enum musb_fifo_style {
26 FIFO_RXTX,
27 FIFO_TX,
28 FIFO_RX
29} __attribute__ ((packed));
30
31enum musb_buf_mode {
32 BUF_SINGLE,
33 BUF_DOUBLE
34} __attribute__ ((packed));
35
36struct musb_fifo_cfg {
37 u8 hw_ep_num;
38 enum musb_fifo_style style;
39 enum musb_buf_mode mode;
40 u16 maxpacket;
41};
42
43#define MUSB_EP_FIFO(ep, st, m, pkt) \
44{ \
45 .hw_ep_num = ep, \
46 .style = st, \
47 .mode = m, \
48 .maxpacket = pkt, \
49}
50
51#define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
52 MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
53
54#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
55 MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
56
25struct musb_hdrc_eps_bits { 57struct musb_hdrc_eps_bits {
26 const char name[16]; 58 const char name[16];
27 u8 bits; 59 u8 bits;
28}; 60};
29 61
30struct musb_hdrc_config { 62struct musb_hdrc_config {
63 struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
64 unsigned fifo_cfg_size; /* size of the fifo configuration */
65
31 /* MUSB configuration-specific details */ 66 /* MUSB configuration-specific details */
32 unsigned multipoint:1; /* multipoint device */ 67 unsigned multipoint:1; /* multipoint device */
33 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ 68 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
@@ -51,8 +86,9 @@ struct musb_hdrc_config {
51 86
52 struct musb_hdrc_eps_bits *eps_bits __deprecated; 87 struct musb_hdrc_eps_bits *eps_bits __deprecated;
53#ifdef CONFIG_BLACKFIN 88#ifdef CONFIG_BLACKFIN
54 /* A GPIO controlling VRSEL in Blackfin */ 89 /* A GPIO controlling VRSEL in Blackfin */
55 unsigned int gpio_vrsel; 90 unsigned int gpio_vrsel;
91 unsigned int gpio_vrsel_active;
56#endif 92#endif
57 93
58}; 94};
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h
new file mode 100644
index 000000000000..006d1064c8b2
--- /dev/null
+++ b/include/linux/usb/ncm.h
@@ -0,0 +1,114 @@
1/*
2 * USB CDC NCM auxiliary definitions
3 */
4
5#ifndef __LINUX_USB_NCM_H
6#define __LINUX_USB_NCM_H
7
8#include <linux/types.h>
9#include <linux/usb/cdc.h>
10#include <asm/unaligned.h>
11
12#define NCM_NTB_MIN_IN_SIZE 2048
13#define NCM_NTB_MIN_OUT_SIZE 2048
14
15#define NCM_CONTROL_TIMEOUT (5 * 1000)
16
17/* bmNetworkCapabilities */
18
19#define NCM_NCAP_ETH_FILTER (1 << 0)
20#define NCM_NCAP_NET_ADDRESS (1 << 1)
21#define NCM_NCAP_ENCAP_COMM (1 << 2)
22#define NCM_NCAP_MAX_DGRAM (1 << 3)
23#define NCM_NCAP_CRC_MODE (1 << 4)
24
25/*
26 * Here are options for NCM Datagram Pointer table (NDP) parser.
27 * There are 2 different formats: NDP16 and NDP32 in the spec (ch. 3),
28 * in NDP16 offsets and sizes fields are 1 16bit word wide,
29 * in NDP32 -- 2 16bit words wide. Also signatures are different.
30 * To make the parser code the same, put the differences in the structure,
31 * and switch pointers to the structures when the format is changed.
32 */
33
34struct ndp_parser_opts {
35 u32 nth_sign;
36 u32 ndp_sign;
37 unsigned nth_size;
38 unsigned ndp_size;
39 unsigned ndplen_align;
40 /* sizes in u16 units */
41 unsigned dgram_item_len; /* index or length */
42 unsigned block_length;
43 unsigned fp_index;
44 unsigned reserved1;
45 unsigned reserved2;
46 unsigned next_fp_index;
47};
48
49#define INIT_NDP16_OPTS { \
50 .nth_sign = NCM_NTH16_SIGN, \
51 .ndp_sign = NCM_NDP16_NOCRC_SIGN, \
52 .nth_size = sizeof(struct usb_cdc_ncm_nth16), \
53 .ndp_size = sizeof(struct usb_cdc_ncm_ndp16), \
54 .ndplen_align = 4, \
55 .dgram_item_len = 1, \
56 .block_length = 1, \
57 .fp_index = 1, \
58 .reserved1 = 0, \
59 .reserved2 = 0, \
60 .next_fp_index = 1, \
61 }
62
63
64#define INIT_NDP32_OPTS { \
65 .nth_sign = NCM_NTH32_SIGN, \
66 .ndp_sign = NCM_NDP32_NOCRC_SIGN, \
67 .nth_size = sizeof(struct usb_cdc_ncm_nth32), \
68 .ndp_size = sizeof(struct usb_cdc_ncm_ndp32), \
69 .ndplen_align = 8, \
70 .dgram_item_len = 2, \
71 .block_length = 2, \
72 .fp_index = 2, \
73 .reserved1 = 1, \
74 .reserved2 = 2, \
75 .next_fp_index = 2, \
76 }
77
78static inline void put_ncm(__le16 **p, unsigned size, unsigned val)
79{
80 switch (size) {
81 case 1:
82 put_unaligned_le16((u16)val, *p);
83 break;
84 case 2:
85 put_unaligned_le32((u32)val, *p);
86
87 break;
88 default:
89 BUG();
90 }
91
92 *p += size;
93}
94
95static inline unsigned get_ncm(__le16 **p, unsigned size)
96{
97 unsigned tmp;
98
99 switch (size) {
100 case 1:
101 tmp = get_unaligned_le16(*p);
102 break;
103 case 2:
104 tmp = get_unaligned_le32(*p);
105 break;
106 default:
107 BUG();
108 }
109
110 *p += size;
111 return tmp;
112}
113
114#endif /* __LINUX_USB_NCM_H */
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index 96ca549a778d..148b8fa5b1a2 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -353,7 +353,7 @@ struct net2280_dma_regs { /* [11.7] */
353#define DMA_TRANSACTION_DONE_INTERRUPT 24 353#define DMA_TRANSACTION_DONE_INTERRUPT 24
354#define DMA_ABORT 1 354#define DMA_ABORT 1
355#define DMA_START 0 355#define DMA_START 0
356 u32 _unused0 [2]; 356 u32 _unused0[2];
357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ 357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
358 u32 dmacount; 358 u32 dmacount;
359#define VALID_BIT 31 359#define VALID_BIT 31
@@ -374,7 +374,7 @@ struct net2280_dep_regs { /* [11.8] */
374 u32 dep_cfg; 374 u32 dep_cfg;
375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ 375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
376 u32 dep_rsp; 376 u32 dep_rsp;
377 u32 _unused [2]; 377 u32 _unused[2];
378} __attribute__ ((packed)); 378} __attribute__ ((packed));
379 379
380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs 380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
@@ -437,7 +437,7 @@ struct net2280_ep_regs { /* [11.9] */
437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ 437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
438 u32 ep_avail; 438 u32 ep_avail;
439 u32 ep_data; 439 u32 ep_data;
440 u32 _unused0 [2]; 440 u32 _unused0[2];
441} __attribute__ ((packed)); 441} __attribute__ ((packed));
442 442
443#endif /* __LINUX_USB_NET2280_H */ 443#endif /* __LINUX_USB_NET2280_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 0a555dd131fc..16b7f3347545 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -22,4 +22,8 @@
22/*device will morph if reset, don't use reset for handling errors */ 22/*device will morph if reset, don't use reset for handling errors */
23#define USB_QUIRK_RESET_MORPHS 0x00000010 23#define USB_QUIRK_RESET_MORPHS 0x00000010
24 24
25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28
25#endif /* __LINUX_USB_QUIRKS_H */ 29#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 1ef1ebc2b04f..05ef52861988 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -34,10 +34,10 @@
34struct rndis_msg_hdr { 34struct rndis_msg_hdr {
35 __le32 msg_type; /* RNDIS_MSG_* */ 35 __le32 msg_type; /* RNDIS_MSG_* */
36 __le32 msg_len; 36 __le32 msg_len;
37 // followed by data that varies between messages 37 /* followed by data that varies between messages */
38 __le32 request_id; 38 __le32 request_id;
39 __le32 status; 39 __le32 status;
40 // ... and more 40 /* ... and more */
41} __attribute__ ((packed)); 41} __attribute__ ((packed));
42 42
43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ 43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
@@ -92,67 +92,67 @@ struct rndis_msg_hdr {
92 92
93struct rndis_data_hdr { 93struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 94 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; // rndis_data_hdr + data_len + pad 95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
96 __le32 data_offset; // 36 -- right after header 96 __le32 data_offset; /* 36 -- right after header */
97 __le32 data_len; // ... real packet size 97 __le32 data_len; /* ... real packet size */
98 98
99 __le32 oob_data_offset; // zero 99 __le32 oob_data_offset; /* zero */
100 __le32 oob_data_len; // zero 100 __le32 oob_data_len; /* zero */
101 __le32 num_oob; // zero 101 __le32 num_oob; /* zero */
102 __le32 packet_data_offset; // zero 102 __le32 packet_data_offset; /* zero */
103 103
104 __le32 packet_data_len; // zero 104 __le32 packet_data_len; /* zero */
105 __le32 vc_handle; // zero 105 __le32 vc_handle; /* zero */
106 __le32 reserved; // zero 106 __le32 reserved; /* zero */
107} __attribute__ ((packed)); 107} __attribute__ ((packed));
108 108
109struct rndis_init { /* OUT */ 109struct rndis_init { /* OUT */
110 // header and: 110 /* header and: */
111 __le32 msg_type; /* RNDIS_MSG_INIT */ 111 __le32 msg_type; /* RNDIS_MSG_INIT */
112 __le32 msg_len; // 24 112 __le32 msg_len; /* 24 */
113 __le32 request_id; 113 __le32 request_id;
114 __le32 major_version; // of rndis (1.0) 114 __le32 major_version; /* of rndis (1.0) */
115 __le32 minor_version; 115 __le32 minor_version;
116 __le32 max_transfer_size; 116 __le32 max_transfer_size;
117} __attribute__ ((packed)); 117} __attribute__ ((packed));
118 118
119struct rndis_init_c { /* IN */ 119struct rndis_init_c { /* IN */
120 // header and: 120 /* header and: */
121 __le32 msg_type; /* RNDIS_MSG_INIT_C */ 121 __le32 msg_type; /* RNDIS_MSG_INIT_C */
122 __le32 msg_len; 122 __le32 msg_len;
123 __le32 request_id; 123 __le32 request_id;
124 __le32 status; 124 __le32 status;
125 __le32 major_version; // of rndis (1.0) 125 __le32 major_version; /* of rndis (1.0) */
126 __le32 minor_version; 126 __le32 minor_version;
127 __le32 device_flags; 127 __le32 device_flags;
128 __le32 medium; // zero == 802.3 128 __le32 medium; /* zero == 802.3 */
129 __le32 max_packets_per_message; 129 __le32 max_packets_per_message;
130 __le32 max_transfer_size; 130 __le32 max_transfer_size;
131 __le32 packet_alignment; // max 7; (1<<n) bytes 131 __le32 packet_alignment; /* max 7; (1<<n) bytes */
132 __le32 af_list_offset; // zero 132 __le32 af_list_offset; /* zero */
133 __le32 af_list_size; // zero 133 __le32 af_list_size; /* zero */
134} __attribute__ ((packed)); 134} __attribute__ ((packed));
135 135
136struct rndis_halt { /* OUT (no reply) */ 136struct rndis_halt { /* OUT (no reply) */
137 // header and: 137 /* header and: */
138 __le32 msg_type; /* RNDIS_MSG_HALT */ 138 __le32 msg_type; /* RNDIS_MSG_HALT */
139 __le32 msg_len; 139 __le32 msg_len;
140 __le32 request_id; 140 __le32 request_id;
141} __attribute__ ((packed)); 141} __attribute__ ((packed));
142 142
143struct rndis_query { /* OUT */ 143struct rndis_query { /* OUT */
144 // header and: 144 /* header and: */
145 __le32 msg_type; /* RNDIS_MSG_QUERY */ 145 __le32 msg_type; /* RNDIS_MSG_QUERY */
146 __le32 msg_len; 146 __le32 msg_len;
147 __le32 request_id; 147 __le32 request_id;
148 __le32 oid; 148 __le32 oid;
149 __le32 len; 149 __le32 len;
150 __le32 offset; 150 __le32 offset;
151/*?*/ __le32 handle; // zero 151/*?*/ __le32 handle; /* zero */
152} __attribute__ ((packed)); 152} __attribute__ ((packed));
153 153
154struct rndis_query_c { /* IN */ 154struct rndis_query_c { /* IN */
155 // header and: 155 /* header and: */
156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */ 156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
157 __le32 msg_len; 157 __le32 msg_len;
158 __le32 request_id; 158 __le32 request_id;
@@ -162,18 +162,18 @@ struct rndis_query_c { /* IN */
162} __attribute__ ((packed)); 162} __attribute__ ((packed));
163 163
164struct rndis_set { /* OUT */ 164struct rndis_set { /* OUT */
165 // header and: 165 /* header and: */
166 __le32 msg_type; /* RNDIS_MSG_SET */ 166 __le32 msg_type; /* RNDIS_MSG_SET */
167 __le32 msg_len; 167 __le32 msg_len;
168 __le32 request_id; 168 __le32 request_id;
169 __le32 oid; 169 __le32 oid;
170 __le32 len; 170 __le32 len;
171 __le32 offset; 171 __le32 offset;
172/*?*/ __le32 handle; // zero 172/*?*/ __le32 handle; /* zero */
173} __attribute__ ((packed)); 173} __attribute__ ((packed));
174 174
175struct rndis_set_c { /* IN */ 175struct rndis_set_c { /* IN */
176 // header and: 176 /* header and: */
177 __le32 msg_type; /* RNDIS_MSG_SET_C */ 177 __le32 msg_type; /* RNDIS_MSG_SET_C */
178 __le32 msg_len; 178 __le32 msg_len;
179 __le32 request_id; 179 __le32 request_id;
@@ -181,14 +181,14 @@ struct rndis_set_c { /* IN */
181} __attribute__ ((packed)); 181} __attribute__ ((packed));
182 182
183struct rndis_reset { /* IN */ 183struct rndis_reset { /* IN */
184 // header and: 184 /* header and: */
185 __le32 msg_type; /* RNDIS_MSG_RESET */ 185 __le32 msg_type; /* RNDIS_MSG_RESET */
186 __le32 msg_len; 186 __le32 msg_len;
187 __le32 reserved; 187 __le32 reserved;
188} __attribute__ ((packed)); 188} __attribute__ ((packed));
189 189
190struct rndis_reset_c { /* OUT */ 190struct rndis_reset_c { /* OUT */
191 // header and: 191 /* header and: */
192 __le32 msg_type; /* RNDIS_MSG_RESET_C */ 192 __le32 msg_type; /* RNDIS_MSG_RESET_C */
193 __le32 msg_len; 193 __le32 msg_len;
194 __le32 status; 194 __le32 status;
@@ -196,7 +196,7 @@ struct rndis_reset_c { /* OUT */
196} __attribute__ ((packed)); 196} __attribute__ ((packed));
197 197
198struct rndis_indicate { /* IN (unrequested) */ 198struct rndis_indicate { /* IN (unrequested) */
199 // header and: 199 /* header and: */
200 __le32 msg_type; /* RNDIS_MSG_INDICATE */ 200 __le32 msg_type; /* RNDIS_MSG_INDICATE */
201 __le32 msg_len; 201 __le32 msg_len;
202 __le32 status; 202 __le32 status;
@@ -208,14 +208,14 @@ struct rndis_indicate { /* IN (unrequested) */
208} __attribute__ ((packed)); 208} __attribute__ ((packed));
209 209
210struct rndis_keepalive { /* OUT (optionally IN) */ 210struct rndis_keepalive { /* OUT (optionally IN) */
211 // header and: 211 /* header and: */
212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ 212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
213 __le32 msg_len; 213 __le32 msg_len;
214 __le32 request_id; 214 __le32 request_id;
215} __attribute__ ((packed)); 215} __attribute__ ((packed));
216 216
217struct rndis_keepalive_c { /* IN (optionally OUT) */ 217struct rndis_keepalive_c { /* IN (optionally OUT) */
218 // header and: 218 /* header and: */
219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ 219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
220 __le32 msg_len; 220 __le32 msg_len;
221 __le32 request_id; 221 __le32 request_id;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0a458b861933..84a4c44c208b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -35,6 +35,9 @@ enum port_dev_state {
35 PORT_UNREGISTERING, 35 PORT_UNREGISTERING,
36}; 36};
37 37
38/* USB serial flags */
39#define USB_SERIAL_WRITE_BUSY 0
40
38/** 41/**
39 * usb_serial_port: structure for the specific ports of a device. 42 * usb_serial_port: structure for the specific ports of a device.
40 * @serial: pointer back to the struct usb_serial owner of this port. 43 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -49,7 +52,7 @@ enum port_dev_state {
49 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. 52 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
50 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. 53 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
51 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe 54 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
52 * for this port. 55 * for this port.
53 * @bulk_in_buffer: pointer to the bulk in buffer for this port. 56 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
54 * @bulk_in_size: the size of the bulk_in_buffer, in bytes. 57 * @bulk_in_size: the size of the bulk_in_buffer, in bytes.
55 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
@@ -60,13 +63,17 @@ enum port_dev_state {
60 * @write_urb: pointer to the bulk out struct urb for this port. 63 * @write_urb: pointer to the bulk out struct urb for this port.
61 * @write_fifo: kfifo used to buffer outgoing data 64 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs
69 * @tx_bytes: number of bytes currently in host stack queues
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 70 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 71 * port.
72 * @flags: usb serial port flags
65 * @write_wait: a wait_queue_head_t used by the port. 73 * @write_wait: a wait_queue_head_t used by the port.
66 * @work: work queue entry for the line discipline waking up. 74 * @work: work queue entry for the line discipline waking up.
67 * @throttled: nonzero if the read urb is inactive to throttle the device 75 * @throttled: nonzero if the read urb is inactive to throttle the device
68 * @throttle_req: nonzero if the tty wants to throttle us 76 * @throttle_req: nonzero if the tty wants to throttle us
69 * @console: attached usb serial console
70 * @dev: pointer to the serial device 77 * @dev: pointer to the serial device
71 * 78 *
72 * This structure is used by the usb-serial core and drivers for the specific 79 * This structure is used by the usb-serial core and drivers for the specific
@@ -97,16 +104,19 @@ struct usb_serial_port {
97 struct urb *write_urb; 104 struct urb *write_urb;
98 struct kfifo write_fifo; 105 struct kfifo write_fifo;
99 int write_urb_busy; 106 int write_urb_busy;
107
108 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2];
110 unsigned long write_urbs_free;
100 __u8 bulk_out_endpointAddress; 111 __u8 bulk_out_endpointAddress;
101 112
102 int tx_bytes_flight; 113 int tx_bytes;
103 int urbs_in_flight;
104 114
115 unsigned long flags;
105 wait_queue_head_t write_wait; 116 wait_queue_head_t write_wait;
106 struct work_struct work; 117 struct work_struct work;
107 char throttled; 118 char throttled;
108 char throttle_req; 119 char throttle_req;
109 char console;
110 unsigned long sysrq; /* sysrq timeout */ 120 unsigned long sysrq; /* sysrq timeout */
111 struct device dev; 121 struct device dev;
112 enum port_dev_state dev_state; 122 enum port_dev_state dev_state;
@@ -181,6 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * @id_table: pointer to a list of usb_device_id structures that define all 191 * @id_table: pointer to a list of usb_device_id structures that define all
182 * of the devices this structure can support. 192 * of the devices this structure can support.
183 * @num_ports: the number of different ports this device will have. 193 * @num_ports: the number of different ports this device will have.
194 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
184 * @calc_num_ports: pointer to a function to determine how many ports this 196 * @calc_num_ports: pointer to a function to determine how many ports this
185 * device has dynamically. It will be called after the probe() 197 * device has dynamically. It will be called after the probe()
186 * callback is called, but before attach() 198 * callback is called, but before attach()
@@ -223,7 +235,9 @@ struct usb_serial_driver {
223 struct device_driver driver; 235 struct device_driver driver;
224 struct usb_driver *usb_driver; 236 struct usb_driver *usb_driver;
225 struct usb_dynids dynids; 237 struct usb_dynids dynids;
226 int max_in_flight_urbs; 238
239 size_t bulk_in_size;
240 size_t bulk_out_size;
227 241
228 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 242 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
229 int (*attach)(struct usb_serial *serial); 243 int (*attach)(struct usb_serial *serial);
@@ -269,6 +283,11 @@ struct usb_serial_driver {
269 void (*write_int_callback)(struct urb *urb); 283 void (*write_int_callback)(struct urb *urb);
270 void (*read_bulk_callback)(struct urb *urb); 284 void (*read_bulk_callback)(struct urb *urb);
271 void (*write_bulk_callback)(struct urb *urb); 285 void (*write_bulk_callback)(struct urb *urb);
286 /* Called by the generic read bulk callback */
287 void (*process_read_urb)(struct urb *urb);
288 /* Called by the generic write implementation */
289 int (*prepare_write_buffer)(struct usb_serial_port *port,
290 void *dest, size_t size);
272}; 291};
273#define to_usb_serial_driver(d) \ 292#define to_usb_serial_driver(d) \
274 container_of(d, struct usb_serial_driver, driver) 293 container_of(d, struct usb_serial_driver, driver)
@@ -318,8 +337,11 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
318extern void usb_serial_generic_release(struct usb_serial *serial); 337extern void usb_serial_generic_release(struct usb_serial *serial);
319extern int usb_serial_generic_register(int debug); 338extern int usb_serial_generic_register(int debug);
320extern void usb_serial_generic_deregister(void); 339extern void usb_serial_generic_deregister(void);
321extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, 340extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
322 gfp_t mem_flags); 341 gfp_t mem_flags);
342extern void usb_serial_generic_process_read_urb(struct urb *urb);
343extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
344 void *dest, size_t size);
323extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, 345extern int usb_serial_handle_sysrq_char(struct tty_struct *tty,
324 struct usb_serial_port *port, 346 struct usb_serial_port *port,
325 unsigned int ch); 347 unsigned int ch);
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 20675c6ebc4d..2369d07c3c87 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -1,6 +1,146 @@
1/*
2 * ulpi.h -- ULPI defines and function prorotypes
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This software is distributed under the terms of the GNU General
7 * Public License ("GPL") as published by the Free Software Foundation,
8 * version 2 of that License.
9 */
10
1#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
2#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
3 13
14/*-------------------------------------------------------------------------*/
15
16/*
17 * Macros for Set and Clear
18 * See ULPI 1.1 specification to find the registers with Set and Clear offsets
19 */
20#define ULPI_SET(a) (a + 1)
21#define ULPI_CLR(a) (a + 2)
22
23/*-------------------------------------------------------------------------*/
24
25/*
26 * Register Map
27 */
28#define ULPI_VENDOR_ID_LOW 0x00
29#define ULPI_VENDOR_ID_HIGH 0x01
30#define ULPI_PRODUCT_ID_LOW 0x02
31#define ULPI_PRODUCT_ID_HIGH 0x03
32#define ULPI_FUNC_CTRL 0x04
33#define ULPI_IFC_CTRL 0x07
34#define ULPI_OTG_CTRL 0x0a
35#define ULPI_USB_INT_EN_RISE 0x0d
36#define ULPI_USB_INT_EN_FALL 0x10
37#define ULPI_USB_INT_STS 0x13
38#define ULPI_USB_INT_LATCH 0x14
39#define ULPI_DEBUG 0x15
40#define ULPI_SCRATCH 0x16
41/* Optional Carkit Registers */
42#define ULPI_CARCIT_CTRL 0x19
43#define ULPI_CARCIT_INT_DELAY 0x1c
44#define ULPI_CARCIT_INT_EN 0x1d
45#define ULPI_CARCIT_INT_STS 0x20
46#define ULPI_CARCIT_INT_LATCH 0x21
47#define ULPI_CARCIT_PLS_CTRL 0x22
48/* Other Optional Registers */
49#define ULPI_TX_POS_WIDTH 0x25
50#define ULPI_TX_NEG_WIDTH 0x26
51#define ULPI_POLARITY_RECOVERY 0x27
52/* Access Extended Register Set */
53#define ULPI_ACCESS_EXTENDED 0x2f
54/* Vendor Specific */
55#define ULPI_VENDOR_SPECIFIC 0x30
56/* Extended Registers */
57#define ULPI_EXT_VENDOR_SPECIFIC 0x80
58
59/*-------------------------------------------------------------------------*/
60
61/* Function Control */
62#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
63#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
64#define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0)
65#define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0)
66#define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0)
67#define ULPI_FUNC_CTRL_FS4LS (3 << 0)
68#define ULPI_FUNC_CTRL_TERMSELECT (1 << 2)
69#define ULPI_FUNC_CTRL_OPMODE (1 << 3)
70#define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3)
71#define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3)
72#define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3)
73#define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3)
74#define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3)
75#define ULPI_FUNC_CTRL_RESET (1 << 5)
76#define ULPI_FUNC_CTRL_SUSPENDM (1 << 6)
77
78/* Interface Control */
79#define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0)
80#define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1)
81#define ULPI_IFC_CTRL_CARKITMODE (1 << 2)
82#define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3)
83#define ULPI_IFC_CTRL_AUTORESUME (1 << 4)
84#define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5)
85#define ULPI_IFC_CTRL_PASSTHRU (1 << 6)
86#define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7)
87
88/* OTG Control */
89#define ULPI_OTG_CTRL_ID_PULLUP (1 << 0)
90#define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1)
91#define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2)
92#define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3)
93#define ULPI_OTG_CTRL_CHRGVBUS (1 << 4)
94#define ULPI_OTG_CTRL_DRVVBUS (1 << 5)
95#define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6)
96#define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7)
97
98/* USB Interrupt Enable Rising,
99 * USB Interrupt Enable Falling,
100 * USB Interrupt Status and
101 * USB Interrupt Latch
102 */
103#define ULPI_INT_HOST_DISCONNECT (1 << 0)
104#define ULPI_INT_VBUS_VALID (1 << 1)
105#define ULPI_INT_SESS_VALID (1 << 2)
106#define ULPI_INT_SESS_END (1 << 3)
107#define ULPI_INT_IDGRD (1 << 4)
108
109/* Debug */
110#define ULPI_DEBUG_LINESTATE0 (1 << 0)
111#define ULPI_DEBUG_LINESTATE1 (1 << 1)
112
113/* Carkit Control */
114#define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0)
115#define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1)
116#define ULPI_CARKIT_CTRL_TXDEN (1 << 2)
117#define ULPI_CARKIT_CTRL_RXDEN (1 << 3)
118#define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4)
119#define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5)
120#define ULPI_CARKIT_CTRL_MICEN (1 << 6)
121
122/* Carkit Interrupt Enable */
123#define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0)
124#define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1)
125#define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2)
126#define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3)
127#define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4)
128
129/* Carkit Interrupt Status and
130 * Carkit Interrupt Latch
131 */
132#define ULPI_CARKIT_INT_IDFLOAT (1 << 0)
133#define ULPI_CARKIT_INT_CARINTDET (1 << 1)
134#define ULPI_CARKIT_INT_DP (1 << 2)
135
136/* Carkit Pulse Control*/
137#define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0)
138#define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1)
139#define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2)
140#define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3)
141
142/*-------------------------------------------------------------------------*/
143
4struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 144struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
5 unsigned int flags); 145 unsigned int flags);
6 146
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index df1e83dd9a54..7ae27a473818 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -43,7 +43,7 @@ struct usbnet {
43 /* protocol/interface state */ 43 /* protocol/interface state */
44 struct net_device *net; 44 struct net_device *net;
45 int msg_enable; 45 int msg_enable;
46 unsigned long data [5]; 46 unsigned long data[5];
47 u32 xid; 47 u32 xid;
48 u32 hard_mtu; /* count any extra framing */ 48 u32 hard_mtu; /* count any extra framing */
49 size_t rx_urb_size; /* size for rx urbs */ 49 size_t rx_urb_size; /* size for rx urbs */
@@ -148,8 +148,8 @@ struct driver_info {
148 * much everything except custom framing and chip-specific stuff. 148 * much everything except custom framing and chip-specific stuff.
149 */ 149 */
150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); 150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
151extern int usbnet_suspend (struct usb_interface *, pm_message_t ); 151extern int usbnet_suspend(struct usb_interface *, pm_message_t);
152extern int usbnet_resume (struct usb_interface *); 152extern int usbnet_resume(struct usb_interface *);
153extern void usbnet_disconnect(struct usb_interface *); 153extern void usbnet_disconnect(struct usb_interface *);
154 154
155 155
@@ -165,8 +165,8 @@ struct cdc_state {
165 struct usb_interface *data; 165 struct usb_interface *data;
166}; 166};
167 167
168extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *); 168extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
169extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); 169extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
170 170
171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
@@ -189,29 +189,31 @@ struct skb_data { /* skb->cb is one of these */
189 size_t length; 189 size_t length;
190}; 190};
191 191
192extern int usbnet_open (struct net_device *net); 192extern int usbnet_open(struct net_device *net);
193extern int usbnet_stop (struct net_device *net); 193extern int usbnet_stop(struct net_device *net);
194extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, 194extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
195 struct net_device *net); 195 struct net_device *net);
196extern void usbnet_tx_timeout (struct net_device *net); 196extern void usbnet_tx_timeout(struct net_device *net);
197extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 197extern int usbnet_change_mtu(struct net_device *net, int new_mtu);
198 198
199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
200extern int usbnet_get_ethernet_addr(struct usbnet *, int); 200extern int usbnet_get_ethernet_addr(struct usbnet *, int);
201extern void usbnet_defer_kevent (struct usbnet *, int); 201extern void usbnet_defer_kevent(struct usbnet *, int);
202extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 202extern void usbnet_skb_return(struct usbnet *, struct sk_buff *);
203extern void usbnet_unlink_rx_urbs(struct usbnet *); 203extern void usbnet_unlink_rx_urbs(struct usbnet *);
204 204
205extern void usbnet_pause_rx(struct usbnet *); 205extern void usbnet_pause_rx(struct usbnet *);
206extern void usbnet_resume_rx(struct usbnet *); 206extern void usbnet_resume_rx(struct usbnet *);
207extern void usbnet_purge_paused_rxq(struct usbnet *); 207extern void usbnet_purge_paused_rxq(struct usbnet *);
208 208
209extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); 209extern int usbnet_get_settings(struct net_device *net,
210extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); 210 struct ethtool_cmd *cmd);
211extern u32 usbnet_get_link (struct net_device *net); 211extern int usbnet_set_settings(struct net_device *net,
212extern u32 usbnet_get_msglevel (struct net_device *); 212 struct ethtool_cmd *cmd);
213extern void usbnet_set_msglevel (struct net_device *, u32); 213extern u32 usbnet_get_link(struct net_device *net);
214extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); 214extern u32 usbnet_get_msglevel(struct net_device *);
215extern void usbnet_set_msglevel(struct net_device *, u32);
216extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
215extern int usbnet_nway_reset(struct net_device *net); 217extern int usbnet_nway_reset(struct net_device *net);
216 218
217#endif /* __LINUX_USB_USBNET_H */ 219#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index fb7c359bdfba..f9dec37f617b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -87,7 +87,7 @@ enum rpipe_crs {
87 * FIXME: explain rpipes 87 * FIXME: explain rpipes
88 */ 88 */
89struct usb_rpipe_descriptor { 89struct usb_rpipe_descriptor {
90 u8 bLength; 90 u8 bLength;
91 u8 bDescriptorType; 91 u8 bDescriptorType;
92 __le16 wRPipeIndex; 92 __le16 wRPipeIndex;
93 __le16 wRequests; 93 __le16 wRequests;
diff --git a/include/linux/via-core.h b/include/linux/via-core.h
new file mode 100644
index 000000000000..7ffb521e1a7a
--- /dev/null
+++ b/include/linux/via-core.h
@@ -0,0 +1,219 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Jonathan Corbet <corbet@lwn.net>
5 * Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation;
10 * either version 2, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR
15 * A PARTICULAR PURPOSE.See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __VIA_CORE_H__
25#define __VIA_CORE_H__
26#include <linux/types.h>
27#include <linux/io.h>
28#include <linux/spinlock.h>
29#include <linux/pci.h>
30
31/*
32 * A description of each known serial I2C/GPIO port.
33 */
34enum via_port_type {
35 VIA_PORT_NONE = 0,
36 VIA_PORT_I2C,
37 VIA_PORT_GPIO,
38};
39
40enum via_port_mode {
41 VIA_MODE_OFF = 0,
42 VIA_MODE_I2C, /* Used as I2C port */
43 VIA_MODE_GPIO, /* Two GPIO ports */
44};
45
46enum viafb_i2c_adap {
47 VIA_PORT_26 = 0,
48 VIA_PORT_31,
49 VIA_PORT_25,
50 VIA_PORT_2C,
51 VIA_PORT_3D,
52};
53#define VIAFB_NUM_PORTS 5
54
55struct via_port_cfg {
56 enum via_port_type type;
57 enum via_port_mode mode;
58 u16 io_port;
59 u8 ioport_index;
60};
61
62/*
63 * This is the global viafb "device" containing stuff needed by
64 * all subdevs.
65 */
66struct viafb_dev {
67 struct pci_dev *pdev;
68 int chip_type;
69 struct via_port_cfg *port_cfg;
70 /*
71 * Spinlock for access to device registers. Not yet
72 * globally used.
73 */
74 spinlock_t reg_lock;
75 /*
76 * The framebuffer MMIO region. Little, if anything, touches
77 * this memory directly, and certainly nothing outside of the
78 * framebuffer device itself. We *do* have to be able to allocate
79 * chunks of this memory for other devices, though.
80 */
81 unsigned long fbmem_start;
82 long fbmem_len;
83 void __iomem *fbmem;
84#if defined(CONFIG_FB_VIA_CAMERA) || defined(CONFIG_FB_VIA_CAMERA_MODULE)
85 long camera_fbmem_offset;
86 long camera_fbmem_size;
87#endif
88 /*
89 * The MMIO region for device registers.
90 */
91 unsigned long engine_start;
92 unsigned long engine_len;
93 void __iomem *engine_mmio;
94
95};
96
97/*
98 * Interrupt management.
99 */
100
101void viafb_irq_enable(u32 mask);
102void viafb_irq_disable(u32 mask);
103
104/*
105 * The global interrupt control register and its bits.
106 */
107#define VDE_INTERRUPT 0x200 /* Video interrupt flags/masks */
108#define VDE_I_DVISENSE 0x00000001 /* DVI sense int status */
109#define VDE_I_VBLANK 0x00000002 /* Vertical blank status */
110#define VDE_I_MCCFI 0x00000004 /* MCE compl. frame int status */
111#define VDE_I_VSYNC 0x00000008 /* VGA VSYNC int status */
112#define VDE_I_DMA0DDONE 0x00000010 /* DMA 0 descr done */
113#define VDE_I_DMA0TDONE 0x00000020 /* DMA 0 transfer done */
114#define VDE_I_DMA1DDONE 0x00000040 /* DMA 1 descr done */
115#define VDE_I_DMA1TDONE 0x00000080 /* DMA 1 transfer done */
116#define VDE_I_C1AV 0x00000100 /* Cap Eng 1 act vid end */
117#define VDE_I_HQV0 0x00000200 /* First HQV engine */
118#define VDE_I_HQV1 0x00000400 /* Second HQV engine */
119#define VDE_I_HQV1EN 0x00000800 /* Second HQV engine enable */
120#define VDE_I_C0AV 0x00001000 /* Cap Eng 0 act vid end */
121#define VDE_I_C0VBI 0x00002000 /* Cap Eng 0 VBI end */
122#define VDE_I_C1VBI 0x00004000 /* Cap Eng 1 VBI end */
123#define VDE_I_VSYNC2 0x00008000 /* Sec. Disp. VSYNC */
124#define VDE_I_DVISNSEN 0x00010000 /* DVI sense enable */
125#define VDE_I_VSYNC2EN 0x00020000 /* Sec Disp VSYNC enable */
126#define VDE_I_MCCFIEN 0x00040000 /* MC comp frame int mask enable */
127#define VDE_I_VSYNCEN 0x00080000 /* VSYNC enable */
128#define VDE_I_DMA0DDEN 0x00100000 /* DMA 0 descr done enable */
129#define VDE_I_DMA0TDEN 0x00200000 /* DMA 0 trans done enable */
130#define VDE_I_DMA1DDEN 0x00400000 /* DMA 1 descr done enable */
131#define VDE_I_DMA1TDEN 0x00800000 /* DMA 1 trans done enable */
132#define VDE_I_C1AVEN 0x01000000 /* cap 1 act vid end enable */
133#define VDE_I_HQV0EN 0x02000000 /* First hqv engine enable */
134#define VDE_I_C1VBIEN 0x04000000 /* Cap 1 VBI end enable */
135#define VDE_I_LVDSSI 0x08000000 /* LVDS sense interrupt */
136#define VDE_I_C0AVEN 0x10000000 /* Cap 0 act vid end enable */
137#define VDE_I_C0VBIEN 0x20000000 /* Cap 0 VBI end enable */
138#define VDE_I_LVDSSIEN 0x40000000 /* LVDS Sense enable */
139#define VDE_I_ENABLE 0x80000000 /* Global interrupt enable */
140
141/*
142 * DMA management.
143 */
144int viafb_request_dma(void);
145void viafb_release_dma(void);
146/* void viafb_dma_copy_out(unsigned int offset, dma_addr_t paddr, int len); */
147int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
148
149/*
150 * DMA Controller registers.
151 */
152#define VDMA_MR0 0xe00 /* Mod reg 0 */
153#define VDMA_MR_CHAIN 0x01 /* Chaining mode */
154#define VDMA_MR_TDIE 0x02 /* Transfer done int enable */
155#define VDMA_CSR0 0xe04 /* Control/status */
156#define VDMA_C_ENABLE 0x01 /* DMA Enable */
157#define VDMA_C_START 0x02 /* Start a transfer */
158#define VDMA_C_ABORT 0x04 /* Abort a transfer */
159#define VDMA_C_DONE 0x08 /* Transfer is done */
160#define VDMA_MARL0 0xe20 /* Mem addr low */
161#define VDMA_MARH0 0xe24 /* Mem addr high */
162#define VDMA_DAR0 0xe28 /* Device address */
163#define VDMA_DQWCR0 0xe2c /* Count (16-byte) */
164#define VDMA_TMR0 0xe30 /* Tile mode reg */
165#define VDMA_DPRL0 0xe34 /* Not sure */
166#define VDMA_DPR_IN 0x08 /* Inbound transfer to FB */
167#define VDMA_DPRH0 0xe38
168#define VDMA_PMR0 (0xe00 + 0x134) /* Pitch mode */
169
170/*
171 * Useful stuff that probably belongs somewhere global.
172 */
173#define VGA_WIDTH 640
174#define VGA_HEIGHT 480
175
176/*
177 * Indexed port operations. Note that these are all multi-op
178 * functions; every invocation will be racy if you're not holding
179 * reg_lock.
180 */
181
182#define VIAStatus 0x3DA /* Non-indexed port */
183#define VIACR 0x3D4
184#define VIASR 0x3C4
185#define VIAGR 0x3CE
186#define VIAAR 0x3C0
187
188static inline u8 via_read_reg(u16 port, u8 index)
189{
190 outb(index, port);
191 return inb(port + 1);
192}
193
194static inline void via_write_reg(u16 port, u8 index, u8 data)
195{
196 outb(index, port);
197 outb(data, port + 1);
198}
199
200static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
201{
202 u8 old;
203
204 outb(index, port);
205 old = inb(port + 1);
206 outb((data & mask) | (old & ~mask), port + 1);
207}
208
209#define VIA_MISC_REG_READ 0x03CC
210#define VIA_MISC_REG_WRITE 0x03C2
211
212static inline void via_write_misc_reg_mask(u8 data, u8 mask)
213{
214 u8 old = inb(VIA_MISC_REG_READ);
215 outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
216}
217
218
219#endif /* __VIA_CORE_H__ */
diff --git a/include/linux/via-gpio.h b/include/linux/via-gpio.h
new file mode 100644
index 000000000000..8281aea3dd6d
--- /dev/null
+++ b/include/linux/via-gpio.h
@@ -0,0 +1,14 @@
1/*
2 * Support for viafb GPIO ports.
3 *
4 * Copyright 2009 Jonathan Corbet <corbet@lwn.net>
5 * Distributable under version 2 of the GNU General Public License.
6 */
7
8#ifndef __VIA_GPIO_H__
9#define __VIA_GPIO_H__
10
11extern int viafb_gpio_lookup(const char *name);
12extern int viafb_gpio_init(void);
13extern void viafb_gpio_exit(void);
14#endif
diff --git a/include/linux/via_i2c.h b/include/linux/via_i2c.h
new file mode 100644
index 000000000000..44532e468c05
--- /dev/null
+++ b/include/linux/via_i2c.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation;
8 * either version 2, or (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
12 * the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE.See the GNU General Public License
14 * for more details.
15
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#ifndef __VIA_I2C_H__
22#define __VIA_I2C_H__
23
24#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h>
26
27struct via_i2c_stuff {
28 u16 i2c_port; /* GPIO or I2C port */
29 u16 is_active; /* Being used as I2C? */
30 struct i2c_adapter adapter;
31 struct i2c_algo_bit_data algo;
32};
33
34
35int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata);
36int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data);
37int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len);
38struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which);
39
40extern int viafb_i2c_init(void);
41extern void viafb_i2c_exit(void);
42#endif /* __VIA_I2C_H__ */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3793d168b44d..047f7e6edb86 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -160,16 +160,6 @@ enum v4l2_buf_type {
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 160 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 161};
162 162
163enum v4l2_ctrl_type {
164 V4L2_CTRL_TYPE_INTEGER = 1,
165 V4L2_CTRL_TYPE_BOOLEAN = 2,
166 V4L2_CTRL_TYPE_MENU = 3,
167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
171};
172
173enum v4l2_tuner_type { 163enum v4l2_tuner_type {
174 V4L2_TUNER_RADIO = 1, 164 V4L2_TUNER_RADIO = 1,
175 V4L2_TUNER_ANALOG_TV = 2, 165 V4L2_TUNER_ANALOG_TV = 2,
@@ -294,6 +284,8 @@ struct v4l2_pix_format {
294 284
295/* Grey formats */ 285/* Grey formats */
296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 286#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
287#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
288#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
297#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ 289#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
298#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
299 291
@@ -369,6 +361,7 @@ struct v4l2_pix_format {
369#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 361#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
370#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 362#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
371#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ 363#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
364#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
372 365
373/* 366/*
374 * F O R M A T E N U M E R A T I O N 367 * F O R M A T E N U M E R A T I O N
@@ -549,6 +542,8 @@ struct v4l2_buffer {
549#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 542#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
550#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 543#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
551#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 544#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
545/* Buffer is ready, but the data contained within is corrupted. */
546#define V4L2_BUF_FLAG_ERROR 0x0040
552#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 547#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
553#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 548#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
554 549
@@ -939,6 +934,16 @@ struct v4l2_ext_controls {
939#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 934#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
940#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 935#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
941 936
937enum v4l2_ctrl_type {
938 V4L2_CTRL_TYPE_INTEGER = 1,
939 V4L2_CTRL_TYPE_BOOLEAN = 2,
940 V4L2_CTRL_TYPE_MENU = 3,
941 V4L2_CTRL_TYPE_BUTTON = 4,
942 V4L2_CTRL_TYPE_INTEGER64 = 5,
943 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
944 V4L2_CTRL_TYPE_STRING = 7,
945};
946
942/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 947/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
943struct v4l2_queryctrl { 948struct v4l2_queryctrl {
944 __u32 id; 949 __u32 id;
@@ -1023,14 +1028,24 @@ enum v4l2_colorfx {
1023 V4L2_COLORFX_NONE = 0, 1028 V4L2_COLORFX_NONE = 0,
1024 V4L2_COLORFX_BW = 1, 1029 V4L2_COLORFX_BW = 1,
1025 V4L2_COLORFX_SEPIA = 2, 1030 V4L2_COLORFX_SEPIA = 2,
1031 V4L2_COLORFX_NEGATIVE = 3,
1032 V4L2_COLORFX_EMBOSS = 4,
1033 V4L2_COLORFX_SKETCH = 5,
1034 V4L2_COLORFX_SKY_BLUE = 6,
1035 V4L2_COLORFX_GRASS_GREEN = 7,
1036 V4L2_COLORFX_SKIN_WHITEN = 8,
1037 V4L2_COLORFX_VIVID = 9,
1026}; 1038};
1027#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1039#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1028#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1040#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1029 1041
1030#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) 1042#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1031#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) 1043#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1044
1045#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1046
1032/* last CID + 1 */ 1047/* last CID + 1 */
1033#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) 1048#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37)
1034 1049
1035/* MPEG-class control IDs defined by V4L2 */ 1050/* MPEG-class control IDs defined by V4L2 */
1036#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1051#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1276,6 +1291,9 @@ enum v4l2_exposure_auto_type {
1276 1291
1277#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1292#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1278 1293
1294#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1295#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1296
1279/* FM Modulator class control IDs */ 1297/* FM Modulator class control IDs */
1280#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1298#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1281#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1299#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1621,6 +1639,38 @@ struct v4l2_streamparm {
1621}; 1639};
1622 1640
1623/* 1641/*
1642 * E V E N T S
1643 */
1644
1645#define V4L2_EVENT_ALL 0
1646#define V4L2_EVENT_VSYNC 1
1647#define V4L2_EVENT_EOS 2
1648#define V4L2_EVENT_PRIVATE_START 0x08000000
1649
1650/* Payload for V4L2_EVENT_VSYNC */
1651struct v4l2_event_vsync {
1652 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1653 __u8 field;
1654} __attribute__ ((packed));
1655
1656struct v4l2_event {
1657 __u32 type;
1658 union {
1659 struct v4l2_event_vsync vsync;
1660 __u8 data[64];
1661 } u;
1662 __u32 pending;
1663 __u32 sequence;
1664 struct timespec timestamp;
1665 __u32 reserved[9];
1666};
1667
1668struct v4l2_event_subscription {
1669 __u32 type;
1670 __u32 reserved[7];
1671};
1672
1673/*
1624 * A D V A N C E D D E B U G G I N G 1674 * A D V A N C E D D E B U G G I N G
1625 * 1675 *
1626 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! 1676 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
@@ -1742,6 +1792,9 @@ struct v4l2_dbg_chip_ident {
1742#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) 1792#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1743#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1793#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1744#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) 1794#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1795#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
1796#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
1797#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
1745 1798
1746/* Reminder: when adding new ioctls please add support for them to 1799/* Reminder: when adding new ioctls please add support for them to
1747 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1800 drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 40d1709bdbf4..aff5b4f74041 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10#include <linux/gfp.h>
10 11
11/** 12/**
12 * virtqueue - a queue to register buffers for sending or receiving. 13 * virtqueue - a queue to register buffers for sending or receiving.
@@ -14,7 +15,6 @@
14 * @callback: the function to call when buffers are consumed (can be NULL). 15 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging) 16 * @name: the name of this virtqueue (mainly for debugging)
16 * @vdev: the virtio device this queue was created for. 17 * @vdev: the virtio device this queue was created for.
17 * @vq_ops: the operations for this virtqueue (see below).
18 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
19 */ 19 */
20struct virtqueue { 20struct virtqueue {
@@ -22,60 +22,71 @@ struct virtqueue {
22 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name; 23 const char *name;
24 struct virtio_device *vdev; 24 struct virtio_device *vdev;
25 struct virtqueue_ops *vq_ops;
26 void *priv; 25 void *priv;
27}; 26};
28 27
29/** 28/**
30 * virtqueue_ops - operations for virtqueue abstraction layer 29 * operations for virtqueue
31 * @add_buf: expose buffer to other end 30 * virtqueue_add_buf: expose buffer to other end
32 * vq: the struct virtqueue we're talking about. 31 * vq: the struct virtqueue we're talking about.
33 * sg: the description of the buffer(s). 32 * sg: the description of the buffer(s).
34 * out_num: the number of sg readable by other side 33 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 34 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 35 * data: the token identifying the buffer.
36 * gfp: how to do memory allocations (if necessary).
37 * Returns remaining capacity of queue (sg segments) or a negative error. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue 39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side. 40 * After one or more add_buf calls, invoke this to kick the other side.
41 * @get_buf: get the next used buffer 41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about. 42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer 43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf. 44 * Returns NULL or the "data" token handed to add_buf.
45 * @disable_cb: disable callbacks 45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about. 46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only 47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization. 48 * useful as an optimization.
49 * @enable_cb: restart callbacks after disable_cb. 49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about. 50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending 51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver 52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks. 53 * checking for more work, and enabling callbacks.
54 * @detach_unused_buf: detach first unused buffer 54 * virtqueue_detach_unused_buf: detach first unused buffer
55 * vq: the struct virtqueue we're talking about. 55 * vq: the struct virtqueue we're talking about.
56 * Returns NULL or the "data" token handed to add_buf 56 * Returns NULL or the "data" token handed to add_buf
57 * 57 *
58 * Locking rules are straightforward: the driver is responsible for 58 * Locking rules are straightforward: the driver is responsible for
59 * locking. No two operations may be invoked simultaneously, with the exception 59 * locking. No two operations may be invoked simultaneously, with the exception
60 * of @disable_cb. 60 * of virtqueue_disable_cb.
61 * 61 *
62 * All operations can be called in any context. 62 * All operations can be called in any context.
63 */ 63 */
64struct virtqueue_ops {
65 int (*add_buf)(struct virtqueue *vq,
66 struct scatterlist sg[],
67 unsigned int out_num,
68 unsigned int in_num,
69 void *data);
70 64
71 void (*kick)(struct virtqueue *vq); 65int virtqueue_add_buf_gfp(struct virtqueue *vq,
66 struct scatterlist sg[],
67 unsigned int out_num,
68 unsigned int in_num,
69 void *data,
70 gfp_t gfp);
72 71
73 void *(*get_buf)(struct virtqueue *vq, unsigned int *len); 72static inline int virtqueue_add_buf(struct virtqueue *vq,
73 struct scatterlist sg[],
74 unsigned int out_num,
75 unsigned int in_num,
76 void *data)
77{
78 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
79}
74 80
75 void (*disable_cb)(struct virtqueue *vq); 81void virtqueue_kick(struct virtqueue *vq);
76 bool (*enable_cb)(struct virtqueue *vq); 82
77 void *(*detach_unused_buf)(struct virtqueue *vq); 83void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
78}; 84
85void virtqueue_disable_cb(struct virtqueue *vq);
86
87bool virtqueue_enable_cb(struct virtqueue *vq);
88
89void *virtqueue_detach_unused_buf(struct virtqueue *vq);
79 90
80/** 91/**
81 * virtio_device - representation of a device using virtio 92 * virtio_device - representation of a device using virtio
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index e52029e98919..167720d695ed 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -17,6 +17,8 @@
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ 18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
19 19
20#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
21
20struct virtio_blk_config { 22struct virtio_blk_config {
21 /* The capacity (in 512-byte sectors). */ 23 /* The capacity (in 512-byte sectors). */
22 __u64 capacity; 24 __u64 capacity;
@@ -67,6 +69,9 @@ struct virtio_blk_config {
67/* Cache flush command */ 69/* Cache flush command */
68#define VIRTIO_BLK_T_FLUSH 4 70#define VIRTIO_BLK_T_FLUSH 4
69 71
72/* Get device ID command */
73#define VIRTIO_BLK_T_GET_ID 8
74
70/* Barrier before this op. */ 75/* Barrier before this op. */
71#define VIRTIO_BLK_T_BARRIER 0x80000000 76#define VIRTIO_BLK_T_BARRIER 0x80000000
72 77
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index 92228a8fbcbc..a85064db8f94 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -12,14 +12,39 @@
12 12
13/* Feature bits */ 13/* Feature bits */
14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
15#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
16
17#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
15 18
16struct virtio_console_config { 19struct virtio_console_config {
17 /* colums of the screens */ 20 /* colums of the screens */
18 __u16 cols; 21 __u16 cols;
19 /* rows of the screens */ 22 /* rows of the screens */
20 __u16 rows; 23 __u16 rows;
24 /* max. number of ports this device can hold */
25 __u32 max_nr_ports;
21} __attribute__((packed)); 26} __attribute__((packed));
22 27
28/*
29 * A message that's passed between the Host and the Guest for a
30 * particular port.
31 */
32struct virtio_console_control {
33 __u32 id; /* Port number */
34 __u16 event; /* The kind of control event (see below) */
35 __u16 value; /* Extra information for the key */
36};
37
38/* Some events for control messages */
39#define VIRTIO_CONSOLE_DEVICE_READY 0
40#define VIRTIO_CONSOLE_PORT_ADD 1
41#define VIRTIO_CONSOLE_PORT_REMOVE 2
42#define VIRTIO_CONSOLE_PORT_READY 3
43#define VIRTIO_CONSOLE_CONSOLE_PORT 4
44#define VIRTIO_CONSOLE_RESIZE 5
45#define VIRTIO_CONSOLE_PORT_OPEN 6
46#define VIRTIO_CONSOLE_PORT_NAME 7
47
23#ifdef __KERNEL__ 48#ifdef __KERNEL__
24int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 49int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
25#endif /* __KERNEL__ */ 50#endif /* __KERNEL__ */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b77d5e..0836ccc57121 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -127,12 +127,26 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
127/* 127/*
128 * Used for wake-one threads: 128 * Used for wake-one threads:
129 */ 129 */
130static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
131 wait_queue_t *wait)
132{
133 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue(q, wait);
135}
136
130static inline void __add_wait_queue_tail(wait_queue_head_t *head, 137static inline void __add_wait_queue_tail(wait_queue_head_t *head,
131 wait_queue_t *new) 138 wait_queue_t *new)
132{ 139{
133 list_add_tail(&new->task_list, &head->task_list); 140 list_add_tail(&new->task_list, &head->task_list);
134} 141}
135 142
143static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q,
144 wait_queue_t *wait)
145{
146 wait->flags |= WQ_FLAG_EXCLUSIVE;
147 __add_wait_queue_tail(q, wait);
148}
149
136static inline void __remove_wait_queue(wait_queue_head_t *head, 150static inline void __remove_wait_queue(wait_queue_head_t *head,
137 wait_queue_t *old) 151 wait_queue_t *old)
138{ 152{
@@ -362,6 +376,155 @@ do { \
362 __ret; \ 376 __ret; \
363}) 377})
364 378
379
380#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
381({ \
382 int __ret = 0; \
383 DEFINE_WAIT(__wait); \
384 if (exclusive) \
385 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
386 do { \
387 if (likely(list_empty(&__wait.task_list))) \
388 __add_wait_queue_tail(&(wq), &__wait); \
389 set_current_state(TASK_INTERRUPTIBLE); \
390 if (signal_pending(current)) { \
391 __ret = -ERESTARTSYS; \
392 break; \
393 } \
394 if (irq) \
395 spin_unlock_irq(&(wq).lock); \
396 else \
397 spin_unlock(&(wq).lock); \
398 schedule(); \
399 if (irq) \
400 spin_lock_irq(&(wq).lock); \
401 else \
402 spin_lock(&(wq).lock); \
403 } while (!(condition)); \
404 __remove_wait_queue(&(wq), &__wait); \
405 __set_current_state(TASK_RUNNING); \
406 __ret; \
407})
408
409
410/**
411 * wait_event_interruptible_locked - sleep until a condition gets true
412 * @wq: the waitqueue to wait on
413 * @condition: a C expression for the event to wait for
414 *
415 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
416 * @condition evaluates to true or a signal is received.
417 * The @condition is checked each time the waitqueue @wq is woken up.
418 *
419 * It must be called with wq.lock being held. This spinlock is
420 * unlocked while sleeping but @condition testing is done while lock
421 * is held and when this macro exits the lock is held.
422 *
423 * The lock is locked/unlocked using spin_lock()/spin_unlock()
424 * functions which must match the way they are locked/unlocked outside
425 * of this macro.
426 *
427 * wake_up_locked() has to be called after changing any variable that could
428 * change the result of the wait condition.
429 *
430 * The function will return -ERESTARTSYS if it was interrupted by a
431 * signal and 0 if @condition evaluated to true.
432 */
433#define wait_event_interruptible_locked(wq, condition) \
434 ((condition) \
435 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
436
437/**
438 * wait_event_interruptible_locked_irq - sleep until a condition gets true
439 * @wq: the waitqueue to wait on
440 * @condition: a C expression for the event to wait for
441 *
442 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
443 * @condition evaluates to true or a signal is received.
444 * The @condition is checked each time the waitqueue @wq is woken up.
445 *
446 * It must be called with wq.lock being held. This spinlock is
447 * unlocked while sleeping but @condition testing is done while lock
448 * is held and when this macro exits the lock is held.
449 *
450 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
451 * functions which must match the way they are locked/unlocked outside
452 * of this macro.
453 *
454 * wake_up_locked() has to be called after changing any variable that could
455 * change the result of the wait condition.
456 *
457 * The function will return -ERESTARTSYS if it was interrupted by a
458 * signal and 0 if @condition evaluated to true.
459 */
460#define wait_event_interruptible_locked_irq(wq, condition) \
461 ((condition) \
462 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
463
464/**
465 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
466 * @wq: the waitqueue to wait on
467 * @condition: a C expression for the event to wait for
468 *
469 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
470 * @condition evaluates to true or a signal is received.
471 * The @condition is checked each time the waitqueue @wq is woken up.
472 *
473 * It must be called with wq.lock being held. This spinlock is
474 * unlocked while sleeping but @condition testing is done while lock
475 * is held and when this macro exits the lock is held.
476 *
477 * The lock is locked/unlocked using spin_lock()/spin_unlock()
478 * functions which must match the way they are locked/unlocked outside
479 * of this macro.
480 *
481 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
482 * set thus when other process waits process on the list if this
483 * process is awaken further processes are not considered.
484 *
485 * wake_up_locked() has to be called after changing any variable that could
486 * change the result of the wait condition.
487 *
488 * The function will return -ERESTARTSYS if it was interrupted by a
489 * signal and 0 if @condition evaluated to true.
490 */
491#define wait_event_interruptible_exclusive_locked(wq, condition) \
492 ((condition) \
493 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0))
494
495/**
496 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
497 * @wq: the waitqueue to wait on
498 * @condition: a C expression for the event to wait for
499 *
500 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
501 * @condition evaluates to true or a signal is received.
502 * The @condition is checked each time the waitqueue @wq is woken up.
503 *
504 * It must be called with wq.lock being held. This spinlock is
505 * unlocked while sleeping but @condition testing is done while lock
506 * is held and when this macro exits the lock is held.
507 *
508 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
509 * functions which must match the way they are locked/unlocked outside
510 * of this macro.
511 *
512 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
513 * set thus when other process waits process on the list if this
514 * process is awaken further processes are not considered.
515 *
516 * wake_up_locked() has to be called after changing any variable that could
517 * change the result of the wait condition.
518 *
519 * The function will return -ERESTARTSYS if it was interrupted by a
520 * signal and 0 if @condition evaluated to true.
521 */
522#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
523 ((condition) \
524 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
525
526
527
365#define __wait_event_killable(wq, condition, ret) \ 528#define __wait_event_killable(wq, condition, ret) \
366do { \ 529do { \
367 DEFINE_WAIT(__wait); \ 530 DEFINE_WAIT(__wait); \
@@ -404,25 +567,6 @@ do { \
404}) 567})
405 568
406/* 569/*
407 * Must be called with the spinlock in the wait_queue_head_t held.
408 */
409static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
410 wait_queue_t * wait)
411{
412 wait->flags |= WQ_FLAG_EXCLUSIVE;
413 __add_wait_queue_tail(q, wait);
414}
415
416/*
417 * Must be called with the spinlock in the wait_queue_head_t held.
418 */
419static inline void remove_wait_queue_locked(wait_queue_head_t *q,
420 wait_queue_t * wait)
421{
422 __remove_wait_queue(q, wait);
423}
424
425/*
426 * These are the old interfaces to sleep waiting for an event. 570 * These are the old interfaces to sleep waiting for an event.
427 * They are racy. DO NOT use them, use the wait_event* interfaces above. 571 * They are racy. DO NOT use them, use the wait_event* interfaces above.
428 * We plan to remove these interfaces. 572 * We plan to remove these interfaces.
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 5b4c6c772a9b..e6827eedf18b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -346,6 +346,8 @@
346#define SIOCIWFIRST 0x8B00 346#define SIOCIWFIRST 0x8B00
347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ 347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) 348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
349#define IW_HANDLER(id, func) \
350 [IW_IOCTL_IDX(id)] = func
349 351
350/* Odd : get (world access), even : set (root access) */ 352/* Odd : get (world access), even : set (root access) */
351#define IW_IS_SET(cmd) (!((cmd) & 0x1)) 353#define IW_IS_SET(cmd) (!((cmd) & 0x1))
@@ -648,7 +650,7 @@
648 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ 650 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
649#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ 651#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \
650 (cmd - SIOCIWFIRSTPRIV + 0x60) : \ 652 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
651 (cmd - SIOCSIWCOMMIT)) 653 (cmd - SIOCIWFIRST))
652#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) 654#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5)
653#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) 655#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
654/* Event capability constants - event autogenerated by the kernel 656/* Event capability constants - event autogenerated by the kernel
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 36520ded3e06..cc97d6caf2b3 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -65,6 +65,15 @@ struct writeback_control {
65 * so we use a single control to update them 65 * so we use a single control to update them
66 */ 66 */
67 unsigned no_nrwrite_index_update:1; 67 unsigned no_nrwrite_index_update:1;
68
69 /*
70 * For WB_SYNC_ALL, the sb must always be pinned. For WB_SYNC_NONE,
71 * the writeback code will pin the sb for the caller. However,
72 * for eg umount, the caller does WB_SYNC_NONE but already has
73 * the sb pinned. If the below is set, caller already has the
74 * sb pinned.
75 */
76 unsigned sb_pinned:1;
68}; 77};
69 78
70/* 79/*
@@ -73,6 +82,7 @@ struct writeback_control {
73struct bdi_writeback; 82struct bdi_writeback;
74int inode_wait(void *); 83int inode_wait(void *);
75void writeback_inodes_sb(struct super_block *); 84void writeback_inodes_sb(struct super_block *);
85void writeback_inodes_sb_locked(struct super_block *);
76int writeback_inodes_sb_if_idle(struct super_block *); 86int writeback_inodes_sb_if_idle(struct super_block *);
77void sync_inodes_sb(struct super_block *); 87void sync_inodes_sb(struct super_block *);
78void writeback_inodes_wbc(struct writeback_control *wbc); 88void writeback_inodes_wbc(struct writeback_control *wbc);
@@ -96,8 +106,14 @@ static inline void inode_sync_wait(struct inode *inode)
96/* 106/*
97 * mm/page-writeback.c 107 * mm/page-writeback.c
98 */ 108 */
99void laptop_io_completion(void); 109#ifdef CONFIG_BLOCK
110void laptop_io_completion(struct backing_dev_info *info);
100void laptop_sync_completion(void); 111void laptop_sync_completion(void);
112void laptop_mode_sync(struct work_struct *work);
113void laptop_mode_timer_fn(unsigned long data);
114#else
115static inline void laptop_sync_completion(void) { }
116#endif
101void throttle_vm_writeout(gfp_t gfp_mask); 117void throttle_vm_writeout(gfp_t gfp_mask);
102 118
103/* These are exported to sysctl. */ 119/* These are exported to sysctl. */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fb9b7e6e1e2d..0cfa1e9c4cc1 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -37,7 +37,7 @@ struct inode;
37struct dentry; 37struct dentry;
38 38
39struct xattr_handler { 39struct xattr_handler {
40 char *prefix; 40 const char *prefix;
41 int flags; /* fs private flags passed back to the handlers */ 41 int flags; /* fs private flags passed back to the handlers */
42 size_t (*list)(struct dentry *dentry, char *list, size_t list_size, 42 size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
43 const char *name, size_t name_len, int handler_flags); 43 const char *name, size_t name_len, int handler_flags);
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 913bfc226dda..7bf9db525e9e 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -38,8 +38,6 @@
38typedef __u32 zorro_id; 38typedef __u32 zorro_id;
39 39
40 40
41#define ZORRO_WILDCARD (0xffffffff) /* not official */
42
43/* Include the ID list */ 41/* Include the ID list */
44#include <linux/zorro_ids.h> 42#include <linux/zorro_ids.h>
45 43
@@ -116,6 +114,7 @@ struct ConfigDev {
116 114
117#include <linux/init.h> 115#include <linux/init.h>
118#include <linux/ioport.h> 116#include <linux/ioport.h>
117#include <linux/mod_devicetable.h>
119 118
120#include <asm/zorro.h> 119#include <asm/zorro.h>
121 120
@@ -142,29 +141,10 @@ struct zorro_dev {
142 * Zorro bus 141 * Zorro bus
143 */ 142 */
144 143
145struct zorro_bus {
146 struct list_head devices; /* list of devices on this bus */
147 unsigned int num_resources; /* number of resources */
148 struct resource resources[4]; /* address space routed to this bus */
149 struct device dev;
150 char name[10];
151};
152
153extern struct zorro_bus zorro_bus; /* single Zorro bus */
154extern struct bus_type zorro_bus_type; 144extern struct bus_type zorro_bus_type;
155 145
156 146
157 /* 147 /*
158 * Zorro device IDs
159 */
160
161struct zorro_device_id {
162 zorro_id id; /* Device ID or ZORRO_WILDCARD */
163 unsigned long driver_data; /* Data private to the driver */
164};
165
166
167 /*
168 * Zorro device drivers 148 * Zorro device drivers
169 */ 149 */
170 150
diff --git a/include/media/ak881x.h b/include/media/ak881x.h
new file mode 100644
index 000000000000..b7f2add5ce7b
--- /dev/null
+++ b/include/media/ak881x.h
@@ -0,0 +1,25 @@
1/*
2 * Header for AK8813 / AK8814 TV-ecoders from Asahi Kasei Microsystems Co., Ltd. (AKM)
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef AK881X_H
12#define AK881X_H
13
14#define AK881X_IF_MODE_MASK (3 << 0)
15#define AK881X_IF_MODE_BT656 (0 << 0)
16#define AK881X_IF_MODE_MASTER (1 << 0)
17#define AK881X_IF_MODE_SLAVE (2 << 0)
18#define AK881X_FIELD (1 << 2)
19#define AK881X_COMPONENT (1 << 3)
20
21struct ak881x_pdata {
22 unsigned long flags;
23};
24
25#endif
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index 4314a5f6a087..cc973ed845a7 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -94,6 +94,8 @@ struct vpfe_config {
94 /* vpfe clock */ 94 /* vpfe clock */
95 struct clk *vpssclk; 95 struct clk *vpssclk;
96 struct clk *slaveclk; 96 struct clk *slaveclk;
97 /* Function for Clearing the interrupt */
98 void (*clr_intr)(int vdint);
97}; 99};
98 100
99struct vpfe_device { 101struct vpfe_device {
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index c66298062d39..528050e39ad9 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -50,6 +50,10 @@ struct card_ir {
50 struct ir_input_state ir; 50 struct ir_input_state ir;
51 char name[32]; 51 char name[32];
52 char phys[32]; 52 char phys[32];
53 int users;
54
55 u32 running:1;
56 struct ir_dev_props props;
53 57
54 /* Usual gpio signalling */ 58 /* Usual gpio signalling */
55 59
@@ -79,6 +83,9 @@ struct card_ir {
79 /* NEC decoding */ 83 /* NEC decoding */
80 u32 nec_gpio; 84 u32 nec_gpio;
81 struct tasklet_struct tlet; 85 struct tasklet_struct tlet;
86
87 /* IR core raw decoding */
88 u32 raw_decode;
82}; 89};
83 90
84/* Routines from ir-functions.c */ 91/* Routines from ir-functions.c */
@@ -97,71 +104,4 @@ u32 ir_rc5_decode(unsigned int code);
97void ir_rc5_timer_end(unsigned long data); 104void ir_rc5_timer_end(unsigned long data);
98void ir_rc5_timer_keyup(unsigned long data); 105void ir_rc5_timer_keyup(unsigned long data);
99 106
100/* scancode->keycode map tables from ir-keymaps.c */
101
102extern struct ir_scancode_table ir_codes_empty_table;
103extern struct ir_scancode_table ir_codes_avermedia_table;
104extern struct ir_scancode_table ir_codes_avermedia_dvbt_table;
105extern struct ir_scancode_table ir_codes_avermedia_m135a_table;
106extern struct ir_scancode_table ir_codes_avermedia_cardbus_table;
107extern struct ir_scancode_table ir_codes_apac_viewcomp_table;
108extern struct ir_scancode_table ir_codes_pixelview_table;
109extern struct ir_scancode_table ir_codes_pixelview_new_table;
110extern struct ir_scancode_table ir_codes_nebula_table;
111extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table;
112extern struct ir_scancode_table ir_codes_iodata_bctv7e_table;
113extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table;
114extern struct ir_scancode_table ir_codes_msi_tvanywhere_table;
115extern struct ir_scancode_table ir_codes_cinergy_1400_table;
116extern struct ir_scancode_table ir_codes_avertv_303_table;
117extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table;
118extern struct ir_scancode_table ir_codes_em_terratec_table;
119extern struct ir_scancode_table ir_codes_pinnacle_grey_table;
120extern struct ir_scancode_table ir_codes_flyvideo_table;
121extern struct ir_scancode_table ir_codes_flydvb_table;
122extern struct ir_scancode_table ir_codes_cinergy_table;
123extern struct ir_scancode_table ir_codes_eztv_table;
124extern struct ir_scancode_table ir_codes_avermedia_table;
125extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table;
126extern struct ir_scancode_table ir_codes_manli_table;
127extern struct ir_scancode_table ir_codes_gotview7135_table;
128extern struct ir_scancode_table ir_codes_purpletv_table;
129extern struct ir_scancode_table ir_codes_pctv_sedna_table;
130extern struct ir_scancode_table ir_codes_pv951_table;
131extern struct ir_scancode_table ir_codes_rc5_tv_table;
132extern struct ir_scancode_table ir_codes_winfast_table;
133extern struct ir_scancode_table ir_codes_pinnacle_color_table;
134extern struct ir_scancode_table ir_codes_hauppauge_new_table;
135extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table;
136extern struct ir_scancode_table ir_codes_npgtech_table;
137extern struct ir_scancode_table ir_codes_norwood_table;
138extern struct ir_scancode_table ir_codes_proteus_2309_table;
139extern struct ir_scancode_table ir_codes_budget_ci_old_table;
140extern struct ir_scancode_table ir_codes_asus_pc39_table;
141extern struct ir_scancode_table ir_codes_encore_enltv_table;
142extern struct ir_scancode_table ir_codes_encore_enltv2_table;
143extern struct ir_scancode_table ir_codes_tt_1500_table;
144extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table;
145extern struct ir_scancode_table ir_codes_behold_table;
146extern struct ir_scancode_table ir_codes_behold_columbus_table;
147extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table;
148extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table;
149extern struct ir_scancode_table ir_codes_powercolor_real_angel_table;
150extern struct ir_scancode_table ir_codes_avermedia_a16d_table;
151extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table;
152extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table;
153extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table;
154extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table;
155extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
156extern struct ir_scancode_table ir_codes_kaiomy_table;
157extern struct ir_scancode_table ir_codes_dm1105_nec_table;
158extern struct ir_scancode_table ir_codes_tevii_nec_table;
159extern struct ir_scancode_table ir_codes_tbs_nec_table;
160extern struct ir_scancode_table ir_codes_evga_indtube_table;
161extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
162extern struct ir_scancode_table ir_codes_videomate_s350_table;
163extern struct ir_scancode_table ir_codes_gadmei_rm008z_table;
164extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table;
165extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table;
166extern struct ir_scancode_table ir_codes_kworld_315u_table;
167#endif 107#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 61c223bc3953..ad1303f20e00 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -1,6 +1,8 @@
1/* 1/*
2 * Remote Controller core header 2 * Remote Controller core header
3 * 3 *
4 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
4 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2 of the License. 8 * the Free Software Foundation version 2 of the License.
@@ -14,61 +16,133 @@
14#ifndef _IR_CORE 16#ifndef _IR_CORE
15#define _IR_CORE 17#define _IR_CORE
16 18
17#include <linux/input.h>
18#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/kfifo.h>
21#include <linux/time.h>
22#include <linux/timer.h>
23#include <media/rc-map.h>
19 24
20extern int ir_core_debug; 25extern int ir_core_debug;
21#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ 26#define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \
22 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) 27 printk(KERN_DEBUG "%s: " fmt , __func__, ## arg)
23 28
24#define IR_TYPE_UNKNOWN 0 29enum rc_driver_type {
25#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ 30 RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */
26#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ 31 RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */
27#define IR_TYPE_NEC (1 << 2)
28#define IR_TYPE_OTHER (((u64)1) << 63l)
29
30struct ir_scancode {
31 u16 scancode;
32 u32 keycode;
33};
34
35struct ir_scancode_table {
36 struct ir_scancode *scan;
37 int size;
38 u64 ir_type;
39 spinlock_t lock;
40}; 32};
41 33
34/**
35 * struct ir_dev_props - Allow caller drivers to set special properties
36 * @driver_type: specifies if the driver or hardware have already a decoder,
37 * or if it needs to use the IR raw event decoders to produce a scancode
38 * @allowed_protos: bitmask with the supported IR_TYPE_* protocols
39 * @scanmask: some hardware decoders are not capable of providing the full
40 * scancode to the application. As this is a hardware limit, we can't do
41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank
44 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device
47 * is opened.
48 * @close: callback to allow drivers to disable polling/irq when IR input device
49 * is opened.
50 */
42struct ir_dev_props { 51struct ir_dev_props {
43 unsigned long allowed_protos; 52 enum rc_driver_type driver_type;
44 void *priv; 53 unsigned long allowed_protos;
45 int (*change_protocol)(void *priv, u64 ir_type); 54 u32 scanmask;
55 void *priv;
56 int (*change_protocol)(void *priv, u64 ir_type);
57 int (*open)(void *priv);
58 void (*close)(void *priv);
46}; 59};
47 60
48
49struct ir_input_dev { 61struct ir_input_dev {
50 struct input_dev *dev; /* Input device*/ 62 struct device dev; /* device */
63 char *driver_name; /* Name of the driver module */
51 struct ir_scancode_table rc_tab; /* scan/key table */ 64 struct ir_scancode_table rc_tab; /* scan/key table */
52 unsigned long devno; /* device number */ 65 unsigned long devno; /* device number */
53 struct attribute_group attr; /* IR attributes */
54 struct device *class_dev; /* virtual class dev */
55 const struct ir_dev_props *props; /* Device properties */ 66 const struct ir_dev_props *props; /* Device properties */
67 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
68 struct input_dev *input_dev; /* the input device associated with this device */
69
70 /* key info - needed by IR keycode handlers */
71 spinlock_t keylock; /* protects the below members */
72 bool keypressed; /* current state */
73 unsigned long keyup_jiffies; /* when should the current keypress be released? */
74 struct timer_list timer_keyup; /* timer for releasing a keypress */
75 u32 last_keycode; /* keycode of last command */
76 u32 last_scancode; /* scancode of last command */
77 u8 last_toggle; /* toggle of last command */
56}; 78};
57#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
58 79
59/* Routines from ir-keytable.c */ 80enum raw_event_type {
81 IR_SPACE = (1 << 0),
82 IR_PULSE = (1 << 1),
83 IR_START_EVENT = (1 << 2),
84 IR_STOP_EVENT = (1 << 3),
85};
60 86
61u32 ir_g_keycode_from_table(struct input_dev *input_dev, 87#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)
62 u32 scancode);
63 88
64int ir_input_register(struct input_dev *dev, 89/* From ir-keytable.c */
90int __ir_input_register(struct input_dev *dev,
65 const struct ir_scancode_table *ir_codes, 91 const struct ir_scancode_table *ir_codes,
66 const struct ir_dev_props *props); 92 const struct ir_dev_props *props,
93 const char *driver_name);
94
95static inline int ir_input_register(struct input_dev *dev,
96 const char *map_name,
97 const struct ir_dev_props *props,
98 const char *driver_name) {
99 struct ir_scancode_table *ir_codes;
100 struct ir_input_dev *ir_dev;
101 int rc;
102
103 if (!map_name)
104 return -EINVAL;
105
106 ir_codes = get_rc_map(map_name);
107 if (!ir_codes)
108 return -EINVAL;
109
110 rc = __ir_input_register(dev, ir_codes, props, driver_name);
111 if (rc < 0)
112 return -EINVAL;
113
114 ir_dev = input_get_drvdata(dev);
115
116 if (!rc && ir_dev->props && ir_dev->props->change_protocol)
117 rc = ir_dev->props->change_protocol(ir_dev->props->priv,
118 ir_codes->ir_type);
119
120 return rc;
121}
122
67void ir_input_unregister(struct input_dev *input_dev); 123void ir_input_unregister(struct input_dev *input_dev);
68 124
69/* Routines from ir-sysfs.c */ 125void ir_repeat(struct input_dev *dev);
126void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);
127u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);
128
129/* From ir-raw-event.c */
130
131struct ir_raw_event {
132 unsigned pulse:1;
133 unsigned duration:31;
134};
135
136#define IR_MAX_DURATION 0x7FFFFFFF /* a bit more than 2 seconds */
70 137
71int ir_register_class(struct input_dev *input_dev); 138void ir_raw_event_handle(struct input_dev *input_dev);
72void ir_unregister_class(struct input_dev *input_dev); 139int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
140int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
141static inline void ir_raw_event_reset(struct input_dev *input_dev)
142{
143 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
144 ir_raw_event_store(input_dev, &ev);
145 ir_raw_event_handle(input_dev);
146}
73 147
74#endif 148#endif /* _IR_CORE */
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 9142936603cc..0506e45c9a4f 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -6,7 +6,7 @@
6struct IR_i2c; 6struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 struct ir_scancode_table *ir_codes; 9 char *ir_codes;
10 10
11 struct i2c_client *c; 11 struct i2c_client *c;
12 struct input_dev *input; 12 struct input_dev *input;
@@ -34,9 +34,9 @@ enum ir_kbd_get_key_fn {
34 34
35/* Can be passed when instantiating an ir_video i2c device */ 35/* Can be passed when instantiating an ir_video i2c device */
36struct IR_i2c_init_data { 36struct IR_i2c_init_data {
37 struct ir_scancode_table *ir_codes; 37 char *ir_codes;
38 const char *name; 38 const char *name;
39 u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ 39 u64 type; /* IR_TYPE_RC5, etc */
40 /* 40 /*
41 * Specify either a function pointer or a value indicating one of 41 * Specify either a function pointer or a value indicating one of
42 * ir_kbd_i2c's internal get_key functions 42 * ir_kbd_i2c's internal get_key functions
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
new file mode 100644
index 000000000000..5833966a7100
--- /dev/null
+++ b/include/media/rc-map.h
@@ -0,0 +1,121 @@
1/*
2 * rc-map.h - define RC map names used by RC drivers
3 *
4 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/input.h>
13
14#define IR_TYPE_UNKNOWN 0
15#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */
16#define IR_TYPE_NEC (1 << 1)
17#define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */
18#define IR_TYPE_JVC (1 << 3) /* JVC protocol */
19#define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */
20#define IR_TYPE_OTHER (1u << 31)
21
22struct ir_scancode {
23 u32 scancode;
24 u32 keycode;
25};
26
27struct ir_scancode_table {
28 struct ir_scancode *scan;
29 unsigned int size; /* Max number of entries */
30 unsigned int len; /* Used number of entries */
31 unsigned int alloc; /* Size of *scan in bytes */
32 u64 ir_type;
33 char *name;
34 spinlock_t lock;
35};
36
37struct rc_keymap {
38 struct list_head list;
39 struct ir_scancode_table map;
40};
41
42/* Routines from rc-map.c */
43
44int ir_register_map(struct rc_keymap *map);
45void ir_unregister_map(struct rc_keymap *map);
46struct ir_scancode_table *get_rc_map(const char *name);
47void rc_map_init(void);
48
49/* Names of the several keytables defined in-kernel */
50
51#define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci"
52#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp"
53#define RC_MAP_ASUS_PC39 "rc-asus-pc39"
54#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600"
55#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d"
56#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus"
57#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt"
58#define RC_MAP_AVERMEDIA_M135A_RM_JX "rc-avermedia-m135a-rm-jx"
59#define RC_MAP_AVERMEDIA "rc-avermedia"
60#define RC_MAP_AVERTV_303 "rc-avertv-303"
61#define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus"
62#define RC_MAP_BEHOLD "rc-behold"
63#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old"
64#define RC_MAP_CINERGY_1400 "rc-cinergy-1400"
65#define RC_MAP_CINERGY "rc-cinergy"
66#define RC_MAP_DM1105_NEC "rc-dm1105-nec"
67#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro"
68#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t"
69#define RC_MAP_EMPTY "rc-empty"
70#define RC_MAP_EM_TERRATEC "rc-em-terratec"
71#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2"
72#define RC_MAP_ENCORE_ENLTV_FM53 "rc-encore-enltv-fm53"
73#define RC_MAP_ENCORE_ENLTV "rc-encore-enltv"
74#define RC_MAP_EVGA_INDTUBE "rc-evga-indtube"
75#define RC_MAP_EZTV "rc-eztv"
76#define RC_MAP_FLYDVB "rc-flydvb"
77#define RC_MAP_FLYVIDEO "rc-flyvideo"
78#define RC_MAP_FUSIONHDTV_MCE "rc-fusionhdtv-mce"
79#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z"
80#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"
81#define RC_MAP_GOTVIEW7135 "rc-gotview7135"
82#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new"
83#define RC_MAP_IMON_MCE "rc-imon-mce"
84#define RC_MAP_IMON_PAD "rc-imon-pad"
85#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
86#define RC_MAP_KAIOMY "rc-kaiomy"
87#define RC_MAP_KWORLD_315U "rc-kworld-315u"
88#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
89#define RC_MAP_MANLI "rc-manli"
90#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
91#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere"
92#define RC_MAP_NEBULA "rc-nebula"
93#define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs"
94#define RC_MAP_NORWOOD "rc-norwood"
95#define RC_MAP_NPGTECH "rc-npgtech"
96#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
97#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color"
98#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
99#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd"
100#define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new"
101#define RC_MAP_PIXELVIEW "rc-pixelview"
102#define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12"
103#define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel"
104#define RC_MAP_PROTEUS_2309 "rc-proteus-2309"
105#define RC_MAP_PURPLETV "rc-purpletv"
106#define RC_MAP_PV951 "rc-pv951"
107#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
108#define RC_MAP_RC5_TV "rc-rc5-tv"
109#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
110#define RC_MAP_TBS_NEC "rc-tbs-nec"
111#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
112#define RC_MAP_TEVII_NEC "rc-tevii-nec"
113#define RC_MAP_TT_1500 "rc-tt-1500"
114#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350"
115#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
116#define RC_MAP_WINFAST "rc-winfast"
117#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
118/*
119 * Please, do not just append newer Remote Controller names at the end.
120 * The names should be ordered in alphabetical order
121 */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index b9da1f5591e7..4aeff96ff7d8 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -188,7 +188,6 @@ void saa7146_buffer_timeout(unsigned long data);
188void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, 188void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
189 struct saa7146_buf *buf); 189 struct saa7146_buf *buf);
190 190
191int saa7146_vv_devinit(struct saa7146_dev *dev);
192int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); 191int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
193int saa7146_vv_release(struct saa7146_dev* dev); 192int saa7146_vv_release(struct saa7146_dev* dev);
194 193
diff --git a/include/media/sh_vou.h b/include/media/sh_vou.h
new file mode 100644
index 000000000000..a3ef30242b00
--- /dev/null
+++ b/include/media/sh_vou.h
@@ -0,0 +1,34 @@
1/*
2 * SuperH Video Output Unit (VOU) driver header
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef SH_VOU_H
11#define SH_VOU_H
12
13#include <linux/i2c.h>
14
15/* Bus flags */
16#define SH_VOU_PCLK_FALLING (1 << 0)
17#define SH_VOU_HSYNC_LOW (1 << 1)
18#define SH_VOU_VSYNC_LOW (1 << 2)
19
20enum sh_vou_bus_fmt {
21 SH_VOU_BUS_8BIT,
22 SH_VOU_BUS_16BIT,
23 SH_VOU_BUS_BT656,
24};
25
26struct sh_vou_pdata {
27 enum sh_vou_bus_fmt bus_fmt;
28 int i2c_adap;
29 struct i2c_board_info *board_info;
30 unsigned long flags;
31 char *module_name;
32};
33
34#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 9d69f01b6fa2..c9a5bbfa6ab5 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -266,8 +266,8 @@ static inline unsigned long soc_camera_bus_param_compatible(
266 common_flags; 266 common_flags;
267} 267}
268 268
269static inline void soc_camera_limit_side(unsigned int *start, 269static inline void soc_camera_limit_side(int *start, int *length,
270 unsigned int *length, unsigned int start_min, 270 unsigned int start_min,
271 unsigned int length_min, unsigned int length_max) 271 unsigned int length_min, unsigned int length_max)
272{ 272{
273 if (*length < length_min) 273 if (*length < length_min)
@@ -284,4 +284,12 @@ static inline void soc_camera_limit_side(unsigned int *start,
284extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 284extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
285 unsigned long flags); 285 unsigned long flags);
286 286
287/* This is only temporary here - until v4l2-subdev begins to link to video_device */
288#include <linux/i2c.h>
289static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client)
290{
291 struct soc_camera_device *icd = client->dev.platform_data;
292 return icd->vdev;
293}
294
287#endif 295#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 56abf21dd786..21b4428c12ab 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -25,6 +25,10 @@
25#define V4L2_CHIP_IDENT_H_ 25#define V4L2_CHIP_IDENT_H_
26 26
27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ 27/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
28
29/* KEEP THIS LIST ORDERED BY ID!
30 Otherwise it will be hard to see which ranges are already in use when
31 adding support to a new chip family. */
28enum { 32enum {
29 /* general idents: reserved range 0-49 */ 33 /* general idents: reserved range 0-49 */
30 V4L2_IDENT_NONE = 0, /* No chip matched */ 34 V4L2_IDENT_NONE = 0, /* No chip matched */
@@ -77,17 +81,14 @@ enum {
77 V4L2_IDENT_CX23417 = 417, 81 V4L2_IDENT_CX23417 = 417,
78 V4L2_IDENT_CX23418 = 418, 82 V4L2_IDENT_CX23418 = 418,
79 83
80 /* module au0828 */
81 V4L2_IDENT_AU0828 = 828,
82
83 /* module indycam: just ident 2000 */
84 V4L2_IDENT_INDYCAM = 2000,
85
86 /* module bt819: reserved range 810-819 */ 84 /* module bt819: reserved range 810-819 */
87 V4L2_IDENT_BT815A = 815, 85 V4L2_IDENT_BT815A = 815,
88 V4L2_IDENT_BT817A = 817, 86 V4L2_IDENT_BT817A = 817,
89 V4L2_IDENT_BT819A = 819, 87 V4L2_IDENT_BT819A = 819,
90 88
89 /* module au0828 */
90 V4L2_IDENT_AU0828 = 828,
91
91 /* module bt856: just ident 856 */ 92 /* module bt856: just ident 856 */
92 V4L2_IDENT_BT856 = 856, 93 V4L2_IDENT_BT856 = 856,
93 94
@@ -99,6 +100,9 @@ enum {
99 V4L2_IDENT_KS0127 = 1127, 100 V4L2_IDENT_KS0127 = 1127,
100 V4L2_IDENT_KS0127B = 1128, 101 V4L2_IDENT_KS0127B = 1128,
101 102
103 /* module indycam: just ident 2000 */
104 V4L2_IDENT_INDYCAM = 2000,
105
102 /* module vp27smpx: just ident 2700 */ 106 /* module vp27smpx: just ident 2700 */
103 V4L2_IDENT_VP27SMPX = 2700, 107 V4L2_IDENT_VP27SMPX = 2700,
104 108
@@ -162,20 +166,21 @@ enum {
162 /* module saa7706h: just ident 7706 */ 166 /* module saa7706h: just ident 7706 */
163 V4L2_IDENT_SAA7706H = 7706, 167 V4L2_IDENT_SAA7706H = 7706,
164 168
169 /* module mt9v011, just ident 8243 */
170 V4L2_IDENT_MT9V011 = 8243,
171
165 /* module wm8739: just ident 8739 */ 172 /* module wm8739: just ident 8739 */
166 V4L2_IDENT_WM8739 = 8739, 173 V4L2_IDENT_WM8739 = 8739,
167 174
168 /* module wm8775: just ident 8775 */ 175 /* module wm8775: just ident 8775 */
169 V4L2_IDENT_WM8775 = 8775, 176 V4L2_IDENT_WM8775 = 8775,
170 177
171 /* module tda9840: just ident 9840 */
172 V4L2_IDENT_TDA9840 = 9840,
173
174 /* module cafe_ccic, just ident 8801 */ 178 /* module cafe_ccic, just ident 8801 */
175 V4L2_IDENT_CAFE = 8801, 179 V4L2_IDENT_CAFE = 8801,
176 180
177 /* module mt9v011, just ident 8243 */ 181 /* AKM AK8813/AK8814 */
178 V4L2_IDENT_MT9V011 = 8243, 182 V4L2_IDENT_AK8813 = 8813,
183 V4L2_IDENT_AK8814 = 8814,
179 184
180 /* module cx23885 and cx25840 */ 185 /* module cx23885 and cx25840 */
181 V4L2_IDENT_CX23885 = 8850, 186 V4L2_IDENT_CX23885 = 8850,
@@ -186,6 +191,9 @@ enum {
186 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ 191 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
187 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ 192 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
188 193
194 /* module tda9840: just ident 9840 */
195 V4L2_IDENT_TDA9840 = 9840,
196
189 /* module tw9910: just ident 9910 */ 197 /* module tw9910: just ident 9910 */
190 V4L2_IDENT_TW9910 = 9910, 198 V4L2_IDENT_TW9910 = 9910,
191 199
@@ -198,72 +206,70 @@ enum {
198 V4L2_IDENT_CX23101 = 23101, 206 V4L2_IDENT_CX23101 = 23101,
199 V4L2_IDENT_CX23102 = 23102, 207 V4L2_IDENT_CX23102 = 23102,
200 208
201 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 209 /* module msp3400: reserved range 34000-34999 for msp34xx */
202 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 210 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
203 use internally (tveeprom.c). */ 211 use internally (tveeprom.c). */
204 212
205 V4L2_IDENT_MSP3400B = 34002, 213 V4L2_IDENT_MSP3400B = 34002,
206 V4L2_IDENT_MSP3410B = 34102,
207
208 V4L2_IDENT_MSP3400C = 34003, 214 V4L2_IDENT_MSP3400C = 34003,
209 V4L2_IDENT_MSP3410C = 34103,
210
211 V4L2_IDENT_MSP3400D = 34004, 215 V4L2_IDENT_MSP3400D = 34004,
212 V4L2_IDENT_MSP3410D = 34104, 216 V4L2_IDENT_MSP3400G = 34007,
217 V4L2_IDENT_MSP3401G = 34017,
218 V4L2_IDENT_MSP3402G = 34027,
213 V4L2_IDENT_MSP3405D = 34054, 219 V4L2_IDENT_MSP3405D = 34054,
214 V4L2_IDENT_MSP3415D = 34154, 220 V4L2_IDENT_MSP3405G = 34057,
215 V4L2_IDENT_MSP3407D = 34074, 221 V4L2_IDENT_MSP3407D = 34074,
216 V4L2_IDENT_MSP3417D = 34174, 222 V4L2_IDENT_MSP3407G = 34077,
217 223
218 V4L2_IDENT_MSP3400G = 34007, 224 V4L2_IDENT_MSP3410B = 34102,
225 V4L2_IDENT_MSP3410C = 34103,
226 V4L2_IDENT_MSP3410D = 34104,
219 V4L2_IDENT_MSP3410G = 34107, 227 V4L2_IDENT_MSP3410G = 34107,
220 V4L2_IDENT_MSP3420G = 34207,
221 V4L2_IDENT_MSP3430G = 34307,
222 V4L2_IDENT_MSP3440G = 34407,
223 V4L2_IDENT_MSP3450G = 34507,
224 V4L2_IDENT_MSP3460G = 34607,
225
226 V4L2_IDENT_MSP3401G = 34017,
227 V4L2_IDENT_MSP3411G = 34117, 228 V4L2_IDENT_MSP3411G = 34117,
228 V4L2_IDENT_MSP3421G = 34217,
229 V4L2_IDENT_MSP3431G = 34317,
230 V4L2_IDENT_MSP3441G = 34417,
231 V4L2_IDENT_MSP3451G = 34517,
232 V4L2_IDENT_MSP3461G = 34617,
233
234 V4L2_IDENT_MSP3402G = 34027,
235 V4L2_IDENT_MSP3412G = 34127, 229 V4L2_IDENT_MSP3412G = 34127,
236 V4L2_IDENT_MSP3422G = 34227, 230 V4L2_IDENT_MSP3415D = 34154,
237 V4L2_IDENT_MSP3442G = 34427,
238 V4L2_IDENT_MSP3452G = 34527,
239
240 V4L2_IDENT_MSP3405G = 34057,
241 V4L2_IDENT_MSP3415G = 34157, 231 V4L2_IDENT_MSP3415G = 34157,
242 V4L2_IDENT_MSP3425G = 34257, 232 V4L2_IDENT_MSP3417D = 34174,
243 V4L2_IDENT_MSP3435G = 34357,
244 V4L2_IDENT_MSP3445G = 34457,
245 V4L2_IDENT_MSP3455G = 34557,
246 V4L2_IDENT_MSP3465G = 34657,
247
248 V4L2_IDENT_MSP3407G = 34077,
249 V4L2_IDENT_MSP3417G = 34177, 233 V4L2_IDENT_MSP3417G = 34177,
234
235 V4L2_IDENT_MSP3420G = 34207,
236 V4L2_IDENT_MSP3421G = 34217,
237 V4L2_IDENT_MSP3422G = 34227,
238 V4L2_IDENT_MSP3425G = 34257,
250 V4L2_IDENT_MSP3427G = 34277, 239 V4L2_IDENT_MSP3427G = 34277,
240
241 V4L2_IDENT_MSP3430G = 34307,
242 V4L2_IDENT_MSP3431G = 34317,
243 V4L2_IDENT_MSP3435G = 34357,
251 V4L2_IDENT_MSP3437G = 34377, 244 V4L2_IDENT_MSP3437G = 34377,
245
246 V4L2_IDENT_MSP3440G = 34407,
247 V4L2_IDENT_MSP3441G = 34417,
248 V4L2_IDENT_MSP3442G = 34427,
249 V4L2_IDENT_MSP3445G = 34457,
252 V4L2_IDENT_MSP3447G = 34477, 250 V4L2_IDENT_MSP3447G = 34477,
251
252 V4L2_IDENT_MSP3450G = 34507,
253 V4L2_IDENT_MSP3451G = 34517,
254 V4L2_IDENT_MSP3452G = 34527,
255 V4L2_IDENT_MSP3455G = 34557,
253 V4L2_IDENT_MSP3457G = 34577, 256 V4L2_IDENT_MSP3457G = 34577,
257
258 V4L2_IDENT_MSP3460G = 34607,
259 V4L2_IDENT_MSP3461G = 34617,
260 V4L2_IDENT_MSP3465G = 34657,
254 V4L2_IDENT_MSP3467G = 34677, 261 V4L2_IDENT_MSP3467G = 34677,
255 262
256 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 263 /* module msp3400: reserved range 44000-44999 for msp44xx */
257 V4L2_IDENT_MSP4400G = 44007, 264 V4L2_IDENT_MSP4400G = 44007,
258 V4L2_IDENT_MSP4410G = 44107,
259 V4L2_IDENT_MSP4420G = 44207,
260 V4L2_IDENT_MSP4440G = 44407,
261 V4L2_IDENT_MSP4450G = 44507,
262
263 V4L2_IDENT_MSP4408G = 44087, 265 V4L2_IDENT_MSP4408G = 44087,
266 V4L2_IDENT_MSP4410G = 44107,
264 V4L2_IDENT_MSP4418G = 44187, 267 V4L2_IDENT_MSP4418G = 44187,
268 V4L2_IDENT_MSP4420G = 44207,
265 V4L2_IDENT_MSP4428G = 44287, 269 V4L2_IDENT_MSP4428G = 44287,
270 V4L2_IDENT_MSP4440G = 44407,
266 V4L2_IDENT_MSP4448G = 44487, 271 V4L2_IDENT_MSP4448G = 44487,
272 V4L2_IDENT_MSP4450G = 44507,
267 V4L2_IDENT_MSP4458G = 44587, 273 V4L2_IDENT_MSP4458G = 44587,
268 274
269 /* Micron CMOS sensor chips: 45000-45099 */ 275 /* Micron CMOS sensor chips: 45000-45099 */
@@ -282,20 +288,27 @@ enum {
282 /* HV7131R CMOS sensor: just ident 46000 */ 288 /* HV7131R CMOS sensor: just ident 46000 */
283 V4L2_IDENT_HV7131R = 46000, 289 V4L2_IDENT_HV7131R = 46000,
284 290
291 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
292 V4L2_IDENT_RJ54N1CB0C = 51980,
293
294 /* module m52790: just ident 52790 */
295 V4L2_IDENT_M52790 = 52790,
296
285 /* module cs53132a: just ident 53132 */ 297 /* module cs53132a: just ident 53132 */
286 V4L2_IDENT_CS53l32A = 53132, 298 V4L2_IDENT_CS53l32A = 53132,
287 299
300 /* modules upd61151 MPEG2 encoder: just ident 54000 */
301 V4L2_IDENT_UPD61161 = 54000,
302 /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
303 V4L2_IDENT_UPD61162 = 54001,
304
288 /* module upd64031a: just ident 64031 */ 305 /* module upd64031a: just ident 64031 */
289 V4L2_IDENT_UPD64031A = 64031, 306 V4L2_IDENT_UPD64031A = 64031,
290 307
291 /* module upd64083: just ident 64083 */ 308 /* module upd64083: just ident 64083 */
292 V4L2_IDENT_UPD64083 = 64083, 309 V4L2_IDENT_UPD64083 = 64083,
293 310
294 /* module m52790: just ident 52790 */ 311 /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
295 V4L2_IDENT_M52790 = 52790,
296
297 /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
298 V4L2_IDENT_RJ54N1CB0C = 51980,
299}; 312};
300 313
301#endif 314#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1c7b259f341c..98b32645e5a7 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -85,13 +85,13 @@
85struct v4l2_prio_state { 85struct v4l2_prio_state {
86 atomic_t prios[4]; 86 atomic_t prios[4];
87}; 87};
88int v4l2_prio_init(struct v4l2_prio_state *global); 88void v4l2_prio_init(struct v4l2_prio_state *global);
89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local, 89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
90 enum v4l2_priority new); 90 enum v4l2_priority new);
91int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local); 91void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
92int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local); 92void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global); 93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local); 94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
95 95
96/* ------------------------------------------------------------------------- */ 96/* ------------------------------------------------------------------------- */
97 97
@@ -184,6 +184,25 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
184 184
185/* ------------------------------------------------------------------------- */ 185/* ------------------------------------------------------------------------- */
186 186
187/* SPI Helper functions */
188#if defined(CONFIG_SPI)
189
190#include <linux/spi/spi.h>
191
192struct spi_device;
193
194/* Load an spi module and return an initialized v4l2_subdev struct.
195 The client_type argument is the name of the chip that's on the adapter. */
196struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
197 struct spi_master *master, struct spi_board_info *info);
198
199/* Initialize an v4l2_subdev with data from an spi_device struct */
200void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
201 const struct v4l2_subdev_ops *ops);
202#endif
203
204/* ------------------------------------------------------------------------- */
205
187/* Note: these remaining ioctls/structs should be removed as well, but they are 206/* Note: these remaining ioctls/structs should be removed as well, but they are
188 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and 207 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
189 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup 208 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2dee93892ea2..bebe44b03e0f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -32,6 +32,7 @@ struct v4l2_device;
32 Drivers can clear this flag if they want to block all future 32 Drivers can clear this flag if they want to block all future
33 device access. It is cleared by video_unregister_device. */ 33 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_REGISTERED (0) 34#define V4L2_FL_REGISTERED (0)
35#define V4L2_FL_USES_V4L2_FH (1)
35 36
36struct v4l2_file_operations { 37struct v4l2_file_operations {
37 struct module *owner; 38 struct module *owner;
@@ -77,6 +78,10 @@ struct video_device
77 /* attribute to differentiate multiple indices on one physical device */ 78 /* attribute to differentiate multiple indices on one physical device */
78 int index; 79 int index;
79 80
81 /* V4L2 file handles */
82 spinlock_t fh_lock; /* Lock for all v4l2_fhs */
83 struct list_head fh_list; /* List of struct v4l2_fh */
84
80 int debug; /* Activates debug level*/ 85 int debug; /* Activates debug level*/
81 86
82 /* Video standard vars */ 87 /* Video standard vars */
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
new file mode 100644
index 000000000000..3b86177c8cd2
--- /dev/null
+++ b/include/media/v4l2-event.h
@@ -0,0 +1,67 @@
1/*
2 * v4l2-event.h
3 *
4 * V4L2 events.
5 *
6 * Copyright (C) 2009--2010 Nokia Corporation.
7 *
8 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef V4L2_EVENT_H
26#define V4L2_EVENT_H
27
28#include <linux/types.h>
29#include <linux/videodev2.h>
30#include <linux/wait.h>
31
32struct v4l2_fh;
33struct video_device;
34
35struct v4l2_kevent {
36 struct list_head list;
37 struct v4l2_event event;
38};
39
40struct v4l2_subscribed_event {
41 struct list_head list;
42 u32 type;
43};
44
45struct v4l2_events {
46 wait_queue_head_t wait;
47 struct list_head subscribed; /* Subscribed events */
48 struct list_head free; /* Events ready for use */
49 struct list_head available; /* Dequeueable event */
50 unsigned int navailable;
51 unsigned int nallocated; /* Number of allocated events */
52 u32 sequence;
53};
54
55int v4l2_event_init(struct v4l2_fh *fh);
56int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n);
57void v4l2_event_free(struct v4l2_fh *fh);
58int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event,
59 int nonblocking);
60void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
61int v4l2_event_pending(struct v4l2_fh *fh);
62int v4l2_event_subscribe(struct v4l2_fh *fh,
63 struct v4l2_event_subscription *sub);
64int v4l2_event_unsubscribe(struct v4l2_fh *fh,
65 struct v4l2_event_subscription *sub);
66
67#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
new file mode 100644
index 000000000000..1d72dde320bf
--- /dev/null
+++ b/include/media/v4l2-fh.h
@@ -0,0 +1,65 @@
1/*
2 * v4l2-fh.h
3 *
4 * V4L2 file handle. Store per file handle data for the V4L2
5 * framework. Using file handles is optional for the drivers.
6 *
7 * Copyright (C) 2009--2010 Nokia Corporation.
8 *
9 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 */
25
26#ifndef V4L2_FH_H
27#define V4L2_FH_H
28
29#include <linux/list.h>
30
31struct video_device;
32struct v4l2_events;
33
34struct v4l2_fh {
35 struct list_head list;
36 struct video_device *vdev;
37 struct v4l2_events *events; /* events, pending and subscribed */
38};
39
40/*
41 * Initialise the file handle. Parts of the V4L2 framework using the
42 * file handles should be initialised in this function. Must be called
43 * from driver's v4l2_file_operations->open() handler if the driver
44 * uses v4l2_fh.
45 */
46int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
47/*
48 * Add the fh to the list of file handles on a video_device. The file
49 * handle must be initialised first.
50 */
51void v4l2_fh_add(struct v4l2_fh *fh);
52/*
53 * Remove file handle from the list of file handles. Must be called in
54 * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
55 */
56void v4l2_fh_del(struct v4l2_fh *fh);
57/*
58 * Release resources related to a file handle. Parts of the V4L2
59 * framework using the v4l2_fh must release their resources here, too.
60 * Must be called in v4l2_file_operations->release() handler if the
61 * driver uses v4l2_fh.
62 */
63void v4l2_fh_exit(struct v4l2_fh *fh);
64
65#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e8ba0f2efbae..06daa6e8e051 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -21,6 +21,8 @@
21#include <linux/videodev2.h> 21#include <linux/videodev2.h>
22#endif 22#endif
23 23
24struct v4l2_fh;
25
24struct v4l2_ioctl_ops { 26struct v4l2_ioctl_ops {
25 /* ioctl callbacks */ 27 /* ioctl callbacks */
26 28
@@ -254,6 +256,11 @@ struct v4l2_ioctl_ops {
254 int (*vidioc_g_dv_timings) (struct file *file, void *fh, 256 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
255 struct v4l2_dv_timings *timings); 257 struct v4l2_dv_timings *timings);
256 258
259 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
260 struct v4l2_event_subscription *sub);
261 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
262 struct v4l2_event_subscription *sub);
263
257 /* For other private ioctls */ 264 /* For other private ioctls */
258 long (*vidioc_default) (struct file *file, void *fh, 265 long (*vidioc_default) (struct file *file, void *fh,
259 int cmd, void *arg); 266 int cmd, void *arg);
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
new file mode 100644
index 000000000000..8d149f1c58d0
--- /dev/null
+++ b/include/media/v4l2-mem2mem.h
@@ -0,0 +1,201 @@
1/*
2 * Memory-to-memory device framework for Video for Linux 2.
3 *
4 * Helper functions for devices that use memory buffers for both source
5 * and destination.
6 *
7 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
8 * Pawel Osciak, <p.osciak@samsung.com>
9 * Marek Szyprowski, <m.szyprowski@samsung.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version
15 */
16
17#ifndef _MEDIA_V4L2_MEM2MEM_H
18#define _MEDIA_V4L2_MEM2MEM_H
19
20#include <media/videobuf-core.h>
21
22/**
23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks
24 * @device_run: required. Begin the actual job (transaction) inside this
25 * callback.
26 * The job does NOT have to end before this callback returns
27 * (and it will be the usual case). When the job finishes,
28 * v4l2_m2m_job_finish() has to be called.
29 * @job_ready: optional. Should return 0 if the driver does not have a job
30 * fully prepared to run yet (i.e. it will not be able to finish a
31 * transaction without sleeping). If not provided, it will be
32 * assumed that one source and one destination buffer are all
33 * that is required for the driver to perform one full transaction.
34 * This method may not sleep.
35 * @job_abort: required. Informs the driver that it has to abort the currently
36 * running transaction as soon as possible (i.e. as soon as it can
37 * stop the device safely; e.g. in the next interrupt handler),
38 * even if the transaction would not have been finished by then.
39 * After the driver performs the necessary steps, it has to call
40 * v4l2_m2m_job_finish() (as if the transaction ended normally).
41 * This function does not have to (and will usually not) wait
42 * until the device enters a state when it can be stopped.
43 */
44struct v4l2_m2m_ops {
45 void (*device_run)(void *priv);
46 int (*job_ready)(void *priv);
47 void (*job_abort)(void *priv);
48};
49
50struct v4l2_m2m_dev;
51
52struct v4l2_m2m_queue_ctx {
53/* private: internal use only */
54 struct videobuf_queue q;
55
56 /* Queue for buffers ready to be processed as soon as this
57 * instance receives access to the device */
58 struct list_head rdy_queue;
59 u8 num_rdy;
60};
61
62struct v4l2_m2m_ctx {
63/* private: internal use only */
64 struct v4l2_m2m_dev *m2m_dev;
65
66 /* Capture (output to memory) queue context */
67 struct v4l2_m2m_queue_ctx cap_q_ctx;
68
69 /* Output (input from memory) queue context */
70 struct v4l2_m2m_queue_ctx out_q_ctx;
71
72 /* For device job queue */
73 struct list_head queue;
74 unsigned long job_flags;
75
76 /* Instance private data */
77 void *priv;
78};
79
80void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
81
82struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
83 enum v4l2_buf_type type);
84
85void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
86 struct v4l2_m2m_ctx *m2m_ctx);
87
88int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
89 struct v4l2_requestbuffers *reqbufs);
90
91int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
92 struct v4l2_buffer *buf);
93
94int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
95 struct v4l2_buffer *buf);
96int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
97 struct v4l2_buffer *buf);
98
99int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
100 enum v4l2_buf_type type);
101int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
102 enum v4l2_buf_type type);
103
104unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
105 struct poll_table_struct *wait);
106
107int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
108 struct vm_area_struct *vma);
109
110struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops);
111void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
112
113struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev,
114 void (*vq_init)(void *priv, struct videobuf_queue *,
115 enum v4l2_buf_type));
116void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
117
118void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq,
119 struct videobuf_buffer *vb);
120
121/**
122 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
123 * use
124 */
125static inline
126unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
127{
128 return m2m_ctx->cap_q_ctx.num_rdy;
129}
130
131/**
132 * v4l2_m2m_num_src_bufs_ready() - return the number of destination buffers
133 * ready for use
134 */
135static inline
136unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
137{
138 return m2m_ctx->out_q_ctx.num_rdy;
139}
140
141void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type);
142
143/**
144 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
145 * buffers
146 */
147static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
148{
149 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
150}
151
152/**
153 * v4l2_m2m_next_dst_buf() - return next destination buffer from the list of
154 * ready buffers
155 */
156static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
157{
158 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
159}
160
161/**
162 * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers
163 */
164static inline
165struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
166{
167 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
168}
169
170/**
171 * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers
172 */
173static inline
174struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
175{
176 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
177}
178
179void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx,
180 enum v4l2_buf_type type);
181
182/**
183 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
184 * buffers and return it
185 */
186static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
187{
188 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
189}
190
191/**
192 * v4l2_m2m_dst_buf_remove() - take off a destination buffer from the list of
193 * ready buffers and return it
194 */
195static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
196{
197 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
198}
199
200#endif /* _MEDIA_V4L2_MEM2MEM_H */
201
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2bcdca0a57fc..a88889355ae0 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -184,28 +184,6 @@ struct v4l2_subdev_audio_ops {
184}; 184};
185 185
186/* 186/*
187 decode_vbi_line: video decoders that support sliced VBI need to implement
188 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
189 start of the VBI data that was generated by the decoder. The driver
190 then parses the sliced VBI data and sets the other fields in the
191 struct accordingly. The pointer p is updated to point to the start of
192 the payload which can be copied verbatim into the data field of the
193 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
194 type field is set to 0 on return.
195
196 s_vbi_data: used to generate VBI signals on a video signal.
197 v4l2_sliced_vbi_data is filled with the data packets that should be
198 output. Note that if you set the line field to 0, then that VBI signal
199 is disabled. If no valid VBI data was found, then the type field is
200 set to 0 on return.
201
202 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
203 Not all video decoders support this. If no data is available because
204 the readback register contains invalid or erroneous data -EIO is
205 returned. Note that you must fill in the 'id' member and the 'field'
206 member (to determine whether CC data from the first or second field
207 should be obtained).
208
209 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 187 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
210 video input devices. 188 video input devices.
211 189
@@ -243,10 +221,6 @@ struct v4l2_subdev_audio_ops {
243struct v4l2_subdev_video_ops { 221struct v4l2_subdev_video_ops {
244 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 222 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
245 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); 223 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
246 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
247 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
248 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
249 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
250 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 224 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
251 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); 225 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
252 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); 226 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
@@ -262,6 +236,8 @@ struct v4l2_subdev_video_ops {
262 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 236 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
263 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 237 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
264 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 238 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
239 int (*enum_dv_presets) (struct v4l2_subdev *sd,
240 struct v4l2_dv_enum_preset *preset);
265 int (*s_dv_preset)(struct v4l2_subdev *sd, 241 int (*s_dv_preset)(struct v4l2_subdev *sd,
266 struct v4l2_dv_preset *preset); 242 struct v4l2_dv_preset *preset);
267 int (*query_dv_preset)(struct v4l2_subdev *sd, 243 int (*query_dv_preset)(struct v4l2_subdev *sd,
@@ -280,6 +256,45 @@ struct v4l2_subdev_video_ops {
280 struct v4l2_mbus_framefmt *fmt); 256 struct v4l2_mbus_framefmt *fmt);
281}; 257};
282 258
259/*
260 decode_vbi_line: video decoders that support sliced VBI need to implement
261 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
262 start of the VBI data that was generated by the decoder. The driver
263 then parses the sliced VBI data and sets the other fields in the
264 struct accordingly. The pointer p is updated to point to the start of
265 the payload which can be copied verbatim into the data field of the
266 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
267 type field is set to 0 on return.
268
269 s_vbi_data: used to generate VBI signals on a video signal.
270 v4l2_sliced_vbi_data is filled with the data packets that should be
271 output. Note that if you set the line field to 0, then that VBI signal
272 is disabled. If no valid VBI data was found, then the type field is
273 set to 0 on return.
274
275 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
276 Not all video decoders support this. If no data is available because
277 the readback register contains invalid or erroneous data -EIO is
278 returned. Note that you must fill in the 'id' member and the 'field'
279 member (to determine whether CC data from the first or second field
280 should be obtained).
281
282 s_raw_fmt: setup the video encoder/decoder for raw VBI.
283
284 g_sliced_fmt: retrieve the current sliced VBI settings.
285
286 s_sliced_fmt: setup the sliced VBI settings.
287 */
288struct v4l2_subdev_vbi_ops {
289 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
290 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
291 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
292 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
293 int (*s_raw_fmt)(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt);
294 int (*g_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
295 int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
296};
297
283/** 298/**
284 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations 299 * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
285 * @g_skip_top_lines: number of lines at the top of the image to be skipped. 300 * @g_skip_top_lines: number of lines at the top of the image to be skipped.
@@ -379,6 +394,7 @@ struct v4l2_subdev_ops {
379 const struct v4l2_subdev_tuner_ops *tuner; 394 const struct v4l2_subdev_tuner_ops *tuner;
380 const struct v4l2_subdev_audio_ops *audio; 395 const struct v4l2_subdev_audio_ops *audio;
381 const struct v4l2_subdev_video_ops *video; 396 const struct v4l2_subdev_video_ops *video;
397 const struct v4l2_subdev_vbi_ops *vbi;
382 const struct v4l2_subdev_ir_ops *ir; 398 const struct v4l2_subdev_ir_ops *ir;
383 const struct v4l2_subdev_sensor_ops *sensor; 399 const struct v4l2_subdev_sensor_ops *sensor;
384}; 400};
@@ -387,6 +403,8 @@ struct v4l2_subdev_ops {
387 403
388/* Set this flag if this subdev is a i2c device. */ 404/* Set this flag if this subdev is a i2c device. */
389#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) 405#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
406/* Set this flag if this subdev is a spi device. */
407#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
390 408
391/* Each instance of a subdev driver should create this struct, either 409/* Each instance of a subdev driver should create this struct, either
392 stand-alone or embedded in a larger struct. 410 stand-alone or embedded in a larger struct.
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 316fdccdcaa0..f91a736c133d 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -127,30 +127,16 @@ struct videobuf_queue_ops {
127struct videobuf_qtype_ops { 127struct videobuf_qtype_ops {
128 u32 magic; 128 u32 magic;
129 129
130 void *(*alloc) (size_t size); 130 struct videobuf_buffer *(*alloc)(size_t size);
131 void *(*vmalloc) (struct videobuf_buffer *buf); 131 void *(*vaddr) (struct videobuf_buffer *buf);
132 int (*iolock) (struct videobuf_queue* q, 132 int (*iolock) (struct videobuf_queue *q,
133 struct videobuf_buffer *vb, 133 struct videobuf_buffer *vb,
134 struct v4l2_framebuffer *fbuf); 134 struct v4l2_framebuffer *fbuf);
135 int (*mmap) (struct videobuf_queue *q, 135 int (*sync) (struct videobuf_queue *q,
136 unsigned int *count,
137 unsigned int *size,
138 enum v4l2_memory memory);
139 int (*sync) (struct videobuf_queue* q,
140 struct videobuf_buffer *buf); 136 struct videobuf_buffer *buf);
141 int (*video_copy_to_user)(struct videobuf_queue *q,
142 char __user *data,
143 size_t count,
144 int nonblocking);
145 int (*copy_stream) (struct videobuf_queue *q,
146 char __user *data,
147 size_t count,
148 size_t pos,
149 int vbihack,
150 int nonblocking);
151 int (*mmap_free) (struct videobuf_queue *q);
152 int (*mmap_mapper) (struct videobuf_queue *q, 137 int (*mmap_mapper) (struct videobuf_queue *q,
153 struct vm_area_struct *vma); 138 struct videobuf_buffer *buf,
139 struct vm_area_struct *vma);
154}; 140};
155 141
156struct videobuf_queue { 142struct videobuf_queue {
@@ -171,7 +157,6 @@ struct videobuf_queue {
171 157
172 unsigned int streaming:1; 158 unsigned int streaming:1;
173 unsigned int reading:1; 159 unsigned int reading:1;
174 unsigned int is_mmapped:1;
175 160
176 /* capture via mmap() + ioctl(QBUF/DQBUF) */ 161 /* capture via mmap() + ioctl(QBUF/DQBUF) */
177 struct list_head stream; 162 struct list_head stream;
@@ -185,14 +170,14 @@ struct videobuf_queue {
185}; 170};
186 171
187int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); 172int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
188int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, 173int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
189 struct v4l2_framebuffer *fbuf); 174 struct v4l2_framebuffer *fbuf);
190 175
191void *videobuf_alloc(struct videobuf_queue* q); 176struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q);
192 177
193/* Used on videobuf-dvb */ 178/* Used on videobuf-dvb */
194void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, 179void *videobuf_queue_to_vaddr(struct videobuf_queue *q,
195 struct videobuf_buffer *buf); 180 struct videobuf_buffer *buf);
196 181
197void videobuf_queue_core_init(struct videobuf_queue *q, 182void videobuf_queue_core_init(struct videobuf_queue *q,
198 const struct videobuf_queue_ops *ops, 183 const struct videobuf_queue_ops *ops,
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index 53e72f787175..a195f3b9c00a 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -17,6 +17,8 @@
17 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 18 * the Free Software Foundation; either version 2
19 */ 19 */
20#ifndef _VIDEOBUF_DMA_SG_H
21#define _VIDEOBUF_DMA_SG_H
20 22
21#include <media/videobuf-core.h> 23#include <media/videobuf-core.h>
22 24
@@ -27,14 +29,14 @@
27 * block (NULL on errors). Memory for the scatterlist is allocated 29 * block (NULL on errors). Memory for the scatterlist is allocated
28 * using kmalloc. The caller must free the memory. 30 * using kmalloc. The caller must free the memory.
29 */ 31 */
30struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); 32struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
31 33
32/* 34/*
33 * Return a scatterlist for a an array of userpages (NULL on errors). 35 * Return a scatterlist for a an array of userpages (NULL on errors).
34 * Memory for the scatterlist is allocated using kmalloc. The caller 36 * Memory for the scatterlist is allocated using kmalloc. The caller
35 * must free the memory. 37 * must free the memory.
36 */ 38 */
37struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, 39struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages,
38 int offset); 40 int offset);
39 41
40/* --------------------------------------------------------------------- */ 42/* --------------------------------------------------------------------- */
@@ -78,8 +80,7 @@ struct videobuf_dmabuf {
78 int direction; 80 int direction;
79}; 81};
80 82
81struct videobuf_dma_sg_memory 83struct videobuf_dma_sg_memory {
82{
83 u32 magic; 84 u32 magic;
84 85
85 /* for mmap'ed buffers */ 86 /* for mmap'ed buffers */
@@ -95,14 +96,13 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
95 dma_addr_t addr, int nr_pages); 96 dma_addr_t addr, int nr_pages);
96int videobuf_dma_free(struct videobuf_dmabuf *dma); 97int videobuf_dma_free(struct videobuf_dmabuf *dma);
97 98
98int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
99int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); 101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
101struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf);
102 102
103void *videobuf_sg_alloc(size_t size); 103void *videobuf_sg_alloc(size_t size);
104 104
105void videobuf_queue_sg_init(struct videobuf_queue* q, 105void videobuf_queue_sg_init(struct videobuf_queue *q,
106 const struct videobuf_queue_ops *ops, 106 const struct videobuf_queue_ops *ops,
107 struct device *dev, 107 struct device *dev,
108 spinlock_t *irqlock, 108 spinlock_t *irqlock,
@@ -111,9 +111,11 @@ void videobuf_queue_sg_init(struct videobuf_queue* q,
111 unsigned int msize, 111 unsigned int msize,
112 void *priv); 112 void *priv);
113 113
114 /*FIXME: these variants are used only on *-alsa code, where videobuf is 114/*FIXME: these variants are used only on *-alsa code, where videobuf is
115 * used without queue 115 * used without queue
116 */ 116 */
117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); 117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); 118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
119 119
120#endif /* _VIDEOBUF_DMA_SG_H */
121
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 4b419a257a7d..851eb1a2ff2a 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -19,17 +19,17 @@
19 19
20/* --------------------------------------------------------------------- */ 20/* --------------------------------------------------------------------- */
21 21
22struct videobuf_vmalloc_memory 22struct videobuf_vmalloc_memory {
23{
24 u32 magic; 23 u32 magic;
25 24
26 void *vmalloc; 25 void *vmalloc;
27 26
28 /* remap_vmalloc_range seems to need to run after mmap() on some cases */ 27 /* remap_vmalloc_range seems to need to run
28 * after mmap() on some cases */
29 struct vm_area_struct *vma; 29 struct vm_area_struct *vma;
30}; 30};
31 31
32void videobuf_queue_vmalloc_init(struct videobuf_queue* q, 32void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
33 const struct videobuf_queue_ops *ops, 33 const struct videobuf_queue_ops *ops,
34 struct device *dev, 34 struct device *dev,
35 spinlock_t *irqlock, 35 spinlock_t *irqlock,
@@ -38,8 +38,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q,
38 unsigned int msize, 38 unsigned int msize,
39 void *priv); 39 void *priv);
40 40
41void *videobuf_to_vmalloc (struct videobuf_buffer *buf); 41void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
42 42
43void videobuf_vmalloc_free (struct videobuf_buffer *buf); 43void videobuf_vmalloc_free(struct videobuf_buffer *buf);
44 44
45#endif 45#endif
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 1614d78c60ed..20725e213aee 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -30,7 +30,7 @@ struct unix_skb_parms {
30#endif 30#endif
31}; 31};
32 32
33#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 33#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 34#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
35#define UNIXSID(skb) (&UNIXCB((skb)).secid) 35#define UNIXSID(skb) (&UNIXCB((skb)).secid)
36 36
@@ -45,21 +45,23 @@ struct unix_skb_parms {
45struct unix_sock { 45struct unix_sock {
46 /* WARNING: sk has to be the first member */ 46 /* WARNING: sk has to be the first member */
47 struct sock sk; 47 struct sock sk;
48 struct unix_address *addr; 48 struct unix_address *addr;
49 struct dentry *dentry; 49 struct dentry *dentry;
50 struct vfsmount *mnt; 50 struct vfsmount *mnt;
51 struct mutex readlock; 51 struct mutex readlock;
52 struct sock *peer; 52 struct sock *peer;
53 struct sock *other; 53 struct sock *other;
54 struct list_head link; 54 struct list_head link;
55 atomic_long_t inflight; 55 atomic_long_t inflight;
56 spinlock_t lock; 56 spinlock_t lock;
57 unsigned int gc_candidate : 1; 57 unsigned int gc_candidate : 1;
58 unsigned int gc_maybe_cycle : 1; 58 unsigned int gc_maybe_cycle : 1;
59 wait_queue_head_t peer_wait; 59 struct socket_wq peer_wq;
60}; 60};
61#define unix_sk(__sk) ((struct unix_sock *)__sk) 61#define unix_sk(__sk) ((struct unix_sock *)__sk)
62 62
63#define peer_wait peer_wq.wait
64
63#ifdef CONFIG_SYSCTL 65#ifdef CONFIG_SYSCTL
64extern int unix_sysctl_register(struct net *net); 66extern int unix_sysctl_register(struct net *net);
65extern void unix_sysctl_unregister(struct net *net); 67extern void unix_sysctl_unregister(struct net *net);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ce3c99e5fa25..e42f6ed5421c 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -107,6 +107,8 @@ struct hci_dev {
107 unsigned long acl_last_tx; 107 unsigned long acl_last_tx;
108 unsigned long sco_last_tx; 108 unsigned long sco_last_tx;
109 109
110 struct workqueue_struct *workqueue;
111
110 struct tasklet_struct cmd_task; 112 struct tasklet_struct cmd_task;
111 struct tasklet_struct rx_task; 113 struct tasklet_struct rx_task;
112 struct tasklet_struct tx_task; 114 struct tasklet_struct tx_task;
@@ -636,8 +638,8 @@ int hci_register_notifier(struct notifier_block *nb);
636int hci_unregister_notifier(struct notifier_block *nb); 638int hci_unregister_notifier(struct notifier_block *nb);
637 639
638int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 640int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
639int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 641void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
640int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 642void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
641 643
642void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 644void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
643 645
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 17a689f27a6a..7c695bfd853c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -30,11 +30,12 @@
30#define L2CAP_DEFAULT_MIN_MTU 48 30#define L2CAP_DEFAULT_MIN_MTU 48
31#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
32#define L2CAP_DEFAULT_TX_WINDOW 63 32#define L2CAP_DEFAULT_TX_WINDOW 63
33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
34#define L2CAP_DEFAULT_MAX_TX 3 33#define L2CAP_DEFAULT_MAX_TX 3
35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ 34#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 35#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672 36#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
37#define L2CAP_DEFAULT_ACK_TO 200
38#define L2CAP_LOCAL_BUSY_TRIES 12
38 39
39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 40#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 41#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -55,6 +56,8 @@ struct l2cap_options {
55 __u16 flush_to; 56 __u16 flush_to;
56 __u8 mode; 57 __u8 mode;
57 __u8 fcs; 58 __u8 fcs;
59 __u8 max_tx;
60 __u16 txwin_size;
58}; 61};
59 62
60#define L2CAP_CONNINFO 0x02 63#define L2CAP_CONNINFO 0x02
@@ -292,6 +295,7 @@ struct l2cap_conn {
292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 295#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) 296#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) 297#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
298#define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) 299#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296 300
297struct srej_list { 301struct srej_list {
@@ -320,7 +324,7 @@ struct l2cap_pinfo {
320 __u8 conf_req[64]; 324 __u8 conf_req[64];
321 __u8 conf_len; 325 __u8 conf_len;
322 __u8 conf_state; 326 __u8 conf_state;
323 __u8 conn_state; 327 __u16 conn_state;
324 328
325 __u8 next_tx_seq; 329 __u8 next_tx_seq;
326 __u8 expected_ack_seq; 330 __u8 expected_ack_seq;
@@ -328,27 +332,35 @@ struct l2cap_pinfo {
328 __u8 buffer_seq; 332 __u8 buffer_seq;
329 __u8 buffer_seq_srej; 333 __u8 buffer_seq_srej;
330 __u8 srej_save_reqseq; 334 __u8 srej_save_reqseq;
335 __u8 frames_sent;
331 __u8 unacked_frames; 336 __u8 unacked_frames;
332 __u8 retry_count; 337 __u8 retry_count;
333 __u8 num_to_ack; 338 __u8 num_acked;
334 __u16 sdu_len; 339 __u16 sdu_len;
335 __u16 partial_sdu_len; 340 __u16 partial_sdu_len;
336 struct sk_buff *sdu; 341 struct sk_buff *sdu;
337 342
338 __u8 ident; 343 __u8 ident;
339 344
345 __u8 tx_win;
346 __u8 max_tx;
340 __u8 remote_tx_win; 347 __u8 remote_tx_win;
341 __u8 remote_max_tx; 348 __u8 remote_max_tx;
342 __u16 retrans_timeout; 349 __u16 retrans_timeout;
343 __u16 monitor_timeout; 350 __u16 monitor_timeout;
344 __u16 max_pdu_size; 351 __u16 remote_mps;
352 __u16 mps;
345 353
346 __le16 sport; 354 __le16 sport;
347 355
356 spinlock_t send_lock;
348 struct timer_list retrans_timer; 357 struct timer_list retrans_timer;
349 struct timer_list monitor_timer; 358 struct timer_list monitor_timer;
359 struct timer_list ack_timer;
350 struct sk_buff_head tx_queue; 360 struct sk_buff_head tx_queue;
351 struct sk_buff_head srej_queue; 361 struct sk_buff_head srej_queue;
362 struct sk_buff_head busy_queue;
363 struct work_struct busy_work;
352 struct srej_list srej_l; 364 struct srej_list srej_l;
353 struct l2cap_conn *conn; 365 struct l2cap_conn *conn;
354 struct sock *next_c; 366 struct sock *next_c;
@@ -367,19 +379,24 @@ struct l2cap_pinfo {
367#define L2CAP_CONF_MAX_CONF_REQ 2 379#define L2CAP_CONF_MAX_CONF_REQ 2
368#define L2CAP_CONF_MAX_CONF_RSP 2 380#define L2CAP_CONF_MAX_CONF_RSP 2
369 381
370#define L2CAP_CONN_SAR_SDU 0x01 382#define L2CAP_CONN_SAR_SDU 0x0001
371#define L2CAP_CONN_SREJ_SENT 0x02 383#define L2CAP_CONN_SREJ_SENT 0x0002
372#define L2CAP_CONN_WAIT_F 0x04 384#define L2CAP_CONN_WAIT_F 0x0004
373#define L2CAP_CONN_SREJ_ACT 0x08 385#define L2CAP_CONN_SREJ_ACT 0x0008
374#define L2CAP_CONN_SEND_PBIT 0x10 386#define L2CAP_CONN_SEND_PBIT 0x0010
375#define L2CAP_CONN_REMOTE_BUSY 0x20 387#define L2CAP_CONN_REMOTE_BUSY 0x0020
376#define L2CAP_CONN_LOCAL_BUSY 0x40 388#define L2CAP_CONN_LOCAL_BUSY 0x0040
377#define L2CAP_CONN_REJ_ACT 0x80 389#define L2CAP_CONN_REJ_ACT 0x0080
390#define L2CAP_CONN_SEND_FBIT 0x0100
391#define L2CAP_CONN_RNR_SENT 0x0200
392#define L2CAP_CONN_SAR_RETRY 0x0400
378 393
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ 394#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); 395 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ 396#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); 397 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
398#define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \
399 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
383 400
384static inline int l2cap_tx_window_full(struct sock *sk) 401static inline int l2cap_tx_window_full(struct sock *sk)
385{ 402{
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
new file mode 100644
index 000000000000..318ab9478a44
--- /dev/null
+++ b/include/net/caif/caif_dev.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEV_H_
8#define CAIF_DEV_H_
9
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfcnfg.h>
12#include <linux/caif/caif_socket.h>
13#include <linux/if.h>
14
15/**
16 * struct caif_param - CAIF parameters.
17 * @size: Length of data
18 * @data: Binary Data Blob
19 */
20struct caif_param {
21 u16 size;
22 u8 data[256];
23};
24
25/**
26 * struct caif_connect_request - Request data for CAIF channel setup.
27 * @protocol: Type of CAIF protocol to use (at, datagram etc)
28 * @sockaddr: Socket address to connect.
29 * @priority: Priority of the connection.
30 * @link_selector: Link selector (high bandwidth or low latency)
31 * @link_name: Name of the CAIF Link Layer to use.
32 * @param: Connect Request parameters (CAIF_SO_REQ_PARAM).
33 *
34 * This struct is used when connecting a CAIF channel.
35 * It contains all CAIF channel configuration options.
36 */
37struct caif_connect_request {
38 enum caif_protocol_type protocol;
39 struct sockaddr_caif sockaddr;
40 enum caif_channel_priority priority;
41 enum caif_link_selector link_selector;
42 char link_name[16];
43 struct caif_param param;
44};
45
46/**
47 * caif_connect_client - Connect a client to CAIF Core Stack.
48 * @config: Channel setup parameters, specifying what address
49 * to connect on the Modem.
50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions
52 * implemented.
53 *
54 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds
56 * receive functions and control callback functions. Control callback
57 * function will receive information about connect/disconnect responses,
58 * flow control etc (see enum caif_control).
59 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket.
61 */
62int caif_connect_client(struct caif_connect_request *config,
63 struct cflayer *client_layer);
64
65/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack.
67 *
68 * @client_layer: Client layer to be removed.
69 */
70int caif_disconnect_client(struct cflayer *client_layer);
71
72/**
73 * caif_release_client - Release adaptation layer reference to client.
74 *
75 * @client_layer: Client layer.
76 *
77 * Releases a client/adaptation layer use of the caif stack.
78 * This function must be used after caif_disconnect_client to
79 * decrease the reference count of the service layer.
80 */
81void caif_release_client(struct cflayer *client_layer);
82
83/**
84 * connect_req_to_link_param - Translate configuration parameters
85 * from socket format to internal format.
86 * @cnfg: Pointer to configuration handler
87 * @con_req: Configuration parameters supplied in function
88 * caif_connect_client
89 * @channel_setup_param: Parameters supplied to the CAIF Core stack for
90 * setting up channels.
91 *
92 */
93int connect_req_to_link_param(struct cfcnfg *cnfg,
94 struct caif_connect_request *con_req,
95 struct cfctrl_link_param *channel_setup_param);
96
97/**
98 * get_caif_conf() - Get the configuration handler.
99 */
100struct cfcnfg *get_caif_conf(void);
101
102
103#endif /* CAIF_DEV_H_ */
diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h
new file mode 100644
index 000000000000..d02f044adb8a
--- /dev/null
+++ b/include/net/caif/caif_device.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_DEVICE_H_
8#define CAIF_DEVICE_H_
9#include <linux/kernel.h>
10#include <linux/net.h>
11#include <linux/netdevice.h>
12#include <linux/caif/caif_socket.h>
13#include <net/caif/caif_device.h>
14
15/**
16 * struct caif_dev_common - data shared between CAIF drivers and stack.
17 * @flowctrl: Flow Control callback function. This function is
18 * supplied by CAIF Core Stack and is used by CAIF
19 * Link Layer to send flow-stop to CAIF Core.
20 * The flow information will be distributed to all
21 * clients of CAIF.
22 *
23 * @link_select: Profile of device, either high-bandwidth or
24 * low-latency. This member is set by CAIF Link
25 * Layer Device in order to indicate if this device
26 * is a high bandwidth or low latency device.
27 *
28 * @use_frag: CAIF Frames may be fragmented.
29 * Is set by CAIF Link Layer in order to indicate if the
30 * interface receives fragmented frames that must be
31 * assembled by CAIF Core Layer.
32 *
33 * @use_fcs: Indicate if Frame CheckSum (fcs) is used.
34 * Is set if the physical interface is
35 * using Frame Checksum on the CAIF Frames.
36 *
37 * @use_stx: Indicate STart of frame eXtension (stx) in use.
38 * Is set if the CAIF Link Layer expects
39 * CAIF Frames to start with the STX byte.
40 *
41 * This structure is shared between the CAIF drivers and the CAIF stack.
42 * It is used by the device to register its behavior.
43 * CAIF Core layer must set the member flowctrl in order to supply
44 * CAIF Link Layer with the flow control function.
45 *
46 */
47 struct caif_dev_common {
48 void (*flowctrl)(struct net_device *net, int on);
49 enum caif_link_selector link_select;
50 int use_frag;
51 int use_fcs;
52 int use_stx;
53};
54
55#endif /* CAIF_DEVICE_H_ */
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
new file mode 100644
index 000000000000..25c472f0e5b8
--- /dev/null
+++ b/include/net/caif/caif_layer.h
@@ -0,0 +1,283 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CAIF_LAYER_H_
8#define CAIF_LAYER_H_
9
10#include <linux/list.h>
11
12struct cflayer;
13struct cfpkt;
14struct cfpktq;
15struct caif_payload_info;
16struct caif_packet_funcs;
17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22
23#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26
27/**
28 * caif_assert() - Assert function for CAIF.
29 * @assert: expression to evaluate.
30 *
31 * This function will print a error message and a do WARN_ON if the
32 * assertion failes. Normally this will do a stack up at the current location.
33 */
34#define caif_assert(assert) \
35do { \
36 if (!(assert)) { \
37 pr_err("caif:Assert detected:'%s'\n", #assert); \
38 WARN_ON(!(assert)); \
39 } \
40} while (0)
41
42
43/**
44 * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd().
45 *
46 * @CAIF_CTRLCMD_FLOW_OFF_IND: Flow Control is OFF, transmit function
47 * should stop sending data
48 *
49 * @CAIF_CTRLCMD_FLOW_ON_IND: Flow Control is ON, transmit function
50 * can start sending data
51 *
52 * @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: Remote end modem has decided to close
53 * down channel
54 *
55 * @CAIF_CTRLCMD_INIT_RSP: Called initially when the layer below
56 * has finished initialization
57 *
58 * @CAIF_CTRLCMD_DEINIT_RSP: Called when de-initialization is
59 * complete
60 *
61 * @CAIF_CTRLCMD_INIT_FAIL_RSP: Called if initialization fails
62 *
63 * @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: CAIF Link layer temporarily cannot
64 * send more packets.
65 * @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND: Called if CAIF Link layer is able
66 * to send packets again.
67 * @_CAIF_CTRLCMD_PHYIF_DOWN_IND: Called if CAIF Link layer is going
68 * down.
69 *
70 * These commands are sent upwards in the CAIF stack to the CAIF Client.
71 * They are used for signaling originating from the modem or CAIF Link Layer.
72 * These are either responses (*_RSP) or events (*_IND).
73 */
74enum caif_ctrlcmd {
75 CAIF_CTRLCMD_FLOW_OFF_IND,
76 CAIF_CTRLCMD_FLOW_ON_IND,
77 CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND,
78 CAIF_CTRLCMD_INIT_RSP,
79 CAIF_CTRLCMD_DEINIT_RSP,
80 CAIF_CTRLCMD_INIT_FAIL_RSP,
81 _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND,
82 _CAIF_CTRLCMD_PHYIF_FLOW_ON_IND,
83 _CAIF_CTRLCMD_PHYIF_DOWN_IND,
84};
85
86/**
87 * enum caif_modemcmd - Modem Control Signaling, sent from CAIF Client
88 * to the CAIF Link Layer or modem.
89 *
90 * @CAIF_MODEMCMD_FLOW_ON_REQ: Flow Control is ON, transmit function
91 * can start sending data.
92 *
93 * @CAIF_MODEMCMD_FLOW_OFF_REQ: Flow Control is OFF, transmit function
94 * should stop sending data.
95 *
96 * @_CAIF_MODEMCMD_PHYIF_USEFULL: Notify physical layer that it is in use
97 *
98 * @_CAIF_MODEMCMD_PHYIF_USELESS: Notify physical layer that it is
99 * no longer in use.
100 *
101 * These are requests sent 'downwards' in the stack.
102 * Flow ON, OFF can be indicated to the modem.
103 */
104enum caif_modemcmd {
105 CAIF_MODEMCMD_FLOW_ON_REQ = 0,
106 CAIF_MODEMCMD_FLOW_OFF_REQ = 1,
107 _CAIF_MODEMCMD_PHYIF_USEFULL = 3,
108 _CAIF_MODEMCMD_PHYIF_USELESS = 4
109};
110
111/**
112 * enum caif_direction - CAIF Packet Direction.
113 * Indicate if a packet is to be sent out or to be received in.
114 * @CAIF_DIR_IN: Incoming packet received.
115 * @CAIF_DIR_OUT: Outgoing packet to be transmitted.
116 */
117enum caif_direction {
118 CAIF_DIR_IN = 0,
119 CAIF_DIR_OUT = 1
120};
121
122/**
123 * struct cflayer - CAIF Stack layer.
124 * Defines the framework for the CAIF Core Stack.
125 * @up: Pointer up to the layer above.
126 * @dn: Pointer down to the layer below.
127 * @node: List node used when layer participate in a list.
128 * @receive: Packet receive function.
129 * @transmit: Packet transmit funciton.
130 * @ctrlcmd: Used for control signalling upwards in the stack.
131 * @modemcmd: Used for control signaling downwards in the stack.
132 * @prio: Priority of this layer.
133 * @id: The identity of this layer
134 * @type: The type of this layer
135 * @name: Name of the layer.
136 *
137 * This structure defines the layered structure in CAIF.
138 *
139 * It defines CAIF layering structure, used by all CAIF Layers and the
140 * layers interfacing CAIF.
141 *
142 * In order to integrate with CAIF an adaptation layer on top of the CAIF stack
143 * and PHY layer below the CAIF stack
144 * must be implemented. These layer must follow the design principles below.
145 *
146 * Principles for layering of protocol layers:
147 * - All layers must use this structure. If embedding it, then place this
148 * structure first in the layer specific structure.
149 *
150 * - Each layer should not depend on any others layer private data.
151 *
152 * - In order to send data upwards do
153 * layer->up->receive(layer->up, packet);
154 *
155 * - In order to send data downwards do
156 * layer->dn->transmit(layer->dn, info, packet);
157 */
158struct cflayer {
159 struct cflayer *up;
160 struct cflayer *dn;
161 struct list_head node;
162
163 /*
164 * receive() - Receive Function.
165 * Contract: Each layer must implement a receive function passing the
166 * CAIF packets upwards in the stack.
167 * Packet handling rules:
168 * - The CAIF packet (cfpkt) cannot be accessed after
169 * passing it to the next layer using up->receive().
170 * - If parsing of the packet fails, the packet must be
171 * destroyed and -1 returned from the function.
172 * - If parsing succeeds (and above layers return OK) then
173 * the function must return a value > 0.
174 *
175 * Returns result < 0 indicates an error, 0 or positive value
176 * indicates success.
177 *
178 * @layr: Pointer to the current layer the receive function is
179 * implemented for (this pointer).
180 * @cfpkt: Pointer to CaifPacket to be handled.
181 */
182 int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt);
183
184 /*
185 * transmit() - Transmit Function.
186 * Contract: Each layer must implement a transmit function passing the
187 * CAIF packet downwards in the stack.
188 * Packet handling rules:
189 * - The CAIF packet (cfpkt) ownership is passed to the
190 * transmit function. This means that the the packet
191 * cannot be accessed after passing it to the below
192 * layer using dn->transmit().
193 *
194 * - If transmit fails, however, the ownership is returned
195 * to thecaller. The caller of "dn->transmit()" must
196 * destroy or resend packet.
197 *
198 * - Return value less than zero means error, zero or
199 * greater than zero means OK.
200 *
201 * result < 0 indicates an error, 0 or positive value
202 * indicate success.
203 *
204 * @layr: Pointer to the current layer the receive function
205 * isimplemented for (this pointer).
206 * @cfpkt: Pointer to CaifPacket to be handled.
207 */
208 int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt);
209
210 /*
211 * cttrlcmd() - Control Function upwards in CAIF Stack.
212 * Used for signaling responses (CAIF_CTRLCMD_*_RSP)
213 * and asynchronous events from the modem (CAIF_CTRLCMD_*_IND)
214 *
215 * @layr: Pointer to the current layer the receive function
216 * is implemented for (this pointer).
217 * @ctrl: Control Command.
218 */
219 void (*ctrlcmd) (struct cflayer *layr, enum caif_ctrlcmd ctrl,
220 int phyid);
221
222 /*
223 * modemctrl() - Control Function used for controlling the modem.
224 * Used to signal down-wards in the CAIF stack.
225 * Returns 0 on success, < 0 upon failure.
226 *
227 * @layr: Pointer to the current layer the receive function
228 * is implemented for (this pointer).
229 * @ctrl: Control Command.
230 */
231 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl);
232
233 unsigned short prio;
234 unsigned int id;
235 unsigned int type;
236 char name[CAIF_LAYER_NAME_SZ];
237};
238
239/**
240 * layer_set_up() - Set the up pointer for a specified layer.
241 * @layr: Layer where up pointer shall be set.
242 * @above: Layer above.
243 */
244#define layer_set_up(layr, above) ((layr)->up = (struct cflayer *)(above))
245
246/**
247 * layer_set_dn() - Set the down pointer for a specified layer.
248 * @layr: Layer where down pointer shall be set.
249 * @below: Layer below.
250 */
251#define layer_set_dn(layr, below) ((layr)->dn = (struct cflayer *)(below))
252
253/**
254 * struct dev_info - Physical Device info information about physical layer.
255 * @dev: Pointer to native physical device.
256 * @id: Physical ID of the physical connection used by the
257 * logical CAIF connection. Used by service layers to
258 * identify their physical id to Caif MUX (CFMUXL)so
259 * that the MUX can add the correct physical ID to the
260 * packet.
261 */
262struct dev_info {
263 void *dev;
264 unsigned int id;
265};
266
267/**
268 * struct caif_payload_info - Payload information embedded in packet (sk_buff).
269 *
270 * @dev_info: Information about the receiving device.
271 *
272 * @hdr_len: Header length, used to align pay load on 32bit boundary.
273 *
274 * @channel_id: Channel ID of the logical CAIF connection.
275 * Used by mux to insert channel id into the caif packet.
276 */
277struct caif_payload_info {
278 struct dev_info *dev_info;
279 unsigned short hdr_len;
280 unsigned short channel_id;
281};
282
283#endif /* CAIF_LAYER_H_ */
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
new file mode 100644
index 000000000000..9fc2fc20b884
--- /dev/null
+++ b/include/net/caif/cfcnfg.h
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCNFG_H_
8#define CFCNFG_H_
9#include <linux/spinlock.h>
10#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h>
12
13struct cfcnfg;
14
15/**
16 * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
17 *
18 * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
19 * @CFPHYTYPE_CAIF: Generic CAIF physical interface
20 */
21enum cfcnfg_phy_type {
22 CFPHYTYPE_FRAG = 1,
23 CFPHYTYPE_CAIF,
24 CFPHYTYPE_MAX
25};
26
27/**
28 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
29 *
30 * @CFPHYPREF_UNSPECIFIED: Default physical interface
31 *
32 * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
33 * traffic
34 * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
35 * traffic
36 * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
37 * responses.
38 *
39 */
40enum cfcnfg_phy_preference {
41 CFPHYPREF_UNSPECIFIED,
42 CFPHYPREF_LOW_LAT,
43 CFPHYPREF_HIGH_BW,
44 CFPHYPREF_LOOP
45};
46
47/**
48 * cfcnfg_create() - Create the CAIF configuration object.
49 */
50struct cfcnfg *cfcnfg_create(void);
51
52/**
53 * cfcnfg_remove() - Remove the CFCNFG object
54 * @cfg: config object
55 */
56void cfcnfg_remove(struct cfcnfg *cfg);
57
58/**
59 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
60 * @cnfg: Pointer to a CAIF configuration object, created by
61 * cfcnfg_create().
62 * @phy_type: Specifies the type of physical interface, e.g.
63 * CFPHYTYPE_FRAG.
64 * @dev: Pointer to link layer device
65 * @phy_layer: Specify the physical layer. The transmit function
66 * MUST be set in the structure.
67 * @phyid: The assigned physical ID for this layer, used in
68 * cfcnfg_add_adapt_layer to specify PHY for the link.
69 * @pref: The phy (link layer) preference.
70 * @fcs: Specify if checksum is used in CAIF Framing Layer.
71 * @stx: Specify if Start Of Frame eXtention is used.
72 */
73
74void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid,
77 enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx);
79
80/**
81 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
82 *
83 * @cnfg: Pointer to a CAIF configuration object, created by
84 * cfcnfg_create().
85 * @phy_layer: Adaptation layer to be removed.
86 */
87int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
88
89/**
90 * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.
91 *
92 * @cnfg: Pointer to a CAIF configuration object, created by
93 * cfcnfg_create().
94 * @adap_layer: Adaptation layer to be removed.
95 */
96int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg,
97 struct cflayer *adap_layer);
98
99/**
100 * cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
101 *
102 * @adap_layer: Adaptation layer.
103 */
104void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
105
106/**
107 * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
108 *
109 * The adaptation Layer is where the interface to application or higher-level
110 * driver functionality is implemented.
111 *
112 * @cnfg: Pointer to a CAIF configuration object, created by
113 * cfcnfg_create().
114 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure.
117 *
118 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer);
122
123/**
124 * cfcnfg_get_phyid() - Get physical ID, given type.
125 * Returns one of the physical interfaces matching the given type.
126 * Zero if no match is found.
127 * @cnfg: Configuration object
128 * @phy_pref: Caif Link Layer preference
129 */
130struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
131 enum cfcnfg_phy_preference phy_pref);
132
133/**
134 * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
135 * @cnfg: Configuration object
136 * @name: Name of the Physical Layer (Caif Link Layer)
137 */
138int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
139
140#endif /* CFCNFG_H_ */
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h
new file mode 100644
index 000000000000..997603f2bf4c
--- /dev/null
+++ b/include/net/caif/cfctrl.h
@@ -0,0 +1,139 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCTRL_H_
8#define CFCTRL_H_
9#include <net/caif/caif_layer.h>
10#include <net/caif/cfsrvl.h>
11
12/* CAIF Control packet commands */
13enum cfctrl_cmd {
14 CFCTRL_CMD_LINK_SETUP = 0,
15 CFCTRL_CMD_LINK_DESTROY = 1,
16 CFCTRL_CMD_LINK_ERR = 2,
17 CFCTRL_CMD_ENUM = 3,
18 CFCTRL_CMD_SLEEP = 4,
19 CFCTRL_CMD_WAKE = 5,
20 CFCTRL_CMD_LINK_RECONF = 6,
21 CFCTRL_CMD_START_REASON = 7,
22 CFCTRL_CMD_RADIO_SET = 8,
23 CFCTRL_CMD_MODEM_SET = 9,
24 CFCTRL_CMD_MASK = 0xf
25};
26
27/* Channel types */
28enum cfctrl_srv {
29 CFCTRL_SRV_DECM = 0,
30 CFCTRL_SRV_VEI = 1,
31 CFCTRL_SRV_VIDEO = 2,
32 CFCTRL_SRV_DBG = 3,
33 CFCTRL_SRV_DATAGRAM = 4,
34 CFCTRL_SRV_RFM = 5,
35 CFCTRL_SRV_UTIL = 6,
36 CFCTRL_SRV_MASK = 0xf
37};
38
39#define CFCTRL_RSP_BIT 0x20
40#define CFCTRL_ERR_BIT 0x10
41
42struct cfctrl_rsp {
43 void (*linksetup_rsp)(struct cflayer *layer, u8 linkid,
44 enum cfctrl_srv serv, u8 phyid,
45 struct cflayer *adapt_layer);
46 void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid);
47 void (*linkerror_ind)(void);
48 void (*enum_rsp)(void);
49 void (*sleep_rsp)(void);
50 void (*wake_rsp)(void);
51 void (*restart_rsp)(void);
52 void (*radioset_rsp)(void);
53 void (*reject_rsp)(struct cflayer *layer, u8 linkid,
54 struct cflayer *client_layer);;
55};
56
57/* Link Setup Parameters for CAIF-Links. */
58struct cfctrl_link_param {
59 enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */
60 u8 priority; /* (P4,P0) Priority of the channel */
61 u8 phyid; /* (U2-U0) Physical interface to connect */
62 u8 endpoint; /* (E1,E0) Endpoint for data channels */
63 u8 chtype; /* (H1,H0) Channel-Type, applies to
64 * VEI, DEBUG */
65 union {
66 struct {
67 u8 connid; /* (D7,D0) Video LinkId */
68 } video;
69
70 struct {
71 u32 connid; /* (N31,Ngit0) Connection ID used
72 * for Datagram */
73 } datagram;
74
75 struct {
76 u32 connid; /* Connection ID used for RFM */
77 char volume[20]; /* Volume to mount for RFM */
78 } rfm; /* Configuration for RFM */
79
80 struct {
81 u16 fifosize_kb; /* Psock FIFO size in KB */
82 u16 fifosize_bufs; /* Psock # signal buffers */
83 char name[16]; /* Name of the PSOCK service */
84 u8 params[255]; /* Link setup Parameters> */
85 u16 paramlen; /* Length of Link Setup
86 * Parameters */
87 } utility; /* Configuration for Utility Links (Psock) */
88 } u;
89};
90
91/* This structure is used internally in CFCTRL */
92struct cfctrl_request_info {
93 int sequence_no;
94 enum cfctrl_cmd cmd;
95 u8 channel_id;
96 struct cfctrl_link_param param;
97 struct cfctrl_request_info *next;
98 struct cflayer *client_layer;
99};
100
101struct cfctrl {
102 struct cfsrvl serv;
103 struct cfctrl_rsp res;
104 atomic_t req_seq_no;
105 atomic_t rsp_seq_no;
106 struct cfctrl_request_info *first_req;
107 /* Protects from simultaneous access to first_req list */
108 spinlock_t info_list_lock;
109#ifndef CAIF_NO_LOOP
110 u8 loop_linkid;
111 int loop_linkused[256];
112 /* Protects simultaneous access to loop_linkid and loop_linkused */
113 spinlock_t loop_linkid_lock;
114#endif
115
116};
117
118void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid);
119int cfctrl_linkup_request(struct cflayer *cfctrl,
120 struct cfctrl_link_param *param,
121 struct cflayer *user_layer);
122int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid,
123 struct cflayer *client);
124void cfctrl_sleep_req(struct cflayer *cfctrl);
125void cfctrl_wake_req(struct cflayer *cfctrl);
126void cfctrl_getstartreason_req(struct cflayer *cfctrl);
127struct cflayer *cfctrl_create(void);
128void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn);
129void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up);
130struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer);
131bool cfctrl_req_eq(struct cfctrl_request_info *r1,
132 struct cfctrl_request_info *r2);
133void cfctrl_insert_req(struct cfctrl *ctrl,
134 struct cfctrl_request_info *req);
135struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,
136 struct cfctrl_request_info *req);
137void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer);
138
139#endif /* CFCTRL_H_ */
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h
new file mode 100644
index 000000000000..3f14d2e1ce61
--- /dev/null
+++ b/include/net/caif/cffrml.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFFRML_H_
8#define CFFRML_H_
9#include <net/caif/caif_layer.h>
10
11struct cffrml;
12struct cflayer *cffrml_create(u16 phyid, bool DoFCS);
13void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up);
14void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn);
15
16#endif /* CFFRML_H_ */
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h
new file mode 100644
index 000000000000..4e1b4f33423e
--- /dev/null
+++ b/include/net/caif/cfmuxl.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFMUXL_H_
8#define CFMUXL_H_
9#include <net/caif/caif_layer.h>
10
11struct cfsrvl;
12struct cffrml;
13
14struct cflayer *cfmuxl_create(void);
15int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid);
16struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid);
17int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid);
18struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid);
19bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid);
20u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id);
21
22#endif /* CFMUXL_H_ */
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
new file mode 100644
index 000000000000..fbc681beff52
--- /dev/null
+++ b/include/net/caif/cfpkt.h
@@ -0,0 +1,274 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFPKT_H_
8#define CFPKT_H_
9#include <net/caif/caif_layer.h>
10#include <linux/types.h>
11struct cfpkt;
12
13/* Create a CAIF packet.
14 * len: Length of packet to be created
15 * @return New packet.
16 */
17struct cfpkt *cfpkt_create(u16 len);
18
19/* Create a CAIF packet.
20 * data Data to copy.
21 * len Length of packet to be created
22 * @return New packet.
23 */
24struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len);
25/*
26 * Destroy a CAIF Packet.
27 * pkt Packet to be destoyed.
28 */
29void cfpkt_destroy(struct cfpkt *pkt);
30
31/*
32 * Extract header from packet.
33 *
34 * pkt Packet to extract header data from.
35 * data Pointer to copy the header data into.
36 * len Length of head data to copy.
37 * @return zero on success and error code upon failure
38 */
39int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len);
40
41/*
42 * Peek header from packet.
43 * Reads data from packet without changing packet.
44 *
45 * pkt Packet to extract header data from.
46 * data Pointer to copy the header data into.
47 * len Length of head data to copy.
48 * @return zero on success and error code upon failure
49 */
50int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len);
51
52/*
53 * Extract header from trailer (end of packet).
54 *
55 * pkt Packet to extract header data from.
56 * data Pointer to copy the trailer data into.
57 * len Length of header data to copy.
58 * @return zero on success and error code upon failure
59 */
60int cfpkt_extr_trail(struct cfpkt *pkt, void *data, u16 len);
61
62/*
63 * Add header to packet.
64 *
65 *
66 * pkt Packet to add header data to.
67 * data Pointer to data to copy into the header.
68 * len Length of header data to copy.
69 * @return zero on success and error code upon failure
70 */
71int cfpkt_add_head(struct cfpkt *pkt, const void *data, u16 len);
72
73/*
74 * Add trailer to packet.
75 *
76 *
77 * pkt Packet to add trailer data to.
78 * data Pointer to data to copy into the trailer.
79 * len Length of trailer data to copy.
80 * @return zero on success and error code upon failure
81 */
82int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len);
83
84/*
85 * Pad trailer on packet.
86 * Moves data pointer in packet, no content copied.
87 *
88 * pkt Packet in which to pad trailer.
89 * len Length of padding to add.
90 * @return zero on success and error code upon failure
91 */
92int cfpkt_pad_trail(struct cfpkt *pkt, u16 len);
93
94/*
95 * Add a single byte to packet body (tail).
96 *
97 * pkt Packet in which to add byte.
98 * data Byte to add.
99 * @return zero on success and error code upon failure
100 */
101int cfpkt_addbdy(struct cfpkt *pkt, const u8 data);
102
103/*
104 * Add a data to packet body (tail).
105 *
106 * pkt Packet in which to add data.
107 * data Pointer to data to copy into the packet body.
108 * len Length of data to add.
109 * @return zero on success and error code upon failure
110 */
111int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len);
112
113/*
114 * Checks whether there are more data to process in packet.
115 * pkt Packet to check.
116 * @return true if more data are available in packet false otherwise
117 */
118bool cfpkt_more(struct cfpkt *pkt);
119
120/*
121 * Checks whether the packet is erroneous,
122 * i.e. if it has been attempted to extract more data than available in packet
123 * or writing more data than has been allocated in cfpkt_create().
124 * pkt Packet to check.
125 * @return true on error false otherwise
126 */
127bool cfpkt_erroneous(struct cfpkt *pkt);
128
129/*
130 * Get the packet length.
131 * pkt Packet to get length from.
132 * @return Number of bytes in packet.
133 */
134u16 cfpkt_getlen(struct cfpkt *pkt);
135
136/*
137 * Set the packet length, by adjusting the trailer pointer according to length.
138 * pkt Packet to set length.
139 * len Packet length.
140 * @return Number of bytes in packet.
141 */
142int cfpkt_setlen(struct cfpkt *pkt, u16 len);
143
144/*
145 * cfpkt_append - Appends a packet's data to another packet.
146 * dstpkt: Packet to append data into, WILL BE FREED BY THIS FUNCTION
147 * addpkt: Packet to be appended and automatically released,
148 * WILL BE FREED BY THIS FUNCTION.
149 * expectlen: Packet's expected total length. This should be considered
150 * as a hint.
151 * NB: Input packets will be destroyed after appending and cannot be used
152 * after calling this function.
153 * @return The new appended packet.
154 */
155struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, struct cfpkt *addpkt,
156 u16 expectlen);
157
158/*
159 * cfpkt_split - Split a packet into two packets at the specified split point.
160 * pkt: Packet to be split (will contain the first part of the data on exit)
161 * pos: Position to split packet in two parts.
162 * @return The new packet, containing the second part of the data.
163 */
164struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos);
165
166/*
167 * Iteration function, iterates the packet buffers from start to end.
168 *
169 * Checksum iteration function used to iterate buffers
170 * (we may have packets consisting of a chain of buffers)
171 * pkt: Packet to calculate checksum for
172 * iter_func: Function pointer to iteration function
173 * chks: Checksum calculated so far.
174 * buf: Pointer to the buffer to checksum
175 * len: Length of buf.
176 * data: Initial checksum value.
177 * @return Checksum of buffer.
178 */
179
180u16 cfpkt_iterate(struct cfpkt *pkt,
181 u16 (*iter_func)(u16 chks, void *buf, u16 len),
182 u16 data);
183
184/* Append by giving user access to packet buffer
185 * cfpkt Packet to append to
186 * buf Buffer inside pkt that user shall copy data into
187 * buflen Length of buffer and number of bytes added to packet
188 * @return 0 on error, 1 on success
189 */
190int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
191
192/* Extract by giving user access to packet buffer
193 * cfpkt Packet to extract from
194 * buf Buffer inside pkt that user shall copy data from
195 * buflen Length of buffer and number of bytes removed from packet
196 * @return 0 on error, 1 on success
197 */
198int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen);
199
200/* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet.
201 * dir - Direction indicating whether this packet is to be sent or received.
202 * nativepkt - The native packet to be transformed to a CAIF packet
203 * @return The mapped CAIF Packet CFPKT.
204 */
205struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
206
207/* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer).
208 * pkt - The CAIF packet to be transformed into a "native" packet.
209 * @return The native packet transformed from a CAIF packet.
210 */
211void *cfpkt_tonative(struct cfpkt *pkt);
212
213/*
214 * Insert a packet in the packet queue.
215 * pktq Packet queue to insert into
216 * pkt Packet to be inserted in queue
217 * prio Priority of packet
218 */
219void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt,
220 unsigned short prio);
221
222/*
223 * Remove a packet from the packet queue.
224 * pktq Packet queue to fetch packets from.
225 * @return Dequeued packet.
226 */
227struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq);
228
229/*
230 * Peek into a packet from the packet queue.
231 * pktq Packet queue to fetch packets from.
232 * @return Peeked packet.
233 */
234struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq);
235
236/*
237 * Initiates the packet queue.
238 * @return Pointer to new packet queue.
239 */
240struct cfpktq *cfpktq_create(void);
241
242/*
243 * Get the number of packets in the queue.
244 * pktq Packet queue to fetch count from.
245 * @return Number of packets in queue.
246 */
247int cfpkt_qcount(struct cfpktq *pktq);
248
249/*
250 * Put content of packet into buffer for debuging purposes.
251 * pkt Packet to copy data from
252 * buf Buffer to copy data into
253 * buflen Length of data to copy
254 * @return Pointer to copied data
255 */
256char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen);
257
258/*
259 * Clones a packet and releases the original packet.
260 * This is used for taking ownership of a packet e.g queueing.
261 * pkt Packet to clone and release.
262 * @return Cloned packet.
263 */
264struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt);
265
266
267/*
268 * Returns packet information for a packet.
269 * pkt Packet to get info from;
270 * @return Packet information
271 */
272struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
273/*! @} */
274#endif /* CFPKT_H_ */
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
new file mode 100644
index 000000000000..b8374321b362
--- /dev/null
+++ b/include/net/caif/cfserl.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSERL_H_
8#define CFSERL_H_
9#include <net/caif/caif_layer.h>
10
11struct cflayer *cfserl_create(int type, int instance, bool use_stx);
12#endif /* CFSERL_H_ */
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h
new file mode 100644
index 000000000000..2dc9eb193ecf
--- /dev/null
+++ b/include/net/caif/cfsrvl.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFSRVL_H_
8#define CFSRVL_H_
9#include <linux/list.h>
10#include <linux/stddef.h>
11#include <linux/types.h>
12#include <linux/kref.h>
13
14struct cfsrvl {
15 struct cflayer layer;
16 bool open;
17 bool phy_flow_on;
18 bool modem_flow_on;
19 struct dev_info dev_info;
20 struct kref ref;
21};
22
23void cfsrvl_release(struct kref *kref);
24struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
25struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
26struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
27struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
28struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info);
29struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
30bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
31void cfservl_destroy(struct cflayer *layer);
32void cfsrvl_init(struct cfsrvl *service,
33 u8 channel_id,
34 struct dev_info *dev_info);
35bool cfsrvl_ready(struct cfsrvl *service, int *err);
36u8 cfsrvl_getphyid(struct cflayer *layer);
37
38static inline void cfsrvl_get(struct cflayer *layr)
39{
40 struct cfsrvl *s;
41 if (layr == NULL)
42 return;
43 s = container_of(layr, struct cfsrvl, layer);
44 kref_get(&s->ref);
45}
46
47static inline void cfsrvl_put(struct cflayer *layr)
48{
49 struct cfsrvl *s;
50 if (layr == NULL)
51 return;
52 s = container_of(layr, struct cfsrvl, layer);
53 kref_put(&s->ref, cfsrvl_release);
54}
55
56#endif /* CFSRVL_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 3d134a1fb96b..b44a2e5321a3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -511,6 +511,7 @@ struct mpath_info {
511 * @basic_rates: basic rates in IEEE 802.11 format 511 * @basic_rates: basic rates in IEEE 802.11 format
512 * (or NULL for no change) 512 * (or NULL for no change)
513 * @basic_rates_len: number of basic rates 513 * @basic_rates_len: number of basic rates
514 * @ap_isolate: do not forward packets between connected stations
514 */ 515 */
515struct bss_parameters { 516struct bss_parameters {
516 int use_cts_prot; 517 int use_cts_prot;
@@ -518,6 +519,7 @@ struct bss_parameters {
518 int use_short_slot_time; 519 int use_short_slot_time;
519 u8 *basic_rates; 520 u8 *basic_rates;
520 u8 basic_rates_len; 521 u8 basic_rates_len;
522 int ap_isolate;
521}; 523};
522 524
523struct mesh_config { 525struct mesh_config {
@@ -704,6 +706,10 @@ struct cfg80211_crypto_settings {
704 * @key_len: length of WEP key for shared key authentication 706 * @key_len: length of WEP key for shared key authentication
705 * @key_idx: index of WEP key for shared key authentication 707 * @key_idx: index of WEP key for shared key authentication
706 * @key: WEP key for shared key authentication 708 * @key: WEP key for shared key authentication
709 * @local_state_change: This is a request for a local state only, i.e., no
710 * Authentication frame is to be transmitted and authentication state is
711 * to be changed without having to wait for a response from the peer STA
712 * (AP).
707 */ 713 */
708struct cfg80211_auth_request { 714struct cfg80211_auth_request {
709 struct cfg80211_bss *bss; 715 struct cfg80211_bss *bss;
@@ -712,6 +718,7 @@ struct cfg80211_auth_request {
712 enum nl80211_auth_type auth_type; 718 enum nl80211_auth_type auth_type;
713 const u8 *key; 719 const u8 *key;
714 u8 key_len, key_idx; 720 u8 key_len, key_idx;
721 bool local_state_change;
715}; 722};
716 723
717/** 724/**
@@ -744,12 +751,15 @@ struct cfg80211_assoc_request {
744 * @ie: Extra IEs to add to Deauthentication frame or %NULL 751 * @ie: Extra IEs to add to Deauthentication frame or %NULL
745 * @ie_len: Length of ie buffer in octets 752 * @ie_len: Length of ie buffer in octets
746 * @reason_code: The reason code for the deauthentication 753 * @reason_code: The reason code for the deauthentication
754 * @local_state_change: This is a request for a local state only, i.e., no
755 * Deauthentication frame is to be transmitted.
747 */ 756 */
748struct cfg80211_deauth_request { 757struct cfg80211_deauth_request {
749 struct cfg80211_bss *bss; 758 struct cfg80211_bss *bss;
750 const u8 *ie; 759 const u8 *ie;
751 size_t ie_len; 760 size_t ie_len;
752 u16 reason_code; 761 u16 reason_code;
762 bool local_state_change;
753}; 763};
754 764
755/** 765/**
@@ -762,12 +772,15 @@ struct cfg80211_deauth_request {
762 * @ie: Extra IEs to add to Disassociation frame or %NULL 772 * @ie: Extra IEs to add to Disassociation frame or %NULL
763 * @ie_len: Length of ie buffer in octets 773 * @ie_len: Length of ie buffer in octets
764 * @reason_code: The reason code for the disassociation 774 * @reason_code: The reason code for the disassociation
775 * @local_state_change: This is a request for a local state only, i.e., no
776 * Disassociation frame is to be transmitted.
765 */ 777 */
766struct cfg80211_disassoc_request { 778struct cfg80211_disassoc_request {
767 struct cfg80211_bss *bss; 779 struct cfg80211_bss *bss;
768 const u8 *ie; 780 const u8 *ie;
769 size_t ie_len; 781 size_t ie_len;
770 u16 reason_code; 782 u16 reason_code;
783 bool local_state_change;
771}; 784};
772 785
773/** 786/**
@@ -953,7 +966,11 @@ struct cfg80211_pmksa {
953 * 966 *
954 * @set_txq_params: Set TX queue parameters 967 * @set_txq_params: Set TX queue parameters
955 * 968 *
956 * @set_channel: Set channel 969 * @set_channel: Set channel for a given wireless interface. Some devices
970 * may support multi-channel operation (by channel hopping) so cfg80211
971 * doesn't verify much. Note, however, that the passed netdev may be
972 * %NULL as well if the user requested changing the channel for the
973 * device itself, or for a monitor interface.
957 * 974 *
958 * @scan: Request to do a scan. If returning zero, the scan request is given 975 * @scan: Request to do a scan. If returning zero, the scan request is given
959 * the driver, and will be valid until passed to cfg80211_scan_done(). 976 * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1007,6 +1024,9 @@ struct cfg80211_pmksa {
1007 * RSN IE. It allows for faster roaming between WPA2 BSSIDs. 1024 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
1008 * @del_pmksa: Delete a cached PMKID. 1025 * @del_pmksa: Delete a cached PMKID.
1009 * @flush_pmksa: Flush all cached PMKIDs. 1026 * @flush_pmksa: Flush all cached PMKIDs.
1027 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
1028 * allows the driver to adjust the dynamic ps timeout value.
1029 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
1010 * 1030 *
1011 */ 1031 */
1012struct cfg80211_ops { 1032struct cfg80211_ops {
@@ -1079,7 +1099,7 @@ struct cfg80211_ops {
1079 int (*set_txq_params)(struct wiphy *wiphy, 1099 int (*set_txq_params)(struct wiphy *wiphy,
1080 struct ieee80211_txq_params *params); 1100 struct ieee80211_txq_params *params);
1081 1101
1082 int (*set_channel)(struct wiphy *wiphy, 1102 int (*set_channel)(struct wiphy *wiphy, struct net_device *dev,
1083 struct ieee80211_channel *chan, 1103 struct ieee80211_channel *chan,
1084 enum nl80211_channel_type channel_type); 1104 enum nl80211_channel_type channel_type);
1085 1105
@@ -1152,6 +1172,10 @@ struct cfg80211_ops {
1152 1172
1153 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1173 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1154 bool enabled, int timeout); 1174 bool enabled, int timeout);
1175
1176 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
1177 struct net_device *dev,
1178 s32 rssi_thold, u32 rssi_hyst);
1155}; 1179};
1156 1180
1157/* 1181/*
@@ -1441,6 +1465,8 @@ struct cfg80211_cached_keys;
1441 * @list: (private) Used to collect the interfaces 1465 * @list: (private) Used to collect the interfaces
1442 * @netdev: (private) Used to reference back to the netdev 1466 * @netdev: (private) Used to reference back to the netdev
1443 * @current_bss: (private) Used by the internal configuration code 1467 * @current_bss: (private) Used by the internal configuration code
1468 * @channel: (private) Used by the internal configuration code to track
1469 * user-set AP, monitor and WDS channels for wireless extensions
1444 * @bssid: (private) Used by the internal configuration code 1470 * @bssid: (private) Used by the internal configuration code
1445 * @ssid: (private) Used by the internal configuration code 1471 * @ssid: (private) Used by the internal configuration code
1446 * @ssid_len: (private) Used by the internal configuration code 1472 * @ssid_len: (private) Used by the internal configuration code
@@ -1487,6 +1513,7 @@ struct wireless_dev {
1487 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 1513 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1488 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1514 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1489 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1515 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1516 struct ieee80211_channel *channel;
1490 1517
1491 bool ps; 1518 bool ps;
1492 int ps_timeout; 1519 int ps_timeout;
@@ -1627,7 +1654,7 @@ struct ieee80211_radiotap_iterator {
1627 const struct ieee80211_radiotap_namespace *current_namespace; 1654 const struct ieee80211_radiotap_namespace *current_namespace;
1628 1655
1629 unsigned char *_arg, *_next_ns_data; 1656 unsigned char *_arg, *_next_ns_data;
1630 uint32_t *_next_bitmap; 1657 __le32 *_next_bitmap;
1631 1658
1632 unsigned char *this_arg; 1659 unsigned char *this_arg;
1633 int this_arg_index; 1660 int this_arg_index;
@@ -2337,4 +2364,18 @@ bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,
2337void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, 2364void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,
2338 const u8 *buf, size_t len, bool ack, gfp_t gfp); 2365 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2339 2366
2367
2368/**
2369 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
2370 * @dev: network device
2371 * @rssi_event: the triggered RSSI event
2372 * @gfp: context flags
2373 *
2374 * This function is called when a configured connection quality monitoring
2375 * rssi threshold reached event occurs.
2376 */
2377void cfg80211_cqm_rssi_notify(struct net_device *dev,
2378 enum nl80211_cqm_rssi_threshold_event rssi_event,
2379 gfp_t gfp);
2380
2340#endif /* __NET_CFG80211_H */ 2381#endif /* __NET_CFG80211_H */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 52da6c3dd50d..bbcde3238e58 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -50,10 +50,6 @@ struct dn_fib_info {
50 __le16 fib_prefsrc; 50 __le16 fib_prefsrc;
51 __u32 fib_priority; 51 __u32 fib_priority;
52 __u32 fib_metrics[RTAX_MAX]; 52 __u32 fib_metrics[RTAX_MAX];
53#define dn_fib_mtu fib_metrics[RTAX_MTU-1]
54#define dn_fib_window fib_metrics[RTAX_WINDOW-1]
55#define dn_fib_rtt fib_metrics[RTAX_RTT-1]
56#define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1]
57 int fib_nhs; 53 int fib_nhs;
58 int fib_power; 54 int fib_power;
59 struct dn_fib_nh fib_nh[0]; 55 struct dn_fib_nh fib_nh[0];
diff --git a/include/net/dst.h b/include/net/dst.h
index ce078cda6b74..612069beda73 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -168,6 +168,12 @@ static inline void dst_use(struct dst_entry *dst, unsigned long time)
168 dst->lastuse = time; 168 dst->lastuse = time;
169} 169}
170 170
171static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
172{
173 dst->__use++;
174 dst->lastuse = time;
175}
176
171static inline 177static inline
172struct dst_entry * dst_clone(struct dst_entry * dst) 178struct dst_entry * dst_clone(struct dst_entry * dst)
173{ 179{
@@ -177,11 +183,67 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
177} 183}
178 184
179extern void dst_release(struct dst_entry *dst); 185extern void dst_release(struct dst_entry *dst);
186
187static inline void refdst_drop(unsigned long refdst)
188{
189 if (!(refdst & SKB_DST_NOREF))
190 dst_release((struct dst_entry *)(refdst & SKB_DST_PTRMASK));
191}
192
193/**
194 * skb_dst_drop - drops skb dst
195 * @skb: buffer
196 *
197 * Drops dst reference count if a reference was taken.
198 */
180static inline void skb_dst_drop(struct sk_buff *skb) 199static inline void skb_dst_drop(struct sk_buff *skb)
181{ 200{
182 if (skb->_skb_dst) 201 if (skb->_skb_refdst) {
183 dst_release(skb_dst(skb)); 202 refdst_drop(skb->_skb_refdst);
184 skb->_skb_dst = 0UL; 203 skb->_skb_refdst = 0UL;
204 }
205}
206
207static inline void skb_dst_copy(struct sk_buff *nskb, const struct sk_buff *oskb)
208{
209 nskb->_skb_refdst = oskb->_skb_refdst;
210 if (!(nskb->_skb_refdst & SKB_DST_NOREF))
211 dst_clone(skb_dst(nskb));
212}
213
214/**
215 * skb_dst_force - makes sure skb dst is refcounted
216 * @skb: buffer
217 *
218 * If dst is not yet refcounted, let's do it
219 */
220static inline void skb_dst_force(struct sk_buff *skb)
221{
222 if (skb_dst_is_noref(skb)) {
223 WARN_ON(!rcu_read_lock_held());
224 skb->_skb_refdst &= ~SKB_DST_NOREF;
225 dst_clone(skb_dst(skb));
226 }
227}
228
229
230/**
231 * skb_tunnel_rx - prepare skb for rx reinsert
232 * @skb: buffer
233 * @dev: tunnel device
234 *
235 * After decapsulation, packet is going to re-enter (netif_rx()) our stack,
236 * so make some cleanups, and perform accounting.
237 */
238static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
239{
240 skb->dev = dev;
241 /* TODO : stats should be SMP safe */
242 dev->stats.rx_packets++;
243 dev->stats.rx_bytes += skb->len;
244 skb->rxhash = 0;
245 skb_dst_drop(skb);
246 nf_reset(skb);
185} 247}
186 248
187/* Children define the path of the packet through the 249/* Children define the path of the packet through the
@@ -225,21 +287,6 @@ static inline void dst_confirm(struct dst_entry *dst)
225 neigh_confirm(dst->neighbour); 287 neigh_confirm(dst->neighbour);
226} 288}
227 289
228static inline void dst_negative_advice(struct dst_entry **dst_p,
229 struct sock *sk)
230{
231 struct dst_entry * dst = *dst_p;
232 if (dst && dst->ops->negative_advice) {
233 *dst_p = dst->ops->negative_advice(dst);
234
235 if (dst != *dst_p) {
236 extern void sk_reset_txq(struct sock *sk);
237
238 sk_reset_txq(sk);
239 }
240 }
241}
242
243static inline void dst_link_failure(struct sk_buff *skb) 290static inline void dst_link_failure(struct sk_buff *skb)
244{ 291{
245 struct dst_entry *dst = skb_dst(skb); 292 struct dst_entry *dst = skb_dst(skb);
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c49086d2bc7d..e8923bc20f9f 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -104,7 +104,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
104 return frh->table; 104 return frh->table;
105} 105}
106 106
107extern struct fib_rules_ops *fib_rules_register(struct fib_rules_ops *, struct net *); 107extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *);
108extern void fib_rules_unregister(struct fib_rules_ops *); 108extern void fib_rules_unregister(struct fib_rules_ops *);
109extern void fib_rules_cleanup_ops(struct fib_rules_ops *); 109extern void fib_rules_cleanup_ops(struct fib_rules_ops *);
110 110
@@ -114,4 +114,5 @@ extern int fib_rules_lookup(struct fib_rules_ops *,
114extern int fib_default_rule_add(struct fib_rules_ops *, 114extern int fib_default_rule_add(struct fib_rules_ops *,
115 u32 pref, u32 table, 115 u32 pref, u32 table,
116 u32 flags); 116 u32 flags);
117extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
117#endif 118#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 809970b7dfee..bb08692a20b0 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -86,11 +86,26 @@ struct flowi {
86 86
87struct net; 87struct net;
88struct sock; 88struct sock;
89typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, 89struct flow_cache_ops;
90 u8 dir, void **objp, atomic_t **obj_refp); 90
91struct flow_cache_object {
92 const struct flow_cache_ops *ops;
93};
94
95struct flow_cache_ops {
96 struct flow_cache_object *(*get)(struct flow_cache_object *);
97 int (*check)(struct flow_cache_object *);
98 void (*delete)(struct flow_cache_object *);
99};
100
101typedef struct flow_cache_object *(*flow_resolve_t)(
102 struct net *net, struct flowi *key, u16 family,
103 u8 dir, struct flow_cache_object *oldobj, void *ctx);
104
105extern struct flow_cache_object *flow_cache_lookup(
106 struct net *net, struct flowi *key, u16 family,
107 u8 dir, flow_resolve_t resolver, void *ctx);
91 108
92extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family,
93 u8 dir, flow_resolve_t resolver);
94extern void flow_cache_flush(void); 109extern void flow_cache_flush(void);
95extern atomic_t flow_cache_genid; 110extern atomic_t flow_cache_genid;
96 111
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 15b3dfe9fce8..6e991e0d0d6f 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -48,15 +48,4 @@ extern void icmp_out_count(struct net *net, unsigned char type);
48/* Move into dst.h ? */ 48/* Move into dst.h ? */
49extern int xrlim_allow(struct dst_entry *dst, int timeout); 49extern int xrlim_allow(struct dst_entry *dst, int timeout);
50 50
51struct raw_sock {
52 /* inet_sock has to be the first member */
53 struct inet_sock inet;
54 struct icmp_filter filter;
55};
56
57static inline struct raw_sock *raw_sk(const struct sock *sk)
58{
59 return (struct raw_sock *)sk;
60}
61
62#endif /* _ICMP_H */ 51#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 545d8b059bef..f95ff8d9aa47 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -32,6 +32,13 @@
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34 34
35enum {
36 INET6_IFADDR_STATE_DAD,
37 INET6_IFADDR_STATE_POSTDAD,
38 INET6_IFADDR_STATE_UP,
39 INET6_IFADDR_STATE_DEAD,
40};
41
35struct inet6_ifaddr { 42struct inet6_ifaddr {
36 struct in6_addr addr; 43 struct in6_addr addr;
37 __u32 prefix_len; 44 __u32 prefix_len;
@@ -40,6 +47,9 @@ struct inet6_ifaddr {
40 __u32 prefered_lft; 47 __u32 prefered_lft;
41 atomic_t refcnt; 48 atomic_t refcnt;
42 spinlock_t lock; 49 spinlock_t lock;
50 spinlock_t state_lock;
51
52 int state;
43 53
44 __u8 probes; 54 __u8 probes;
45 __u8 flags; 55 __u8 flags;
@@ -54,16 +64,15 @@ struct inet6_ifaddr {
54 struct inet6_dev *idev; 64 struct inet6_dev *idev;
55 struct rt6_info *rt; 65 struct rt6_info *rt;
56 66
57 struct inet6_ifaddr *lst_next; /* next addr in addr_lst */ 67 struct hlist_node addr_lst;
58 struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ 68 struct list_head if_list;
59 69
60#ifdef CONFIG_IPV6_PRIVACY 70#ifdef CONFIG_IPV6_PRIVACY
61 struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */ 71 struct list_head tmp_list;
62 struct inet6_ifaddr *ifpub; 72 struct inet6_ifaddr *ifpub;
63 int regen_count; 73 int regen_count;
64#endif 74#endif
65 75 struct rcu_head rcu;
66 int dead;
67}; 76};
68 77
69struct ip6_sf_socklist { 78struct ip6_sf_socklist {
@@ -151,9 +160,9 @@ struct ipv6_devstat {
151}; 160};
152 161
153struct inet6_dev { 162struct inet6_dev {
154 struct net_device *dev; 163 struct net_device *dev;
155 164
156 struct inet6_ifaddr *addr_list; 165 struct list_head addr_list;
157 166
158 struct ifmcaddr6 *mc_list; 167 struct ifmcaddr6 *mc_list;
159 struct ifmcaddr6 *mc_tomb; 168 struct ifmcaddr6 *mc_tomb;
@@ -175,7 +184,7 @@ struct inet6_dev {
175#ifdef CONFIG_IPV6_PRIVACY 184#ifdef CONFIG_IPV6_PRIVACY
176 u8 rndid[8]; 185 u8 rndid[8];
177 struct timer_list regen_timer; 186 struct timer_list regen_timer;
178 struct inet6_ifaddr *tempaddr_list; 187 struct list_head tempaddr_list;
179#endif 188#endif
180 189
181 struct neigh_parms *nd_parms; 190 struct neigh_parms *nd_parms;
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index f13ddc2543b1..aae08f686633 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 696d6e4ce68a..b6d3b55da19b 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -36,9 +36,8 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 36 * (i.e. things that depend on the address family)
37 */ 37 */
38struct inet_connection_sock_af_ops { 38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok); 39 int (*queue_xmit)(struct sk_buff *skb);
40 void (*send_check)(struct sock *sk, int len, 40 void (*send_check)(struct sock *sk, struct sk_buff *skb);
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk); 41 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb); 42 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, 43 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 83fd34437cf1..1653de515cee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/jhash.h> 23#include <linux/jhash.h>
24#include <linux/netdevice.h>
24 25
25#include <net/flow.h> 26#include <net/flow.h>
26#include <net/sock.h> 27#include <net/sock.h>
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 79f67eae8a7e..a066fdd50da6 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -224,7 +224,9 @@ static inline
224struct net *twsk_net(const struct inet_timewait_sock *twsk) 224struct net *twsk_net(const struct inet_timewait_sock *twsk)
225{ 225{
226#ifdef CONFIG_NET_NS 226#ifdef CONFIG_NET_NS
227 return rcu_dereference(twsk->tw_net); 227 return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
228 /* reference counting, */
229 /* initialization, or RCU. */
228#else 230#else
229 return &init_net; 231 return &init_net;
230#endif 232#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index 503994a38ed1..63548f0a44b1 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -101,7 +101,7 @@ extern int ip_do_nat(struct sk_buff *skb);
101extern void ip_send_check(struct iphdr *ip); 101extern void ip_send_check(struct iphdr *ip);
102extern int __ip_local_out(struct sk_buff *skb); 102extern int __ip_local_out(struct sk_buff *skb);
103extern int ip_local_out(struct sk_buff *skb); 103extern int ip_local_out(struct sk_buff *skb);
104extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 104extern int ip_queue_xmit(struct sk_buff *skb);
105extern void ip_init(void); 105extern void ip_init(void);
106extern int ip_append_data(struct sock *sk, 106extern int ip_append_data(struct sock *sk,
107 int getfrag(void *from, char *to, int offset, int len, 107 int getfrag(void *from, char *to, int offset, int len,
@@ -184,6 +184,12 @@ extern struct local_ports {
184} sysctl_local_ports; 184} sysctl_local_ports;
185extern void inet_get_local_port_range(int *low, int *high); 185extern void inet_get_local_port_range(int *low, int *high);
186 186
187extern unsigned long *sysctl_local_reserved_ports;
188static inline int inet_is_reserved_local_port(int port)
189{
190 return test_bit(port, sysctl_local_reserved_ports);
191}
192
187extern int sysctl_ip_default_ttl; 193extern int sysctl_ip_default_ttl;
188extern int sysctl_ip_nonlocal_bind; 194extern int sysctl_ip_nonlocal_bind;
189 195
@@ -393,6 +399,7 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
393 * Functions provided by ip_sockglue.c 399 * Functions provided by ip_sockglue.c
394 */ 400 */
395 401
402extern int ip_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
396extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 403extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
397extern int ip_cmsg_send(struct net *net, 404extern int ip_cmsg_send(struct net *net,
398 struct msghdr *msg, struct ipcm_cookie *ipc); 405 struct msghdr *msg, struct ipcm_cookie *ipc);
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 86f46c49e318..4b1dc1161c37 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -88,34 +88,37 @@ struct rt6_info {
88 struct dst_entry dst; 88 struct dst_entry dst;
89 } u; 89 } u;
90 90
91 struct inet6_dev *rt6i_idev;
92
93#define rt6i_dev u.dst.dev 91#define rt6i_dev u.dst.dev
94#define rt6i_nexthop u.dst.neighbour 92#define rt6i_nexthop u.dst.neighbour
95#define rt6i_expires u.dst.expires 93#define rt6i_expires u.dst.expires
96 94
95 /*
96 * Tail elements of dst_entry (__refcnt etc.)
97 * and these elements (rarely used in hot path) are in
98 * the same cache line.
99 */
100 struct fib6_table *rt6i_table;
97 struct fib6_node *rt6i_node; 101 struct fib6_node *rt6i_node;
98 102
99 struct in6_addr rt6i_gateway; 103 struct in6_addr rt6i_gateway;
100
101 u32 rt6i_flags;
102 u32 rt6i_metric;
103 atomic_t rt6i_ref;
104 104
105 /* more non-fragment space at head required */ 105 atomic_t rt6i_ref;
106 unsigned short rt6i_nfheader_len;
107
108 u8 rt6i_protocol;
109 106
110 struct fib6_table *rt6i_table; 107 /* These are in a separate cache line. */
108 struct rt6key rt6i_dst ____cacheline_aligned_in_smp;
109 u32 rt6i_flags;
110 struct rt6key rt6i_src;
111 u32 rt6i_metric;
111 112
112 struct rt6key rt6i_dst; 113 struct inet6_dev *rt6i_idev;
113 114
114#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
115 u32 rt6i_flow_cache_genid; 116 u32 rt6i_flow_cache_genid;
116#endif 117#endif
118 /* more non-fragment space at head required */
119 unsigned short rt6i_nfheader_len;
117 120
118 struct rt6key rt6i_src; 121 u8 rt6i_protocol;
119}; 122};
120 123
121static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 124static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 68f67836e146..278312c95f96 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -152,9 +152,9 @@ static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
152static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, 152static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
153 struct in6_addr *daddr, struct in6_addr *saddr) 153 struct in6_addr *daddr, struct in6_addr *saddr)
154{ 154{
155 write_lock(&sk->sk_dst_lock); 155 spin_lock(&sk->sk_dst_lock);
156 __ip6_dst_store(sk, dst, daddr, saddr); 156 __ip6_dst_store(sk, dst, daddr, saddr);
157 write_unlock(&sk->sk_dst_lock); 157 spin_unlock(&sk->sk_dst_lock);
158} 158}
159 159
160static inline int ipv6_unicast_destination(struct sk_buff *skb) 160static inline int ipv6_unicast_destination(struct sk_buff *skb)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e72fb10ce573..eba5cc00325a 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -422,7 +422,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a
422 for (i = 0; i < addrlen; i++) { 422 for (i = 0; i < addrlen; i++) {
423 __be32 xb = a1[i] ^ a2[i]; 423 __be32 xb = a1[i] ^ a2[i];
424 if (xb) 424 if (xb)
425 return i * 32 + 32 - fls(ntohl(xb)); 425 return i * 32 + 31 - __fls(ntohl(xb));
426 } 426 }
427 427
428 /* 428 /*
@@ -482,8 +482,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
482extern int ip6_xmit(struct sock *sk, 482extern int ip6_xmit(struct sock *sk,
483 struct sk_buff *skb, 483 struct sk_buff *skb,
484 struct flowi *fl, 484 struct flowi *fl,
485 struct ipv6_txoptions *opt, 485 struct ipv6_txoptions *opt);
486 int ipfragok);
487 486
488extern int ip6_nd_hdr(struct sock *sk, 487extern int ip6_nd_hdr(struct sock *sk,
489 struct sk_buff *skb, 488 struct sk_buff *skb,
@@ -504,7 +503,8 @@ extern int ip6_append_data(struct sock *sk,
504 struct ipv6_txoptions *opt, 503 struct ipv6_txoptions *opt,
505 struct flowi *fl, 504 struct flowi *fl,
506 struct rt6_info *rt, 505 struct rt6_info *rt,
507 unsigned int flags); 506 unsigned int flags,
507 int dontfrag);
508 508
509extern int ip6_push_pending_frames(struct sock *sk); 509extern int ip6_push_pending_frames(struct sock *sk);
510 510
@@ -578,9 +578,11 @@ extern int ip6_datagram_connect(struct sock *sk,
578 struct sockaddr *addr, int addr_len); 578 struct sockaddr *addr, int addr_len);
579 579
580extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 580extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
581extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
581extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 582extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
582 u32 info, u8 *payload); 583 u32 info, u8 *payload);
583extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 584extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
585extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu);
584 586
585extern int inet6_release(struct socket *sock); 587extern int inet6_release(struct socket *sock);
586extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, 588extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index b2b98f3fa265..3afdb21cc31d 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -323,7 +323,7 @@ typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info,
323struct iw_handler_def { 323struct iw_handler_def {
324 324
325 /* Array of handlers for standard ioctls 325 /* Array of handlers for standard ioctls
326 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT] 326 * We will call dev->wireless_handlers->standard[ioctl - SIOCIWFIRST]
327 */ 327 */
328 const iw_handler * standard; 328 const iw_handler * standard;
329 /* Number of handlers defined (more precisely, index of the 329 /* Number of handlers defined (more precisely, index of the
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 45d7d44d7cbe..5be900d19660 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -144,6 +144,8 @@ struct ieee80211_low_level_stats {
144 * new beacon (beaconing modes) 144 * new beacon (beaconing modes)
145 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be 145 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
146 * enabled/disabled (beaconing modes) 146 * enabled/disabled (beaconing modes)
147 * @BSS_CHANGED_CQM: Connection quality monitor config changed
148 * @BSS_CHANGED_IBSS: IBSS join status changed
147 */ 149 */
148enum ieee80211_bss_change { 150enum ieee80211_bss_change {
149 BSS_CHANGED_ASSOC = 1<<0, 151 BSS_CHANGED_ASSOC = 1<<0,
@@ -156,6 +158,10 @@ enum ieee80211_bss_change {
156 BSS_CHANGED_BSSID = 1<<7, 158 BSS_CHANGED_BSSID = 1<<7,
157 BSS_CHANGED_BEACON = 1<<8, 159 BSS_CHANGED_BEACON = 1<<8,
158 BSS_CHANGED_BEACON_ENABLED = 1<<9, 160 BSS_CHANGED_BEACON_ENABLED = 1<<9,
161 BSS_CHANGED_CQM = 1<<10,
162 BSS_CHANGED_IBSS = 1<<11,
163
164 /* when adding here, make sure to change ieee80211_reconfig */
159}; 165};
160 166
161/** 167/**
@@ -165,6 +171,8 @@ enum ieee80211_bss_change {
165 * to that BSS) that can change during the lifetime of the BSS. 171 * to that BSS) that can change during the lifetime of the BSS.
166 * 172 *
167 * @assoc: association status 173 * @assoc: association status
174 * @ibss_joined: indicates whether this station is part of an IBSS
175 * or not
168 * @aid: association ID number, valid only when @assoc is true 176 * @aid: association ID number, valid only when @assoc is true
169 * @use_cts_prot: use CTS protection 177 * @use_cts_prot: use CTS protection
170 * @use_short_preamble: use 802.11b short preamble; 178 * @use_short_preamble: use 802.11b short preamble;
@@ -183,13 +191,19 @@ enum ieee80211_bss_change {
183 * the current band. 191 * the current band.
184 * @bssid: The BSSID for this BSS 192 * @bssid: The BSSID for this BSS
185 * @enable_beacon: whether beaconing should be enabled or not 193 * @enable_beacon: whether beaconing should be enabled or not
194 * @channel_type: Channel type for this BSS -- the hardware might be
195 * configured for HT40+ while this BSS only uses no-HT, for
196 * example.
186 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 197 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
187 * This field is only valid when the channel type is one of the HT types. 198 * This field is only valid when the channel type is one of the HT types.
199 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
200 * implies disabled
201 * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
188 */ 202 */
189struct ieee80211_bss_conf { 203struct ieee80211_bss_conf {
190 const u8 *bssid; 204 const u8 *bssid;
191 /* association related data */ 205 /* association related data */
192 bool assoc; 206 bool assoc, ibss_joined;
193 u16 aid; 207 u16 aid;
194 /* erp related data */ 208 /* erp related data */
195 bool use_cts_prot; 209 bool use_cts_prot;
@@ -202,6 +216,9 @@ struct ieee80211_bss_conf {
202 u64 timestamp; 216 u64 timestamp;
203 u32 basic_rates; 217 u32 basic_rates;
204 u16 ht_operation_mode; 218 u16 ht_operation_mode;
219 s32 cqm_rssi_thold;
220 u32 cqm_rssi_hyst;
221 enum nl80211_channel_type channel_type;
205}; 222};
206 223
207/** 224/**
@@ -267,6 +284,9 @@ struct ieee80211_bss_conf {
267 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 284 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
268 * MLME command (internal to mac80211 to figure out whether to send TX 285 * MLME command (internal to mac80211 to figure out whether to send TX
269 * status to user space) 286 * status to user space)
287 * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
288 * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
289 * frame and selects the maximum number of streams that it can use.
270 */ 290 */
271enum mac80211_tx_control_flags { 291enum mac80211_tx_control_flags {
272 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 292 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -290,6 +310,9 @@ enum mac80211_tx_control_flags {
290 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 310 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
291 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20), 311 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20),
292 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), 312 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
313 IEEE80211_TX_CTL_LDPC = BIT(22),
314 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
315#define IEEE80211_TX_CTL_STBC_SHIFT 23
293}; 316};
294 317
295/** 318/**
@@ -388,11 +411,11 @@ struct ieee80211_tx_rate {
388 * @status: union for status data 411 * @status: union for status data
389 * @driver_data: array of driver_data pointers 412 * @driver_data: array of driver_data pointers
390 * @ampdu_ack_len: number of acked aggregated frames. 413 * @ampdu_ack_len: number of acked aggregated frames.
391 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 414 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
392 * @ampdu_ack_map: block ack bit map for the aggregation. 415 * @ampdu_ack_map: block ack bit map for the aggregation.
393 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 416 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
394 * @ampdu_len: number of aggregated frames. 417 * @ampdu_len: number of aggregated frames.
395 * relevant only if IEEE80211_TX_STATUS_AMPDU was set. 418 * relevant only if IEEE80211_TX_STAT_AMPDU was set.
396 * @ack_signal: signal strength of the ACK frame 419 * @ack_signal: signal strength of the ACK frame
397 */ 420 */
398struct ieee80211_tx_info { 421struct ieee80211_tx_info {
@@ -543,7 +566,6 @@ enum mac80211_rx_flags {
543 * @signal: signal strength when receiving this frame, either in dBm, in dB or 566 * @signal: signal strength when receiving this frame, either in dBm, in dB or
544 * unspecified depending on the hardware capabilities flags 567 * unspecified depending on the hardware capabilities flags
545 * @IEEE80211_HW_SIGNAL_* 568 * @IEEE80211_HW_SIGNAL_*
546 * @noise: noise when receiving this frame, in dBm.
547 * @antenna: antenna used 569 * @antenna: antenna used
548 * @rate_idx: index of data rate into band's supported rates or MCS index if 570 * @rate_idx: index of data rate into band's supported rates or MCS index if
549 * HT rates are use (RX_FLAG_HT) 571 * HT rates are use (RX_FLAG_HT)
@@ -554,7 +576,6 @@ struct ieee80211_rx_status {
554 enum ieee80211_band band; 576 enum ieee80211_band band;
555 int freq; 577 int freq;
556 int signal; 578 int signal;
557 int noise;
558 int antenna; 579 int antenna;
559 int rate_idx; 580 int rate_idx;
560 int flag; 581 int flag;
@@ -580,11 +601,15 @@ struct ieee80211_rx_status {
580 * may turn the device off as much as possible. Typically, this flag will 601 * may turn the device off as much as possible. Typically, this flag will
581 * be set when an interface is set UP but not associated or scanning, but 602 * be set when an interface is set UP but not associated or scanning, but
582 * it can also be unset in that case when monitor interfaces are active. 603 * it can also be unset in that case when monitor interfaces are active.
604 * @IEEE80211_CONF_QOS: Enable 802.11e QoS also know as WMM (Wireless
605 * Multimedia). On some drivers (iwlwifi is one of know) we have
606 * to enable/disable QoS explicitly.
583 */ 607 */
584enum ieee80211_conf_flags { 608enum ieee80211_conf_flags {
585 IEEE80211_CONF_MONITOR = (1<<0), 609 IEEE80211_CONF_MONITOR = (1<<0),
586 IEEE80211_CONF_PS = (1<<1), 610 IEEE80211_CONF_PS = (1<<1),
587 IEEE80211_CONF_IDLE = (1<<2), 611 IEEE80211_CONF_IDLE = (1<<2),
612 IEEE80211_CONF_QOS = (1<<3),
588}; 613};
589 614
590 615
@@ -599,6 +624,7 @@ enum ieee80211_conf_flags {
599 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 624 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
600 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 625 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
601 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed 626 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
627 * @IEEE80211_CONF_CHANGE_QOS: Quality of service was enabled or disabled
602 */ 628 */
603enum ieee80211_conf_changed { 629enum ieee80211_conf_changed {
604 IEEE80211_CONF_CHANGE_SMPS = BIT(1), 630 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
@@ -609,6 +635,7 @@ enum ieee80211_conf_changed {
609 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 635 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
610 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 636 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
611 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 637 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
638 IEEE80211_CONF_CHANGE_QOS = BIT(9),
612}; 639};
613 640
614/** 641/**
@@ -649,6 +676,9 @@ enum ieee80211_smps_mode {
649 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 676 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
650 * powersave documentation below. This variable is valid only when 677 * powersave documentation below. This variable is valid only when
651 * the CONF_PS flag is set. 678 * the CONF_PS flag is set.
679 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
680 * by cfg80211 (essentially, wext) If set, this value overrules the value
681 * chosen by mac80211 based on ps qos network latency.
652 * 682 *
653 * @power_level: requested transmit power (in dBm) 683 * @power_level: requested transmit power (in dBm)
654 * 684 *
@@ -668,7 +698,7 @@ enum ieee80211_smps_mode {
668 */ 698 */
669struct ieee80211_conf { 699struct ieee80211_conf {
670 u32 flags; 700 u32 flags;
671 int power_level, dynamic_ps_timeout; 701 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
672 int max_sleep_period; 702 int max_sleep_period;
673 703
674 u16 listen_interval; 704 u16 listen_interval;
@@ -682,6 +712,28 @@ struct ieee80211_conf {
682}; 712};
683 713
684/** 714/**
715 * struct ieee80211_channel_switch - holds the channel switch data
716 *
717 * The information provided in this structure is required for channel switch
718 * operation.
719 *
720 * @timestamp: value in microseconds of the 64-bit Time Synchronization
721 * Function (TSF) timer when the frame containing the channel switch
722 * announcement was received. This is simply the rx.mactime parameter
723 * the driver passed into mac80211.
724 * @block_tx: Indicates whether transmission must be blocked before the
725 * scheduled channel switch, as indicated by the AP.
726 * @channel: the new channel to switch to
727 * @count: the number of TBTT's until the channel switch event
728 */
729struct ieee80211_channel_switch {
730 u64 timestamp;
731 bool block_tx;
732 struct ieee80211_channel *channel;
733 u8 count;
734};
735
736/**
685 * struct ieee80211_vif - per-interface data 737 * struct ieee80211_vif - per-interface data
686 * 738 *
687 * Data in this structure is continually present for driver 739 * Data in this structure is continually present for driver
@@ -779,6 +831,7 @@ struct ieee80211_key_conf {
779 u8 iv_len; 831 u8 iv_len;
780 u8 hw_key_idx; 832 u8 hw_key_idx;
781 u8 flags; 833 u8 flags;
834 u8 *ap_addr;
782 s8 keyidx; 835 s8 keyidx;
783 u8 keylen; 836 u8 keylen;
784 u8 key[0]; 837 u8 key[0];
@@ -907,10 +960,6 @@ enum ieee80211_tkip_key_type {
907 * one milliwatt. This is the preferred method since it is standardized 960 * one milliwatt. This is the preferred method since it is standardized
908 * between different devices. @max_signal does not need to be set. 961 * between different devices. @max_signal does not need to be set.
909 * 962 *
910 * @IEEE80211_HW_NOISE_DBM:
911 * Hardware can provide noise (radio interference) values in units dBm,
912 * decibel difference from one milliwatt.
913 *
914 * @IEEE80211_HW_SPECTRUM_MGMT: 963 * @IEEE80211_HW_SPECTRUM_MGMT:
915 * Hardware supports spectrum management defined in 802.11h 964 * Hardware supports spectrum management defined in 802.11h
916 * Measurement, Channel Switch, Quieting, TPC 965 * Measurement, Channel Switch, Quieting, TPC
@@ -954,6 +1003,17 @@ enum ieee80211_tkip_key_type {
954 * Hardware can provide ack status reports of Tx frames to 1003 * Hardware can provide ack status reports of Tx frames to
955 * the stack. 1004 * the stack.
956 * 1005 *
1006 * @IEEE80211_HW_CONNECTION_MONITOR:
1007 * The hardware performs its own connection monitoring, including
1008 * periodic keep-alives to the AP and probing the AP on beacon loss.
1009 * When this flag is set, signaling beacon-loss will cause an immediate
1010 * change to disassociated state.
1011 *
1012 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1013 * Hardware can do connection quality monitoring - i.e. it can monitor
1014 * connection quality related parameters, such as the RSSI level and
1015 * provide notifications if configured trigger levels are reached.
1016 *
957 */ 1017 */
958enum ieee80211_hw_flags { 1018enum ieee80211_hw_flags {
959 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1019 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -963,7 +1023,7 @@ enum ieee80211_hw_flags {
963 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 1023 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
964 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 1024 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
965 IEEE80211_HW_SIGNAL_DBM = 1<<6, 1025 IEEE80211_HW_SIGNAL_DBM = 1<<6,
966 IEEE80211_HW_NOISE_DBM = 1<<7, 1026 /* use this hole */
967 IEEE80211_HW_SPECTRUM_MGMT = 1<<8, 1027 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
968 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, 1028 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
969 IEEE80211_HW_SUPPORTS_PS = 1<<10, 1029 IEEE80211_HW_SUPPORTS_PS = 1<<10,
@@ -975,6 +1035,8 @@ enum ieee80211_hw_flags {
975 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1035 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
976 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1036 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
977 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1037 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1038 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1039 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20,
978}; 1040};
979 1041
980/** 1042/**
@@ -1591,6 +1653,11 @@ enum ieee80211_ampdu_mlme_action {
1591 * @flush: Flush all pending frames from the hardware queue, making sure 1653 * @flush: Flush all pending frames from the hardware queue, making sure
1592 * that the hardware queues are empty. If the parameter @drop is set 1654 * that the hardware queues are empty. If the parameter @drop is set
1593 * to %true, pending frames may be dropped. The callback can sleep. 1655 * to %true, pending frames may be dropped. The callback can sleep.
1656 *
1657 * @channel_switch: Drivers that need (or want) to offload the channel
1658 * switch operation for CSAs received from the AP may implement this
1659 * callback. They must then call ieee80211_chswitch_done() to indicate
1660 * completion of the channel switch.
1594 */ 1661 */
1595struct ieee80211_ops { 1662struct ieee80211_ops {
1596 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1663 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1606,7 +1673,7 @@ struct ieee80211_ops {
1606 struct ieee80211_bss_conf *info, 1673 struct ieee80211_bss_conf *info,
1607 u32 changed); 1674 u32 changed);
1608 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 1675 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1609 int mc_count, struct dev_addr_list *mc_list); 1676 struct netdev_hw_addr_list *mc_list);
1610 void (*configure_filter)(struct ieee80211_hw *hw, 1677 void (*configure_filter)(struct ieee80211_hw *hw,
1611 unsigned int changed_flags, 1678 unsigned int changed_flags,
1612 unsigned int *total_flags, 1679 unsigned int *total_flags,
@@ -1621,7 +1688,7 @@ struct ieee80211_ops {
1621 struct ieee80211_key_conf *conf, 1688 struct ieee80211_key_conf *conf,
1622 struct ieee80211_sta *sta, 1689 struct ieee80211_sta *sta,
1623 u32 iv32, u16 *phase1key); 1690 u32 iv32, u16 *phase1key);
1624 int (*hw_scan)(struct ieee80211_hw *hw, 1691 int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1625 struct cfg80211_scan_request *req); 1692 struct cfg80211_scan_request *req);
1626 void (*sw_scan_start)(struct ieee80211_hw *hw); 1693 void (*sw_scan_start)(struct ieee80211_hw *hw);
1627 void (*sw_scan_complete)(struct ieee80211_hw *hw); 1694 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -1646,13 +1713,16 @@ struct ieee80211_ops {
1646 struct ieee80211_vif *vif, 1713 struct ieee80211_vif *vif,
1647 enum ieee80211_ampdu_mlme_action action, 1714 enum ieee80211_ampdu_mlme_action action,
1648 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1715 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1649 1716 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1717 struct survey_info *survey);
1650 void (*rfkill_poll)(struct ieee80211_hw *hw); 1718 void (*rfkill_poll)(struct ieee80211_hw *hw);
1651 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); 1719 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1652#ifdef CONFIG_NL80211_TESTMODE 1720#ifdef CONFIG_NL80211_TESTMODE
1653 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); 1721 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1654#endif 1722#endif
1655 void (*flush)(struct ieee80211_hw *hw, bool drop); 1723 void (*flush)(struct ieee80211_hw *hw, bool drop);
1724 void (*channel_switch)(struct ieee80211_hw *hw,
1725 struct ieee80211_channel_switch *ch_switch);
1656}; 1726};
1657 1727
1658/** 1728/**
@@ -1802,7 +1872,10 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1802 * ieee80211_rx - receive frame 1872 * ieee80211_rx - receive frame
1803 * 1873 *
1804 * Use this function to hand received frames to mac80211. The receive 1874 * Use this function to hand received frames to mac80211. The receive
1805 * buffer in @skb must start with an IEEE 802.11 header. 1875 * buffer in @skb must start with an IEEE 802.11 header. In case of a
1876 * paged @skb is used, the driver is recommended to put the ieee80211
1877 * header of the frame on the linear part of the @skb to avoid memory
1878 * allocation and/or memcpy by the stack.
1806 * 1879 *
1807 * This function may not be called in IRQ context. Calls to this function 1880 * This function may not be called in IRQ context. Calls to this function
1808 * for a single hardware must be synchronized against each other. Calls to 1881 * for a single hardware must be synchronized against each other. Calls to
@@ -2364,12 +2437,52 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2364 * 2437 *
2365 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 2438 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2366 * 2439 *
2367 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and 2440 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and
2368 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2441 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2369 * hardware is not receiving beacons with this function. 2442 * hardware is not receiving beacons with this function.
2370 */ 2443 */
2371void ieee80211_beacon_loss(struct ieee80211_vif *vif); 2444void ieee80211_beacon_loss(struct ieee80211_vif *vif);
2372 2445
2446/**
2447 * ieee80211_connection_loss - inform hardware has lost connection to the AP
2448 *
2449 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2450 *
2451 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and
2452 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
2453 * needs to inform if the connection to the AP has been lost.
2454 *
2455 * This function will cause immediate change to disassociated state,
2456 * without connection recovery attempts.
2457 */
2458void ieee80211_connection_loss(struct ieee80211_vif *vif);
2459
2460/**
2461 * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
2462 * rssi threshold triggered
2463 *
2464 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2465 * @rssi_event: the RSSI trigger event type
2466 * @gfp: context flags
2467 *
2468 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality
2469 * monitoring is configured with an rssi threshold, the driver will inform
2470 * whenever the rssi level reaches the threshold.
2471 */
2472void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2473 enum nl80211_cqm_rssi_threshold_event rssi_event,
2474 gfp_t gfp);
2475
2476/**
2477 * ieee80211_chswitch_done - Complete channel switch process
2478 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2479 * @success: make the channel switch successful or not
2480 *
2481 * Complete the channel switch post-process: set the new operational channel
2482 * and wake up the suspended queues.
2483 */
2484void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
2485
2373/* Rate control API */ 2486/* Rate control API */
2374 2487
2375/** 2488/**
diff --git a/include/net/mld.h b/include/net/mld.h
new file mode 100644
index 000000000000..467143cd4e2f
--- /dev/null
+++ b/include/net/mld.h
@@ -0,0 +1,75 @@
1#ifndef LINUX_MLD_H
2#define LINUX_MLD_H
3
4#include <linux/in6.h>
5#include <linux/icmpv6.h>
6
7/* MLDv1 Query/Report/Done */
8struct mld_msg {
9 struct icmp6hdr mld_hdr;
10 struct in6_addr mld_mca;
11};
12
13#define mld_type mld_hdr.icmp6_type
14#define mld_code mld_hdr.icmp6_code
15#define mld_cksum mld_hdr.icmp6_cksum
16#define mld_maxdelay mld_hdr.icmp6_maxdelay
17#define mld_reserved mld_hdr.icmp6_dataun.un_data16[1]
18
19/* Multicast Listener Discovery version 2 headers */
20/* MLDv2 Report */
21struct mld2_grec {
22 __u8 grec_type;
23 __u8 grec_auxwords;
24 __be16 grec_nsrcs;
25 struct in6_addr grec_mca;
26 struct in6_addr grec_src[0];
27};
28
29struct mld2_report {
30 struct icmp6hdr mld2r_hdr;
31 struct mld2_grec mld2r_grec[0];
32};
33
34#define mld2r_type mld2r_hdr.icmp6_type
35#define mld2r_resv1 mld2r_hdr.icmp6_code
36#define mld2r_cksum mld2r_hdr.icmp6_cksum
37#define mld2r_resv2 mld2r_hdr.icmp6_dataun.un_data16[0]
38#define mld2r_ngrec mld2r_hdr.icmp6_dataun.un_data16[1]
39
40/* MLDv2 Query */
41struct mld2_query {
42 struct icmp6hdr mld2q_hdr;
43 struct in6_addr mld2q_mca;
44#if defined(__LITTLE_ENDIAN_BITFIELD)
45 __u8 mld2q_qrv:3,
46 mld2q_suppress:1,
47 mld2q_resv2:4;
48#elif defined(__BIG_ENDIAN_BITFIELD)
49 __u8 mld2q_resv2:4,
50 mld2q_suppress:1,
51 mld2q_qrv:3;
52#else
53#error "Please fix <asm/byteorder.h>"
54#endif
55 __u8 mld2q_qqic;
56 __be16 mld2q_nsrcs;
57 struct in6_addr mld2q_srcs[0];
58};
59
60#define mld2q_type mld2q_hdr.icmp6_type
61#define mld2q_code mld2q_hdr.icmp6_code
62#define mld2q_cksum mld2q_hdr.icmp6_cksum
63#define mld2q_mrc mld2q_hdr.icmp6_maxdelay
64#define mld2q_resv1 mld2q_hdr.icmp6_dataun.un_data16[1]
65
66/* Max Response Code */
67#define MLDV2_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
68#define MLDV2_EXP(thresh, nbmant, nbexp, value) \
69 ((value) < (thresh) ? (value) : \
70 ((MLDV2_MASK(value, nbmant) | (1<<(nbmant))) << \
71 (MLDV2_MASK((value) >> (nbmant), nbexp) + (nbexp))))
72
73#define MLDV2_MRC(value) MLDV2_EXP(0x8000, 12, 3, value)
74
75#endif
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index da1d58be31b7..eb21340a573b 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -299,6 +299,20 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
299 return 0; 299 return 0;
300} 300}
301 301
302#ifdef CONFIG_BRIDGE_NETFILTER
303static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
304{
305 unsigned seq, hh_alen;
306
307 do {
308 seq = read_seqbegin(&hh->hh_lock);
309 hh_alen = HH_DATA_ALIGN(ETH_HLEN);
310 memcpy(skb->data - hh_alen, hh->hh_data, ETH_ALEN + hh_alen - ETH_HLEN);
311 } while (read_seqretry(&hh->hh_lock, seq));
312 return 0;
313}
314#endif
315
302static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 316static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
303{ 317{
304 unsigned seq; 318 unsigned seq;
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index ff4982ab84b6..81a31c0db3e7 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -14,11 +14,8 @@
14 * The rules are simple: 14 * The rules are simple:
15 * 1. set pernet_operations->id. After register_pernet_device you 15 * 1. set pernet_operations->id. After register_pernet_device you
16 * will have the id of your private pointer. 16 * will have the id of your private pointer.
17 * 2. Either set pernet_operations->size (to have the code allocate and 17 * 2. set pernet_operations->size to have the code allocate and free
18 * free a private structure pointed to from struct net ) or 18 * a private structure pointed to from struct net.
19 * call net_assign_generic() to put the private data on the struct
20 * net (most preferably this should be done in the ->init callback
21 * of the ops registered);
22 * 3. do not change this pointer while the net is alive; 19 * 3. do not change this pointer while the net is alive;
23 * 4. do not try to have any private reference on the net_generic object. 20 * 4. do not try to have any private reference on the net_generic object.
24 * 21 *
@@ -46,6 +43,4 @@ static inline void *net_generic(struct net *net, int id)
46 43
47 return ptr; 44 return ptr;
48} 45}
49
50extern int net_assign_generic(struct net *net, int id, void *data);
51#endif 46#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2764994c9136..d68c3f121774 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -55,19 +55,14 @@ struct netns_ipv4 {
55 int sysctl_rt_cache_rebuild_count; 55 int sysctl_rt_cache_rebuild_count;
56 int current_rt_cache_rebuild_count; 56 int current_rt_cache_rebuild_count;
57 57
58 struct timer_list rt_secret_timer;
59 atomic_t rt_genid; 58 atomic_t rt_genid;
60 59
61#ifdef CONFIG_IP_MROUTE 60#ifdef CONFIG_IP_MROUTE
62 struct sock *mroute_sk; 61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
63 struct mfc_cache **mfc_cache_array; 62 struct mr_table *mrt;
64 struct vif_device *vif_table; 63#else
65 int maxvif; 64 struct list_head mr_tables;
66 atomic_t cache_resolve_queue_len; 65 struct fib_rules_ops *mr_rules_ops;
67 int mroute_do_assert;
68 int mroute_do_pim;
69#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
70 int mroute_reg_vif_num;
71#endif 66#endif
72#endif 67#endif
73}; 68};
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1f11ebc22151..81abfcb2eb4e 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -59,15 +59,11 @@ struct netns_ipv6 {
59 struct sock *tcp_sk; 59 struct sock *tcp_sk;
60 struct sock *igmp_sk; 60 struct sock *igmp_sk;
61#ifdef CONFIG_IPV6_MROUTE 61#ifdef CONFIG_IPV6_MROUTE
62 struct sock *mroute6_sk; 62#ifndef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
63 struct mfc6_cache **mfc6_cache_array; 63 struct mr6_table *mrt6;
64 struct mif_device *vif6_table; 64#else
65 int maxvif; 65 struct list_head mr6_tables;
66 atomic_t cache_resolve_queue_len; 66 struct fib_rules_ops *mr6_rules_ops;
67 int mroute_do_assert;
68 int mroute_do_pim;
69#ifdef CONFIG_IPV6_PIMSM_V2
70 int mroute_reg_vif_num;
71#endif 67#endif
72#endif 68#endif
73}; 69};
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b6cdc33b39c1..9d4d87cc970e 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -12,7 +12,7 @@ struct qdisc_walker {
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 13};
14 14
15#define QDISC_ALIGNTO 32 15#define QDISC_ALIGNTO 64
16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 16#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
17 17
18static inline void *qdisc_priv(struct Qdisc *q) 18static inline void *qdisc_priv(struct Qdisc *q)
diff --git a/include/net/raw.h b/include/net/raw.h
index 6c14a656357a..43c57502659b 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,7 @@
19 19
20 20
21#include <net/protocol.h> 21#include <net/protocol.h>
22#include <linux/icmp.h>
22 23
23extern struct proto raw_prot; 24extern struct proto raw_prot;
24 25
@@ -56,4 +57,16 @@ int raw_seq_open(struct inode *ino, struct file *file,
56void raw_hash_sk(struct sock *sk); 57void raw_hash_sk(struct sock *sk);
57void raw_unhash_sk(struct sock *sk); 58void raw_unhash_sk(struct sock *sk);
58 59
60struct raw_sock {
61 /* inet_sock has to be the first member */
62 struct inet_sock inet;
63 struct icmp_filter filter;
64 u32 ipmr_table;
65};
66
67static inline struct raw_sock *raw_sk(const struct sock *sk)
68{
69 return (struct raw_sock *)sk;
70}
71
59#endif /* _RAW_H */ 72#endif /* _RAW_H */
diff --git a/include/net/route.h b/include/net/route.h
index 2c9fba7f7731..af6cf4b4c9dc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -112,7 +112,22 @@ extern void rt_cache_flush_batch(void);
112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 112extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 113extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 114extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
115extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); 115
116extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
117 u8 tos, struct net_device *devin, bool noref);
118
119static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
120 u8 tos, struct net_device *devin)
121{
122 return ip_route_input_common(skb, dst, src, tos, devin, false);
123}
124
125static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
126 u8 tos, struct net_device *devin)
127{
128 return ip_route_input_common(skb, dst, src, tos, devin, true);
129}
130
116extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); 131extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev);
117extern void ip_rt_send_redirect(struct sk_buff *skb); 132extern void ip_rt_send_redirect(struct sk_buff *skb);
118 133
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 67dc08eaaa45..03ca5d826757 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -73,6 +73,7 @@ struct Qdisc {
73 struct sk_buff_head q; 73 struct sk_buff_head q;
74 struct gnet_stats_basic_packed bstats; 74 struct gnet_stats_basic_packed bstats;
75 struct gnet_stats_queue qstats; 75 struct gnet_stats_queue qstats;
76 struct rcu_head rcu_head;
76}; 77};
77 78
78struct Qdisc_class_ops { 79struct Qdisc_class_ops {
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 8be5135ff7aa..2c55a7ea20af 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -107,6 +107,7 @@ typedef enum {
107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 107 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ 108 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
109 SCTP_CMD_SEND_MSG, /* Send the whole use message */ 109 SCTP_CMD_SEND_MSG, /* Send the whole use message */
110 SCTP_CMD_SEND_NEXT_ASCONF, /* Send the next ASCONF after ACK */
110 SCTP_CMD_LAST 111 SCTP_CMD_LAST
111} sctp_verb_t; 112} sctp_verb_t;
112 113
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 78740ec57d5d..65946bc43d00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -128,6 +128,7 @@ extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 128int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
129int sctp_inet_listen(struct socket *sock, int backlog); 129int sctp_inet_listen(struct socket *sock, int backlog);
130void sctp_write_space(struct sock *sk); 130void sctp_write_space(struct sock *sk);
131void sctp_data_ready(struct sock *sk, int len);
131unsigned int sctp_poll(struct file *file, struct socket *sock, 132unsigned int sctp_poll(struct file *file, struct socket *sock,
132 poll_table *wait); 133 poll_table *wait);
133void sctp_sock_rfree(struct sk_buff *skb); 134void sctp_sock_rfree(struct sk_buff *skb);
@@ -268,7 +269,7 @@ enum {
268#define SCTP_MIB_MAX __SCTP_MIB_MAX 269#define SCTP_MIB_MAX __SCTP_MIB_MAX
269struct sctp_mib { 270struct sctp_mib {
270 unsigned long mibs[SCTP_MIB_MAX]; 271 unsigned long mibs[SCTP_MIB_MAX];
271} __SNMP_MIB_ALIGN__; 272};
272 273
273 274
274/* Print debugging messages. */ 275/* Print debugging messages. */
@@ -546,7 +547,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
546#define WORD_ROUND(s) (((s)+3)&~3) 547#define WORD_ROUND(s) (((s)+3)&~3)
547 548
548/* Make a new instance of type. */ 549/* Make a new instance of type. */
549#define t_new(type, flags) (type *)kmalloc(sizeof(type), flags) 550#define t_new(type, flags) (type *)kzalloc(sizeof(type), flags)
550 551
551/* Compare two timevals. */ 552/* Compare two timevals. */
552#define tv_lt(s, t) \ 553#define tv_lt(s, t) \
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 851c813adb3a..4088c89a9055 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -279,6 +279,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
279/* 2nd level prototypes */ 279/* 2nd level prototypes */
280void sctp_generate_t3_rtx_event(unsigned long peer); 280void sctp_generate_t3_rtx_event(unsigned long peer);
281void sctp_generate_heartbeat_event(unsigned long peer); 281void sctp_generate_heartbeat_event(unsigned long peer);
282void sctp_generate_proto_unreach_event(unsigned long peer);
282 283
283void sctp_ootb_pkt_free(struct sctp_packet *); 284void sctp_ootb_pkt_free(struct sctp_packet *);
284 285
@@ -437,7 +438,7 @@ sctp_vtag_verify_either(const struct sctp_chunk *chunk,
437 */ 438 */
438 if ((!sctp_test_T_bit(chunk) && 439 if ((!sctp_test_T_bit(chunk) &&
439 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || 440 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) ||
440 (sctp_test_T_bit(chunk) && 441 (sctp_test_T_bit(chunk) && asoc->c.peer_vtag &&
441 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { 442 (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) {
442 return 1; 443 return 1;
443 } 444 }
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ff3017744711..6173c619913a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -643,17 +643,15 @@ struct sctp_pf {
643struct sctp_datamsg { 643struct sctp_datamsg {
644 /* Chunks waiting to be submitted to lower layer. */ 644 /* Chunks waiting to be submitted to lower layer. */
645 struct list_head chunks; 645 struct list_head chunks;
646 /* Chunks that have been transmitted. */
647 size_t msg_size;
648 /* Reference counting. */ 646 /* Reference counting. */
649 atomic_t refcnt; 647 atomic_t refcnt;
650 /* When is this message no longer interesting to the peer? */ 648 /* When is this message no longer interesting to the peer? */
651 unsigned long expires_at; 649 unsigned long expires_at;
652 /* Did the messenge fail to send? */ 650 /* Did the messenge fail to send? */
653 int send_error; 651 int send_error;
654 char send_failed; 652 u8 send_failed:1,
655 /* Control whether chunks from this message can be abandoned. */ 653 can_abandon:1, /* can chunks from this message can be abandoned. */
656 char can_abandon; 654 can_delay; /* should this message be Nagle delayed */
657}; 655};
658 656
659struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 657struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
@@ -757,7 +755,6 @@ struct sctp_chunk {
757#define SCTP_NEED_FRTX 0x1 755#define SCTP_NEED_FRTX 0x1
758#define SCTP_DONT_FRTX 0x2 756#define SCTP_DONT_FRTX 0x2
759 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ 757 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
760 resent:1, /* Has this chunk ever been resent. */
761 has_tsn:1, /* Does this chunk have a TSN yet? */ 758 has_tsn:1, /* Does this chunk have a TSN yet? */
762 has_ssn:1, /* Does this chunk have a SSN yet? */ 759 has_ssn:1, /* Does this chunk have a SSN yet? */
763 singleton:1, /* Only chunk in the packet? */ 760 singleton:1, /* Only chunk in the packet? */
@@ -778,6 +775,7 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,
778 struct iovec *data); 775 struct iovec *data);
779void sctp_chunk_free(struct sctp_chunk *); 776void sctp_chunk_free(struct sctp_chunk *);
780void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 777void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
778void *sctp_addto_chunk_fixed(struct sctp_chunk *, int len, const void *data);
781struct sctp_chunk *sctp_chunkify(struct sk_buff *, 779struct sctp_chunk *sctp_chunkify(struct sk_buff *,
782 const struct sctp_association *, 780 const struct sctp_association *,
783 struct sock *); 781 struct sock *);
@@ -878,7 +876,30 @@ struct sctp_transport {
878 876
879 /* Reference counting. */ 877 /* Reference counting. */
880 atomic_t refcnt; 878 atomic_t refcnt;
881 int dead; 879 int dead:1,
880 /* RTO-Pending : A flag used to track if one of the DATA
881 * chunks sent to this address is currently being
882 * used to compute a RTT. If this flag is 0,
883 * the next DATA chunk sent to this destination
884 * should be used to compute a RTT and this flag
885 * should be set. Every time the RTT
886 * calculation completes (i.e. the DATA chunk
887 * is SACK'd) clear this flag.
888 */
889 rto_pending:1,
890
891 /*
892 * hb_sent : a flag that signals that we have a pending
893 * heartbeat.
894 */
895 hb_sent:1,
896
897 /* Is the Path MTU update pending on this tranport */
898 pmtu_pending:1,
899
900 /* Is this structure kfree()able? */
901 malloced:1;
902
882 903
883 /* This is the peer's IP address and port. */ 904 /* This is the peer's IP address and port. */
884 union sctp_addr ipaddr; 905 union sctp_addr ipaddr;
@@ -908,22 +929,6 @@ struct sctp_transport {
908 /* SRTT : The current smoothed round trip time. */ 929 /* SRTT : The current smoothed round trip time. */
909 __u32 srtt; 930 __u32 srtt;
910 931
911 /* RTO-Pending : A flag used to track if one of the DATA
912 * chunks sent to this address is currently being
913 * used to compute a RTT. If this flag is 0,
914 * the next DATA chunk sent to this destination
915 * should be used to compute a RTT and this flag
916 * should be set. Every time the RTT
917 * calculation completes (i.e. the DATA chunk
918 * is SACK'd) clear this flag.
919 * hb_sent : a flag that signals that we have a pending heartbeat.
920 */
921 __u8 rto_pending;
922 __u8 hb_sent;
923
924 /* Flag to track the current fast recovery state */
925 __u8 fast_recovery;
926
927 /* 932 /*
928 * These are the congestion stats. 933 * These are the congestion stats.
929 */ 934 */
@@ -943,9 +948,6 @@ struct sctp_transport {
943 948
944 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ 949 __u32 burst_limited; /* Holds old cwnd when max.burst is applied */
945 950
946 /* TSN marking the fast recovery exit point */
947 __u32 fast_recovery_exit;
948
949 /* Destination */ 951 /* Destination */
950 struct dst_entry *dst; 952 struct dst_entry *dst;
951 /* Source address. */ 953 /* Source address. */
@@ -976,9 +978,6 @@ struct sctp_transport {
976 */ 978 */
977 __u16 pathmaxrxt; 979 __u16 pathmaxrxt;
978 980
979 /* is the Path MTU update pending on this tranport */
980 __u8 pmtu_pending;
981
982 /* PMTU : The current known path MTU. */ 981 /* PMTU : The current known path MTU. */
983 __u32 pathmtu; 982 __u32 pathmtu;
984 983
@@ -1009,6 +1008,9 @@ struct sctp_transport {
1009 /* Heartbeat timer is per destination. */ 1008 /* Heartbeat timer is per destination. */
1010 struct timer_list hb_timer; 1009 struct timer_list hb_timer;
1011 1010
1011 /* Timer to handle ICMP proto unreachable envets */
1012 struct timer_list proto_unreach_timer;
1013
1012 /* Since we're using per-destination retransmission timers 1014 /* Since we're using per-destination retransmission timers
1013 * (see above), we're also using per-destination "transmitted" 1015 * (see above), we're also using per-destination "transmitted"
1014 * queues. This probably ought to be a private struct 1016 * queues. This probably ought to be a private struct
@@ -1022,8 +1024,6 @@ struct sctp_transport {
1022 /* This is the list of transports that have chunks to send. */ 1024 /* This is the list of transports that have chunks to send. */
1023 struct list_head send_ready; 1025 struct list_head send_ready;
1024 1026
1025 int malloced; /* Is this structure kfree()able? */
1026
1027 /* State information saved for SFR_CACC algorithm. The key 1027 /* State information saved for SFR_CACC algorithm. The key
1028 * idea in SFR_CACC is to maintain state at the sender on a 1028 * idea in SFR_CACC is to maintain state at the sender on a
1029 * per-destination basis when a changeover happens. 1029 * per-destination basis when a changeover happens.
@@ -1065,7 +1065,7 @@ void sctp_transport_route(struct sctp_transport *, union sctp_addr *,
1065 struct sctp_sock *); 1065 struct sctp_sock *);
1066void sctp_transport_pmtu(struct sctp_transport *); 1066void sctp_transport_pmtu(struct sctp_transport *);
1067void sctp_transport_free(struct sctp_transport *); 1067void sctp_transport_free(struct sctp_transport *);
1068void sctp_transport_reset_timers(struct sctp_transport *, int); 1068void sctp_transport_reset_timers(struct sctp_transport *);
1069void sctp_transport_hold(struct sctp_transport *); 1069void sctp_transport_hold(struct sctp_transport *);
1070void sctp_transport_put(struct sctp_transport *); 1070void sctp_transport_put(struct sctp_transport *);
1071void sctp_transport_update_rto(struct sctp_transport *, __u32); 1071void sctp_transport_update_rto(struct sctp_transport *, __u32);
@@ -1719,6 +1719,12 @@ struct sctp_association {
1719 /* Highest TSN that is acknowledged by incoming SACKs. */ 1719 /* Highest TSN that is acknowledged by incoming SACKs. */
1720 __u32 highest_sacked; 1720 __u32 highest_sacked;
1721 1721
1722 /* TSN marking the fast recovery exit point */
1723 __u32 fast_recovery_exit;
1724
1725 /* Flag to track the current fast recovery state */
1726 __u8 fast_recovery;
1727
1722 /* The number of unacknowledged data chunks. Reported through 1728 /* The number of unacknowledged data chunks. Reported through
1723 * the SCTP_STATUS sockopt. 1729 * the SCTP_STATUS sockopt.
1724 */ 1730 */
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 692ee0061dc4..92456f1035f5 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -52,26 +52,11 @@ struct snmp_mib {
52 * count on the 20Gb/s + networks people expect in a few years time! 52 * count on the 20Gb/s + networks people expect in a few years time!
53 */ 53 */
54 54
55/*
56 * The rule for padding:
57 * Best is power of two because then the right structure can be found by a
58 * simple shift. The structure should be always cache line aligned.
59 * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add
60 * instructions to emulate multiply in case it is not power-of-two.
61 * Currently n is always <=3 for all sizes so simple cache line alignment
62 * is enough.
63 *
64 * The best solution would be a global CPU local area , especially on 64
65 * and 128byte cacheline machine it makes a *lot* of sense -AK
66 */
67
68#define __SNMP_MIB_ALIGN__ ____cacheline_aligned
69
70/* IPstats */ 55/* IPstats */
71#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX 56#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
72struct ipstats_mib { 57struct ipstats_mib {
73 unsigned long mibs[IPSTATS_MIB_MAX]; 58 unsigned long mibs[IPSTATS_MIB_MAX];
74} __SNMP_MIB_ALIGN__; 59};
75 60
76/* ICMP */ 61/* ICMP */
77#define ICMP_MIB_DUMMY __ICMP_MIB_MAX 62#define ICMP_MIB_DUMMY __ICMP_MIB_MAX
@@ -79,36 +64,36 @@ struct ipstats_mib {
79 64
80struct icmp_mib { 65struct icmp_mib {
81 unsigned long mibs[ICMP_MIB_MAX]; 66 unsigned long mibs[ICMP_MIB_MAX];
82} __SNMP_MIB_ALIGN__; 67};
83 68
84#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX 69#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
85struct icmpmsg_mib { 70struct icmpmsg_mib {
86 unsigned long mibs[ICMPMSG_MIB_MAX]; 71 unsigned long mibs[ICMPMSG_MIB_MAX];
87} __SNMP_MIB_ALIGN__; 72};
88 73
89/* ICMP6 (IPv6-ICMP) */ 74/* ICMP6 (IPv6-ICMP) */
90#define ICMP6_MIB_MAX __ICMP6_MIB_MAX 75#define ICMP6_MIB_MAX __ICMP6_MIB_MAX
91struct icmpv6_mib { 76struct icmpv6_mib {
92 unsigned long mibs[ICMP6_MIB_MAX]; 77 unsigned long mibs[ICMP6_MIB_MAX];
93} __SNMP_MIB_ALIGN__; 78};
94 79
95#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX 80#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
96struct icmpv6msg_mib { 81struct icmpv6msg_mib {
97 unsigned long mibs[ICMP6MSG_MIB_MAX]; 82 unsigned long mibs[ICMP6MSG_MIB_MAX];
98} __SNMP_MIB_ALIGN__; 83};
99 84
100 85
101/* TCP */ 86/* TCP */
102#define TCP_MIB_MAX __TCP_MIB_MAX 87#define TCP_MIB_MAX __TCP_MIB_MAX
103struct tcp_mib { 88struct tcp_mib {
104 unsigned long mibs[TCP_MIB_MAX]; 89 unsigned long mibs[TCP_MIB_MAX];
105} __SNMP_MIB_ALIGN__; 90};
106 91
107/* UDP */ 92/* UDP */
108#define UDP_MIB_MAX __UDP_MIB_MAX 93#define UDP_MIB_MAX __UDP_MIB_MAX
109struct udp_mib { 94struct udp_mib {
110 unsigned long mibs[UDP_MIB_MAX]; 95 unsigned long mibs[UDP_MIB_MAX];
111} __SNMP_MIB_ALIGN__; 96};
112 97
113/* Linux */ 98/* Linux */
114#define LINUX_MIB_MAX __LINUX_MIB_MAX 99#define LINUX_MIB_MAX __LINUX_MIB_MAX
@@ -148,6 +133,8 @@ struct linux_xfrm_mib {
148 __this_cpu_add(mib[0]->mibs[field], addend) 133 __this_cpu_add(mib[0]->mibs[field], addend)
149#define SNMP_ADD_STATS_USER(mib, field, addend) \ 134#define SNMP_ADD_STATS_USER(mib, field, addend) \
150 this_cpu_add(mib[1]->mibs[field], addend) 135 this_cpu_add(mib[1]->mibs[field], addend)
136#define SNMP_ADD_STATS(mib, field, addend) \
137 this_cpu_add(mib[0]->mibs[field], addend)
151/* 138/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 * to make @ptr a non-percpu pointer. 140 * to make @ptr a non-percpu pointer.
diff --git a/include/net/sock.h b/include/net/sock.h
index b4603cd54fcd..5697caf8cc76 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -74,7 +74,7 @@
74 printk(KERN_DEBUG msg); } while (0) 74 printk(KERN_DEBUG msg); } while (0)
75#else 75#else
76/* Validate arguments and do nothing */ 76/* Validate arguments and do nothing */
77static void inline int __attribute__ ((format (printf, 2, 3))) 77static inline void __attribute__ ((format (printf, 2, 3)))
78SOCK_DEBUG(struct sock *sk, const char *msg, ...) 78SOCK_DEBUG(struct sock *sk, const char *msg, ...)
79{ 79{
80} 80}
@@ -159,7 +159,7 @@ struct sock_common {
159 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings 159 * @sk_userlocks: %SO_SNDBUF and %SO_RCVBUF settings
160 * @sk_lock: synchronizer 160 * @sk_lock: synchronizer
161 * @sk_rcvbuf: size of receive buffer in bytes 161 * @sk_rcvbuf: size of receive buffer in bytes
162 * @sk_sleep: sock wait queue 162 * @sk_wq: sock wait queue and async head
163 * @sk_dst_cache: destination cache 163 * @sk_dst_cache: destination cache
164 * @sk_dst_lock: destination cache lock 164 * @sk_dst_lock: destination cache lock
165 * @sk_policy: flow policy 165 * @sk_policy: flow policy
@@ -177,6 +177,7 @@ struct sock_common {
177 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 177 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
178 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 178 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
179 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 179 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
180 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
180 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 181 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
181 * @sk_gso_max_size: Maximum GSO segment size to build 182 * @sk_gso_max_size: Maximum GSO segment size to build
182 * @sk_lingertime: %SO_LINGER l_linger setting 183 * @sk_lingertime: %SO_LINGER l_linger setting
@@ -198,6 +199,7 @@ struct sock_common {
198 * @sk_rcvlowat: %SO_RCVLOWAT setting 199 * @sk_rcvlowat: %SO_RCVLOWAT setting
199 * @sk_rcvtimeo: %SO_RCVTIMEO setting 200 * @sk_rcvtimeo: %SO_RCVTIMEO setting
200 * @sk_sndtimeo: %SO_SNDTIMEO setting 201 * @sk_sndtimeo: %SO_SNDTIMEO setting
202 * @sk_rxhash: flow hash received from netif layer
201 * @sk_filter: socket filtering instructions 203 * @sk_filter: socket filtering instructions
202 * @sk_protinfo: private area, net family specific, when not using slab 204 * @sk_protinfo: private area, net family specific, when not using slab
203 * @sk_timer: sock cleanup timer 205 * @sk_timer: sock cleanup timer
@@ -255,14 +257,13 @@ struct sock {
255 struct sk_buff *head; 257 struct sk_buff *head;
256 struct sk_buff *tail; 258 struct sk_buff *tail;
257 int len; 259 int len;
258 int limit;
259 } sk_backlog; 260 } sk_backlog;
260 wait_queue_head_t *sk_sleep; 261 struct socket_wq *sk_wq;
261 struct dst_entry *sk_dst_cache; 262 struct dst_entry *sk_dst_cache;
262#ifdef CONFIG_XFRM 263#ifdef CONFIG_XFRM
263 struct xfrm_policy *sk_policy[2]; 264 struct xfrm_policy *sk_policy[2];
264#endif 265#endif
265 rwlock_t sk_dst_lock; 266 spinlock_t sk_dst_lock;
266 atomic_t sk_rmem_alloc; 267 atomic_t sk_rmem_alloc;
267 atomic_t sk_wmem_alloc; 268 atomic_t sk_wmem_alloc;
268 atomic_t sk_omem_alloc; 269 atomic_t sk_omem_alloc;
@@ -276,9 +277,13 @@ struct sock {
276 int sk_forward_alloc; 277 int sk_forward_alloc;
277 gfp_t sk_allocation; 278 gfp_t sk_allocation;
278 int sk_route_caps; 279 int sk_route_caps;
280 int sk_route_nocaps;
279 int sk_gso_type; 281 int sk_gso_type;
280 unsigned int sk_gso_max_size; 282 unsigned int sk_gso_max_size;
281 int sk_rcvlowat; 283 int sk_rcvlowat;
284#ifdef CONFIG_RPS
285 __u32 sk_rxhash;
286#endif
282 unsigned long sk_flags; 287 unsigned long sk_flags;
283 unsigned long sk_lingertime; 288 unsigned long sk_lingertime;
284 struct sk_buff_head sk_error_queue; 289 struct sk_buff_head sk_error_queue;
@@ -595,19 +600,32 @@ static inline int sk_stream_memory_free(struct sock *sk)
595/* OOB backlog add */ 600/* OOB backlog add */
596static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 601static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
597{ 602{
598 if (!sk->sk_backlog.tail) { 603 /* dont let skb dst not refcounted, we are going to leave rcu lock */
599 sk->sk_backlog.head = sk->sk_backlog.tail = skb; 604 skb_dst_force(skb);
600 } else { 605
606 if (!sk->sk_backlog.tail)
607 sk->sk_backlog.head = skb;
608 else
601 sk->sk_backlog.tail->next = skb; 609 sk->sk_backlog.tail->next = skb;
602 sk->sk_backlog.tail = skb; 610
603 } 611 sk->sk_backlog.tail = skb;
604 skb->next = NULL; 612 skb->next = NULL;
605} 613}
606 614
615/*
616 * Take into account size of receive queue and backlog queue
617 */
618static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb)
619{
620 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
621
622 return qsize + skb->truesize > sk->sk_rcvbuf;
623}
624
607/* The per-socket spinlock must be held here. */ 625/* The per-socket spinlock must be held here. */
608static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) 626static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb)
609{ 627{
610 if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) 628 if (sk_rcvqueues_full(sk, skb))
611 return -ENOBUFS; 629 return -ENOBUFS;
612 630
613 __sk_add_backlog(sk, skb); 631 __sk_add_backlog(sk, skb);
@@ -620,6 +638,40 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
620 return sk->sk_backlog_rcv(sk, skb); 638 return sk->sk_backlog_rcv(sk, skb);
621} 639}
622 640
641static inline void sock_rps_record_flow(const struct sock *sk)
642{
643#ifdef CONFIG_RPS
644 struct rps_sock_flow_table *sock_flow_table;
645
646 rcu_read_lock();
647 sock_flow_table = rcu_dereference(rps_sock_flow_table);
648 rps_record_sock_flow(sock_flow_table, sk->sk_rxhash);
649 rcu_read_unlock();
650#endif
651}
652
653static inline void sock_rps_reset_flow(const struct sock *sk)
654{
655#ifdef CONFIG_RPS
656 struct rps_sock_flow_table *sock_flow_table;
657
658 rcu_read_lock();
659 sock_flow_table = rcu_dereference(rps_sock_flow_table);
660 rps_reset_sock_flow(sock_flow_table, sk->sk_rxhash);
661 rcu_read_unlock();
662#endif
663}
664
665static inline void sock_rps_save_rxhash(struct sock *sk, u32 rxhash)
666{
667#ifdef CONFIG_RPS
668 if (unlikely(sk->sk_rxhash != rxhash)) {
669 sock_rps_reset_flow(sk);
670 sk->sk_rxhash = rxhash;
671 }
672#endif
673}
674
623#define sk_wait_event(__sk, __timeo, __condition) \ 675#define sk_wait_event(__sk, __timeo, __condition) \
624 ({ int __rc; \ 676 ({ int __rc; \
625 release_sock(__sk); \ 677 release_sock(__sk); \
@@ -974,6 +1026,16 @@ extern void release_sock(struct sock *sk);
974 SINGLE_DEPTH_NESTING) 1026 SINGLE_DEPTH_NESTING)
975#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1027#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
976 1028
1029static inline void lock_sock_bh(struct sock *sk)
1030{
1031 spin_lock_bh(&sk->sk_lock.slock);
1032}
1033
1034static inline void unlock_sock_bh(struct sock *sk)
1035{
1036 spin_unlock_bh(&sk->sk_lock.slock);
1037}
1038
977extern struct sock *sk_alloc(struct net *net, int family, 1039extern struct sock *sk_alloc(struct net *net, int family,
978 gfp_t priority, 1040 gfp_t priority,
979 struct proto *prot); 1041 struct proto *prot);
@@ -1160,6 +1222,10 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1160 sk->sk_socket = sock; 1222 sk->sk_socket = sock;
1161} 1223}
1162 1224
1225static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1226{
1227 return &sk->sk_wq->wait;
1228}
1163/* Detach socket from process context. 1229/* Detach socket from process context.
1164 * Announce socket dead, detach it from wait queue and inode. 1230 * Announce socket dead, detach it from wait queue and inode.
1165 * Note that parent inode held reference count on this struct sock, 1231 * Note that parent inode held reference count on this struct sock,
@@ -1172,14 +1238,14 @@ static inline void sock_orphan(struct sock *sk)
1172 write_lock_bh(&sk->sk_callback_lock); 1238 write_lock_bh(&sk->sk_callback_lock);
1173 sock_set_flag(sk, SOCK_DEAD); 1239 sock_set_flag(sk, SOCK_DEAD);
1174 sk_set_socket(sk, NULL); 1240 sk_set_socket(sk, NULL);
1175 sk->sk_sleep = NULL; 1241 sk->sk_wq = NULL;
1176 write_unlock_bh(&sk->sk_callback_lock); 1242 write_unlock_bh(&sk->sk_callback_lock);
1177} 1243}
1178 1244
1179static inline void sock_graft(struct sock *sk, struct socket *parent) 1245static inline void sock_graft(struct sock *sk, struct socket *parent)
1180{ 1246{
1181 write_lock_bh(&sk->sk_callback_lock); 1247 write_lock_bh(&sk->sk_callback_lock);
1182 sk->sk_sleep = &parent->wait; 1248 rcu_assign_pointer(sk->sk_wq, parent->wq);
1183 parent->sk = sk; 1249 parent->sk = sk;
1184 sk_set_socket(sk, parent); 1250 sk_set_socket(sk, parent);
1185 security_sock_graft(sk, parent); 1251 security_sock_graft(sk, parent);
@@ -1192,7 +1258,9 @@ extern unsigned long sock_i_ino(struct sock *sk);
1192static inline struct dst_entry * 1258static inline struct dst_entry *
1193__sk_dst_get(struct sock *sk) 1259__sk_dst_get(struct sock *sk)
1194{ 1260{
1195 return sk->sk_dst_cache; 1261 return rcu_dereference_check(sk->sk_dst_cache, rcu_read_lock_held() ||
1262 sock_owned_by_user(sk) ||
1263 lockdep_is_held(&sk->sk_lock.slock));
1196} 1264}
1197 1265
1198static inline struct dst_entry * 1266static inline struct dst_entry *
@@ -1200,50 +1268,65 @@ sk_dst_get(struct sock *sk)
1200{ 1268{
1201 struct dst_entry *dst; 1269 struct dst_entry *dst;
1202 1270
1203 read_lock(&sk->sk_dst_lock); 1271 rcu_read_lock();
1204 dst = sk->sk_dst_cache; 1272 dst = rcu_dereference(sk->sk_dst_cache);
1205 if (dst) 1273 if (dst)
1206 dst_hold(dst); 1274 dst_hold(dst);
1207 read_unlock(&sk->sk_dst_lock); 1275 rcu_read_unlock();
1208 return dst; 1276 return dst;
1209} 1277}
1210 1278
1279extern void sk_reset_txq(struct sock *sk);
1280
1281static inline void dst_negative_advice(struct sock *sk)
1282{
1283 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
1284
1285 if (dst && dst->ops->negative_advice) {
1286 ndst = dst->ops->negative_advice(dst);
1287
1288 if (ndst != dst) {
1289 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1290 sk_reset_txq(sk);
1291 }
1292 }
1293}
1294
1211static inline void 1295static inline void
1212__sk_dst_set(struct sock *sk, struct dst_entry *dst) 1296__sk_dst_set(struct sock *sk, struct dst_entry *dst)
1213{ 1297{
1214 struct dst_entry *old_dst; 1298 struct dst_entry *old_dst;
1215 1299
1216 sk_tx_queue_clear(sk); 1300 sk_tx_queue_clear(sk);
1217 old_dst = sk->sk_dst_cache; 1301 /*
1218 sk->sk_dst_cache = dst; 1302 * This can be called while sk is owned by the caller only,
1303 * with no state that can be checked in a rcu_dereference_check() cond
1304 */
1305 old_dst = rcu_dereference_raw(sk->sk_dst_cache);
1306 rcu_assign_pointer(sk->sk_dst_cache, dst);
1219 dst_release(old_dst); 1307 dst_release(old_dst);
1220} 1308}
1221 1309
1222static inline void 1310static inline void
1223sk_dst_set(struct sock *sk, struct dst_entry *dst) 1311sk_dst_set(struct sock *sk, struct dst_entry *dst)
1224{ 1312{
1225 write_lock(&sk->sk_dst_lock); 1313 spin_lock(&sk->sk_dst_lock);
1226 __sk_dst_set(sk, dst); 1314 __sk_dst_set(sk, dst);
1227 write_unlock(&sk->sk_dst_lock); 1315 spin_unlock(&sk->sk_dst_lock);
1228} 1316}
1229 1317
1230static inline void 1318static inline void
1231__sk_dst_reset(struct sock *sk) 1319__sk_dst_reset(struct sock *sk)
1232{ 1320{
1233 struct dst_entry *old_dst; 1321 __sk_dst_set(sk, NULL);
1234
1235 sk_tx_queue_clear(sk);
1236 old_dst = sk->sk_dst_cache;
1237 sk->sk_dst_cache = NULL;
1238 dst_release(old_dst);
1239} 1322}
1240 1323
1241static inline void 1324static inline void
1242sk_dst_reset(struct sock *sk) 1325sk_dst_reset(struct sock *sk)
1243{ 1326{
1244 write_lock(&sk->sk_dst_lock); 1327 spin_lock(&sk->sk_dst_lock);
1245 __sk_dst_reset(sk); 1328 __sk_dst_reset(sk);
1246 write_unlock(&sk->sk_dst_lock); 1329 spin_unlock(&sk->sk_dst_lock);
1247} 1330}
1248 1331
1249extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1332extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
@@ -1257,6 +1340,12 @@ static inline int sk_can_gso(const struct sock *sk)
1257 1340
1258extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1341extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1259 1342
1343static inline void sk_nocaps_add(struct sock *sk, int flags)
1344{
1345 sk->sk_route_nocaps |= flags;
1346 sk->sk_route_caps &= ~flags;
1347}
1348
1260static inline int skb_copy_to_page(struct sock *sk, char __user *from, 1349static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1261 struct sk_buff *skb, struct page *page, 1350 struct sk_buff *skb, struct page *page,
1262 int off, int copy) 1351 int off, int copy)
@@ -1314,12 +1403,12 @@ static inline int sk_has_allocations(const struct sock *sk)
1314} 1403}
1315 1404
1316/** 1405/**
1317 * sk_has_sleeper - check if there are any waiting processes 1406 * wq_has_sleeper - check if there are any waiting processes
1318 * @sk: socket 1407 * @sk: struct socket_wq
1319 * 1408 *
1320 * Returns true if socket has waiting processes 1409 * Returns true if socket_wq has waiting processes
1321 * 1410 *
1322 * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory 1411 * The purpose of the wq_has_sleeper and sock_poll_wait is to wrap the memory
1323 * barrier call. They were added due to the race found within the tcp code. 1412 * barrier call. They were added due to the race found within the tcp code.
1324 * 1413 *
1325 * Consider following tcp code paths: 1414 * Consider following tcp code paths:
@@ -1332,9 +1421,10 @@ static inline int sk_has_allocations(const struct sock *sk)
1332 * ... ... 1421 * ... ...
1333 * tp->rcv_nxt check sock_def_readable 1422 * tp->rcv_nxt check sock_def_readable
1334 * ... { 1423 * ... {
1335 * schedule ... 1424 * schedule rcu_read_lock();
1336 * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1425 * wq = rcu_dereference(sk->sk_wq);
1337 * wake_up_interruptible(sk->sk_sleep) 1426 * if (wq && waitqueue_active(&wq->wait))
1427 * wake_up_interruptible(&wq->wait)
1338 * ... 1428 * ...
1339 * } 1429 * }
1340 * 1430 *
@@ -1343,19 +1433,18 @@ static inline int sk_has_allocations(const struct sock *sk)
1343 * could then endup calling schedule and sleep forever if there are no more 1433 * could then endup calling schedule and sleep forever if there are no more
1344 * data on the socket. 1434 * data on the socket.
1345 * 1435 *
1346 * The sk_has_sleeper is always called right after a call to read_lock, so we
1347 * can use smp_mb__after_lock barrier.
1348 */ 1436 */
1349static inline int sk_has_sleeper(struct sock *sk) 1437static inline bool wq_has_sleeper(struct socket_wq *wq)
1350{ 1438{
1439
1351 /* 1440 /*
1352 * We need to be sure we are in sync with the 1441 * We need to be sure we are in sync with the
1353 * add_wait_queue modifications to the wait queue. 1442 * add_wait_queue modifications to the wait queue.
1354 * 1443 *
1355 * This memory barrier is paired in the sock_poll_wait. 1444 * This memory barrier is paired in the sock_poll_wait.
1356 */ 1445 */
1357 smp_mb__after_lock(); 1446 smp_mb();
1358 return sk->sk_sleep && waitqueue_active(sk->sk_sleep); 1447 return wq && waitqueue_active(&wq->wait);
1359} 1448}
1360 1449
1361/** 1450/**
@@ -1364,7 +1453,7 @@ static inline int sk_has_sleeper(struct sock *sk)
1364 * @wait_address: socket wait queue 1453 * @wait_address: socket wait queue
1365 * @p: poll_table 1454 * @p: poll_table
1366 * 1455 *
1367 * See the comments in the sk_has_sleeper function. 1456 * See the comments in the wq_has_sleeper function.
1368 */ 1457 */
1369static inline void sock_poll_wait(struct file *filp, 1458static inline void sock_poll_wait(struct file *filp,
1370 wait_queue_head_t *wait_address, poll_table *p) 1459 wait_queue_head_t *wait_address, poll_table *p)
@@ -1375,7 +1464,7 @@ static inline void sock_poll_wait(struct file *filp,
1375 * We need to be sure we are in sync with the 1464 * We need to be sure we are in sync with the
1376 * socket flags modification. 1465 * socket flags modification.
1377 * 1466 *
1378 * This memory barrier is paired in the sk_has_sleeper. 1467 * This memory barrier is paired in the wq_has_sleeper.
1379 */ 1468 */
1380 smp_mb(); 1469 smp_mb();
1381 } 1470 }
@@ -1557,7 +1646,24 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1557 sk->sk_stamp = kt; 1646 sk->sk_stamp = kt;
1558} 1647}
1559 1648
1560extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); 1649extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1650 struct sk_buff *skb);
1651
1652static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
1653 struct sk_buff *skb)
1654{
1655#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
1656 (1UL << SOCK_RCVTSTAMP) | \
1657 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
1658 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
1659 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
1660 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
1661
1662 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
1663 __sock_recv_ts_and_drops(msg, sk, skb);
1664 else
1665 sk->sk_stamp = skb->tstamp;
1666}
1561 1667
1562/** 1668/**
1563 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 1669 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 75be5a28815d..a1449144848a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -294,6 +294,7 @@ extern struct proto tcp_prot;
294#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field) 294#define TCP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.tcp_statistics, field)
295#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) 295#define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field)
296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 296#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
297#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
297 298
298extern void tcp_v4_err(struct sk_buff *skb, u32); 299extern void tcp_v4_err(struct sk_buff *skb, u32);
299 300
@@ -423,7 +424,7 @@ extern u8 *tcp_parse_md5sig_option(struct tcphdr *th);
423 * TCP v4 functions exported for the inet6 API 424 * TCP v4 functions exported for the inet6 API
424 */ 425 */
425 426
426extern void tcp_v4_send_check(struct sock *sk, int len, 427extern void tcp_v4_send_check(struct sock *sk,
427 struct sk_buff *skb); 428 struct sk_buff *skb);
428 429
429extern int tcp_v4_conn_request(struct sock *sk, 430extern int tcp_v4_conn_request(struct sock *sk,
@@ -939,7 +940,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
939 940
940 tp->ucopy.memory = 0; 941 tp->ucopy.memory = 0;
941 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { 942 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
942 wake_up_interruptible_sync_poll(sk->sk_sleep, 943 wake_up_interruptible_sync_poll(sk_sleep(sk),
943 POLLIN | POLLRDNORM | POLLRDBAND); 944 POLLIN | POLLRDNORM | POLLRDBAND);
944 if (!inet_csk_ack_scheduled(sk)) 945 if (!inet_csk_ack_scheduled(sk))
945 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 946 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
@@ -1032,6 +1033,14 @@ static inline int keepalive_probes(const struct tcp_sock *tp)
1032 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; 1033 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1033} 1034}
1034 1035
1036static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
1037{
1038 const struct inet_connection_sock *icsk = &tp->inet_conn;
1039
1040 return min_t(u32, tcp_time_stamp - icsk->icsk_ack.lrcvtime,
1041 tcp_time_stamp - tp->rcv_tstamp);
1042}
1043
1035static inline int tcp_fin_time(const struct sock *sk) 1044static inline int tcp_fin_time(const struct sock *sk)
1036{ 1045{
1037 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1046 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
@@ -1197,30 +1206,15 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1197extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *); 1206extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1198extern void tcp_free_md5sig_pool(void); 1207extern void tcp_free_md5sig_pool(void);
1199 1208
1200extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1209extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1201extern void __tcp_put_md5sig_pool(void); 1210extern void tcp_put_md5sig_pool(void);
1211
1202extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *); 1212extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, struct tcphdr *);
1203extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *, 1213extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, struct sk_buff *,
1204 unsigned header_len); 1214 unsigned header_len);
1205extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1215extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1206 struct tcp_md5sig_key *key); 1216 struct tcp_md5sig_key *key);
1207 1217
1208static inline
1209struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
1210{
1211 int cpu = get_cpu();
1212 struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
1213 if (!ret)
1214 put_cpu();
1215 return ret;
1216}
1217
1218static inline void tcp_put_md5sig_pool(void)
1219{
1220 __tcp_put_md5sig_pool();
1221 put_cpu();
1222}
1223
1224/* write queue abstraction */ 1218/* write queue abstraction */
1225static inline void tcp_write_queue_purge(struct sock *sk) 1219static inline void tcp_write_queue_purge(struct sock *sk)
1226{ 1220{
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h
index 9566608c88cf..15af6dca0b49 100644
--- a/include/net/tipc/tipc.h
+++ b/include/net/tipc/tipc.h
@@ -2,7 +2,7 @@
2 * include/net/tipc/tipc.h: Main include file for TIPC users 2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005,2010 Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -126,7 +126,7 @@ int tipc_createport(unsigned int tipc_user,
126 tipc_msg_event message_cb, 126 tipc_msg_event message_cb,
127 tipc_named_msg_event named_message_cb, 127 tipc_named_msg_event named_message_cb,
128 tipc_conn_msg_event conn_message_cb, 128 tipc_conn_msg_event conn_message_cb,
129 tipc_continue_event continue_event_cb,/* May be zero */ 129 tipc_continue_event continue_event_cb,
130 u32 *portref); 130 u32 *portref);
131 131
132int tipc_deleteport(u32 portref); 132int tipc_deleteport(u32 portref);
@@ -145,13 +145,13 @@ int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
145int tipc_publish(u32 portref, unsigned int scope, 145int tipc_publish(u32 portref, unsigned int scope,
146 struct tipc_name_seq const *name_seq); 146 struct tipc_name_seq const *name_seq);
147int tipc_withdraw(u32 portref, unsigned int scope, 147int tipc_withdraw(u32 portref, unsigned int scope,
148 struct tipc_name_seq const *name_seq); /* 0: all */ 148 struct tipc_name_seq const *name_seq);
149 149
150int tipc_connect2port(u32 portref, struct tipc_portid const *port); 150int tipc_connect2port(u32 portref, struct tipc_portid const *port);
151 151
152int tipc_disconnect(u32 portref); 152int tipc_disconnect(u32 portref);
153 153
154int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */ 154int tipc_shutdown(u32 ref);
155 155
156int tipc_isconnected(u32 portref, int *isconnected); 156int tipc_isconnected(u32 portref, int *isconnected);
157 157
@@ -176,7 +176,7 @@ int tipc_send_buf(u32 portref,
176 176
177int tipc_send2name(u32 portref, 177int tipc_send2name(u32 portref,
178 struct tipc_name const *name, 178 struct tipc_name const *name,
179 u32 domain, /* 0:own zone */ 179 u32 domain,
180 unsigned int num_sect, 180 unsigned int num_sect,
181 struct iovec const *msg_sect); 181 struct iovec const *msg_sect);
182 182
@@ -188,7 +188,7 @@ int tipc_send_buf2name(u32 portref,
188 188
189int tipc_forward2name(u32 portref, 189int tipc_forward2name(u32 portref,
190 struct tipc_name const *name, 190 struct tipc_name const *name,
191 u32 domain, /*0: own zone */ 191 u32 domain,
192 unsigned int section_count, 192 unsigned int section_count,
193 struct iovec const *msg_sect, 193 struct iovec const *msg_sect,
194 struct tipc_portid const *origin, 194 struct tipc_portid const *origin,
@@ -228,14 +228,14 @@ int tipc_forward_buf2port(u32 portref,
228 228
229int tipc_multicast(u32 portref, 229int tipc_multicast(u32 portref,
230 struct tipc_name_seq const *seq, 230 struct tipc_name_seq const *seq,
231 u32 domain, /* 0:own zone */ 231 u32 domain, /* currently unused */
232 unsigned int section_count, 232 unsigned int section_count,
233 struct iovec const *msg); 233 struct iovec const *msg);
234 234
235#if 0 235#if 0
236int tipc_multicast_buf(u32 portref, 236int tipc_multicast_buf(u32 portref,
237 struct tipc_name_seq const *seq, 237 struct tipc_name_seq const *seq,
238 u32 domain, /* 0:own zone */ 238 u32 domain,
239 void *buf, 239 void *buf,
240 unsigned int size); 240 unsigned int size);
241#endif 241#endif
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index d65381cad0fc..42a0eb68b7b6 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,8 @@ extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg, 44 struct msghdr *msg,
45 struct flowi *fl, 45 struct flowi *fl,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass,
48 int *dontfrag);
48 49
49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006) 50#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 51
diff --git a/include/net/x25.h b/include/net/x25.h
index 468551ea4f1d..1479cb4a41fc 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -80,8 +80,6 @@ enum {
80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 80#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 81#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 82#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
83#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
84#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
85 83
86#define X25_SMODULUS 8 84#define X25_SMODULUS 8
87#define X25_EMODULUS 128 85#define X25_EMODULUS 128
@@ -113,6 +111,11 @@ enum {
113#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */ 111#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
114#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */ 112#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
115 113
114/* Bitset in x25_sock->flags for misc flags */
115#define X25_Q_BIT_FLAG 0
116#define X25_INTERRUPT_FLAG 1
117#define X25_ACCPT_APPRV_FLAG 2
118
116/** 119/**
117 * struct x25_route - x25 routing entry 120 * struct x25_route - x25 routing entry
118 * @node - entry in x25_list_lock 121 * @node - entry in x25_list_lock
@@ -146,10 +149,11 @@ struct x25_sock {
146 struct x25_address source_addr, dest_addr; 149 struct x25_address source_addr, dest_addr;
147 struct x25_neigh *neighbour; 150 struct x25_neigh *neighbour;
148 unsigned int lci, cudmatchlength; 151 unsigned int lci, cudmatchlength;
149 unsigned char state, condition, qbitincl, intflag, accptapprv; 152 unsigned char state, condition;
150 unsigned short vs, vr, va, vl; 153 unsigned short vs, vr, va, vl;
151 unsigned long t2, t21, t22, t23; 154 unsigned long t2, t21, t22, t23;
152 unsigned short fraglen; 155 unsigned short fraglen;
156 unsigned long flags;
153 struct sk_buff_head ack_queue; 157 struct sk_buff_head ack_queue;
154 struct sk_buff_head fragment_queue; 158 struct sk_buff_head fragment_queue;
155 struct sk_buff_head interrupt_in_queue; 159 struct sk_buff_head interrupt_in_queue;
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1415bcf93980..1fa08b49f1c2 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/if_ether.h> 4#include <linux/if_ether.h>
5#include <linux/if_packet.h> 5#include <linux/if_packet.h>
6#include <linux/if_x25.h>
6#include <linux/skbuff.h> 7#include <linux/skbuff.h>
7 8
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 9static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index ac52f33f3e4a..1913af67c43d 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,7 @@
20#include <net/route.h> 20#include <net/route.h>
21#include <net/ipv6.h> 21#include <net/ipv6.h>
22#include <net/ip6_fib.h> 22#include <net/ip6_fib.h>
23#include <net/flow.h>
23 24
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
25 26
@@ -267,7 +268,6 @@ struct xfrm_policy_afinfo {
267 xfrm_address_t *saddr, 268 xfrm_address_t *saddr,
268 xfrm_address_t *daddr); 269 xfrm_address_t *daddr);
269 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); 270 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
270 struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);
271 void (*decode_session)(struct sk_buff *skb, 271 void (*decode_session)(struct sk_buff *skb,
272 struct flowi *fl, 272 struct flowi *fl,
273 int reverse); 273 int reverse);
@@ -482,13 +482,14 @@ struct xfrm_policy {
482 atomic_t refcnt; 482 atomic_t refcnt;
483 struct timer_list timer; 483 struct timer_list timer;
484 484
485 struct flow_cache_object flo;
486 atomic_t genid;
485 u32 priority; 487 u32 priority;
486 u32 index; 488 u32 index;
487 struct xfrm_mark mark; 489 struct xfrm_mark mark;
488 struct xfrm_selector selector; 490 struct xfrm_selector selector;
489 struct xfrm_lifetime_cfg lft; 491 struct xfrm_lifetime_cfg lft;
490 struct xfrm_lifetime_cur curlft; 492 struct xfrm_lifetime_cur curlft;
491 struct dst_entry *bundles;
492 struct xfrm_policy_walk_entry walk; 493 struct xfrm_policy_walk_entry walk;
493 u8 type; 494 u8 type;
494 u8 action; 495 u8 action;
@@ -735,19 +736,12 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy)
735 xfrm_policy_destroy(policy); 736 xfrm_policy_destroy(policy);
736} 737}
737 738
738#ifdef CONFIG_XFRM_SUB_POLICY
739static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) 739static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
740{ 740{
741 int i; 741 int i;
742 for (i = npols - 1; i >= 0; --i) 742 for (i = npols - 1; i >= 0; --i)
743 xfrm_pol_put(pols[i]); 743 xfrm_pol_put(pols[i]);
744} 744}
745#else
746static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
747{
748 xfrm_pol_put(pols[0]);
749}
750#endif
751 745
752extern void __xfrm_state_destroy(struct xfrm_state *); 746extern void __xfrm_state_destroy(struct xfrm_state *);
753 747
@@ -878,11 +872,15 @@ struct xfrm_dst {
878 struct rt6_info rt6; 872 struct rt6_info rt6;
879 } u; 873 } u;
880 struct dst_entry *route; 874 struct dst_entry *route;
875 struct flow_cache_object flo;
876 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
877 int num_pols, num_xfrms;
881#ifdef CONFIG_XFRM_SUB_POLICY 878#ifdef CONFIG_XFRM_SUB_POLICY
882 struct flowi *origin; 879 struct flowi *origin;
883 struct xfrm_selector *partner; 880 struct xfrm_selector *partner;
884#endif 881#endif
885 u32 genid; 882 u32 xfrm_genid;
883 u32 policy_genid;
886 u32 route_mtu_cached; 884 u32 route_mtu_cached;
887 u32 child_mtu_cached; 885 u32 child_mtu_cached;
888 u32 route_cookie; 886 u32 route_cookie;
@@ -892,6 +890,7 @@ struct xfrm_dst {
892#ifdef CONFIG_XFRM 890#ifdef CONFIG_XFRM
893static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) 891static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
894{ 892{
893 xfrm_pols_put(xdst->pols, xdst->num_pols);
895 dst_release(xdst->route); 894 dst_release(xdst->route);
896 if (likely(xdst->u.dst.xfrm)) 895 if (likely(xdst->u.dst.xfrm))
897 xfrm_state_put(xdst->u.dst.xfrm); 896 xfrm_state_put(xdst->u.dst.xfrm);
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 75fa3530345b..57d8d0393567 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -85,6 +85,7 @@ typedef struct config_req_t {
85#define CONF_ENABLE_IRQ 0x01 85#define CONF_ENABLE_IRQ 0x01
86#define CONF_ENABLE_DMA 0x02 86#define CONF_ENABLE_DMA 0x02
87#define CONF_ENABLE_SPKR 0x04 87#define CONF_ENABLE_SPKR 0x04
88#define CONF_ENABLE_PULSE_IRQ 0x08
88#define CONF_VALID_CLIENT 0x100 89#define CONF_VALID_CLIENT 0x100
89 90
90/* IntType field */ 91/* IntType field */
@@ -113,25 +114,7 @@ typedef struct io_req_t {
113#define IO_DATA_PATH_WIDTH_16 0x08 114#define IO_DATA_PATH_WIDTH_16 0x08
114#define IO_DATA_PATH_WIDTH_AUTO 0x10 115#define IO_DATA_PATH_WIDTH_AUTO 0x10
115 116
116/* For RequestIRQ and ReleaseIRQ */
117typedef struct irq_req_t {
118 u_int Attributes;
119 u_int AssignedIRQ;
120 irq_handler_t Handler;
121} irq_req_t;
122
123/* Attributes for RequestIRQ and ReleaseIRQ */
124#define IRQ_TYPE 0x03
125#define IRQ_TYPE_EXCLUSIVE 0x00
126#define IRQ_TYPE_TIME 0x01
127#define IRQ_TYPE_DYNAMIC_SHARING 0x02
128#define IRQ_FORCED_PULSE 0x04
129#define IRQ_FIRST_SHARED 0x08 /* unused */
130#define IRQ_HANDLE_PRESENT 0x10 /* unused */
131#define IRQ_PULSE_ALLOCATED 0x100
132
133/* Bits in IRQInfo1 field */ 117/* Bits in IRQInfo1 field */
134#define IRQ_MASK 0x0f
135#define IRQ_NMI_ID 0x01 118#define IRQ_NMI_ID 0x01
136#define IRQ_IOCK_ID 0x02 119#define IRQ_IOCK_ID 0x02
137#define IRQ_BERR_ID 0x04 120#define IRQ_BERR_ID 0x04
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index d57847f2f6c1..c180165fbd3e 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -26,6 +26,7 @@
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27#include <linux/device.h> 27#include <linux/device.h>
28#include <pcmcia/ss.h> 28#include <pcmcia/ss.h>
29#include <asm/atomic.h>
29 30
30/* 31/*
31 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus 32 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus
@@ -61,15 +62,6 @@ struct pcmcia_driver {
61int pcmcia_register_driver(struct pcmcia_driver *driver); 62int pcmcia_register_driver(struct pcmcia_driver *driver);
62void pcmcia_unregister_driver(struct pcmcia_driver *driver); 63void pcmcia_unregister_driver(struct pcmcia_driver *driver);
63 64
64/* Some drivers use dev_node_t to store char or block device information.
65 * Don't use this in new drivers, though.
66 */
67typedef struct dev_node_t {
68 char dev_name[DEV_NAME_LEN];
69 u_short major, minor;
70 struct dev_node_t *next;
71} dev_node_t;
72
73struct pcmcia_device { 65struct pcmcia_device {
74 /* the socket and the device_no [for multifunction devices] 66 /* the socket and the device_no [for multifunction devices]
75 uniquely define a pcmcia_device */ 67 uniquely define a pcmcia_device */
@@ -87,17 +79,16 @@ struct pcmcia_device {
87 struct list_head socket_device_list; 79 struct list_head socket_device_list;
88 80
89 /* deprecated, will be cleaned up soon */ 81 /* deprecated, will be cleaned up soon */
90 dev_node_t *dev_node;
91 u_int open; 82 u_int open;
92 io_req_t io; 83 io_req_t io;
93 irq_req_t irq;
94 config_req_t conf; 84 config_req_t conf;
95 window_handle_t win; 85 window_handle_t win;
96 86
97 /* Is the device suspended, or in the process of 87 /* device setup */
98 * being removed? */ 88 unsigned int irq;
89
90 /* Is the device suspended? */
99 u16 suspended:1; 91 u16 suspended:1;
100 u16 _removed:1;
101 92
102 /* Flags whether io, irq, win configurations were 93 /* Flags whether io, irq, win configurations were
103 * requested, and whether the configuration is "locked" */ 94 * requested, and whether the configuration is "locked" */
@@ -115,7 +106,7 @@ struct pcmcia_device {
115 u16 has_card_id:1; 106 u16 has_card_id:1;
116 u16 has_func_id:1; 107 u16 has_func_id:1;
117 108
118 u16 reserved:3; 109 u16 reserved:4;
119 110
120 u8 func_id; 111 u8 func_id;
121 u16 manf_id; 112 u16 manf_id;
@@ -192,7 +183,20 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
192 183
193/* device configuration */ 184/* device configuration */
194int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); 185int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
195int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); 186
187int __must_check
188__pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
189 irq_handler_t handler);
190static inline __must_check __deprecated int
191pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev,
192 irq_handler_t handler)
193{
194 return __pcmcia_request_exclusive_irq(p_dev, handler);
195}
196
197int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev,
198 irq_handler_t handler);
199
196int pcmcia_request_configuration(struct pcmcia_device *p_dev, 200int pcmcia_request_configuration(struct pcmcia_device *p_dev,
197 config_req_t *req); 201 config_req_t *req);
198 202
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h
deleted file mode 100644
index 0fa06e5d5376..000000000000
--- a/include/pcmcia/mem_op.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * mem_op.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_MEM_OP_H
16#define _LINUX_MEM_OP_H
17
18#include <linux/io.h>
19#include <asm/uaccess.h>
20
21/*
22 If UNSAFE_MEMCPY is defined, we use the (optimized) system routines
23 to copy between a card and kernel memory. These routines do 32-bit
24 operations which may not work with all PCMCIA controllers. The
25 safe versions defined here will do only 8-bit and 16-bit accesses.
26*/
27
28#ifdef UNSAFE_MEMCPY
29
30#define copy_from_pc memcpy_fromio
31#define copy_to_pc memcpy_toio
32
33static inline void copy_pc_to_user(void *to, const void *from, size_t n)
34{
35 size_t odd = (n & 3);
36 n -= odd;
37 while (n) {
38 put_user(__raw_readl(from), (int *)to);
39 (char *)from += 4; (char *)to += 4; n -= 4;
40 }
41 while (odd--)
42 put_user(readb((char *)from++), (char *)to++);
43}
44
45static inline void copy_user_to_pc(void *to, const void *from, size_t n)
46{
47 int l;
48 char c;
49 size_t odd = (n & 3);
50 n -= odd;
51 while (n) {
52 get_user(l, (int *)from);
53 __raw_writel(l, to);
54 (char *)to += 4; (char *)from += 4; n -= 4;
55 }
56 while (odd--) {
57 get_user(c, (char *)from++);
58 writeb(c, (char *)to++);
59 }
60}
61
62#else /* UNSAFE_MEMCPY */
63
64static inline void copy_from_pc(void *to, void __iomem *from, size_t n)
65{
66 __u16 *t = to;
67 __u16 __iomem *f = from;
68 size_t odd = (n & 1);
69 for (n >>= 1; n; n--)
70 *t++ = __raw_readw(f++);
71 if (odd)
72 *(__u8 *)t = readb(f);
73}
74
75static inline void copy_to_pc(void __iomem *to, const void *from, size_t n)
76{
77 __u16 __iomem *t = to;
78 const __u16 *f = from;
79 size_t odd = (n & 1);
80 for (n >>= 1; n ; n--)
81 __raw_writew(*f++, t++);
82 if (odd)
83 writeb(*(__u8 *)f, t);
84}
85
86static inline void copy_pc_to_user(void __user *to, void __iomem *from, size_t n)
87{
88 __u16 __user *t = to;
89 __u16 __iomem *f = from;
90 size_t odd = (n & 1);
91 for (n >>= 1; n ; n--)
92 put_user(__raw_readw(f++), t++);
93 if (odd)
94 put_user(readb(f), (char __user *)t);
95}
96
97static inline void copy_user_to_pc(void __iomem *to, void __user *from, size_t n)
98{
99 __u16 __user *f = from;
100 __u16 __iomem *t = to;
101 short s;
102 char c;
103 size_t odd = (n & 1);
104 for (n >>= 1; n; n--) {
105 get_user(s, f++);
106 __raw_writew(s, t++);
107 }
108 if (odd) {
109 get_user(c, (char __user *)f);
110 writeb(c, t);
111 }
112}
113
114#endif /* UNSAFE_MEMCPY */
115
116#endif /* _LINUX_MEM_OP_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 2e488b60bc76..764281b29218 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -141,10 +141,6 @@ struct pcmcia_socket {
141 u_short lock_count; 141 u_short lock_count;
142 pccard_mem_map cis_mem; 142 pccard_mem_map cis_mem;
143 void __iomem *cis_virt; 143 void __iomem *cis_virt;
144 struct {
145 u_int AssignedIRQ;
146 u_int Config;
147 } irq;
148 io_window_t io[MAX_IO_WIN]; 144 io_window_t io[MAX_IO_WIN];
149 pccard_mem_map win[MAX_WIN]; 145 pccard_mem_map win[MAX_WIN];
150 struct list_head cis_cache; 146 struct list_head cis_cache;
@@ -224,18 +220,19 @@ struct pcmcia_socket {
224 220
225 /* 16-bit state: */ 221 /* 16-bit state: */
226 struct { 222 struct {
227 /* PCMCIA card is present in socket */
228 u8 present:1;
229 /* "master" ioctl is used */ 223 /* "master" ioctl is used */
230 u8 busy:1; 224 u8 busy:1;
231 /* pcmcia module is being unloaded */
232 u8 dead:1;
233 /* the PCMCIA card consists of two pseudo devices */ 225 /* the PCMCIA card consists of two pseudo devices */
234 u8 has_pfc:1; 226 u8 has_pfc:1;
235 227
236 u8 reserved:4; 228 u8 reserved:6;
237 } pcmcia_state; 229 } pcmcia_state;
238 230
231 /* non-zero if PCMCIA card is present */
232 atomic_t present;
233
234 /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */
235 unsigned int pcmcia_irq;
239 236
240#ifdef CONFIG_PCMCIA_IOCTL 237#ifdef CONFIG_PCMCIA_IOCTL
241 struct user_info_t *user; 238 struct user_info_t *user;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index a585e0f92bc3..310d31474034 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -136,6 +136,7 @@ struct ib_device_attr {
136 int max_qp_init_rd_atom; 136 int max_qp_init_rd_atom;
137 int max_ee_init_rd_atom; 137 int max_ee_init_rd_atom;
138 enum ib_atomic_cap atomic_cap; 138 enum ib_atomic_cap atomic_cap;
139 enum ib_atomic_cap masked_atomic_cap;
139 int max_ee; 140 int max_ee;
140 int max_rdd; 141 int max_rdd;
141 int max_mw; 142 int max_mw;
@@ -467,6 +468,8 @@ enum ib_wc_opcode {
467 IB_WC_LSO, 468 IB_WC_LSO,
468 IB_WC_LOCAL_INV, 469 IB_WC_LOCAL_INV,
469 IB_WC_FAST_REG_MR, 470 IB_WC_FAST_REG_MR,
471 IB_WC_MASKED_COMP_SWAP,
472 IB_WC_MASKED_FETCH_ADD,
470/* 473/*
471 * Set value of IB_WC_RECV so consumers can test if a completion is a 474 * Set value of IB_WC_RECV so consumers can test if a completion is a
472 * receive by testing (opcode & IB_WC_RECV). 475 * receive by testing (opcode & IB_WC_RECV).
@@ -689,6 +692,8 @@ enum ib_wr_opcode {
689 IB_WR_RDMA_READ_WITH_INV, 692 IB_WR_RDMA_READ_WITH_INV,
690 IB_WR_LOCAL_INV, 693 IB_WR_LOCAL_INV,
691 IB_WR_FAST_REG_MR, 694 IB_WR_FAST_REG_MR,
695 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
696 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
692}; 697};
693 698
694enum ib_send_flags { 699enum ib_send_flags {
@@ -731,6 +736,8 @@ struct ib_send_wr {
731 u64 remote_addr; 736 u64 remote_addr;
732 u64 compare_add; 737 u64 compare_add;
733 u64 swap; 738 u64 swap;
739 u64 compare_add_mask;
740 u64 swap_mask;
734 u32 rkey; 741 u32 rkey;
735 } atomic; 742 } atomic;
736 struct { 743 struct {
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
index b3a0ee6b2f1c..f2b94918994d 100644
--- a/include/scsi/Kbuild
+++ b/include/scsi/Kbuild
@@ -1,4 +1,3 @@
1header-y += scsi.h
2header-y += scsi_netlink.h 1header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h 2header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h 3header-y += scsi_bsg_fc.h
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 747e2c7d88d6..8e9b222251c2 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -76,6 +76,7 @@ struct fcp_cmnd32 {
76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */ 76#define FCP_PTA_HEADQ 1 /* head of queue task attribute */
77#define FCP_PTA_ORDERED 2 /* ordered task attribute */ 77#define FCP_PTA_ORDERED 2 /* ordered task attribute */
78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */ 78#define FCP_PTA_ACA 4 /* auto. contigent allegiance */
79#define FCP_PTA_MASK 7 /* mask for task attribute field */
79#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ 80#define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */
80#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ 81#define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */
81 82
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 8eb0a0fc0a71..9b4867c9c2d2 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -74,7 +74,7 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
74 adisc->adisc_cmd = ELS_ADISC; 74 adisc->adisc_cmd = ELS_ADISC;
75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); 75 put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn);
76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); 76 put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn);
77 hton24(adisc->adisc_port_id, fc_host_port_id(lport->host)); 77 hton24(adisc->adisc_port_id, lport->port_id);
78} 78}
79 79
80/** 80/**
@@ -127,15 +127,13 @@ static inline int fc_ct_fill(struct fc_lport *lport,
127 127
128 case FC_NS_RFT_ID: 128 case FC_NS_RFT_ID:
129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 129 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft));
130 hton24(ct->payload.rft.fid.fp_fid, 130 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
131 fc_host_port_id(lport->host));
132 ct->payload.rft.fts = lport->fcts; 131 ct->payload.rft.fts = lport->fcts;
133 break; 132 break;
134 133
135 case FC_NS_RFF_ID: 134 case FC_NS_RFF_ID:
136 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); 135 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id));
137 hton24(ct->payload.rff.fr_fid.fp_fid, 136 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
138 fc_host_port_id(lport->host));
139 ct->payload.rff.fr_type = FC_TYPE_FCP; 137 ct->payload.rff.fr_type = FC_TYPE_FCP;
140 if (lport->service_params & FCP_SPPF_INIT_FCN) 138 if (lport->service_params & FCP_SPPF_INIT_FCN)
141 ct->payload.rff.fr_feat = FCP_FEAT_INIT; 139 ct->payload.rff.fr_feat = FCP_FEAT_INIT;
@@ -145,16 +143,14 @@ static inline int fc_ct_fill(struct fc_lport *lport,
145 143
146 case FC_NS_RNN_ID: 144 case FC_NS_RNN_ID:
147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 145 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id));
148 hton24(ct->payload.rn.fr_fid.fp_fid, 146 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
149 fc_host_port_id(lport->host));
150 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); 147 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
151 break; 148 break;
152 149
153 case FC_NS_RSPN_ID: 150 case FC_NS_RSPN_ID:
154 len = strnlen(fc_host_symbolic_name(lport->host), 255); 151 len = strnlen(fc_host_symbolic_name(lport->host), 255);
155 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); 152 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len);
156 hton24(ct->payload.spn.fr_fid.fp_fid, 153 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
157 fc_host_port_id(lport->host));
158 strncpy(ct->payload.spn.fr_name, 154 strncpy(ct->payload.spn.fr_name,
159 fc_host_symbolic_name(lport->host), len); 155 fc_host_symbolic_name(lport->host), len);
160 ct->payload.spn.fr_name_len = len; 156 ct->payload.spn.fr_name_len = len;
@@ -268,7 +264,7 @@ static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp)
268 logo = fc_frame_payload_get(fp, sizeof(*logo)); 264 logo = fc_frame_payload_get(fp, sizeof(*logo));
269 memset(logo, 0, sizeof(*logo)); 265 memset(logo, 0, sizeof(*logo));
270 logo->fl_cmd = ELS_LOGO; 266 logo->fl_cmd = ELS_LOGO;
271 hton24(logo->fl_n_port_id, fc_host_port_id(lport->host)); 267 hton24(logo->fl_n_port_id, lport->port_id);
272 logo->fl_n_port_wwn = htonll(lport->wwpn); 268 logo->fl_n_port_wwn = htonll(lport->wwpn);
273} 269}
274 270
@@ -295,7 +291,7 @@ static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp)
295 rec = fc_frame_payload_get(fp, sizeof(*rec)); 291 rec = fc_frame_payload_get(fp, sizeof(*rec));
296 memset(rec, 0, sizeof(*rec)); 292 memset(rec, 0, sizeof(*rec));
297 rec->rec_cmd = ELS_REC; 293 rec->rec_cmd = ELS_REC;
298 hton24(rec->rec_s_id, fc_host_port_id(lport->host)); 294 hton24(rec->rec_s_id, lport->port_id);
299 rec->rec_ox_id = htons(ep->oxid); 295 rec->rec_ox_id = htons(ep->oxid);
300 rec->rec_rx_id = htons(ep->rxid); 296 rec->rec_rx_id = htons(ep->rxid);
301} 297}
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 4b912eee33e5..7495c0ba67ee 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -47,13 +47,18 @@
47#define ntohll(x) be64_to_cpu(x) 47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x) 48#define htonll(x) cpu_to_be64(x)
49 49
50#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
51 50
52#define hton24(p, v) do { \ 51static inline u32 ntoh24(const u8 *p)
53 p[0] = (((v) >> 16) & 0xFF); \ 52{
54 p[1] = (((v) >> 8) & 0xFF); \ 53 return (p[0] << 16) | (p[1] << 8) | p[2];
55 p[2] = ((v) & 0xFF); \ 54}
56 } while (0) 55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
57 62
58/** 63/**
59 * enum fc_lport_state - Local port states 64 * enum fc_lport_state - Local port states
@@ -775,6 +780,7 @@ struct fc_disc {
775 * @dev_stats: FCoE device stats (TODO: libfc should not be 780 * @dev_stats: FCoE device stats (TODO: libfc should not be
776 * FCoE aware) 781 * FCoE aware)
777 * @retry_count: Number of retries in the current state 782 * @retry_count: Number of retries in the current state
783 * @port_id: FC Port ID
778 * @wwpn: World Wide Port Name 784 * @wwpn: World Wide Port Name
779 * @wwnn: World Wide Node Name 785 * @wwnn: World Wide Node Name
780 * @service_params: Common service parameters 786 * @service_params: Common service parameters
@@ -821,6 +827,7 @@ struct fc_lport {
821 u8 retry_count; 827 u8 retry_count;
822 828
823 /* Fabric information */ 829 /* Fabric information */
830 u32 port_id;
824 u64 wwpn; 831 u64 wwpn;
825 u64 wwnn; 832 u64 wwnn;
826 unsigned int service_params; 833 unsigned int service_params;
@@ -918,15 +925,6 @@ static inline void fc_lport_free_stats(struct fc_lport *lport)
918} 925}
919 926
920/** 927/**
921 * fc_lport_get_stats() - Get a local port's statistics
922 * @lport: The local port whose statistics are to be retreived
923 */
924static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport)
925{
926 return per_cpu_ptr(lport->dev_stats, smp_processor_id());
927}
928
929/**
930 * lport_priv() - Return the private data from a local port 928 * lport_priv() - Return the private data from a local port
931 * @lport: The local port whose private data is to be retreived 929 * @lport: The local port whose private data is to be retreived
932 */ 930 */
@@ -1053,7 +1051,6 @@ void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
1053 * Functions for fc_functions_template 1051 * Functions for fc_functions_template
1054 */ 1052 */
1055void fc_get_host_speed(struct Scsi_Host *); 1053void fc_get_host_speed(struct Scsi_Host *);
1056void fc_get_host_port_type(struct Scsi_Host *);
1057void fc_get_host_port_state(struct Scsi_Host *); 1054void fc_get_host_port_state(struct Scsi_Host *);
1058void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); 1055void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout);
1059struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); 1056struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index c603f4a7e7fc..ec13f51531f8 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -29,6 +29,8 @@
29#include <scsi/fc/fc_fcoe.h> 29#include <scsi/fc/fc_fcoe.h>
30#include <scsi/libfc.h> 30#include <scsi/libfc.h>
31 31
32#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
33
32/* 34/*
33 * FIP tunable parameters. 35 * FIP tunable parameters.
34 */ 36 */
@@ -65,14 +67,12 @@ enum fip_state {
65 * @port_ka_time: time of next port keep-alive. 67 * @port_ka_time: time of next port keep-alive.
66 * @ctlr_ka_time: time of next controller keep-alive. 68 * @ctlr_ka_time: time of next controller keep-alive.
67 * @timer: timer struct used for all delayed events. 69 * @timer: timer struct used for all delayed events.
68 * @link_work: &work_struct for doing FCF selection. 70 * @timer_work: &work_struct for doing keep-alives and resets.
69 * @recv_work: &work_struct for receiving FIP frames. 71 * @recv_work: &work_struct for receiving FIP frames.
70 * @fip_recv_list: list of received FIP frames. 72 * @fip_recv_list: list of received FIP frames.
71 * @user_mfs: configured maximum FC frame size, including FC header. 73 * @user_mfs: configured maximum FC frame size, including FC header.
72 * @flogi_oxid: exchange ID of most recent fabric login. 74 * @flogi_oxid: exchange ID of most recent fabric login.
73 * @flogi_count: number of FLOGI attempts in AUTO mode. 75 * @flogi_count: number of FLOGI attempts in AUTO mode.
74 * @link: current link status for libfc.
75 * @last_link: last link state reported to libfc.
76 * @map_dest: use the FC_MAP mode for destination MAC addresses. 76 * @map_dest: use the FC_MAP mode for destination MAC addresses.
77 * @spma: supports SPMA server-provided MACs mode 77 * @spma: supports SPMA server-provided MACs mode
78 * @send_ctlr_ka: need to send controller keep alive 78 * @send_ctlr_ka: need to send controller keep alive
@@ -100,14 +100,12 @@ struct fcoe_ctlr {
100 unsigned long port_ka_time; 100 unsigned long port_ka_time;
101 unsigned long ctlr_ka_time; 101 unsigned long ctlr_ka_time;
102 struct timer_list timer; 102 struct timer_list timer;
103 struct work_struct link_work; 103 struct work_struct timer_work;
104 struct work_struct recv_work; 104 struct work_struct recv_work;
105 struct sk_buff_head fip_recv_list; 105 struct sk_buff_head fip_recv_list;
106 u16 user_mfs; 106 u16 user_mfs;
107 u16 flogi_oxid; 107 u16 flogi_oxid;
108 u8 flogi_count; 108 u8 flogi_count;
109 u8 link;
110 u8 last_link;
111 u8 reset_req; 109 u8 reset_req;
112 u8 map_dest; 110 u8 map_dest;
113 u8 spma; 111 u8 spma;
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8b4deca996ad..9ae5c613131b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -114,6 +114,7 @@ struct scsi_cmnd;
114#define READ_12 0xa8 114#define READ_12 0xa8
115#define WRITE_12 0xaa 115#define WRITE_12 0xaa
116#define WRITE_VERIFY_12 0xae 116#define WRITE_VERIFY_12 0xae
117#define VERIFY_12 0xaf
117#define SEARCH_HIGH_12 0xb0 118#define SEARCH_HIGH_12 0xb0
118#define SEARCH_EQUAL_12 0xb1 119#define SEARCH_EQUAL_12 0xb1
119#define SEARCH_LOW_12 0xb2 120#define SEARCH_LOW_12 0xb2
@@ -134,6 +135,7 @@ struct scsi_cmnd;
134#define MO_SET_TARGET_PGS 0x0a 135#define MO_SET_TARGET_PGS 0x0a
135/* values for variable length command */ 136/* values for variable length command */
136#define READ_32 0x09 137#define READ_32 0x09
138#define VERIFY_32 0x0a
137#define WRITE_32 0x0b 139#define WRITE_32 0x0b
138#define WRITE_SAME_32 0x0d 140#define WRITE_SAME_32 0x0d
139 141
@@ -423,6 +425,7 @@ static inline int scsi_is_wlun(unsigned int lun)
423#define ADD_TO_MLQUEUE 0x2006 425#define ADD_TO_MLQUEUE 0x2006
424#define TIMEOUT_ERROR 0x2007 426#define TIMEOUT_ERROR 0x2007
425#define SCSI_RETURN_NOT_HANDLED 0x2008 427#define SCSI_RETURN_NOT_HANDLED 0x2008
428#define FAST_IO_FAIL 0x2009
426 429
427/* 430/*
428 * Midlevel queue return values. 431 * Midlevel queue return values.
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 8e86a94faf06..87d81b3ce564 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -807,6 +807,6 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel, 807struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
808 struct fc_vport_identifiers *); 808 struct fc_vport_identifiers *);
809int fc_vport_terminate(struct fc_vport *vport); 809int fc_vport_terminate(struct fc_vport *vport);
810void fc_block_scsi_eh(struct scsi_cmnd *cmnd); 810int fc_block_scsi_eh(struct scsi_cmnd *cmnd);
811 811
812#endif /* SCSI_TRANSPORT_FC_H */ 812#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 098595500632..9f1eecf99e6b 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -574,7 +574,7 @@ enum {
574#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 574#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
575 575
576struct snd_timer_id { 576struct snd_timer_id {
577 int dev_class; 577 int dev_class;
578 int dev_sclass; 578 int dev_sclass;
579 int card; 579 int card;
580 int device; 580 int device;
@@ -762,7 +762,7 @@ struct snd_ctl_elem_id {
762 snd_ctl_elem_iface_t iface; /* interface identifier */ 762 snd_ctl_elem_iface_t iface; /* interface identifier */
763 unsigned int device; /* device/client number */ 763 unsigned int device; /* device/client number */
764 unsigned int subdevice; /* subdevice (substream) number */ 764 unsigned int subdevice; /* subdevice (substream) number */
765 unsigned char name[44]; /* ASCII name of item */ 765 unsigned char name[44]; /* ASCII name of item */
766 unsigned int index; /* index of item */ 766 unsigned int index; /* index of item */
767}; 767};
768 768
@@ -809,7 +809,7 @@ struct snd_ctl_elem_info {
809struct snd_ctl_elem_value { 809struct snd_ctl_elem_value {
810 struct snd_ctl_elem_id id; /* W: element ID */ 810 struct snd_ctl_elem_id id; /* W: element ID */
811 unsigned int indirect: 1; /* W: indirect access - obsoleted */ 811 unsigned int indirect: 1; /* W: indirect access - obsoleted */
812 union { 812 union {
813 union { 813 union {
814 long value[128]; 814 long value[128];
815 long *value_ptr; /* obsoleted */ 815 long *value_ptr; /* obsoleted */
@@ -827,15 +827,15 @@ struct snd_ctl_elem_value {
827 unsigned char *data_ptr; /* obsoleted */ 827 unsigned char *data_ptr; /* obsoleted */
828 } bytes; 828 } bytes;
829 struct snd_aes_iec958 iec958; 829 struct snd_aes_iec958 iec958;
830 } value; /* RO */ 830 } value; /* RO */
831 struct timespec tstamp; 831 struct timespec tstamp;
832 unsigned char reserved[128-sizeof(struct timespec)]; 832 unsigned char reserved[128-sizeof(struct timespec)];
833}; 833};
834 834
835struct snd_ctl_tlv { 835struct snd_ctl_tlv {
836 unsigned int numid; /* control element numeric identification */ 836 unsigned int numid; /* control element numeric identification */
837 unsigned int length; /* in bytes aligned to 4 */ 837 unsigned int length; /* in bytes aligned to 4 */
838 unsigned int tlv[0]; /* first TLV */ 838 unsigned int tlv[0]; /* first TLV */
839}; 839};
840 840
841#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) 841#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
@@ -886,8 +886,8 @@ struct snd_ctl_event {
886 unsigned int mask; 886 unsigned int mask;
887 struct snd_ctl_elem_id id; 887 struct snd_ctl_elem_id id;
888 } elem; 888 } elem;
889 unsigned char data8[60]; 889 unsigned char data8[60];
890 } data; 890 } data;
891}; 891};
892 892
893/* 893/*
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 10fcf1465810..3ec7ecbe2502 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -44,7 +44,6 @@ struct snd_es1688 {
44 unsigned char pad; 44 unsigned char pad;
45 unsigned int dma_size; 45 unsigned int dma_size;
46 46
47 struct snd_card *card;
48 struct snd_pcm *pcm; 47 struct snd_pcm *pcm;
49 struct snd_pcm_substream *playback_substream; 48 struct snd_pcm_substream *playback_substream;
50 struct snd_pcm_substream *capture_substream; 49 struct snd_pcm_substream *capture_substream;
@@ -108,14 +107,16 @@ struct snd_es1688 {
108void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data); 107void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
109 108
110int snd_es1688_create(struct snd_card *card, 109int snd_es1688_create(struct snd_card *card,
110 struct snd_es1688 *chip,
111 unsigned long port, 111 unsigned long port,
112 unsigned long mpu_port, 112 unsigned long mpu_port,
113 int irq, 113 int irq,
114 int mpu_irq, 114 int mpu_irq,
115 int dma8, 115 int dma8,
116 unsigned short hardware, 116 unsigned short hardware);
117 struct snd_es1688 ** rchip); 117int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device,
118int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm); 118 struct snd_pcm **rpcm);
119int snd_es1688_mixer(struct snd_es1688 *chip); 119int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
120int snd_es1688_reset(struct snd_es1688 *chip);
120 121
121#endif /* __SOUND_ES1688_H */ 122#endif /* __SOUND_ES1688_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index 112e8949e1a7..4e94cf1ff762 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -51,18 +51,18 @@ struct snd_info_entry_ops {
51 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
52 int (*release)(struct snd_info_entry *entry, 52 int (*release)(struct snd_info_entry *entry,
53 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
54 long (*read)(struct snd_info_entry *entry, void *file_private_data, 54 ssize_t (*read)(struct snd_info_entry *entry, void *file_private_data,
55 struct file *file, char __user *buf, 55 struct file *file, char __user *buf,
56 unsigned long count, unsigned long pos); 56 size_t count, loff_t pos);
57 long (*write)(struct snd_info_entry *entry, void *file_private_data, 57 ssize_t (*write)(struct snd_info_entry *entry, void *file_private_data,
58 struct file *file, const char __user *buf, 58 struct file *file, const char __user *buf,
59 unsigned long count, unsigned long pos); 59 size_t count, loff_t pos);
60 long long (*llseek)(struct snd_info_entry *entry, 60 loff_t (*llseek)(struct snd_info_entry *entry,
61 void *file_private_data, struct file *file, 61 void *file_private_data, struct file *file,
62 long long offset, int orig); 62 loff_t offset, int orig);
63 unsigned int(*poll)(struct snd_info_entry *entry, 63 unsigned int (*poll)(struct snd_info_entry *entry,
64 void *file_private_data, struct file *file, 64 void *file_private_data, struct file *file,
65 poll_table *wait); 65 poll_table *wait);
66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data, 66 int (*ioctl)(struct snd_info_entry *entry, void *file_private_data,
67 struct file *file, unsigned int cmd, unsigned long arg); 67 struct file *file, unsigned int cmd, unsigned long arg);
68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data, 68 int (*mmap)(struct snd_info_entry *entry, void *file_private_data,
diff --git a/include/sound/jack.h b/include/sound/jack.h
index f236e426a706..d90b9fa32707 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -42,6 +42,11 @@ enum snd_jack_types {
42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */ 42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
43 SND_JACK_VIDEOOUT = 0x0010, 43 SND_JACK_VIDEOOUT = 0x0010,
44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT, 44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
45
46 /* Kept separate from switches to facilitate implementation */
47 SND_JACK_BTN_0 = 0x4000,
48 SND_JACK_BTN_1 = 0x2000,
49 SND_JACK_BTN_2 = 0x1000,
45}; 50};
46 51
47struct snd_jack { 52struct snd_jack {
@@ -50,6 +55,7 @@ struct snd_jack {
50 int type; 55 int type;
51 const char *id; 56 const char *id;
52 char name[100]; 57 char name[100];
58 unsigned int key[3]; /* Keep in sync with definitions above */
53 void *private_data; 59 void *private_data;
54 void (*private_free)(struct snd_jack *); 60 void (*private_free)(struct snd_jack *);
55}; 61};
@@ -59,6 +65,8 @@ struct snd_jack {
59int snd_jack_new(struct snd_card *card, const char *id, int type, 65int snd_jack_new(struct snd_card *card, const char *id, int type,
60 struct snd_jack **jack); 66 struct snd_jack **jack);
61void snd_jack_set_parent(struct snd_jack *jack, struct device *parent); 67void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
68int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
69 int keytype);
62 70
63void snd_jack_report(struct snd_jack *jack, int status); 71void snd_jack_report(struct snd_jack *jack, int status);
64 72
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 8b611a561985..dd76cdede64d 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -29,6 +29,7 @@
29#include <linux/poll.h> 29#include <linux/poll.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/pm_qos_params.h>
32 33
33#define snd_pcm_substream_chip(substream) ((substream)->private_data) 34#define snd_pcm_substream_chip(substream) ((substream)->private_data)
34#define snd_pcm_chip(pcm) ((pcm)->private_data) 35#define snd_pcm_chip(pcm) ((pcm)->private_data)
@@ -365,7 +366,7 @@ struct snd_pcm_substream {
365 int number; 366 int number;
366 char name[32]; /* substream name */ 367 char name[32]; /* substream name */
367 int stream; /* stream (direction) */ 368 int stream; /* stream (direction) */
368 char latency_id[20]; /* latency identifier */ 369 struct pm_qos_request_list *latency_pm_qos_req; /* pm_qos request */
369 size_t buffer_bytes_max; /* limit ring buffer size */ 370 size_t buffer_bytes_max; /* limit ring buffer size */
370 struct snd_dma_buffer dma_buffer; 371 struct snd_dma_buffer dma_buffer;
371 unsigned int dma_buf_id; 372 unsigned int dma_buf_id;
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 0a0b019d41ad..377693a14385 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -182,6 +182,12 @@ struct snd_soc_dai_ops {
182 struct snd_soc_dai *); 182 struct snd_soc_dai *);
183 int (*trigger)(struct snd_pcm_substream *, int, 183 int (*trigger)(struct snd_pcm_substream *, int,
184 struct snd_soc_dai *); 184 struct snd_soc_dai *);
185 /*
186 * For hardware based FIFO caused delay reporting.
187 * Optional.
188 */
189 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
190 struct snd_soc_dai *);
185}; 191};
186 192
187/* 193/*
@@ -215,7 +221,6 @@ struct snd_soc_dai {
215 unsigned int symmetric_rates:1; 221 unsigned int symmetric_rates:1;
216 222
217 /* DAI runtime info */ 223 /* DAI runtime info */
218 struct snd_pcm_runtime *runtime;
219 struct snd_soc_codec *codec; 224 struct snd_soc_codec *codec;
220 unsigned int active; 225 unsigned int active;
221 unsigned char pop_wait:1; 226 unsigned char pop_wait:1;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c0922a034223..66ff4c124dbd 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -339,6 +339,9 @@ int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
339int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); 339int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
340int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); 340int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
341int snd_soc_dapm_sync(struct snd_soc_codec *codec); 341int snd_soc_dapm_sync(struct snd_soc_codec *codec);
342int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec,
343 const char *pin);
344int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin);
342 345
343/* dapm widget types */ 346/* dapm widget types */
344enum snd_soc_dapm_type { 347enum snd_soc_dapm_type {
@@ -425,9 +428,8 @@ struct snd_soc_dapm_widget {
425 unsigned char connected:1; /* connected codec pin */ 428 unsigned char connected:1; /* connected codec pin */
426 unsigned char new:1; /* cnew complete */ 429 unsigned char new:1; /* cnew complete */
427 unsigned char ext:1; /* has external widgets */ 430 unsigned char ext:1; /* has external widgets */
428 unsigned char muted:1; /* muted for pop reduction */ 431 unsigned char force:1; /* force state */
429 unsigned char suspend:1; /* was active before suspend */ 432 unsigned char ignore_suspend:1; /* kept enabled over suspend */
430 unsigned char pmdown:1; /* waiting for timeout */
431 433
432 int (*power_check)(struct snd_soc_dapm_widget *w); 434 int (*power_check)(struct snd_soc_dapm_widget *w);
433 435
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a57fbfcd4c8f..697e7ffe39d7 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/notifier.h>
18#include <linux/workqueue.h> 19#include <linux/workqueue.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -29,10 +30,10 @@
29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ 30#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30 ((unsigned long)&(struct soc_mixer_control) \ 31 ((unsigned long)&(struct soc_mixer_control) \
31 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \ 32 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
32 .invert = xinvert}) 33 .platform_max = xmax, .invert = xinvert})
33#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 34#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
34 ((unsigned long)&(struct soc_mixer_control) \ 35 ((unsigned long)&(struct soc_mixer_control) \
35 {.reg = xreg, .max = xmax, .invert = xinvert}) 36 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
36#define SOC_SINGLE(xname, reg, shift, max, invert) \ 37#define SOC_SINGLE(xname, reg, shift, max, invert) \
37{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 38{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
38 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 39 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
@@ -52,14 +53,14 @@
52 .put = snd_soc_put_volsw, \ 53 .put = snd_soc_put_volsw, \
53 .private_value = (unsigned long)&(struct soc_mixer_control) \ 54 .private_value = (unsigned long)&(struct soc_mixer_control) \
54 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 55 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
55 .max = xmax, .invert = xinvert} } 56 .max = xmax, .platform_max = xmax, .invert = xinvert} }
56#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ 57#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
57{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 58{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
58 .info = snd_soc_info_volsw_2r, \ 59 .info = snd_soc_info_volsw_2r, \
59 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 60 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
60 .private_value = (unsigned long)&(struct soc_mixer_control) \ 61 .private_value = (unsigned long)&(struct soc_mixer_control) \
61 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 62 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
62 .max = xmax, .invert = xinvert} } 63 .max = xmax, .platform_max = xmax, .invert = xinvert} }
63#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ 64#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
64{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 65{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
65 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 66 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -69,7 +70,7 @@
69 .put = snd_soc_put_volsw, \ 70 .put = snd_soc_put_volsw, \
70 .private_value = (unsigned long)&(struct soc_mixer_control) \ 71 .private_value = (unsigned long)&(struct soc_mixer_control) \
71 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ 72 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
72 .max = xmax, .invert = xinvert} } 73 .max = xmax, .platform_max = xmax, .invert = xinvert} }
73#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 74#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
74{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 75{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
75 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 76 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -79,7 +80,7 @@
79 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 80 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
80 .private_value = (unsigned long)&(struct soc_mixer_control) \ 81 .private_value = (unsigned long)&(struct soc_mixer_control) \
81 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 82 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
82 .max = xmax, .invert = xinvert} } 83 .max = xmax, .platform_max = xmax, .invert = xinvert} }
83#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 84#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
84{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 85{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
85 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 86 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -88,7 +89,8 @@
88 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 89 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
89 .put = snd_soc_put_volsw_s8, \ 90 .put = snd_soc_put_volsw_s8, \
90 .private_value = (unsigned long)&(struct soc_mixer_control) \ 91 .private_value = (unsigned long)&(struct soc_mixer_control) \
91 {.reg = xreg, .min = xmin, .max = xmax} } 92 {.reg = xreg, .min = xmin, .max = xmax, \
93 .platform_max = xmax} }
92#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 94#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
93{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 95{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
94 .max = xmax, .texts = xtexts } 96 .max = xmax, .texts = xtexts }
@@ -125,7 +127,7 @@
125 .get = xhandler_get, .put = xhandler_put, \ 127 .get = xhandler_get, .put = xhandler_put, \
126 .private_value = (unsigned long)&(struct soc_mixer_control) \ 128 .private_value = (unsigned long)&(struct soc_mixer_control) \
127 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 129 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
128 .max = xmax, .invert = xinvert} } 130 .max = xmax, .platform_max = xmax, .invert = xinvert} }
129#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 131#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
130 xhandler_get, xhandler_put, tlv_array) \ 132 xhandler_get, xhandler_put, tlv_array) \
131{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 133{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -145,7 +147,7 @@
145 .get = xhandler_get, .put = xhandler_put, \ 147 .get = xhandler_get, .put = xhandler_put, \
146 .private_value = (unsigned long)&(struct soc_mixer_control) \ 148 .private_value = (unsigned long)&(struct soc_mixer_control) \
147 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 149 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
148 .max = xmax, .invert = xinvert} } 150 .max = xmax, .platform_max = xmax, .invert = xinvert} }
149#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 151#define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
150 xhandler_get, xhandler_put, tlv_array) \ 152 xhandler_get, xhandler_put, tlv_array) \
151{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 153{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -156,7 +158,7 @@
156 .get = xhandler_get, .put = xhandler_put, \ 158 .get = xhandler_get, .put = xhandler_put, \
157 .private_value = (unsigned long)&(struct soc_mixer_control) \ 159 .private_value = (unsigned long)&(struct soc_mixer_control) \
158 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 160 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
159 .max = xmax, .invert = xinvert} } 161 .max = xmax, .platform_max = xmax, .invert = xinvert} }
160#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 162#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
161{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 163{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
162 .info = snd_soc_info_bool_ext, \ 164 .info = snd_soc_info_bool_ext, \
@@ -212,6 +214,7 @@ struct snd_soc_dai_mode;
212struct snd_soc_pcm_runtime; 214struct snd_soc_pcm_runtime;
213struct snd_soc_dai; 215struct snd_soc_dai;
214struct snd_soc_platform; 216struct snd_soc_platform;
217struct snd_soc_dai_link;
215struct snd_soc_codec; 218struct snd_soc_codec;
216struct soc_enum; 219struct soc_enum;
217struct snd_soc_ac97_ops; 220struct snd_soc_ac97_ops;
@@ -260,6 +263,10 @@ int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
260void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 263void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
261int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 264int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
262 struct snd_soc_jack_pin *pins); 265 struct snd_soc_jack_pin *pins);
266void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
267 struct notifier_block *nb);
268void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
269 struct notifier_block *nb);
263#ifdef CONFIG_GPIOLIB 270#ifdef CONFIG_GPIOLIB
264int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 271int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
265 struct snd_soc_jack_gpio *gpios); 272 struct snd_soc_jack_gpio *gpios);
@@ -320,6 +327,8 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
320 struct snd_ctl_elem_value *ucontrol); 327 struct snd_ctl_elem_value *ucontrol);
321int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 328int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
322 struct snd_ctl_elem_value *ucontrol); 329 struct snd_ctl_elem_value *ucontrol);
330int snd_soc_limit_volume(struct snd_soc_codec *codec,
331 const char *name, int max);
323 332
324/** 333/**
325 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection 334 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
@@ -363,6 +372,7 @@ struct snd_soc_jack {
363 struct snd_soc_card *card; 372 struct snd_soc_card *card;
364 struct list_head pins; 373 struct list_head pins;
365 int status; 374 int status;
375 struct blocking_notifier_head notifier;
366}; 376};
367 377
368/* SoC PCM stream information */ 378/* SoC PCM stream information */
@@ -374,7 +384,7 @@ struct snd_soc_pcm_stream {
374 unsigned int rate_max; /* max rate */ 384 unsigned int rate_max; /* max rate */
375 unsigned int channels_min; /* min channels */ 385 unsigned int channels_min; /* min channels */
376 unsigned int channels_max; /* max channels */ 386 unsigned int channels_max; /* max channels */
377 unsigned int active:1; /* stream is in use */ 387 unsigned int active; /* stream is in use */
378 void *dma_data; /* used by platform code */ 388 void *dma_data; /* used by platform code */
379}; 389};
380 390
@@ -407,7 +417,7 @@ struct snd_soc_codec {
407 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 417 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
408 unsigned int active; 418 unsigned int active;
409 unsigned int pcm_devs; 419 unsigned int pcm_devs;
410 void *private_data; 420 void *drvdata;
411 421
412 /* codec IO */ 422 /* codec IO */
413 void *control_data; /* codec control (i2c/3wire) data */ 423 void *control_data; /* codec control (i2c/3wire) data */
@@ -462,14 +472,21 @@ struct snd_soc_platform {
462 472
463 int (*probe)(struct platform_device *pdev); 473 int (*probe)(struct platform_device *pdev);
464 int (*remove)(struct platform_device *pdev); 474 int (*remove)(struct platform_device *pdev);
465 int (*suspend)(struct snd_soc_dai *dai); 475 int (*suspend)(struct snd_soc_dai_link *dai_link);
466 int (*resume)(struct snd_soc_dai *dai); 476 int (*resume)(struct snd_soc_dai_link *dai_link);
467 477
468 /* pcm creation and destruction */ 478 /* pcm creation and destruction */
469 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 479 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
470 struct snd_pcm *); 480 struct snd_pcm *);
471 void (*pcm_free)(struct snd_pcm *); 481 void (*pcm_free)(struct snd_pcm *);
472 482
483 /*
484 * For platform caused delay reporting.
485 * Optional.
486 */
487 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
488 struct snd_soc_dai *);
489
473 /* platform stream ops */ 490 /* platform stream ops */
474 struct snd_pcm_ops *pcm_ops; 491 struct snd_pcm_ops *pcm_ops;
475}; 492};
@@ -489,6 +506,9 @@ struct snd_soc_dai_link {
489 /* codec/machine specific init - e.g. add machine controls */ 506 /* codec/machine specific init - e.g. add machine controls */
490 int (*init)(struct snd_soc_codec *codec); 507 int (*init)(struct snd_soc_codec *codec);
491 508
509 /* Keep DAI active over suspend */
510 unsigned int ignore_suspend:1;
511
492 /* Symmetry requirements */ 512 /* Symmetry requirements */
493 unsigned int symmetric_rates:1; 513 unsigned int symmetric_rates:1;
494 514
@@ -553,7 +573,7 @@ struct snd_soc_pcm_runtime {
553 573
554/* mixer control */ 574/* mixer control */
555struct soc_mixer_control { 575struct soc_mixer_control {
556 int min, max; 576 int min, max, platform_max;
557 unsigned int reg, rreg, shift, rshift, invert; 577 unsigned int reg, rreg, shift, rshift, invert;
558}; 578};
559 579
@@ -583,6 +603,17 @@ static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
583 return codec->write(codec, reg, val); 603 return codec->write(codec, reg, val);
584} 604}
585 605
606static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
607 void *data)
608{
609 codec->drvdata = data;
610}
611
612static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
613{
614 return codec->drvdata;
615}
616
586#include <sound/soc-dai.h> 617#include <sound/soc-dai.h>
587 618
588#endif 619#endif
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h
new file mode 100644
index 000000000000..b1a5f34e5cfa
--- /dev/null
+++ b/include/sound/tlv320aic3x.h
@@ -0,0 +1,17 @@
1/*
2 * Platform data for Texas Instruments TLV320AIC3x codec
3 *
4 * Author: Jarkko Nikula <jhnikula@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __TLV320AIC3x_H__
11#define __TLV320AIC3x_H__
12
13struct aic3x_pdata {
14 int gpio_reset; /* < 0 if not used */
15};
16
17#endif \ No newline at end of file
diff --git a/include/sound/tlv320dac33-plat.h b/include/sound/tlv320dac33-plat.h
index ac0665264bdf..3f428d53195b 100644
--- a/include/sound/tlv320dac33-plat.h
+++ b/include/sound/tlv320dac33-plat.h
@@ -15,6 +15,7 @@
15 15
16struct tlv320dac33_platform_data { 16struct tlv320dac33_platform_data {
17 int power_gpio; 17 int power_gpio;
18 int keep_bclk; /* Keep the BCLK running in FIFO modes */
18 u8 burst_bclkdiv; 19 u8 burst_bclkdiv;
19}; 20};
20 21
diff --git a/include/sound/uda134x.h b/include/sound/uda134x.h
index 475ef8bb7dcd..509efb050176 100644
--- a/include/sound/uda134x.h
+++ b/include/sound/uda134x.h
@@ -21,6 +21,7 @@ struct uda134x_platform_data {
21#define UDA134X_UDA1340 1 21#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2 22#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3 23#define UDA134X_UDA1344 3
24#define UDA134X_UDA1345 4
24}; 25};
25 26
26#endif /* _UDA134X_H */ 27#endif /* _UDA134X_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index 7fed23442db8..bf69a5b7e65f 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.22.1" 2#define CONFIG_SND_VERSION "1.0.23"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
new file mode 100644
index 000000000000..b4a0db2307ef
--- /dev/null
+++ b/include/sound/wm8903.h
@@ -0,0 +1,249 @@
1/*
2 * linux/sound/wm8903.h -- Platform data for WM8903
3 *
4 * Copyright 2010 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM8903_H
12#define __LINUX_SND_WM8903_H
13
14/* Used to enable configuration of a GPIO to all zeros */
15#define WM8903_GPIO_NO_CONFIG 0x8000
16
17/*
18 * R6 (0x06) - Mic Bias Control 0
19 */
20#define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */
21#define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */
22#define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */
23#define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */
24#define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
25#define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
26#define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
27#define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
28#define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
29#define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
30#define WM8903_MICDET_ENA 0x0002 /* MICDET_ENA */
31#define WM8903_MICDET_ENA_MASK 0x0002 /* MICDET_ENA */
32#define WM8903_MICDET_ENA_SHIFT 1 /* MICDET_ENA */
33#define WM8903_MICDET_ENA_WIDTH 1 /* MICDET_ENA */
34#define WM8903_MICBIAS_ENA 0x0001 /* MICBIAS_ENA */
35#define WM8903_MICBIAS_ENA_MASK 0x0001 /* MICBIAS_ENA */
36#define WM8903_MICBIAS_ENA_SHIFT 0 /* MICBIAS_ENA */
37#define WM8903_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
38
39/*
40 * R116 (0x74) - GPIO Control 1
41 */
42#define WM8903_GP1_FN_MASK 0x1F00 /* GP1_FN - [12:8] */
43#define WM8903_GP1_FN_SHIFT 8 /* GP1_FN - [12:8] */
44#define WM8903_GP1_FN_WIDTH 5 /* GP1_FN - [12:8] */
45#define WM8903_GP1_DIR 0x0080 /* GP1_DIR */
46#define WM8903_GP1_DIR_MASK 0x0080 /* GP1_DIR */
47#define WM8903_GP1_DIR_SHIFT 7 /* GP1_DIR */
48#define WM8903_GP1_DIR_WIDTH 1 /* GP1_DIR */
49#define WM8903_GP1_OP_CFG 0x0040 /* GP1_OP_CFG */
50#define WM8903_GP1_OP_CFG_MASK 0x0040 /* GP1_OP_CFG */
51#define WM8903_GP1_OP_CFG_SHIFT 6 /* GP1_OP_CFG */
52#define WM8903_GP1_OP_CFG_WIDTH 1 /* GP1_OP_CFG */
53#define WM8903_GP1_IP_CFG 0x0020 /* GP1_IP_CFG */
54#define WM8903_GP1_IP_CFG_MASK 0x0020 /* GP1_IP_CFG */
55#define WM8903_GP1_IP_CFG_SHIFT 5 /* GP1_IP_CFG */
56#define WM8903_GP1_IP_CFG_WIDTH 1 /* GP1_IP_CFG */
57#define WM8903_GP1_LVL 0x0010 /* GP1_LVL */
58#define WM8903_GP1_LVL_MASK 0x0010 /* GP1_LVL */
59#define WM8903_GP1_LVL_SHIFT 4 /* GP1_LVL */
60#define WM8903_GP1_LVL_WIDTH 1 /* GP1_LVL */
61#define WM8903_GP1_PD 0x0008 /* GP1_PD */
62#define WM8903_GP1_PD_MASK 0x0008 /* GP1_PD */
63#define WM8903_GP1_PD_SHIFT 3 /* GP1_PD */
64#define WM8903_GP1_PD_WIDTH 1 /* GP1_PD */
65#define WM8903_GP1_PU 0x0004 /* GP1_PU */
66#define WM8903_GP1_PU_MASK 0x0004 /* GP1_PU */
67#define WM8903_GP1_PU_SHIFT 2 /* GP1_PU */
68#define WM8903_GP1_PU_WIDTH 1 /* GP1_PU */
69#define WM8903_GP1_INTMODE 0x0002 /* GP1_INTMODE */
70#define WM8903_GP1_INTMODE_MASK 0x0002 /* GP1_INTMODE */
71#define WM8903_GP1_INTMODE_SHIFT 1 /* GP1_INTMODE */
72#define WM8903_GP1_INTMODE_WIDTH 1 /* GP1_INTMODE */
73#define WM8903_GP1_DB 0x0001 /* GP1_DB */
74#define WM8903_GP1_DB_MASK 0x0001 /* GP1_DB */
75#define WM8903_GP1_DB_SHIFT 0 /* GP1_DB */
76#define WM8903_GP1_DB_WIDTH 1 /* GP1_DB */
77
78/*
79 * R117 (0x75) - GPIO Control 2
80 */
81#define WM8903_GP2_FN_MASK 0x1F00 /* GP2_FN - [12:8] */
82#define WM8903_GP2_FN_SHIFT 8 /* GP2_FN - [12:8] */
83#define WM8903_GP2_FN_WIDTH 5 /* GP2_FN - [12:8] */
84#define WM8903_GP2_DIR 0x0080 /* GP2_DIR */
85#define WM8903_GP2_DIR_MASK 0x0080 /* GP2_DIR */
86#define WM8903_GP2_DIR_SHIFT 7 /* GP2_DIR */
87#define WM8903_GP2_DIR_WIDTH 1 /* GP2_DIR */
88#define WM8903_GP2_OP_CFG 0x0040 /* GP2_OP_CFG */
89#define WM8903_GP2_OP_CFG_MASK 0x0040 /* GP2_OP_CFG */
90#define WM8903_GP2_OP_CFG_SHIFT 6 /* GP2_OP_CFG */
91#define WM8903_GP2_OP_CFG_WIDTH 1 /* GP2_OP_CFG */
92#define WM8903_GP2_IP_CFG 0x0020 /* GP2_IP_CFG */
93#define WM8903_GP2_IP_CFG_MASK 0x0020 /* GP2_IP_CFG */
94#define WM8903_GP2_IP_CFG_SHIFT 5 /* GP2_IP_CFG */
95#define WM8903_GP2_IP_CFG_WIDTH 1 /* GP2_IP_CFG */
96#define WM8903_GP2_LVL 0x0010 /* GP2_LVL */
97#define WM8903_GP2_LVL_MASK 0x0010 /* GP2_LVL */
98#define WM8903_GP2_LVL_SHIFT 4 /* GP2_LVL */
99#define WM8903_GP2_LVL_WIDTH 1 /* GP2_LVL */
100#define WM8903_GP2_PD 0x0008 /* GP2_PD */
101#define WM8903_GP2_PD_MASK 0x0008 /* GP2_PD */
102#define WM8903_GP2_PD_SHIFT 3 /* GP2_PD */
103#define WM8903_GP2_PD_WIDTH 1 /* GP2_PD */
104#define WM8903_GP2_PU 0x0004 /* GP2_PU */
105#define WM8903_GP2_PU_MASK 0x0004 /* GP2_PU */
106#define WM8903_GP2_PU_SHIFT 2 /* GP2_PU */
107#define WM8903_GP2_PU_WIDTH 1 /* GP2_PU */
108#define WM8903_GP2_INTMODE 0x0002 /* GP2_INTMODE */
109#define WM8903_GP2_INTMODE_MASK 0x0002 /* GP2_INTMODE */
110#define WM8903_GP2_INTMODE_SHIFT 1 /* GP2_INTMODE */
111#define WM8903_GP2_INTMODE_WIDTH 1 /* GP2_INTMODE */
112#define WM8903_GP2_DB 0x0001 /* GP2_DB */
113#define WM8903_GP2_DB_MASK 0x0001 /* GP2_DB */
114#define WM8903_GP2_DB_SHIFT 0 /* GP2_DB */
115#define WM8903_GP2_DB_WIDTH 1 /* GP2_DB */
116
117/*
118 * R118 (0x76) - GPIO Control 3
119 */
120#define WM8903_GP3_FN_MASK 0x1F00 /* GP3_FN - [12:8] */
121#define WM8903_GP3_FN_SHIFT 8 /* GP3_FN - [12:8] */
122#define WM8903_GP3_FN_WIDTH 5 /* GP3_FN - [12:8] */
123#define WM8903_GP3_DIR 0x0080 /* GP3_DIR */
124#define WM8903_GP3_DIR_MASK 0x0080 /* GP3_DIR */
125#define WM8903_GP3_DIR_SHIFT 7 /* GP3_DIR */
126#define WM8903_GP3_DIR_WIDTH 1 /* GP3_DIR */
127#define WM8903_GP3_OP_CFG 0x0040 /* GP3_OP_CFG */
128#define WM8903_GP3_OP_CFG_MASK 0x0040 /* GP3_OP_CFG */
129#define WM8903_GP3_OP_CFG_SHIFT 6 /* GP3_OP_CFG */
130#define WM8903_GP3_OP_CFG_WIDTH 1 /* GP3_OP_CFG */
131#define WM8903_GP3_IP_CFG 0x0020 /* GP3_IP_CFG */
132#define WM8903_GP3_IP_CFG_MASK 0x0020 /* GP3_IP_CFG */
133#define WM8903_GP3_IP_CFG_SHIFT 5 /* GP3_IP_CFG */
134#define WM8903_GP3_IP_CFG_WIDTH 1 /* GP3_IP_CFG */
135#define WM8903_GP3_LVL 0x0010 /* GP3_LVL */
136#define WM8903_GP3_LVL_MASK 0x0010 /* GP3_LVL */
137#define WM8903_GP3_LVL_SHIFT 4 /* GP3_LVL */
138#define WM8903_GP3_LVL_WIDTH 1 /* GP3_LVL */
139#define WM8903_GP3_PD 0x0008 /* GP3_PD */
140#define WM8903_GP3_PD_MASK 0x0008 /* GP3_PD */
141#define WM8903_GP3_PD_SHIFT 3 /* GP3_PD */
142#define WM8903_GP3_PD_WIDTH 1 /* GP3_PD */
143#define WM8903_GP3_PU 0x0004 /* GP3_PU */
144#define WM8903_GP3_PU_MASK 0x0004 /* GP3_PU */
145#define WM8903_GP3_PU_SHIFT 2 /* GP3_PU */
146#define WM8903_GP3_PU_WIDTH 1 /* GP3_PU */
147#define WM8903_GP3_INTMODE 0x0002 /* GP3_INTMODE */
148#define WM8903_GP3_INTMODE_MASK 0x0002 /* GP3_INTMODE */
149#define WM8903_GP3_INTMODE_SHIFT 1 /* GP3_INTMODE */
150#define WM8903_GP3_INTMODE_WIDTH 1 /* GP3_INTMODE */
151#define WM8903_GP3_DB 0x0001 /* GP3_DB */
152#define WM8903_GP3_DB_MASK 0x0001 /* GP3_DB */
153#define WM8903_GP3_DB_SHIFT 0 /* GP3_DB */
154#define WM8903_GP3_DB_WIDTH 1 /* GP3_DB */
155
156/*
157 * R119 (0x77) - GPIO Control 4
158 */
159#define WM8903_GP4_FN_MASK 0x1F00 /* GP4_FN - [12:8] */
160#define WM8903_GP4_FN_SHIFT 8 /* GP4_FN - [12:8] */
161#define WM8903_GP4_FN_WIDTH 5 /* GP4_FN - [12:8] */
162#define WM8903_GP4_DIR 0x0080 /* GP4_DIR */
163#define WM8903_GP4_DIR_MASK 0x0080 /* GP4_DIR */
164#define WM8903_GP4_DIR_SHIFT 7 /* GP4_DIR */
165#define WM8903_GP4_DIR_WIDTH 1 /* GP4_DIR */
166#define WM8903_GP4_OP_CFG 0x0040 /* GP4_OP_CFG */
167#define WM8903_GP4_OP_CFG_MASK 0x0040 /* GP4_OP_CFG */
168#define WM8903_GP4_OP_CFG_SHIFT 6 /* GP4_OP_CFG */
169#define WM8903_GP4_OP_CFG_WIDTH 1 /* GP4_OP_CFG */
170#define WM8903_GP4_IP_CFG 0x0020 /* GP4_IP_CFG */
171#define WM8903_GP4_IP_CFG_MASK 0x0020 /* GP4_IP_CFG */
172#define WM8903_GP4_IP_CFG_SHIFT 5 /* GP4_IP_CFG */
173#define WM8903_GP4_IP_CFG_WIDTH 1 /* GP4_IP_CFG */
174#define WM8903_GP4_LVL 0x0010 /* GP4_LVL */
175#define WM8903_GP4_LVL_MASK 0x0010 /* GP4_LVL */
176#define WM8903_GP4_LVL_SHIFT 4 /* GP4_LVL */
177#define WM8903_GP4_LVL_WIDTH 1 /* GP4_LVL */
178#define WM8903_GP4_PD 0x0008 /* GP4_PD */
179#define WM8903_GP4_PD_MASK 0x0008 /* GP4_PD */
180#define WM8903_GP4_PD_SHIFT 3 /* GP4_PD */
181#define WM8903_GP4_PD_WIDTH 1 /* GP4_PD */
182#define WM8903_GP4_PU 0x0004 /* GP4_PU */
183#define WM8903_GP4_PU_MASK 0x0004 /* GP4_PU */
184#define WM8903_GP4_PU_SHIFT 2 /* GP4_PU */
185#define WM8903_GP4_PU_WIDTH 1 /* GP4_PU */
186#define WM8903_GP4_INTMODE 0x0002 /* GP4_INTMODE */
187#define WM8903_GP4_INTMODE_MASK 0x0002 /* GP4_INTMODE */
188#define WM8903_GP4_INTMODE_SHIFT 1 /* GP4_INTMODE */
189#define WM8903_GP4_INTMODE_WIDTH 1 /* GP4_INTMODE */
190#define WM8903_GP4_DB 0x0001 /* GP4_DB */
191#define WM8903_GP4_DB_MASK 0x0001 /* GP4_DB */
192#define WM8903_GP4_DB_SHIFT 0 /* GP4_DB */
193#define WM8903_GP4_DB_WIDTH 1 /* GP4_DB */
194
195/*
196 * R120 (0x78) - GPIO Control 5
197 */
198#define WM8903_GP5_FN_MASK 0x1F00 /* GP5_FN - [12:8] */
199#define WM8903_GP5_FN_SHIFT 8 /* GP5_FN - [12:8] */
200#define WM8903_GP5_FN_WIDTH 5 /* GP5_FN - [12:8] */
201#define WM8903_GP5_DIR 0x0080 /* GP5_DIR */
202#define WM8903_GP5_DIR_MASK 0x0080 /* GP5_DIR */
203#define WM8903_GP5_DIR_SHIFT 7 /* GP5_DIR */
204#define WM8903_GP5_DIR_WIDTH 1 /* GP5_DIR */
205#define WM8903_GP5_OP_CFG 0x0040 /* GP5_OP_CFG */
206#define WM8903_GP5_OP_CFG_MASK 0x0040 /* GP5_OP_CFG */
207#define WM8903_GP5_OP_CFG_SHIFT 6 /* GP5_OP_CFG */
208#define WM8903_GP5_OP_CFG_WIDTH 1 /* GP5_OP_CFG */
209#define WM8903_GP5_IP_CFG 0x0020 /* GP5_IP_CFG */
210#define WM8903_GP5_IP_CFG_MASK 0x0020 /* GP5_IP_CFG */
211#define WM8903_GP5_IP_CFG_SHIFT 5 /* GP5_IP_CFG */
212#define WM8903_GP5_IP_CFG_WIDTH 1 /* GP5_IP_CFG */
213#define WM8903_GP5_LVL 0x0010 /* GP5_LVL */
214#define WM8903_GP5_LVL_MASK 0x0010 /* GP5_LVL */
215#define WM8903_GP5_LVL_SHIFT 4 /* GP5_LVL */
216#define WM8903_GP5_LVL_WIDTH 1 /* GP5_LVL */
217#define WM8903_GP5_PD 0x0008 /* GP5_PD */
218#define WM8903_GP5_PD_MASK 0x0008 /* GP5_PD */
219#define WM8903_GP5_PD_SHIFT 3 /* GP5_PD */
220#define WM8903_GP5_PD_WIDTH 1 /* GP5_PD */
221#define WM8903_GP5_PU 0x0004 /* GP5_PU */
222#define WM8903_GP5_PU_MASK 0x0004 /* GP5_PU */
223#define WM8903_GP5_PU_SHIFT 2 /* GP5_PU */
224#define WM8903_GP5_PU_WIDTH 1 /* GP5_PU */
225#define WM8903_GP5_INTMODE 0x0002 /* GP5_INTMODE */
226#define WM8903_GP5_INTMODE_MASK 0x0002 /* GP5_INTMODE */
227#define WM8903_GP5_INTMODE_SHIFT 1 /* GP5_INTMODE */
228#define WM8903_GP5_INTMODE_WIDTH 1 /* GP5_INTMODE */
229#define WM8903_GP5_DB 0x0001 /* GP5_DB */
230#define WM8903_GP5_DB_MASK 0x0001 /* GP5_DB */
231#define WM8903_GP5_DB_SHIFT 0 /* GP5_DB */
232#define WM8903_GP5_DB_WIDTH 1 /* GP5_DB */
233
234struct wm8903_platform_data {
235 bool irq_active_low; /* Set if IRQ active low, default high */
236
237 /* Default register value for R6 (Mic bias), used to configure
238 * microphone detection. In conjunction with gpio_cfg this
239 * can be used to route the microphone status signals out onto
240 * the GPIOs for use with snd_soc_jack_add_gpios().
241 */
242 u16 micdet_cfg;
243
244 int micdet_delay; /* Delay after microphone detection (ms) */
245
246 u32 gpio_cfg[5]; /* Default register values for GPIO pin mux */
247};
248
249#endif
diff --git a/include/sound/wm8904.h b/include/sound/wm8904.h
index d66575a601be..898be3a8db9a 100644
--- a/include/sound/wm8904.h
+++ b/include/sound/wm8904.h
@@ -15,8 +15,111 @@
15#ifndef __MFD_WM8994_PDATA_H__ 15#ifndef __MFD_WM8994_PDATA_H__
16#define __MFD_WM8994_PDATA_H__ 16#define __MFD_WM8994_PDATA_H__
17 17
18#define WM8904_DRC_REGS 4 18/* Used to enable configuration of a GPIO to all zeros */
19#define WM8904_EQ_REGS 25 19#define WM8904_GPIO_NO_CONFIG 0x8000
20
21/*
22 * R6 (0x06) - Mic Bias Control 0
23 */
24#define WM8904_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */
25#define WM8904_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */
26#define WM8904_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */
27#define WM8904_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */
28#define WM8904_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */
29#define WM8904_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */
30#define WM8904_MICDET_ENA 0x0002 /* MICDET_ENA */
31#define WM8904_MICDET_ENA_MASK 0x0002 /* MICDET_ENA */
32#define WM8904_MICDET_ENA_SHIFT 1 /* MICDET_ENA */
33#define WM8904_MICDET_ENA_WIDTH 1 /* MICDET_ENA */
34#define WM8904_MICBIAS_ENA 0x0001 /* MICBIAS_ENA */
35#define WM8904_MICBIAS_ENA_MASK 0x0001 /* MICBIAS_ENA */
36#define WM8904_MICBIAS_ENA_SHIFT 0 /* MICBIAS_ENA */
37#define WM8904_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
38
39/*
40 * R7 (0x07) - Mic Bias Control 1
41 */
42#define WM8904_MIC_DET_FILTER_ENA 0x8000 /* MIC_DET_FILTER_ENA */
43#define WM8904_MIC_DET_FILTER_ENA_MASK 0x8000 /* MIC_DET_FILTER_ENA */
44#define WM8904_MIC_DET_FILTER_ENA_SHIFT 15 /* MIC_DET_FILTER_ENA */
45#define WM8904_MIC_DET_FILTER_ENA_WIDTH 1 /* MIC_DET_FILTER_ENA */
46#define WM8904_MIC_SHORT_FILTER_ENA 0x4000 /* MIC_SHORT_FILTER_ENA */
47#define WM8904_MIC_SHORT_FILTER_ENA_MASK 0x4000 /* MIC_SHORT_FILTER_ENA */
48#define WM8904_MIC_SHORT_FILTER_ENA_SHIFT 14 /* MIC_SHORT_FILTER_ENA */
49#define WM8904_MIC_SHORT_FILTER_ENA_WIDTH 1 /* MIC_SHORT_FILTER_ENA */
50#define WM8904_MICBIAS_SEL_MASK 0x0007 /* MICBIAS_SEL - [2:0] */
51#define WM8904_MICBIAS_SEL_SHIFT 0 /* MICBIAS_SEL - [2:0] */
52#define WM8904_MICBIAS_SEL_WIDTH 3 /* MICBIAS_SEL - [2:0] */
53
54
55/*
56 * R121 (0x79) - GPIO Control 1
57 */
58#define WM8904_GPIO1_PU 0x0020 /* GPIO1_PU */
59#define WM8904_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */
60#define WM8904_GPIO1_PU_SHIFT 5 /* GPIO1_PU */
61#define WM8904_GPIO1_PU_WIDTH 1 /* GPIO1_PU */
62#define WM8904_GPIO1_PD 0x0010 /* GPIO1_PD */
63#define WM8904_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */
64#define WM8904_GPIO1_PD_SHIFT 4 /* GPIO1_PD */
65#define WM8904_GPIO1_PD_WIDTH 1 /* GPIO1_PD */
66#define WM8904_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */
67#define WM8904_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */
68#define WM8904_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */
69
70/*
71 * R122 (0x7A) - GPIO Control 2
72 */
73#define WM8904_GPIO2_PU 0x0020 /* GPIO2_PU */
74#define WM8904_GPIO2_PU_MASK 0x0020 /* GPIO2_PU */
75#define WM8904_GPIO2_PU_SHIFT 5 /* GPIO2_PU */
76#define WM8904_GPIO2_PU_WIDTH 1 /* GPIO2_PU */
77#define WM8904_GPIO2_PD 0x0010 /* GPIO2_PD */
78#define WM8904_GPIO2_PD_MASK 0x0010 /* GPIO2_PD */
79#define WM8904_GPIO2_PD_SHIFT 4 /* GPIO2_PD */
80#define WM8904_GPIO2_PD_WIDTH 1 /* GPIO2_PD */
81#define WM8904_GPIO2_SEL_MASK 0x000F /* GPIO2_SEL - [3:0] */
82#define WM8904_GPIO2_SEL_SHIFT 0 /* GPIO2_SEL - [3:0] */
83#define WM8904_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [3:0] */
84
85/*
86 * R123 (0x7B) - GPIO Control 3
87 */
88#define WM8904_GPIO3_PU 0x0020 /* GPIO3_PU */
89#define WM8904_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */
90#define WM8904_GPIO3_PU_SHIFT 5 /* GPIO3_PU */
91#define WM8904_GPIO3_PU_WIDTH 1 /* GPIO3_PU */
92#define WM8904_GPIO3_PD 0x0010 /* GPIO3_PD */
93#define WM8904_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */
94#define WM8904_GPIO3_PD_SHIFT 4 /* GPIO3_PD */
95#define WM8904_GPIO3_PD_WIDTH 1 /* GPIO3_PD */
96#define WM8904_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */
97#define WM8904_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */
98#define WM8904_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */
99
100/*
101 * R124 (0x7C) - GPIO Control 4
102 */
103#define WM8904_GPI7_ENA 0x0200 /* GPI7_ENA */
104#define WM8904_GPI7_ENA_MASK 0x0200 /* GPI7_ENA */
105#define WM8904_GPI7_ENA_SHIFT 9 /* GPI7_ENA */
106#define WM8904_GPI7_ENA_WIDTH 1 /* GPI7_ENA */
107#define WM8904_GPI8_ENA 0x0100 /* GPI8_ENA */
108#define WM8904_GPI8_ENA_MASK 0x0100 /* GPI8_ENA */
109#define WM8904_GPI8_ENA_SHIFT 8 /* GPI8_ENA */
110#define WM8904_GPI8_ENA_WIDTH 1 /* GPI8_ENA */
111#define WM8904_GPIO_BCLK_MODE_ENA 0x0080 /* GPIO_BCLK_MODE_ENA */
112#define WM8904_GPIO_BCLK_MODE_ENA_MASK 0x0080 /* GPIO_BCLK_MODE_ENA */
113#define WM8904_GPIO_BCLK_MODE_ENA_SHIFT 7 /* GPIO_BCLK_MODE_ENA */
114#define WM8904_GPIO_BCLK_MODE_ENA_WIDTH 1 /* GPIO_BCLK_MODE_ENA */
115#define WM8904_GPIO_BCLK_SEL_MASK 0x000F /* GPIO_BCLK_SEL - [3:0] */
116#define WM8904_GPIO_BCLK_SEL_SHIFT 0 /* GPIO_BCLK_SEL - [3:0] */
117#define WM8904_GPIO_BCLK_SEL_WIDTH 4 /* GPIO_BCLK_SEL - [3:0] */
118
119#define WM8904_MIC_REGS 2
120#define WM8904_GPIO_REGS 4
121#define WM8904_DRC_REGS 4
122#define WM8904_EQ_REGS 25
20 123
21/** 124/**
22 * DRC configurations are specified with a label and a set of register 125 * DRC configurations are specified with a label and a set of register
@@ -52,6 +155,9 @@ struct wm8904_pdata {
52 155
53 int num_retune_mobile_cfgs; 156 int num_retune_mobile_cfgs;
54 struct wm8904_retune_mobile_cfg *retune_mobile_cfgs; 157 struct wm8904_retune_mobile_cfg *retune_mobile_cfgs;
158
159 u32 gpio_cfg[WM8904_GPIO_REGS];
160 u32 mic_cfg[WM8904_MIC_REGS];
55}; 161};
56 162
57#endif 163#endif
diff --git a/include/sound/wm8960.h b/include/sound/wm8960.h
new file mode 100644
index 000000000000..74e9a95529c5
--- /dev/null
+++ b/include/sound/wm8960.h
@@ -0,0 +1,24 @@
1/*
2 * wm8960.h -- WM8960 Soc Audio driver platform data
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _WM8960_PDATA_H
10#define _WM8960_PDATA_H
11
12#define WM8960_DRES_400R 0
13#define WM8960_DRES_200R 1
14#define WM8960_DRES_600R 2
15#define WM8960_DRES_150R 3
16#define WM8960_DRES_MAX 3
17
18struct wm8960_data {
19 bool capless; /* Headphone outputs configured in capless mode */
20
21 int dres; /* Discharge resistance for headphone outputs */
22};
23
24#endif
diff --git a/include/sound/wm9090.h b/include/sound/wm9090.h
new file mode 100644
index 000000000000..3718928cde1a
--- /dev/null
+++ b/include/sound/wm9090.h
@@ -0,0 +1,28 @@
1/*
2 * linux/sound/wm9090.h -- Platform data for WM9090
3 *
4 * Copyright 2009, 2010 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM9090_H
12#define __LINUX_SND_WM9090_H
13
14struct wm9090_platform_data {
15 /* Line inputs 1 & 2 can optionally be differential */
16 unsigned int lin1_diff:1;
17 unsigned int lin2_diff:1;
18
19 /* AGC configuration. This is intended to protect the speaker
20 * against overdriving and will therefore depend on the
21 * hardware setup with incorrect runtime configuration
22 * potentially causing hardware damage.
23 */
24 unsigned int agc_ena:1;
25 u16 agc[3];
26};
27
28#endif
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 5acfb1eb4df9..1dfab5401511 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -65,6 +65,10 @@
65 65
66#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 66#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
67 67
68/* Make all open coded DECLARE_TRACE nops */
69#undef DECLARE_TRACE
70#define DECLARE_TRACE(name, proto, args)
71
68#ifdef CONFIG_EVENT_TRACING 72#ifdef CONFIG_EVENT_TRACING
69#include <trace/ftrace.h> 73#include <trace/ftrace.h>
70#endif 74#endif
@@ -75,6 +79,7 @@
75#undef DEFINE_EVENT 79#undef DEFINE_EVENT
76#undef DEFINE_EVENT_PRINT 80#undef DEFINE_EVENT_PRINT
77#undef TRACE_HEADER_MULTI_READ 81#undef TRACE_HEADER_MULTI_READ
82#undef DECLARE_TRACE
78 83
79/* Only undef what we defined in this file */ 84/* Only undef what we defined in this file */
80#ifdef UNDEF_TRACE_INCLUDE_FILE 85#ifdef UNDEF_TRACE_INCLUDE_FILE
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index b17d49dfc3ef..6dd3a51ab1cb 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -5,7 +5,6 @@
5 5
6#undef TRACE_SYSTEM 6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM kvm 7#define TRACE_SYSTEM kvm
8#define TRACE_INCLUDE_FILE kvm
9 8
10#if defined(__KVM_HAVE_IOAPIC) 9#if defined(__KVM_HAVE_IOAPIC)
11TRACE_EVENT(kvm_set_irq, 10TRACE_EVENT(kvm_set_irq,
diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h
index 5c1dcfc16c60..2821b86de63b 100644
--- a/include/trace/events/lock.h
+++ b/include/trace/events/lock.h
@@ -35,15 +35,15 @@ TRACE_EVENT(lock_acquire,
35 __get_str(name)) 35 __get_str(name))
36); 36);
37 37
38TRACE_EVENT(lock_release, 38DECLARE_EVENT_CLASS(lock,
39 39
40 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip), 40 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
41 41
42 TP_ARGS(lock, nested, ip), 42 TP_ARGS(lock, ip),
43 43
44 TP_STRUCT__entry( 44 TP_STRUCT__entry(
45 __string(name, lock->name) 45 __string( name, lock->name )
46 __field(void *, lockdep_addr) 46 __field( void *, lockdep_addr )
47 ), 47 ),
48 48
49 TP_fast_assign( 49 TP_fast_assign(
@@ -51,51 +51,30 @@ TRACE_EVENT(lock_release,
51 __entry->lockdep_addr = lock; 51 __entry->lockdep_addr = lock;
52 ), 52 ),
53 53
54 TP_printk("%p %s", 54 TP_printk("%p %s", __entry->lockdep_addr, __get_str(name))
55 __entry->lockdep_addr, __get_str(name))
56); 55);
57 56
58#ifdef CONFIG_LOCK_STAT 57DEFINE_EVENT(lock, lock_release,
59
60TRACE_EVENT(lock_contended,
61 58
62 TP_PROTO(struct lockdep_map *lock, unsigned long ip), 59 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
63 60
64 TP_ARGS(lock, ip), 61 TP_ARGS(lock, ip)
62);
65 63
66 TP_STRUCT__entry( 64#ifdef CONFIG_LOCK_STAT
67 __string(name, lock->name)
68 __field(void *, lockdep_addr)
69 ),
70 65
71 TP_fast_assign( 66DEFINE_EVENT(lock, lock_contended,
72 __assign_str(name, lock->name);
73 __entry->lockdep_addr = lock;
74 ),
75 67
76 TP_printk("%p %s", 68 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
77 __entry->lockdep_addr, __get_str(name))
78);
79 69
80TRACE_EVENT(lock_acquired, 70 TP_ARGS(lock, ip)
81 TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime), 71);
82 72
83 TP_ARGS(lock, ip, waittime), 73DEFINE_EVENT(lock, lock_acquired,
84 74
85 TP_STRUCT__entry( 75 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
86 __string(name, lock->name)
87 __field(s64, wait_nsec)
88 __field(void *, lockdep_addr)
89 ),
90 76
91 TP_fast_assign( 77 TP_ARGS(lock, ip)
92 __assign_str(name, lock->name);
93 __entry->wait_nsec = waittime;
94 __entry->lockdep_addr = lock;
95 ),
96 TP_printk("%p %s (%llu ns)", __entry->lockdep_addr,
97 __get_str(name),
98 __entry->wait_nsec)
99); 78);
100 79
101#endif 80#endif
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 4b0f48ba16a6..c7bb2f0482fe 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -51,11 +51,14 @@ TRACE_EVENT(module_free,
51 TP_printk("%s", __get_str(name)) 51 TP_printk("%s", __get_str(name))
52); 52);
53 53
54#ifdef CONFIG_MODULE_UNLOAD
55/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
56
54DECLARE_EVENT_CLASS(module_refcnt, 57DECLARE_EVENT_CLASS(module_refcnt,
55 58
56 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 59 TP_PROTO(struct module *mod, unsigned long ip),
57 60
58 TP_ARGS(mod, ip, refcnt), 61 TP_ARGS(mod, ip),
59 62
60 TP_STRUCT__entry( 63 TP_STRUCT__entry(
61 __field( unsigned long, ip ) 64 __field( unsigned long, ip )
@@ -65,7 +68,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
65 68
66 TP_fast_assign( 69 TP_fast_assign(
67 __entry->ip = ip; 70 __entry->ip = ip;
68 __entry->refcnt = refcnt; 71 __entry->refcnt = __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs);
69 __assign_str(name, mod->name); 72 __assign_str(name, mod->name);
70 ), 73 ),
71 74
@@ -75,17 +78,18 @@ DECLARE_EVENT_CLASS(module_refcnt,
75 78
76DEFINE_EVENT(module_refcnt, module_get, 79DEFINE_EVENT(module_refcnt, module_get,
77 80
78 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 81 TP_PROTO(struct module *mod, unsigned long ip),
79 82
80 TP_ARGS(mod, ip, refcnt) 83 TP_ARGS(mod, ip)
81); 84);
82 85
83DEFINE_EVENT(module_refcnt, module_put, 86DEFINE_EVENT(module_refcnt, module_put,
84 87
85 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 88 TP_PROTO(struct module *mod, unsigned long ip),
86 89
87 TP_ARGS(mod, ip, refcnt) 90 TP_ARGS(mod, ip)
88); 91);
92#endif /* CONFIG_MODULE_UNLOAD */
89 93
90TRACE_EVENT(module_request, 94TRACE_EVENT(module_request,
91 95
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h
index a8989c4547e7..188deca2f3c7 100644
--- a/include/trace/events/napi.h
+++ b/include/trace/events/napi.h
@@ -1,4 +1,7 @@
1#ifndef _TRACE_NAPI_H_ 1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM napi
3
4#if !defined(_TRACE_NAPI_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_NAPI_H_ 5#define _TRACE_NAPI_H_
3 6
4#include <linux/netdevice.h> 7#include <linux/netdevice.h>
@@ -8,4 +11,7 @@ DECLARE_TRACE(napi_poll,
8 TP_PROTO(struct napi_struct *napi), 11 TP_PROTO(struct napi_struct *napi),
9 TP_ARGS(napi)); 12 TP_ARGS(napi));
10 13
11#endif 14#endif /* _TRACE_NAPI_H_ */
15
16/* This part must be outside protection */
17#include <trace/define_trace.h>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b73e20..4f733ecea46e 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -51,15 +51,12 @@ TRACE_EVENT(sched_kthread_stop_ret,
51 51
52/* 52/*
53 * Tracepoint for waiting on task to unschedule: 53 * Tracepoint for waiting on task to unschedule:
54 *
55 * (NOTE: the 'rq' argument is not used by generic trace events,
56 * but used by the latency tracer plugin. )
57 */ 54 */
58TRACE_EVENT(sched_wait_task, 55TRACE_EVENT(sched_wait_task,
59 56
60 TP_PROTO(struct rq *rq, struct task_struct *p), 57 TP_PROTO(struct task_struct *p),
61 58
62 TP_ARGS(rq, p), 59 TP_ARGS(p),
63 60
64 TP_STRUCT__entry( 61 TP_STRUCT__entry(
65 __array( char, comm, TASK_COMM_LEN ) 62 __array( char, comm, TASK_COMM_LEN )
@@ -79,15 +76,12 @@ TRACE_EVENT(sched_wait_task,
79 76
80/* 77/*
81 * Tracepoint for waking up a task: 78 * Tracepoint for waking up a task:
82 *
83 * (NOTE: the 'rq' argument is not used by generic trace events,
84 * but used by the latency tracer plugin. )
85 */ 79 */
86DECLARE_EVENT_CLASS(sched_wakeup_template, 80DECLARE_EVENT_CLASS(sched_wakeup_template,
87 81
88 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 82 TP_PROTO(struct task_struct *p, int success),
89 83
90 TP_ARGS(rq, p, success), 84 TP_ARGS(p, success),
91 85
92 TP_STRUCT__entry( 86 TP_STRUCT__entry(
93 __array( char, comm, TASK_COMM_LEN ) 87 __array( char, comm, TASK_COMM_LEN )
@@ -111,31 +105,25 @@ DECLARE_EVENT_CLASS(sched_wakeup_template,
111); 105);
112 106
113DEFINE_EVENT(sched_wakeup_template, sched_wakeup, 107DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
114 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 108 TP_PROTO(struct task_struct *p, int success),
115 TP_ARGS(rq, p, success)); 109 TP_ARGS(p, success));
116 110
117/* 111/*
118 * Tracepoint for waking up a new task: 112 * Tracepoint for waking up a new task:
119 *
120 * (NOTE: the 'rq' argument is not used by generic trace events,
121 * but used by the latency tracer plugin. )
122 */ 113 */
123DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, 114DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
124 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 115 TP_PROTO(struct task_struct *p, int success),
125 TP_ARGS(rq, p, success)); 116 TP_ARGS(p, success));
126 117
127/* 118/*
128 * Tracepoint for task switches, performed by the scheduler: 119 * Tracepoint for task switches, performed by the scheduler:
129 *
130 * (NOTE: the 'rq' argument is not used by generic trace events,
131 * but used by the latency tracer plugin. )
132 */ 120 */
133TRACE_EVENT(sched_switch, 121TRACE_EVENT(sched_switch,
134 122
135 TP_PROTO(struct rq *rq, struct task_struct *prev, 123 TP_PROTO(struct task_struct *prev,
136 struct task_struct *next), 124 struct task_struct *next),
137 125
138 TP_ARGS(rq, prev, next), 126 TP_ARGS(prev, next),
139 127
140 TP_STRUCT__entry( 128 TP_STRUCT__entry(
141 __array( char, prev_comm, TASK_COMM_LEN ) 129 __array( char, prev_comm, TASK_COMM_LEN )
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
new file mode 100644
index 000000000000..25fbefdf2f2e
--- /dev/null
+++ b/include/trace/events/scsi.h
@@ -0,0 +1,345 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM scsi
3
4#if !defined(_TRACE_SCSI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SCSI_H
6
7#include <scsi/scsi_cmnd.h>
8#include <scsi/scsi_host.h>
9#include <linux/tracepoint.h>
10#include <linux/trace_seq.h>
11
12#define scsi_opcode_name(opcode) { opcode, #opcode }
13#define show_opcode_name(val) \
14 __print_symbolic(val, \
15 scsi_opcode_name(TEST_UNIT_READY), \
16 scsi_opcode_name(REZERO_UNIT), \
17 scsi_opcode_name(REQUEST_SENSE), \
18 scsi_opcode_name(FORMAT_UNIT), \
19 scsi_opcode_name(READ_BLOCK_LIMITS), \
20 scsi_opcode_name(REASSIGN_BLOCKS), \
21 scsi_opcode_name(INITIALIZE_ELEMENT_STATUS), \
22 scsi_opcode_name(READ_6), \
23 scsi_opcode_name(WRITE_6), \
24 scsi_opcode_name(SEEK_6), \
25 scsi_opcode_name(READ_REVERSE), \
26 scsi_opcode_name(WRITE_FILEMARKS), \
27 scsi_opcode_name(SPACE), \
28 scsi_opcode_name(INQUIRY), \
29 scsi_opcode_name(RECOVER_BUFFERED_DATA), \
30 scsi_opcode_name(MODE_SELECT), \
31 scsi_opcode_name(RESERVE), \
32 scsi_opcode_name(RELEASE), \
33 scsi_opcode_name(COPY), \
34 scsi_opcode_name(ERASE), \
35 scsi_opcode_name(MODE_SENSE), \
36 scsi_opcode_name(START_STOP), \
37 scsi_opcode_name(RECEIVE_DIAGNOSTIC), \
38 scsi_opcode_name(SEND_DIAGNOSTIC), \
39 scsi_opcode_name(ALLOW_MEDIUM_REMOVAL), \
40 scsi_opcode_name(SET_WINDOW), \
41 scsi_opcode_name(READ_CAPACITY), \
42 scsi_opcode_name(READ_10), \
43 scsi_opcode_name(WRITE_10), \
44 scsi_opcode_name(SEEK_10), \
45 scsi_opcode_name(POSITION_TO_ELEMENT), \
46 scsi_opcode_name(WRITE_VERIFY), \
47 scsi_opcode_name(VERIFY), \
48 scsi_opcode_name(SEARCH_HIGH), \
49 scsi_opcode_name(SEARCH_EQUAL), \
50 scsi_opcode_name(SEARCH_LOW), \
51 scsi_opcode_name(SET_LIMITS), \
52 scsi_opcode_name(PRE_FETCH), \
53 scsi_opcode_name(READ_POSITION), \
54 scsi_opcode_name(SYNCHRONIZE_CACHE), \
55 scsi_opcode_name(LOCK_UNLOCK_CACHE), \
56 scsi_opcode_name(READ_DEFECT_DATA), \
57 scsi_opcode_name(MEDIUM_SCAN), \
58 scsi_opcode_name(COMPARE), \
59 scsi_opcode_name(COPY_VERIFY), \
60 scsi_opcode_name(WRITE_BUFFER), \
61 scsi_opcode_name(READ_BUFFER), \
62 scsi_opcode_name(UPDATE_BLOCK), \
63 scsi_opcode_name(READ_LONG), \
64 scsi_opcode_name(WRITE_LONG), \
65 scsi_opcode_name(CHANGE_DEFINITION), \
66 scsi_opcode_name(WRITE_SAME), \
67 scsi_opcode_name(UNMAP), \
68 scsi_opcode_name(READ_TOC), \
69 scsi_opcode_name(LOG_SELECT), \
70 scsi_opcode_name(LOG_SENSE), \
71 scsi_opcode_name(XDWRITEREAD_10), \
72 scsi_opcode_name(MODE_SELECT_10), \
73 scsi_opcode_name(RESERVE_10), \
74 scsi_opcode_name(RELEASE_10), \
75 scsi_opcode_name(MODE_SENSE_10), \
76 scsi_opcode_name(PERSISTENT_RESERVE_IN), \
77 scsi_opcode_name(PERSISTENT_RESERVE_OUT), \
78 scsi_opcode_name(VARIABLE_LENGTH_CMD), \
79 scsi_opcode_name(REPORT_LUNS), \
80 scsi_opcode_name(MAINTENANCE_IN), \
81 scsi_opcode_name(MAINTENANCE_OUT), \
82 scsi_opcode_name(MOVE_MEDIUM), \
83 scsi_opcode_name(EXCHANGE_MEDIUM), \
84 scsi_opcode_name(READ_12), \
85 scsi_opcode_name(WRITE_12), \
86 scsi_opcode_name(WRITE_VERIFY_12), \
87 scsi_opcode_name(SEARCH_HIGH_12), \
88 scsi_opcode_name(SEARCH_EQUAL_12), \
89 scsi_opcode_name(SEARCH_LOW_12), \
90 scsi_opcode_name(READ_ELEMENT_STATUS), \
91 scsi_opcode_name(SEND_VOLUME_TAG), \
92 scsi_opcode_name(WRITE_LONG_2), \
93 scsi_opcode_name(READ_16), \
94 scsi_opcode_name(WRITE_16), \
95 scsi_opcode_name(VERIFY_16), \
96 scsi_opcode_name(WRITE_SAME_16), \
97 scsi_opcode_name(SERVICE_ACTION_IN), \
98 scsi_opcode_name(SAI_READ_CAPACITY_16), \
99 scsi_opcode_name(SAI_GET_LBA_STATUS), \
100 scsi_opcode_name(MI_REPORT_TARGET_PGS), \
101 scsi_opcode_name(MO_SET_TARGET_PGS), \
102 scsi_opcode_name(READ_32), \
103 scsi_opcode_name(WRITE_32), \
104 scsi_opcode_name(WRITE_SAME_32), \
105 scsi_opcode_name(ATA_16), \
106 scsi_opcode_name(ATA_12))
107
108#define scsi_hostbyte_name(result) { result, #result }
109#define show_hostbyte_name(val) \
110 __print_symbolic(val, \
111 scsi_hostbyte_name(DID_OK), \
112 scsi_hostbyte_name(DID_NO_CONNECT), \
113 scsi_hostbyte_name(DID_BUS_BUSY), \
114 scsi_hostbyte_name(DID_TIME_OUT), \
115 scsi_hostbyte_name(DID_BAD_TARGET), \
116 scsi_hostbyte_name(DID_ABORT), \
117 scsi_hostbyte_name(DID_PARITY), \
118 scsi_hostbyte_name(DID_ERROR), \
119 scsi_hostbyte_name(DID_RESET), \
120 scsi_hostbyte_name(DID_BAD_INTR), \
121 scsi_hostbyte_name(DID_PASSTHROUGH), \
122 scsi_hostbyte_name(DID_SOFT_ERROR), \
123 scsi_hostbyte_name(DID_IMM_RETRY), \
124 scsi_hostbyte_name(DID_REQUEUE), \
125 scsi_hostbyte_name(DID_TRANSPORT_DISRUPTED), \
126 scsi_hostbyte_name(DID_TRANSPORT_FAILFAST))
127
128#define scsi_driverbyte_name(result) { result, #result }
129#define show_driverbyte_name(val) \
130 __print_symbolic(val, \
131 scsi_driverbyte_name(DRIVER_OK), \
132 scsi_driverbyte_name(DRIVER_BUSY), \
133 scsi_driverbyte_name(DRIVER_SOFT), \
134 scsi_driverbyte_name(DRIVER_MEDIA), \
135 scsi_driverbyte_name(DRIVER_ERROR), \
136 scsi_driverbyte_name(DRIVER_INVALID), \
137 scsi_driverbyte_name(DRIVER_TIMEOUT), \
138 scsi_driverbyte_name(DRIVER_HARD), \
139 scsi_driverbyte_name(DRIVER_SENSE))
140
141#define scsi_msgbyte_name(result) { result, #result }
142#define show_msgbyte_name(val) \
143 __print_symbolic(val, \
144 scsi_msgbyte_name(COMMAND_COMPLETE), \
145 scsi_msgbyte_name(EXTENDED_MESSAGE), \
146 scsi_msgbyte_name(SAVE_POINTERS), \
147 scsi_msgbyte_name(RESTORE_POINTERS), \
148 scsi_msgbyte_name(DISCONNECT), \
149 scsi_msgbyte_name(INITIATOR_ERROR), \
150 scsi_msgbyte_name(ABORT_TASK_SET), \
151 scsi_msgbyte_name(MESSAGE_REJECT), \
152 scsi_msgbyte_name(NOP), \
153 scsi_msgbyte_name(MSG_PARITY_ERROR), \
154 scsi_msgbyte_name(LINKED_CMD_COMPLETE), \
155 scsi_msgbyte_name(LINKED_FLG_CMD_COMPLETE), \
156 scsi_msgbyte_name(TARGET_RESET), \
157 scsi_msgbyte_name(ABORT_TASK), \
158 scsi_msgbyte_name(CLEAR_TASK_SET), \
159 scsi_msgbyte_name(INITIATE_RECOVERY), \
160 scsi_msgbyte_name(RELEASE_RECOVERY), \
161 scsi_msgbyte_name(CLEAR_ACA), \
162 scsi_msgbyte_name(LOGICAL_UNIT_RESET), \
163 scsi_msgbyte_name(SIMPLE_QUEUE_TAG), \
164 scsi_msgbyte_name(HEAD_OF_QUEUE_TAG), \
165 scsi_msgbyte_name(ORDERED_QUEUE_TAG), \
166 scsi_msgbyte_name(IGNORE_WIDE_RESIDUE), \
167 scsi_msgbyte_name(ACA), \
168 scsi_msgbyte_name(QAS_REQUEST), \
169 scsi_msgbyte_name(BUS_DEVICE_RESET), \
170 scsi_msgbyte_name(ABORT))
171
172#define scsi_statusbyte_name(result) { result, #result }
173#define show_statusbyte_name(val) \
174 __print_symbolic(val, \
175 scsi_statusbyte_name(SAM_STAT_GOOD), \
176 scsi_statusbyte_name(SAM_STAT_CHECK_CONDITION), \
177 scsi_statusbyte_name(SAM_STAT_CONDITION_MET), \
178 scsi_statusbyte_name(SAM_STAT_BUSY), \
179 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE), \
180 scsi_statusbyte_name(SAM_STAT_INTERMEDIATE_CONDITION_MET), \
181 scsi_statusbyte_name(SAM_STAT_RESERVATION_CONFLICT), \
182 scsi_statusbyte_name(SAM_STAT_COMMAND_TERMINATED), \
183 scsi_statusbyte_name(SAM_STAT_TASK_SET_FULL), \
184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \
185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED))
186
187const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
188#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
189
190TRACE_EVENT(scsi_dispatch_cmd_start,
191
192 TP_PROTO(struct scsi_cmnd *cmd),
193
194 TP_ARGS(cmd),
195
196 TP_STRUCT__entry(
197 __field( unsigned int, host_no )
198 __field( unsigned int, channel )
199 __field( unsigned int, id )
200 __field( unsigned int, lun )
201 __field( unsigned int, opcode )
202 __field( unsigned int, cmd_len )
203 __field( unsigned int, data_sglen )
204 __field( unsigned int, prot_sglen )
205 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
206 ),
207
208 TP_fast_assign(
209 __entry->host_no = cmd->device->host->host_no;
210 __entry->channel = cmd->device->channel;
211 __entry->id = cmd->device->id;
212 __entry->lun = cmd->device->lun;
213 __entry->opcode = cmd->cmnd[0];
214 __entry->cmd_len = cmd->cmd_len;
215 __entry->data_sglen = scsi_sg_count(cmd);
216 __entry->prot_sglen = scsi_prot_sg_count(cmd);
217 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
218 ),
219
220 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
221 " cmnd=(%s %s raw=%s)",
222 __entry->host_no, __entry->channel, __entry->id,
223 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
224 show_opcode_name(__entry->opcode),
225 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
226 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len))
227);
228
229TRACE_EVENT(scsi_dispatch_cmd_error,
230
231 TP_PROTO(struct scsi_cmnd *cmd, int rtn),
232
233 TP_ARGS(cmd, rtn),
234
235 TP_STRUCT__entry(
236 __field( unsigned int, host_no )
237 __field( unsigned int, channel )
238 __field( unsigned int, id )
239 __field( unsigned int, lun )
240 __field( int, rtn )
241 __field( unsigned int, opcode )
242 __field( unsigned int, cmd_len )
243 __field( unsigned int, data_sglen )
244 __field( unsigned int, prot_sglen )
245 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
246 ),
247
248 TP_fast_assign(
249 __entry->host_no = cmd->device->host->host_no;
250 __entry->channel = cmd->device->channel;
251 __entry->id = cmd->device->id;
252 __entry->lun = cmd->device->lun;
253 __entry->rtn = rtn;
254 __entry->opcode = cmd->cmnd[0];
255 __entry->cmd_len = cmd->cmd_len;
256 __entry->data_sglen = scsi_sg_count(cmd);
257 __entry->prot_sglen = scsi_prot_sg_count(cmd);
258 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
259 ),
260
261 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
262 " cmnd=(%s %s raw=%s) rtn=%d",
263 __entry->host_no, __entry->channel, __entry->id,
264 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
265 show_opcode_name(__entry->opcode),
266 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
267 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
268 __entry->rtn)
269);
270
271DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
272
273 TP_PROTO(struct scsi_cmnd *cmd),
274
275 TP_ARGS(cmd),
276
277 TP_STRUCT__entry(
278 __field( unsigned int, host_no )
279 __field( unsigned int, channel )
280 __field( unsigned int, id )
281 __field( unsigned int, lun )
282 __field( int, result )
283 __field( unsigned int, opcode )
284 __field( unsigned int, cmd_len )
285 __field( unsigned int, data_sglen )
286 __field( unsigned int, prot_sglen )
287 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
288 ),
289
290 TP_fast_assign(
291 __entry->host_no = cmd->device->host->host_no;
292 __entry->channel = cmd->device->channel;
293 __entry->id = cmd->device->id;
294 __entry->lun = cmd->device->lun;
295 __entry->result = cmd->result;
296 __entry->opcode = cmd->cmnd[0];
297 __entry->cmd_len = cmd->cmd_len;
298 __entry->data_sglen = scsi_sg_count(cmd);
299 __entry->prot_sglen = scsi_prot_sg_count(cmd);
300 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
301 ),
302
303 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \
304 "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \
305 "message=%s status=%s)",
306 __entry->host_no, __entry->channel, __entry->id,
307 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
308 show_opcode_name(__entry->opcode),
309 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
310 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
311 show_driverbyte_name(((__entry->result) >> 24) & 0xff),
312 show_hostbyte_name(((__entry->result) >> 16) & 0xff),
313 show_msgbyte_name(((__entry->result) >> 8) & 0xff),
314 show_statusbyte_name(__entry->result & 0xff))
315);
316
317DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done,
318 TP_PROTO(struct scsi_cmnd *cmd),
319 TP_ARGS(cmd));
320
321DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_timeout,
322 TP_PROTO(struct scsi_cmnd *cmd),
323 TP_ARGS(cmd));
324
325TRACE_EVENT(scsi_eh_wakeup,
326
327 TP_PROTO(struct Scsi_Host *shost),
328
329 TP_ARGS(shost),
330
331 TP_STRUCT__entry(
332 __field( unsigned int, host_no )
333 ),
334
335 TP_fast_assign(
336 __entry->host_no = shost->host_no;
337 ),
338
339 TP_printk("host_no=%u", __entry->host_no)
340);
341
342#endif /* _TRACE_SCSI_H */
343
344/* This part must be outside protection */
345#include <trace/define_trace.h>
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
index a510b75ac304..814566c99d29 100644
--- a/include/trace/events/signal.h
+++ b/include/trace/events/signal.h
@@ -100,18 +100,7 @@ TRACE_EVENT(signal_deliver,
100 __entry->sa_handler, __entry->sa_flags) 100 __entry->sa_handler, __entry->sa_flags)
101); 101);
102 102
103/** 103DECLARE_EVENT_CLASS(signal_queue_overflow,
104 * signal_overflow_fail - called when signal queue is overflow
105 * @sig: signal number
106 * @group: signal to process group or not (bool)
107 * @info: pointer to struct siginfo
108 *
109 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
110 * siginfo queue is overflow, and the signal is dropped.
111 * 'group' is not 0 if the signal will be sent to a process group.
112 * 'sig' is always one of RT signals.
113 */
114TRACE_EVENT(signal_overflow_fail,
115 104
116 TP_PROTO(int sig, int group, struct siginfo *info), 105 TP_PROTO(int sig, int group, struct siginfo *info),
117 106
@@ -135,6 +124,24 @@ TRACE_EVENT(signal_overflow_fail,
135); 124);
136 125
137/** 126/**
127 * signal_overflow_fail - called when signal queue is overflow
128 * @sig: signal number
129 * @group: signal to process group or not (bool)
130 * @info: pointer to struct siginfo
131 *
132 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
133 * siginfo queue is overflow, and the signal is dropped.
134 * 'group' is not 0 if the signal will be sent to a process group.
135 * 'sig' is always one of RT signals.
136 */
137DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail,
138
139 TP_PROTO(int sig, int group, struct siginfo *info),
140
141 TP_ARGS(sig, group, info)
142);
143
144/**
138 * signal_lose_info - called when siginfo is lost 145 * signal_lose_info - called when siginfo is lost
139 * @sig: signal number 146 * @sig: signal number
140 * @group: signal to process group or not (bool) 147 * @group: signal to process group or not (bool)
@@ -145,28 +152,13 @@ TRACE_EVENT(signal_overflow_fail,
145 * 'group' is not 0 if the signal will be sent to a process group. 152 * 'group' is not 0 if the signal will be sent to a process group.
146 * 'sig' is always one of non-RT signals. 153 * 'sig' is always one of non-RT signals.
147 */ 154 */
148TRACE_EVENT(signal_lose_info, 155DEFINE_EVENT(signal_queue_overflow, signal_lose_info,
149 156
150 TP_PROTO(int sig, int group, struct siginfo *info), 157 TP_PROTO(int sig, int group, struct siginfo *info),
151 158
152 TP_ARGS(sig, group, info), 159 TP_ARGS(sig, group, info)
153
154 TP_STRUCT__entry(
155 __field( int, sig )
156 __field( int, group )
157 __field( int, errno )
158 __field( int, code )
159 ),
160
161 TP_fast_assign(
162 __entry->sig = sig;
163 __entry->group = group;
164 TP_STORE_SIGINFO(__entry, info);
165 ),
166
167 TP_printk("sig=%d group=%d errno=%d code=%d",
168 __entry->sig, __entry->group, __entry->errno, __entry->code)
169); 160);
161
170#endif /* _TRACE_SIGNAL_H */ 162#endif /* _TRACE_SIGNAL_H */
171 163
172/* This part must be outside protection */ 164/* This part must be outside protection */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index ea6f9d4a20e9..88c59c13ea7b 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -154,9 +154,11 @@
154 * 154 *
155 * field = (typeof(field))entry; 155 * field = (typeof(field))entry;
156 * 156 *
157 * p = get_cpu_var(ftrace_event_seq); 157 * p = &get_cpu_var(ftrace_event_seq);
158 * trace_seq_init(p); 158 * trace_seq_init(p);
159 * ret = trace_seq_printf(s, <TP_printk> "\n"); 159 * ret = trace_seq_printf(s, "%s: ", <call>);
160 * if (ret)
161 * ret = trace_seq_printf(s, <TP_printk> "\n");
160 * put_cpu(); 162 * put_cpu();
161 * if (!ret) 163 * if (!ret)
162 * return TRACE_TYPE_PARTIAL_LINE; 164 * return TRACE_TYPE_PARTIAL_LINE;
@@ -198,6 +200,9 @@
198 ftrace_print_symbols_seq(p, value, symbols); \ 200 ftrace_print_symbols_seq(p, value, symbols); \
199 }) 201 })
200 202
203#undef __print_hex
204#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
205
201#undef DECLARE_EVENT_CLASS 206#undef DECLARE_EVENT_CLASS
202#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
203static notrace enum print_line_t \ 208static notrace enum print_line_t \
@@ -450,38 +455,38 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \
450 * 455 *
451 * static void ftrace_raw_event_<call>(proto) 456 * static void ftrace_raw_event_<call>(proto)
452 * { 457 * {
458 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
453 * struct ring_buffer_event *event; 459 * struct ring_buffer_event *event;
454 * struct ftrace_raw_<call> *entry; <-- defined in stage 1 460 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
455 * struct ring_buffer *buffer; 461 * struct ring_buffer *buffer;
456 * unsigned long irq_flags; 462 * unsigned long irq_flags;
463 * int __data_size;
457 * int pc; 464 * int pc;
458 * 465 *
459 * local_save_flags(irq_flags); 466 * local_save_flags(irq_flags);
460 * pc = preempt_count(); 467 * pc = preempt_count();
461 * 468 *
469 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
470 *
462 * event = trace_current_buffer_lock_reserve(&buffer, 471 * event = trace_current_buffer_lock_reserve(&buffer,
463 * event_<call>.id, 472 * event_<call>.id,
464 * sizeof(struct ftrace_raw_<call>), 473 * sizeof(*entry) + __data_size,
465 * irq_flags, pc); 474 * irq_flags, pc);
466 * if (!event) 475 * if (!event)
467 * return; 476 * return;
468 * entry = ring_buffer_event_data(event); 477 * entry = ring_buffer_event_data(event);
469 * 478 *
470 * <assign>; <-- Here we assign the entries by the __field and 479 * { <assign>; } <-- Here we assign the entries by the __field and
471 * __array macros. 480 * __array macros.
472 * 481 *
473 * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); 482 * if (!filter_current_check_discard(buffer, event_call, entry, event))
483 * trace_current_buffer_unlock_commit(buffer,
484 * event, irq_flags, pc);
474 * } 485 * }
475 * 486 *
476 * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) 487 * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused)
477 * { 488 * {
478 * int ret; 489 * return register_trace_<call>(ftrace_raw_event_<call>);
479 *
480 * ret = register_trace_<call>(ftrace_raw_event_<call>);
481 * if (!ret)
482 * pr_info("event trace: Could not activate trace point "
483 * "probe to <call>");
484 * return ret;
485 * } 490 * }
486 * 491 *
487 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused) 492 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
@@ -493,6 +498,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \
493 * .trace = ftrace_raw_output_<call>, <-- stage 2 498 * .trace = ftrace_raw_output_<call>, <-- stage 2
494 * }; 499 * };
495 * 500 *
501 * static const char print_fmt_<call>[] = <TP_printk>;
502 *
496 * static struct ftrace_event_call __used 503 * static struct ftrace_event_call __used
497 * __attribute__((__aligned__(4))) 504 * __attribute__((__aligned__(4)))
498 * __attribute__((section("_ftrace_events"))) event_<call> = { 505 * __attribute__((section("_ftrace_events"))) event_<call> = {
@@ -501,6 +508,8 @@ perf_trace_disable_##name(struct ftrace_event_call *unused) \
501 * .raw_init = trace_event_raw_init, 508 * .raw_init = trace_event_raw_init,
502 * .regfunc = ftrace_reg_event_<call>, 509 * .regfunc = ftrace_reg_event_<call>,
503 * .unregfunc = ftrace_unreg_event_<call>, 510 * .unregfunc = ftrace_unreg_event_<call>,
511 * .print_fmt = print_fmt_<call>,
512 * .define_fields = ftrace_define_fields_<call>,
504 * } 513 * }
505 * 514 *
506 */ 515 */
@@ -569,7 +578,6 @@ ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
569 return; \ 578 return; \
570 entry = ring_buffer_event_data(event); \ 579 entry = ring_buffer_event_data(event); \
571 \ 580 \
572 \
573 tstruct \ 581 tstruct \
574 \ 582 \
575 { assign; } \ 583 { assign; } \
@@ -758,13 +766,12 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
758#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 766#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
759static notrace void \ 767static notrace void \
760perf_trace_templ_##call(struct ftrace_event_call *event_call, \ 768perf_trace_templ_##call(struct ftrace_event_call *event_call, \
761 proto) \ 769 struct pt_regs *__regs, proto) \
762{ \ 770{ \
763 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 771 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
764 struct ftrace_raw_##call *entry; \ 772 struct ftrace_raw_##call *entry; \
765 u64 __addr = 0, __count = 1; \ 773 u64 __addr = 0, __count = 1; \
766 unsigned long irq_flags; \ 774 unsigned long irq_flags; \
767 struct pt_regs *__regs; \
768 int __entry_size; \ 775 int __entry_size; \
769 int __data_size; \ 776 int __data_size; \
770 int rctx; \ 777 int rctx; \
@@ -785,20 +792,22 @@ perf_trace_templ_##call(struct ftrace_event_call *event_call, \
785 \ 792 \
786 { assign; } \ 793 { assign; } \
787 \ 794 \
788 __regs = &__get_cpu_var(perf_trace_regs); \
789 perf_fetch_caller_regs(__regs, 2); \
790 \
791 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \ 795 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
792 __count, irq_flags, __regs); \ 796 __count, irq_flags, __regs); \
793} 797}
794 798
795#undef DEFINE_EVENT 799#undef DEFINE_EVENT
796#define DEFINE_EVENT(template, call, proto, args) \ 800#define DEFINE_EVENT(template, call, proto, args) \
797static notrace void perf_trace_##call(proto) \ 801static notrace void perf_trace_##call(proto) \
798{ \ 802{ \
799 struct ftrace_event_call *event_call = &event_##call; \ 803 struct ftrace_event_call *event_call = &event_##call; \
800 \ 804 struct pt_regs *__regs = &get_cpu_var(perf_trace_regs); \
801 perf_trace_templ_##template(event_call, args); \ 805 \
806 perf_fetch_caller_regs(__regs, 1); \
807 \
808 perf_trace_templ_##template(event_call, __regs, args); \
809 \
810 put_cpu_var(perf_trace_regs); \
802} 811}
803 812
804#undef DEFINE_EVENT_PRINT 813#undef DEFINE_EVENT_PRINT