aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acpi_bus.h18
-rw-r--r--include/acpi/acpi_drivers.h33
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/acpixf.h18
-rw-r--r--include/acpi/actbl.h74
-rw-r--r--include/acpi/actbl1.h6
-rw-r--r--include/acpi/actypes.h18
-rw-r--r--include/acpi/processor.h4
-rw-r--r--include/acpi/video.h11
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-iis.h77
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h72
-rw-r--r--include/asm-frv/highmem.h2
-rw-r--r--include/asm-frv/ide.h24
-rw-r--r--include/asm-frv/socket.h3
-rw-r--r--include/asm-generic/dma-mapping.h308
-rw-r--r--include/asm-generic/fcntl.h12
-rw-r--r--include/asm-generic/gpio.h5
-rw-r--r--include/asm-generic/siginfo.h14
-rw-r--r--include/asm-generic/statfs.h5
-rw-r--r--include/asm-generic/topology.h10
-rw-r--r--include/asm-generic/vmlinux.lds.h15
-rw-r--r--include/asm-m32r/socket.h3
-rw-r--r--include/asm-m32r/spinlock.h3
-rw-r--r--include/asm-mn10300/highmem.h2
-rw-r--r--include/asm-mn10300/ide.h39
-rw-r--r--include/asm-mn10300/pci.h5
-rw-r--r--include/asm-mn10300/socket.h3
-rw-r--r--include/crypto/aes.h6
-rw-r--r--include/crypto/compress.h145
-rw-r--r--include/crypto/cryptd.h27
-rw-r--r--include/crypto/crypto_wq.h7
-rw-r--r--include/crypto/hash.h5
-rw-r--r--include/crypto/internal/compress.h28
-rw-r--r--include/drm/drm.h21
-rw-r--r--include/drm/drmP.h145
-rw-r--r--include/drm/drm_crtc.h6
-rw-r--r--include/drm/drm_crtc_helper.h3
-rw-r--r--include/drm/drm_mode.h153
-rw-r--r--include/drm/drm_os_linux.h19
-rw-r--r--include/drm/drm_pciids.h115
-rw-r--r--include/drm/i915_drm.h140
-rw-r--r--include/drm/mga_drm.h18
-rw-r--r--include/drm/radeon_drm.h9
-rw-r--r--include/drm/via_drm.h42
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi.h35
-rw-r--r--include/linux/agpgart.h14
-rw-r--r--include/linux/arcdevice.h9
-rw-r--r--include/linux/async_tx.h9
-rw-r--r--include/linux/ata.h49
-rw-r--r--include/linux/ath9k_platform.h28
-rw-r--r--include/linux/atmlec.h5
-rw-r--r--include/linux/atmmpc.h45
-rw-r--r--include/linux/audit.h9
-rw-r--r--include/linux/auto_dev-ioctl.h7
-rw-r--r--include/linux/auto_fs.h6
-rw-r--r--include/linux/backing-dev.h12
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/bio.h37
-rw-r--r--include/linux/blkdev.h57
-rw-r--r--include/linux/bootmem.h6
-rw-r--r--include/linux/bsg.h10
-rw-r--r--include/linux/buffer_head.h21
-rw-r--r--include/linux/cgroup.h142
-rw-r--r--include/linux/clk.h17
-rw-r--r--include/linux/clocksource.h101
-rw-r--r--include/linux/cm4000_cs.h10
-rw-r--r--include/linux/cn_proc.h20
-rw-r--r--include/linux/com20020.h1
-rw-r--r--include/linux/compat.h14
-rw-r--r--include/linux/compiler-gcc4.h6
-rw-r--r--include/linux/connector.h12
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/cpu.h16
-rw-r--r--include/linux/cpuset.h37
-rw-r--r--include/linux/crypto.h4
-rw-r--r--include/linux/cyclades.h6
-rw-r--r--include/linux/dca.h20
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/dccp.h51
-rw-r--r--include/linux/device-mapper.h3
-rw-r--r--include/linux/device.h38
-rw-r--r--include/linux/dlm_netlink.h18
-rw-r--r--include/linux/dm-dirty-log.h13
-rw-r--r--include/linux/dm-ioctl.h42
-rw-r--r--include/linux/dma-debug.h174
-rw-r--r--include/linux/dma-mapping.h50
-rw-r--r--include/linux/dma_remapping.h1
-rw-r--r--include/linux/dmaengine.h30
-rw-r--r--include/linux/dmar.h63
-rw-r--r--include/linux/dmi.h7
-rw-r--r--include/linux/ds1wm.h12
-rw-r--r--include/linux/dst.h587
-rw-r--r--include/linux/dvb/audio.h2
-rw-r--r--include/linux/dvb/video.h24
-rw-r--r--include/linux/dw_dmac.h19
-rw-r--r--include/linux/dynamic_debug.h88
-rw-r--r--include/linux/dynamic_printk.h93
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/errqueue.h1
-rw-r--r--include/linux/etherdevice.h21
-rw-r--r--include/linux/ethtool.h89
-rw-r--r--include/linux/eventfd.h12
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/ext3_fs.h6
-rw-r--r--include/linux/fb.h11
-rw-r--r--include/linux/fdtable.h4
-rw-r--r--include/linux/firewire-cdev.h218
-rw-r--r--include/linux/fs.h284
-rw-r--r--include/linux/fs_struct.h7
-rw-r--r--include/linux/fscache-cache.h505
-rw-r--r--include/linux/fscache.h618
-rw-r--r--include/linux/fsl_devices.h29
-rw-r--r--include/linux/gen_stats.h2
-rw-r--r--include/linux/genhd.h5
-rw-r--r--include/linux/gfp.h1
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/hdlc.h5
-rw-r--r--include/linux/hdlcdrv.h3
-rw-r--r--include/linux/hdreg.h66
-rw-r--r--include/linux/hid.h23
-rw-r--r--include/linux/highmem.h17
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/i2c-algo-pca.h33
-rw-r--r--include/linux/i2c-algo-sgi.h26
-rw-r--r--include/linux/i2c-id.h38
-rw-r--r--include/linux/i2c-pca-platform.h2
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/i2c/at24.h4
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/i2c/twl4030.h47
-rw-r--r--include/linux/ibmtr.h2
-rw-r--r--include/linux/ide.h347
-rw-r--r--include/linux/idr.h1
-rw-r--r--include/linux/ieee80211.h198
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arcnet.h27
-rw-r--r--include/linux/if_ether.h9
-rw-r--r--include/linux/if_frad.h1
-rw-r--r--include/linux/if_pppol2tp.h2
-rw-r--r--include/linux/if_pppox.h20
-rw-r--r--include/linux/if_tun.h2
-rw-r--r--include/linux/if_tunnel.h16
-rw-r--r--include/linux/ima.h61
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init_task.h1
-rw-r--r--include/linux/input.h1
-rw-r--r--include/linux/intel-iommu.h27
-rw-r--r--include/linux/interrupt.h102
-rw-r--r--include/linux/iommu.h13
-rw-r--r--include/linux/ip_vs.h26
-rw-r--r--include/linux/ipc_namespace.h65
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/irq.h24
-rw-r--r--include/linux/irqnr.h8
-rw-r--r--include/linux/irqreturn.h30
-rw-r--r--include/linux/ivtv.h10
-rw-r--r--include/linux/ivtvfb.h2
-rw-r--r--include/linux/jbd.h7
-rw-r--r--include/linux/jbd2.h6
-rw-r--r--include/linux/jffs2.h27
-rw-r--r--include/linux/kallsyms.h15
-rw-r--r--include/linux/kernel.h25
-rw-r--r--include/linux/kernel_stat.h13
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/kmod.h11
-rw-r--r--include/linux/kobject.h3
-rw-r--r--include/linux/kprobes.h52
-rw-r--r--include/linux/kvm.h115
-rw-r--r--include/linux/kvm_host.h62
-rw-r--r--include/linux/kvm_types.h13
-rw-r--r--include/linux/latencytop.h10
-rw-r--r--include/linux/leds-bd2802.h26
-rw-r--r--include/linux/leds.h4
-rw-r--r--include/linux/leds_pwm.h21
-rw-r--r--include/linux/libata.h10
-rw-r--r--include/linux/lm_interface.h277
-rw-r--r--include/linux/lockd/xdr.h12
-rw-r--r--include/linux/lockd/xdr4.h10
-rw-r--r--include/linux/lockdep.h17
-rw-r--r--include/linux/loop.h1
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/maple.h62
-rw-r--r--include/linux/matroxfb.h2
-rw-r--r--include/linux/memcontrol.h20
-rw-r--r--include/linux/memory.h11
-rw-r--r--include/linux/mfd/ds1wm.h6
-rw-r--r--include/linux/mfd/htc-pasic3.h1
-rw-r--r--include/linux/mfd/wm8350/audio.h1
-rw-r--r--include/linux/mfd/wm8350/core.h2
-rw-r--r--include/linux/mfd/wm8400-audio.h1
-rw-r--r--include/linux/mg_disk.h206
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h1
-rw-r--r--include/linux/mlx4/device.h6
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/mmzone.h14
-rw-r--r--include/linux/mnt_namespace.h2
-rw-r--r--include/linux/mod_devicetable.h9
-rw-r--r--include/linux/module.h63
-rw-r--r--include/linux/moduleparam.h10
-rw-r--r--include/linux/mount.h1
-rw-r--r--include/linux/mpage.h10
-rw-r--r--include/linux/mroute.h18
-rw-r--r--include/linux/mroute6.h2
-rw-r--r--include/linux/msi.h13
-rw-r--r--include/linux/mtd/mtd.h21
-rw-r--r--include/linux/mtd/nand.h4
-rw-r--r--include/linux/mtd/partitions.h12
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/ncp_no.h26
-rw-r--r--include/linux/neighbour.h1
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/net_dropmon.h56
-rw-r--r--include/linux/net_tstamp.h104
-rw-r--r--include/linux/netdevice.h130
-rw-r--r--include/linux/netfilter/Kbuild8
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter/nfnetlink.h5
-rw-r--r--include/linux/netfilter/nfnetlink_compat.h7
-rw-r--r--include/linux/netfilter/nfnetlink_log.h32
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h24
-rw-r--r--include/linux/netfilter/x_tables.h68
-rw-r--r--include/linux/netfilter/xt_CLASSIFY.h4
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h8
-rw-r--r--include/linux/netfilter/xt_CONNSECMARK.h4
-rw-r--r--include/linux/netfilter/xt_DSCP.h7
-rw-r--r--include/linux/netfilter/xt_LED.h13
-rw-r--r--include/linux/netfilter/xt_MARK.h6
-rw-r--r--include/linux/netfilter/xt_NFLOG.h12
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h4
-rw-r--r--include/linux/netfilter/xt_RATEEST.h6
-rw-r--r--include/linux/netfilter/xt_SECMARK.h6
-rw-r--r--include/linux/netfilter/xt_TCPMSS.h4
-rw-r--r--include/linux/netfilter/xt_cluster.h15
-rw-r--r--include/linux/netfilter/xt_connbytes.h6
-rw-r--r--include/linux/netfilter/xt_connmark.h8
-rw-r--r--include/linux/netfilter/xt_conntrack.h12
-rw-r--r--include/linux/netfilter/xt_dccp.h14
-rw-r--r--include/linux/netfilter/xt_dscp.h12
-rw-r--r--include/linux/netfilter/xt_esp.h6
-rw-r--r--include/linux/netfilter/xt_hashlimit.h32
-rw-r--r--include/linux/netfilter/xt_iprange.h4
-rw-r--r--include/linux/netfilter/xt_length.h6
-rw-r--r--include/linux/netfilter/xt_limit.h17
-rw-r--r--include/linux/netfilter/xt_mark.h8
-rw-r--r--include/linux/netfilter/xt_multiport.h18
-rw-r--r--include/linux/netfilter/xt_owner.h8
-rw-r--r--include/linux/netfilter/xt_physdev.h6
-rw-r--r--include/linux/netfilter/xt_policy.h14
-rw-r--r--include/linux/netfilter/xt_quota.h4
-rw-r--r--include/linux/netfilter/xt_rateest.h14
-rw-r--r--include/linux/netfilter/xt_realm.h8
-rw-r--r--include/linux/netfilter/xt_recent.h12
-rw-r--r--include/linux/netfilter/xt_sctp.h36
-rw-r--r--include/linux/netfilter/xt_statistic.h19
-rw-r--r--include/linux/netfilter/xt_string.h12
-rw-r--r--include/linux/netfilter/xt_tcpmss.h6
-rw-r--r--include/linux/netfilter/xt_tcpudp.h20
-rw-r--r--include/linux/netfilter_bridge.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_owner.h8
-rw-r--r--include/linux/netfilter_ipv6/Kbuild1
-rw-r--r--include/linux/netfilter_ipv6/ip6t_owner.h8
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h13
-rw-r--r--include/linux/nfs.h1
-rw-r--r--include/linux/nfs4.h138
-rw-r--r--include/linux/nfs_fs.h19
-rw-r--r--include/linux/nfs_fs_sb.h16
-rw-r--r--include/linux/nfs_iostat.h12
-rw-r--r--include/linux/nfs_xdr.h61
-rw-r--r--include/linux/nfsd/cache.h8
-rw-r--r--include/linux/nfsd/nfsd.h225
-rw-r--r--include/linux/nfsd/nfsfh.h7
-rw-r--r--include/linux/nfsd/state.h84
-rw-r--r--include/linux/nfsd/stats.h9
-rw-r--r--include/linux/nfsd/xdr4.h129
-rw-r--r--include/linux/nilfs2_fs.h801
-rw-r--r--include/linux/nl80211.h261
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/page-debug-flags.h30
-rw-r--r--include/linux/page-flags.h60
-rw-r--r--include/linux/page_cgroup.h13
-rw-r--r--include/linux/pagemap.h17
-rw-r--r--include/linux/pagevec.h1
-rw-r--r--include/linux/parport_pc.h11
-rw-r--r--include/linux/pci-acpi.h67
-rw-r--r--include/linux/pci.h67
-rw-r--r--include/linux/pci_ids.h51
-rw-r--r--include/linux/pci_regs.h37
-rw-r--r--include/linux/pcieport_if.h36
-rw-r--r--include/linux/percpu.h6
-rw-r--r--include/linux/pfkeyv2.h242
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/pim.h4
-rw-r--r--include/linux/platform_device.h7
-rw-r--r--include/linux/plist.h9
-rw-r--r--include/linux/pm.h11
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/power_supply.h2
-rw-r--r--include/linux/ppp_channel.h6
-rw-r--r--include/linux/ppp_defs.h4
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/pwm.h2
-rw-r--r--include/linux/quota.h11
-rw-r--r--include/linux/quotaops.h119
-rw-r--r--include/linux/raid/bitmap.h288
-rw-r--r--include/linux/raid/linear.h31
-rw-r--r--include/linux/raid/md.h81
-rw-r--r--include/linux/raid/md_k.h402
-rw-r--r--include/linux/raid/md_u.h35
-rw-r--r--include/linux/raid/multipath.h42
-rw-r--r--include/linux/raid/pq.h132
-rw-r--r--include/linux/raid/raid0.h30
-rw-r--r--include/linux/raid/raid1.h134
-rw-r--r--include/linux/raid/raid10.h123
-rw-r--r--include/linux/raid/raid5.h402
-rw-r--r--include/linux/raid/xor.h2
-rw-r--r--include/linux/rcuclassic.h16
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/rcupreempt.h53
-rw-r--r--include/linux/rcutree.h27
-rw-r--r--include/linux/rds.h250
-rw-r--r--include/linux/regulator/bq24022.h3
-rw-r--r--include/linux/regulator/consumer.h6
-rw-r--r--include/linux/regulator/driver.h81
-rw-r--r--include/linux/regulator/fixed.h3
-rw-r--r--include/linux/regulator/machine.h12
-rw-r--r--include/linux/reiserfs_acl.h22
-rw-r--r--include/linux/reiserfs_fs.h168
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/reiserfs_fs_sb.h31
-rw-r--r--include/linux/reiserfs_xattr.h154
-rw-r--r--include/linux/rtc-v3020.h6
-rw-r--r--include/linux/rtc.h6
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h101
-rw-r--r--include/linux/sctp.h92
-rw-r--r--include/linux/security.h37
-rw-r--r--include/linux/selinux_netlink.h6
-rw-r--r--include/linux/seq_file.h9
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/sh_cmt.h13
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/skbuff.h127
-rw-r--r--include/linux/slab_def.h10
-rw-r--r--include/linux/slow-work.h95
-rw-r--r--include/linux/slub_def.h18
-rw-r--r--include/linux/smp.h7
-rw-r--r--include/linux/smsc911x.h3
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/sockios.h3
-rw-r--r--include/linux/sonypi.h8
-rw-r--r--include/linux/spi/eeprom.h6
-rw-r--r--include/linux/spi/libertas_spi.h32
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spi/spi_gpio.h6
-rw-r--r--include/linux/spinlock.h6
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h224
-rw-r--r--include/linux/ssb/ssb_regs.h36
-rw-r--r--include/linux/string.h10
-rw-r--r--include/linux/sunrpc/svc.h25
-rw-r--r--include/linux/sunrpc/svc_xprt.h52
-rw-r--r--include/linux/sunrpc/xdr.h42
-rw-r--r--include/linux/sunrpc/xprt.h2
-rw-r--r--include/linux/suspend.h3
-rw-r--r--include/linux/suspend_ioctls.h11
-rw-r--r--include/linux/swap.h7
-rw-r--r--include/linux/swiotlb.h41
-rw-r--r--include/linux/synclink.h1
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/thermal.h48
-rw-r--r--include/linux/time.h8
-rw-r--r--include/linux/timecompare.h125
-rw-r--r--include/linux/timer.h22
-rw-r--r--include/linux/timeriomem-rng.h21
-rw-r--r--include/linux/times.h8
-rw-r--r--include/linux/timex.h2
-rw-r--r--include/linux/topology.h11
-rw-r--r--include/linux/tpm.h35
-rw-r--r--include/linux/tracehook.h15
-rw-r--r--include/linux/tty_driver.h6
-rw-r--r--include/linux/types.h13
-rw-r--r--include/linux/uio_driver.h4
-rw-r--r--include/linux/usb.h184
-rw-r--r--include/linux/usb/ch9.h183
-rw-r--r--include/linux/usb/composite.h8
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/otg.h8
-rw-r--r--include/linux/usb/quirks.h3
-rw-r--r--include/linux/usb/rndis_host.h85
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/usb/usbnet.h5
-rw-r--r--include/linux/usb/wusb.h3
-rw-r--r--include/linux/usb_usual.h21
-rw-r--r--include/linux/utime.h4
-rw-r--r--include/linux/video_decoder.h48
-rw-r--r--include/linux/video_encoder.h23
-rw-r--r--include/linux/videodev.h18
-rw-r--r--include/linux/videodev2.h74
-rw-r--r--include/linux/virtio_net.h71
-rw-r--r--include/linux/wait.h29
-rw-r--r--include/linux/wimax/debug.h2
-rw-r--r--include/linux/wimax/i2400m.h69
-rw-r--r--include/linux/wireless.h12
-rw-r--r--include/linux/workqueue.h5
-rw-r--r--include/linux/writeback.h6
-rw-r--r--include/linux/xfrm.h2
-rw-r--r--include/media/bt819.h33
-rw-r--r--include/media/cx2341x.h6
-rw-r--r--include/media/cx25840.h12
-rw-r--r--include/media/ir-common.h3
-rw-r--r--include/media/ir-kbd-i2c.h3
-rw-r--r--include/media/msp3400.h4
-rw-r--r--include/media/ov772x.h40
-rw-r--r--include/media/saa7146.h10
-rw-r--r--include/media/saa7146_vv.h17
-rw-r--r--include/media/sh_mobile_ceu.h5
-rw-r--r--include/media/soc_camera.h24
-rw-r--r--include/media/tvaudio.h19
-rw-r--r--include/media/v4l2-chip-ident.h94
-rw-r--r--include/media/v4l2-common.h159
-rw-r--r--include/media/v4l2-dev.h2
-rw-r--r--include/media/v4l2-device.h40
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h152
-rw-r--r--include/media/v4l2-i2c-drv.h6
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-subdev.h137
-rw-r--r--include/media/videobuf-core.h1
-rw-r--r--include/mtd/inftl-user.h36
-rw-r--r--include/mtd/jffs2-user.h5
-rw-r--r--include/mtd/mtd-abi.h70
-rw-r--r--include/mtd/nftl-user.h32
-rw-r--r--include/mtd/ubi-user.h72
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/atmclip.h1
-rw-r--r--include/net/ax88796.h13
-rw-r--r--include/net/bluetooth/bluetooth.h12
-rw-r--r--include/net/bluetooth/hci.h8
-rw-r--r--include/net/bluetooth/hci_core.h84
-rw-r--r--include/net/bluetooth/l2cap.h13
-rw-r--r--include/net/bluetooth/rfcomm.h20
-rw-r--r--include/net/cfg80211.h417
-rw-r--r--include/net/cipso_ipv4.h17
-rw-r--r--include/net/dsa.h42
-rw-r--r--include/net/ethoc.h22
-rw-r--r--include/net/ieee80211.h1185
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet_ecn.h4
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/inet_hashtables.h4
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/mac80211.h342
-rw-r--r--include/net/netfilter/nf_conntrack.h16
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h7
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h17
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h6
-rw-r--r--include/net/netfilter/nf_log.h11
-rw-r--r--include/net/netlabel.h17
-rw-r--r--include/net/netlink.h1
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/ipv4.h13
-rw-r--r--include/net/netrom.h4
-rw-r--r--include/net/phonet/phonet.h1
-rw-r--r--include/net/phonet/pn_dev.h5
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/net/psnap.h6
-rw-r--r--include/net/sch_generic.h28
-rw-r--r--include/net/sctp/checksum.h14
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sock.h49
-rw-r--r--include/net/tcp.h52
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h2
-rw-r--r--include/net/wireless.h86
-rw-r--r--include/rdma/ib_cm.h12
-rw-r--r--include/rdma/ib_mad.h4
-rw-r--r--include/rdma/ib_smi.h34
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/fc/fc_fcoe.h7
-rw-r--r--include/scsi/fc/fc_fip.h237
-rw-r--r--include/scsi/fc_frame.h19
-rw-r--r--include/scsi/fc_transport_fcoe.h54
-rw-r--r--include/scsi/libfc.h76
-rw-r--r--include/scsi/libfcoe.h245
-rw-r--r--include/scsi/libiscsi.h19
-rw-r--r--include/scsi/osd_attributes.h327
-rw-r--r--include/scsi/osd_initiator.h433
-rw-r--r--include/scsi/osd_protocol.h579
-rw-r--r--include/scsi/osd_sec.h45
-rw-r--r--include/scsi/osd_sense.h260
-rw-r--r--include/scsi/osd_types.h40
-rw-r--r--include/scsi/scsi.h31
-rw-r--r--include/scsi/scsi_cmnd.h15
-rw-r--r--include/scsi/scsi_device.h10
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
-rw-r--r--include/sound/ad1816a.h2
-rw-r--r--include/sound/asound.h194
-rw-r--r--include/sound/atmel-abdac.h23
-rw-r--r--include/sound/atmel-ac97c.h40
-rw-r--r--include/sound/control.h52
-rw-r--r--include/sound/core.h36
-rw-r--r--include/sound/emu10k1.h11
-rw-r--r--include/sound/hwdep.h38
-rw-r--r--include/sound/jack.h5
-rw-r--r--include/sound/pcm.h3
-rw-r--r--include/sound/pxa2xx-lib.h15
-rw-r--r--include/sound/rawmidi.h1
-rw-r--r--include/sound/sb.h4
-rw-r--r--include/sound/sfnt_info.h14
-rw-r--r--include/sound/soc-dai.h2
-rw-r--r--include/sound/soc-dapm.h31
-rw-r--r--include/sound/soc.h69
-rw-r--r--include/sound/tea575x-tuner.h8
-rw-r--r--include/sound/uda1341.h126
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wss.h1
-rw-r--r--include/trace/kmemtrace.h92
-rw-r--r--include/trace/skb.h11
-rw-r--r--include/video/aty128.h2
-rw-r--r--include/video/broadsheetfb.h59
-rw-r--r--include/video/cirrus.h2
-rw-r--r--include/video/newport.h4
-rw-r--r--include/video/radeon.h564
-rw-r--r--include/video/s1d13xxxfb.h16
-rw-r--r--include/video/tdfx.h26
541 files changed, 15571 insertions, 8348 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index eda04546cdf6..473d584b1d31 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -103,8 +103,9 @@
103#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) 103#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
104#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) 104#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
105#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) 105#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
106#define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
106 107
107#define AE_CODE_PGM_MAX 0x0008 108#define AE_CODE_PGM_MAX 0x0009
108 109
109/* 110/*
110 * Acpi table exceptions 111 * Acpi table exceptions
@@ -224,7 +225,8 @@ char const *acpi_gbl_exception_names_pgm[] = {
224 "AE_BAD_HEX_CONSTANT", 225 "AE_BAD_HEX_CONSTANT",
225 "AE_BAD_OCTAL_CONSTANT", 226 "AE_BAD_OCTAL_CONSTANT",
226 "AE_BAD_DECIMAL_CONSTANT", 227 "AE_BAD_DECIMAL_CONSTANT",
227 "AE_MISSING_ARGUMENTS" 228 "AE_MISSING_ARGUMENTS",
229 "AE_BAD_ADDRESS"
228}; 230};
229 231
230char const *acpi_gbl_exception_names_tbl[] = { 232char const *acpi_gbl_exception_names_tbl[] = {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e9f6574930ef..a2228511d4be 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -88,44 +88,30 @@ struct acpi_device;
88 88
89typedef int (*acpi_op_add) (struct acpi_device * device); 89typedef int (*acpi_op_add) (struct acpi_device * device);
90typedef int (*acpi_op_remove) (struct acpi_device * device, int type); 90typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
91typedef int (*acpi_op_lock) (struct acpi_device * device, int type);
92typedef int (*acpi_op_start) (struct acpi_device * device); 91typedef int (*acpi_op_start) (struct acpi_device * device);
93typedef int (*acpi_op_stop) (struct acpi_device * device, int type); 92typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
94typedef int (*acpi_op_suspend) (struct acpi_device * device, 93typedef int (*acpi_op_suspend) (struct acpi_device * device,
95 pm_message_t state); 94 pm_message_t state);
96typedef int (*acpi_op_resume) (struct acpi_device * device); 95typedef int (*acpi_op_resume) (struct acpi_device * device);
97typedef int (*acpi_op_scan) (struct acpi_device * device);
98typedef int (*acpi_op_bind) (struct acpi_device * device); 96typedef int (*acpi_op_bind) (struct acpi_device * device);
99typedef int (*acpi_op_unbind) (struct acpi_device * device); 97typedef int (*acpi_op_unbind) (struct acpi_device * device);
100typedef int (*acpi_op_shutdown) (struct acpi_device * device); 98typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
101 99
102struct acpi_bus_ops { 100struct acpi_bus_ops {
103 u32 acpi_op_add:1; 101 u32 acpi_op_add:1;
104 u32 acpi_op_remove:1;
105 u32 acpi_op_lock:1;
106 u32 acpi_op_start:1; 102 u32 acpi_op_start:1;
107 u32 acpi_op_stop:1;
108 u32 acpi_op_suspend:1;
109 u32 acpi_op_resume:1;
110 u32 acpi_op_scan:1;
111 u32 acpi_op_bind:1;
112 u32 acpi_op_unbind:1;
113 u32 acpi_op_shutdown:1;
114 u32 reserved:21;
115}; 103};
116 104
117struct acpi_device_ops { 105struct acpi_device_ops {
118 acpi_op_add add; 106 acpi_op_add add;
119 acpi_op_remove remove; 107 acpi_op_remove remove;
120 acpi_op_lock lock;
121 acpi_op_start start; 108 acpi_op_start start;
122 acpi_op_stop stop; 109 acpi_op_stop stop;
123 acpi_op_suspend suspend; 110 acpi_op_suspend suspend;
124 acpi_op_resume resume; 111 acpi_op_resume resume;
125 acpi_op_scan scan;
126 acpi_op_bind bind; 112 acpi_op_bind bind;
127 acpi_op_unbind unbind; 113 acpi_op_unbind unbind;
128 acpi_op_shutdown shutdown; 114 acpi_op_notify notify;
129}; 115};
130 116
131struct acpi_driver { 117struct acpi_driver {
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 5fc1bb0f4a90..0352c8f0b05b 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -67,6 +67,16 @@
67#define ACPI_BAY_HID "LNXIOBAY" 67#define ACPI_BAY_HID "LNXIOBAY"
68#define ACPI_DOCK_HID "LNXDOCK" 68#define ACPI_DOCK_HID "LNXDOCK"
69 69
70/*
71 * For fixed hardware buttons, we fabricate acpi_devices with HID
72 * ACPI_BUTTON_HID_POWERF or ACPI_BUTTON_HID_SLEEPF. Fixed hardware
73 * signals only an event; it doesn't supply a notification value.
74 * To allow drivers to treat notifications from fixed hardware the
75 * same as those from real devices, we turn the events into this
76 * notification value.
77 */
78#define ACPI_FIXED_HARDWARE_EVENT 0x100
79
70/* -------------------------------------------------------------------------- 80/* --------------------------------------------------------------------------
71 PCI 81 PCI
72 -------------------------------------------------------------------------- */ 82 -------------------------------------------------------------------------- */
@@ -99,24 +109,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
99 int bus); 109 int bus);
100 110
101/* -------------------------------------------------------------------------- 111/* --------------------------------------------------------------------------
102 Power Resource
103 -------------------------------------------------------------------------- */
104
105int acpi_device_sleep_wake(struct acpi_device *dev,
106 int enable, int sleep_state, int dev_state);
107int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
108int acpi_disable_wakeup_device_power(struct acpi_device *dev);
109int acpi_power_get_inferred_state(struct acpi_device *device);
110int acpi_power_transition(struct acpi_device *device, int state);
111extern int acpi_power_nocheck;
112
113/* --------------------------------------------------------------------------
114 Embedded Controller
115 -------------------------------------------------------------------------- */
116int acpi_ec_ecdt_probe(void);
117int acpi_boot_ec_enable(void);
118
119/* --------------------------------------------------------------------------
120 Processor 112 Processor
121 -------------------------------------------------------------------------- */ 113 -------------------------------------------------------------------------- */
122 114
@@ -165,9 +157,4 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
165} 157}
166#endif 158#endif
167 159
168/*--------------------------------------------------------------------------
169 Suspend/Resume
170 -------------------------------------------------------------------------- */
171extern int acpi_sleep_init(void);
172
173#endif /*__ACPI_DRIVERS_H__*/ 160#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index ab0b85cf21f3..3e798593b17b 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -242,10 +242,6 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
242acpi_status acpi_os_validate_interface(char *interface); 242acpi_status acpi_os_validate_interface(char *interface);
243acpi_status acpi_osi_invalidate(char* interface); 243acpi_status acpi_osi_invalidate(char* interface);
244 244
245acpi_status
246acpi_os_validate_address(u8 space_id, acpi_physical_address address,
247 acpi_size length, char *name);
248
249u64 acpi_os_get_timer(void); 245u64 acpi_os_get_timer(void);
250 246
251acpi_status acpi_os_signal(u32 function, void *info); 247acpi_status acpi_os_signal(u32 function, void *info);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index cc40102fe2f3..4db89e98535d 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 0x20081204 50#define ACPI_CA_VERSION 0x20090320
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -191,14 +191,12 @@ acpi_evaluate_object(acpi_handle object,
191 struct acpi_object_list *parameter_objects, 191 struct acpi_object_list *parameter_objects,
192 struct acpi_buffer *return_object_buffer); 192 struct acpi_buffer *return_object_buffer);
193 193
194#ifdef ACPI_FUTURE_USAGE
195acpi_status 194acpi_status
196acpi_evaluate_object_typed(acpi_handle object, 195acpi_evaluate_object_typed(acpi_handle object,
197 acpi_string pathname, 196 acpi_string pathname,
198 struct acpi_object_list *external_params, 197 struct acpi_object_list *external_params,
199 struct acpi_buffer *return_buffer, 198 struct acpi_buffer *return_buffer,
200 acpi_object_type return_type); 199 acpi_object_type return_type);
201#endif
202 200
203acpi_status 201acpi_status
204acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
@@ -349,17 +347,15 @@ acpi_resource_to_address64(struct acpi_resource *resource,
349 */ 347 */
350acpi_status acpi_reset(void); 348acpi_status acpi_reset(void);
351 349
352acpi_status acpi_get_register(u32 register_id, u32 * return_value); 350acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value);
353
354acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
355 351
356acpi_status acpi_set_register(u32 register_id, u32 value); 352acpi_status acpi_write_bit_register(u32 register_id, u32 value);
357 353
358acpi_status 354acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
359acpi_set_firmware_waking_vector(u32 physical_address);
360 355
361acpi_status 356#if ACPI_MACHINE_WIDTH == 64
362acpi_set_firmware_waking_vector64(u64 physical_address); 357acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
358#endif
363 359
364acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); 360acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg);
365 361
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index bf8d4cfd8cf5..222733d01f36 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -214,11 +214,11 @@ struct acpi_table_fadt {
214 u16 flush_size; /* Processor's memory cache line width, in bytes */ 214 u16 flush_size; /* Processor's memory cache line width, in bytes */
215 u16 flush_stride; /* Number of flush strides that need to be read */ 215 u16 flush_stride; /* Number of flush strides that need to be read */
216 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ 216 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */
217 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register. */ 217 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */
218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ 218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ 219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
220 u8 century; /* Index to century in RTC CMOS RAM */ 220 u8 century; /* Index to century in RTC CMOS RAM */
221 u16 boot_flags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */ 221 u16 boot_flags; /* IA-PC Boot Architecture Flags (see below for individual flags) */
222 u8 reserved; /* Reserved, must be zero */ 222 u8 reserved; /* Reserved, must be zero */
223 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ 223 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */
224 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ 224 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */
@@ -236,32 +236,41 @@ struct acpi_table_fadt {
236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
237}; 237};
238 238
239/* FADT Boot Architecture Flags (boot_flags) */
240
241#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
242#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
243#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */
244#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
245#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */
246
247#define FADT2_REVISION_ID 3
248
239/* FADT flags */ 249/* FADT flags */
240 250
241#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */ 251#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */
242#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */ 252#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */
243#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */ 253#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */
244#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */ 254#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */
245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */ 255#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */
246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */ 256#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */
247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */ 257#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */
248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup possible from S4 */ 258#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */
249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */ 259#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */ 260#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */
251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */ 261#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */
252#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */ 262#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */
253#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */ 263#define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */
254#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */ 264#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */
255#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ 265#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
256#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ 266#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */
257#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ 267#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
258#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */ 268#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
259#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */ 269#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
260#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ 270#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
271
272/* FADT Prefered Power Management Profiles */
261 273
262/*
263 * FADT Prefered Power Management Profiles
264 */
265enum acpi_prefered_pm_profiles { 274enum acpi_prefered_pm_profiles {
266 PM_UNSPECIFIED = 0, 275 PM_UNSPECIFIED = 0,
267 PM_DESKTOP = 1, 276 PM_DESKTOP = 1,
@@ -272,16 +281,6 @@ enum acpi_prefered_pm_profiles {
272 PM_APPLIANCE_PC = 6 281 PM_APPLIANCE_PC = 6
273}; 282};
274 283
275/* FADT Boot Arch Flags */
276
277#define BAF_LEGACY_DEVICES 0x0001
278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
279#define BAF_MSI_NOT_SUPPORTED 0x0008
280#define BAF_PCIE_ASPM_CONTROL 0x0010
281
282#define FADT2_REVISION_ID 3
283#define FADT2_MINUS_REVISION_ID 2
284
285/* Reset to default packing */ 284/* Reset to default packing */
286 285
287#pragma pack() 286#pragma pack()
@@ -310,8 +309,9 @@ struct acpi_table_desc {
310#define ACPI_TABLE_ORIGIN_UNKNOWN (0) 309#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
311#define ACPI_TABLE_ORIGIN_MAPPED (1) 310#define ACPI_TABLE_ORIGIN_MAPPED (1)
312#define ACPI_TABLE_ORIGIN_ALLOCATED (2) 311#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
313#define ACPI_TABLE_ORIGIN_MASK (3) 312#define ACPI_TABLE_ORIGIN_OVERRIDE (4)
314#define ACPI_TABLE_IS_LOADED (4) 313#define ACPI_TABLE_ORIGIN_MASK (7)
314#define ACPI_TABLE_IS_LOADED (8)
315 315
316/* 316/*
317 * Get the remaining ACPI tables 317 * Get the remaining ACPI tables
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 18963b968114..59ade0752473 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -1016,9 +1016,9 @@ struct acpi_madt_interrupt_source {
1016struct acpi_madt_local_x2apic { 1016struct acpi_madt_local_x2apic {
1017 struct acpi_subtable_header header; 1017 struct acpi_subtable_header header;
1018 u16 reserved; /* Reserved - must be zero */ 1018 u16 reserved; /* Reserved - must be zero */
1019 u32 local_apic_id; /* Processor X2_APIC ID */ 1019 u32 local_apic_id; /* Processor x2APIC ID */
1020 u32 lapic_flags; 1020 u32 lapic_flags;
1021 u32 uid; /* Extended X2_APIC processor ID */ 1021 u32 uid; /* ACPI processor UID */
1022}; 1022};
1023 1023
1024/* 10: Local X2APIC NMI (07/2008) */ 1024/* 10: Local X2APIC NMI (07/2008) */
@@ -1026,7 +1026,7 @@ struct acpi_madt_local_x2apic {
1026struct acpi_madt_local_x2apic_nmi { 1026struct acpi_madt_local_x2apic_nmi {
1027 struct acpi_subtable_header header; 1027 struct acpi_subtable_header header;
1028 u16 inti_flags; 1028 u16 inti_flags;
1029 u32 uid; /* Processor X2_APIC ID */ 1029 u32 uid; /* ACPI processor UID */
1030 u8 lint; /* LINTn to which NMI is connected */ 1030 u8 lint; /* LINTn to which NMI is connected */
1031 u8 reserved[3]; 1031 u8 reserved[3];
1032}; 1032};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index a20aab510173..f555d927f7c0 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -777,17 +777,25 @@ typedef u8 acpi_adr_space_type;
777#define ACPI_BITREG_SCI_ENABLE 0x0E 777#define ACPI_BITREG_SCI_ENABLE 0x0E
778#define ACPI_BITREG_BUS_MASTER_RLD 0x0F 778#define ACPI_BITREG_BUS_MASTER_RLD 0x0F
779#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 779#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10
780#define ACPI_BITREG_SLEEP_TYPE_A 0x11 780#define ACPI_BITREG_SLEEP_TYPE 0x11
781#define ACPI_BITREG_SLEEP_TYPE_B 0x12 781#define ACPI_BITREG_SLEEP_ENABLE 0x12
782#define ACPI_BITREG_SLEEP_ENABLE 0x13
783 782
784/* PM2 Control register */ 783/* PM2 Control register */
785 784
786#define ACPI_BITREG_ARB_DISABLE 0x14 785#define ACPI_BITREG_ARB_DISABLE 0x13
787 786
788#define ACPI_BITREG_MAX 0x14 787#define ACPI_BITREG_MAX 0x13
789#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 788#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
790 789
790/* Status register values. A 1 clears a status bit. 0 = no effect */
791
792#define ACPI_CLEAR_STATUS 1
793
794/* Enable and Control register values */
795
796#define ACPI_ENABLE_EVENT 1
797#define ACPI_DISABLE_EVENT 0
798
791/* 799/*
792 * External ACPI object definition 800 * External ACPI object definition
793 */ 801 */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 0574add2a1e3..b09c4fde9725 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -322,7 +322,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
322int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 322int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
323int acpi_processor_get_throttling_info(struct acpi_processor *pr); 323int acpi_processor_get_throttling_info(struct acpi_processor *pr);
324extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 324extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
325extern struct file_operations acpi_processor_throttling_fops; 325extern const struct file_operations acpi_processor_throttling_fops;
326extern void acpi_processor_throttling_init(void); 326extern void acpi_processor_throttling_init(void);
327/* in processor_idle.c */ 327/* in processor_idle.c */
328int acpi_processor_power_init(struct acpi_processor *pr, 328int acpi_processor_power_init(struct acpi_processor *pr,
@@ -336,7 +336,7 @@ extern struct cpuidle_driver acpi_idle_driver;
336 336
337/* in processor_thermal.c */ 337/* in processor_thermal.c */
338int acpi_processor_get_limit_info(struct acpi_processor *pr); 338int acpi_processor_get_limit_info(struct acpi_processor *pr);
339extern struct file_operations acpi_processor_limit_fops; 339extern const struct file_operations acpi_processor_limit_fops;
340extern struct thermal_cooling_device_ops processor_cooling_ops; 340extern struct thermal_cooling_device_ops processor_cooling_ops;
341#ifdef CONFIG_CPU_FREQ 341#ifdef CONFIG_CPU_FREQ
342void acpi_thermal_cpufreq_init(void); 342void acpi_thermal_cpufreq_init(void);
diff --git a/include/acpi/video.h b/include/acpi/video.h
new file mode 100644
index 000000000000..f0275bb79ce4
--- /dev/null
+++ b/include/acpi/video.h
@@ -0,0 +1,11 @@
1#ifndef __ACPI_VIDEO_H
2#define __ACPI_VIDEO_H
3
4#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
5extern int acpi_video_register(void);
6#else
7static inline int acpi_video_register(void) { return 0; }
8#endif
9
10#endif
11
diff --git a/include/asm-arm/plat-s3c24xx/regs-iis.h b/include/asm-arm/plat-s3c24xx/regs-iis.h
deleted file mode 100644
index a6f1d5df13b4..000000000000
--- a/include/asm-arm/plat-s3c24xx/regs-iis.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-iis.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 * S3C2410 IIS register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_IIS_H
14#define __ASM_ARCH_REGS_IIS_H
15
16#define S3C2410_IISCON (0x00)
17
18#define S3C2410_IISCON_LRINDEX (1<<8)
19#define S3C2410_IISCON_TXFIFORDY (1<<7)
20#define S3C2410_IISCON_RXFIFORDY (1<<6)
21#define S3C2410_IISCON_TXDMAEN (1<<5)
22#define S3C2410_IISCON_RXDMAEN (1<<4)
23#define S3C2410_IISCON_TXIDLE (1<<3)
24#define S3C2410_IISCON_RXIDLE (1<<2)
25#define S3C2410_IISCON_PSCEN (1<<1)
26#define S3C2410_IISCON_IISEN (1<<0)
27
28#define S3C2410_IISMOD (0x04)
29
30#define S3C2440_IISMOD_MPLL (1<<9)
31#define S3C2410_IISMOD_SLAVE (1<<8)
32#define S3C2410_IISMOD_NOXFER (0<<6)
33#define S3C2410_IISMOD_RXMODE (1<<6)
34#define S3C2410_IISMOD_TXMODE (2<<6)
35#define S3C2410_IISMOD_TXRXMODE (3<<6)
36#define S3C2410_IISMOD_LR_LLOW (0<<5)
37#define S3C2410_IISMOD_LR_RLOW (1<<5)
38#define S3C2410_IISMOD_IIS (0<<4)
39#define S3C2410_IISMOD_MSB (1<<4)
40#define S3C2410_IISMOD_8BIT (0<<3)
41#define S3C2410_IISMOD_16BIT (1<<3)
42#define S3C2410_IISMOD_BITMASK (1<<3)
43#define S3C2410_IISMOD_256FS (0<<2)
44#define S3C2410_IISMOD_384FS (1<<2)
45#define S3C2410_IISMOD_16FS (0<<0)
46#define S3C2410_IISMOD_32FS (1<<0)
47#define S3C2410_IISMOD_48FS (2<<0)
48#define S3C2410_IISMOD_FS_MASK (3<<0)
49
50#define S3C2410_IISPSR (0x08)
51#define S3C2410_IISPSR_INTMASK (31<<5)
52#define S3C2410_IISPSR_INTSHIFT (5)
53#define S3C2410_IISPSR_EXTMASK (31<<0)
54#define S3C2410_IISPSR_EXTSHFIT (0)
55
56#define S3C2410_IISFCON (0x0c)
57
58#define S3C2410_IISFCON_TXDMA (1<<15)
59#define S3C2410_IISFCON_RXDMA (1<<14)
60#define S3C2410_IISFCON_TXENABLE (1<<13)
61#define S3C2410_IISFCON_RXENABLE (1<<12)
62#define S3C2410_IISFCON_TXMASK (0x3f << 6)
63#define S3C2410_IISFCON_TXSHIFT (6)
64#define S3C2410_IISFCON_RXMASK (0x3f)
65#define S3C2410_IISFCON_RXSHIFT (0)
66
67#define S3C2400_IISFCON_TXDMA (1<<11)
68#define S3C2400_IISFCON_RXDMA (1<<10)
69#define S3C2400_IISFCON_TXENABLE (1<<9)
70#define S3C2400_IISFCON_RXENABLE (1<<8)
71#define S3C2400_IISFCON_TXMASK (0x07 << 4)
72#define S3C2400_IISFCON_TXSHIFT (4)
73#define S3C2400_IISFCON_RXMASK (0x07)
74#define S3C2400_IISFCON_RXSHIFT (0)
75
76#define S3C2410_IISFIFO (0x10)
77#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h b/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
deleted file mode 100644
index 25d4058bcfed..000000000000
--- a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
2 *
3 * Copyright 2007 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 * S3C2412 IIS register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_S3C2412_IIS_H
14#define __ASM_ARCH_REGS_S3C2412_IIS_H
15
16#define S3C2412_IISCON (0x00)
17#define S3C2412_IISMOD (0x04)
18#define S3C2412_IISFIC (0x08)
19#define S3C2412_IISPSR (0x0C)
20#define S3C2412_IISTXD (0x10)
21#define S3C2412_IISRXD (0x14)
22
23#define S3C2412_IISCON_LRINDEX (1 << 11)
24#define S3C2412_IISCON_TXFIFO_EMPTY (1 << 10)
25#define S3C2412_IISCON_RXFIFO_EMPTY (1 << 9)
26#define S3C2412_IISCON_TXFIFO_FULL (1 << 8)
27#define S3C2412_IISCON_RXFIFO_FULL (1 << 7)
28#define S3C2412_IISCON_TXDMA_PAUSE (1 << 6)
29#define S3C2412_IISCON_RXDMA_PAUSE (1 << 5)
30#define S3C2412_IISCON_TXCH_PAUSE (1 << 4)
31#define S3C2412_IISCON_RXCH_PAUSE (1 << 3)
32#define S3C2412_IISCON_TXDMA_ACTIVE (1 << 2)
33#define S3C2412_IISCON_RXDMA_ACTIVE (1 << 1)
34#define S3C2412_IISCON_IIS_ACTIVE (1 << 0)
35
36#define S3C2412_IISMOD_MASTER_INTERNAL (0 << 10)
37#define S3C2412_IISMOD_MASTER_EXTERNAL (1 << 10)
38#define S3C2412_IISMOD_SLAVE (2 << 10)
39#define S3C2412_IISMOD_MASTER_MASK (3 << 10)
40#define S3C2412_IISMOD_MODE_TXONLY (0 << 8)
41#define S3C2412_IISMOD_MODE_RXONLY (1 << 8)
42#define S3C2412_IISMOD_MODE_TXRX (2 << 8)
43#define S3C2412_IISMOD_MODE_MASK (3 << 8)
44#define S3C2412_IISMOD_LR_LLOW (0 << 7)
45#define S3C2412_IISMOD_LR_RLOW (1 << 7)
46#define S3C2412_IISMOD_SDF_IIS (0 << 5)
47#define S3C2412_IISMOD_SDF_MSB (0 << 5)
48#define S3C2412_IISMOD_SDF_LSB (0 << 5)
49#define S3C2412_IISMOD_SDF_MASK (3 << 5)
50#define S3C2412_IISMOD_RCLK_256FS (0 << 3)
51#define S3C2412_IISMOD_RCLK_512FS (1 << 3)
52#define S3C2412_IISMOD_RCLK_384FS (2 << 3)
53#define S3C2412_IISMOD_RCLK_768FS (3 << 3)
54#define S3C2412_IISMOD_RCLK_MASK (3 << 3)
55#define S3C2412_IISMOD_BCLK_32FS (0 << 1)
56#define S3C2412_IISMOD_BCLK_48FS (1 << 1)
57#define S3C2412_IISMOD_BCLK_16FS (2 << 1)
58#define S3C2412_IISMOD_BCLK_24FS (3 << 1)
59#define S3C2412_IISMOD_BCLK_MASK (3 << 1)
60#define S3C2412_IISMOD_8BIT (1 << 0)
61
62#define S3C2412_IISPSR_PSREN (1 << 15)
63
64#define S3C2412_IISFIC_TXFLUSH (1 << 15)
65#define S3C2412_IISFIC_RXFLUSH (1 << 7)
66#define S3C2412_IISFIC_TXCOUNT(x) (((x) >> 8) & 0xf)
67#define S3C2412_IISFIC_RXCOUNT(x) (((x) >> 0) & 0xf)
68
69
70
71#endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */
72
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index 26cefcde5cee..68e4677fb9e7 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -18,6 +18,7 @@
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/highmem.h>
21#include <asm/mem-layout.h> 22#include <asm/mem-layout.h>
22#include <asm/spr-regs.h> 23#include <asm/spr-regs.h>
23#include <asm/mb-regs.h> 24#include <asm/mb-regs.h>
@@ -116,6 +117,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
116 unsigned long paddr; 117 unsigned long paddr;
117 118
118 pagefault_disable(); 119 pagefault_disable();
120 debug_kmap_atomic(type);
119 paddr = page_to_phys(page); 121 paddr = page_to_phys(page);
120 122
121 switch (type) { 123 switch (type) {
diff --git a/include/asm-frv/ide.h b/include/asm-frv/ide.h
deleted file mode 100644
index 361076611855..000000000000
--- a/include/asm-frv/ide.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* ide.h: FRV IDE declarations
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_IDE_H
13#define _ASM_IDE_H
14
15#ifdef __KERNEL__
16
17#include <asm/setup.h>
18#include <asm/io.h>
19#include <asm/irq.h>
20
21#include <asm-generic/ide_iops.h>
22
23#endif /* __KERNEL__ */
24#endif /* _ASM_IDE_H */
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index e51ca67b9356..57c3d4054e8b 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -54,5 +54,8 @@
54 54
55#define SO_MARK 36 55#define SO_MARK 36
56 56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
57#endif /* _ASM_SOCKET_H */ 60#endif /* _ASM_SOCKET_H */
58 61
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
deleted file mode 100644
index 189486c3f92e..000000000000
--- a/include/asm-generic/dma-mapping.h
+++ /dev/null
@@ -1,308 +0,0 @@
1/* Copyright (C) 2002 by James.Bottomley@HansenPartnership.com
2 *
3 * Implements the generic device dma API via the existing pci_ one
4 * for unconverted architectures
5 */
6
7#ifndef _ASM_GENERIC_DMA_MAPPING_H
8#define _ASM_GENERIC_DMA_MAPPING_H
9
10
11#ifdef CONFIG_PCI
12
13/* we implement the API below in terms of the existing PCI one,
14 * so include it */
15#include <linux/pci.h>
16/* need struct page definitions */
17#include <linux/mm.h>
18
19static inline int
20dma_supported(struct device *dev, u64 mask)
21{
22 BUG_ON(dev->bus != &pci_bus_type);
23
24 return pci_dma_supported(to_pci_dev(dev), mask);
25}
26
27static inline int
28dma_set_mask(struct device *dev, u64 dma_mask)
29{
30 BUG_ON(dev->bus != &pci_bus_type);
31
32 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
33}
34
35static inline void *
36dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
37 gfp_t flag)
38{
39 BUG_ON(dev->bus != &pci_bus_type);
40
41 return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
42}
43
44static inline void
45dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
46 dma_addr_t dma_handle)
47{
48 BUG_ON(dev->bus != &pci_bus_type);
49
50 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
51}
52
53static inline dma_addr_t
54dma_map_single(struct device *dev, void *cpu_addr, size_t size,
55 enum dma_data_direction direction)
56{
57 BUG_ON(dev->bus != &pci_bus_type);
58
59 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
60}
61
62static inline void
63dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
64 enum dma_data_direction direction)
65{
66 BUG_ON(dev->bus != &pci_bus_type);
67
68 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
69}
70
71static inline dma_addr_t
72dma_map_page(struct device *dev, struct page *page,
73 unsigned long offset, size_t size,
74 enum dma_data_direction direction)
75{
76 BUG_ON(dev->bus != &pci_bus_type);
77
78 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
79}
80
81static inline void
82dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
83 enum dma_data_direction direction)
84{
85 BUG_ON(dev->bus != &pci_bus_type);
86
87 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
88}
89
90static inline int
91dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
92 enum dma_data_direction direction)
93{
94 BUG_ON(dev->bus != &pci_bus_type);
95
96 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
97}
98
99static inline void
100dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
101 enum dma_data_direction direction)
102{
103 BUG_ON(dev->bus != &pci_bus_type);
104
105 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
106}
107
108static inline void
109dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
110 enum dma_data_direction direction)
111{
112 BUG_ON(dev->bus != &pci_bus_type);
113
114 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
115 size, (int)direction);
116}
117
118static inline void
119dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
120 enum dma_data_direction direction)
121{
122 BUG_ON(dev->bus != &pci_bus_type);
123
124 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
125 size, (int)direction);
126}
127
128static inline void
129dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
130 enum dma_data_direction direction)
131{
132 BUG_ON(dev->bus != &pci_bus_type);
133
134 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
135}
136
137static inline void
138dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
139 enum dma_data_direction direction)
140{
141 BUG_ON(dev->bus != &pci_bus_type);
142
143 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
144}
145
146static inline int
147dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
148{
149 return pci_dma_mapping_error(to_pci_dev(dev), dma_addr);
150}
151
152
153#else
154
155static inline int
156dma_supported(struct device *dev, u64 mask)
157{
158 return 0;
159}
160
161static inline int
162dma_set_mask(struct device *dev, u64 dma_mask)
163{
164 BUG();
165 return 0;
166}
167
168static inline void *
169dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
170 gfp_t flag)
171{
172 BUG();
173 return NULL;
174}
175
176static inline void
177dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
178 dma_addr_t dma_handle)
179{
180 BUG();
181}
182
183static inline dma_addr_t
184dma_map_single(struct device *dev, void *cpu_addr, size_t size,
185 enum dma_data_direction direction)
186{
187 BUG();
188 return 0;
189}
190
191static inline void
192dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
193 enum dma_data_direction direction)
194{
195 BUG();
196}
197
198static inline dma_addr_t
199dma_map_page(struct device *dev, struct page *page,
200 unsigned long offset, size_t size,
201 enum dma_data_direction direction)
202{
203 BUG();
204 return 0;
205}
206
207static inline void
208dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
209 enum dma_data_direction direction)
210{
211 BUG();
212}
213
214static inline int
215dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
216 enum dma_data_direction direction)
217{
218 BUG();
219 return 0;
220}
221
222static inline void
223dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
224 enum dma_data_direction direction)
225{
226 BUG();
227}
228
229static inline void
230dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
231 enum dma_data_direction direction)
232{
233 BUG();
234}
235
236static inline void
237dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
238 enum dma_data_direction direction)
239{
240 BUG();
241}
242
243static inline void
244dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
245 enum dma_data_direction direction)
246{
247 BUG();
248}
249
250static inline void
251dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
252 enum dma_data_direction direction)
253{
254 BUG();
255}
256
257static inline int
258dma_error(dma_addr_t dma_addr)
259{
260 return 0;
261}
262
263#endif
264
265/* Now for the API extensions over the pci_ one */
266
267#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
268#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
269#define dma_is_consistent(d, h) (1)
270
271static inline int
272dma_get_cache_alignment(void)
273{
274 /* no easy way to get cache size on all processors, so return
275 * the maximum possible, to be safe */
276 return (1 << INTERNODE_CACHE_SHIFT);
277}
278
279static inline void
280dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
281 unsigned long offset, size_t size,
282 enum dma_data_direction direction)
283{
284 /* just sync everything, that's all the pci API can do */
285 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
286}
287
288static inline void
289dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
290 unsigned long offset, size_t size,
291 enum dma_data_direction direction)
292{
293 /* just sync everything, that's all the pci API can do */
294 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
295}
296
297static inline void
298dma_cache_sync(struct device *dev, void *vaddr, size_t size,
299 enum dma_data_direction direction)
300{
301 /* could define this in terms of the dma_cache ... operations,
302 * but if you get this on a platform, you should convert the platform
303 * to using the generic device DMA API */
304 BUG();
305}
306
307#endif
308
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index b8477414c5c8..4d3e48373e74 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -117,9 +117,9 @@
117struct flock { 117struct flock {
118 short l_type; 118 short l_type;
119 short l_whence; 119 short l_whence;
120 off_t l_start; 120 __kernel_off_t l_start;
121 off_t l_len; 121 __kernel_off_t l_len;
122 pid_t l_pid; 122 __kernel_pid_t l_pid;
123 __ARCH_FLOCK_PAD 123 __ARCH_FLOCK_PAD
124}; 124};
125#endif 125#endif
@@ -140,9 +140,9 @@ struct flock {
140struct flock64 { 140struct flock64 {
141 short l_type; 141 short l_type;
142 short l_whence; 142 short l_whence;
143 loff_t l_start; 143 __kernel_loff_t l_start;
144 loff_t l_len; 144 __kernel_loff_t l_len;
145 pid_t l_pid; 145 __kernel_pid_t l_pid;
146 __ARCH_FLOCK64_PAD 146 __ARCH_FLOCK64_PAD
147}; 147};
148#endif 148#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 81797ec9ab29..d6c379dc64fa 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -55,6 +55,10 @@ struct module;
55 * handled is (base + ngpio - 1). 55 * handled is (base + ngpio - 1).
56 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 56 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
57 * must while accessing GPIO expander chips over I2C or SPI 57 * must while accessing GPIO expander chips over I2C or SPI
58 * @names: if set, must be an array of strings to use as alternative
59 * names for the GPIOs in this chip. Any entry in the array
60 * may be NULL if there is no alias for the GPIO, however the
61 * array must be @ngpio entries long.
58 * 62 *
59 * A gpio_chip can help platforms abstract various sources of GPIOs so 63 * A gpio_chip can help platforms abstract various sources of GPIOs so
60 * they can all be accessed through a common programing interface. 64 * they can all be accessed through a common programing interface.
@@ -92,6 +96,7 @@ struct gpio_chip {
92 struct gpio_chip *chip); 96 struct gpio_chip *chip);
93 int base; 97 int base;
94 u16 ngpio; 98 u16 ngpio;
99 char **names;
95 unsigned can_sleep:1; 100 unsigned can_sleep:1;
96 unsigned exported:1; 101 unsigned exported:1;
97}; 102};
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 969570167e9e..35752dadd6df 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -23,7 +23,7 @@ typedef union sigval {
23#endif 23#endif
24 24
25#ifndef __ARCH_SI_UID_T 25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T uid_t 26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif 27#endif
28 28
29/* 29/*
@@ -47,13 +47,13 @@ typedef struct siginfo {
47 47
48 /* kill() */ 48 /* kill() */
49 struct { 49 struct {
50 pid_t _pid; /* sender's pid */ 50 __kernel_pid_t _pid; /* sender's pid */
51 __ARCH_SI_UID_T _uid; /* sender's uid */ 51 __ARCH_SI_UID_T _uid; /* sender's uid */
52 } _kill; 52 } _kill;
53 53
54 /* POSIX.1b timers */ 54 /* POSIX.1b timers */
55 struct { 55 struct {
56 timer_t _tid; /* timer id */ 56 __kernel_timer_t _tid; /* timer id */
57 int _overrun; /* overrun count */ 57 int _overrun; /* overrun count */
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; 58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval; /* same as below */ 59 sigval_t _sigval; /* same as below */
@@ -62,18 +62,18 @@ typedef struct siginfo {
62 62
63 /* POSIX.1b signals */ 63 /* POSIX.1b signals */
64 struct { 64 struct {
65 pid_t _pid; /* sender's pid */ 65 __kernel_pid_t _pid; /* sender's pid */
66 __ARCH_SI_UID_T _uid; /* sender's uid */ 66 __ARCH_SI_UID_T _uid; /* sender's uid */
67 sigval_t _sigval; 67 sigval_t _sigval;
68 } _rt; 68 } _rt;
69 69
70 /* SIGCHLD */ 70 /* SIGCHLD */
71 struct { 71 struct {
72 pid_t _pid; /* which child */ 72 __kernel_pid_t _pid; /* which child */
73 __ARCH_SI_UID_T _uid; /* sender's uid */ 73 __ARCH_SI_UID_T _uid; /* sender's uid */
74 int _status; /* exit code */ 74 int _status; /* exit code */
75 clock_t _utime; 75 __kernel_clock_t _utime;
76 clock_t _stime; 76 __kernel_clock_t _stime;
77 } _sigchld; 77 } _sigchld;
78 78
79 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 79 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 6129d6802149..3b4fb3e52f0d 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -1,8 +1,9 @@
1#ifndef _GENERIC_STATFS_H 1#ifndef _GENERIC_STATFS_H
2#define _GENERIC_STATFS_H 2#define _GENERIC_STATFS_H
3 3
4#ifndef __KERNEL_STRICT_NAMES 4#include <linux/types.h>
5# include <linux/types.h> 5
6#ifdef __KERNEL__
6typedef __kernel_fsid_t fsid_t; 7typedef __kernel_fsid_t fsid_t;
7#endif 8#endif
8 9
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index 0e9e2bc0ee96..88bada2ebc4b 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -43,20 +43,10 @@
43#ifndef cpumask_of_node 43#ifndef cpumask_of_node
44#define cpumask_of_node(node) ((void)node, cpu_online_mask) 44#define cpumask_of_node(node) ((void)node, cpu_online_mask)
45#endif 45#endif
46#ifndef node_to_first_cpu
47#define node_to_first_cpu(node) ((void)(node),0)
48#endif
49#ifndef pcibus_to_node 46#ifndef pcibus_to_node
50#define pcibus_to_node(bus) ((void)(bus), -1) 47#define pcibus_to_node(bus) ((void)(bus), -1)
51#endif 48#endif
52 49
53#ifndef pcibus_to_cpumask
54#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
55 CPU_MASK_ALL : \
56 node_to_cpumask(pcibus_to_node(bus)) \
57 )
58#endif
59
60#ifndef cpumask_of_pcibus 50#ifndef cpumask_of_pcibus
61#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 51#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
62 cpu_all_mask : \ 52 cpu_all_mask : \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d3bc3c86df6a..7fa660fd449c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -104,6 +104,11 @@
104 VMLINUX_SYMBOL(__start___tracepoints) = .; \ 104 VMLINUX_SYMBOL(__start___tracepoints) = .; \
105 *(__tracepoints) \ 105 *(__tracepoints) \
106 VMLINUX_SYMBOL(__stop___tracepoints) = .; \ 106 VMLINUX_SYMBOL(__stop___tracepoints) = .; \
107 /* implement dynamic printk debug */ \
108 . = ALIGN(8); \
109 VMLINUX_SYMBOL(__start___verbose) = .; \
110 *(__verbose) \
111 VMLINUX_SYMBOL(__stop___verbose) = .; \
107 LIKELY_PROFILE() \ 112 LIKELY_PROFILE() \
108 BRANCH_PROFILE() \ 113 BRANCH_PROFILE() \
109 TRACE_PRINTKS() \ 114 TRACE_PRINTKS() \
@@ -336,15 +341,7 @@
336 CPU_DISCARD(init.data) \ 341 CPU_DISCARD(init.data) \
337 CPU_DISCARD(init.rodata) \ 342 CPU_DISCARD(init.rodata) \
338 MEM_DISCARD(init.data) \ 343 MEM_DISCARD(init.data) \
339 MEM_DISCARD(init.rodata) \ 344 MEM_DISCARD(init.rodata)
340 /* implement dynamic printk debug */ \
341 VMLINUX_SYMBOL(__start___verbose_strings) = .; \
342 *(__verbose_strings) \
343 VMLINUX_SYMBOL(__stop___verbose_strings) = .; \
344 . = ALIGN(8); \
345 VMLINUX_SYMBOL(__start___verbose) = .; \
346 *(__verbose) \
347 VMLINUX_SYMBOL(__stop___verbose) = .;
348 345
349#define INIT_TEXT \ 346#define INIT_TEXT \
350 *(.init.text) \ 347 *(.init.text) \
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 9a0e20012224..be7ed589af5c 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -54,4 +54,7 @@
54 54
55#define SO_MARK 36 55#define SO_MARK 36
56 56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
57#endif /* _ASM_M32R_SOCKET_H */ 60#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f5cfba81ee10..dded923883b2 100644
--- a/include/asm-m32r/spinlock.h
+++ b/include/asm-m32r/spinlock.h
@@ -316,6 +316,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
316 return 0; 316 return 0;
317} 317}
318 318
319#define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock)
320#define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock)
321
319#define _raw_spin_relax(lock) cpu_relax() 322#define _raw_spin_relax(lock) cpu_relax()
320#define _raw_read_relax(lock) cpu_relax() 323#define _raw_read_relax(lock) cpu_relax()
321#define _raw_write_relax(lock) cpu_relax() 324#define _raw_write_relax(lock) cpu_relax()
diff --git a/include/asm-mn10300/highmem.h b/include/asm-mn10300/highmem.h
index 5256854c0453..90f2abb04bfd 100644
--- a/include/asm-mn10300/highmem.h
+++ b/include/asm-mn10300/highmem.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/highmem.h>
19#include <asm/kmap_types.h> 20#include <asm/kmap_types.h>
20#include <asm/pgtable.h> 21#include <asm/pgtable.h>
21 22
@@ -77,6 +78,7 @@ static inline unsigned long kmap_atomic(struct page *page, enum km_type type)
77 if (page < highmem_start_page) 78 if (page < highmem_start_page)
78 return page_address(page); 79 return page_address(page);
79 80
81 debug_kmap_atomic(type);
80 idx = type + KM_TYPE_NR * smp_processor_id(); 82 idx = type + KM_TYPE_NR * smp_processor_id();
81 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
82#if HIGHMEM_DEBUG 84#if HIGHMEM_DEBUG
diff --git a/include/asm-mn10300/ide.h b/include/asm-mn10300/ide.h
deleted file mode 100644
index 6adcdd92e83d..000000000000
--- a/include/asm-mn10300/ide.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* MN10300 Arch-specific IDE code
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-i386/ide.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
11 */
12
13#ifndef _ASM_IDE_H
14#define _ASM_IDE_H
15
16#ifdef __KERNEL__
17
18#include <asm/intctl-regs.h>
19
20#undef SUPPORT_SLOW_DATA_PORTS
21#define SUPPORT_SLOW_DATA_PORTS 0
22
23#undef SUPPORT_VLB_SYNC
24#define SUPPORT_VLB_SYNC 0
25
26/*
27 * some bits needed for parts of the IDE subsystem to compile
28 */
29#define __ide_mm_insw(port, addr, n) \
30 insw((unsigned long) (port), (addr), (n))
31#define __ide_mm_insl(port, addr, n) \
32 insl((unsigned long) (port), (addr), (n))
33#define __ide_mm_outsw(port, addr, n) \
34 outsw((unsigned long) (port), (addr), (n))
35#define __ide_mm_outsl(port, addr, n) \
36 outsl((unsigned long) (port), (addr), (n))
37
38#endif /* __KERNEL__ */
39#endif /* _ASM_IDE_H */
diff --git a/include/asm-mn10300/pci.h b/include/asm-mn10300/pci.h
index cd9cc5c89cea..0517b45313d8 100644
--- a/include/asm-mn10300/pci.h
+++ b/include/asm-mn10300/pci.h
@@ -121,4 +121,9 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
121 121
122#define pcibios_scan_all_fns(a, b) 0 122#define pcibios_scan_all_fns(a, b) 0
123 123
124static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
125{
126 return channel ? 15 : 14;
127}
128
124#endif /* _ASM_PCI_H */ 129#endif /* _ASM_PCI_H */
diff --git a/include/asm-mn10300/socket.h b/include/asm-mn10300/socket.h
index 80af9c4ccad7..fb5daf438ec9 100644
--- a/include/asm-mn10300/socket.h
+++ b/include/asm-mn10300/socket.h
@@ -54,4 +54,7 @@
54 54
55#define SO_MARK 36 55#define SO_MARK 36
56 56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
57#endif /* _ASM_SOCKET_H */ 60#endif /* _ASM_SOCKET_H */
diff --git a/include/crypto/aes.h b/include/crypto/aes.h
index 656a4c66a568..7524ba3b6f3c 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -17,10 +17,14 @@
17#define AES_MAX_KEYLENGTH (15 * 16) 17#define AES_MAX_KEYLENGTH (15 * 16)
18#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32)) 18#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32))
19 19
20/*
21 * Please ensure that the first two fields are 16-byte aligned
22 * relative to the start of the structure, i.e., don't move them!
23 */
20struct crypto_aes_ctx { 24struct crypto_aes_ctx {
21 u32 key_length;
22 u32 key_enc[AES_MAX_KEYLENGTH_U32]; 25 u32 key_enc[AES_MAX_KEYLENGTH_U32];
23 u32 key_dec[AES_MAX_KEYLENGTH_U32]; 26 u32 key_dec[AES_MAX_KEYLENGTH_U32];
27 u32 key_length;
24}; 28};
25 29
26extern const u32 crypto_ft_tab[4][256]; 30extern const u32 crypto_ft_tab[4][256];
diff --git a/include/crypto/compress.h b/include/crypto/compress.h
new file mode 100644
index 000000000000..86163ef24219
--- /dev/null
+++ b/include/crypto/compress.h
@@ -0,0 +1,145 @@
1/*
2 * Compress: Compression algorithms under the cryptographic API.
3 *
4 * Copyright 2008 Sony Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 * If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _CRYPTO_COMPRESS_H
21#define _CRYPTO_COMPRESS_H
22
23#include <linux/crypto.h>
24
25
26struct comp_request {
27 const void *next_in; /* next input byte */
28 void *next_out; /* next output byte */
29 unsigned int avail_in; /* bytes available at next_in */
30 unsigned int avail_out; /* bytes available at next_out */
31};
32
33enum zlib_comp_params {
34 ZLIB_COMP_LEVEL = 1, /* e.g. Z_DEFAULT_COMPRESSION */
35 ZLIB_COMP_METHOD, /* e.g. Z_DEFLATED */
36 ZLIB_COMP_WINDOWBITS, /* e.g. MAX_WBITS */
37 ZLIB_COMP_MEMLEVEL, /* e.g. DEF_MEM_LEVEL */
38 ZLIB_COMP_STRATEGY, /* e.g. Z_DEFAULT_STRATEGY */
39 __ZLIB_COMP_MAX,
40};
41
42#define ZLIB_COMP_MAX (__ZLIB_COMP_MAX - 1)
43
44
45enum zlib_decomp_params {
46 ZLIB_DECOMP_WINDOWBITS = 1, /* e.g. DEF_WBITS */
47 __ZLIB_DECOMP_MAX,
48};
49
50#define ZLIB_DECOMP_MAX (__ZLIB_DECOMP_MAX - 1)
51
52
53struct crypto_pcomp {
54 struct crypto_tfm base;
55};
56
57struct pcomp_alg {
58 int (*compress_setup)(struct crypto_pcomp *tfm, void *params,
59 unsigned int len);
60 int (*compress_init)(struct crypto_pcomp *tfm);
61 int (*compress_update)(struct crypto_pcomp *tfm,
62 struct comp_request *req);
63 int (*compress_final)(struct crypto_pcomp *tfm,
64 struct comp_request *req);
65 int (*decompress_setup)(struct crypto_pcomp *tfm, void *params,
66 unsigned int len);
67 int (*decompress_init)(struct crypto_pcomp *tfm);
68 int (*decompress_update)(struct crypto_pcomp *tfm,
69 struct comp_request *req);
70 int (*decompress_final)(struct crypto_pcomp *tfm,
71 struct comp_request *req);
72
73 struct crypto_alg base;
74};
75
76extern struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type,
77 u32 mask);
78
79static inline struct crypto_tfm *crypto_pcomp_tfm(struct crypto_pcomp *tfm)
80{
81 return &tfm->base;
82}
83
84static inline void crypto_free_pcomp(struct crypto_pcomp *tfm)
85{
86 crypto_destroy_tfm(tfm, crypto_pcomp_tfm(tfm));
87}
88
89static inline struct pcomp_alg *__crypto_pcomp_alg(struct crypto_alg *alg)
90{
91 return container_of(alg, struct pcomp_alg, base);
92}
93
94static inline struct pcomp_alg *crypto_pcomp_alg(struct crypto_pcomp *tfm)
95{
96 return __crypto_pcomp_alg(crypto_pcomp_tfm(tfm)->__crt_alg);
97}
98
99static inline int crypto_compress_setup(struct crypto_pcomp *tfm,
100 void *params, unsigned int len)
101{
102 return crypto_pcomp_alg(tfm)->compress_setup(tfm, params, len);
103}
104
105static inline int crypto_compress_init(struct crypto_pcomp *tfm)
106{
107 return crypto_pcomp_alg(tfm)->compress_init(tfm);
108}
109
110static inline int crypto_compress_update(struct crypto_pcomp *tfm,
111 struct comp_request *req)
112{
113 return crypto_pcomp_alg(tfm)->compress_update(tfm, req);
114}
115
116static inline int crypto_compress_final(struct crypto_pcomp *tfm,
117 struct comp_request *req)
118{
119 return crypto_pcomp_alg(tfm)->compress_final(tfm, req);
120}
121
122static inline int crypto_decompress_setup(struct crypto_pcomp *tfm,
123 void *params, unsigned int len)
124{
125 return crypto_pcomp_alg(tfm)->decompress_setup(tfm, params, len);
126}
127
128static inline int crypto_decompress_init(struct crypto_pcomp *tfm)
129{
130 return crypto_pcomp_alg(tfm)->decompress_init(tfm);
131}
132
133static inline int crypto_decompress_update(struct crypto_pcomp *tfm,
134 struct comp_request *req)
135{
136 return crypto_pcomp_alg(tfm)->decompress_update(tfm, req);
137}
138
139static inline int crypto_decompress_final(struct crypto_pcomp *tfm,
140 struct comp_request *req)
141{
142 return crypto_pcomp_alg(tfm)->decompress_final(tfm, req);
143}
144
145#endif /* _CRYPTO_COMPRESS_H */
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h
new file mode 100644
index 000000000000..55fa7bbdbc71
--- /dev/null
+++ b/include/crypto/cryptd.h
@@ -0,0 +1,27 @@
1/*
2 * Software async crypto daemon
3 */
4
5#ifndef _CRYPTO_CRYPT_H
6#define _CRYPTO_CRYPT_H
7
8#include <linux/crypto.h>
9#include <linux/kernel.h>
10
11struct cryptd_ablkcipher {
12 struct crypto_ablkcipher base;
13};
14
15static inline struct cryptd_ablkcipher *__cryptd_ablkcipher_cast(
16 struct crypto_ablkcipher *tfm)
17{
18 return (struct cryptd_ablkcipher *)tfm;
19}
20
21/* alg_name should be algorithm to be cryptd-ed */
22struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
23 u32 type, u32 mask);
24struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm);
25void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm);
26
27#endif
diff --git a/include/crypto/crypto_wq.h b/include/crypto/crypto_wq.h
new file mode 100644
index 000000000000..a7d252daf91b
--- /dev/null
+++ b/include/crypto/crypto_wq.h
@@ -0,0 +1,7 @@
1#ifndef CRYPTO_WQ_H
2#define CRYPTO_WQ_H
3
4#include <linux/workqueue.h>
5
6extern struct workqueue_struct *kcrypto_wq;
7#endif
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index d797e119e3d5..d56bb71617c3 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -231,6 +231,11 @@ static inline unsigned int crypto_shash_alignmask(
231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm)); 231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm));
232} 232}
233 233
234static inline unsigned int crypto_shash_blocksize(struct crypto_shash *tfm)
235{
236 return crypto_tfm_alg_blocksize(crypto_shash_tfm(tfm));
237}
238
234static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg) 239static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg)
235{ 240{
236 return container_of(alg, struct shash_alg, base); 241 return container_of(alg, struct shash_alg, base);
diff --git a/include/crypto/internal/compress.h b/include/crypto/internal/compress.h
new file mode 100644
index 000000000000..178a888d1d93
--- /dev/null
+++ b/include/crypto/internal/compress.h
@@ -0,0 +1,28 @@
1/*
2 * Compress: Compression algorithms under the cryptographic API.
3 *
4 * Copyright 2008 Sony Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 * If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _CRYPTO_INTERNAL_COMPRESS_H
21#define _CRYPTO_INTERNAL_COMPRESS_H
22
23#include <crypto/compress.h>
24
25extern int crypto_register_pcomp(struct pcomp_alg *alg);
26extern int crypto_unregister_pcomp(struct pcomp_alg *alg);
27
28#endif /* _CRYPTO_INTERNAL_COMPRESS_H */
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 8e77357334ad..7cb50bdde46d 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -36,8 +36,7 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__KERNEL__) 39#include <linux/types.h>
40#endif
41#include <asm/ioctl.h> /* For _IO* macros */ 40#include <asm/ioctl.h> /* For _IO* macros */
42#define DRM_IOCTL_NR(n) _IOC_NR(n) 41#define DRM_IOCTL_NR(n) _IOC_NR(n)
43#define DRM_IOC_VOID _IOC_NONE 42#define DRM_IOC_VOID _IOC_NONE
@@ -497,8 +496,8 @@ union drm_wait_vblank {
497 * \sa drmModesetCtl(). 496 * \sa drmModesetCtl().
498 */ 497 */
499struct drm_modeset_ctl { 498struct drm_modeset_ctl {
500 uint32_t crtc; 499 __u32 crtc;
501 uint32_t cmd; 500 __u32 cmd;
502}; 501};
503 502
504/** 503/**
@@ -574,29 +573,29 @@ struct drm_set_version {
574/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 573/** DRM_IOCTL_GEM_CLOSE ioctl argument type */
575struct drm_gem_close { 574struct drm_gem_close {
576 /** Handle of the object to be closed. */ 575 /** Handle of the object to be closed. */
577 uint32_t handle; 576 __u32 handle;
578 uint32_t pad; 577 __u32 pad;
579}; 578};
580 579
581/** DRM_IOCTL_GEM_FLINK ioctl argument type */ 580/** DRM_IOCTL_GEM_FLINK ioctl argument type */
582struct drm_gem_flink { 581struct drm_gem_flink {
583 /** Handle for the object being named */ 582 /** Handle for the object being named */
584 uint32_t handle; 583 __u32 handle;
585 584
586 /** Returned global name */ 585 /** Returned global name */
587 uint32_t name; 586 __u32 name;
588}; 587};
589 588
590/** DRM_IOCTL_GEM_OPEN ioctl argument type */ 589/** DRM_IOCTL_GEM_OPEN ioctl argument type */
591struct drm_gem_open { 590struct drm_gem_open {
592 /** Name of object being opened */ 591 /** Name of object being opened */
593 uint32_t name; 592 __u32 name;
594 593
595 /** Returned handle for the object */ 594 /** Returned handle for the object */
596 uint32_t handle; 595 __u32 handle;
597 596
598 /** Returned size of the object */ 597 /** Returned size of the object */
599 uint64_t size; 598 __u64 size;
600}; 599};
601 600
602#include "drm_mode.h" 601#include "drm_mode.h"
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5f4ae989abf..c8c422151431 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -281,16 +281,16 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
281 281
282struct drm_ioctl_desc { 282struct drm_ioctl_desc {
283 unsigned int cmd; 283 unsigned int cmd;
284 drm_ioctl_t *func;
285 int flags; 284 int flags;
285 drm_ioctl_t *func;
286}; 286};
287 287
288/** 288/**
289 * Creates a driver or general drm_ioctl_desc array entry for the given 289 * Creates a driver or general drm_ioctl_desc array entry for the given
290 * ioctl, for use by drm_ioctl(). 290 * ioctl, for use by drm_ioctl().
291 */ 291 */
292#define DRM_IOCTL_DEF(ioctl, func, flags) \ 292#define DRM_IOCTL_DEF(ioctl, _func, _flags) \
293 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} 293 [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
294 294
295struct drm_magic_entry { 295struct drm_magic_entry {
296 struct list_head head; 296 struct list_head head;
@@ -523,19 +523,32 @@ struct drm_mm {
523 523
524 524
525/** 525/**
526 * Kernel side of a mapping
527 */
528struct drm_local_map {
529 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
530 unsigned long size; /**< Requested physical size (bytes) */
531 enum drm_map_type type; /**< Type of memory to map */
532 enum drm_map_flags flags; /**< Flags */
533 void *handle; /**< User-space: "Handle" to pass to mmap() */
534 /**< Kernel-space: kernel-virtual address */
535 int mtrr; /**< MTRR slot used */
536};
537
538typedef struct drm_local_map drm_local_map_t;
539
540/**
526 * Mappings list 541 * Mappings list
527 */ 542 */
528struct drm_map_list { 543struct drm_map_list {
529 struct list_head head; /**< list head */ 544 struct list_head head; /**< list head */
530 struct drm_hash_item hash; 545 struct drm_hash_item hash;
531 struct drm_map *map; /**< mapping */ 546 struct drm_local_map *map; /**< mapping */
532 uint64_t user_token; 547 uint64_t user_token;
533 struct drm_master *master; 548 struct drm_master *master;
534 struct drm_mm_node *file_offset_node; /**< fake offset */ 549 struct drm_mm_node *file_offset_node; /**< fake offset */
535}; 550};
536 551
537typedef struct drm_map drm_local_map_t;
538
539/** 552/**
540 * Context handle list 553 * Context handle list
541 */ 554 */
@@ -560,7 +573,7 @@ struct drm_ati_pcigart_info {
560 dma_addr_t bus_addr; 573 dma_addr_t bus_addr;
561 dma_addr_t table_mask; 574 dma_addr_t table_mask;
562 struct drm_dma_handle *table_handle; 575 struct drm_dma_handle *table_handle;
563 drm_local_map_t mapping; 576 struct drm_local_map mapping;
564 int table_size; 577 int table_size;
565}; 578};
566 579
@@ -675,7 +688,6 @@ struct drm_driver {
675 int (*kernel_context_switch) (struct drm_device *dev, int old, 688 int (*kernel_context_switch) (struct drm_device *dev, int old,
676 int new); 689 int new);
677 void (*kernel_context_switch_unlock) (struct drm_device *dev); 690 void (*kernel_context_switch_unlock) (struct drm_device *dev);
678 int (*dri_library_name) (struct drm_device *dev, char *buf);
679 691
680 /** 692 /**
681 * get_vblank_counter - get raw hardware vblank counter 693 * get_vblank_counter - get raw hardware vblank counter
@@ -747,8 +759,8 @@ struct drm_driver {
747 struct drm_file *file_priv); 759 struct drm_file *file_priv);
748 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 760 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
749 struct drm_file *file_priv); 761 struct drm_file *file_priv);
750 unsigned long (*get_map_ofs) (struct drm_map * map); 762 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
751 unsigned long (*get_reg_ofs) (struct drm_device *dev); 763 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
752 void (*set_version) (struct drm_device *dev, 764 void (*set_version) (struct drm_device *dev,
753 struct drm_set_version *sv); 765 struct drm_set_version *sv);
754 766
@@ -758,6 +770,8 @@ struct drm_driver {
758 770
759 int (*proc_init)(struct drm_minor *minor); 771 int (*proc_init)(struct drm_minor *minor);
760 void (*proc_cleanup)(struct drm_minor *minor); 772 void (*proc_cleanup)(struct drm_minor *minor);
773 int (*debugfs_init)(struct drm_minor *minor);
774 void (*debugfs_cleanup)(struct drm_minor *minor);
761 775
762 /** 776 /**
763 * Driver-specific constructor for drm_gem_objects, to set up 777 * Driver-specific constructor for drm_gem_objects, to set up
@@ -793,6 +807,48 @@ struct drm_driver {
793#define DRM_MINOR_CONTROL 2 807#define DRM_MINOR_CONTROL 2
794#define DRM_MINOR_RENDER 3 808#define DRM_MINOR_RENDER 3
795 809
810
811/**
812 * debugfs node list. This structure represents a debugfs file to
813 * be created by the drm core
814 */
815struct drm_debugfs_list {
816 const char *name; /** file name */
817 int (*show)(struct seq_file*, void*); /** show callback */
818 u32 driver_features; /**< Required driver features for this entry */
819};
820
821/**
822 * debugfs node structure. This structure represents a debugfs file.
823 */
824struct drm_debugfs_node {
825 struct list_head list;
826 struct drm_minor *minor;
827 struct drm_debugfs_list *debugfs_ent;
828 struct dentry *dent;
829};
830
831/**
832 * Info file list entry. This structure represents a debugfs or proc file to
833 * be created by the drm core
834 */
835struct drm_info_list {
836 const char *name; /** file name */
837 int (*show)(struct seq_file*, void*); /** show callback */
838 u32 driver_features; /**< Required driver features for this entry */
839 void *data;
840};
841
842/**
843 * debugfs node structure. This structure represents a debugfs file.
844 */
845struct drm_info_node {
846 struct list_head list;
847 struct drm_minor *minor;
848 struct drm_info_list *info_ent;
849 struct dentry *dent;
850};
851
796/** 852/**
797 * DRM minor structure. This structure represents a drm minor number. 853 * DRM minor structure. This structure represents a drm minor number.
798 */ 854 */
@@ -802,7 +858,12 @@ struct drm_minor {
802 dev_t device; /**< Device number for mknod */ 858 dev_t device; /**< Device number for mknod */
803 struct device kdev; /**< Linux device */ 859 struct device kdev; /**< Linux device */
804 struct drm_device *dev; 860 struct drm_device *dev;
805 struct proc_dir_entry *dev_root; /**< proc directory entry */ 861
862 struct proc_dir_entry *proc_root; /**< proc directory entry */
863 struct drm_info_node proc_nodes;
864 struct dentry *debugfs_root;
865 struct drm_info_node debugfs_nodes;
866
806 struct drm_master *master; /* currently active master for this node */ 867 struct drm_master *master; /* currently active master for this node */
807 struct list_head master_list; 868 struct list_head master_list;
808 struct drm_mode_group mode_group; 869 struct drm_mode_group mode_group;
@@ -932,7 +993,7 @@ struct drm_device {
932 sigset_t sigmask; 993 sigset_t sigmask;
933 994
934 struct drm_driver *driver; 995 struct drm_driver *driver;
935 drm_local_map_t *agp_buffer_map; 996 struct drm_local_map *agp_buffer_map;
936 unsigned int agp_buffer_token; 997 unsigned int agp_buffer_token;
937 struct drm_minor *control; /**< Control node for card */ 998 struct drm_minor *control; /**< Control node for card */
938 struct drm_minor *primary; /**< render type primary screen head */ 999 struct drm_minor *primary; /**< render type primary screen head */
@@ -1049,8 +1110,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1049extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1110extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1050extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1111extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1051extern void drm_vm_open_locked(struct vm_area_struct *vma); 1112extern void drm_vm_open_locked(struct vm_area_struct *vma);
1052extern unsigned long drm_core_get_map_ofs(struct drm_map * map); 1113extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1053extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1114extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1054extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1115extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1055 1116
1056 /* Memory management support (drm_memory.h) */ 1117 /* Memory management support (drm_memory.h) */
@@ -1153,13 +1214,13 @@ extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv
1153 /* Buffer management support (drm_bufs.h) */ 1214 /* Buffer management support (drm_bufs.h) */
1154extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); 1215extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1155extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); 1216extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1156extern int drm_addmap(struct drm_device *dev, unsigned int offset, 1217extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1157 unsigned int size, enum drm_map_type type, 1218 unsigned int size, enum drm_map_type type,
1158 enum drm_map_flags flags, drm_local_map_t ** map_ptr); 1219 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1159extern int drm_addmap_ioctl(struct drm_device *dev, void *data, 1220extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
1160 struct drm_file *file_priv); 1221 struct drm_file *file_priv);
1161extern int drm_rmmap(struct drm_device *dev, drm_local_map_t *map); 1222extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
1162extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map); 1223extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
1163extern int drm_rmmap_ioctl(struct drm_device *dev, void *data, 1224extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
1164 struct drm_file *file_priv); 1225 struct drm_file *file_priv);
1165extern int drm_addbufs(struct drm_device *dev, void *data, 1226extern int drm_addbufs(struct drm_device *dev, void *data,
@@ -1173,10 +1234,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1173extern int drm_mapbufs(struct drm_device *dev, void *data, 1234extern int drm_mapbufs(struct drm_device *dev, void *data,
1174 struct drm_file *file_priv); 1235 struct drm_file *file_priv);
1175extern int drm_order(unsigned long size); 1236extern int drm_order(unsigned long size);
1176extern unsigned long drm_get_resource_start(struct drm_device *dev, 1237extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1238 unsigned int resource);
1239extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1177 unsigned int resource); 1240 unsigned int resource);
1178extern unsigned long drm_get_resource_len(struct drm_device *dev,
1179 unsigned int resource);
1180 1241
1181 /* DMA support (drm_dma.h) */ 1242 /* DMA support (drm_dma.h) */
1182extern int drm_dma_setup(struct drm_device *dev); 1243extern int drm_dma_setup(struct drm_device *dev);
@@ -1252,22 +1313,48 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1252extern void drm_master_put(struct drm_master **master); 1313extern void drm_master_put(struct drm_master **master);
1253extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1314extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1254 struct drm_driver *driver); 1315 struct drm_driver *driver);
1255extern int drm_put_dev(struct drm_device *dev); 1316extern void drm_put_dev(struct drm_device *dev);
1256extern int drm_put_minor(struct drm_minor **minor); 1317extern int drm_put_minor(struct drm_minor **minor);
1257extern unsigned int drm_debug; 1318extern unsigned int drm_debug;
1258 1319
1259extern struct class *drm_class; 1320extern struct class *drm_class;
1260extern struct proc_dir_entry *drm_proc_root; 1321extern struct proc_dir_entry *drm_proc_root;
1322extern struct dentry *drm_debugfs_root;
1261 1323
1262extern struct idr drm_minors_idr; 1324extern struct idr drm_minors_idr;
1263 1325
1264extern drm_local_map_t *drm_getsarea(struct drm_device *dev); 1326extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1265 1327
1266 /* Proc support (drm_proc.h) */ 1328 /* Proc support (drm_proc.h) */
1267extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1329extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1268 struct proc_dir_entry *root); 1330 struct proc_dir_entry *root);
1269extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1331extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1270 1332
1333 /* Debugfs support */
1334#if defined(CONFIG_DEBUG_FS)
1335extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1336 struct dentry *root);
1337extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
1338 struct dentry *root, struct drm_minor *minor);
1339extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
1340 struct drm_minor *minor);
1341extern int drm_debugfs_cleanup(struct drm_minor *minor);
1342#endif
1343
1344 /* Info file support */
1345extern int drm_name_info(struct seq_file *m, void *data);
1346extern int drm_vm_info(struct seq_file *m, void *data);
1347extern int drm_queues_info(struct seq_file *m, void *data);
1348extern int drm_bufs_info(struct seq_file *m, void *data);
1349extern int drm_vblank_info(struct seq_file *m, void *data);
1350extern int drm_clients_info(struct seq_file *m, void* data);
1351extern int drm_gem_name_info(struct seq_file *m, void *data);
1352extern int drm_gem_object_info(struct seq_file *m, void* data);
1353
1354#if DRM_DEBUG_CODE
1355extern int drm_vma_info(struct seq_file *m, void *data);
1356#endif
1357
1271 /* Scatter Gather Support (drm_scatter.h) */ 1358 /* Scatter Gather Support (drm_scatter.h) */
1272extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1359extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1273extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1360extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
@@ -1378,12 +1465,12 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1378void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); 1465void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1379void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); 1466void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1380 1467
1381extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1468extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1382extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1469extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1383extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1470extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1384 1471
1385static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, 1472static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1386 unsigned int token) 1473 unsigned int token)
1387{ 1474{
1388 struct drm_map_list *_entry; 1475 struct drm_map_list *_entry;
1389 list_for_each_entry(_entry, &dev->maplist, head) 1476 list_for_each_entry(_entry, &dev->maplist, head)
@@ -1410,7 +1497,7 @@ static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1410 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1497 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1411} 1498}
1412 1499
1413static __inline__ void drm_core_dropmap(struct drm_map *map) 1500static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1414{ 1501{
1415} 1502}
1416 1503
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5ded1acfb543..3c1924c010e8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -550,7 +550,7 @@ struct drm_mode_config {
550 int min_width, min_height; 550 int min_width, min_height;
551 int max_width, max_height; 551 int max_width, max_height;
552 struct drm_mode_config_funcs *funcs; 552 struct drm_mode_config_funcs *funcs;
553 unsigned long fb_base; 553 resource_size_t fb_base;
554 554
555 /* pointers to standard properties */ 555 /* pointers to standard properties */
556 struct list_head property_blob_list; 556 struct list_head property_blob_list;
@@ -613,7 +613,8 @@ extern void drm_fb_release(struct drm_file *file_priv);
613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
614extern struct edid *drm_get_edid(struct drm_connector *connector, 614extern struct edid *drm_get_edid(struct drm_connector *connector,
615 struct i2c_adapter *adapter); 615 struct i2c_adapter *adapter);
616extern unsigned char *drm_do_probe_ddc_edid(struct i2c_adapter *adapter); 616extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
617 unsigned char *buf, int len);
617extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 618extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
618extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 619extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
619extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 620extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -731,4 +732,5 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
731 void *data, struct drm_file *file_priv); 732 void *data, struct drm_file *file_priv);
732extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 733extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
733 void *data, struct drm_file *file_priv); 734 void *data, struct drm_file *file_priv);
735extern bool drm_detect_hdmi_monitor(struct edid *edid);
734#endif /* __DRM_CRTC_H__ */ 736#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index c7d4b2e606a5..ec073d8288d9 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -33,7 +33,6 @@
33#ifndef __DRM_CRTC_HELPER_H__ 33#ifndef __DRM_CRTC_HELPER_H__
34#define __DRM_CRTC_HELPER_H__ 34#define __DRM_CRTC_HELPER_H__
35 35
36#include <linux/i2c.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/types.h> 37#include <linux/types.h>
39#include <linux/idr.h> 38#include <linux/idr.h>
@@ -92,7 +91,7 @@ struct drm_connector_helper_funcs {
92extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 91extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
93extern void drm_helper_disable_unused_functions(struct drm_device *dev); 92extern void drm_helper_disable_unused_functions(struct drm_device *dev);
94extern int drm_helper_hotplug_stage_two(struct drm_device *dev); 93extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
95extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); 94extern bool drm_helper_initial_config(struct drm_device *dev);
96extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 95extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
97extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 96extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
98 struct drm_display_mode *mode, 97 struct drm_display_mode *mode,
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 601d2bd839f6..ae304cc73c90 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,11 +27,8 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#if !defined(__KERNEL__) && !defined(_KERNEL)
31#include <stdint.h>
32#else
33#include <linux/kernel.h> 30#include <linux/kernel.h>
34#endif 31#include <linux/types.h>
35 32
36#define DRM_DISPLAY_INFO_LEN 32 33#define DRM_DISPLAY_INFO_LEN 32
37#define DRM_CONNECTOR_NAME_LEN 32 34#define DRM_CONNECTOR_NAME_LEN 32
@@ -81,41 +78,41 @@
81#define DRM_MODE_DITHERING_ON 1 78#define DRM_MODE_DITHERING_ON 1
82 79
83struct drm_mode_modeinfo { 80struct drm_mode_modeinfo {
84 uint32_t clock; 81 __u32 clock;
85 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; 82 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
86 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; 83 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
87 84
88 uint32_t vrefresh; /* vertical refresh * 1000 */ 85 __u32 vrefresh; /* vertical refresh * 1000 */
89 86
90 uint32_t flags; 87 __u32 flags;
91 uint32_t type; 88 __u32 type;
92 char name[DRM_DISPLAY_MODE_LEN]; 89 char name[DRM_DISPLAY_MODE_LEN];
93}; 90};
94 91
95struct drm_mode_card_res { 92struct drm_mode_card_res {
96 uint64_t fb_id_ptr; 93 __u64 fb_id_ptr;
97 uint64_t crtc_id_ptr; 94 __u64 crtc_id_ptr;
98 uint64_t connector_id_ptr; 95 __u64 connector_id_ptr;
99 uint64_t encoder_id_ptr; 96 __u64 encoder_id_ptr;
100 uint32_t count_fbs; 97 __u32 count_fbs;
101 uint32_t count_crtcs; 98 __u32 count_crtcs;
102 uint32_t count_connectors; 99 __u32 count_connectors;
103 uint32_t count_encoders; 100 __u32 count_encoders;
104 uint32_t min_width, max_width; 101 __u32 min_width, max_width;
105 uint32_t min_height, max_height; 102 __u32 min_height, max_height;
106}; 103};
107 104
108struct drm_mode_crtc { 105struct drm_mode_crtc {
109 uint64_t set_connectors_ptr; 106 __u64 set_connectors_ptr;
110 uint32_t count_connectors; 107 __u32 count_connectors;
111 108
112 uint32_t crtc_id; /**< Id */ 109 __u32 crtc_id; /**< Id */
113 uint32_t fb_id; /**< Id of framebuffer */ 110 __u32 fb_id; /**< Id of framebuffer */
114 111
115 uint32_t x, y; /**< Position on the frameuffer */ 112 __u32 x, y; /**< Position on the frameuffer */
116 113
117 uint32_t gamma_size; 114 __u32 gamma_size;
118 uint32_t mode_valid; 115 __u32 mode_valid;
119 struct drm_mode_modeinfo mode; 116 struct drm_mode_modeinfo mode;
120}; 117};
121 118
@@ -126,13 +123,13 @@ struct drm_mode_crtc {
126#define DRM_MODE_ENCODER_TVDAC 4 123#define DRM_MODE_ENCODER_TVDAC 4
127 124
128struct drm_mode_get_encoder { 125struct drm_mode_get_encoder {
129 uint32_t encoder_id; 126 __u32 encoder_id;
130 uint32_t encoder_type; 127 __u32 encoder_type;
131 128
132 uint32_t crtc_id; /**< Id of crtc */ 129 __u32 crtc_id; /**< Id of crtc */
133 130
134 uint32_t possible_crtcs; 131 __u32 possible_crtcs;
135 uint32_t possible_clones; 132 __u32 possible_clones;
136}; 133};
137 134
138/* This is for connectors with multiple signal types. */ 135/* This is for connectors with multiple signal types. */
@@ -161,23 +158,23 @@ struct drm_mode_get_encoder {
161 158
162struct drm_mode_get_connector { 159struct drm_mode_get_connector {
163 160
164 uint64_t encoders_ptr; 161 __u64 encoders_ptr;
165 uint64_t modes_ptr; 162 __u64 modes_ptr;
166 uint64_t props_ptr; 163 __u64 props_ptr;
167 uint64_t prop_values_ptr; 164 __u64 prop_values_ptr;
168 165
169 uint32_t count_modes; 166 __u32 count_modes;
170 uint32_t count_props; 167 __u32 count_props;
171 uint32_t count_encoders; 168 __u32 count_encoders;
172 169
173 uint32_t encoder_id; /**< Current Encoder */ 170 __u32 encoder_id; /**< Current Encoder */
174 uint32_t connector_id; /**< Id */ 171 __u32 connector_id; /**< Id */
175 uint32_t connector_type; 172 __u32 connector_type;
176 uint32_t connector_type_id; 173 __u32 connector_type_id;
177 174
178 uint32_t connection; 175 __u32 connection;
179 uint32_t mm_width, mm_height; /**< HxW in millimeters */ 176 __u32 mm_width, mm_height; /**< HxW in millimeters */
180 uint32_t subpixel; 177 __u32 subpixel;
181}; 178};
182 179
183#define DRM_MODE_PROP_PENDING (1<<0) 180#define DRM_MODE_PROP_PENDING (1<<0)
@@ -187,46 +184,46 @@ struct drm_mode_get_connector {
187#define DRM_MODE_PROP_BLOB (1<<4) 184#define DRM_MODE_PROP_BLOB (1<<4)
188 185
189struct drm_mode_property_enum { 186struct drm_mode_property_enum {
190 uint64_t value; 187 __u64 value;
191 char name[DRM_PROP_NAME_LEN]; 188 char name[DRM_PROP_NAME_LEN];
192}; 189};
193 190
194struct drm_mode_get_property { 191struct drm_mode_get_property {
195 uint64_t values_ptr; /* values and blob lengths */ 192 __u64 values_ptr; /* values and blob lengths */
196 uint64_t enum_blob_ptr; /* enum and blob id ptrs */ 193 __u64 enum_blob_ptr; /* enum and blob id ptrs */
197 194
198 uint32_t prop_id; 195 __u32 prop_id;
199 uint32_t flags; 196 __u32 flags;
200 char name[DRM_PROP_NAME_LEN]; 197 char name[DRM_PROP_NAME_LEN];
201 198
202 uint32_t count_values; 199 __u32 count_values;
203 uint32_t count_enum_blobs; 200 __u32 count_enum_blobs;
204}; 201};
205 202
206struct drm_mode_connector_set_property { 203struct drm_mode_connector_set_property {
207 uint64_t value; 204 __u64 value;
208 uint32_t prop_id; 205 __u32 prop_id;
209 uint32_t connector_id; 206 __u32 connector_id;
210}; 207};
211 208
212struct drm_mode_get_blob { 209struct drm_mode_get_blob {
213 uint32_t blob_id; 210 __u32 blob_id;
214 uint32_t length; 211 __u32 length;
215 uint64_t data; 212 __u64 data;
216}; 213};
217 214
218struct drm_mode_fb_cmd { 215struct drm_mode_fb_cmd {
219 uint32_t fb_id; 216 __u32 fb_id;
220 uint32_t width, height; 217 __u32 width, height;
221 uint32_t pitch; 218 __u32 pitch;
222 uint32_t bpp; 219 __u32 bpp;
223 uint32_t depth; 220 __u32 depth;
224 /* driver specific handle */ 221 /* driver specific handle */
225 uint32_t handle; 222 __u32 handle;
226}; 223};
227 224
228struct drm_mode_mode_cmd { 225struct drm_mode_mode_cmd {
229 uint32_t connector_id; 226 __u32 connector_id;
230 struct drm_mode_modeinfo mode; 227 struct drm_mode_modeinfo mode;
231}; 228};
232 229
@@ -248,24 +245,24 @@ struct drm_mode_mode_cmd {
248 * y 245 * y
249 */ 246 */
250struct drm_mode_cursor { 247struct drm_mode_cursor {
251 uint32_t flags; 248 __u32 flags;
252 uint32_t crtc_id; 249 __u32 crtc_id;
253 int32_t x; 250 __s32 x;
254 int32_t y; 251 __s32 y;
255 uint32_t width; 252 __u32 width;
256 uint32_t height; 253 __u32 height;
257 /* driver specific handle */ 254 /* driver specific handle */
258 uint32_t handle; 255 __u32 handle;
259}; 256};
260 257
261struct drm_mode_crtc_lut { 258struct drm_mode_crtc_lut {
262 uint32_t crtc_id; 259 __u32 crtc_id;
263 uint32_t gamma_size; 260 __u32 gamma_size;
264 261
265 /* pointers to arrays */ 262 /* pointers to arrays */
266 uint64_t red; 263 __u64 red;
267 uint64_t green; 264 __u64 green;
268 uint64_t blue; 265 __u64 blue;
269}; 266};
270 267
271#endif 268#endif
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 8dbd2572b7c3..26641e95e0a4 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -6,6 +6,19 @@
6#include <linux/interrupt.h> /* For task queue support */ 6#include <linux/interrupt.h> /* For task queue support */
7#include <linux/delay.h> 7#include <linux/delay.h>
8 8
9#ifndef readq
10static inline u64 readq(void __iomem *reg)
11{
12 return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
13}
14
15static inline void writeq(u64 val, void __iomem *reg)
16{
17 writel(val & 0xffffffff, reg);
18 writel(val >> 32, reg + 0x4UL);
19}
20#endif
21
9/** Current process ID */ 22/** Current process ID */
10#define DRM_CURRENTPID task_pid_nr(current) 23#define DRM_CURRENTPID task_pid_nr(current)
11#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) 24#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
@@ -23,6 +36,12 @@
23/** Write a dword into a MMIO region */ 36/** Write a dword into a MMIO region */
24#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) 37#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset))
25/** Read memory barrier */ 38/** Read memory barrier */
39
40/** Read a qword from a MMIO region - be careful using these unless you really understand them */
41#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset))
42/** Write a qword into a MMIO region */
43#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset))
44
26#define DRM_READMEMORYBARRIER() rmb() 45#define DRM_READMEMORYBARRIER() rmb()
27/** Write memory barrier */ 46/** Write memory barrier */
28#define DRM_WRITEMEMORYBARRIER() wmb() 47#define DRM_WRITEMEMORYBARRIER() wmb()
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 5165f240aa68..2df74eb09563 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -239,10 +239,123 @@
239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
242 {0x1002, 0x793f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
243 {0x1002, 0x7941, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
244 {0x1002, 0x7942, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
242 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 245 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
243 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 246 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
244 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 247 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
245 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 248 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
249 {0x1002, 0x9400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
250 {0x1002, 0x9401, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
251 {0x1002, 0x9402, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
252 {0x1002, 0x9403, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
253 {0x1002, 0x9405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x9444, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x9446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
262 {0x1002, 0x944A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
263 {0x1002, 0x944B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
264 {0x1002, 0x944C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
265 {0x1002, 0x944E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
266 {0x1002, 0x9450, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
267 {0x1002, 0x9452, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
268 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
269 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
270 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
271 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
272 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
273 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x947B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x9480, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
278 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
279 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
280 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
281 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
282 {0x1002, 0x9498, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
283 {0x1002, 0x949C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
284 {0x1002, 0x949E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
285 {0x1002, 0x949F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
286 {0x1002, 0x94C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
287 {0x1002, 0x94C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
288 {0x1002, 0x94C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
289 {0x1002, 0x94C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
290 {0x1002, 0x94C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
291 {0x1002, 0x94C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
292 {0x1002, 0x94C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
293 {0x1002, 0x94C8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
294 {0x1002, 0x94C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
295 {0x1002, 0x94CB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
296 {0x1002, 0x94CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
297 {0x1002, 0x94CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
298 {0x1002, 0x9500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
299 {0x1002, 0x9501, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
300 {0x1002, 0x9504, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
301 {0x1002, 0x9505, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
302 {0x1002, 0x9506, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
303 {0x1002, 0x9507, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
304 {0x1002, 0x9508, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
305 {0x1002, 0x9509, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
306 {0x1002, 0x950F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
307 {0x1002, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
308 {0x1002, 0x9515, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
309 {0x1002, 0x9517, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
310 {0x1002, 0x9519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
311 {0x1002, 0x9540, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
312 {0x1002, 0x9541, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
313 {0x1002, 0x9542, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
314 {0x1002, 0x954E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
315 {0x1002, 0x954F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
316 {0x1002, 0x9552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
317 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
318 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
319 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
320 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
321 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
322 {0x1002, 0x9586, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
323 {0x1002, 0x9587, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
324 {0x1002, 0x9588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
325 {0x1002, 0x9589, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
326 {0x1002, 0x958A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
327 {0x1002, 0x958B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
328 {0x1002, 0x958C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
329 {0x1002, 0x958D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
330 {0x1002, 0x958E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
331 {0x1002, 0x958F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
332 {0x1002, 0x9590, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
333 {0x1002, 0x9591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
334 {0x1002, 0x9593, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
335 {0x1002, 0x9595, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
336 {0x1002, 0x9596, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
337 {0x1002, 0x9597, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
338 {0x1002, 0x9598, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
339 {0x1002, 0x9599, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
340 {0x1002, 0x959B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
341 {0x1002, 0x95C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
342 {0x1002, 0x95C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
343 {0x1002, 0x95C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
344 {0x1002, 0x95C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
345 {0x1002, 0x95C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
346 {0x1002, 0x95C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
347 {0x1002, 0x95C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
348 {0x1002, 0x95CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
349 {0x1002, 0x95CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
350 {0x1002, 0x95CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
351 {0x1002, 0x95CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
352 {0x1002, 0x9610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
353 {0x1002, 0x9611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
354 {0x1002, 0x9612, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
355 {0x1002, 0x9613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
356 {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
357 {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
358 {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
246 {0, 0, 0} 359 {0, 0, 0}
247 360
248#define r128_PCI_IDS \ 361#define r128_PCI_IDS \
@@ -418,4 +531,6 @@
418 {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 531 {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
419 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 532 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
420 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 533 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
534 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
535 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
421 {0, 0, 0} 536 {0, 0, 0}
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 912cd52db965..67e3353a56d6 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -30,7 +30,7 @@
30/* Please note that modifications to all structs defined here are 30/* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints. 31 * subject to backwards-compatibility constraints.
32 */ 32 */
33 33#include <linux/types.h>
34#include "drm.h" 34#include "drm.h"
35 35
36/* Each region is a minimum of 16k, and there are at most 255 of them. 36/* Each region is a minimum of 16k, and there are at most 255 of them.
@@ -116,15 +116,15 @@ typedef struct _drm_i915_sarea {
116 116
117 /* fill out some space for old userspace triple buffer */ 117 /* fill out some space for old userspace triple buffer */
118 drm_handle_t unused_handle; 118 drm_handle_t unused_handle;
119 uint32_t unused1, unused2, unused3; 119 __u32 unused1, unused2, unused3;
120 120
121 /* buffer object handles for static buffers. May change 121 /* buffer object handles for static buffers. May change
122 * over the lifetime of the client. 122 * over the lifetime of the client.
123 */ 123 */
124 uint32_t front_bo_handle; 124 __u32 front_bo_handle;
125 uint32_t back_bo_handle; 125 __u32 back_bo_handle;
126 uint32_t unused_bo_handle; 126 __u32 unused_bo_handle;
127 uint32_t depth_bo_handle; 127 __u32 depth_bo_handle;
128 128
129} drm_i915_sarea_t; 129} drm_i915_sarea_t;
130 130
@@ -327,7 +327,7 @@ typedef struct drm_i915_vblank_swap {
327} drm_i915_vblank_swap_t; 327} drm_i915_vblank_swap_t;
328 328
329typedef struct drm_i915_hws_addr { 329typedef struct drm_i915_hws_addr {
330 uint64_t addr; 330 __u64 addr;
331} drm_i915_hws_addr_t; 331} drm_i915_hws_addr_t;
332 332
333struct drm_i915_gem_init { 333struct drm_i915_gem_init {
@@ -335,12 +335,12 @@ struct drm_i915_gem_init {
335 * Beginning offset in the GTT to be managed by the DRM memory 335 * Beginning offset in the GTT to be managed by the DRM memory
336 * manager. 336 * manager.
337 */ 337 */
338 uint64_t gtt_start; 338 __u64 gtt_start;
339 /** 339 /**
340 * Ending offset in the GTT to be managed by the DRM memory 340 * Ending offset in the GTT to be managed by the DRM memory
341 * manager. 341 * manager.
342 */ 342 */
343 uint64_t gtt_end; 343 __u64 gtt_end;
344}; 344};
345 345
346struct drm_i915_gem_create { 346struct drm_i915_gem_create {
@@ -349,94 +349,94 @@ struct drm_i915_gem_create {
349 * 349 *
350 * The (page-aligned) allocated size for the object will be returned. 350 * The (page-aligned) allocated size for the object will be returned.
351 */ 351 */
352 uint64_t size; 352 __u64 size;
353 /** 353 /**
354 * Returned handle for the object. 354 * Returned handle for the object.
355 * 355 *
356 * Object handles are nonzero. 356 * Object handles are nonzero.
357 */ 357 */
358 uint32_t handle; 358 __u32 handle;
359 uint32_t pad; 359 __u32 pad;
360}; 360};
361 361
362struct drm_i915_gem_pread { 362struct drm_i915_gem_pread {
363 /** Handle for the object being read. */ 363 /** Handle for the object being read. */
364 uint32_t handle; 364 __u32 handle;
365 uint32_t pad; 365 __u32 pad;
366 /** Offset into the object to read from */ 366 /** Offset into the object to read from */
367 uint64_t offset; 367 __u64 offset;
368 /** Length of data to read */ 368 /** Length of data to read */
369 uint64_t size; 369 __u64 size;
370 /** 370 /**
371 * Pointer to write the data into. 371 * Pointer to write the data into.
372 * 372 *
373 * This is a fixed-size type for 32/64 compatibility. 373 * This is a fixed-size type for 32/64 compatibility.
374 */ 374 */
375 uint64_t data_ptr; 375 __u64 data_ptr;
376}; 376};
377 377
378struct drm_i915_gem_pwrite { 378struct drm_i915_gem_pwrite {
379 /** Handle for the object being written to. */ 379 /** Handle for the object being written to. */
380 uint32_t handle; 380 __u32 handle;
381 uint32_t pad; 381 __u32 pad;
382 /** Offset into the object to write to */ 382 /** Offset into the object to write to */
383 uint64_t offset; 383 __u64 offset;
384 /** Length of data to write */ 384 /** Length of data to write */
385 uint64_t size; 385 __u64 size;
386 /** 386 /**
387 * Pointer to read the data from. 387 * Pointer to read the data from.
388 * 388 *
389 * This is a fixed-size type for 32/64 compatibility. 389 * This is a fixed-size type for 32/64 compatibility.
390 */ 390 */
391 uint64_t data_ptr; 391 __u64 data_ptr;
392}; 392};
393 393
394struct drm_i915_gem_mmap { 394struct drm_i915_gem_mmap {
395 /** Handle for the object being mapped. */ 395 /** Handle for the object being mapped. */
396 uint32_t handle; 396 __u32 handle;
397 uint32_t pad; 397 __u32 pad;
398 /** Offset in the object to map. */ 398 /** Offset in the object to map. */
399 uint64_t offset; 399 __u64 offset;
400 /** 400 /**
401 * Length of data to map. 401 * Length of data to map.
402 * 402 *
403 * The value will be page-aligned. 403 * The value will be page-aligned.
404 */ 404 */
405 uint64_t size; 405 __u64 size;
406 /** 406 /**
407 * Returned pointer the data was mapped at. 407 * Returned pointer the data was mapped at.
408 * 408 *
409 * This is a fixed-size type for 32/64 compatibility. 409 * This is a fixed-size type for 32/64 compatibility.
410 */ 410 */
411 uint64_t addr_ptr; 411 __u64 addr_ptr;
412}; 412};
413 413
414struct drm_i915_gem_mmap_gtt { 414struct drm_i915_gem_mmap_gtt {
415 /** Handle for the object being mapped. */ 415 /** Handle for the object being mapped. */
416 uint32_t handle; 416 __u32 handle;
417 uint32_t pad; 417 __u32 pad;
418 /** 418 /**
419 * Fake offset to use for subsequent mmap call 419 * Fake offset to use for subsequent mmap call
420 * 420 *
421 * This is a fixed-size type for 32/64 compatibility. 421 * This is a fixed-size type for 32/64 compatibility.
422 */ 422 */
423 uint64_t offset; 423 __u64 offset;
424}; 424};
425 425
426struct drm_i915_gem_set_domain { 426struct drm_i915_gem_set_domain {
427 /** Handle for the object */ 427 /** Handle for the object */
428 uint32_t handle; 428 __u32 handle;
429 429
430 /** New read domains */ 430 /** New read domains */
431 uint32_t read_domains; 431 __u32 read_domains;
432 432
433 /** New write domain */ 433 /** New write domain */
434 uint32_t write_domain; 434 __u32 write_domain;
435}; 435};
436 436
437struct drm_i915_gem_sw_finish { 437struct drm_i915_gem_sw_finish {
438 /** Handle for the object */ 438 /** Handle for the object */
439 uint32_t handle; 439 __u32 handle;
440}; 440};
441 441
442struct drm_i915_gem_relocation_entry { 442struct drm_i915_gem_relocation_entry {
@@ -448,16 +448,16 @@ struct drm_i915_gem_relocation_entry {
448 * a relocation list for state buffers and not re-write it per 448 * a relocation list for state buffers and not re-write it per
449 * exec using the buffer. 449 * exec using the buffer.
450 */ 450 */
451 uint32_t target_handle; 451 __u32 target_handle;
452 452
453 /** 453 /**
454 * Value to be added to the offset of the target buffer to make up 454 * Value to be added to the offset of the target buffer to make up
455 * the relocation entry. 455 * the relocation entry.
456 */ 456 */
457 uint32_t delta; 457 __u32 delta;
458 458
459 /** Offset in the buffer the relocation entry will be written into */ 459 /** Offset in the buffer the relocation entry will be written into */
460 uint64_t offset; 460 __u64 offset;
461 461
462 /** 462 /**
463 * Offset value of the target buffer that the relocation entry was last 463 * Offset value of the target buffer that the relocation entry was last
@@ -467,12 +467,12 @@ struct drm_i915_gem_relocation_entry {
467 * and writing the relocation. This value is written back out by 467 * and writing the relocation. This value is written back out by
468 * the execbuffer ioctl when the relocation is written. 468 * the execbuffer ioctl when the relocation is written.
469 */ 469 */
470 uint64_t presumed_offset; 470 __u64 presumed_offset;
471 471
472 /** 472 /**
473 * Target memory domains read by this operation. 473 * Target memory domains read by this operation.
474 */ 474 */
475 uint32_t read_domains; 475 __u32 read_domains;
476 476
477 /** 477 /**
478 * Target memory domains written by this operation. 478 * Target memory domains written by this operation.
@@ -481,7 +481,7 @@ struct drm_i915_gem_relocation_entry {
481 * execbuffer operation, so that where there are conflicts, 481 * execbuffer operation, so that where there are conflicts,
482 * the application will get -EINVAL back. 482 * the application will get -EINVAL back.
483 */ 483 */
484 uint32_t write_domain; 484 __u32 write_domain;
485}; 485};
486 486
487/** @{ 487/** @{
@@ -512,24 +512,24 @@ struct drm_i915_gem_exec_object {
512 * User's handle for a buffer to be bound into the GTT for this 512 * User's handle for a buffer to be bound into the GTT for this
513 * operation. 513 * operation.
514 */ 514 */
515 uint32_t handle; 515 __u32 handle;
516 516
517 /** Number of relocations to be performed on this buffer */ 517 /** Number of relocations to be performed on this buffer */
518 uint32_t relocation_count; 518 __u32 relocation_count;
519 /** 519 /**
520 * Pointer to array of struct drm_i915_gem_relocation_entry containing 520 * Pointer to array of struct drm_i915_gem_relocation_entry containing
521 * the relocations to be performed in this buffer. 521 * the relocations to be performed in this buffer.
522 */ 522 */
523 uint64_t relocs_ptr; 523 __u64 relocs_ptr;
524 524
525 /** Required alignment in graphics aperture */ 525 /** Required alignment in graphics aperture */
526 uint64_t alignment; 526 __u64 alignment;
527 527
528 /** 528 /**
529 * Returned value of the updated offset of the object, for future 529 * Returned value of the updated offset of the object, for future
530 * presumed_offset writes. 530 * presumed_offset writes.
531 */ 531 */
532 uint64_t offset; 532 __u64 offset;
533}; 533};
534 534
535struct drm_i915_gem_execbuffer { 535struct drm_i915_gem_execbuffer {
@@ -543,44 +543,44 @@ struct drm_i915_gem_execbuffer {
543 * a buffer is performing refer to buffers that have already appeared 543 * a buffer is performing refer to buffers that have already appeared
544 * in the validate list. 544 * in the validate list.
545 */ 545 */
546 uint64_t buffers_ptr; 546 __u64 buffers_ptr;
547 uint32_t buffer_count; 547 __u32 buffer_count;
548 548
549 /** Offset in the batchbuffer to start execution from. */ 549 /** Offset in the batchbuffer to start execution from. */
550 uint32_t batch_start_offset; 550 __u32 batch_start_offset;
551 /** Bytes used in batchbuffer from batch_start_offset */ 551 /** Bytes used in batchbuffer from batch_start_offset */
552 uint32_t batch_len; 552 __u32 batch_len;
553 uint32_t DR1; 553 __u32 DR1;
554 uint32_t DR4; 554 __u32 DR4;
555 uint32_t num_cliprects; 555 __u32 num_cliprects;
556 /** This is a struct drm_clip_rect *cliprects */ 556 /** This is a struct drm_clip_rect *cliprects */
557 uint64_t cliprects_ptr; 557 __u64 cliprects_ptr;
558}; 558};
559 559
560struct drm_i915_gem_pin { 560struct drm_i915_gem_pin {
561 /** Handle of the buffer to be pinned. */ 561 /** Handle of the buffer to be pinned. */
562 uint32_t handle; 562 __u32 handle;
563 uint32_t pad; 563 __u32 pad;
564 564
565 /** alignment required within the aperture */ 565 /** alignment required within the aperture */
566 uint64_t alignment; 566 __u64 alignment;
567 567
568 /** Returned GTT offset of the buffer. */ 568 /** Returned GTT offset of the buffer. */
569 uint64_t offset; 569 __u64 offset;
570}; 570};
571 571
572struct drm_i915_gem_unpin { 572struct drm_i915_gem_unpin {
573 /** Handle of the buffer to be unpinned. */ 573 /** Handle of the buffer to be unpinned. */
574 uint32_t handle; 574 __u32 handle;
575 uint32_t pad; 575 __u32 pad;
576}; 576};
577 577
578struct drm_i915_gem_busy { 578struct drm_i915_gem_busy {
579 /** Handle of the buffer to check for busy */ 579 /** Handle of the buffer to check for busy */
580 uint32_t handle; 580 __u32 handle;
581 581
582 /** Return busy status (1 if busy, 0 if idle) */ 582 /** Return busy status (1 if busy, 0 if idle) */
583 uint32_t busy; 583 __u32 busy;
584}; 584};
585 585
586#define I915_TILING_NONE 0 586#define I915_TILING_NONE 0
@@ -597,7 +597,7 @@ struct drm_i915_gem_busy {
597 597
598struct drm_i915_gem_set_tiling { 598struct drm_i915_gem_set_tiling {
599 /** Handle of the buffer to have its tiling state updated */ 599 /** Handle of the buffer to have its tiling state updated */
600 uint32_t handle; 600 __u32 handle;
601 601
602 /** 602 /**
603 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 603 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
@@ -611,47 +611,47 @@ struct drm_i915_gem_set_tiling {
611 * 611 *
612 * Buffer contents become undefined when changing tiling_mode. 612 * Buffer contents become undefined when changing tiling_mode.
613 */ 613 */
614 uint32_t tiling_mode; 614 __u32 tiling_mode;
615 615
616 /** 616 /**
617 * Stride in bytes for the object when in I915_TILING_X or 617 * Stride in bytes for the object when in I915_TILING_X or
618 * I915_TILING_Y. 618 * I915_TILING_Y.
619 */ 619 */
620 uint32_t stride; 620 __u32 stride;
621 621
622 /** 622 /**
623 * Returned address bit 6 swizzling required for CPU access through 623 * Returned address bit 6 swizzling required for CPU access through
624 * mmap mapping. 624 * mmap mapping.
625 */ 625 */
626 uint32_t swizzle_mode; 626 __u32 swizzle_mode;
627}; 627};
628 628
629struct drm_i915_gem_get_tiling { 629struct drm_i915_gem_get_tiling {
630 /** Handle of the buffer to get tiling state for. */ 630 /** Handle of the buffer to get tiling state for. */
631 uint32_t handle; 631 __u32 handle;
632 632
633 /** 633 /**
634 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 634 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
635 * I915_TILING_Y). 635 * I915_TILING_Y).
636 */ 636 */
637 uint32_t tiling_mode; 637 __u32 tiling_mode;
638 638
639 /** 639 /**
640 * Returned address bit 6 swizzling required for CPU access through 640 * Returned address bit 6 swizzling required for CPU access through
641 * mmap mapping. 641 * mmap mapping.
642 */ 642 */
643 uint32_t swizzle_mode; 643 __u32 swizzle_mode;
644}; 644};
645 645
646struct drm_i915_gem_get_aperture { 646struct drm_i915_gem_get_aperture {
647 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 647 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
648 uint64_t aper_size; 648 __u64 aper_size;
649 649
650 /** 650 /**
651 * Available space in the aperture used by i915_gem_execbuffer, in 651 * Available space in the aperture used by i915_gem_execbuffer, in
652 * bytes 652 * bytes
653 */ 653 */
654 uint64_t aper_available_size; 654 __u64 aper_available_size;
655}; 655};
656 656
657#endif /* _I915_DRM_H_ */ 657#endif /* _I915_DRM_H_ */
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index 944b50a5ff24..325fd6fb4a42 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -35,6 +35,8 @@
35#ifndef __MGA_DRM_H__ 35#ifndef __MGA_DRM_H__
36#define __MGA_DRM_H__ 36#define __MGA_DRM_H__
37 37
38#include <linux/types.h>
39
38/* WARNING: If you change any of these defines, make sure to change the 40/* WARNING: If you change any of these defines, make sure to change the
39 * defines in the Xserver file (mga_sarea.h) 41 * defines in the Xserver file (mga_sarea.h)
40 */ 42 */
@@ -255,8 +257,8 @@ typedef struct _drm_mga_sarea {
255#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) 257#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t)
256#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) 258#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t)
257#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) 259#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t)
258#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, uint32_t) 260#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32)
259#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, uint32_t) 261#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32)
260#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) 262#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t)
261 263
262typedef struct _drm_mga_warp_index { 264typedef struct _drm_mga_warp_index {
@@ -310,7 +312,7 @@ typedef struct drm_mga_dma_bootstrap {
310 */ 312 */
311 /*@{ */ 313 /*@{ */
312 unsigned long texture_handle; /**< Handle used to map AGP textures. */ 314 unsigned long texture_handle; /**< Handle used to map AGP textures. */
313 uint32_t texture_size; /**< Size of the AGP texture region. */ 315 __u32 texture_size; /**< Size of the AGP texture region. */
314 /*@} */ 316 /*@} */
315 317
316 /** 318 /**
@@ -319,7 +321,7 @@ typedef struct drm_mga_dma_bootstrap {
319 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 321 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be
320 * filled in with the actual AGP mode. If AGP was not available 322 * filled in with the actual AGP mode. If AGP was not available
321 */ 323 */
322 uint32_t primary_size; 324 __u32 primary_size;
323 325
324 /** 326 /**
325 * Requested number of secondary DMA buffers. 327 * Requested number of secondary DMA buffers.
@@ -329,7 +331,7 @@ typedef struct drm_mga_dma_bootstrap {
329 * allocated. Particularly when PCI DMA is used, this may be 331 * allocated. Particularly when PCI DMA is used, this may be
330 * (subtantially) less than the number requested. 332 * (subtantially) less than the number requested.
331 */ 333 */
332 uint32_t secondary_bin_count; 334 __u32 secondary_bin_count;
333 335
334 /** 336 /**
335 * Requested size of each secondary DMA buffer. 337 * Requested size of each secondary DMA buffer.
@@ -338,7 +340,7 @@ typedef struct drm_mga_dma_bootstrap {
338 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed 340 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed
339 * to reduce dma_mga_dma_bootstrap::secondary_bin_size. 341 * to reduce dma_mga_dma_bootstrap::secondary_bin_size.
340 */ 342 */
341 uint32_t secondary_bin_size; 343 __u32 secondary_bin_size;
342 344
343 /** 345 /**
344 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, 346 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X,
@@ -350,12 +352,12 @@ typedef struct drm_mga_dma_bootstrap {
350 * filled in with the actual AGP mode. If AGP was not available 352 * filled in with the actual AGP mode. If AGP was not available
351 * (i.e., PCI DMA was used), this value will be zero. 353 * (i.e., PCI DMA was used), this value will be zero.
352 */ 354 */
353 uint32_t agp_mode; 355 __u32 agp_mode;
354 356
355 /** 357 /**
356 * Desired AGP GART size, measured in megabytes. 358 * Desired AGP GART size, measured in megabytes.
357 */ 359 */
358 uint8_t agp_size; 360 __u8 agp_size;
359} drm_mga_dma_bootstrap_t; 361} drm_mga_dma_bootstrap_t;
360 362
361typedef struct drm_mga_clear { 363typedef struct drm_mga_clear {
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 73ff51f12311..fe3e3a4b4aed 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -33,6 +33,8 @@
33#ifndef __RADEON_DRM_H__ 33#ifndef __RADEON_DRM_H__
34#define __RADEON_DRM_H__ 34#define __RADEON_DRM_H__
35 35
36#include <linux/types.h>
37
36/* WARNING: If you change any of these defines, make sure to change the 38/* WARNING: If you change any of these defines, make sure to change the
37 * defines in the X server file (radeon_sarea.h) 39 * defines in the X server file (radeon_sarea.h)
38 */ 40 */
@@ -304,6 +306,8 @@ typedef union {
304 306
305#define RADEON_SCRATCH_REG_OFFSET 32 307#define RADEON_SCRATCH_REG_OFFSET 32
306 308
309#define R600_SCRATCH_REG_OFFSET 256
310
307#define RADEON_NR_SAREA_CLIPRECTS 12 311#define RADEON_NR_SAREA_CLIPRECTS 12
308 312
309/* There are 2 heaps (local/GART). Each region within a heap is a 313/* There are 2 heaps (local/GART). Each region within a heap is a
@@ -526,7 +530,8 @@ typedef struct drm_radeon_init {
526 RADEON_INIT_CP = 0x01, 530 RADEON_INIT_CP = 0x01,
527 RADEON_CLEANUP_CP = 0x02, 531 RADEON_CLEANUP_CP = 0x02,
528 RADEON_INIT_R200_CP = 0x03, 532 RADEON_INIT_R200_CP = 0x03,
529 RADEON_INIT_R300_CP = 0x04 533 RADEON_INIT_R300_CP = 0x04,
534 RADEON_INIT_R600_CP = 0x05
530 } func; 535 } func;
531 unsigned long sarea_priv_offset; 536 unsigned long sarea_priv_offset;
532 int is_pci; 537 int is_pci;
@@ -722,7 +727,7 @@ typedef struct drm_radeon_irq_wait {
722 727
723typedef struct drm_radeon_setparam { 728typedef struct drm_radeon_setparam {
724 unsigned int param; 729 unsigned int param;
725 int64_t value; 730 __s64 value;
726} drm_radeon_setparam_t; 731} drm_radeon_setparam_t;
727 732
728#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ 733#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index a3b5c102b067..170786e5c2ff 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -24,6 +24,8 @@
24#ifndef _VIA_DRM_H_ 24#ifndef _VIA_DRM_H_
25#define _VIA_DRM_H_ 25#define _VIA_DRM_H_
26 26
27#include <linux/types.h>
28
27/* WARNING: These defines must be the same as what the Xserver uses. 29/* WARNING: These defines must be the same as what the Xserver uses.
28 * if you change them, you must change the defines in the Xserver. 30 * if you change them, you must change the defines in the Xserver.
29 */ 31 */
@@ -114,19 +116,19 @@
114#define VIA_MEM_UNKNOWN 4 116#define VIA_MEM_UNKNOWN 4
115 117
116typedef struct { 118typedef struct {
117 uint32_t offset; 119 __u32 offset;
118 uint32_t size; 120 __u32 size;
119} drm_via_agp_t; 121} drm_via_agp_t;
120 122
121typedef struct { 123typedef struct {
122 uint32_t offset; 124 __u32 offset;
123 uint32_t size; 125 __u32 size;
124} drm_via_fb_t; 126} drm_via_fb_t;
125 127
126typedef struct { 128typedef struct {
127 uint32_t context; 129 __u32 context;
128 uint32_t type; 130 __u32 type;
129 uint32_t size; 131 __u32 size;
130 unsigned long index; 132 unsigned long index;
131 unsigned long offset; 133 unsigned long offset;
132} drm_via_mem_t; 134} drm_via_mem_t;
@@ -148,9 +150,9 @@ typedef struct _drm_via_futex {
148 VIA_FUTEX_WAIT = 0x00, 150 VIA_FUTEX_WAIT = 0x00,
149 VIA_FUTEX_WAKE = 0X01 151 VIA_FUTEX_WAKE = 0X01
150 } func; 152 } func;
151 uint32_t ms; 153 __u32 ms;
152 uint32_t lock; 154 __u32 lock;
153 uint32_t val; 155 __u32 val;
154} drm_via_futex_t; 156} drm_via_futex_t;
155 157
156typedef struct _drm_via_dma_init { 158typedef struct _drm_via_dma_init {
@@ -211,7 +213,7 @@ typedef struct _drm_via_cmdbuf_size {
211 VIA_CMDBUF_LAG = 0x02 213 VIA_CMDBUF_LAG = 0x02
212 } func; 214 } func;
213 int wait; 215 int wait;
214 uint32_t size; 216 __u32 size;
215} drm_via_cmdbuf_size_t; 217} drm_via_cmdbuf_size_t;
216 218
217typedef enum { 219typedef enum {
@@ -236,8 +238,8 @@ enum drm_via_irqs {
236struct drm_via_wait_irq_request { 238struct drm_via_wait_irq_request {
237 unsigned irq; 239 unsigned irq;
238 via_irq_seq_type_t type; 240 via_irq_seq_type_t type;
239 uint32_t sequence; 241 __u32 sequence;
240 uint32_t signal; 242 __u32 signal;
241}; 243};
242 244
243typedef union drm_via_irqwait { 245typedef union drm_via_irqwait {
@@ -246,7 +248,7 @@ typedef union drm_via_irqwait {
246} drm_via_irqwait_t; 248} drm_via_irqwait_t;
247 249
248typedef struct drm_via_blitsync { 250typedef struct drm_via_blitsync {
249 uint32_t sync_handle; 251 __u32 sync_handle;
250 unsigned engine; 252 unsigned engine;
251} drm_via_blitsync_t; 253} drm_via_blitsync_t;
252 254
@@ -257,16 +259,16 @@ typedef struct drm_via_blitsync {
257 */ 259 */
258 260
259typedef struct drm_via_dmablit { 261typedef struct drm_via_dmablit {
260 uint32_t num_lines; 262 __u32 num_lines;
261 uint32_t line_length; 263 __u32 line_length;
262 264
263 uint32_t fb_addr; 265 __u32 fb_addr;
264 uint32_t fb_stride; 266 __u32 fb_stride;
265 267
266 unsigned char *mem_addr; 268 unsigned char *mem_addr;
267 uint32_t mem_stride; 269 __u32 mem_stride;
268 270
269 uint32_t flags; 271 __u32 flags;
270 int to_fb; 272 int to_fb;
271 273
272 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 106c3ba50844..ca9b9b9bd331 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -67,6 +67,7 @@ header-y += falloc.h
67header-y += fd.h 67header-y += fd.h
68header-y += fdreg.h 68header-y += fdreg.h
69header-y += fib_rules.h 69header-y += fib_rules.h
70header-y += fiemap.h
70header-y += firewire-cdev.h 71header-y += firewire-cdev.h
71header-y += firewire-constants.h 72header-y += firewire-constants.h
72header-y += fuse.h 73header-y += fuse.h
@@ -115,6 +116,7 @@ header-y += mqueue.h
115header-y += mtio.h 116header-y += mtio.h
116header-y += ncp_no.h 117header-y += ncp_no.h
117header-y += neighbour.h 118header-y += neighbour.h
119header-y += net_dropmon.h
118header-y += netfilter_arp.h 120header-y += netfilter_arp.h
119header-y += netrom.h 121header-y += netrom.h
120header-y += nfs2.h 122header-y += nfs2.h
@@ -157,8 +159,6 @@ header-y += ultrasound.h
157header-y += un.h 159header-y += un.h
158header-y += utime.h 160header-y += utime.h
159header-y += veth.h 161header-y += veth.h
160header-y += video_decoder.h
161header-y += video_encoder.h
162header-y += videotext.h 162header-y += videotext.h
163header-y += x25.h 163header-y += x25.h
164 164
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 78199151c00b..6586cbd0d4af 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -97,6 +97,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
97/* the following four functions are architecture-dependent */ 97/* the following four functions are architecture-dependent */
98void acpi_numa_slit_init (struct acpi_table_slit *slit); 98void acpi_numa_slit_init (struct acpi_table_slit *slit);
99void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); 99void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
100void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
100void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); 101void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
101void acpi_numa_arch_fixup(void); 102void acpi_numa_arch_fixup(void);
102 103
@@ -257,6 +258,40 @@ void __init acpi_no_s4_hw_signature(void);
257void __init acpi_old_suspend_ordering(void); 258void __init acpi_old_suspend_ordering(void);
258void __init acpi_s4_no_nvs(void); 259void __init acpi_s4_no_nvs(void);
259#endif /* CONFIG_PM_SLEEP */ 260#endif /* CONFIG_PM_SLEEP */
261
262#define OSC_QUERY_TYPE 0
263#define OSC_SUPPORT_TYPE 1
264#define OSC_CONTROL_TYPE 2
265#define OSC_SUPPORT_MASKS 0x1f
266
267/* _OSC DW0 Definition */
268#define OSC_QUERY_ENABLE 1
269#define OSC_REQUEST_ERROR 2
270#define OSC_INVALID_UUID_ERROR 4
271#define OSC_INVALID_REVISION_ERROR 8
272#define OSC_CAPABILITIES_MASK_ERROR 16
273
274/* _OSC DW1 Definition (OS Support Fields) */
275#define OSC_EXT_PCI_CONFIG_SUPPORT 1
276#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
277#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
278#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
279#define OSC_MSI_SUPPORT 16
280
281/* _OSC DW1 Definition (OS Control Fields) */
282#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
283#define OSC_SHPC_NATIVE_HP_CONTROL 2
284#define OSC_PCI_EXPRESS_PME_CONTROL 4
285#define OSC_PCI_EXPRESS_AER_CONTROL 8
286#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
287
288#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
289 OSC_SHPC_NATIVE_HP_CONTROL | \
290 OSC_PCI_EXPRESS_PME_CONTROL | \
291 OSC_PCI_EXPRESS_AER_CONTROL | \
292 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
293
294extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
260#else /* CONFIG_ACPI */ 295#else /* CONFIG_ACPI */
261 296
262static inline int early_acpi_boot_init(void) 297static inline int early_acpi_boot_init(void)
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 110c600c885f..f6778eceb8f4 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -77,20 +77,20 @@ typedef struct _agp_setup {
77 * The "prot" down below needs still a "sleep" flag somehow ... 77 * The "prot" down below needs still a "sleep" flag somehow ...
78 */ 78 */
79typedef struct _agp_segment { 79typedef struct _agp_segment {
80 off_t pg_start; /* starting page to populate */ 80 __kernel_off_t pg_start; /* starting page to populate */
81 size_t pg_count; /* number of pages */ 81 __kernel_size_t pg_count; /* number of pages */
82 int prot; /* prot flags for mmap */ 82 int prot; /* prot flags for mmap */
83} agp_segment; 83} agp_segment;
84 84
85typedef struct _agp_region { 85typedef struct _agp_region {
86 pid_t pid; /* pid of process */ 86 __kernel_pid_t pid; /* pid of process */
87 size_t seg_count; /* number of segments */ 87 __kernel_size_t seg_count; /* number of segments */
88 struct _agp_segment *seg_list; 88 struct _agp_segment *seg_list;
89} agp_region; 89} agp_region;
90 90
91typedef struct _agp_allocate { 91typedef struct _agp_allocate {
92 int key; /* tag of allocation */ 92 int key; /* tag of allocation */
93 size_t pg_count; /* number of pages */ 93 __kernel_size_t pg_count;/* number of pages */
94 __u32 type; /* 0 == normal, other devspec */ 94 __u32 type; /* 0 == normal, other devspec */
95 __u32 physical; /* device specific (some devices 95 __u32 physical; /* device specific (some devices
96 * need a phys address of the 96 * need a phys address of the
@@ -100,7 +100,7 @@ typedef struct _agp_allocate {
100 100
101typedef struct _agp_bind { 101typedef struct _agp_bind {
102 int key; /* tag of allocation */ 102 int key; /* tag of allocation */
103 off_t pg_start; /* starting page to populate */ 103 __kernel_off_t pg_start;/* starting page to populate */
104} agp_bind; 104} agp_bind;
105 105
106typedef struct _agp_unbind { 106typedef struct _agp_unbind {
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index a1916078fd08..cd4bcb6989ce 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -235,8 +235,6 @@ struct Outgoing {
235 235
236 236
237struct arcnet_local { 237struct arcnet_local {
238 struct net_device_stats stats;
239
240 uint8_t config, /* current value of CONFIG register */ 238 uint8_t config, /* current value of CONFIG register */
241 timeout, /* Extended timeout for COM20020 */ 239 timeout, /* Extended timeout for COM20020 */
242 backplane, /* Backplane flag for COM20020 */ 240 backplane, /* Backplane flag for COM20020 */
@@ -335,7 +333,12 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
335 333
336void arcnet_unregister_proto(struct ArcProto *proto); 334void arcnet_unregister_proto(struct ArcProto *proto);
337irqreturn_t arcnet_interrupt(int irq, void *dev_id); 335irqreturn_t arcnet_interrupt(int irq, void *dev_id);
338struct net_device *alloc_arcdev(char *name); 336struct net_device *alloc_arcdev(const char *name);
337
338int arcnet_open(struct net_device *dev);
339int arcnet_close(struct net_device *dev);
340int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
341void arcnet_timeout(struct net_device *dev);
339 342
340#endif /* __KERNEL__ */ 343#endif /* __KERNEL__ */
341#endif /* _LINUX_ARCDEVICE_H */ 344#endif /* _LINUX_ARCDEVICE_H */
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 45f6297821bd..5fc2ef8d97fa 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -21,6 +21,15 @@
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23 23
24/* on architectures without dma-mapping capabilities we need to ensure
25 * that the asynchronous path compiles away
26 */
27#ifdef CONFIG_HAS_DMA
28#define __async_inline
29#else
30#define __async_inline __always_inline
31#endif
32
24/** 33/**
25 * dma_chan_ref - object used to manage dma channels received from the 34 * dma_chan_ref - object used to manage dma channels received from the
26 * dmaengine core. 35 * dmaengine core.
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 9a061accd8b8..cb79b7a208e1 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -29,6 +29,8 @@
29#ifndef __LINUX_ATA_H__ 29#ifndef __LINUX_ATA_H__
30#define __LINUX_ATA_H__ 30#define __LINUX_ATA_H__
31 31
32#include <linux/kernel.h>
33#include <linux/string.h>
32#include <linux/types.h> 34#include <linux/types.h>
33#include <asm/byteorder.h> 35#include <asm/byteorder.h>
34 36
@@ -91,6 +93,7 @@ enum {
91 ATA_ID_CFA_POWER = 160, 93 ATA_ID_CFA_POWER = 160,
92 ATA_ID_CFA_KEY_MGMT = 162, 94 ATA_ID_CFA_KEY_MGMT = 162,
93 ATA_ID_CFA_MODES = 163, 95 ATA_ID_CFA_MODES = 163,
96 ATA_ID_DATA_SET_MGMT = 169,
94 ATA_ID_ROT_SPEED = 217, 97 ATA_ID_ROT_SPEED = 217,
95 ATA_ID_PIO4 = (1 << 1), 98 ATA_ID_PIO4 = (1 << 1),
96 99
@@ -108,6 +111,8 @@ enum {
108 ATA_PIO5 = ATA_PIO4 | (1 << 5), 111 ATA_PIO5 = ATA_PIO4 | (1 << 5),
109 ATA_PIO6 = ATA_PIO5 | (1 << 6), 112 ATA_PIO6 = ATA_PIO5 | (1 << 6),
110 113
114 ATA_PIO4_ONLY = (1 << 4),
115
111 ATA_SWDMA0 = (1 << 0), 116 ATA_SWDMA0 = (1 << 0),
112 ATA_SWDMA1 = ATA_SWDMA0 | (1 << 1), 117 ATA_SWDMA1 = ATA_SWDMA0 | (1 << 1),
113 ATA_SWDMA2 = ATA_SWDMA1 | (1 << 2), 118 ATA_SWDMA2 = ATA_SWDMA1 | (1 << 2),
@@ -117,6 +122,8 @@ enum {
117 ATA_MWDMA0 = (1 << 0), 122 ATA_MWDMA0 = (1 << 0),
118 ATA_MWDMA1 = ATA_MWDMA0 | (1 << 1), 123 ATA_MWDMA1 = ATA_MWDMA0 | (1 << 1),
119 ATA_MWDMA2 = ATA_MWDMA1 | (1 << 2), 124 ATA_MWDMA2 = ATA_MWDMA1 | (1 << 2),
125 ATA_MWDMA3 = ATA_MWDMA2 | (1 << 3),
126 ATA_MWDMA4 = ATA_MWDMA3 | (1 << 4),
120 127
121 ATA_MWDMA12_ONLY = (1 << 1) | (1 << 2), 128 ATA_MWDMA12_ONLY = (1 << 1) | (1 << 2),
122 ATA_MWDMA2_ONLY = (1 << 2), 129 ATA_MWDMA2_ONLY = (1 << 2),
@@ -131,6 +138,8 @@ enum {
131 ATA_UDMA7 = ATA_UDMA6 | (1 << 7), 138 ATA_UDMA7 = ATA_UDMA6 | (1 << 7),
132 /* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */ 139 /* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */
133 140
141 ATA_UDMA24_ONLY = (1 << 2) | (1 << 4),
142
134 ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */ 143 ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */
135 144
136 /* DMA-related */ 145 /* DMA-related */
@@ -242,10 +251,9 @@ enum {
242 ATA_CMD_SMART = 0xB0, 251 ATA_CMD_SMART = 0xB0,
243 ATA_CMD_MEDIA_LOCK = 0xDE, 252 ATA_CMD_MEDIA_LOCK = 0xDE,
244 ATA_CMD_MEDIA_UNLOCK = 0xDF, 253 ATA_CMD_MEDIA_UNLOCK = 0xDF,
254 ATA_CMD_DSM = 0x06,
245 /* marked obsolete in the ATA/ATAPI-7 spec */ 255 /* marked obsolete in the ATA/ATAPI-7 spec */
246 ATA_CMD_RESTORE = 0x10, 256 ATA_CMD_RESTORE = 0x10,
247 /* EXABYTE specific */
248 ATA_EXABYTE_ENABLE_NEST = 0xF0,
249 257
250 /* READ_LOG_EXT pages */ 258 /* READ_LOG_EXT pages */
251 ATA_LOG_SATA_NCQ = 0x10, 259 ATA_LOG_SATA_NCQ = 0x10,
@@ -317,6 +325,9 @@ enum {
317 ATA_SMART_READ_VALUES = 0xD0, 325 ATA_SMART_READ_VALUES = 0xD0,
318 ATA_SMART_READ_THRESHOLDS = 0xD1, 326 ATA_SMART_READ_THRESHOLDS = 0xD1,
319 327
328 /* feature values for Data Set Management */
329 ATA_DSM_TRIM = 0x01,
330
320 /* password used in LBA Mid / LBA High for executing SMART commands */ 331 /* password used in LBA Mid / LBA High for executing SMART commands */
321 ATA_SMART_LBAM_PASS = 0x4F, 332 ATA_SMART_LBAM_PASS = 0x4F,
322 ATA_SMART_LBAH_PASS = 0xC2, 333 ATA_SMART_LBAH_PASS = 0xC2,
@@ -719,6 +730,14 @@ static inline int ata_id_has_unload(const u16 *id)
719 return 0; 730 return 0;
720} 731}
721 732
733static inline int ata_id_has_trim(const u16 *id)
734{
735 if (ata_id_major_version(id) >= 7 &&
736 (id[ATA_ID_DATA_SET_MGMT] & 1))
737 return 1;
738 return 0;
739}
740
722static inline int ata_id_current_chs_valid(const u16 *id) 741static inline int ata_id_current_chs_valid(const u16 *id)
723{ 742{
724 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 743 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -859,6 +878,32 @@ static inline void ata_id_to_hd_driveid(u16 *id)
859#endif 878#endif
860} 879}
861 880
881/*
882 * Write up to 'max' LBA Range Entries to the buffer that will cover the
883 * extent from sector to sector + count. This is used for TRIM and for
884 * ADD LBA(S) TO NV CACHE PINNED SET.
885 */
886static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max,
887 u64 sector, unsigned long count)
888{
889 __le64 *buffer = _buffer;
890 unsigned i = 0;
891
892 while (i < max) {
893 u64 entry = sector |
894 ((u64)(count > 0xffff ? 0xffff : count) << 48);
895 buffer[i++] = __cpu_to_le64(entry);
896 if (count <= 0xffff)
897 break;
898 count -= 0xffff;
899 sector += 0xffff;
900 }
901
902 max = ALIGN(i * 8, 512);
903 memset(buffer + i, 0, max - i * 8);
904 return max;
905}
906
862static inline int is_multi_taskfile(struct ata_taskfile *tf) 907static inline int is_multi_taskfile(struct ata_taskfile *tf)
863{ 908{
864 return (tf->command == ATA_CMD_READ_MULTI) || 909 return (tf->command == ATA_CMD_READ_MULTI) ||
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
new file mode 100644
index 000000000000..b847fc7b93f9
--- /dev/null
+++ b/include/linux/ath9k_platform.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 2008 Atheros Communications Inc.
3 * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
4 * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _LINUX_ATH9K_PLATFORM_H
20#define _LINUX_ATH9K_PLATFORM_H
21
22#define ATH9K_PLAT_EEP_MAX_WORDS 2048
23
24struct ath9k_platform_data {
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26};
27
28#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index 6f5a1bab8f50..39c917fd1b96 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -11,6 +11,7 @@
11#include <linux/atmioc.h> 11#include <linux/atmioc.h>
12#include <linux/atm.h> 12#include <linux/atm.h>
13#include <linux/if_ether.h> 13#include <linux/if_ether.h>
14#include <linux/types.h>
14 15
15/* ATM lec daemon control socket */ 16/* ATM lec daemon control socket */
16#define ATMLEC_CTRL _IO('a', ATMIOC_LANE) 17#define ATMLEC_CTRL _IO('a', ATMIOC_LANE)
@@ -78,8 +79,8 @@ struct atmlec_msg {
78 } normal; 79 } normal;
79 struct atmlec_config_msg config; 80 struct atmlec_config_msg config;
80 struct { 81 struct {
81 uint16_t lec_id; /* requestor lec_id */ 82 __u16 lec_id; /* requestor lec_id */
82 uint32_t tran_id; /* transaction id */ 83 __u32 tran_id; /* transaction id */
83 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ 84 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
84 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ 85 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
85 } proxy; /* 86 } proxy; /*
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h
index ea1650425a12..2aba5787fa63 100644
--- a/include/linux/atmmpc.h
+++ b/include/linux/atmmpc.h
@@ -4,6 +4,7 @@
4#include <linux/atmapi.h> 4#include <linux/atmapi.h>
5#include <linux/atmioc.h> 5#include <linux/atmioc.h>
6#include <linux/atm.h> 6#include <linux/atm.h>
7#include <linux/types.h>
7 8
8#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) 9#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
9#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) 10#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
@@ -18,39 +19,39 @@ struct atmmpc_ioc {
18}; 19};
19 20
20typedef struct in_ctrl_info { 21typedef struct in_ctrl_info {
21 uint8_t Last_NHRP_CIE_code; 22 __u8 Last_NHRP_CIE_code;
22 uint8_t Last_Q2931_cause_value; 23 __u8 Last_Q2931_cause_value;
23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN]; 24 __u8 eg_MPC_ATM_addr[ATM_ESA_LEN];
24 __be32 tag; 25 __be32 tag;
25 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ 26 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */
26 uint16_t holding_time; 27 __u16 holding_time;
27 uint32_t request_id; 28 __u32 request_id;
28} in_ctrl_info; 29} in_ctrl_info;
29 30
30typedef struct eg_ctrl_info { 31typedef struct eg_ctrl_info {
31 uint8_t DLL_header[256]; 32 __u8 DLL_header[256];
32 uint8_t DH_length; 33 __u8 DH_length;
33 __be32 cache_id; 34 __be32 cache_id;
34 __be32 tag; 35 __be32 tag;
35 __be32 mps_ip; 36 __be32 mps_ip;
36 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ 37 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */
37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN]; 38 __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN];
38 uint16_t holding_time; 39 __u16 holding_time;
39} eg_ctrl_info; 40} eg_ctrl_info;
40 41
41struct mpc_parameters { 42struct mpc_parameters {
42 uint16_t mpc_p1; /* Shortcut-Setup Frame Count */ 43 __u16 mpc_p1; /* Shortcut-Setup Frame Count */
43 uint16_t mpc_p2; /* Shortcut-Setup Frame Time */ 44 __u16 mpc_p2; /* Shortcut-Setup Frame Time */
44 uint8_t mpc_p3[8]; /* Flow-detection Protocols */ 45 __u8 mpc_p3[8]; /* Flow-detection Protocols */
45 uint16_t mpc_p4; /* MPC Initial Retry Time */ 46 __u16 mpc_p4; /* MPC Initial Retry Time */
46 uint16_t mpc_p5; /* MPC Retry Time Maximum */ 47 __u16 mpc_p5; /* MPC Retry Time Maximum */
47 uint16_t mpc_p6; /* Hold Down Time */ 48 __u16 mpc_p6; /* Hold Down Time */
48} ; 49} ;
49 50
50struct k_message { 51struct k_message {
51 uint16_t type; 52 __u16 type;
52 __be32 ip_mask; 53 __be32 ip_mask;
53 uint8_t MPS_ctrl[ATM_ESA_LEN]; 54 __u8 MPS_ctrl[ATM_ESA_LEN];
54 union { 55 union {
55 in_ctrl_info in_info; 56 in_ctrl_info in_info;
56 eg_ctrl_info eg_info; 57 eg_ctrl_info eg_info;
@@ -61,11 +62,11 @@ struct k_message {
61 62
62struct llc_snap_hdr { 63struct llc_snap_hdr {
63 /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ 64 /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
64 uint8_t dsap; /* Destination Service Access Point (0xAA) */ 65 __u8 dsap; /* Destination Service Access Point (0xAA) */
65 uint8_t ssap; /* Source Service Access Point (0xAA) */ 66 __u8 ssap; /* Source Service Access Point (0xAA) */
66 uint8_t ui; /* Unnumbered Information (0x03) */ 67 __u8 ui; /* Unnumbered Information (0x03) */
67 uint8_t org[3]; /* Organizational identification (0x000000) */ 68 __u8 org[3]; /* Organizational identification (0x000000) */
68 uint8_t type[2]; /* Ether type (for IP) (0x0800) */ 69 __u8 type[2]; /* Ether type (for IP) (0x0800) */
69}; 70};
70 71
71/* TLVs this MPC recognizes */ 72/* TLVs this MPC recognizes */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 67e5dbfc2961..4fa2810b675e 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -36,7 +36,8 @@
36 * 1500 - 1599 kernel LSPP events 36 * 1500 - 1599 kernel LSPP events
37 * 1600 - 1699 kernel crypto events 37 * 1600 - 1699 kernel crypto events
38 * 1700 - 1799 kernel anomaly records 38 * 1700 - 1799 kernel anomaly records
39 * 1800 - 1999 future kernel use (maybe integrity labels and related events) 39 * 1800 - 1899 kernel integrity events
40 * 1900 - 1999 future kernel use
40 * 2000 is for otherwise unclassified kernel audit messages (legacy) 41 * 2000 is for otherwise unclassified kernel audit messages (legacy)
41 * 2001 - 2099 unused (kernel) 42 * 2001 - 2099 unused (kernel)
42 * 2100 - 2199 user space anomaly records 43 * 2100 - 2199 user space anomaly records
@@ -125,6 +126,12 @@
125#define AUDIT_LAST_KERN_ANOM_MSG 1799 126#define AUDIT_LAST_KERN_ANOM_MSG 1799
126#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ 127#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
127#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ 128#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
129#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
130#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
131#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
132#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */
133#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */
134#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */
128 135
129#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ 136#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
130 137
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
index 91a773993a5c..850f39b33e74 100644
--- a/include/linux/auto_dev-ioctl.h
+++ b/include/linux/auto_dev-ioctl.h
@@ -10,8 +10,13 @@
10#ifndef _LINUX_AUTO_DEV_IOCTL_H 10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H 11#define _LINUX_AUTO_DEV_IOCTL_H
12 12
13#include <linux/auto_fs.h>
14
15#ifdef __KERNEL__
13#include <linux/string.h> 16#include <linux/string.h>
14#include <linux/types.h> 17#else
18#include <string.h>
19#endif /* __KERNEL__ */
15 20
16#define AUTOFS_DEVICE_NAME "autofs" 21#define AUTOFS_DEVICE_NAME "autofs"
17 22
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index c21e5972a3e8..63265852b7d1 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -17,11 +17,13 @@
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/limits.h> 19#include <linux/limits.h>
20#include <linux/types.h>
21#include <linux/ioctl.h>
22#else
20#include <asm/types.h> 23#include <asm/types.h>
24#include <sys/ioctl.h>
21#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
22 26
23#include <linux/ioctl.h>
24
25/* This file describes autofs v3 */ 27/* This file describes autofs v3 */
26#define AUTOFS_PROTO_VERSION 3 28#define AUTOFS_PROTO_VERSION 3
27 29
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index bee52abb8a4d..0ec2c594868e 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -24,8 +24,8 @@ struct dentry;
24 */ 24 */
25enum bdi_state { 25enum bdi_state {
26 BDI_pdflush, /* A pdflush thread is working this device */ 26 BDI_pdflush, /* A pdflush thread is working this device */
27 BDI_write_congested, /* The write queue is getting full */ 27 BDI_async_congested, /* The async (write) queue is getting full */
28 BDI_read_congested, /* The read queue is getting full */ 28 BDI_sync_congested, /* The sync queue is getting full */
29 BDI_unused, /* Available bits start here */ 29 BDI_unused, /* Available bits start here */
30}; 30};
31 31
@@ -215,18 +215,18 @@ static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
215 215
216static inline int bdi_read_congested(struct backing_dev_info *bdi) 216static inline int bdi_read_congested(struct backing_dev_info *bdi)
217{ 217{
218 return bdi_congested(bdi, 1 << BDI_read_congested); 218 return bdi_congested(bdi, 1 << BDI_sync_congested);
219} 219}
220 220
221static inline int bdi_write_congested(struct backing_dev_info *bdi) 221static inline int bdi_write_congested(struct backing_dev_info *bdi)
222{ 222{
223 return bdi_congested(bdi, 1 << BDI_write_congested); 223 return bdi_congested(bdi, 1 << BDI_async_congested);
224} 224}
225 225
226static inline int bdi_rw_congested(struct backing_dev_info *bdi) 226static inline int bdi_rw_congested(struct backing_dev_info *bdi)
227{ 227{
228 return bdi_congested(bdi, (1 << BDI_read_congested)| 228 return bdi_congested(bdi, (1 << BDI_sync_congested) |
229 (1 << BDI_write_congested)); 229 (1 << BDI_async_congested));
230} 230}
231 231
232void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 232void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 77b4a9e46004..6638b8148de7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -35,8 +35,7 @@ struct linux_binprm{
35#endif 35#endif
36 struct mm_struct *mm; 36 struct mm_struct *mm;
37 unsigned long p; /* current top of mem */ 37 unsigned long p; /* current top of mem */
38 unsigned int sh_bang:1, 38 unsigned int
39 misc_bang:1,
40 cred_prepared:1,/* true if creds already prepared (multiple 39 cred_prepared:1,/* true if creds already prepared (multiple
41 * preps happen for interpreters) */ 40 * preps happen for interpreters) */
42 cap_effective:1;/* true if has elevated effective capabilities, 41 cap_effective:1;/* true if has elevated effective capabilities,
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d8bd43bfdcf5..b900d2c67d29 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -145,20 +145,21 @@ struct bio {
145 * bit 2 -- barrier 145 * bit 2 -- barrier
146 * Insert a serialization point in the IO queue, forcing previously 146 * Insert a serialization point in the IO queue, forcing previously
147 * submitted IO to be completed before this one is issued. 147 * submitted IO to be completed before this one is issued.
148 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately 148 * bit 3 -- synchronous I/O hint.
149 * Note that this does NOT indicate that the IO itself is sync, just 149 * bit 4 -- Unplug the device immediately after submitting this bio.
150 * that the block layer will not postpone issue of this IO by plugging. 150 * bit 5 -- metadata request
151 * bit 4 -- metadata request
152 * Used for tracing to differentiate metadata and data IO. May also 151 * Used for tracing to differentiate metadata and data IO. May also
153 * get some preferential treatment in the IO scheduler 152 * get some preferential treatment in the IO scheduler
154 * bit 5 -- discard sectors 153 * bit 6 -- discard sectors
155 * Informs the lower level device that this range of sectors is no longer 154 * Informs the lower level device that this range of sectors is no longer
156 * used by the file system and may thus be freed by the device. Used 155 * used by the file system and may thus be freed by the device. Used
157 * for flash based storage. 156 * for flash based storage.
158 * bit 6 -- fail fast device errors 157 * bit 7 -- fail fast device errors
159 * bit 7 -- fail fast transport errors 158 * bit 8 -- fail fast transport errors
160 * bit 8 -- fail fast driver errors 159 * bit 9 -- fail fast driver errors
161 * Don't want driver retries for any fast fail whatever the reason. 160 * Don't want driver retries for any fast fail whatever the reason.
161 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
162 one has been submitted, even if it is a SYNC request.
162 */ 163 */
163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 164#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 165#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
@@ -170,6 +171,7 @@ struct bio {
170#define BIO_RW_FAILFAST_DEV 7 171#define BIO_RW_FAILFAST_DEV 7
171#define BIO_RW_FAILFAST_TRANSPORT 8 172#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9 173#define BIO_RW_FAILFAST_DRIVER 9
174#define BIO_RW_NOIDLE 10
173 175
174#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 176#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
175 177
@@ -188,6 +190,7 @@ struct bio {
188#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) 190#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
189#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META) 191#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
190#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) 192#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
193#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
191 194
192/* 195/*
193 * upper 16 bits of bi_rw define the io priority of this bio 196 * upper 16 bits of bi_rw define the io priority of this bio
@@ -426,9 +429,6 @@ struct bio_set {
426 unsigned int front_pad; 429 unsigned int front_pad;
427 430
428 mempool_t *bio_pool; 431 mempool_t *bio_pool;
429#if defined(CONFIG_BLK_DEV_INTEGRITY)
430 mempool_t *bio_integrity_pool;
431#endif
432 mempool_t *bvec_pool; 432 mempool_t *bvec_pool;
433}; 433};
434 434
@@ -519,9 +519,8 @@ static inline int bio_has_data(struct bio *bio)
519 519
520#define bio_integrity(bio) (bio->bi_integrity != NULL) 520#define bio_integrity(bio) (bio->bi_integrity != NULL)
521 521
522extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
523extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 522extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
524extern void bio_integrity_free(struct bio *, struct bio_set *); 523extern void bio_integrity_free(struct bio *);
525extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 524extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
526extern int bio_integrity_enabled(struct bio *bio); 525extern int bio_integrity_enabled(struct bio *bio);
527extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); 526extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
@@ -531,27 +530,21 @@ extern void bio_integrity_endio(struct bio *, int);
531extern void bio_integrity_advance(struct bio *, unsigned int); 530extern void bio_integrity_advance(struct bio *, unsigned int);
532extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); 531extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
533extern void bio_integrity_split(struct bio *, struct bio_pair *, int); 532extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
534extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *); 533extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t);
535extern int bioset_integrity_create(struct bio_set *, int);
536extern void bioset_integrity_free(struct bio_set *);
537extern void bio_integrity_init_slab(void);
538 534
539#else /* CONFIG_BLK_DEV_INTEGRITY */ 535#else /* CONFIG_BLK_DEV_INTEGRITY */
540 536
541#define bio_integrity(a) (0) 537#define bio_integrity(a) (0)
542#define bioset_integrity_create(a, b) (0)
543#define bio_integrity_prep(a) (0) 538#define bio_integrity_prep(a) (0)
544#define bio_integrity_enabled(a) (0) 539#define bio_integrity_enabled(a) (0)
545#define bio_integrity_clone(a, b, c,d ) (0) 540#define bio_integrity_clone(a, b, c) (0)
546#define bioset_integrity_free(a) do { } while (0) 541#define bio_integrity_free(a) do { } while (0)
547#define bio_integrity_free(a, b) do { } while (0)
548#define bio_integrity_endio(a, b) do { } while (0) 542#define bio_integrity_endio(a, b) do { } while (0)
549#define bio_integrity_advance(a, b) do { } while (0) 543#define bio_integrity_advance(a, b) do { } while (0)
550#define bio_integrity_trim(a, b, c) do { } while (0) 544#define bio_integrity_trim(a, b, c) do { } while (0)
551#define bio_integrity_split(a, b, c) do { } while (0) 545#define bio_integrity_split(a, b, c) do { } while (0)
552#define bio_integrity_set_tag(a, b, c) do { } while (0) 546#define bio_integrity_set_tag(a, b, c) do { } while (0)
553#define bio_integrity_get_tag(a, b, c) do { } while (0) 547#define bio_integrity_get_tag(a, b, c) do { } while (0)
554#define bio_integrity_init_slab(a) do { } while (0)
555 548
556#endif /* CONFIG_BLK_DEV_INTEGRITY */ 549#endif /* CONFIG_BLK_DEV_INTEGRITY */
557 550
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 465d6babc847..ba54c834a590 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -38,6 +38,10 @@ struct request;
38typedef void (rq_end_io_fn)(struct request *, int); 38typedef void (rq_end_io_fn)(struct request *, int);
39 39
40struct request_list { 40struct request_list {
41 /*
42 * count[], starved[], and wait[] are indexed by
43 * BLK_RW_SYNC/BLK_RW_ASYNC
44 */
41 int count[2]; 45 int count[2];
42 int starved[2]; 46 int starved[2];
43 int elvpriv; 47 int elvpriv;
@@ -66,6 +70,11 @@ enum rq_cmd_type_bits {
66 REQ_TYPE_ATA_PC, 70 REQ_TYPE_ATA_PC,
67}; 71};
68 72
73enum {
74 BLK_RW_ASYNC = 0,
75 BLK_RW_SYNC = 1,
76};
77
69/* 78/*
70 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being 79 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
71 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a 80 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
@@ -103,12 +112,12 @@ enum rq_flag_bits {
103 __REQ_QUIET, /* don't worry about errors */ 112 __REQ_QUIET, /* don't worry about errors */
104 __REQ_PREEMPT, /* set for "ide_preempt" requests */ 113 __REQ_PREEMPT, /* set for "ide_preempt" requests */
105 __REQ_ORDERED_COLOR, /* is before or after barrier */ 114 __REQ_ORDERED_COLOR, /* is before or after barrier */
106 __REQ_RW_SYNC, /* request is sync (O_DIRECT) */ 115 __REQ_RW_SYNC, /* request is sync (sync write or read) */
107 __REQ_ALLOCED, /* request came from our alloc pool */ 116 __REQ_ALLOCED, /* request came from our alloc pool */
108 __REQ_RW_META, /* metadata io request */ 117 __REQ_RW_META, /* metadata io request */
109 __REQ_COPY_USER, /* contains copies of user pages */ 118 __REQ_COPY_USER, /* contains copies of user pages */
110 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 119 __REQ_INTEGRITY, /* integrity metadata has been remapped */
111 __REQ_UNPLUG, /* unplug queue on submission */ 120 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
112 __REQ_NR_BITS, /* stops here */ 121 __REQ_NR_BITS, /* stops here */
113}; 122};
114 123
@@ -135,7 +144,7 @@ enum rq_flag_bits {
135#define REQ_RW_META (1 << __REQ_RW_META) 144#define REQ_RW_META (1 << __REQ_RW_META)
136#define REQ_COPY_USER (1 << __REQ_COPY_USER) 145#define REQ_COPY_USER (1 << __REQ_COPY_USER)
137#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 146#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138#define REQ_UNPLUG (1 << __REQ_UNPLUG) 147#define REQ_NOIDLE (1 << __REQ_NOIDLE)
139 148
140#define BLK_MAX_CDB 16 149#define BLK_MAX_CDB 16
141 150
@@ -438,8 +447,8 @@ struct request_queue
438#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 447#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
439#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 448#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
440#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 449#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
441#define QUEUE_FLAG_READFULL 3 /* read queue has been filled */ 450#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
442#define QUEUE_FLAG_WRITEFULL 4 /* write queue has been filled */ 451#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
443#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 452#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 453#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 454#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
@@ -611,32 +620,42 @@ enum {
611#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 620#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
612 621
613/* 622/*
614 * We regard a request as sync, if it's a READ or a SYNC write. 623 * We regard a request as sync, if either a read or a sync write
615 */ 624 */
616#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC) 625static inline bool rw_is_sync(unsigned int rw_flags)
626{
627 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC);
628}
629
630static inline bool rq_is_sync(struct request *rq)
631{
632 return rw_is_sync(rq->cmd_flags);
633}
634
617#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) 635#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
636#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
618 637
619static inline int blk_queue_full(struct request_queue *q, int rw) 638static inline int blk_queue_full(struct request_queue *q, int sync)
620{ 639{
621 if (rw == READ) 640 if (sync)
622 return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 641 return test_bit(QUEUE_FLAG_SYNCFULL, &q->queue_flags);
623 return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 642 return test_bit(QUEUE_FLAG_ASYNCFULL, &q->queue_flags);
624} 643}
625 644
626static inline void blk_set_queue_full(struct request_queue *q, int rw) 645static inline void blk_set_queue_full(struct request_queue *q, int sync)
627{ 646{
628 if (rw == READ) 647 if (sync)
629 queue_flag_set(QUEUE_FLAG_READFULL, q); 648 queue_flag_set(QUEUE_FLAG_SYNCFULL, q);
630 else 649 else
631 queue_flag_set(QUEUE_FLAG_WRITEFULL, q); 650 queue_flag_set(QUEUE_FLAG_ASYNCFULL, q);
632} 651}
633 652
634static inline void blk_clear_queue_full(struct request_queue *q, int rw) 653static inline void blk_clear_queue_full(struct request_queue *q, int sync)
635{ 654{
636 if (rw == READ) 655 if (sync)
637 queue_flag_clear(QUEUE_FLAG_READFULL, q); 656 queue_flag_clear(QUEUE_FLAG_SYNCFULL, q);
638 else 657 else
639 queue_flag_clear(QUEUE_FLAG_WRITEFULL, q); 658 queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q);
640} 659}
641 660
642 661
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 455d83219fae..bc3ab7073695 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -146,10 +146,10 @@ extern void *alloc_large_system_hash(const char *tablename,
146 146
147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
148 148
149/* Only NUMA needs hash distribution. 149/* Only NUMA needs hash distribution. 64bit NUMA architectures have
150 * IA64 and x86_64 have sufficient vmalloc space. 150 * sufficient vmalloc space.
151 */ 151 */
152#if defined(CONFIG_NUMA) && (defined(CONFIG_IA64) || defined(CONFIG_X86_64)) 152#if defined(CONFIG_NUMA) && defined(CONFIG_64BIT)
153#define HASHDIST_DEFAULT 1 153#define HASHDIST_DEFAULT 1
154#else 154#else
155#define HASHDIST_DEFAULT 0 155#define HASHDIST_DEFAULT 0
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index cf0303a60611..ecb4730d0868 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -1,12 +1,22 @@
1#ifndef BSG_H 1#ifndef BSG_H
2#define BSG_H 2#define BSG_H
3 3
4#include <linux/types.h>
5
4#define BSG_PROTOCOL_SCSI 0 6#define BSG_PROTOCOL_SCSI 0
5 7
6#define BSG_SUB_PROTOCOL_SCSI_CMD 0 8#define BSG_SUB_PROTOCOL_SCSI_CMD 0
7#define BSG_SUB_PROTOCOL_SCSI_TMF 1 9#define BSG_SUB_PROTOCOL_SCSI_TMF 1
8#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
9 11
12/*
13 * For flags member below
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However
15 * none of these bits are implemented/used by bsg. The bits below are
16 * allocated to not conflict with sg.h ones anyway.
17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */
19
10struct sg_io_v4 { 20struct sg_io_v4 {
11 __s32 guard; /* [i] 'Q' to differentiate from v3 */ 21 __s32 guard; /* [i] 'Q' to differentiate from v3 */
12 __u32 protocol; /* [i] 0 -> SCSI , .... */ 22 __u32 protocol; /* [i] 0 -> SCSI , .... */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index bd7ac793be19..7b73bb8f1970 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -165,15 +165,8 @@ int sync_mapping_buffers(struct address_space *mapping);
165void unmap_underlying_metadata(struct block_device *bdev, sector_t block); 165void unmap_underlying_metadata(struct block_device *bdev, sector_t block);
166 166
167void mark_buffer_async_write(struct buffer_head *bh); 167void mark_buffer_async_write(struct buffer_head *bh);
168void invalidate_bdev(struct block_device *);
169int sync_blockdev(struct block_device *bdev);
170void __wait_on_buffer(struct buffer_head *); 168void __wait_on_buffer(struct buffer_head *);
171wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 169wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
172int fsync_bdev(struct block_device *);
173struct super_block *freeze_bdev(struct block_device *);
174int thaw_bdev(struct block_device *, struct super_block *);
175int fsync_super(struct super_block *);
176int fsync_no_super(struct block_device *);
177struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 170struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
178 unsigned size); 171 unsigned size);
179struct buffer_head *__getblk(struct block_device *bdev, sector_t block, 172struct buffer_head *__getblk(struct block_device *bdev, sector_t block,
@@ -223,7 +216,7 @@ int cont_write_begin(struct file *, struct address_space *, loff_t,
223 get_block_t *, loff_t *); 216 get_block_t *, loff_t *);
224int generic_cont_expand_simple(struct inode *inode, loff_t size); 217int generic_cont_expand_simple(struct inode *inode, loff_t size);
225int block_commit_write(struct page *page, unsigned from, unsigned to); 218int block_commit_write(struct page *page, unsigned from, unsigned to);
226int block_page_mkwrite(struct vm_area_struct *vma, struct page *page, 219int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
227 get_block_t get_block); 220 get_block_t get_block);
228void block_sync_page(struct page *); 221void block_sync_page(struct page *);
229sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 222sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
@@ -339,22 +332,10 @@ extern int __set_page_dirty_buffers(struct page *page);
339 332
340static inline void buffer_init(void) {} 333static inline void buffer_init(void) {}
341static inline int try_to_free_buffers(struct page *page) { return 1; } 334static inline int try_to_free_buffers(struct page *page) { return 1; }
342static inline int sync_blockdev(struct block_device *bdev) { return 0; }
343static inline int inode_has_buffers(struct inode *inode) { return 0; } 335static inline int inode_has_buffers(struct inode *inode) { return 0; }
344static inline void invalidate_inode_buffers(struct inode *inode) {} 336static inline void invalidate_inode_buffers(struct inode *inode) {}
345static inline int remove_inode_buffers(struct inode *inode) { return 1; } 337static inline int remove_inode_buffers(struct inode *inode) { return 1; }
346static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } 338static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
347static inline void invalidate_bdev(struct block_device *bdev) {}
348
349static inline struct super_block *freeze_bdev(struct block_device *sb)
350{
351 return NULL;
352}
353
354static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
355{
356 return 0;
357}
358 339
359#endif /* CONFIG_BLOCK */ 340#endif /* CONFIG_BLOCK */
360#endif /* _LINUX_BUFFER_HEAD_H */ 341#endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 499900d0cee7..665fa70e4094 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -15,6 +15,7 @@
15#include <linux/cgroupstats.h> 15#include <linux/cgroupstats.h>
16#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h>
18 19
19#ifdef CONFIG_CGROUPS 20#ifdef CONFIG_CGROUPS
20 21
@@ -22,6 +23,7 @@ struct cgroupfs_root;
22struct cgroup_subsys; 23struct cgroup_subsys;
23struct inode; 24struct inode;
24struct cgroup; 25struct cgroup;
26struct css_id;
25 27
26extern int cgroup_init_early(void); 28extern int cgroup_init_early(void);
27extern int cgroup_init(void); 29extern int cgroup_init(void);
@@ -47,18 +49,24 @@ enum cgroup_subsys_id {
47 49
48/* Per-subsystem/per-cgroup state maintained by the system. */ 50/* Per-subsystem/per-cgroup state maintained by the system. */
49struct cgroup_subsys_state { 51struct cgroup_subsys_state {
50 /* The cgroup that this subsystem is attached to. Useful 52 /*
53 * The cgroup that this subsystem is attached to. Useful
51 * for subsystems that want to know about the cgroup 54 * for subsystems that want to know about the cgroup
52 * hierarchy structure */ 55 * hierarchy structure
56 */
53 struct cgroup *cgroup; 57 struct cgroup *cgroup;
54 58
55 /* State maintained by the cgroup system to allow subsystems 59 /*
60 * State maintained by the cgroup system to allow subsystems
56 * to be "busy". Should be accessed via css_get(), 61 * to be "busy". Should be accessed via css_get(),
57 * css_tryget() and and css_put(). */ 62 * css_tryget() and and css_put().
63 */
58 64
59 atomic_t refcnt; 65 atomic_t refcnt;
60 66
61 unsigned long flags; 67 unsigned long flags;
68 /* ID for this css, if possible */
69 struct css_id *id;
62}; 70};
63 71
64/* bits in struct cgroup_subsys_state flags field */ 72/* bits in struct cgroup_subsys_state flags field */
@@ -120,19 +128,26 @@ static inline void css_put(struct cgroup_subsys_state *css)
120enum { 128enum {
121 /* Control Group is dead */ 129 /* Control Group is dead */
122 CGRP_REMOVED, 130 CGRP_REMOVED,
123 /* Control Group has previously had a child cgroup or a task, 131 /*
124 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */ 132 * Control Group has previously had a child cgroup or a task,
133 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
134 */
125 CGRP_RELEASABLE, 135 CGRP_RELEASABLE,
126 /* Control Group requires release notifications to userspace */ 136 /* Control Group requires release notifications to userspace */
127 CGRP_NOTIFY_ON_RELEASE, 137 CGRP_NOTIFY_ON_RELEASE,
138 /*
139 * A thread in rmdir() is wating for this cgroup.
140 */
141 CGRP_WAIT_ON_RMDIR,
128}; 142};
129 143
130struct cgroup { 144struct cgroup {
131 unsigned long flags; /* "unsigned long" so bitops work */ 145 unsigned long flags; /* "unsigned long" so bitops work */
132 146
133 /* count users of this cgroup. >0 means busy, but doesn't 147 /*
134 * necessarily indicate the number of tasks in the 148 * count users of this cgroup. >0 means busy, but doesn't
135 * cgroup */ 149 * necessarily indicate the number of tasks in the cgroup
150 */
136 atomic_t count; 151 atomic_t count;
137 152
138 /* 153 /*
@@ -142,7 +157,7 @@ struct cgroup {
142 struct list_head sibling; /* my parent's children */ 157 struct list_head sibling; /* my parent's children */
143 struct list_head children; /* my children */ 158 struct list_head children; /* my children */
144 159
145 struct cgroup *parent; /* my parent */ 160 struct cgroup *parent; /* my parent */
146 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 161 struct dentry *dentry; /* cgroup fs entry, RCU protected */
147 162
148 /* Private pointers for each registered subsystem */ 163 /* Private pointers for each registered subsystem */
@@ -177,11 +192,12 @@ struct cgroup {
177 struct rcu_head rcu_head; 192 struct rcu_head rcu_head;
178}; 193};
179 194
180/* A css_set is a structure holding pointers to a set of 195/*
196 * A css_set is a structure holding pointers to a set of
181 * cgroup_subsys_state objects. This saves space in the task struct 197 * cgroup_subsys_state objects. This saves space in the task struct
182 * object and speeds up fork()/exit(), since a single inc/dec and a 198 * object and speeds up fork()/exit(), since a single inc/dec and a
183 * list_add()/del() can bump the reference count on the entire 199 * list_add()/del() can bump the reference count on the entire cgroup
184 * cgroup set for a task. 200 * set for a task.
185 */ 201 */
186 202
187struct css_set { 203struct css_set {
@@ -226,13 +242,8 @@ struct cgroup_map_cb {
226 void *state; 242 void *state;
227}; 243};
228 244
229/* struct cftype: 245/*
230 * 246 * struct cftype: handler definitions for cgroup control files
231 * The files in the cgroup filesystem mostly have a very simple read/write
232 * handling, some common function will take care of it. Nevertheless some cases
233 * (read tasks) are special and therefore I define this structure for every
234 * kind of file.
235 *
236 * 247 *
237 * When reading/writing to a file: 248 * When reading/writing to a file:
238 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata 249 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata
@@ -241,10 +252,17 @@ struct cgroup_map_cb {
241 252
242#define MAX_CFTYPE_NAME 64 253#define MAX_CFTYPE_NAME 64
243struct cftype { 254struct cftype {
244 /* By convention, the name should begin with the name of the 255 /*
245 * subsystem, followed by a period */ 256 * By convention, the name should begin with the name of the
257 * subsystem, followed by a period
258 */
246 char name[MAX_CFTYPE_NAME]; 259 char name[MAX_CFTYPE_NAME];
247 int private; 260 int private;
261 /*
262 * If not 0, file mode is set to this value, otherwise it will
263 * be figured out automatically
264 */
265 mode_t mode;
248 266
249 /* 267 /*
250 * If non-zero, defines the maximum length of string that can 268 * If non-zero, defines the maximum length of string that can
@@ -319,15 +337,20 @@ struct cgroup_scanner {
319 void (*process_task)(struct task_struct *p, 337 void (*process_task)(struct task_struct *p,
320 struct cgroup_scanner *scan); 338 struct cgroup_scanner *scan);
321 struct ptr_heap *heap; 339 struct ptr_heap *heap;
340 void *data;
322}; 341};
323 342
324/* Add a new file to the given cgroup directory. Should only be 343/*
325 * called by subsystems from within a populate() method */ 344 * Add a new file to the given cgroup directory. Should only be
345 * called by subsystems from within a populate() method
346 */
326int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, 347int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
327 const struct cftype *cft); 348 const struct cftype *cft);
328 349
329/* Add a set of new files to the given cgroup directory. Should 350/*
330 * only be called by subsystems from within a populate() method */ 351 * Add a set of new files to the given cgroup directory. Should
352 * only be called by subsystems from within a populate() method
353 */
331int cgroup_add_files(struct cgroup *cgrp, 354int cgroup_add_files(struct cgroup *cgrp,
332 struct cgroup_subsys *subsys, 355 struct cgroup_subsys *subsys,
333 const struct cftype cft[], 356 const struct cftype cft[],
@@ -339,15 +362,18 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
339 362
340int cgroup_task_count(const struct cgroup *cgrp); 363int cgroup_task_count(const struct cgroup *cgrp);
341 364
342/* Return true if the cgroup is a descendant of the current cgroup */ 365/* Return true if cgrp is a descendant of the task's cgroup */
343int cgroup_is_descendant(const struct cgroup *cgrp); 366int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
344 367
345/* Control Group subsystem type. See Documentation/cgroups.txt for details */ 368/*
369 * Control Group subsystem type.
370 * See Documentation/cgroups/cgroups.txt for details
371 */
346 372
347struct cgroup_subsys { 373struct cgroup_subsys {
348 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 374 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
349 struct cgroup *cgrp); 375 struct cgroup *cgrp);
350 void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 376 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
351 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 377 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
352 int (*can_attach)(struct cgroup_subsys *ss, 378 int (*can_attach)(struct cgroup_subsys *ss,
353 struct cgroup *cgrp, struct task_struct *tsk); 379 struct cgroup *cgrp, struct task_struct *tsk);
@@ -364,6 +390,11 @@ struct cgroup_subsys {
364 int active; 390 int active;
365 int disabled; 391 int disabled;
366 int early_init; 392 int early_init;
393 /*
394 * True if this subsys uses ID. ID is not available before cgroup_init()
395 * (not available in early_init time.)
396 */
397 bool use_id;
367#define MAX_CGROUP_TYPE_NAMELEN 32 398#define MAX_CGROUP_TYPE_NAMELEN 32
368 const char *name; 399 const char *name;
369 400
@@ -386,6 +417,9 @@ struct cgroup_subsys {
386 */ 417 */
387 struct cgroupfs_root *root; 418 struct cgroupfs_root *root;
388 struct list_head sibling; 419 struct list_head sibling;
420 /* used when use_id == true */
421 struct idr idr;
422 spinlock_t id_lock;
389}; 423};
390 424
391#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 425#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
@@ -419,7 +453,8 @@ struct cgroup_iter {
419 struct list_head *task; 453 struct list_head *task;
420}; 454};
421 455
422/* To iterate across the tasks in a cgroup: 456/*
457 * To iterate across the tasks in a cgroup:
423 * 458 *
424 * 1) call cgroup_iter_start to intialize an iterator 459 * 1) call cgroup_iter_start to intialize an iterator
425 * 460 *
@@ -428,9 +463,10 @@ struct cgroup_iter {
428 * 463 *
429 * 3) call cgroup_iter_end() to destroy the iterator. 464 * 3) call cgroup_iter_end() to destroy the iterator.
430 * 465 *
431 * Or, call cgroup_scan_tasks() to iterate through every task in a cpuset. 466 * Or, call cgroup_scan_tasks() to iterate through every task in a
432 * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task() 467 * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
433 * callback, but not while calling the process_task() callback. 468 * the test_task() callback, but not while calling the process_task()
469 * callback.
434 */ 470 */
435void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it); 471void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
436struct task_struct *cgroup_iter_next(struct cgroup *cgrp, 472struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
@@ -439,6 +475,44 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
439int cgroup_scan_tasks(struct cgroup_scanner *scan); 475int cgroup_scan_tasks(struct cgroup_scanner *scan);
440int cgroup_attach_task(struct cgroup *, struct task_struct *); 476int cgroup_attach_task(struct cgroup *, struct task_struct *);
441 477
478/*
479 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
480 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
481 * CSS ID is assigned at cgroup allocation (create) automatically
482 * and removed when subsys calls free_css_id() function. This is because
483 * the lifetime of cgroup_subsys_state is subsys's matter.
484 *
485 * Looking up and scanning function should be called under rcu_read_lock().
486 * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls.
487 * But the css returned by this routine can be "not populated yet" or "being
488 * destroyed". The caller should check css and cgroup's status.
489 */
490
491/*
492 * Typically Called at ->destroy(), or somewhere the subsys frees
493 * cgroup_subsys_state.
494 */
495void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
496
497/* Find a cgroup_subsys_state which has given ID */
498
499struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
500
501/*
502 * Get a cgroup whose id is greater than or equal to id under tree of root.
503 * Returning a cgroup_subsys_state or NULL.
504 */
505struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id,
506 struct cgroup_subsys_state *root, int *foundid);
507
508/* Returns true if root is ancestor of cg */
509bool css_is_ancestor(struct cgroup_subsys_state *cg,
510 const struct cgroup_subsys_state *root);
511
512/* Get id and depth of css */
513unsigned short css_id(struct cgroup_subsys_state *css);
514unsigned short css_depth(struct cgroup_subsys_state *css);
515
442#else /* !CONFIG_CGROUPS */ 516#else /* !CONFIG_CGROUPS */
443 517
444static inline int cgroup_init_early(void) { return 0; } 518static inline int cgroup_init_early(void) { return 0; }
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 778777316ea4..1db9bbf444a3 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent);
125 */ 125 */
126struct clk *clk_get_parent(struct clk *clk); 126struct clk *clk_get_parent(struct clk *clk);
127 127
128/**
129 * clk_get_sys - get a clock based upon the device name
130 * @dev_id: device name
131 * @con_id: connection ID
132 *
133 * Returns a struct clk corresponding to the clock producer, or
134 * valid IS_ERR() condition containing errno. The implementation
135 * uses @dev_id and @con_id to determine the clock consumer, and
136 * thereby the clock producer. In contrast to clk_get() this function
137 * takes the device name instead of the device itself for identification.
138 *
139 * Drivers must assume that the clock source is not enabled.
140 *
141 * clk_get_sys should not be called from within interrupt context.
142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144
128#endif 145#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index f88d32f8ff7c..573819ef4cc0 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -22,8 +22,109 @@ typedef u64 cycle_t;
22struct clocksource; 22struct clocksource;
23 23
24/** 24/**
25 * struct cyclecounter - hardware abstraction for a free running counter
26 * Provides completely state-free accessors to the underlying hardware.
27 * Depending on which hardware it reads, the cycle counter may wrap
28 * around quickly. Locking rules (if necessary) have to be defined
29 * by the implementor and user of specific instances of this API.
30 *
31 * @read: returns the current cycle value
32 * @mask: bitmask for two's complement
33 * subtraction of non 64 bit counters,
34 * see CLOCKSOURCE_MASK() helper macro
35 * @mult: cycle to nanosecond multiplier
36 * @shift: cycle to nanosecond divisor (power of two)
37 */
38struct cyclecounter {
39 cycle_t (*read)(const struct cyclecounter *cc);
40 cycle_t mask;
41 u32 mult;
42 u32 shift;
43};
44
45/**
46 * struct timecounter - layer above a %struct cyclecounter which counts nanoseconds
47 * Contains the state needed by timecounter_read() to detect
48 * cycle counter wrap around. Initialize with
49 * timecounter_init(). Also used to convert cycle counts into the
50 * corresponding nanosecond counts with timecounter_cyc2time(). Users
51 * of this code are responsible for initializing the underlying
52 * cycle counter hardware, locking issues and reading the time
53 * more often than the cycle counter wraps around. The nanosecond
54 * counter will only wrap around after ~585 years.
55 *
56 * @cc: the cycle counter used by this instance
57 * @cycle_last: most recent cycle counter value seen by
58 * timecounter_read()
59 * @nsec: continuously increasing count
60 */
61struct timecounter {
62 const struct cyclecounter *cc;
63 cycle_t cycle_last;
64 u64 nsec;
65};
66
67/**
68 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
69 * @tc: Pointer to cycle counter.
70 * @cycles: Cycles
71 *
72 * XXX - This could use some mult_lxl_ll() asm optimization. Same code
73 * as in cyc2ns, but with unsigned result.
74 */
75static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
76 cycle_t cycles)
77{
78 u64 ret = (u64)cycles;
79 ret = (ret * cc->mult) >> cc->shift;
80 return ret;
81}
82
83/**
84 * timecounter_init - initialize a time counter
85 * @tc: Pointer to time counter which is to be initialized/reset
86 * @cc: A cycle counter, ready to be used.
87 * @start_tstamp: Arbitrary initial time stamp.
88 *
89 * After this call the current cycle register (roughly) corresponds to
90 * the initial time stamp. Every call to timecounter_read() increments
91 * the time stamp counter by the number of elapsed nanoseconds.
92 */
93extern void timecounter_init(struct timecounter *tc,
94 const struct cyclecounter *cc,
95 u64 start_tstamp);
96
97/**
98 * timecounter_read - return nanoseconds elapsed since timecounter_init()
99 * plus the initial time stamp
100 * @tc: Pointer to time counter.
101 *
102 * In other words, keeps track of time since the same epoch as
103 * the function which generated the initial time stamp.
104 */
105extern u64 timecounter_read(struct timecounter *tc);
106
107/**
108 * timecounter_cyc2time - convert a cycle counter to same
109 * time base as values returned by
110 * timecounter_read()
111 * @tc: Pointer to time counter.
112 * @cycle: a value returned by tc->cc->read()
113 *
114 * Cycle counts that are converted correctly as long as they
115 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
116 * with "max cycle count" == cs->mask+1.
117 *
118 * This allows conversion of cycle counter values which were generated
119 * in the past.
120 */
121extern u64 timecounter_cyc2time(struct timecounter *tc,
122 cycle_t cycle_tstamp);
123
124/**
25 * struct clocksource - hardware abstraction for a free running counter 125 * struct clocksource - hardware abstraction for a free running counter
26 * Provides mostly state-free accessors to the underlying hardware. 126 * Provides mostly state-free accessors to the underlying hardware.
127 * This is the structure used for system time.
27 * 128 *
28 * @name: ptr to clocksource name 129 * @name: ptr to clocksource name
29 * @list: list head for registration 130 * @list: list head for registration
diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h
index 605ebe24bb2e..72bfefdbd767 100644
--- a/include/linux/cm4000_cs.h
+++ b/include/linux/cm4000_cs.h
@@ -1,6 +1,8 @@
1#ifndef _CM4000_H_ 1#ifndef _CM4000_H_
2#define _CM4000_H_ 2#define _CM4000_H_
3 3
4#include <linux/types.h>
5
4#define MAX_ATR 33 6#define MAX_ATR 33
5 7
6#define CM4000_MAX_DEV 4 8#define CM4000_MAX_DEV 4
@@ -10,9 +12,9 @@
10 * not to break compilation of userspace apps. -HW */ 12 * not to break compilation of userspace apps. -HW */
11 13
12typedef struct atreq { 14typedef struct atreq {
13 int32_t atr_len; 15 __s32 atr_len;
14 unsigned char atr[64]; 16 unsigned char atr[64];
15 int32_t power_act; 17 __s32 power_act;
16 unsigned char bIFSD; 18 unsigned char bIFSD;
17 unsigned char bIFSC; 19 unsigned char bIFSC;
18} atreq_t; 20} atreq_t;
@@ -22,13 +24,13 @@ typedef struct atreq {
22 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace 24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
23 * will lay out the structure members differently than the 64bit kernel. 25 * will lay out the structure members differently than the 64bit kernel.
24 * 26 *
25 * I've changed "ptsreq.protocol" from "unsigned long" to "u_int32_t". 27 * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
26 * On 32bit this will make no difference. With 64bit kernels, it will make 28 * On 32bit this will make no difference. With 64bit kernels, it will make
27 * 32bit apps work, too. 29 * 32bit apps work, too.
28 */ 30 */
29 31
30typedef struct ptsreq { 32typedef struct ptsreq {
31 u_int32_t protocol; /*T=0: 2^0, T=1: 2^1*/ 33 __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
32 unsigned char flags; 34 unsigned char flags;
33 unsigned char pts1; 35 unsigned char pts1;
34 unsigned char pts2; 36 unsigned char pts2;
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index 1c86d65bc4b9..b8125b2eb665 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -65,20 +65,20 @@ struct proc_event {
65 } ack; 65 } ack;
66 66
67 struct fork_proc_event { 67 struct fork_proc_event {
68 pid_t parent_pid; 68 __kernel_pid_t parent_pid;
69 pid_t parent_tgid; 69 __kernel_pid_t parent_tgid;
70 pid_t child_pid; 70 __kernel_pid_t child_pid;
71 pid_t child_tgid; 71 __kernel_pid_t child_tgid;
72 } fork; 72 } fork;
73 73
74 struct exec_proc_event { 74 struct exec_proc_event {
75 pid_t process_pid; 75 __kernel_pid_t process_pid;
76 pid_t process_tgid; 76 __kernel_pid_t process_tgid;
77 } exec; 77 } exec;
78 78
79 struct id_proc_event { 79 struct id_proc_event {
80 pid_t process_pid; 80 __kernel_pid_t process_pid;
81 pid_t process_tgid; 81 __kernel_pid_t process_tgid;
82 union { 82 union {
83 __u32 ruid; /* task uid */ 83 __u32 ruid; /* task uid */
84 __u32 rgid; /* task gid */ 84 __u32 rgid; /* task gid */
@@ -90,8 +90,8 @@ struct proc_event {
90 } id; 90 } id;
91 91
92 struct exit_proc_event { 92 struct exit_proc_event {
93 pid_t process_pid; 93 __kernel_pid_t process_pid;
94 pid_t process_tgid; 94 __kernel_pid_t process_tgid;
95 __u32 exit_code, exit_signal; 95 __u32 exit_code, exit_signal;
96 } exit; 96 } exit;
97 } event_data; 97 } event_data;
diff --git a/include/linux/com20020.h b/include/linux/com20020.h
index ac6d9a43e085..5dcfb944b6ce 100644
--- a/include/linux/com20020.h
+++ b/include/linux/com20020.h
@@ -29,6 +29,7 @@
29 29
30int com20020_check(struct net_device *dev); 30int com20020_check(struct net_device *dev);
31int com20020_found(struct net_device *dev, int shared); 31int com20020_found(struct net_device *dev, int shared);
32extern const struct net_device_ops com20020_netdev_ops;
32 33
33/* The number of low I/O ports used by the card. */ 34/* The number of low I/O ports used by the card. */
34#define ARCNET_TOTAL_SIZE 8 35#define ARCNET_TOTAL_SIZE 8
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3fd2194ff573..f2ded21f9a3c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -125,6 +125,13 @@ struct compat_dirent {
125 char d_name[256]; 125 char d_name[256];
126}; 126};
127 127
128struct compat_ustat {
129 compat_daddr_t f_tfree;
130 compat_ino_t f_tinode;
131 char f_fname[6];
132 char f_fpack[6];
133};
134
128typedef union compat_sigval { 135typedef union compat_sigval {
129 compat_int_t sival_int; 136 compat_int_t sival_int;
130 compat_uptr_t sival_ptr; 137 compat_uptr_t sival_ptr;
@@ -178,11 +185,18 @@ long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
178 unsigned nsems, const struct compat_timespec __user *timeout); 185 unsigned nsems, const struct compat_timespec __user *timeout);
179asmlinkage long compat_sys_keyctl(u32 option, 186asmlinkage long compat_sys_keyctl(u32 option,
180 u32 arg2, u32 arg3, u32 arg4, u32 arg5); 187 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
188asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
181 189
182asmlinkage ssize_t compat_sys_readv(unsigned long fd, 190asmlinkage ssize_t compat_sys_readv(unsigned long fd,
183 const struct compat_iovec __user *vec, unsigned long vlen); 191 const struct compat_iovec __user *vec, unsigned long vlen);
184asmlinkage ssize_t compat_sys_writev(unsigned long fd, 192asmlinkage ssize_t compat_sys_writev(unsigned long fd,
185 const struct compat_iovec __user *vec, unsigned long vlen); 193 const struct compat_iovec __user *vec, unsigned long vlen);
194asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
195 const struct compat_iovec __user *vec,
196 unsigned long vlen, u32 pos_low, u32 pos_high);
197asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
198 const struct compat_iovec __user *vec,
199 unsigned long vlen, u32 pos_low, u32 pos_high);
186 200
187int compat_do_execve(char * filename, compat_uptr_t __user *argv, 201int compat_do_execve(char * filename, compat_uptr_t __user *argv,
188 compat_uptr_t __user *envp, struct pt_regs * regs); 202 compat_uptr_t __user *envp, struct pt_regs * regs);
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 09992718f9e8..450fa597c94d 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,8 +3,10 @@
3#endif 3#endif
4 4
5/* GCC 4.1.[01] miscompiles __weak */ 5/* GCC 4.1.[01] miscompiles __weak */
6#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 6#ifdef __KERNEL__
7# error Your version of gcc miscompiles the __weak directive 7# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
8# error Your version of gcc miscompiles the __weak directive
9# endif
8#endif 10#endif
9 11
10#define __used __attribute__((__used__)) 12#define __used __attribute__((__used__))
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 34f2789d9b9b..b9966e64604e 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -39,8 +39,10 @@
39#define CN_IDX_V86D 0x4 39#define CN_IDX_V86D 0x4
40#define CN_VAL_V86D_UVESAFB 0x1 40#define CN_VAL_V86D_UVESAFB 0x1
41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ 41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
42#define CN_DST_IDX 0x6
43#define CN_DST_VAL 0x1
42 44
43#define CN_NETLINK_USERS 6 45#define CN_NETLINK_USERS 7
44 46
45/* 47/*
46 * Maximum connector's message size. 48 * Maximum connector's message size.
@@ -109,6 +111,12 @@ struct cn_queue_dev {
109 unsigned char name[CN_CBQ_NAMELEN]; 111 unsigned char name[CN_CBQ_NAMELEN];
110 112
111 struct workqueue_struct *cn_queue; 113 struct workqueue_struct *cn_queue;
114 /* Sent to kevent to create cn_queue only when needed */
115 struct work_struct wq_creation;
116 /* Tell if the wq_creation job is pending/completed */
117 atomic_t wq_requested;
118 /* Wait for cn_queue to be created */
119 wait_queue_head_t wq_created;
112 120
113 struct list_head queue_list; 121 struct list_head queue_list;
114 spinlock_t queue_lock; 122 spinlock_t queue_lock;
@@ -164,6 +172,8 @@ int cn_netlink_send(struct cn_msg *, u32, gfp_t);
164int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 172int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
165void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 173void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
166 174
175int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
176
167struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); 177struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
168void cn_queue_free_dev(struct cn_queue_dev *dev); 178void cn_queue_free_dev(struct cn_queue_dev *dev);
169 179
diff --git a/include/linux/console.h b/include/linux/console.h
index a67a90cf8268..dcca5339ceb3 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -137,8 +137,8 @@ extern void resume_console(void);
137int mda_console_init(void); 137int mda_console_init(void);
138void prom_con_init(void); 138void prom_con_init(void);
139 139
140void vcs_make_sysfs(struct tty_struct *tty); 140void vcs_make_sysfs(int index);
141void vcs_remove_sysfs(struct tty_struct *tty); 141void vcs_remove_sysfs(int index);
142 142
143/* Some debug stub to catch some of the obvious races in the VT code */ 143/* Some debug stub to catch some of the obvious races in the VT code */
144#if 1 144#if 1
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c2747ac2ae43..2643d848df90 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -23,7 +23,6 @@
23#include <linux/node.h> 23#include <linux/node.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/cpumask.h> 25#include <linux/cpumask.h>
26#include <linux/mutex.h>
27 26
28struct cpu { 27struct cpu {
29 int node_id; /* The node which contains the CPU */ 28 int node_id; /* The node which contains the CPU */
@@ -103,16 +102,6 @@ extern struct sysdev_class cpu_sysdev_class;
103#ifdef CONFIG_HOTPLUG_CPU 102#ifdef CONFIG_HOTPLUG_CPU
104/* Stop CPUs going up and down. */ 103/* Stop CPUs going up and down. */
105 104
106static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
107{
108 mutex_lock(cpu_hp_mutex);
109}
110
111static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
112{
113 mutex_unlock(cpu_hp_mutex);
114}
115
116extern void get_online_cpus(void); 105extern void get_online_cpus(void);
117extern void put_online_cpus(void); 106extern void put_online_cpus(void);
118#define hotcpu_notifier(fn, pri) { \ 107#define hotcpu_notifier(fn, pri) { \
@@ -126,11 +115,6 @@ int cpu_down(unsigned int cpu);
126 115
127#else /* CONFIG_HOTPLUG_CPU */ 116#else /* CONFIG_HOTPLUG_CPU */
128 117
129static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
130{ }
131static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
132{ }
133
134#define get_online_cpus() do { } while (0) 118#define get_online_cpus() do { } while (0)
135#define put_online_cpus() do { } while (0) 119#define put_online_cpus() do { } while (0)
136#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 120#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 90c6074a36ca..05ea1dd7d681 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/cgroup.h> 14#include <linux/cgroup.h>
15#include <linux/mm.h>
15 16
16#ifdef CONFIG_CPUSETS 17#ifdef CONFIG_CPUSETS
17 18
@@ -29,19 +30,29 @@ void cpuset_init_current_mems_allowed(void);
29void cpuset_update_task_memory_state(void); 30void cpuset_update_task_memory_state(void);
30int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 31int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
31 32
32extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); 33extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
33extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); 34extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
34 35
35static int inline cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask) 36static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
36{ 37{
37 return number_of_cpusets <= 1 || 38 return number_of_cpusets <= 1 ||
38 __cpuset_zone_allowed_softwall(z, gfp_mask); 39 __cpuset_node_allowed_softwall(node, gfp_mask);
39} 40}
40 41
41static int inline cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask) 42static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
42{ 43{
43 return number_of_cpusets <= 1 || 44 return number_of_cpusets <= 1 ||
44 __cpuset_zone_allowed_hardwall(z, gfp_mask); 45 __cpuset_node_allowed_hardwall(node, gfp_mask);
46}
47
48static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
49{
50 return cpuset_node_allowed_softwall(zone_to_nid(z), gfp_mask);
51}
52
53static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
54{
55 return cpuset_node_allowed_hardwall(zone_to_nid(z), gfp_mask);
45} 56}
46 57
47extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, 58extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
@@ -90,12 +101,12 @@ static inline void cpuset_init_smp(void) {}
90static inline void cpuset_cpus_allowed(struct task_struct *p, 101static inline void cpuset_cpus_allowed(struct task_struct *p,
91 struct cpumask *mask) 102 struct cpumask *mask)
92{ 103{
93 *mask = cpu_possible_map; 104 cpumask_copy(mask, cpu_possible_mask);
94} 105}
95static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 106static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
96 struct cpumask *mask) 107 struct cpumask *mask)
97{ 108{
98 *mask = cpu_possible_map; 109 cpumask_copy(mask, cpu_possible_mask);
99} 110}
100 111
101static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 112static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -112,6 +123,16 @@ static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
112 return 1; 123 return 1;
113} 124}
114 125
126static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
127{
128 return 1;
129}
130
131static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
132{
133 return 1;
134}
135
115static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask) 136static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
116{ 137{
117 return 1; 138 return 1;
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 1f2e9020acc6..ec29fa268b94 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -40,6 +40,7 @@
40#define CRYPTO_ALG_TYPE_SHASH 0x00000009 40#define CRYPTO_ALG_TYPE_SHASH 0x00000009
41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
42#define CRYPTO_ALG_TYPE_RNG 0x0000000c 42#define CRYPTO_ALG_TYPE_RNG 0x0000000c
43#define CRYPTO_ALG_TYPE_PCOMPRESS 0x0000000f
43 44
44#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 45#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
45#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c 46#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
@@ -548,9 +549,6 @@ struct crypto_attr_u32 {
548 * Transform user interface. 549 * Transform user interface.
549 */ 550 */
550 551
551struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
552 const struct crypto_type *frontend,
553 u32 type, u32 mask);
554struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 552struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
555void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm); 553void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm);
556 554
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index d06fbf286346..788850ba4e75 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -82,9 +82,9 @@ struct cyclades_monitor {
82 * open) 82 * open)
83 */ 83 */
84struct cyclades_idle_stats { 84struct cyclades_idle_stats {
85 time_t in_use; /* Time device has been in use (secs) */ 85 __kernel_time_t in_use; /* Time device has been in use (secs) */
86 time_t recv_idle; /* Time since last char received (secs) */ 86 __kernel_time_t recv_idle; /* Time since last char received (secs) */
87 time_t xmit_idle; /* Time since last char transmitted (secs) */ 87 __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */
88 unsigned long recv_bytes; /* Bytes received */ 88 unsigned long recv_bytes; /* Bytes received */
89 unsigned long xmit_bytes; /* Bytes transmitted */ 89 unsigned long xmit_bytes; /* Bytes transmitted */
90 unsigned long overruns; /* Input overruns */ 90 unsigned long overruns; /* Input overruns */
diff --git a/include/linux/dca.h b/include/linux/dca.h
index b00a753eda53..9c20c7e87d0a 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -1,3 +1,23 @@
1/*
2 * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
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 Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
1#ifndef DCA_H 21#ifndef DCA_H
2#define DCA_H 22#define DCA_H
3/* DCA Provider API */ 23/* DCA Provider API */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c66d22487bf8..15156364d196 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -112,7 +112,7 @@ struct dentry {
112 struct list_head d_subdirs; /* our children */ 112 struct list_head d_subdirs; /* our children */
113 struct list_head d_alias; /* inode alias list */ 113 struct list_head d_alias; /* inode alias list */
114 unsigned long d_time; /* used by d_revalidate */ 114 unsigned long d_time; /* used by d_revalidate */
115 struct dentry_operations *d_op; 115 const struct dentry_operations *d_op;
116 struct super_block *d_sb; /* The root of the dentry tree */ 116 struct super_block *d_sb; /* The root of the dentry tree */
117 void *d_fsdata; /* fs-specific data */ 117 void *d_fsdata; /* fs-specific data */
118 118
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 61734e27abb7..7434a8353e23 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -355,46 +355,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
355 return __dccp_hdr_len(dccp_hdr(skb)); 355 return __dccp_hdr_len(dccp_hdr(skb));
356} 356}
357 357
358
359/* initial values for each feature */
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363/* FIXME: for now we're default to 1 but it should really be 0 */
364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
365
366/**
367 * struct dccp_minisock - Minimal DCCP connection representation
368 *
369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
370 *
371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
372 * @dccpms_pending - List of features being negotiated
373 * @dccpms_conf -
374 */
375struct dccp_minisock {
376 __u64 dccpms_sequence_window;
377 struct list_head dccpms_pending;
378 struct list_head dccpms_conf;
379};
380
381struct dccp_opt_conf {
382 __u8 *dccpoc_val;
383 __u8 dccpoc_len;
384};
385
386struct dccp_opt_pend {
387 struct list_head dccpop_node;
388 __u8 dccpop_type;
389 __u8 dccpop_feat;
390 __u8 *dccpop_val;
391 __u8 dccpop_len;
392 int dccpop_conf;
393 struct dccp_opt_conf *dccpop_sc;
394};
395
396extern void dccp_minisock_init(struct dccp_minisock *dmsk);
397
398/** 358/**
399 * struct dccp_request_sock - represent DCCP-specific connection request 359 * struct dccp_request_sock - represent DCCP-specific connection request
400 * @dreq_inet_rsk: structure inherited from 360 * @dreq_inet_rsk: structure inherited from
@@ -483,13 +443,14 @@ struct dccp_ackvec;
483 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo 443 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
484 * @dccps_l_ack_ratio - feature-local Ack Ratio 444 * @dccps_l_ack_ratio - feature-local Ack Ratio
485 * @dccps_r_ack_ratio - feature-remote Ack Ratio 445 * @dccps_r_ack_ratio - feature-remote Ack Ratio
446 * @dccps_l_seq_win - local Sequence Window (influences ack number validity)
447 * @dccps_r_seq_win - remote Sequence Window (influences seq number validity)
486 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 448 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 449 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2) 450 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
489 * @dccps_ndp_count - number of Non Data Packets since last data packet 451 * @dccps_ndp_count - number of Non Data Packets since last data packet
490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 452 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 453 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake) 454 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
494 * @dccps_hc_rx_ackvec - rx half connection ack vector 455 * @dccps_hc_rx_ackvec - rx half connection ack vector
495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 456 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
@@ -523,12 +484,13 @@ struct dccp_sock {
523 __u32 dccps_timestamp_time; 484 __u32 dccps_timestamp_time;
524 __u16 dccps_l_ack_ratio; 485 __u16 dccps_l_ack_ratio;
525 __u16 dccps_r_ack_ratio; 486 __u16 dccps_r_ack_ratio;
487 __u64 dccps_l_seq_win:48;
488 __u64 dccps_r_seq_win:48;
526 __u8 dccps_pcslen:4; 489 __u8 dccps_pcslen:4;
527 __u8 dccps_pcrlen:4; 490 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1; 491 __u8 dccps_send_ndp_count:1;
529 __u64 dccps_ndp_count:48; 492 __u64 dccps_ndp_count:48;
530 unsigned long dccps_rate_last; 493 unsigned long dccps_rate_last;
531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg; 494 struct list_head dccps_featneg;
533 struct dccp_ackvec *dccps_hc_rx_ackvec; 495 struct dccp_ackvec *dccps_hc_rx_ackvec;
534 struct ccid *dccps_hc_rx_ccid; 496 struct ccid *dccps_hc_rx_ccid;
@@ -546,11 +508,6 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
546 return (struct dccp_sock *)sk; 508 return (struct dccp_sock *)sk;
547} 509}
548 510
549static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
550{
551 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
552}
553
554static inline const char *dccp_role(const struct sock *sk) 511static inline const char *dccp_role(const struct sock *sk)
555{ 512{
556 switch (dccp_sk(sk)->dccps_role) { 513 switch (dccp_sk(sk)->dccps_role) {
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 8209e08969f9..66ec05a57955 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -139,6 +139,9 @@ struct target_type {
139 dm_ioctl_fn ioctl; 139 dm_ioctl_fn ioctl;
140 dm_merge_fn merge; 140 dm_merge_fn merge;
141 dm_busy_fn busy; 141 dm_busy_fn busy;
142
143 /* For internal device-mapper use. */
144 struct list_head list;
142}; 145};
143 146
144struct io_restrictions { 147struct io_restrictions {
diff --git a/include/linux/device.h b/include/linux/device.h
index 47f343c7bdda..2918c0e8fdfd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -28,6 +28,7 @@
28#define BUS_ID_SIZE 20 28#define BUS_ID_SIZE 20
29 29
30struct device; 30struct device;
31struct device_private;
31struct device_driver; 32struct device_driver;
32struct driver_private; 33struct driver_private;
33struct class; 34struct class;
@@ -147,7 +148,7 @@ extern void put_driver(struct device_driver *drv);
147extern struct device_driver *driver_find(const char *name, 148extern struct device_driver *driver_find(const char *name,
148 struct bus_type *bus); 149 struct bus_type *bus);
149extern int driver_probe_done(void); 150extern int driver_probe_done(void);
150extern int wait_for_device_probe(void); 151extern void wait_for_device_probe(void);
151 152
152 153
153/* sysfs interface for exporting driver attributes */ 154/* sysfs interface for exporting driver attributes */
@@ -367,15 +368,11 @@ struct device_dma_parameters {
367}; 368};
368 369
369struct device { 370struct device {
370 struct klist klist_children;
371 struct klist_node knode_parent; /* node in sibling list */
372 struct klist_node knode_driver;
373 struct klist_node knode_bus;
374 struct device *parent; 371 struct device *parent;
375 372
373 struct device_private *p;
374
376 struct kobject kobj; 375 struct kobject kobj;
377 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
378 unsigned uevent_suppress:1;
379 const char *init_name; /* initial name of the device */ 376 const char *init_name; /* initial name of the device */
380 struct device_type *type; 377 struct device_type *type;
381 378
@@ -387,8 +384,13 @@ struct device {
387 struct device_driver *driver; /* which driver has allocated this 384 struct device_driver *driver; /* which driver has allocated this
388 device */ 385 device */
389 void *driver_data; /* data private to the driver */ 386 void *driver_data; /* data private to the driver */
390 void *platform_data; /* Platform specific data, device 387
391 core doesn't touch it */ 388 void *platform_data; /* We will remove platform_data
389 field if all platform devices
390 pass its platform specific data
391 from platform_device->platform_data,
392 other kind of devices should not
393 use platform_data. */
392 struct dev_pm_info power; 394 struct dev_pm_info power;
393 395
394#ifdef CONFIG_NUMA 396#ifdef CONFIG_NUMA
@@ -427,8 +429,7 @@ struct device {
427 429
428static inline const char *dev_name(const struct device *dev) 430static inline const char *dev_name(const struct device *dev)
429{ 431{
430 /* will be changed into kobject_name(&dev->kobj) in the near future */ 432 return kobject_name(&dev->kobj);
431 return dev->bus_id;
432} 433}
433 434
434extern int dev_set_name(struct device *dev, const char *name, ...) 435extern int dev_set_name(struct device *dev, const char *name, ...)
@@ -463,6 +464,16 @@ static inline void dev_set_drvdata(struct device *dev, void *data)
463 dev->driver_data = data; 464 dev->driver_data = data;
464} 465}
465 466
467static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
468{
469 return dev->kobj.uevent_suppress;
470}
471
472static inline void dev_set_uevent_suppress(struct device *dev, int val)
473{
474 dev->kobj.uevent_suppress = val;
475}
476
466static inline int device_is_registered(struct device *dev) 477static inline int device_is_registered(struct device *dev)
467{ 478{
468 return dev->kobj.state_in_sysfs; 479 return dev->kobj.state_in_sysfs;
@@ -483,7 +494,8 @@ extern int device_for_each_child(struct device *dev, void *data,
483extern struct device *device_find_child(struct device *dev, void *data, 494extern struct device *device_find_child(struct device *dev, void *data,
484 int (*match)(struct device *dev, void *data)); 495 int (*match)(struct device *dev, void *data));
485extern int device_rename(struct device *dev, char *new_name); 496extern int device_rename(struct device *dev, char *new_name);
486extern int device_move(struct device *dev, struct device *new_parent); 497extern int device_move(struct device *dev, struct device *new_parent,
498 enum dpm_order dpm_order);
487 499
488/* 500/*
489 * Root device objects for grouping under /sys/devices 501 * Root device objects for grouping under /sys/devices
@@ -570,7 +582,7 @@ extern const char *dev_driver_string(const struct device *dev);
570#if defined(DEBUG) 582#if defined(DEBUG)
571#define dev_dbg(dev, format, arg...) \ 583#define dev_dbg(dev, format, arg...) \
572 dev_printk(KERN_DEBUG , dev , format , ## arg) 584 dev_printk(KERN_DEBUG , dev , format , ## arg)
573#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 585#elif defined(CONFIG_DYNAMIC_DEBUG)
574#define dev_dbg(dev, format, ...) do { \ 586#define dev_dbg(dev, format, ...) do { \
575 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 587 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
576 } while (0) 588 } while (0)
diff --git a/include/linux/dlm_netlink.h b/include/linux/dlm_netlink.h
index 19276332707a..647c8ef27227 100644
--- a/include/linux/dlm_netlink.h
+++ b/include/linux/dlm_netlink.h
@@ -9,6 +9,8 @@
9#ifndef _DLM_NETLINK_H 9#ifndef _DLM_NETLINK_H
10#define _DLM_NETLINK_H 10#define _DLM_NETLINK_H
11 11
12#include <linux/types.h>
13
12enum { 14enum {
13 DLM_STATUS_WAITING = 1, 15 DLM_STATUS_WAITING = 1,
14 DLM_STATUS_GRANTED = 2, 16 DLM_STATUS_GRANTED = 2,
@@ -18,16 +20,16 @@ enum {
18#define DLM_LOCK_DATA_VERSION 1 20#define DLM_LOCK_DATA_VERSION 1
19 21
20struct dlm_lock_data { 22struct dlm_lock_data {
21 uint16_t version; 23 __u16 version;
22 uint32_t lockspace_id; 24 __u32 lockspace_id;
23 int nodeid; 25 int nodeid;
24 int ownpid; 26 int ownpid;
25 uint32_t id; 27 __u32 id;
26 uint32_t remid; 28 __u32 remid;
27 uint64_t xid; 29 __u64 xid;
28 int8_t status; 30 __s8 status;
29 int8_t grmode; 31 __s8 grmode;
30 int8_t rqmode; 32 __s8 rqmode;
31 unsigned long timestamp; 33 unsigned long timestamp;
32 int resource_namelen; 34 int resource_namelen;
33 char resource_name[DLM_RESNAME_MAXLEN]; 35 char resource_name[DLM_RESNAME_MAXLEN];
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
index 600c5fb2daad..5e8b11d88f6f 100644
--- a/include/linux/dm-dirty-log.h
+++ b/include/linux/dm-dirty-log.h
@@ -28,6 +28,9 @@ struct dm_dirty_log_type {
28 const char *name; 28 const char *name;
29 struct module *module; 29 struct module *module;
30 30
31 /* For internal device-mapper use */
32 struct list_head list;
33
31 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, 34 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
32 unsigned argc, char **argv); 35 unsigned argc, char **argv);
33 void (*dtr)(struct dm_dirty_log *log); 36 void (*dtr)(struct dm_dirty_log *log);
@@ -113,6 +116,16 @@ struct dm_dirty_log_type {
113 */ 116 */
114 int (*status)(struct dm_dirty_log *log, status_type_t status_type, 117 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
115 char *result, unsigned maxlen); 118 char *result, unsigned maxlen);
119
120 /*
121 * is_remote_recovering is necessary for cluster mirroring. It provides
122 * a way to detect recovery on another node, so we aren't writing
123 * concurrently. This function is likely to block (when a cluster log
124 * is used).
125 *
126 * Returns: 0, 1
127 */
128 int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region);
116}; 129};
117 130
118int dm_dirty_log_type_register(struct dm_dirty_log_type *type); 131int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 28c2940eb30d..48e44ee2b466 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -113,20 +113,20 @@ struct dm_ioctl {
113 * return -ENOTTY) fill out this field, even if the 113 * return -ENOTTY) fill out this field, even if the
114 * command failed. 114 * command failed.
115 */ 115 */
116 uint32_t version[3]; /* in/out */ 116 __u32 version[3]; /* in/out */
117 uint32_t data_size; /* total size of data passed in 117 __u32 data_size; /* total size of data passed in
118 * including this struct */ 118 * including this struct */
119 119
120 uint32_t data_start; /* offset to start of data 120 __u32 data_start; /* offset to start of data
121 * relative to start of this struct */ 121 * relative to start of this struct */
122 122
123 uint32_t target_count; /* in/out */ 123 __u32 target_count; /* in/out */
124 int32_t open_count; /* out */ 124 __s32 open_count; /* out */
125 uint32_t flags; /* in/out */ 125 __u32 flags; /* in/out */
126 uint32_t event_nr; /* in/out */ 126 __u32 event_nr; /* in/out */
127 uint32_t padding; 127 __u32 padding;
128 128
129 uint64_t dev; /* in/out */ 129 __u64 dev; /* in/out */
130 130
131 char name[DM_NAME_LEN]; /* device name */ 131 char name[DM_NAME_LEN]; /* device name */
132 char uuid[DM_UUID_LEN]; /* unique identifier for 132 char uuid[DM_UUID_LEN]; /* unique identifier for
@@ -139,9 +139,9 @@ struct dm_ioctl {
139 * dm_ioctl. 139 * dm_ioctl.
140 */ 140 */
141struct dm_target_spec { 141struct dm_target_spec {
142 uint64_t sector_start; 142 __u64 sector_start;
143 uint64_t length; 143 __u64 length;
144 int32_t status; /* used when reading from kernel only */ 144 __s32 status; /* used when reading from kernel only */
145 145
146 /* 146 /*
147 * Location of the next dm_target_spec. 147 * Location of the next dm_target_spec.
@@ -153,7 +153,7 @@ struct dm_target_spec {
153 * (that follows the dm_ioctl struct) to the start of the "next" 153 * (that follows the dm_ioctl struct) to the start of the "next"
154 * dm_target_spec. 154 * dm_target_spec.
155 */ 155 */
156 uint32_t next; 156 __u32 next;
157 157
158 char target_type[DM_MAX_TYPE_NAME]; 158 char target_type[DM_MAX_TYPE_NAME];
159 159
@@ -168,17 +168,17 @@ struct dm_target_spec {
168 * Used to retrieve the target dependencies. 168 * Used to retrieve the target dependencies.
169 */ 169 */
170struct dm_target_deps { 170struct dm_target_deps {
171 uint32_t count; /* Array size */ 171 __u32 count; /* Array size */
172 uint32_t padding; /* unused */ 172 __u32 padding; /* unused */
173 uint64_t dev[0]; /* out */ 173 __u64 dev[0]; /* out */
174}; 174};
175 175
176/* 176/*
177 * Used to get a list of all dm devices. 177 * Used to get a list of all dm devices.
178 */ 178 */
179struct dm_name_list { 179struct dm_name_list {
180 uint64_t dev; 180 __u64 dev;
181 uint32_t next; /* offset to the next record from 181 __u32 next; /* offset to the next record from
182 the _start_ of this */ 182 the _start_ of this */
183 char name[0]; 183 char name[0];
184}; 184};
@@ -187,8 +187,8 @@ struct dm_name_list {
187 * Used to retrieve the target versions 187 * Used to retrieve the target versions
188 */ 188 */
189struct dm_target_versions { 189struct dm_target_versions {
190 uint32_t next; 190 __u32 next;
191 uint32_t version[3]; 191 __u32 version[3];
192 192
193 char name[0]; 193 char name[0];
194}; 194};
@@ -197,7 +197,7 @@ struct dm_target_versions {
197 * Used to pass message to a target 197 * Used to pass message to a target
198 */ 198 */
199struct dm_target_msg { 199struct dm_target_msg {
200 uint64_t sector; /* Device sector */ 200 __u64 sector; /* Device sector */
201 201
202 char message[0]; 202 char message[0];
203}; 203};
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
new file mode 100644
index 000000000000..28d53cb7b5a2
--- /dev/null
+++ b/include/linux/dma-debug.h
@@ -0,0 +1,174 @@
1/*
2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
3 *
4 * Author: Joerg Roedel <joerg.roedel@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __DMA_DEBUG_H
21#define __DMA_DEBUG_H
22
23#include <linux/types.h>
24
25struct device;
26struct scatterlist;
27struct bus_type;
28
29#ifdef CONFIG_DMA_API_DEBUG
30
31extern void dma_debug_add_bus(struct bus_type *bus);
32
33extern void dma_debug_init(u32 num_entries);
34
35extern void debug_dma_map_page(struct device *dev, struct page *page,
36 size_t offset, size_t size,
37 int direction, dma_addr_t dma_addr,
38 bool map_single);
39
40extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
41 size_t size, int direction, bool map_single);
42
43extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
44 int nents, int mapped_ents, int direction);
45
46extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
47 int nelems, int dir);
48
49extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
50 dma_addr_t dma_addr, void *virt);
51
52extern void debug_dma_free_coherent(struct device *dev, size_t size,
53 void *virt, dma_addr_t addr);
54
55extern void debug_dma_sync_single_for_cpu(struct device *dev,
56 dma_addr_t dma_handle, size_t size,
57 int direction);
58
59extern void debug_dma_sync_single_for_device(struct device *dev,
60 dma_addr_t dma_handle,
61 size_t size, int direction);
62
63extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
64 dma_addr_t dma_handle,
65 unsigned long offset,
66 size_t size,
67 int direction);
68
69extern void debug_dma_sync_single_range_for_device(struct device *dev,
70 dma_addr_t dma_handle,
71 unsigned long offset,
72 size_t size, int direction);
73
74extern void debug_dma_sync_sg_for_cpu(struct device *dev,
75 struct scatterlist *sg,
76 int nelems, int direction);
77
78extern void debug_dma_sync_sg_for_device(struct device *dev,
79 struct scatterlist *sg,
80 int nelems, int direction);
81
82extern void debug_dma_dump_mappings(struct device *dev);
83
84#else /* CONFIG_DMA_API_DEBUG */
85
86static inline void dma_debug_add_bus(struct bus_type *bus)
87{
88}
89
90static inline void dma_debug_init(u32 num_entries)
91{
92}
93
94static inline void debug_dma_map_page(struct device *dev, struct page *page,
95 size_t offset, size_t size,
96 int direction, dma_addr_t dma_addr,
97 bool map_single)
98{
99}
100
101static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
102 size_t size, int direction,
103 bool map_single)
104{
105}
106
107static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
108 int nents, int mapped_ents, int direction)
109{
110}
111
112static inline void debug_dma_unmap_sg(struct device *dev,
113 struct scatterlist *sglist,
114 int nelems, int dir)
115{
116}
117
118static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
119 dma_addr_t dma_addr, void *virt)
120{
121}
122
123static inline void debug_dma_free_coherent(struct device *dev, size_t size,
124 void *virt, dma_addr_t addr)
125{
126}
127
128static inline void debug_dma_sync_single_for_cpu(struct device *dev,
129 dma_addr_t dma_handle,
130 size_t size, int direction)
131{
132}
133
134static inline void debug_dma_sync_single_for_device(struct device *dev,
135 dma_addr_t dma_handle,
136 size_t size, int direction)
137{
138}
139
140static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
141 dma_addr_t dma_handle,
142 unsigned long offset,
143 size_t size,
144 int direction)
145{
146}
147
148static inline void debug_dma_sync_single_range_for_device(struct device *dev,
149 dma_addr_t dma_handle,
150 unsigned long offset,
151 size_t size,
152 int direction)
153{
154}
155
156static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
157 struct scatterlist *sg,
158 int nelems, int direction)
159{
160}
161
162static inline void debug_dma_sync_sg_for_device(struct device *dev,
163 struct scatterlist *sg,
164 int nelems, int direction)
165{
166}
167
168static inline void debug_dma_dump_mappings(struct device *dev)
169{
170}
171
172#endif /* CONFIG_DMA_API_DEBUG */
173
174#endif /* __DMA_DEBUG_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ba9114ec5d3a..8083b6a36a38 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/dma-attrs.h>
7#include <linux/scatterlist.h>
6 8
7/* These definitions mirror those in pci.h, so they can be used 9/* These definitions mirror those in pci.h, so they can be used
8 * interchangeably with their PCI_ counterparts */ 10 * interchangeably with their PCI_ counterparts */
@@ -13,6 +15,52 @@ enum dma_data_direction {
13 DMA_NONE = 3, 15 DMA_NONE = 3,
14}; 16};
15 17
18struct dma_map_ops {
19 void* (*alloc_coherent)(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, gfp_t gfp);
21 void (*free_coherent)(struct device *dev, size_t size,
22 void *vaddr, dma_addr_t dma_handle);
23 dma_addr_t (*map_page)(struct device *dev, struct page *page,
24 unsigned long offset, size_t size,
25 enum dma_data_direction dir,
26 struct dma_attrs *attrs);
27 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
28 size_t size, enum dma_data_direction dir,
29 struct dma_attrs *attrs);
30 int (*map_sg)(struct device *dev, struct scatterlist *sg,
31 int nents, enum dma_data_direction dir,
32 struct dma_attrs *attrs);
33 void (*unmap_sg)(struct device *dev,
34 struct scatterlist *sg, int nents,
35 enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37 void (*sync_single_for_cpu)(struct device *dev,
38 dma_addr_t dma_handle, size_t size,
39 enum dma_data_direction dir);
40 void (*sync_single_for_device)(struct device *dev,
41 dma_addr_t dma_handle, size_t size,
42 enum dma_data_direction dir);
43 void (*sync_single_range_for_cpu)(struct device *dev,
44 dma_addr_t dma_handle,
45 unsigned long offset,
46 size_t size,
47 enum dma_data_direction dir);
48 void (*sync_single_range_for_device)(struct device *dev,
49 dma_addr_t dma_handle,
50 unsigned long offset,
51 size_t size,
52 enum dma_data_direction dir);
53 void (*sync_sg_for_cpu)(struct device *dev,
54 struct scatterlist *sg, int nents,
55 enum dma_data_direction dir);
56 void (*sync_sg_for_device)(struct device *dev,
57 struct scatterlist *sg, int nents,
58 enum dma_data_direction dir);
59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
60 int (*dma_supported)(struct device *dev, u64 mask);
61 int is_phys;
62};
63
16#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 64#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
17 65
18/* 66/*
@@ -67,7 +115,7 @@ static inline u64 dma_get_mask(struct device *dev)
67{ 115{
68 if (dev && dev->dma_mask && *dev->dma_mask) 116 if (dev && dev->dma_mask && *dev->dma_mask)
69 return *dev->dma_mask; 117 return *dev->dma_mask;
70 return DMA_32BIT_MASK; 118 return DMA_BIT_MASK(32);
71} 119}
72 120
73extern u64 dma_get_required_mask(struct device *dev); 121extern u64 dma_get_required_mask(struct device *dev);
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index af1dab41674b..1a455f1f86d7 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -11,6 +11,7 @@
11 11
12#define DMA_PTE_READ (1) 12#define DMA_PTE_READ (1)
13#define DMA_PTE_WRITE (2) 13#define DMA_PTE_WRITE (2)
14#define DMA_PTE_SNP (1 << 11)
14 15
15struct intel_iommu; 16struct intel_iommu;
16struct dmar_domain; 17struct dmar_domain;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 1956c8d46d32..2e2aa3df170c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,9 +23,6 @@
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/kref.h>
27#include <linux/completion.h>
28#include <linux/rcupdate.h>
29#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
30 27
31/** 28/**
@@ -205,6 +202,7 @@ struct dma_async_tx_descriptor {
205/** 202/**
206 * struct dma_device - info on the entity supplying DMA services 203 * struct dma_device - info on the entity supplying DMA services
207 * @chancnt: how many DMA channels are supported 204 * @chancnt: how many DMA channels are supported
205 * @privatecnt: how many DMA channels are requested by dma_request_channel
208 * @channels: the list of struct dma_chan 206 * @channels: the list of struct dma_chan
209 * @global_node: list_head for global dma_device_list 207 * @global_node: list_head for global dma_device_list
210 * @cap_mask: one or more dma_capability flags 208 * @cap_mask: one or more dma_capability flags
@@ -227,6 +225,7 @@ struct dma_async_tx_descriptor {
227struct dma_device { 225struct dma_device {
228 226
229 unsigned int chancnt; 227 unsigned int chancnt;
228 unsigned int privatecnt;
230 struct list_head channels; 229 struct list_head channels;
231 struct list_head global_node; 230 struct list_head global_node;
232 dma_cap_mask_t cap_mask; 231 dma_cap_mask_t cap_mask;
@@ -291,6 +290,24 @@ static inline void net_dmaengine_put(void)
291} 290}
292#endif 291#endif
293 292
293#ifdef CONFIG_ASYNC_TX_DMA
294#define async_dmaengine_get() dmaengine_get()
295#define async_dmaengine_put() dmaengine_put()
296#define async_dma_find_channel(type) dma_find_channel(type)
297#else
298static inline void async_dmaengine_get(void)
299{
300}
301static inline void async_dmaengine_put(void)
302{
303}
304static inline struct dma_chan *
305async_dma_find_channel(enum dma_transaction_type type)
306{
307 return NULL;
308}
309#endif
310
294dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 311dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
295 void *dest, void *src, size_t len); 312 void *dest, void *src, size_t len);
296dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, 313dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
@@ -337,6 +354,13 @@ __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
337 set_bit(tx_type, dstp->bits); 354 set_bit(tx_type, dstp->bits);
338} 355}
339 356
357#define dma_cap_clear(tx, mask) __dma_cap_clear((tx), &(mask))
358static inline void
359__dma_cap_clear(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
360{
361 clear_bit(tx_type, dstp->bits);
362}
363
340#define dma_cap_zero(mask) __dma_cap_zero(&(mask)) 364#define dma_cap_zero(mask) __dma_cap_zero(&(mask))
341static inline void __dma_cap_zero(dma_cap_mask_t *dstp) 365static inline void __dma_cap_zero(dma_cap_mask_t *dstp)
342{ 366{
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f28440784cf0..e397dc342cda 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -24,16 +24,17 @@
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h>
27 28
28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
31struct dmar_drhd_unit { 31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */ 32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */ 33 struct acpi_dmar_header *hdr; /* ACPI header */
34 u64 reg_base_addr; /* register base address*/ 34 u64 reg_base_addr; /* register base address*/
35 struct pci_dev **devices; /* target device array */ 35 struct pci_dev **devices; /* target device array */
36 int devices_cnt; /* target device count */ 36 int devices_cnt; /* target device count */
37 u16 segment; /* PCI domain */
37 u8 ignored:1; /* ignore drhd */ 38 u8 ignored:1; /* ignore drhd */
38 u8 include_all:1; 39 u8 include_all:1;
39 struct intel_iommu *iommu; 40 struct intel_iommu *iommu;
@@ -44,12 +45,20 @@ extern struct list_head dmar_drhd_units;
44#define for_each_drhd_unit(drhd) \ 45#define for_each_drhd_unit(drhd) \
45 list_for_each_entry(drhd, &dmar_drhd_units, list) 46 list_for_each_entry(drhd, &dmar_drhd_units, list)
46 47
48#define for_each_active_iommu(i, drhd) \
49 list_for_each_entry(drhd, &dmar_drhd_units, list) \
50 if (i=drhd->iommu, drhd->ignored) {} else
51
52#define for_each_iommu(i, drhd) \
53 list_for_each_entry(drhd, &dmar_drhd_units, list) \
54 if (i=drhd->iommu, 0) {} else
55
47extern int dmar_table_init(void); 56extern int dmar_table_init(void);
48extern int dmar_dev_scope_init(void); 57extern int dmar_dev_scope_init(void);
49 58
50/* Intel IOMMU detection */ 59/* Intel IOMMU detection */
51extern void detect_intel_iommu(void); 60extern void detect_intel_iommu(void);
52 61extern int enable_drhd_fault_handling(void);
53 62
54extern int parse_ioapics_under_ir(void); 63extern int parse_ioapics_under_ir(void);
55extern int alloc_iommu(struct dmar_drhd_unit *); 64extern int alloc_iommu(struct dmar_drhd_unit *);
@@ -63,12 +72,12 @@ static inline int dmar_table_init(void)
63{ 72{
64 return -ENODEV; 73 return -ENODEV;
65} 74}
75static inline int enable_drhd_fault_handling(void)
76{
77 return -1;
78}
66#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ 79#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
67 80
68#ifdef CONFIG_INTR_REMAP
69extern int intr_remapping_enabled;
70extern int enable_intr_remapping(int);
71
72struct irte { 81struct irte {
73 union { 82 union {
74 struct { 83 struct {
@@ -97,6 +106,12 @@ struct irte {
97 __u64 high; 106 __u64 high;
98 }; 107 };
99}; 108};
109#ifdef CONFIG_INTR_REMAP
110extern int intr_remapping_enabled;
111extern int enable_intr_remapping(int);
112extern void disable_intr_remapping(void);
113extern int reenable_intr_remapping(int);
114
100extern int get_irte(int irq, struct irte *entry); 115extern int get_irte(int irq, struct irte *entry);
101extern int modify_irte(int irq, struct irte *irte_modified); 116extern int modify_irte(int irq, struct irte *irte_modified);
102extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); 117extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
@@ -111,14 +126,40 @@ extern int irq_remapped(int irq);
111extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 126extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
112extern struct intel_iommu *map_ioapic_to_ir(int apic); 127extern struct intel_iommu *map_ioapic_to_ir(int apic);
113#else 128#else
129static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
130{
131 return -1;
132}
133static inline int modify_irte(int irq, struct irte *irte_modified)
134{
135 return -1;
136}
137static inline int free_irte(int irq)
138{
139 return -1;
140}
141static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
142{
143 return -1;
144}
145static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
146 u16 sub_handle)
147{
148 return -1;
149}
150static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
151{
152 return NULL;
153}
154static inline struct intel_iommu *map_ioapic_to_ir(int apic)
155{
156 return NULL;
157}
114#define irq_remapped(irq) (0) 158#define irq_remapped(irq) (0)
115#define enable_intr_remapping(mode) (-1) 159#define enable_intr_remapping(mode) (-1)
116#define intr_remapping_enabled (0) 160#define intr_remapping_enabled (0)
117#endif 161#endif
118 162
119#ifdef CONFIG_DMAR
120extern const char *dmar_get_fault_reason(u8 fault_reason);
121
122/* Can't use the common MSI interrupt functions 163/* Can't use the common MSI interrupt functions
123 * since DMAR is not a pci device 164 * since DMAR is not a pci device
124 */ 165 */
@@ -127,8 +168,10 @@ extern void dmar_msi_mask(unsigned int irq);
127extern void dmar_msi_read(int irq, struct msi_msg *msg); 168extern void dmar_msi_read(int irq, struct msi_msg *msg);
128extern void dmar_msi_write(int irq, struct msi_msg *msg); 169extern void dmar_msi_write(int irq, struct msi_msg *msg);
129extern int dmar_set_interrupt(struct intel_iommu *iommu); 170extern int dmar_set_interrupt(struct intel_iommu *iommu);
171extern irqreturn_t dmar_fault(int irq, void *dev_id);
130extern int arch_setup_dmar_msi(unsigned int irq); 172extern int arch_setup_dmar_msi(unsigned int irq);
131 173
174#ifdef CONFIG_DMAR
132extern int iommu_detected, no_iommu; 175extern int iommu_detected, no_iommu;
133extern struct list_head dmar_rmrr_units; 176extern struct list_head dmar_rmrr_units;
134struct dmar_rmrr_unit { 177struct dmar_rmrr_unit {
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index d741b9ceb0e0..bb5489c82c99 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -47,7 +47,8 @@ extern int dmi_get_year(int field);
47extern int dmi_name_in_vendors(const char *str); 47extern int dmi_name_in_vendors(const char *str);
48extern int dmi_name_in_serial(const char *str); 48extern int dmi_name_in_serial(const char *str);
49extern int dmi_available; 49extern int dmi_available;
50extern int dmi_walk(void (*decode)(const struct dmi_header *)); 50extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
51 void *private_data);
51extern bool dmi_match(enum dmi_field f, const char *str); 52extern bool dmi_match(enum dmi_field f, const char *str);
52 53
53#else 54#else
@@ -61,8 +62,8 @@ static inline int dmi_get_year(int year) { return 0; }
61static inline int dmi_name_in_vendors(const char *s) { return 0; } 62static inline int dmi_name_in_vendors(const char *s) { return 0; }
62static inline int dmi_name_in_serial(const char *s) { return 0; } 63static inline int dmi_name_in_serial(const char *s) { return 0; }
63#define dmi_available 0 64#define dmi_available 0
64static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 65static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
65 { return -1; } 66 void *private_data) { return -1; }
66static inline bool dmi_match(enum dmi_field f, const char *str) 67static inline bool dmi_match(enum dmi_field f, const char *str)
67 { return false; } 68 { return false; }
68static inline const struct dmi_system_id * 69static inline const struct dmi_system_id *
diff --git a/include/linux/ds1wm.h b/include/linux/ds1wm.h
deleted file mode 100644
index d3c65e48a2e7..000000000000
--- a/include/linux/ds1wm.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* platform data for the DS1WM driver */
2
3struct ds1wm_platform_data {
4 int bus_shift; /* number of shifts needed to calculate the
5 * offset between DS1WM registers;
6 * e.g. on h5xxx and h2200 this is 2
7 * (registers aligned to 4-byte boundaries),
8 * while on hx4700 this is 1 */
9 int active_high;
10 void (*enable)(struct platform_device *pdev);
11 void (*disable)(struct platform_device *pdev);
12};
diff --git a/include/linux/dst.h b/include/linux/dst.h
new file mode 100644
index 000000000000..e26fed84b1aa
--- /dev/null
+++ b/include/linux/dst.h
@@ -0,0 +1,587 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
3 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DST_H
17#define __DST_H
18
19#include <linux/types.h>
20#include <linux/connector.h>
21
22#define DST_NAMELEN 32
23#define DST_NAME "dst"
24
25enum {
26 /* Remove node with given id from storage */
27 DST_DEL_NODE = 0,
28 /* Add remote node with given id to the storage */
29 DST_ADD_REMOTE,
30 /* Add local node with given id to the storage to be exported and used by remote peers */
31 DST_ADD_EXPORT,
32 /* Crypto initialization command (hash/cipher used to protect the connection) */
33 DST_CRYPTO,
34 /* Security attributes for given connection (permissions for example) */
35 DST_SECURITY,
36 /* Register given node in the block layer subsystem */
37 DST_START,
38 DST_CMD_MAX
39};
40
41struct dst_ctl
42{
43 /* Storage name */
44 char name[DST_NAMELEN];
45 /* Command flags */
46 __u32 flags;
47 /* Command itself (see above) */
48 __u32 cmd;
49 /* Maximum number of pages per single request in this device */
50 __u32 max_pages;
51 /* Stale/error transaction scanning timeout in milliseconds */
52 __u32 trans_scan_timeout;
53 /* Maximum number of retry sends before completing transaction as broken */
54 __u32 trans_max_retries;
55 /* Storage size */
56 __u64 size;
57};
58
59/* Reply command carries completion status */
60struct dst_ctl_ack
61{
62 struct cn_msg msg;
63 int error;
64 int unused[3];
65};
66
67/*
68 * Unfortunaltely socket address structure is not exported to userspace
69 * and is redefined there.
70 */
71#define SADDR_MAX_DATA 128
72
73struct saddr {
74 /* address family, AF_xxx */
75 unsigned short sa_family;
76 /* 14 bytes of protocol address */
77 char sa_data[SADDR_MAX_DATA];
78 /* Number of bytes used in sa_data */
79 unsigned short sa_data_len;
80};
81
82/* Address structure */
83struct dst_network_ctl
84{
85 /* Socket type: datagram, stream...*/
86 unsigned int type;
87 /* Let me guess, is it a Jupiter diameter? */
88 unsigned int proto;
89 /* Peer's address */
90 struct saddr addr;
91};
92
93struct dst_crypto_ctl
94{
95 /* Cipher and hash names */
96 char cipher_algo[DST_NAMELEN];
97 char hash_algo[DST_NAMELEN];
98
99 /* Key sizes. Can be zero for digest for example */
100 unsigned int cipher_keysize, hash_keysize;
101 /* Alignment. Calculated by the DST itself. */
102 unsigned int crypto_attached_size;
103 /* Number of threads to perform crypto operations */
104 int thread_num;
105};
106
107/* Export security attributes have this bits checked in when client connects */
108#define DST_PERM_READ (1<<0)
109#define DST_PERM_WRITE (1<<1)
110
111/*
112 * Right now it is simple model, where each remote address
113 * is assigned to set of permissions it is allowed to perform.
114 * In real world block device does not know anything but
115 * reading and writing, so it should be more than enough.
116 */
117struct dst_secure_user
118{
119 unsigned int permissions;
120 struct saddr addr;
121};
122
123/*
124 * Export control command: device to export and network address to accept
125 * clients to work with given device
126 */
127struct dst_export_ctl
128{
129 char device[DST_NAMELEN];
130 struct dst_network_ctl ctl;
131};
132
133enum {
134 DST_CFG = 1, /* Request remote configuration */
135 DST_IO, /* IO command */
136 DST_IO_RESPONSE, /* IO response */
137 DST_PING, /* Keepalive message */
138 DST_NCMD_MAX,
139};
140
141struct dst_cmd
142{
143 /* Network command itself, see above */
144 __u32 cmd;
145 /*
146 * Size of the attached data
147 * (in most cases, for READ command it means how many bytes were requested)
148 */
149 __u32 size;
150 /* Crypto size: number of attached bytes with digest/hmac */
151 __u32 csize;
152 /* Here we can carry secret data */
153 __u32 reserved;
154 /* Read/write bits, see how they are encoded in bio structure */
155 __u64 rw;
156 /* BIO flags */
157 __u64 flags;
158 /* Unique command id (like transaction ID) */
159 __u64 id;
160 /* Sector to start IO from */
161 __u64 sector;
162 /* Hash data is placed after this header */
163 __u8 hash[0];
164};
165
166/*
167 * Convert command to/from network byte order.
168 * We do not use hton*() functions, since there is
169 * no 64-bit implementation.
170 */
171static inline void dst_convert_cmd(struct dst_cmd *c)
172{
173 c->cmd = __cpu_to_be32(c->cmd);
174 c->csize = __cpu_to_be32(c->csize);
175 c->size = __cpu_to_be32(c->size);
176 c->sector = __cpu_to_be64(c->sector);
177 c->id = __cpu_to_be64(c->id);
178 c->flags = __cpu_to_be64(c->flags);
179 c->rw = __cpu_to_be64(c->rw);
180}
181
182/* Transaction id */
183typedef __u64 dst_gen_t;
184
185#ifdef __KERNEL__
186
187#include <linux/blkdev.h>
188#include <linux/bio.h>
189#include <linux/device.h>
190#include <linux/mempool.h>
191#include <linux/net.h>
192#include <linux/poll.h>
193#include <linux/rbtree.h>
194
195#ifdef CONFIG_DST_DEBUG
196#define dprintk(f, a...) printk(KERN_NOTICE f, ##a)
197#else
198static inline void __attribute__ ((format (printf, 1, 2)))
199 dprintk(const char *fmt, ...) {}
200#endif
201
202struct dst_node;
203
204struct dst_trans
205{
206 /* DST node we are working with */
207 struct dst_node *n;
208
209 /* Entry inside transaction tree */
210 struct rb_node trans_entry;
211
212 /* Merlin kills this transaction when this memory cell equals zero */
213 atomic_t refcnt;
214
215 /* How this transaction should be processed by crypto engine */
216 short enc;
217 /* How many times this transaction was resent */
218 short retries;
219 /* Completion status */
220 int error;
221
222 /* When did we send it to the remote peer */
223 long send_time;
224
225 /* My name is...
226 * Well, computers does not speak, they have unique id instead */
227 dst_gen_t gen;
228
229 /* Block IO we are working with */
230 struct bio *bio;
231
232 /* Network command for above block IO request */
233 struct dst_cmd cmd;
234};
235
236struct dst_crypto_engine
237{
238 /* What should we do with all block requests */
239 struct crypto_hash *hash;
240 struct crypto_ablkcipher *cipher;
241
242 /* Pool of pages used to encrypt data into before sending */
243 int page_num;
244 struct page **pages;
245
246 /* What to do with current request */
247 int enc;
248 /* Who we are and where do we go */
249 struct scatterlist *src, *dst;
250
251 /* Maximum timeout waiting for encryption to be completed */
252 long timeout;
253 /* IV is a 64-bit sequential counter */
254 u64 iv;
255
256 /* Secret data */
257 void *private;
258
259 /* Cached temporary data lives here */
260 int size;
261 void *data;
262};
263
264struct dst_state
265{
266 /* The main state protection */
267 struct mutex state_lock;
268
269 /* Polling machinery for sockets */
270 wait_queue_t wait;
271 wait_queue_head_t *whead;
272 /* Most of events are being waited here */
273 wait_queue_head_t thread_wait;
274
275 /* Who owns this? */
276 struct dst_node *node;
277
278 /* Network address for this state */
279 struct dst_network_ctl ctl;
280
281 /* Permissions to work with: read-only or rw connection */
282 u32 permissions;
283
284 /* Called when we need to clean private data */
285 void (* cleanup)(struct dst_state *st);
286
287 /* Used by the server: BIO completion queues BIOs here */
288 struct list_head request_list;
289 spinlock_t request_lock;
290
291 /* Guess what? No, it is not number of planets */
292 atomic_t refcnt;
293
294 /* This flags is set when connection should be dropped */
295 int need_exit;
296
297 /*
298 * Socket to work with. Second pointer is used for
299 * lockless check if socket was changed before performing
300 * next action (like working with cached polling result)
301 */
302 struct socket *socket, *read_socket;
303
304 /* Cached preallocated data */
305 void *data;
306 unsigned int size;
307
308 /* Currently processed command */
309 struct dst_cmd cmd;
310};
311
312struct dst_info
313{
314 /* Device size */
315 u64 size;
316
317 /* Local device name for export devices */
318 char local[DST_NAMELEN];
319
320 /* Network setup */
321 struct dst_network_ctl net;
322
323 /* Sysfs bits use this */
324 struct device device;
325};
326
327struct dst_node
328{
329 struct list_head node_entry;
330
331 /* Hi, my name is stored here */
332 char name[DST_NAMELEN];
333 /* My cache name is stored here */
334 char cache_name[DST_NAMELEN];
335
336 /* Block device attached to given node.
337 * Only valid for exporting nodes */
338 struct block_device *bdev;
339 /* Network state machine for given peer */
340 struct dst_state *state;
341
342 /* Block IO machinery */
343 struct request_queue *queue;
344 struct gendisk *disk;
345
346 /* Number of threads in processing pool */
347 int thread_num;
348 /* Maximum number of pages in single IO */
349 int max_pages;
350
351 /* I'm that big in bytes */
352 loff_t size;
353
354 /* Exported to userspace node information */
355 struct dst_info *info;
356
357 /*
358 * Security attribute list.
359 * Used only by exporting node currently.
360 */
361 struct list_head security_list;
362 struct mutex security_lock;
363
364 /*
365 * When this unerflows below zero, university collapses.
366 * But this will not happen, since node will be freed,
367 * when reference counter reaches zero.
368 */
369 atomic_t refcnt;
370
371 /* How precisely should I be started? */
372 int (*start)(struct dst_node *);
373
374 /* Crypto capabilities */
375 struct dst_crypto_ctl crypto;
376 u8 *hash_key;
377 u8 *cipher_key;
378
379 /* Pool of processing thread */
380 struct thread_pool *pool;
381
382 /* Transaction IDs live here */
383 atomic_long_t gen;
384
385 /*
386 * How frequently and how many times transaction
387 * tree should be scanned to drop stale objects.
388 */
389 long trans_scan_timeout;
390 int trans_max_retries;
391
392 /* Small gnomes live here */
393 struct rb_root trans_root;
394 struct mutex trans_lock;
395
396 /*
397 * Transaction cache/memory pool.
398 * It is big enough to contain not only transaction
399 * itself, but additional crypto data (digest/hmac).
400 */
401 struct kmem_cache *trans_cache;
402 mempool_t *trans_pool;
403
404 /* This entity scans transaction tree */
405 struct delayed_work trans_work;
406
407 wait_queue_head_t wait;
408};
409
410/* Kernel representation of the security attribute */
411struct dst_secure
412{
413 struct list_head sec_entry;
414 struct dst_secure_user sec;
415};
416
417int dst_process_bio(struct dst_node *n, struct bio *bio);
418
419int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r);
420int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le);
421
422static inline struct dst_state *dst_state_get(struct dst_state *st)
423{
424 BUG_ON(atomic_read(&st->refcnt) == 0);
425 atomic_inc(&st->refcnt);
426 return st;
427}
428
429void dst_state_put(struct dst_state *st);
430
431struct dst_state *dst_state_alloc(struct dst_node *n);
432int dst_state_socket_create(struct dst_state *st);
433void dst_state_socket_release(struct dst_state *st);
434
435void dst_state_exit_connected(struct dst_state *st);
436
437int dst_state_schedule_receiver(struct dst_state *st);
438
439void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str);
440
441static inline void dst_state_lock(struct dst_state *st)
442{
443 mutex_lock(&st->state_lock);
444}
445
446static inline void dst_state_unlock(struct dst_state *st)
447{
448 mutex_unlock(&st->state_lock);
449}
450
451void dst_poll_exit(struct dst_state *st);
452int dst_poll_init(struct dst_state *st);
453
454static inline unsigned int dst_state_poll(struct dst_state *st)
455{
456 unsigned int revents = POLLHUP | POLLERR;
457
458 dst_state_lock(st);
459 if (st->socket)
460 revents = st->socket->ops->poll(NULL, st->socket, NULL);
461 dst_state_unlock(st);
462
463 return revents;
464}
465
466static inline int dst_thread_setup(void *private, void *data)
467{
468 return 0;
469}
470
471void dst_node_put(struct dst_node *n);
472
473static inline struct dst_node *dst_node_get(struct dst_node *n)
474{
475 atomic_inc(&n->refcnt);
476 return n;
477}
478
479int dst_data_recv(struct dst_state *st, void *data, unsigned int size);
480int dst_recv_cdata(struct dst_state *st, void *cdata);
481int dst_data_send_header(struct socket *sock,
482 void *data, unsigned int size, int more);
483
484int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio);
485
486int dst_process_io(struct dst_state *st);
487int dst_export_crypto(struct dst_node *n, struct bio *bio);
488int dst_export_send_bio(struct bio *bio);
489int dst_start_export(struct dst_node *n);
490
491int __init dst_export_init(void);
492void dst_export_exit(void);
493
494/* Private structure for export block IO requests */
495struct dst_export_priv
496{
497 struct list_head request_entry;
498 struct dst_state *state;
499 struct bio *bio;
500 struct dst_cmd cmd;
501};
502
503static inline void dst_trans_get(struct dst_trans *t)
504{
505 atomic_inc(&t->refcnt);
506}
507
508struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen);
509int dst_trans_remove(struct dst_trans *t);
510int dst_trans_remove_nolock(struct dst_trans *t);
511void dst_trans_put(struct dst_trans *t);
512
513/*
514 * Convert bio into network command.
515 */
516static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd,
517 u32 command, u64 id)
518{
519 cmd->cmd = command;
520 cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS;
521 cmd->rw = bio->bi_rw;
522 cmd->size = bio->bi_size;
523 cmd->csize = 0;
524 cmd->id = id;
525 cmd->sector = bio->bi_sector;
526};
527
528int dst_trans_send(struct dst_trans *t);
529int dst_trans_crypto(struct dst_trans *t);
530
531int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl);
532void dst_node_crypto_exit(struct dst_node *n);
533
534static inline int dst_need_crypto(struct dst_node *n)
535{
536 struct dst_crypto_ctl *c = &n->crypto;
537 /*
538 * Logical OR is appropriate here, but boolean one produces
539 * more optimal code, so it is used instead.
540 */
541 return (c->hash_algo[0] | c->cipher_algo[0]);
542}
543
544int dst_node_trans_init(struct dst_node *n, unsigned int size);
545void dst_node_trans_exit(struct dst_node *n);
546
547/*
548 * Pool of threads.
549 * Ready list contains threads currently free to be used,
550 * active one contains threads with some work scheduled for them.
551 * Caller can wait in given queue when thread is ready.
552 */
553struct thread_pool
554{
555 int thread_num;
556 struct mutex thread_lock;
557 struct list_head ready_list, active_list;
558
559 wait_queue_head_t wait;
560};
561
562void thread_pool_del_worker(struct thread_pool *p);
563void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id);
564int thread_pool_add_worker(struct thread_pool *p,
565 char *name,
566 unsigned int id,
567 void *(* init)(void *data),
568 void (* cleanup)(void *data),
569 void *data);
570
571void thread_pool_destroy(struct thread_pool *p);
572struct thread_pool *thread_pool_create(int num, char *name,
573 void *(* init)(void *data),
574 void (* cleanup)(void *data),
575 void *data);
576
577int thread_pool_schedule(struct thread_pool *p,
578 int (* setup)(void *stored_private, void *setup_data),
579 int (* action)(void *stored_private, void *setup_data),
580 void *setup_data, long timeout);
581int thread_pool_schedule_private(struct thread_pool *p,
582 int (* setup)(void *private, void *data),
583 int (* action)(void *private, void *data),
584 void *data, long timeout, void *id);
585
586#endif /* __KERNEL__ */
587#endif /* __DST_H */
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index bb0df2aaebfa..fec66bd24f22 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -76,7 +76,7 @@ struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */
76} audio_karaoke_t; /* into left and right */ 76} audio_karaoke_t; /* into left and right */
77 77
78 78
79typedef uint16_t audio_attributes_t; 79typedef __u16 audio_attributes_t;
80/* bits: descr. */ 80/* bits: descr. */
81/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ 81/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */
82/* 12 multichannel extension */ 82/* 12 multichannel extension */
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index bd49c3ebf916..1d750c0fd86e 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -132,12 +132,12 @@ struct video_command {
132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) 132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
133 133
134struct video_event { 134struct video_event {
135 int32_t type; 135 __s32 type;
136#define VIDEO_EVENT_SIZE_CHANGED 1 136#define VIDEO_EVENT_SIZE_CHANGED 1
137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
138#define VIDEO_EVENT_DECODER_STOPPED 3 138#define VIDEO_EVENT_DECODER_STOPPED 3
139#define VIDEO_EVENT_VSYNC 4 139#define VIDEO_EVENT_VSYNC 4
140 time_t timestamp; 140 __kernel_time_t timestamp;
141 union { 141 union {
142 video_size_t size; 142 video_size_t size;
143 unsigned int frame_rate; /* in frames per 1000sec */ 143 unsigned int frame_rate; /* in frames per 1000sec */
@@ -157,25 +157,25 @@ struct video_status {
157 157
158struct video_still_picture { 158struct video_still_picture {
159 char __user *iFrame; /* pointer to a single iframe in memory */ 159 char __user *iFrame; /* pointer to a single iframe in memory */
160 int32_t size; 160 __s32 size;
161}; 161};
162 162
163 163
164typedef 164typedef
165struct video_highlight { 165struct video_highlight {
166 int active; /* 1=show highlight, 0=hide highlight */ 166 int active; /* 1=show highlight, 0=hide highlight */
167 uint8_t contrast1; /* 7- 4 Pattern pixel contrast */ 167 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
168 /* 3- 0 Background pixel contrast */ 168 /* 3- 0 Background pixel contrast */
169 uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */ 169 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
170 /* 3- 0 Emphasis pixel-1 contrast */ 170 /* 3- 0 Emphasis pixel-1 contrast */
171 uint8_t color1; /* 7- 4 Pattern pixel color */ 171 __u8 color1; /* 7- 4 Pattern pixel color */
172 /* 3- 0 Background pixel color */ 172 /* 3- 0 Background pixel color */
173 uint8_t color2; /* 7- 4 Emphasis pixel-2 color */ 173 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
174 /* 3- 0 Emphasis pixel-1 color */ 174 /* 3- 0 Emphasis pixel-1 color */
175 uint32_t ypos; /* 23-22 auto action mode */ 175 __u32 ypos; /* 23-22 auto action mode */
176 /* 21-12 start y */ 176 /* 21-12 start y */
177 /* 9- 0 end y */ 177 /* 9- 0 end y */
178 uint32_t xpos; /* 23-22 button color number */ 178 __u32 xpos; /* 23-22 button color number */
179 /* 21-12 start x */ 179 /* 21-12 start x */
180 /* 9- 0 end x */ 180 /* 9- 0 end x */
181} video_highlight_t; 181} video_highlight_t;
@@ -189,17 +189,17 @@ typedef struct video_spu {
189 189
190typedef struct video_spu_palette { /* SPU Palette information */ 190typedef struct video_spu_palette { /* SPU Palette information */
191 int length; 191 int length;
192 uint8_t __user *palette; 192 __u8 __user *palette;
193} video_spu_palette_t; 193} video_spu_palette_t;
194 194
195 195
196typedef struct video_navi_pack { 196typedef struct video_navi_pack {
197 int length; /* 0 ... 1024 */ 197 int length; /* 0 ... 1024 */
198 uint8_t data[1024]; 198 __u8 data[1024];
199} video_navi_pack_t; 199} video_navi_pack_t;
200 200
201 201
202typedef uint16_t video_attributes_t; 202typedef __u16 video_attributes_t;
203/* bits: descr. */ 203/* bits: descr. */
204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ 204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
205/* 13-12 TV system (0=525/60, 1=625/50) */ 205/* 13-12 TV system (0=525/60, 1=625/50) */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index d797dde247f7..c8aad713a046 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -74,4 +74,23 @@ struct dw_dma_slave {
74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ 74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ 75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
76 76
77/* DMA API extensions */
78struct dw_cyclic_desc {
79 struct dw_desc **desc;
80 unsigned long periods;
81 void (*period_callback)(void *param);
82 void *period_callback_param;
83};
84
85struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
86 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
87 enum dma_data_direction direction);
88void dw_dma_cyclic_free(struct dma_chan *chan);
89int dw_dma_cyclic_start(struct dma_chan *chan);
90void dw_dma_cyclic_stop(struct dma_chan *chan);
91
92dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
93
94dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
95
77#endif /* DW_DMAC_H */ 96#endif /* DW_DMAC_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
new file mode 100644
index 000000000000..baabf33be244
--- /dev/null
+++ b/include/linux/dynamic_debug.h
@@ -0,0 +1,88 @@
1#ifndef _DYNAMIC_DEBUG_H
2#define _DYNAMIC_DEBUG_H
3
4/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
5 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
6 * use independent hash functions, to reduce the chance of false positives.
7 */
8extern long long dynamic_debug_enabled;
9extern long long dynamic_debug_enabled2;
10
11/*
12 * An instance of this structure is created in a special
13 * ELF section at every dynamic debug callsite. At runtime,
14 * the special section is treated as an array of these.
15 */
16struct _ddebug {
17 /*
18 * These fields are used to drive the user interface
19 * for selecting and displaying debug callsites.
20 */
21 const char *modname;
22 const char *function;
23 const char *filename;
24 const char *format;
25 char primary_hash;
26 char secondary_hash;
27 unsigned int lineno:24;
28 /*
29 * The flags field controls the behaviour at the callsite.
30 * The bits here are changed dynamically when the user
31 * writes commands to <debugfs>/dynamic_debug/ddebug
32 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
34#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8;
36} __attribute__((aligned(8)));
37
38
39int ddebug_add_module(struct _ddebug *tab, unsigned int n,
40 const char *modname);
41
42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(char *mod_name);
44
45#define __dynamic_dbg_enabled(dd) ({ \
46 int __ret = 0; \
47 if (unlikely((dynamic_debug_enabled & (1LL << DEBUG_HASH)) && \
48 (dynamic_debug_enabled2 & (1LL << DEBUG_HASH2)))) \
49 if (unlikely(dd.flags)) \
50 __ret = 1; \
51 __ret; })
52
53#define dynamic_pr_debug(fmt, ...) do { \
54 static struct _ddebug descriptor \
55 __used \
56 __attribute__((section("__verbose"), aligned(8))) = \
57 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
58 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
59 if (__dynamic_dbg_enabled(descriptor)) \
60 printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \
61 ##__VA_ARGS__); \
62 } while (0)
63
64
65#define dynamic_dev_dbg(dev, fmt, ...) do { \
66 static struct _ddebug descriptor \
67 __used \
68 __attribute__((section("__verbose"), aligned(8))) = \
69 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
70 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
71 if (__dynamic_dbg_enabled(descriptor)) \
72 dev_printk(KERN_DEBUG, dev, \
73 KBUILD_MODNAME ": " pr_fmt(fmt),\
74 ##__VA_ARGS__); \
75 } while (0)
76
77#else
78
79static inline int ddebug_remove_module(char *mod)
80{
81 return 0;
82}
83
84#define dynamic_pr_debug(fmt, ...) do { } while (0)
85#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
86#endif
87
88#endif
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h
deleted file mode 100644
index 2d528d009074..000000000000
--- a/include/linux/dynamic_printk.h
+++ /dev/null
@@ -1,93 +0,0 @@
1#ifndef _DYNAMIC_PRINTK_H
2#define _DYNAMIC_PRINTK_H
3
4#define DYNAMIC_DEBUG_HASH_BITS 6
5#define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS)
6
7#define TYPE_BOOLEAN 1
8
9#define DYNAMIC_ENABLED_ALL 0
10#define DYNAMIC_ENABLED_NONE 1
11#define DYNAMIC_ENABLED_SOME 2
12
13extern int dynamic_enabled;
14
15/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
16 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
17 * use independent hash functions, to reduce the chance of false positives.
18 */
19extern long long dynamic_printk_enabled;
20extern long long dynamic_printk_enabled2;
21
22struct mod_debug {
23 char *modname;
24 char *logical_modname;
25 char *flag_names;
26 int type;
27 int hash;
28 int hash2;
29} __attribute__((aligned(8)));
30
31int register_dynamic_debug_module(char *mod_name, int type, char *share_name,
32 char *flags, int hash, int hash2);
33
34#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
35extern int unregister_dynamic_debug_module(char *mod_name);
36extern int __dynamic_dbg_enabled_helper(char *modname, int type,
37 int value, int hash);
38
39#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \
40 int __ret = 0; \
41 if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \
42 (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \
43 __ret = __dynamic_dbg_enabled_helper(module, type, \
44 value, hash);\
45 __ret; })
46
47#define dynamic_pr_debug(fmt, ...) do { \
48 static char mod_name[] \
49 __attribute__((section("__verbose_strings"))) \
50 = KBUILD_MODNAME; \
51 static struct mod_debug descriptor \
52 __used \
53 __attribute__((section("__verbose"), aligned(8))) = \
54 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
55 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
56 0, 0, DEBUG_HASH)) \
57 printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
58 ##__VA_ARGS__); \
59 } while (0)
60
61#define dynamic_dev_dbg(dev, format, ...) do { \
62 static char mod_name[] \
63 __attribute__((section("__verbose_strings"))) \
64 = KBUILD_MODNAME; \
65 static struct mod_debug descriptor \
66 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \
68 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
69 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
70 0, 0, DEBUG_HASH)) \
71 dev_printk(KERN_DEBUG, dev, \
72 KBUILD_MODNAME ": " format, \
73 ##__VA_ARGS__); \
74 } while (0)
75
76#else
77
78static inline int unregister_dynamic_debug_module(const char *mod_name)
79{
80 return 0;
81}
82static inline int __dynamic_dbg_enabled_helper(char *modname, int type,
83 int value, int hash)
84{
85 return 0;
86}
87
88#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; })
89#define dynamic_pr_debug(fmt, ...) do { } while (0)
90#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
91#endif
92
93#endif
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 7a204256b155..c59b769f62b0 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -116,6 +116,7 @@ extern void elv_abort_queue(struct request_queue *);
116extern void elv_completed_request(struct request_queue *, struct request *); 116extern void elv_completed_request(struct request_queue *, struct request *);
117extern int elv_set_request(struct request_queue *, struct request *, gfp_t); 117extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
118extern void elv_put_request(struct request_queue *, struct request *); 118extern void elv_put_request(struct request_queue *, struct request *);
119extern void elv_drain_elevator(struct request_queue *);
119 120
120/* 121/*
121 * io scheduler registration 122 * io scheduler registration
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index ceb1454b6977..ec12cc74366f 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -18,6 +18,7 @@ struct sock_extended_err
18#define SO_EE_ORIGIN_LOCAL 1 18#define SO_EE_ORIGIN_LOCAL 1
19#define SO_EE_ORIGIN_ICMP 2 19#define SO_EE_ORIGIN_ICMP 2
20#define SO_EE_ORIGIN_ICMP6 3 20#define SO_EE_ORIGIN_ICMP6 3
21#define SO_EE_ORIGIN_TIMESTAMPING 4
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 1cb0f0b90926..a1f17abba7dc 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -184,4 +184,25 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
184} 184}
185#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
186 186
187/**
188 * compare_ether_header - Compare two Ethernet headers
189 * @a: Pointer to Ethernet header
190 * @b: Pointer to Ethernet header
191 *
192 * Compare two ethernet headers, returns 0 if equal.
193 * This assumes that the network header (i.e., IP header) is 4-byte
194 * aligned OR the platform can handle unaligned access. This is the
195 * case for all packets coming into netif_receive_skb or similar
196 * entry points.
197 */
198
199static inline int compare_ether_header(const void *a, const void *b)
200{
201 u32 *a32 = (u32 *)((u8 *)a + 2);
202 u32 *b32 = (u32 *)((u8 *)b + 2);
203
204 return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
205 (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
206}
207
187#endif /* _LINUX_ETHERDEVICE_H */ 208#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 27c67a542235..131b127b70f8 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -7,6 +7,7 @@
7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com, 7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8 * christopher.leech@intel.com, 8 * christopher.leech@intel.com,
9 * scott.feldman@intel.com) 9 * scott.feldman@intel.com)
10 * Portions Copyright (C) Sun Microsystems 2008
10 */ 11 */
11 12
12#ifndef _LINUX_ETHTOOL_H 13#ifndef _LINUX_ETHTOOL_H
@@ -287,10 +288,75 @@ enum ethtool_flags {
287 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 288 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
288}; 289};
289 290
290struct ethtool_rxnfc { 291/* The following structures are for supporting RX network flow
291 __u32 cmd; 292 * classification configuration. Note, all multibyte fields, e.g.,
293 * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
294 * byte order.
295 */
296struct ethtool_tcpip4_spec {
297 __be32 ip4src;
298 __be32 ip4dst;
299 __be16 psrc;
300 __be16 pdst;
301 __u8 tos;
302};
303
304struct ethtool_ah_espip4_spec {
305 __be32 ip4src;
306 __be32 ip4dst;
307 __be32 spi;
308 __u8 tos;
309};
310
311struct ethtool_rawip4_spec {
312 __be32 ip4src;
313 __be32 ip4dst;
314 __u8 hdata[64];
315};
316
317struct ethtool_ether_spec {
318 __be16 ether_type;
319 __u8 frame_size;
320 __u8 eframe[16];
321};
322
323#define ETH_RX_NFC_IP4 1
324#define ETH_RX_NFC_IP6 2
325
326struct ethtool_usrip4_spec {
327 __be32 ip4src;
328 __be32 ip4dst;
329 __be32 l4_4_bytes;
330 __u8 tos;
331 __u8 ip_ver;
332 __u8 proto;
333};
334
335struct ethtool_rx_flow_spec {
292 __u32 flow_type; 336 __u32 flow_type;
293 __u64 data; 337 union {
338 struct ethtool_tcpip4_spec tcp_ip4_spec;
339 struct ethtool_tcpip4_spec udp_ip4_spec;
340 struct ethtool_tcpip4_spec sctp_ip4_spec;
341 struct ethtool_ah_espip4_spec ah_ip4_spec;
342 struct ethtool_ah_espip4_spec esp_ip4_spec;
343 struct ethtool_rawip4_spec raw_ip4_spec;
344 struct ethtool_ether_spec ether_spec;
345 struct ethtool_usrip4_spec usr_ip4_spec;
346 __u8 hdata[64];
347 } h_u, m_u; /* entry, mask */
348 __u64 ring_cookie;
349 __u32 location;
350};
351
352struct ethtool_rxnfc {
353 __u32 cmd;
354 __u32 flow_type;
355 /* The rx flow hash value or the rule DB size */
356 __u64 data;
357 struct ethtool_rx_flow_spec fs;
358 __u32 rule_cnt;
359 __u32 rule_locs[0];
294}; 360};
295 361
296#ifdef __KERNEL__ 362#ifdef __KERNEL__
@@ -417,8 +483,8 @@ struct ethtool_ops {
417 /* the following hooks are obsolete */ 483 /* the following hooks are obsolete */
418 int (*self_test_count)(struct net_device *);/* use get_sset_count */ 484 int (*self_test_count)(struct net_device *);/* use get_sset_count */
419 int (*get_stats_count)(struct net_device *);/* use get_sset_count */ 485 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
420 int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *); 486 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
421 int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *); 487 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
422}; 488};
423#endif /* __KERNEL__ */ 489#endif /* __KERNEL__ */
424 490
@@ -469,6 +535,12 @@ struct ethtool_ops {
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 535#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 536#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 537#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
538#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
539#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
540#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
541#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
542#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
543#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
472 544
473/* compatibility with older code */ 545/* compatibility with older code */
474#define SPARC_ETH_GSET ETHTOOL_GSET 546#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -565,9 +637,13 @@ struct ethtool_ops {
565#define UDP_V6_FLOW 0x06 637#define UDP_V6_FLOW 0x06
566#define SCTP_V6_FLOW 0x07 638#define SCTP_V6_FLOW 0x07
567#define AH_ESP_V6_FLOW 0x08 639#define AH_ESP_V6_FLOW 0x08
640#define AH_V4_FLOW 0x09
641#define ESP_V4_FLOW 0x0a
642#define AH_V6_FLOW 0x0b
643#define ESP_V6_FLOW 0x0c
644#define IP_USER_FLOW 0x0d
568 645
569/* L3-L4 network traffic flow hash options */ 646/* L3-L4 network traffic flow hash options */
570#define RXH_DEV_PORT (1 << 0)
571#define RXH_L2DA (1 << 1) 647#define RXH_L2DA (1 << 1)
572#define RXH_VLAN (1 << 2) 648#define RXH_VLAN (1 << 2)
573#define RXH_L3_PROTO (1 << 3) 649#define RXH_L3_PROTO (1 << 3)
@@ -577,5 +653,6 @@ struct ethtool_ops {
577#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ 653#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
578#define RXH_DISCARD (1 << 31) 654#define RXH_DISCARD (1 << 31)
579 655
656#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
580 657
581#endif /* _LINUX_ETHTOOL_H */ 658#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index a667637b54e3..f45a8ae5f828 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -13,10 +13,20 @@
13/* For O_CLOEXEC and O_NONBLOCK */ 13/* For O_CLOEXEC and O_NONBLOCK */
14#include <linux/fcntl.h> 14#include <linux/fcntl.h>
15 15
16/* Flags for eventfd2. */ 16/*
17 * CAREFUL: Check include/asm-generic/fcntl.h when defining
18 * new flags, since they might collide with O_* ones. We want
19 * to re-use O_* flags that couldn't possibly have a meaning
20 * from eventfd, in order to leave a free define-space for
21 * shared O_* flags.
22 */
23#define EFD_SEMAPHORE (1 << 0)
17#define EFD_CLOEXEC O_CLOEXEC 24#define EFD_CLOEXEC O_CLOEXEC
18#define EFD_NONBLOCK O_NONBLOCK 25#define EFD_NONBLOCK O_NONBLOCK
19 26
27#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
28#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
29
20struct file *eventfd_fget(int fd); 30struct file *eventfd_fget(int fd);
21int eventfd_signal(struct file *file, int n); 31int eventfd_signal(struct file *file, int n);
22 32
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f1e1d3c47125..f6856a5a1d4b 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -61,7 +61,6 @@ struct file;
61static inline void eventpoll_init_file(struct file *file) 61static inline void eventpoll_init_file(struct file *file)
62{ 62{
63 INIT_LIST_HEAD(&file->f_ep_links); 63 INIT_LIST_HEAD(&file->f_ep_links);
64 spin_lock_init(&file->f_ep_lock);
65} 64}
66 65
67 66
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dd495b8c3091..634a5e5aba3e 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -208,6 +208,7 @@ static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
208#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ 208#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
209#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */ 209#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
210#define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */ 210#define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */
211#define EXT3_STATE_FLUSH_ON_CLOSE 0x00000008
211 212
212/* Used to pass group descriptor data when online resize is done */ 213/* Used to pass group descriptor data when online resize is done */
213struct ext3_new_group_input { 214struct ext3_new_group_input {
@@ -893,9 +894,8 @@ extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
893 u64 start, u64 len); 894 u64 start, u64 len);
894 895
895/* ioctl.c */ 896/* ioctl.c */
896extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 897extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
897 unsigned long); 898extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long);
898extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
899 899
900/* namei.c */ 900/* namei.c */
901extern int ext3_orphan_add(handle_t *, struct inode *); 901extern int ext3_orphan_add(handle_t *, struct inode *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 31527e17076b..f563c5013932 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -123,6 +123,7 @@ struct dentry;
123#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ 123#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
124#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ 124#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
125#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ 125#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
126#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */
126#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ 127#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
127#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ 128#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
128#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ 129#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
@@ -960,15 +961,7 @@ extern struct fb_info *registered_fb[FB_MAX];
960extern int num_registered_fb; 961extern int num_registered_fb;
961extern struct class *fb_class; 962extern struct class *fb_class;
962 963
963static inline int lock_fb_info(struct fb_info *info) 964extern int lock_fb_info(struct fb_info *info);
964{
965 mutex_lock(&info->lock);
966 if (!info->fbops) {
967 mutex_unlock(&info->lock);
968 return 0;
969 }
970 return 1;
971}
972 965
973static inline void unlock_fb_info(struct fb_info *info) 966static inline void unlock_fb_info(struct fb_info *info)
974{ 967{
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 09d6c5bbdddd..a2ec74bc4812 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -5,12 +5,14 @@
5#ifndef __LINUX_FDTABLE_H 5#ifndef __LINUX_FDTABLE_H
6#define __LINUX_FDTABLE_H 6#define __LINUX_FDTABLE_H
7 7
8#include <asm/atomic.h>
9#include <linux/posix_types.h> 8#include <linux/posix_types.h>
10#include <linux/compiler.h> 9#include <linux/compiler.h>
11#include <linux/spinlock.h> 10#include <linux/spinlock.h>
12#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
13#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h>
14
15#include <asm/atomic.h>
14 16
15/* 17/*
16 * The default fd array needs to be at least BITS_PER_LONG, 18 * The default fd array needs to be at least BITS_PER_LONG,
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 4d078e99c017..c6b3ca3af6df 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -25,10 +25,12 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/firewire-constants.h> 26#include <linux/firewire-constants.h>
27 27
28#define FW_CDEV_EVENT_BUS_RESET 0x00 28#define FW_CDEV_EVENT_BUS_RESET 0x00
29#define FW_CDEV_EVENT_RESPONSE 0x01 29#define FW_CDEV_EVENT_RESPONSE 0x01
30#define FW_CDEV_EVENT_REQUEST 0x02 30#define FW_CDEV_EVENT_REQUEST 0x02
31#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 31#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
32#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
33#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
32 34
33/** 35/**
34 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types 36 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
@@ -136,7 +138,24 @@ struct fw_cdev_event_request {
136 * This event is sent when the controller has completed an &fw_cdev_iso_packet 138 * This event is sent when the controller has completed an &fw_cdev_iso_packet
137 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers 139 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers
138 * stripped of all packets up until and including the interrupt packet are 140 * stripped of all packets up until and including the interrupt packet are
139 * returned in the @header field. 141 * returned in the @header field. The amount of header data per packet is as
142 * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
143 *
144 * In version 1 of this ABI, header data consisted of the 1394 isochronous
145 * packet header, followed by quadlets from the packet payload if
146 * &fw_cdev_create_iso_context.header_size > 4.
147 *
148 * In version 2 of this ABI, header data consist of the 1394 isochronous
149 * packet header, followed by a timestamp quadlet if
150 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
151 * packet payload if &fw_cdev_create_iso_context.header_size > 8.
152 *
153 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
154 *
155 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
156 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp:
157 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
158 * order.
140 */ 159 */
141struct fw_cdev_event_iso_interrupt { 160struct fw_cdev_event_iso_interrupt {
142 __u64 closure; 161 __u64 closure;
@@ -147,12 +166,44 @@ struct fw_cdev_event_iso_interrupt {
147}; 166};
148 167
149/** 168/**
169 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
170 * @closure: See &fw_cdev_event_common;
171 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
172 * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
173 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
174 * @handle: Reference by which an allocated resource can be deallocated
175 * @channel: Isochronous channel which was (de)allocated, if any
176 * @bandwidth: Bandwidth allocation units which were (de)allocated, if any
177 *
178 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
179 * resource was allocated at the IRM. The client has to check @channel and
180 * @bandwidth for whether the allocation actually succeeded.
181 *
182 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
183 * resource was deallocated at the IRM. It is also sent when automatic
184 * reallocation after a bus reset failed.
185 *
186 * @channel is <0 if no channel was (de)allocated or if reallocation failed.
187 * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
188 */
189struct fw_cdev_event_iso_resource {
190 __u64 closure;
191 __u32 type;
192 __u32 handle;
193 __s32 channel;
194 __s32 bandwidth;
195};
196
197/**
150 * union fw_cdev_event - Convenience union of fw_cdev_event_ types 198 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
151 * @common: Valid for all types 199 * @common: Valid for all types
152 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET 200 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
153 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE 201 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
154 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 202 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
155 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 203 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
204 * @iso_resource: Valid if @common.type ==
205 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
206 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
156 * 207 *
157 * Convenience union for userspace use. Events could be read(2) into an 208 * Convenience union for userspace use. Events could be read(2) into an
158 * appropriately aligned char buffer and then cast to this union for further 209 * appropriately aligned char buffer and then cast to this union for further
@@ -163,33 +214,47 @@ struct fw_cdev_event_iso_interrupt {
163 * not fit will be discarded so that the next read(2) will return a new event. 214 * not fit will be discarded so that the next read(2) will return a new event.
164 */ 215 */
165union fw_cdev_event { 216union fw_cdev_event {
166 struct fw_cdev_event_common common; 217 struct fw_cdev_event_common common;
167 struct fw_cdev_event_bus_reset bus_reset; 218 struct fw_cdev_event_bus_reset bus_reset;
168 struct fw_cdev_event_response response; 219 struct fw_cdev_event_response response;
169 struct fw_cdev_event_request request; 220 struct fw_cdev_event_request request;
170 struct fw_cdev_event_iso_interrupt iso_interrupt; 221 struct fw_cdev_event_iso_interrupt iso_interrupt;
222 struct fw_cdev_event_iso_resource iso_resource;
171}; 223};
172 224
173#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) 225/* available since kernel version 2.6.22 */
174#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) 226#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
175#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) 227#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
176#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) 228#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
177#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) 229#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
178#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) 230#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
179#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) 231#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
180#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) 232#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
233#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
234#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
235#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
236#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
237#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
181 238
182#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) 239/* available since kernel version 2.6.24 */
183#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) 240#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
184#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
185#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
186#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
187 241
188/* FW_CDEV_VERSION History 242/* available since kernel version 2.6.30 */
189 * 243#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
190 * 1 Feb 18, 2007: Initial version. 244#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
245#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
246#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
247#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
248#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
249#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
250
251/*
252 * FW_CDEV_VERSION History
253 * 1 (2.6.22) - initial version
254 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
255 * &fw_cdev_create_iso_context.header_size is 8 or more
191 */ 256 */
192#define FW_CDEV_VERSION 1 257#define FW_CDEV_VERSION 2
193 258
194/** 259/**
195 * struct fw_cdev_get_info - General purpose information ioctl 260 * struct fw_cdev_get_info - General purpose information ioctl
@@ -201,7 +266,7 @@ union fw_cdev_event {
201 * case, @rom_length is updated with the actual length of the 266 * case, @rom_length is updated with the actual length of the
202 * configuration ROM. 267 * configuration ROM.
203 * @rom: If non-zero, address of a buffer to be filled by a copy of the 268 * @rom: If non-zero, address of a buffer to be filled by a copy of the
204 * local node's configuration ROM 269 * device's configuration ROM
205 * @bus_reset: If non-zero, address of a buffer to be filled by a 270 * @bus_reset: If non-zero, address of a buffer to be filled by a
206 * &struct fw_cdev_event_bus_reset with the current state 271 * &struct fw_cdev_event_bus_reset with the current state
207 * of the bus. This does not cause a bus reset to happen. 272 * of the bus. This does not cause a bus reset to happen.
@@ -229,7 +294,7 @@ struct fw_cdev_get_info {
229 * Send a request to the device. This ioctl implements all outgoing requests. 294 * Send a request to the device. This ioctl implements all outgoing requests.
230 * Both quadlet and block request specify the payload as a pointer to the data 295 * Both quadlet and block request specify the payload as a pointer to the data
231 * in the @data field. Once the transaction completes, the kernel writes an 296 * in the @data field. Once the transaction completes, the kernel writes an
232 * &fw_cdev_event_request event back. The @closure field is passed back to 297 * &fw_cdev_event_response event back. The @closure field is passed back to
233 * user space in the response event. 298 * user space in the response event.
234 */ 299 */
235struct fw_cdev_send_request { 300struct fw_cdev_send_request {
@@ -284,9 +349,9 @@ struct fw_cdev_allocate {
284}; 349};
285 350
286/** 351/**
287 * struct fw_cdev_deallocate - Free an address range allocation 352 * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
288 * @handle: Handle to the address range, as returned by the kernel when the 353 * @handle: Handle to the address range or iso resource, as returned by the
289 * range was allocated 354 * kernel when the range or resource was allocated
290 */ 355 */
291struct fw_cdev_deallocate { 356struct fw_cdev_deallocate {
292 __u32 handle; 357 __u32 handle;
@@ -329,6 +394,9 @@ struct fw_cdev_initiate_bus_reset {
329 * If successful, the kernel adds the descriptor and writes back a handle to the 394 * If successful, the kernel adds the descriptor and writes back a handle to the
330 * kernel-side object to be used for later removal of the descriptor block and 395 * kernel-side object to be used for later removal of the descriptor block and
331 * immediate key. 396 * immediate key.
397 *
398 * This ioctl affects the configuration ROMs of all local nodes.
399 * The ioctl only succeeds on device files which represent a local node.
332 */ 400 */
333struct fw_cdev_add_descriptor { 401struct fw_cdev_add_descriptor {
334 __u32 immediate; 402 __u32 immediate;
@@ -344,7 +412,7 @@ struct fw_cdev_add_descriptor {
344 * descriptor was added 412 * descriptor was added
345 * 413 *
346 * Remove a descriptor block and accompanying immediate key from the local 414 * Remove a descriptor block and accompanying immediate key from the local
347 * node's configuration ROM. 415 * nodes' configuration ROMs.
348 */ 416 */
349struct fw_cdev_remove_descriptor { 417struct fw_cdev_remove_descriptor {
350 __u32 handle; 418 __u32 handle;
@@ -370,6 +438,9 @@ struct fw_cdev_remove_descriptor {
370 * 438 *
371 * If a context was successfully created, the kernel writes back a handle to the 439 * If a context was successfully created, the kernel writes back a handle to the
372 * context, which must be passed in for subsequent operations on that context. 440 * context, which must be passed in for subsequent operations on that context.
441 *
442 * Note that the effect of a @header_size > 4 depends on
443 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
373 */ 444 */
374struct fw_cdev_create_iso_context { 445struct fw_cdev_create_iso_context {
375 __u32 type; 446 __u32 type;
@@ -473,10 +544,91 @@ struct fw_cdev_stop_iso {
473 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 544 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
474 * and also the system clock. This allows to express the receive time of an 545 * and also the system clock. This allows to express the receive time of an
475 * isochronous packet as a system time with microsecond accuracy. 546 * isochronous packet as a system time with microsecond accuracy.
547 *
548 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
549 * 12 bits cycleOffset, in host byte order.
476 */ 550 */
477struct fw_cdev_get_cycle_timer { 551struct fw_cdev_get_cycle_timer {
478 __u64 local_time; 552 __u64 local_time;
479 __u32 cycle_timer; 553 __u32 cycle_timer;
480}; 554};
481 555
556/**
557 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
558 * @closure: Passed back to userspace in correponding iso resource events
559 * @channels: Isochronous channels of which one is to be (de)allocated
560 * @bandwidth: Isochronous bandwidth units to be (de)allocated
561 * @handle: Handle to the allocation, written by the kernel (only valid in
562 * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
563 *
564 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
565 * isochronous channel and/or of isochronous bandwidth at the isochronous
566 * resource manager (IRM). Only one of the channels specified in @channels is
567 * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
568 * communication with the IRM, indicating success or failure in the event data.
569 * The kernel will automatically reallocate the resources after bus resets.
570 * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
571 * will be sent. The kernel will also automatically deallocate the resources
572 * when the file descriptor is closed.
573 *
574 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
575 * deallocation of resources which were allocated as described above.
576 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
577 *
578 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
579 * without automatic re- or deallocation.
580 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
581 * indicating success or failure in its data.
582 *
583 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
584 * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
585 * instead of allocated.
586 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
587 *
588 * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources
589 * for the lifetime of the fd or handle.
590 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
591 * for the duration of a bus generation.
592 *
593 * @channels is a host-endian bitfield with the least significant bit
594 * representing channel 0 and the most significant bit representing channel 63:
595 * 1ULL << c for each channel c that is a candidate for (de)allocation.
596 *
597 * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
598 * one quadlet of data (payload or header data) at speed S1600.
599 */
600struct fw_cdev_allocate_iso_resource {
601 __u64 closure;
602 __u64 channels;
603 __u32 bandwidth;
604 __u32 handle;
605};
606
607/**
608 * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
609 * @length: Length of outgoing payload, in bytes
610 * @tag: Data format tag
611 * @channel: Isochronous channel to transmit to
612 * @sy: Synchronization code
613 * @closure: Passed back to userspace in the response event
614 * @data: Userspace pointer to payload
615 * @generation: The bus generation where packet is valid
616 * @speed: Speed to transmit at
617 *
618 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
619 * to every device which is listening to the specified channel. The kernel
620 * writes an &fw_cdev_event_response event which indicates success or failure of
621 * the transmission.
622 */
623struct fw_cdev_send_stream_packet {
624 __u32 length;
625 __u32 tag;
626 __u32 channel;
627 __u32 sy;
628 __u64 closure;
629 __u64 data;
630 __u32 generation;
631 __u32 speed;
632};
633
482#endif /* _LINUX_FIREWIRE_CDEV_H */ 634#endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 92734c0012e6..562d2855cf30 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -95,8 +95,12 @@ struct inodes_stat_t {
95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
97#define READ_META (READ | (1 << BIO_RW_META)) 97#define READ_META (READ | (1 << BIO_RW_META))
98#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 98#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
99#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 99#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
101#define SWRITE_SYNC_PLUG \
102 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
103#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 104#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
101#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 105#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
102#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 106#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
@@ -141,6 +145,7 @@ struct inodes_stat_t {
141#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 145#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
142#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 146#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
143#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 147#define MS_I_VERSION (1<<23) /* Update inode I_version field */
148#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
144#define MS_ACTIVE (1<<30) 149#define MS_ACTIVE (1<<30)
145#define MS_NOUSER (1<<31) 150#define MS_NOUSER (1<<31)
146 151
@@ -848,6 +853,7 @@ struct file {
848#define f_dentry f_path.dentry 853#define f_dentry f_path.dentry
849#define f_vfsmnt f_path.mnt 854#define f_vfsmnt f_path.mnt
850 const struct file_operations *f_op; 855 const struct file_operations *f_op;
856 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
851 atomic_long_t f_count; 857 atomic_long_t f_count;
852 unsigned int f_flags; 858 unsigned int f_flags;
853 fmode_t f_mode; 859 fmode_t f_mode;
@@ -866,7 +872,6 @@ struct file {
866#ifdef CONFIG_EPOLL 872#ifdef CONFIG_EPOLL
867 /* Used by fs/eventpoll.c to link all the hooks to this file */ 873 /* Used by fs/eventpoll.c to link all the hooks to this file */
868 struct list_head f_ep_links; 874 struct list_head f_ep_links;
869 spinlock_t f_ep_lock;
870#endif /* #ifdef CONFIG_EPOLL */ 875#endif /* #ifdef CONFIG_EPOLL */
871 struct address_space *f_mapping; 876 struct address_space *f_mapping;
872#ifdef CONFIG_DEBUG_WRITECOUNT 877#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1063,34 +1068,147 @@ extern int lease_modify(struct file_lock **, int);
1063extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1068extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1064extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1069extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1065#else /* !CONFIG_FILE_LOCKING */ 1070#else /* !CONFIG_FILE_LOCKING */
1066#define fcntl_getlk(a, b) ({ -EINVAL; }) 1071static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1067#define fcntl_setlk(a, b, c, d) ({ -EACCES; }) 1072{
1073 return -EINVAL;
1074}
1075
1076static inline int fcntl_setlk(unsigned int fd, struct file *file,
1077 unsigned int cmd, struct flock __user *user)
1078{
1079 return -EACCES;
1080}
1081
1068#if BITS_PER_LONG == 32 1082#if BITS_PER_LONG == 32
1069#define fcntl_getlk64(a, b) ({ -EINVAL; }) 1083static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user)
1070#define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) 1084{
1085 return -EINVAL;
1086}
1087
1088static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1089 unsigned int cmd, struct flock64 __user *user)
1090{
1091 return -EACCES;
1092}
1071#endif 1093#endif
1072#define fcntl_setlease(a, b, c) ({ 0; }) 1094static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1073#define fcntl_getlease(a) ({ 0; }) 1095{
1074#define locks_init_lock(a) ({ }) 1096 return 0;
1075#define __locks_copy_lock(a, b) ({ }) 1097}
1076#define locks_copy_lock(a, b) ({ }) 1098
1077#define locks_remove_posix(a, b) ({ }) 1099static inline int fcntl_getlease(struct file *filp)
1078#define locks_remove_flock(a) ({ }) 1100{
1079#define posix_test_lock(a, b) ({ 0; }) 1101 return 0;
1080#define posix_lock_file(a, b, c) ({ -ENOLCK; }) 1102}
1081#define posix_lock_file_wait(a, b) ({ -ENOLCK; }) 1103
1082#define posix_unblock_lock(a, b) (-ENOENT) 1104static inline void locks_init_lock(struct file_lock *fl)
1083#define vfs_test_lock(a, b) ({ 0; }) 1105{
1084#define vfs_lock_file(a, b, c, d) (-ENOLCK) 1106 return;
1085#define vfs_cancel_lock(a, b) ({ 0; }) 1107}
1086#define flock_lock_file_wait(a, b) ({ -ENOLCK; }) 1108
1087#define __break_lease(a, b) ({ 0; }) 1109static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1088#define lease_get_mtime(a, b) ({ }) 1110{
1089#define generic_setlease(a, b, c) ({ -EINVAL; }) 1111 return;
1090#define vfs_setlease(a, b, c) ({ -EINVAL; }) 1112}
1091#define lease_modify(a, b) ({ -EINVAL; }) 1113
1092#define lock_may_read(a, b, c) ({ 1; }) 1114static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1093#define lock_may_write(a, b, c) ({ 1; }) 1115{
1116 return;
1117}
1118
1119static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
1120{
1121 return;
1122}
1123
1124static inline void locks_remove_flock(struct file *filp)
1125{
1126 return;
1127}
1128
1129static inline void posix_test_lock(struct file *filp, struct file_lock *fl)
1130{
1131 return;
1132}
1133
1134static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
1135 struct file_lock *conflock)
1136{
1137 return -ENOLCK;
1138}
1139
1140static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1141{
1142 return -ENOLCK;
1143}
1144
1145static inline int posix_unblock_lock(struct file *filp,
1146 struct file_lock *waiter)
1147{
1148 return -ENOENT;
1149}
1150
1151static inline int vfs_test_lock(struct file *filp, struct file_lock *fl)
1152{
1153 return 0;
1154}
1155
1156static inline int vfs_lock_file(struct file *filp, unsigned int cmd,
1157 struct file_lock *fl, struct file_lock *conf)
1158{
1159 return -ENOLCK;
1160}
1161
1162static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
1163{
1164 return 0;
1165}
1166
1167static inline int flock_lock_file_wait(struct file *filp,
1168 struct file_lock *request)
1169{
1170 return -ENOLCK;
1171}
1172
1173static inline int __break_lease(struct inode *inode, unsigned int mode)
1174{
1175 return 0;
1176}
1177
1178static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1179{
1180 return;
1181}
1182
1183static inline int generic_setlease(struct file *filp, long arg,
1184 struct file_lock **flp)
1185{
1186 return -EINVAL;
1187}
1188
1189static inline int vfs_setlease(struct file *filp, long arg,
1190 struct file_lock **lease)
1191{
1192 return -EINVAL;
1193}
1194
1195static inline int lease_modify(struct file_lock **before, int arg)
1196{
1197 return -EINVAL;
1198}
1199
1200static inline int lock_may_read(struct inode *inode, loff_t start,
1201 unsigned long len)
1202{
1203 return 1;
1204}
1205
1206static inline int lock_may_write(struct inode *inode, loff_t start,
1207 unsigned long len)
1208{
1209 return 1;
1210}
1211
1094#endif /* !CONFIG_FILE_LOCKING */ 1212#endif /* !CONFIG_FILE_LOCKING */
1095 1213
1096 1214
@@ -1581,6 +1699,9 @@ struct file_system_type {
1581 struct lock_class_key i_alloc_sem_key; 1699 struct lock_class_key i_alloc_sem_key;
1582}; 1700};
1583 1701
1702extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
1703 int (*fill_super)(struct super_block *, void *, int),
1704 struct vfsmount *mnt);
1584extern int get_sb_bdev(struct file_system_type *fs_type, 1705extern int get_sb_bdev(struct file_system_type *fs_type,
1585 int flags, const char *dev_name, void *data, 1706 int flags, const char *dev_name, void *data,
1586 int (*fill_super)(struct super_block *, void *, int), 1707 int (*fill_super)(struct super_block *, void *, int),
@@ -1606,7 +1727,7 @@ struct super_block *sget(struct file_system_type *type,
1606extern int get_sb_pseudo(struct file_system_type *, char *, 1727extern int get_sb_pseudo(struct file_system_type *, char *,
1607 const struct super_operations *ops, unsigned long, 1728 const struct super_operations *ops, unsigned long,
1608 struct vfsmount *mnt); 1729 struct vfsmount *mnt);
1609extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1730extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1610int __put_super_and_need_restart(struct super_block *sb); 1731int __put_super_and_need_restart(struct super_block *sb);
1611 1732
1612/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1733/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
@@ -1627,6 +1748,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1627 1748
1628extern int vfs_statfs(struct dentry *, struct kstatfs *); 1749extern int vfs_statfs(struct dentry *, struct kstatfs *);
1629 1750
1751extern int current_umask(void);
1752
1630/* /sys/fs */ 1753/* /sys/fs */
1631extern struct kobject *fs_kobj; 1754extern struct kobject *fs_kobj;
1632 1755
@@ -1687,13 +1810,44 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1687 return 0; 1810 return 0;
1688} 1811}
1689#else /* !CONFIG_FILE_LOCKING */ 1812#else /* !CONFIG_FILE_LOCKING */
1690#define locks_mandatory_locked(a) ({ 0; }) 1813static inline int locks_mandatory_locked(struct inode *inode)
1691#define locks_mandatory_area(a, b, c, d, e) ({ 0; }) 1814{
1692#define __mandatory_lock(a) ({ 0; }) 1815 return 0;
1693#define mandatory_lock(a) ({ 0; }) 1816}
1694#define locks_verify_locked(a) ({ 0; }) 1817
1695#define locks_verify_truncate(a, b, c) ({ 0; }) 1818static inline int locks_mandatory_area(int rw, struct inode *inode,
1696#define break_lease(a, b) ({ 0; }) 1819 struct file *filp, loff_t offset,
1820 size_t count)
1821{
1822 return 0;
1823}
1824
1825static inline int __mandatory_lock(struct inode *inode)
1826{
1827 return 0;
1828}
1829
1830static inline int mandatory_lock(struct inode *inode)
1831{
1832 return 0;
1833}
1834
1835static inline int locks_verify_locked(struct inode *inode)
1836{
1837 return 0;
1838}
1839
1840static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
1841 size_t size)
1842{
1843 return 0;
1844}
1845
1846static inline int break_lease(struct inode *inode, unsigned int mode)
1847{
1848 return 0;
1849}
1850
1697#endif /* CONFIG_FILE_LOCKING */ 1851#endif /* CONFIG_FILE_LOCKING */
1698 1852
1699/* fs/open.c */ 1853/* fs/open.c */
@@ -1730,8 +1884,28 @@ extern void bd_set_size(struct block_device *, loff_t size);
1730extern void bd_forget(struct inode *inode); 1884extern void bd_forget(struct inode *inode);
1731extern void bdput(struct block_device *); 1885extern void bdput(struct block_device *);
1732extern struct block_device *open_by_devnum(dev_t, fmode_t); 1886extern struct block_device *open_by_devnum(dev_t, fmode_t);
1887extern void invalidate_bdev(struct block_device *);
1888extern int sync_blockdev(struct block_device *bdev);
1889extern struct super_block *freeze_bdev(struct block_device *);
1890extern void emergency_thaw_all(void);
1891extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
1892extern int fsync_bdev(struct block_device *);
1893extern int fsync_super(struct super_block *);
1894extern int fsync_no_super(struct block_device *);
1733#else 1895#else
1734static inline void bd_forget(struct inode *inode) {} 1896static inline void bd_forget(struct inode *inode) {}
1897static inline int sync_blockdev(struct block_device *bdev) { return 0; }
1898static inline void invalidate_bdev(struct block_device *bdev) {}
1899
1900static inline struct super_block *freeze_bdev(struct block_device *sb)
1901{
1902 return NULL;
1903}
1904
1905static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
1906{
1907 return 0;
1908}
1735#endif 1909#endif
1736extern const struct file_operations def_blk_fops; 1910extern const struct file_operations def_blk_fops;
1737extern const struct file_operations def_chr_fops; 1911extern const struct file_operations def_chr_fops;
@@ -1881,7 +2055,6 @@ static inline void allow_write_access(struct file *file)
1881 if (file) 2055 if (file)
1882 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2056 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
1883} 2057}
1884extern int do_pipe(int *);
1885extern int do_pipe_flags(int *, int); 2058extern int do_pipe_flags(int *, int);
1886extern struct file *create_read_pipe(struct file *f, int flags); 2059extern struct file *create_read_pipe(struct file *f, int flags);
1887extern struct file *create_write_pipe(int flags); 2060extern struct file *create_write_pipe(int flags);
@@ -2171,19 +2344,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
2171 size_t size, loff_t *pos); 2344 size_t size, loff_t *pos);
2172int simple_transaction_release(struct inode *inode, struct file *file); 2345int simple_transaction_release(struct inode *inode, struct file *file);
2173 2346
2174static inline void simple_transaction_set(struct file *file, size_t n) 2347void simple_transaction_set(struct file *file, size_t n);
2175{
2176 struct simple_transaction_argresp *ar = file->private_data;
2177
2178 BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
2179
2180 /*
2181 * The barrier ensures that ar->size will really remain zero until
2182 * ar->data is ready for reading.
2183 */
2184 smp_mb();
2185 ar->size = n;
2186}
2187 2348
2188/* 2349/*
2189 * simple attribute files 2350 * simple attribute files
@@ -2230,27 +2391,6 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
2230ssize_t simple_attr_write(struct file *file, const char __user *buf, 2391ssize_t simple_attr_write(struct file *file, const char __user *buf,
2231 size_t len, loff_t *ppos); 2392 size_t len, loff_t *ppos);
2232 2393
2233
2234#ifdef CONFIG_SECURITY
2235static inline char *alloc_secdata(void)
2236{
2237 return (char *)get_zeroed_page(GFP_KERNEL);
2238}
2239
2240static inline void free_secdata(void *secdata)
2241{
2242 free_page((unsigned long)secdata);
2243}
2244#else
2245static inline char *alloc_secdata(void)
2246{
2247 return (char *)1;
2248}
2249
2250static inline void free_secdata(void *secdata)
2251{ }
2252#endif /* CONFIG_SECURITY */
2253
2254struct ctl_table; 2394struct ctl_table;
2255int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2395int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2256 void __user *buffer, size_t *lenp, loff_t *ppos); 2396 void __user *buffer, size_t *lenp, loff_t *ppos);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index a97c053d3a9a..78a05bfcd8eb 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -4,9 +4,10 @@
4#include <linux/path.h> 4#include <linux/path.h>
5 5
6struct fs_struct { 6struct fs_struct {
7 atomic_t count; 7 int users;
8 rwlock_t lock; 8 rwlock_t lock;
9 int umask; 9 int umask;
10 int in_exec;
10 struct path root, pwd; 11 struct path root, pwd;
11}; 12};
12 13
@@ -16,6 +17,8 @@ extern void exit_fs(struct task_struct *);
16extern void set_fs_root(struct fs_struct *, struct path *); 17extern void set_fs_root(struct fs_struct *, struct path *);
17extern void set_fs_pwd(struct fs_struct *, struct path *); 18extern void set_fs_pwd(struct fs_struct *, struct path *);
18extern struct fs_struct *copy_fs_struct(struct fs_struct *); 19extern struct fs_struct *copy_fs_struct(struct fs_struct *);
19extern void put_fs_struct(struct fs_struct *); 20extern void free_fs_struct(struct fs_struct *);
21extern void daemonize_fs_struct(void);
22extern int unshare_fs_struct(void);
20 23
21#endif /* _LINUX_FS_STRUCT_H */ 24#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
new file mode 100644
index 000000000000..84d3532dd3ea
--- /dev/null
+++ b/include/linux/fscache-cache.h
@@ -0,0 +1,505 @@
1/* General filesystem caching backing cache interface
2 *
3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * NOTE!!! See:
12 *
13 * Documentation/filesystems/caching/backend-api.txt
14 *
15 * for a description of the cache backend interface declared here.
16 */
17
18#ifndef _LINUX_FSCACHE_CACHE_H
19#define _LINUX_FSCACHE_CACHE_H
20
21#include <linux/fscache.h>
22#include <linux/sched.h>
23#include <linux/slow-work.h>
24
25#define NR_MAXCACHES BITS_PER_LONG
26
27struct fscache_cache;
28struct fscache_cache_ops;
29struct fscache_object;
30struct fscache_operation;
31
32/*
33 * cache tag definition
34 */
35struct fscache_cache_tag {
36 struct list_head link;
37 struct fscache_cache *cache; /* cache referred to by this tag */
38 unsigned long flags;
39#define FSCACHE_TAG_RESERVED 0 /* T if tag is reserved for a cache */
40 atomic_t usage;
41 char name[0]; /* tag name */
42};
43
44/*
45 * cache definition
46 */
47struct fscache_cache {
48 const struct fscache_cache_ops *ops;
49 struct fscache_cache_tag *tag; /* tag representing this cache */
50 struct kobject *kobj; /* system representation of this cache */
51 struct list_head link; /* link in list of caches */
52 size_t max_index_size; /* maximum size of index data */
53 char identifier[36]; /* cache label */
54
55 /* node management */
56 struct work_struct op_gc; /* operation garbage collector */
57 struct list_head object_list; /* list of data/index objects */
58 struct list_head op_gc_list; /* list of ops to be deleted */
59 spinlock_t object_list_lock;
60 spinlock_t op_gc_list_lock;
61 atomic_t object_count; /* no. of live objects in this cache */
62 struct fscache_object *fsdef; /* object for the fsdef index */
63 unsigned long flags;
64#define FSCACHE_IOERROR 0 /* cache stopped on I/O error */
65#define FSCACHE_CACHE_WITHDRAWN 1 /* cache has been withdrawn */
66};
67
68extern wait_queue_head_t fscache_cache_cleared_wq;
69
70/*
71 * operation to be applied to a cache object
72 * - retrieval initiation operations are done in the context of the process
73 * that issued them, and not in an async thread pool
74 */
75typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77
78struct fscache_operation {
79 union {
80 struct work_struct fast_work; /* record for fast ops */
81 struct slow_work slow_work; /* record for (very) slow ops */
82 };
83 struct list_head pend_link; /* link in object->pending_ops */
84 struct fscache_object *object; /* object to be operated upon */
85
86 unsigned long flags;
87#define FSCACHE_OP_TYPE 0x000f /* operation type */
88#define FSCACHE_OP_FAST 0x0001 /* - fast op, processor may not sleep for disk */
89#define FSCACHE_OP_SLOW 0x0002 /* - (very) slow op, processor may sleep for disk */
90#define FSCACHE_OP_MYTHREAD 0x0003 /* - processing is done be issuing thread, not pool */
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */
94
95 atomic_t usage;
96 unsigned debug_id; /* debugging ID */
97
98 /* operation processor callback
99 * - can be NULL if FSCACHE_OP_WAITING is going to be used to perform
100 * the op in a non-pool thread */
101 fscache_operation_processor_t processor;
102
103 /* operation releaser */
104 fscache_operation_release_t release;
105};
106
107extern atomic_t fscache_op_debug_id;
108extern const struct slow_work_ops fscache_op_slow_work_ops;
109
110extern void fscache_enqueue_operation(struct fscache_operation *);
111extern void fscache_put_operation(struct fscache_operation *);
112
113/**
114 * fscache_operation_init - Do basic initialisation of an operation
115 * @op: The operation to initialise
116 * @release: The release function to assign
117 *
118 * Do basic initialisation of an operation. The caller must still set flags,
119 * object, either fast_work or slow_work if necessary, and processor if needed.
120 */
121static inline void fscache_operation_init(struct fscache_operation *op,
122 fscache_operation_release_t release)
123{
124 atomic_set(&op->usage, 1);
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->release = release;
127 INIT_LIST_HEAD(&op->pend_link);
128}
129
130/**
131 * fscache_operation_init_slow - Do additional initialisation of a slow op
132 * @op: The operation to initialise
133 * @processor: The processor function to assign
134 *
135 * Do additional initialisation of an operation as required for slow work.
136 */
137static inline
138void fscache_operation_init_slow(struct fscache_operation *op,
139 fscache_operation_processor_t processor)
140{
141 op->processor = processor;
142 slow_work_init(&op->slow_work, &fscache_op_slow_work_ops);
143}
144
145/*
146 * data read operation
147 */
148struct fscache_retrieval {
149 struct fscache_operation op;
150 struct address_space *mapping; /* netfs pages */
151 fscache_rw_complete_t end_io_func; /* function to call on I/O completion */
152 void *context; /* netfs read context (pinned) */
153 struct list_head to_do; /* list of things to be done by the backend */
154 unsigned long start_time; /* time at which retrieval started */
155};
156
157typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
158 struct page *page,
159 gfp_t gfp);
160
161typedef int (*fscache_pages_retrieval_func_t)(struct fscache_retrieval *op,
162 struct list_head *pages,
163 unsigned *nr_pages,
164 gfp_t gfp);
165
166/**
167 * fscache_get_retrieval - Get an extra reference on a retrieval operation
168 * @op: The retrieval operation to get a reference on
169 *
170 * Get an extra reference on a retrieval operation.
171 */
172static inline
173struct fscache_retrieval *fscache_get_retrieval(struct fscache_retrieval *op)
174{
175 atomic_inc(&op->op.usage);
176 return op;
177}
178
179/**
180 * fscache_enqueue_retrieval - Enqueue a retrieval operation for processing
181 * @op: The retrieval operation affected
182 *
183 * Enqueue a retrieval operation for processing by the FS-Cache thread pool.
184 */
185static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
186{
187 fscache_enqueue_operation(&op->op);
188}
189
190/**
191 * fscache_put_retrieval - Drop a reference to a retrieval operation
192 * @op: The retrieval operation affected
193 *
194 * Drop a reference to a retrieval operation.
195 */
196static inline void fscache_put_retrieval(struct fscache_retrieval *op)
197{
198 fscache_put_operation(&op->op);
199}
200
201/*
202 * cached page storage work item
203 * - used to do three things:
204 * - batch writes to the cache
205 * - do cache writes asynchronously
206 * - defer writes until cache object lookup completion
207 */
208struct fscache_storage {
209 struct fscache_operation op;
210 pgoff_t store_limit; /* don't write more than this */
211};
212
213/*
214 * cache operations
215 */
216struct fscache_cache_ops {
217 /* name of cache provider */
218 const char *name;
219
220 /* allocate an object record for a cookie */
221 struct fscache_object *(*alloc_object)(struct fscache_cache *cache,
222 struct fscache_cookie *cookie);
223
224 /* look up the object for a cookie */
225 void (*lookup_object)(struct fscache_object *object);
226
227 /* finished looking up */
228 void (*lookup_complete)(struct fscache_object *object);
229
230 /* increment the usage count on this object (may fail if unmounting) */
231 struct fscache_object *(*grab_object)(struct fscache_object *object);
232
233 /* pin an object in the cache */
234 int (*pin_object)(struct fscache_object *object);
235
236 /* unpin an object in the cache */
237 void (*unpin_object)(struct fscache_object *object);
238
239 /* store the updated auxilliary data on an object */
240 void (*update_object)(struct fscache_object *object);
241
242 /* discard the resources pinned by an object and effect retirement if
243 * necessary */
244 void (*drop_object)(struct fscache_object *object);
245
246 /* dispose of a reference to an object */
247 void (*put_object)(struct fscache_object *object);
248
249 /* sync a cache */
250 void (*sync_cache)(struct fscache_cache *cache);
251
252 /* notification that the attributes of a non-index object (such as
253 * i_size) have changed */
254 int (*attr_changed)(struct fscache_object *object);
255
256 /* reserve space for an object's data and associated metadata */
257 int (*reserve_space)(struct fscache_object *object, loff_t i_size);
258
259 /* request a backing block for a page be read or allocated in the
260 * cache */
261 fscache_page_retrieval_func_t read_or_alloc_page;
262
263 /* request backing blocks for a list of pages be read or allocated in
264 * the cache */
265 fscache_pages_retrieval_func_t read_or_alloc_pages;
266
267 /* request a backing block for a page be allocated in the cache so that
268 * it can be written directly */
269 fscache_page_retrieval_func_t allocate_page;
270
271 /* request backing blocks for pages be allocated in the cache so that
272 * they can be written directly */
273 fscache_pages_retrieval_func_t allocate_pages;
274
275 /* write a page to its backing block in the cache */
276 int (*write_page)(struct fscache_storage *op, struct page *page);
277
278 /* detach backing block from a page (optional)
279 * - must release the cookie lock before returning
280 * - may sleep
281 */
282 void (*uncache_page)(struct fscache_object *object,
283 struct page *page);
284
285 /* dissociate a cache from all the pages it was backing */
286 void (*dissociate_pages)(struct fscache_cache *cache);
287};
288
289/*
290 * data file or index object cookie
291 * - a file will only appear in one cache
292 * - a request to cache a file may or may not be honoured, subject to
293 * constraints such as disk space
294 * - indices are created on disk just-in-time
295 */
296struct fscache_cookie {
297 atomic_t usage; /* number of users of this cookie */
298 atomic_t n_children; /* number of children of this cookie */
299 spinlock_t lock;
300 struct hlist_head backing_objects; /* object(s) backing this file/index */
301 const struct fscache_cookie_def *def; /* definition */
302 struct fscache_cookie *parent; /* parent of this entry */
303 void *netfs_data; /* back pointer to netfs */
304 struct radix_tree_root stores; /* pages to be stored on this cookie */
305#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
306
307 unsigned long flags;
308#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
309#define FSCACHE_COOKIE_CREATING 1 /* T if non-index object being created still */
310#define FSCACHE_COOKIE_NO_DATA_YET 2 /* T if new object with no cached data yet */
311#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */
312#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */
313#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */
314};
315
316extern struct fscache_cookie fscache_fsdef_index;
317
318/*
319 * on-disk cache file or index handle
320 */
321struct fscache_object {
322 enum fscache_object_state {
323 FSCACHE_OBJECT_INIT, /* object in initial unbound state */
324 FSCACHE_OBJECT_LOOKING_UP, /* looking up object */
325 FSCACHE_OBJECT_CREATING, /* creating object */
326
327 /* active states */
328 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
329 FSCACHE_OBJECT_ACTIVE, /* object is usable */
330 FSCACHE_OBJECT_UPDATING, /* object is updating */
331
332 /* terminal states */
333 FSCACHE_OBJECT_DYING, /* object waiting for accessors to finish */
334 FSCACHE_OBJECT_LC_DYING, /* object cleaning up after lookup/create */
335 FSCACHE_OBJECT_ABORT_INIT, /* abort the init state */
336 FSCACHE_OBJECT_RELEASING, /* releasing object */
337 FSCACHE_OBJECT_RECYCLING, /* retiring object */
338 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
339 FSCACHE_OBJECT_DEAD, /* object is now dead */
340 } state;
341
342 int debug_id; /* debugging ID */
343 int n_children; /* number of child objects */
344 int n_ops; /* number of ops outstanding on object */
345 int n_obj_ops; /* number of object ops outstanding on object */
346 int n_in_progress; /* number of ops in progress */
347 int n_exclusive; /* number of exclusive ops queued */
348 spinlock_t lock; /* state and operations lock */
349
350 unsigned long lookup_jif; /* time at which lookup started */
351 unsigned long event_mask; /* events this object is interested in */
352 unsigned long events; /* events to be processed by this object
353 * (order is important - using fls) */
354#define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */
355#define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */
356#define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */
357#define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */
358#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
359#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
360#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
361
362 unsigned long flags;
363#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
364#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */
365#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */
366
367 struct list_head cache_link; /* link in cache->object_list */
368 struct hlist_node cookie_link; /* link in cookie->backing_objects */
369 struct fscache_cache *cache; /* cache that supplied this object */
370 struct fscache_cookie *cookie; /* netfs's file/index object */
371 struct fscache_object *parent; /* parent object */
372 struct slow_work work; /* attention scheduling record */
373 struct list_head dependents; /* FIFO of dependent objects */
374 struct list_head dep_link; /* link in parent's dependents list */
375 struct list_head pending_ops; /* unstarted operations on this object */
376 pgoff_t store_limit; /* current storage limit */
377};
378
379extern const char *fscache_object_states[];
380
381#define fscache_object_is_active(obj) \
382 (!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
383 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
384 (obj)->state < FSCACHE_OBJECT_DYING)
385
386extern const struct slow_work_ops fscache_object_slow_work_ops;
387
388/**
389 * fscache_object_init - Initialise a cache object description
390 * @object: Object description
391 *
392 * Initialise a cache object description to its basic values.
393 *
394 * See Documentation/filesystems/caching/backend-api.txt for a complete
395 * description.
396 */
397static inline
398void fscache_object_init(struct fscache_object *object,
399 struct fscache_cookie *cookie,
400 struct fscache_cache *cache)
401{
402 atomic_inc(&cache->object_count);
403
404 object->state = FSCACHE_OBJECT_INIT;
405 spin_lock_init(&object->lock);
406 INIT_LIST_HEAD(&object->cache_link);
407 INIT_HLIST_NODE(&object->cookie_link);
408 vslow_work_init(&object->work, &fscache_object_slow_work_ops);
409 INIT_LIST_HEAD(&object->dependents);
410 INIT_LIST_HEAD(&object->dep_link);
411 INIT_LIST_HEAD(&object->pending_ops);
412 object->n_children = 0;
413 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
414 object->events = object->event_mask = 0;
415 object->flags = 0;
416 object->store_limit = 0;
417 object->cache = cache;
418 object->cookie = cookie;
419 object->parent = NULL;
420}
421
422extern void fscache_object_lookup_negative(struct fscache_object *object);
423extern void fscache_obtained_object(struct fscache_object *object);
424
425/**
426 * fscache_object_destroyed - Note destruction of an object in a cache
427 * @cache: The cache from which the object came
428 *
429 * Note the destruction and deallocation of an object record in a cache.
430 */
431static inline void fscache_object_destroyed(struct fscache_cache *cache)
432{
433 if (atomic_dec_and_test(&cache->object_count))
434 wake_up_all(&fscache_cache_cleared_wq);
435}
436
437/**
438 * fscache_object_lookup_error - Note an object encountered an error
439 * @object: The object on which the error was encountered
440 *
441 * Note that an object encountered a fatal error (usually an I/O error) and
442 * that it should be withdrawn as soon as possible.
443 */
444static inline void fscache_object_lookup_error(struct fscache_object *object)
445{
446 set_bit(FSCACHE_OBJECT_EV_ERROR, &object->events);
447}
448
449/**
450 * fscache_set_store_limit - Set the maximum size to be stored in an object
451 * @object: The object to set the maximum on
452 * @i_size: The limit to set in bytes
453 *
454 * Set the maximum size an object is permitted to reach, implying the highest
455 * byte that may be written. Intended to be called by the attr_changed() op.
456 *
457 * See Documentation/filesystems/caching/backend-api.txt for a complete
458 * description.
459 */
460static inline
461void fscache_set_store_limit(struct fscache_object *object, loff_t i_size)
462{
463 object->store_limit = i_size >> PAGE_SHIFT;
464 if (i_size & ~PAGE_MASK)
465 object->store_limit++;
466}
467
468/**
469 * fscache_end_io - End a retrieval operation on a page
470 * @op: The FS-Cache operation covering the retrieval
471 * @page: The page that was to be fetched
472 * @error: The error code (0 if successful)
473 *
474 * Note the end of an operation to retrieve a page, as covered by a particular
475 * operation record.
476 */
477static inline void fscache_end_io(struct fscache_retrieval *op,
478 struct page *page, int error)
479{
480 op->end_io_func(page, op->context, error);
481}
482
483/*
484 * out-of-line cache backend functions
485 */
486extern void fscache_init_cache(struct fscache_cache *cache,
487 const struct fscache_cache_ops *ops,
488 const char *idfmt,
489 ...) __attribute__ ((format (printf, 3, 4)));
490
491extern int fscache_add_cache(struct fscache_cache *cache,
492 struct fscache_object *fsdef,
493 const char *tagname);
494extern void fscache_withdraw_cache(struct fscache_cache *cache);
495
496extern void fscache_io_error(struct fscache_cache *cache);
497
498extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
499 struct pagevec *pagevec);
500
501extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object,
502 const void *data,
503 uint16_t datalen);
504
505#endif /* _LINUX_FSCACHE_CACHE_H */
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
new file mode 100644
index 000000000000..6d8ee466e0a0
--- /dev/null
+++ b/include/linux/fscache.h
@@ -0,0 +1,618 @@
1/* General filesystem caching interface
2 *
3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * NOTE!!! See:
12 *
13 * Documentation/filesystems/caching/netfs-api.txt
14 *
15 * for a description of the network filesystem interface declared here.
16 */
17
18#ifndef _LINUX_FSCACHE_H
19#define _LINUX_FSCACHE_H
20
21#include <linux/fs.h>
22#include <linux/list.h>
23#include <linux/pagemap.h>
24#include <linux/pagevec.h>
25
26#if defined(CONFIG_FSCACHE) || defined(CONFIG_FSCACHE_MODULE)
27#define fscache_available() (1)
28#define fscache_cookie_valid(cookie) (cookie)
29#else
30#define fscache_available() (0)
31#define fscache_cookie_valid(cookie) (0)
32#endif
33
34
35/*
36 * overload PG_private_2 to give us PG_fscache - this is used to indicate that
37 * a page is currently backed by a local disk cache
38 */
39#define PageFsCache(page) PagePrivate2((page))
40#define SetPageFsCache(page) SetPagePrivate2((page))
41#define ClearPageFsCache(page) ClearPagePrivate2((page))
42#define TestSetPageFsCache(page) TestSetPagePrivate2((page))
43#define TestClearPageFsCache(page) TestClearPagePrivate2((page))
44
45/* pattern used to fill dead space in an index entry */
46#define FSCACHE_INDEX_DEADFILL_PATTERN 0x79
47
48struct pagevec;
49struct fscache_cache_tag;
50struct fscache_cookie;
51struct fscache_netfs;
52
53typedef void (*fscache_rw_complete_t)(struct page *page,
54 void *context,
55 int error);
56
57/* result of index entry consultation */
58enum fscache_checkaux {
59 FSCACHE_CHECKAUX_OKAY, /* entry okay as is */
60 FSCACHE_CHECKAUX_NEEDS_UPDATE, /* entry requires update */
61 FSCACHE_CHECKAUX_OBSOLETE, /* entry requires deletion */
62};
63
64/*
65 * fscache cookie definition
66 */
67struct fscache_cookie_def {
68 /* name of cookie type */
69 char name[16];
70
71 /* cookie type */
72 uint8_t type;
73#define FSCACHE_COOKIE_TYPE_INDEX 0
74#define FSCACHE_COOKIE_TYPE_DATAFILE 1
75
76 /* select the cache into which to insert an entry in this index
77 * - optional
78 * - should return a cache identifier or NULL to cause the cache to be
79 * inherited from the parent if possible or the first cache picked
80 * for a non-index file if not
81 */
82 struct fscache_cache_tag *(*select_cache)(
83 const void *parent_netfs_data,
84 const void *cookie_netfs_data);
85
86 /* get an index key
87 * - should store the key data in the buffer
88 * - should return the amount of amount stored
89 * - not permitted to return an error
90 * - the netfs data from the cookie being used as the source is
91 * presented
92 */
93 uint16_t (*get_key)(const void *cookie_netfs_data,
94 void *buffer,
95 uint16_t bufmax);
96
97 /* get certain file attributes from the netfs data
98 * - this function can be absent for an index
99 * - not permitted to return an error
100 * - the netfs data from the cookie being used as the source is
101 * presented
102 */
103 void (*get_attr)(const void *cookie_netfs_data, uint64_t *size);
104
105 /* get the auxilliary data from netfs data
106 * - this function can be absent if the index carries no state data
107 * - should store the auxilliary data in the buffer
108 * - should return the amount of amount stored
109 * - not permitted to return an error
110 * - the netfs data from the cookie being used as the source is
111 * presented
112 */
113 uint16_t (*get_aux)(const void *cookie_netfs_data,
114 void *buffer,
115 uint16_t bufmax);
116
117 /* consult the netfs about the state of an object
118 * - this function can be absent if the index carries no state data
119 * - the netfs data from the cookie being used as the target is
120 * presented, as is the auxilliary data
121 */
122 enum fscache_checkaux (*check_aux)(void *cookie_netfs_data,
123 const void *data,
124 uint16_t datalen);
125
126 /* get an extra reference on a read context
127 * - this function can be absent if the completion function doesn't
128 * require a context
129 */
130 void (*get_context)(void *cookie_netfs_data, void *context);
131
132 /* release an extra reference on a read context
133 * - this function can be absent if the completion function doesn't
134 * require a context
135 */
136 void (*put_context)(void *cookie_netfs_data, void *context);
137
138 /* indicate pages that now have cache metadata retained
139 * - this function should mark the specified pages as now being cached
140 * - the pages will have been marked with PG_fscache before this is
141 * called, so this is optional
142 */
143 void (*mark_pages_cached)(void *cookie_netfs_data,
144 struct address_space *mapping,
145 struct pagevec *cached_pvec);
146
147 /* indicate the cookie is no longer cached
148 * - this function is called when the backing store currently caching
149 * a cookie is removed
150 * - the netfs should use this to clean up any markers indicating
151 * cached pages
152 * - this is mandatory for any object that may have data
153 */
154 void (*now_uncached)(void *cookie_netfs_data);
155};
156
157/*
158 * fscache cached network filesystem type
159 * - name, version and ops must be filled in before registration
160 * - all other fields will be set during registration
161 */
162struct fscache_netfs {
163 uint32_t version; /* indexing version */
164 const char *name; /* filesystem name */
165 struct fscache_cookie *primary_index;
166 struct list_head link; /* internal link */
167};
168
169/*
170 * slow-path functions for when there is actually caching available, and the
171 * netfs does actually have a valid token
172 * - these are not to be called directly
173 * - these are undefined symbols when FS-Cache is not configured and the
174 * optimiser takes care of not using them
175 */
176extern int __fscache_register_netfs(struct fscache_netfs *);
177extern void __fscache_unregister_netfs(struct fscache_netfs *);
178extern struct fscache_cache_tag *__fscache_lookup_cache_tag(const char *);
179extern void __fscache_release_cache_tag(struct fscache_cache_tag *);
180
181extern struct fscache_cookie *__fscache_acquire_cookie(
182 struct fscache_cookie *,
183 const struct fscache_cookie_def *,
184 void *);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *);
188extern int __fscache_read_or_alloc_page(struct fscache_cookie *,
189 struct page *,
190 fscache_rw_complete_t,
191 void *,
192 gfp_t);
193extern int __fscache_read_or_alloc_pages(struct fscache_cookie *,
194 struct address_space *,
195 struct list_head *,
196 unsigned *,
197 fscache_rw_complete_t,
198 void *,
199 gfp_t);
200extern int __fscache_alloc_page(struct fscache_cookie *, struct page *, gfp_t);
201extern int __fscache_write_page(struct fscache_cookie *, struct page *, gfp_t);
202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *);
203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
205
206/**
207 * fscache_register_netfs - Register a filesystem as desiring caching services
208 * @netfs: The description of the filesystem
209 *
210 * Register a filesystem as desiring caching services if they're available.
211 *
212 * See Documentation/filesystems/caching/netfs-api.txt for a complete
213 * description.
214 */
215static inline
216int fscache_register_netfs(struct fscache_netfs *netfs)
217{
218 if (fscache_available())
219 return __fscache_register_netfs(netfs);
220 else
221 return 0;
222}
223
224/**
225 * fscache_unregister_netfs - Indicate that a filesystem no longer desires
226 * caching services
227 * @netfs: The description of the filesystem
228 *
229 * Indicate that a filesystem no longer desires caching services for the
230 * moment.
231 *
232 * See Documentation/filesystems/caching/netfs-api.txt for a complete
233 * description.
234 */
235static inline
236void fscache_unregister_netfs(struct fscache_netfs *netfs)
237{
238 if (fscache_available())
239 __fscache_unregister_netfs(netfs);
240}
241
242/**
243 * fscache_lookup_cache_tag - Look up a cache tag
244 * @name: The name of the tag to search for
245 *
246 * Acquire a specific cache referral tag that can be used to select a specific
247 * cache in which to cache an index.
248 *
249 * See Documentation/filesystems/caching/netfs-api.txt for a complete
250 * description.
251 */
252static inline
253struct fscache_cache_tag *fscache_lookup_cache_tag(const char *name)
254{
255 if (fscache_available())
256 return __fscache_lookup_cache_tag(name);
257 else
258 return NULL;
259}
260
261/**
262 * fscache_release_cache_tag - Release a cache tag
263 * @tag: The tag to release
264 *
265 * Release a reference to a cache referral tag previously looked up.
266 *
267 * See Documentation/filesystems/caching/netfs-api.txt for a complete
268 * description.
269 */
270static inline
271void fscache_release_cache_tag(struct fscache_cache_tag *tag)
272{
273 if (fscache_available())
274 __fscache_release_cache_tag(tag);
275}
276
277/**
278 * fscache_acquire_cookie - Acquire a cookie to represent a cache object
279 * @parent: The cookie that's to be the parent of this one
280 * @def: A description of the cache object, including callback operations
281 * @netfs_data: An arbitrary piece of data to be kept in the cookie to
282 * represent the cache object to the netfs
283 *
284 * This function is used to inform FS-Cache about part of an index hierarchy
285 * that can be used to locate files. This is done by requesting a cookie for
286 * each index in the path to the file.
287 *
288 * See Documentation/filesystems/caching/netfs-api.txt for a complete
289 * description.
290 */
291static inline
292struct fscache_cookie *fscache_acquire_cookie(
293 struct fscache_cookie *parent,
294 const struct fscache_cookie_def *def,
295 void *netfs_data)
296{
297 if (fscache_cookie_valid(parent))
298 return __fscache_acquire_cookie(parent, def, netfs_data);
299 else
300 return NULL;
301}
302
303/**
304 * fscache_relinquish_cookie - Return the cookie to the cache, maybe discarding
305 * it
306 * @cookie: The cookie being returned
307 * @retire: True if the cache object the cookie represents is to be discarded
308 *
309 * This function returns a cookie to the cache, forcibly discarding the
310 * associated cache object if retire is set to true.
311 *
312 * See Documentation/filesystems/caching/netfs-api.txt for a complete
313 * description.
314 */
315static inline
316void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
317{
318 if (fscache_cookie_valid(cookie))
319 __fscache_relinquish_cookie(cookie, retire);
320}
321
322/**
323 * fscache_update_cookie - Request that a cache object be updated
324 * @cookie: The cookie representing the cache object
325 *
326 * Request an update of the index data for the cache object associated with the
327 * cookie.
328 *
329 * See Documentation/filesystems/caching/netfs-api.txt for a complete
330 * description.
331 */
332static inline
333void fscache_update_cookie(struct fscache_cookie *cookie)
334{
335 if (fscache_cookie_valid(cookie))
336 __fscache_update_cookie(cookie);
337}
338
339/**
340 * fscache_pin_cookie - Pin a data-storage cache object in its cache
341 * @cookie: The cookie representing the cache object
342 *
343 * Permit data-storage cache objects to be pinned in the cache.
344 *
345 * See Documentation/filesystems/caching/netfs-api.txt for a complete
346 * description.
347 */
348static inline
349int fscache_pin_cookie(struct fscache_cookie *cookie)
350{
351 return -ENOBUFS;
352}
353
354/**
355 * fscache_pin_cookie - Unpin a data-storage cache object in its cache
356 * @cookie: The cookie representing the cache object
357 *
358 * Permit data-storage cache objects to be unpinned from the cache.
359 *
360 * See Documentation/filesystems/caching/netfs-api.txt for a complete
361 * description.
362 */
363static inline
364void fscache_unpin_cookie(struct fscache_cookie *cookie)
365{
366}
367
368/**
369 * fscache_attr_changed - Notify cache that an object's attributes changed
370 * @cookie: The cookie representing the cache object
371 *
372 * Send a notification to the cache indicating that an object's attributes have
373 * changed. This includes the data size. These attributes will be obtained
374 * through the get_attr() cookie definition op.
375 *
376 * See Documentation/filesystems/caching/netfs-api.txt for a complete
377 * description.
378 */
379static inline
380int fscache_attr_changed(struct fscache_cookie *cookie)
381{
382 if (fscache_cookie_valid(cookie))
383 return __fscache_attr_changed(cookie);
384 else
385 return -ENOBUFS;
386}
387
388/**
389 * fscache_reserve_space - Reserve data space for a cached object
390 * @cookie: The cookie representing the cache object
391 * @i_size: The amount of space to be reserved
392 *
393 * Reserve an amount of space in the cache for the cache object attached to a
394 * cookie so that a write to that object within the space can always be
395 * honoured.
396 *
397 * See Documentation/filesystems/caching/netfs-api.txt for a complete
398 * description.
399 */
400static inline
401int fscache_reserve_space(struct fscache_cookie *cookie, loff_t size)
402{
403 return -ENOBUFS;
404}
405
406/**
407 * fscache_read_or_alloc_page - Read a page from the cache or allocate a block
408 * in which to store it
409 * @cookie: The cookie representing the cache object
410 * @page: The netfs page to fill if possible
411 * @end_io_func: The callback to invoke when and if the page is filled
412 * @context: An arbitrary piece of data to pass on to end_io_func()
413 * @gfp: The conditions under which memory allocation should be made
414 *
415 * Read a page from the cache, or if that's not possible make a potential
416 * one-block reservation in the cache into which the page may be stored once
417 * fetched from the server.
418 *
419 * If the page is not backed by the cache object, or if it there's some reason
420 * it can't be, -ENOBUFS will be returned and nothing more will be done for
421 * that page.
422 *
423 * Else, if that page is backed by the cache, a read will be initiated directly
424 * to the netfs's page and 0 will be returned by this function. The
425 * end_io_func() callback will be invoked when the operation terminates on a
426 * completion or failure. Note that the callback may be invoked before the
427 * return.
428 *
429 * Else, if the page is unbacked, -ENODATA is returned and a block may have
430 * been allocated in the cache.
431 *
432 * See Documentation/filesystems/caching/netfs-api.txt for a complete
433 * description.
434 */
435static inline
436int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
437 struct page *page,
438 fscache_rw_complete_t end_io_func,
439 void *context,
440 gfp_t gfp)
441{
442 if (fscache_cookie_valid(cookie))
443 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
444 context, gfp);
445 else
446 return -ENOBUFS;
447}
448
449/**
450 * fscache_read_or_alloc_pages - Read pages from the cache and/or allocate
451 * blocks in which to store them
452 * @cookie: The cookie representing the cache object
453 * @mapping: The netfs inode mapping to which the pages will be attached
454 * @pages: A list of potential netfs pages to be filled
455 * @end_io_func: The callback to invoke when and if each page is filled
456 * @context: An arbitrary piece of data to pass on to end_io_func()
457 * @gfp: The conditions under which memory allocation should be made
458 *
459 * Read a set of pages from the cache, or if that's not possible, attempt to
460 * make a potential one-block reservation for each page in the cache into which
461 * that page may be stored once fetched from the server.
462 *
463 * If some pages are not backed by the cache object, or if it there's some
464 * reason they can't be, -ENOBUFS will be returned and nothing more will be
465 * done for that pages.
466 *
467 * Else, if some of the pages are backed by the cache, a read will be initiated
468 * directly to the netfs's page and 0 will be returned by this function. The
469 * end_io_func() callback will be invoked when the operation terminates on a
470 * completion or failure. Note that the callback may be invoked before the
471 * return.
472 *
473 * Else, if a page is unbacked, -ENODATA is returned and a block may have
474 * been allocated in the cache.
475 *
476 * Because the function may want to return all of -ENOBUFS, -ENODATA and 0 in
477 * regard to different pages, the return values are prioritised in that order.
478 * Any pages submitted for reading are removed from the pages list.
479 *
480 * See Documentation/filesystems/caching/netfs-api.txt for a complete
481 * description.
482 */
483static inline
484int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
485 struct address_space *mapping,
486 struct list_head *pages,
487 unsigned *nr_pages,
488 fscache_rw_complete_t end_io_func,
489 void *context,
490 gfp_t gfp)
491{
492 if (fscache_cookie_valid(cookie))
493 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
494 nr_pages, end_io_func,
495 context, gfp);
496 else
497 return -ENOBUFS;
498}
499
500/**
501 * fscache_alloc_page - Allocate a block in which to store a page
502 * @cookie: The cookie representing the cache object
503 * @page: The netfs page to allocate a page for
504 * @gfp: The conditions under which memory allocation should be made
505 *
506 * Request Allocation a block in the cache in which to store a netfs page
507 * without retrieving any contents from the cache.
508 *
509 * If the page is not backed by a file then -ENOBUFS will be returned and
510 * nothing more will be done, and no reservation will be made.
511 *
512 * Else, a block will be allocated if one wasn't already, and 0 will be
513 * returned
514 *
515 * See Documentation/filesystems/caching/netfs-api.txt for a complete
516 * description.
517 */
518static inline
519int fscache_alloc_page(struct fscache_cookie *cookie,
520 struct page *page,
521 gfp_t gfp)
522{
523 if (fscache_cookie_valid(cookie))
524 return __fscache_alloc_page(cookie, page, gfp);
525 else
526 return -ENOBUFS;
527}
528
529/**
530 * fscache_write_page - Request storage of a page in the cache
531 * @cookie: The cookie representing the cache object
532 * @page: The netfs page to store
533 * @gfp: The conditions under which memory allocation should be made
534 *
535 * Request the contents of the netfs page be written into the cache. This
536 * request may be ignored if no cache block is currently allocated, in which
537 * case it will return -ENOBUFS.
538 *
539 * If a cache block was already allocated, a write will be initiated and 0 will
540 * be returned. The PG_fscache_write page bit is set immediately and will then
541 * be cleared at the completion of the write to indicate the success or failure
542 * of the operation. Note that the completion may happen before the return.
543 *
544 * See Documentation/filesystems/caching/netfs-api.txt for a complete
545 * description.
546 */
547static inline
548int fscache_write_page(struct fscache_cookie *cookie,
549 struct page *page,
550 gfp_t gfp)
551{
552 if (fscache_cookie_valid(cookie))
553 return __fscache_write_page(cookie, page, gfp);
554 else
555 return -ENOBUFS;
556}
557
558/**
559 * fscache_uncache_page - Indicate that caching is no longer required on a page
560 * @cookie: The cookie representing the cache object
561 * @page: The netfs page that was being cached.
562 *
563 * Tell the cache that we no longer want a page to be cached and that it should
564 * remove any knowledge of the netfs page it may have.
565 *
566 * Note that this cannot cancel any outstanding I/O operations between this
567 * page and the cache.
568 *
569 * See Documentation/filesystems/caching/netfs-api.txt for a complete
570 * description.
571 */
572static inline
573void fscache_uncache_page(struct fscache_cookie *cookie,
574 struct page *page)
575{
576 if (fscache_cookie_valid(cookie))
577 __fscache_uncache_page(cookie, page);
578}
579
580/**
581 * fscache_check_page_write - Ask if a page is being writing to the cache
582 * @cookie: The cookie representing the cache object
583 * @page: The netfs page that is being cached.
584 *
585 * Ask the cache if a page is being written to the cache.
586 *
587 * See Documentation/filesystems/caching/netfs-api.txt for a complete
588 * description.
589 */
590static inline
591bool fscache_check_page_write(struct fscache_cookie *cookie,
592 struct page *page)
593{
594 if (fscache_cookie_valid(cookie))
595 return __fscache_check_page_write(cookie, page);
596 return false;
597}
598
599/**
600 * fscache_wait_on_page_write - Wait for a page to complete writing to the cache
601 * @cookie: The cookie representing the cache object
602 * @page: The netfs page that is being cached.
603 *
604 * Ask the cache to wake us up when a page is no longer being written to the
605 * cache.
606 *
607 * See Documentation/filesystems/caching/netfs-api.txt for a complete
608 * description.
609 */
610static inline
611void fscache_wait_on_page_write(struct fscache_cookie *cookie,
612 struct page *page)
613{
614 if (fscache_cookie_valid(cookie))
615 __fscache_wait_on_page_write(cookie, page);
616}
617
618#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index d9051d717d27..f2a78b5e8b55 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -18,7 +18,6 @@
18#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/phy.h>
22 21
23/* 22/*
24 * Some conventions on how we handle peripherals on Freescale chips 23 * Some conventions on how we handle peripherals on Freescale chips
@@ -44,27 +43,6 @@
44 * 43 *
45 */ 44 */
46 45
47struct gianfar_platform_data {
48 /* device specific information */
49 u32 device_flags;
50 char bus_id[BUS_ID_SIZE];
51 phy_interface_t interface;
52};
53
54struct gianfar_mdio_data {
55 /* board specific information */
56 int irq[32];
57};
58
59/* Flags in gianfar_platform_data */
60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
62
63struct fsl_i2c_platform_data {
64 /* device specific information */
65 u32 device_flags;
66};
67
68/* Flags related to I2C device features */ 46/* Flags related to I2C device features */
69#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 47#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001
70#define FSL_I2C_DEV_CLOCK_5200 0x00000002 48#define FSL_I2C_DEV_CLOCK_5200 0x00000002
@@ -95,14 +73,15 @@ struct fsl_usb2_platform_data {
95#define FSL_USB2_PORT0_ENABLED 0x00000001 73#define FSL_USB2_PORT0_ENABLED 0x00000001
96#define FSL_USB2_PORT1_ENABLED 0x00000002 74#define FSL_USB2_PORT1_ENABLED 0x00000002
97 75
76struct spi_device;
77
98struct fsl_spi_platform_data { 78struct fsl_spi_platform_data {
99 u32 initial_spmode; /* initial SPMODE value */ 79 u32 initial_spmode; /* initial SPMODE value */
100 u16 bus_num; 80 s16 bus_num;
101 bool qe_mode; 81 bool qe_mode;
102 /* board specific information */ 82 /* board specific information */
103 u16 max_chipselect; 83 u16 max_chipselect;
104 void (*activate_cs)(u8 cs, u8 polarity); 84 void (*cs_control)(struct spi_device *spi, bool on);
105 void (*deactivate_cs)(u8 cs, u8 polarity);
106 u32 sysclk; 85 u32 sysclk;
107}; 86};
108 87
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h
index 13f4e74609ac..0ffa41df0ee8 100644
--- a/include/linux/gen_stats.h
+++ b/include/linux/gen_stats.h
@@ -22,7 +22,7 @@ struct gnet_stats_basic
22{ 22{
23 __u64 bytes; 23 __u64 bytes;
24 __u32 packets; 24 __u32 packets;
25}; 25} __attribute__ ((packed));
26 26
27/** 27/**
28 * struct gnet_stats_rate_est - rate estimator 28 * struct gnet_stats_rate_est - rate estimator
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 16948eaecae3..634c53028fb8 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -333,11 +333,10 @@ static inline void part_dec_in_flight(struct hd_struct *part)
333 part_to_disk(part)->part0.in_flight--; 333 part_to_disk(part)->part0.in_flight--;
334} 334}
335 335
336/* drivers/block/ll_rw_blk.c */ 336/* block/blk-core.c */
337extern void part_round_stats(int cpu, struct hd_struct *part); 337extern void part_round_stats(int cpu, struct hd_struct *part);
338 338
339/* drivers/block/genhd.c */ 339/* block/genhd.c */
340extern int get_blkdev_list(char *, int);
341extern void add_disk(struct gendisk *disk); 340extern void add_disk(struct gendisk *disk);
342extern void del_gendisk(struct gendisk *gp); 341extern void del_gendisk(struct gendisk *gp);
343extern void unlink_gendisk(struct gendisk *gp); 342extern void unlink_gendisk(struct gendisk *gp);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index dd20cd78faa8..0bbc15f54536 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -4,6 +4,7 @@
4#include <linux/mmzone.h> 4#include <linux/mmzone.h>
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/topology.h>
7 8
8struct vm_area_struct; 9struct vm_area_struct;
9 10
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index faa1cf848bcd..45257475623c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -116,7 +116,7 @@
116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET 116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
117#endif 117#endif
118 118
119#ifdef CONFIG_SMP 119#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
120extern void synchronize_irq(unsigned int irq); 120extern void synchronize_irq(unsigned int irq);
121#else 121#else
122# define synchronize_irq(irq) barrier() 122# define synchronize_irq(irq) barrier()
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index fd47a151665e..6a6e701f1631 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,6 +38,7 @@ struct hdlc_proto {
38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb); 40 int (*netif_rx)(struct sk_buff *skb);
41 int (*xmit)(struct sk_buff *skb, struct net_device *dev);
41 struct module *module; 42 struct module *module;
42 struct hdlc_proto *next; /* next protocol in the list */ 43 struct hdlc_proto *next; /* next protocol in the list */
43}; 44};
@@ -102,6 +103,10 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
102int hdlc_open(struct net_device *dev); 103int hdlc_open(struct net_device *dev);
103/* Must be called by hardware driver when HDLC device is being closed */ 104/* Must be called by hardware driver when HDLC device is being closed */
104void hdlc_close(struct net_device *dev); 105void hdlc_close(struct net_device *dev);
106/* May be used by hardware driver */
107int hdlc_change_mtu(struct net_device *dev, int new_mtu);
108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
109int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
105 110
106int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
107 size_t size); 112 size_t size);
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index bf6302f6b5f8..c010b4a785b8 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -215,7 +215,7 @@ struct hdlcdrv_state {
215 215
216 struct hdlcdrv_hdlctx { 216 struct hdlcdrv_hdlctx {
217 struct hdlcdrv_hdlcbuffer hbuf; 217 struct hdlcdrv_hdlcbuffer hbuf;
218 long in_hdlc_tx; 218 unsigned long in_hdlc_tx;
219 /* 219 /*
220 * 0 = send flags 220 * 0 = send flags
221 * 1 = send txtail (flags) 221 * 1 = send txtail (flags)
@@ -241,7 +241,6 @@ struct hdlcdrv_state {
241 struct hdlcdrv_bitbuffer bitbuf_hdlc; 241 struct hdlcdrv_bitbuffer bitbuf_hdlc;
242#endif /* HDLCDRV_DEBUG */ 242#endif /* HDLCDRV_DEBUG */
243 243
244 struct net_device_stats stats;
245 int ptt_keyed; 244 int ptt_keyed;
246 245
247 /* queued skb for transmission */ 246 /* queued skb for transmission */
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index ed21bd3dbd25..29ee2873f4a8 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -1,68 +1,6 @@
1#ifndef _LINUX_HDREG_H 1#ifndef _LINUX_HDREG_H
2#define _LINUX_HDREG_H 2#define _LINUX_HDREG_H
3 3
4#ifdef __KERNEL__
5#include <linux/ata.h>
6
7/*
8 * This file contains some defines for the AT-hd-controller.
9 * Various sources.
10 */
11
12/* ide.c has its own port definitions in "ide.h" */
13
14#define HD_IRQ 14
15
16/* Hd controller regs. Ref: IBM AT Bios-listing */
17#define HD_DATA 0x1f0 /* _CTL when writing */
18#define HD_ERROR 0x1f1 /* see err-bits */
19#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
20#define HD_SECTOR 0x1f3 /* starting sector */
21#define HD_LCYL 0x1f4 /* starting cylinder */
22#define HD_HCYL 0x1f5 /* high byte of starting cyl */
23#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
24#define HD_STATUS 0x1f7 /* see status-bits */
25#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
26#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
27#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
28
29#define HD_CMD 0x3f6 /* used for resets */
30#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
31
32/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
33
34/* Bits of HD_STATUS */
35#define ERR_STAT 0x01
36#define INDEX_STAT 0x02
37#define ECC_STAT 0x04 /* Corrected error */
38#define DRQ_STAT 0x08
39#define SEEK_STAT 0x10
40#define SRV_STAT 0x10
41#define WRERR_STAT 0x20
42#define READY_STAT 0x40
43#define BUSY_STAT 0x80
44
45/* Bits for HD_ERROR */
46#define MARK_ERR 0x01 /* Bad address mark */
47#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
48#define TRK0_ERR 0x02 /* couldn't find track 0 */
49#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
50#define ABRT_ERR 0x04 /* Command aborted */
51#define MCR_ERR 0x08 /* media change request */
52#define ID_ERR 0x10 /* ID field not found */
53#define MC_ERR 0x20 /* media changed */
54#define ECC_ERR 0x40 /* Uncorrectable ECC error */
55#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
56#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
57#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
58
59/* Bits of HD_NSECTOR */
60#define CD 0x01
61#define IO 0x02
62#define REL 0x04
63#define TAG_MASK 0xf8
64#endif /* __KERNEL__ */
65
66#include <linux/types.h> 4#include <linux/types.h>
67 5
68/* 6/*
@@ -191,6 +129,7 @@ typedef struct hd_drive_hob_hdr {
191#define TASKFILE_INVALID 0x7fff 129#define TASKFILE_INVALID 0x7fff
192#endif 130#endif
193 131
132#ifndef __KERNEL__
194/* ATA/ATAPI Commands pre T13 Spec */ 133/* ATA/ATAPI Commands pre T13 Spec */
195#define WIN_NOP 0x00 134#define WIN_NOP 0x00
196/* 135/*
@@ -379,6 +318,7 @@ typedef struct hd_drive_hob_hdr {
379#define SECURITY_ERASE_UNIT 0xBD 318#define SECURITY_ERASE_UNIT 0xBD
380#define SECURITY_FREEZE_LOCK 0xBE 319#define SECURITY_FREEZE_LOCK 0xBE
381#define SECURITY_DISABLE_PASSWORD 0xBF 320#define SECURITY_DISABLE_PASSWORD 0xBF
321#endif /* __KERNEL__ */
382 322
383struct hd_geometry { 323struct hd_geometry {
384 unsigned char heads; 324 unsigned char heads;
@@ -448,6 +388,7 @@ enum {
448 388
449#define __NEW_HD_DRIVE_ID 389#define __NEW_HD_DRIVE_ID
450 390
391#ifndef __KERNEL__
451/* 392/*
452 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. 393 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
453 * 394 *
@@ -699,6 +640,7 @@ struct hd_driveid {
699 * 7:0 Signature 640 * 7:0 Signature
700 */ 641 */
701}; 642};
643#endif /* __KERNEL__ */
702 644
703/* 645/*
704 * IDE "nice" flags. These are used on a per drive basis to determine 646 * IDE "nice" flags. These are used on a per drive basis to determine
diff --git a/include/linux/hid.h b/include/linux/hid.h
index fa8ee9cef7be..a72876e43589 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -270,6 +270,7 @@ struct hid_item {
270 270
271#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
272#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
273#define HID_QUIRK_IGNORE 0x00000004
273#define HID_QUIRK_NOGET 0x00000008 274#define HID_QUIRK_NOGET 0x00000008
274#define HID_QUIRK_BADPAD 0x00000020 275#define HID_QUIRK_BADPAD 0x00000020
275#define HID_QUIRK_MULTI_INPUT 0x00000040 276#define HID_QUIRK_MULTI_INPUT 0x00000040
@@ -603,12 +604,17 @@ struct hid_ll_driver {
603 int (*open)(struct hid_device *hdev); 604 int (*open)(struct hid_device *hdev);
604 void (*close)(struct hid_device *hdev); 605 void (*close)(struct hid_device *hdev);
605 606
607 int (*power)(struct hid_device *hdev, int level);
608
606 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, 609 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
607 unsigned int code, int value); 610 unsigned int code, int value);
608 611
609 int (*parse)(struct hid_device *hdev); 612 int (*parse)(struct hid_device *hdev);
610}; 613};
611 614
615#define PM_HINT_FULLON 1<<5
616#define PM_HINT_NORMAL 1<<1
617
612/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 618/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
613/* We ignore a few input applications that are not widely used */ 619/* We ignore a few input applications that are not widely used */
614#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 620#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
@@ -641,6 +647,7 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
641void hid_output_report(struct hid_report *report, __u8 *data); 647void hid_output_report(struct hid_report *report, __u8 *data);
642struct hid_device *hid_allocate_device(void); 648struct hid_device *hid_allocate_device(void);
643int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 649int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
650int hid_check_keys_pressed(struct hid_device *hid);
644int hid_connect(struct hid_device *hid, unsigned int connect_mask); 651int hid_connect(struct hid_device *hid, unsigned int connect_mask);
645 652
646/** 653/**
@@ -791,21 +798,5 @@ dbg_hid(const char *fmt, ...)
791 __FILE__ , ## arg) 798 __FILE__ , ## arg)
792#endif /* HID_FF */ 799#endif /* HID_FF */
793 800
794#ifdef __KERNEL__
795#ifdef CONFIG_HID_COMPAT
796#define HID_COMPAT_LOAD_DRIVER(name) \
797/* prototype to avoid sparse warning */ \
798extern void hid_compat_##name(void); \
799void hid_compat_##name(void) { } \
800EXPORT_SYMBOL(hid_compat_##name)
801#else
802#define HID_COMPAT_LOAD_DRIVER(name)
803#endif /* HID_COMPAT */
804#define HID_COMPAT_CALL_DRIVER(name) do { \
805 extern void hid_compat_##name(void); \
806 hid_compat_##name(); \
807} while (0)
808#endif /* __KERNEL__ */
809
810#endif 801#endif
811 802
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 13875ce9112a..1fcb7126a01f 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -19,8 +19,21 @@ static inline void flush_kernel_dcache_page(struct page *page)
19} 19}
20#endif 20#endif
21 21
22#ifdef CONFIG_HIGHMEM 22#include <asm/kmap_types.h>
23
24#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT)
25
26void debug_kmap_atomic(enum km_type type);
23 27
28#else
29
30static inline void debug_kmap_atomic(enum km_type type)
31{
32}
33
34#endif
35
36#ifdef CONFIG_HIGHMEM
24#include <asm/highmem.h> 37#include <asm/highmem.h>
25 38
26/* declarations for linux/mm/highmem.c */ 39/* declarations for linux/mm/highmem.c */
@@ -44,8 +57,6 @@ static inline void *kmap(struct page *page)
44 57
45#define kunmap(page) do { (void) (page); } while (0) 58#define kunmap(page) do { (void) (page); } while (0)
46 59
47#include <asm/kmap_types.h>
48
49static inline void *kmap_atomic(struct page *page, enum km_type idx) 60static inline void *kmap_atomic(struct page *page, enum km_type idx)
50{ 61{
51 pagefault_disable(); 62 pagefault_disable();
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index bd37078c2d7d..0d2f7c8a33d6 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -336,6 +336,11 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
336 const enum hrtimer_mode mode); 336 const enum hrtimer_mode mode);
337extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, 337extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
338 unsigned long range_ns, const enum hrtimer_mode mode); 338 unsigned long range_ns, const enum hrtimer_mode mode);
339extern int
340__hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
341 unsigned long delta_ns,
342 const enum hrtimer_mode mode, int wakeup);
343
339extern int hrtimer_cancel(struct hrtimer *timer); 344extern int hrtimer_cancel(struct hrtimer *timer);
340extern int hrtimer_try_to_cancel(struct hrtimer *timer); 345extern int hrtimer_try_to_cancel(struct hrtimer *timer);
341 346
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h
index adcb3dc7ac26..1364d62e2fbe 100644
--- a/include/linux/i2c-algo-pca.h
+++ b/include/linux/i2c-algo-pca.h
@@ -1,7 +1,14 @@
1#ifndef _LINUX_I2C_ALGO_PCA_H 1#ifndef _LINUX_I2C_ALGO_PCA_H
2#define _LINUX_I2C_ALGO_PCA_H 2#define _LINUX_I2C_ALGO_PCA_H
3 3
4/* Clock speeds for the bus */ 4/* Chips known to the pca algo */
5#define I2C_PCA_CHIP_9564 0x00
6#define I2C_PCA_CHIP_9665 0x01
7
8/* Internal period for PCA9665 oscilator */
9#define I2C_PCA_OSC_PER 3 /* e10-8s */
10
11/* Clock speeds for the bus for PCA9564*/
5#define I2C_PCA_CON_330kHz 0x00 12#define I2C_PCA_CON_330kHz 0x00
6#define I2C_PCA_CON_288kHz 0x01 13#define I2C_PCA_CON_288kHz 0x01
7#define I2C_PCA_CON_217kHz 0x02 14#define I2C_PCA_CON_217kHz 0x02
@@ -18,6 +25,26 @@
18#define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */ 25#define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */
19#define I2C_PCA_CON 0x03 /* CONTROL Read/Write */ 26#define I2C_PCA_CON 0x03 /* CONTROL Read/Write */
20 27
28/* PCA9665 registers */
29#define I2C_PCA_INDPTR 0x00 /* INDIRECT Pointer Write Only */
30#define I2C_PCA_IND 0x02 /* INDIRECT Read/Write */
31
32/* PCA9665 indirect registers */
33#define I2C_PCA_ICOUNT 0x00 /* Byte Count for buffered mode */
34#define I2C_PCA_IADR 0x01 /* OWN ADR */
35#define I2C_PCA_ISCLL 0x02 /* SCL LOW period */
36#define I2C_PCA_ISCLH 0x03 /* SCL HIGH period */
37#define I2C_PCA_ITO 0x04 /* TIMEOUT */
38#define I2C_PCA_IPRESET 0x05 /* Parallel bus reset */
39#define I2C_PCA_IMODE 0x06 /* I2C Bus mode */
40
41/* PCA9665 I2C bus mode */
42#define I2C_PCA_MODE_STD 0x00 /* Standard mode */
43#define I2C_PCA_MODE_FAST 0x01 /* Fast mode */
44#define I2C_PCA_MODE_FASTP 0x02 /* Fast Plus mode */
45#define I2C_PCA_MODE_TURBO 0x03 /* Turbo mode */
46
47
21#define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */ 48#define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */
22#define I2C_PCA_CON_ENSIO 0x40 /* Enable */ 49#define I2C_PCA_CON_ENSIO 0x40 /* Enable */
23#define I2C_PCA_CON_STA 0x20 /* Start */ 50#define I2C_PCA_CON_STA 0x20 /* Start */
@@ -31,7 +58,9 @@ struct i2c_algo_pca_data {
31 int (*read_byte) (void *data, int reg); 58 int (*read_byte) (void *data, int reg);
32 int (*wait_for_completion) (void *data); 59 int (*wait_for_completion) (void *data);
33 void (*reset_chip) (void *data); 60 void (*reset_chip) (void *data);
34 /* i2c_clock values are defined in linux/i2c-algo-pca.h */ 61 /* For PCA9564, use one of the predefined frequencies:
62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000
63 * For PCA9665, use the frequency you want here. */
35 unsigned int i2c_clock; 64 unsigned int i2c_clock;
36}; 65};
37 66
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h
deleted file mode 100644
index 3b7715024e69..000000000000
--- a/include/linux/i2c-algo-sgi.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License version 2 as published by the Free Software Foundation.
4 *
5 * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
6 */
7
8#ifndef I2C_ALGO_SGI_H
9#define I2C_ALGO_SGI_H 1
10
11#include <linux/i2c.h>
12
13struct i2c_algo_sgi_data {
14 void *data; /* private data for lowlevel routines */
15 unsigned (*getctrl)(void *data);
16 void (*setctrl)(void *data, unsigned val);
17 unsigned (*rdata)(void *data);
18 void (*wdata)(void *data, unsigned val);
19
20 int xfer_timeout;
21 int ack_timeout;
22};
23
24int i2c_sgi_add_bus(struct i2c_adapter *);
25
26#endif /* I2C_ALGO_SGI_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 1ffc23bc5d1e..c9087de5c6c6 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,46 +33,10 @@
33 33
34#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
35#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
36#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
37#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
38#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
43#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 36#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
44#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 37#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
45#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
46#define I2C_DRIVERID_BT819 40 /* video decoder */
47#define I2C_DRIVERID_BT856 41 /* video encoder */
48#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
49#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
50#define I2C_DRIVERID_SAA7114 49 /* video decoder */
51#define I2C_DRIVERID_ADV7170 54 /* video encoder */
52#define I2C_DRIVERID_SAA7191 57 /* video decoder */
53#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
54#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
55#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
56#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
57#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
58#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
59#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
60#define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */
61#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 38#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
62#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 39#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
63#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
64#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
65#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
66#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
67#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
68#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
69#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
70#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
71#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
72#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
73#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
74
75#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
76 40
77/* 41/*
78 * ---- Adapter types ---------------------------------------------------- 42 * ---- Adapter types ----------------------------------------------------
@@ -87,6 +51,8 @@
87#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 51#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
88#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 52#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
89#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */ 53#define I2C_HW_B_AU0828 0x010023 /* auvitek au0828 usb bridge */
54#define I2C_HW_B_CX231XX 0x010024 /* Conexant CX231XX USB based cards */
55#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
90 56
91/* --- SGI adapters */ 57/* --- SGI adapters */
92#define I2C_HW_SGI_VINO 0x160000 58#define I2C_HW_SGI_VINO 0x160000
diff --git a/include/linux/i2c-pca-platform.h b/include/linux/i2c-pca-platform.h
index 3d191873f2d1..aba33759dec4 100644
--- a/include/linux/i2c-pca-platform.h
+++ b/include/linux/i2c-pca-platform.h
@@ -6,7 +6,7 @@ struct i2c_pca9564_pf_platform_data {
6 * not supplied (negative value), but it 6 * not supplied (negative value), but it
7 * cannot exit some error conditions then */ 7 * cannot exit some error conditions then */
8 int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */ 8 int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */
9 int timeout; /* timeout = this value * 10us */ 9 int timeout; /* timeout in jiffies */
10}; 10};
11 11
12#endif /* I2C_PCA9564_PLATFORM_H */ 12#endif /* I2C_PCA9564_PLATFORM_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c86c3b07604c..00ee11eb9092 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -353,8 +353,8 @@ struct i2c_adapter {
353 void *algo_data; 353 void *algo_data;
354 354
355 /* --- administration stuff. */ 355 /* --- administration stuff. */
356 int (*client_register)(struct i2c_client *); 356 int (*client_register)(struct i2c_client *) __deprecated;
357 int (*client_unregister)(struct i2c_client *); 357 int (*client_unregister)(struct i2c_client *) __deprecated;
358 358
359 /* data fields that are valid for all devices */ 359 /* data fields that are valid for all devices */
360 u8 level; /* nesting level for lockdep */ 360 u8 level; /* nesting level for lockdep */
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
index f6edd522a929..8ace93024d60 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/i2c/at24.h
@@ -2,6 +2,7 @@
2#define _LINUX_AT24_H 2#define _LINUX_AT24_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/memory.h>
5 6
6/* 7/*
7 * As seen through Linux I2C, differences between the most common types of I2C 8 * As seen through Linux I2C, differences between the most common types of I2C
@@ -23,6 +24,9 @@ struct at24_platform_data {
23#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */ 24#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */
24#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */ 25#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */
25#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */ 26#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */
27
28 void (*setup)(struct memory_accessor *, void *context);
29 void *context;
26}; 30};
27 31
28#endif /* _LINUX_AT24_H */ 32#endif /* _LINUX_AT24_H */
diff --git a/include/linux/i2c/s6000.h b/include/linux/i2c/s6000.h
new file mode 100644
index 000000000000..d9b34bfdae76
--- /dev/null
+++ b/include/linux/i2c/s6000.h
@@ -0,0 +1,10 @@
1#ifndef __LINUX_I2C_S6000_H
2#define __LINUX_I2C_S6000_H
3
4struct s6_i2c_platform_data {
5 const char *clock; /* the clock to use */
6 int bus_num; /* the bus number to register */
7};
8
9#endif
10
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 8137f660a5cc..0dc80ef24975 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -218,6 +218,53 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
218 218
219/*----------------------------------------------------------------------*/ 219/*----------------------------------------------------------------------*/
220 220
221/* Power bus message definitions */
222
223#define DEV_GRP_NULL 0x0
224#define DEV_GRP_P1 0x1
225#define DEV_GRP_P2 0x2
226#define DEV_GRP_P3 0x4
227
228#define RES_GRP_RES 0x0
229#define RES_GRP_PP 0x1
230#define RES_GRP_RC 0x2
231#define RES_GRP_PP_RC 0x3
232#define RES_GRP_PR 0x4
233#define RES_GRP_PP_PR 0x5
234#define RES_GRP_RC_PR 0x6
235#define RES_GRP_ALL 0x7
236
237#define RES_TYPE2_R0 0x0
238
239#define RES_TYPE_ALL 0x7
240
241#define RES_STATE_WRST 0xF
242#define RES_STATE_ACTIVE 0xE
243#define RES_STATE_SLEEP 0x8
244#define RES_STATE_OFF 0x0
245
246/*
247 * Power Bus Message Format ... these can be sent individually by Linux,
248 * but are usually part of downloaded scripts that are run when various
249 * power events are triggered.
250 *
251 * Broadcast Message (16 Bits):
252 * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4]
253 * RES_STATE[3:0]
254 *
255 * Singular Message (16 Bits):
256 * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0]
257 */
258
259#define MSG_BROADCAST(devgrp, grp, type, type2, state) \
260 ( (devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \
261 | (type) << 4 | (state))
262
263#define MSG_SINGULAR(devgrp, id, state) \
264 ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
265
266/*----------------------------------------------------------------------*/
267
221struct twl4030_bci_platform_data { 268struct twl4030_bci_platform_data {
222 int *battery_tmp_tbl; 269 int *battery_tmp_tbl;
223 unsigned int tblsize; 270 unsigned int tblsize;
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h
index 1c7a0dd5536a..06695b74d405 100644
--- a/include/linux/ibmtr.h
+++ b/include/linux/ibmtr.h
@@ -207,7 +207,7 @@ struct tok_info {
207 unsigned short exsap_station_id; 207 unsigned short exsap_station_id;
208 unsigned short global_int_enable; 208 unsigned short global_int_enable;
209 struct sk_buff *current_skb; 209 struct sk_buff *current_skb;
210 struct net_device_stats tr_stats; 210
211 unsigned char auto_speedsave; 211 unsigned char auto_speedsave;
212 open_state open_status, sap_status; 212 open_state open_status, sap_status;
213 enum {MANUAL, AUTOMATIC} open_mode; 213 enum {MANUAL, AUTOMATIC} open_mode;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 25087aead657..a5d26f66ef78 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -26,7 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/mutex.h> 27#include <asm/mutex.h>
28 28
29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) 29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300)
30# define SUPPORT_VLB_SYNC 0 30# define SUPPORT_VLB_SYNC 0
31#else 31#else
32# define SUPPORT_VLB_SYNC 1 32# define SUPPORT_VLB_SYNC 1
@@ -40,6 +40,13 @@
40#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
42 42
43/* Error codes returned in rq->errors to the higher part of the driver. */
44enum {
45 IDE_DRV_ERROR_GENERAL = 101,
46 IDE_DRV_ERROR_FILEMARK = 102,
47 IDE_DRV_ERROR_EOD = 103,
48};
49
43/* 50/*
44 * Definitions for accessing IDE controller registers 51 * Definitions for accessing IDE controller registers
45 */ 52 */
@@ -193,42 +200,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
193 hw->io_ports.ctl_addr = ctl_addr; 200 hw->io_ports.ctl_addr = ctl_addr;
194} 201}
195 202
196/* for IDE PCI controllers in legacy mode, temporary */
197static inline int __ide_default_irq(unsigned long base)
198{
199 switch (base) {
200#ifdef CONFIG_IA64
201 case 0x1f0: return isa_irq_to_vector(14);
202 case 0x170: return isa_irq_to_vector(15);
203#else
204 case 0x1f0: return 14;
205 case 0x170: return 15;
206#endif
207 }
208 return 0;
209}
210
211#if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \
212 defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \
213 || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
214#include <asm/ide.h>
215#else
216#include <asm-generic/ide_iops.h>
217#endif
218
219#define MAX_HWIFS 10 203#define MAX_HWIFS 10
220 204
221/* Currently only m68k, apus and m8xx need it */
222#ifndef IDE_ARCH_ACK_INTR
223# define ide_ack_intr(hwif) (1)
224#endif
225
226/* Currently only Atari needs it */
227#ifndef IDE_ARCH_LOCK
228# define ide_release_lock() do {} while (0)
229# define ide_get_lock(hdlr, data) do {} while (0)
230#endif /* IDE_ARCH_LOCK */
231
232/* 205/*
233 * Now for the data we need to maintain per-drive: ide_drive_t 206 * Now for the data we need to maintain per-drive: ide_drive_t
234 */ 207 */
@@ -268,56 +241,52 @@ typedef enum {
268 241
269enum { 242enum {
270 IDE_TFLAG_LBA48 = (1 << 0), 243 IDE_TFLAG_LBA48 = (1 << 0),
271 IDE_TFLAG_FLAGGED = (1 << 2), 244 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1),
272 IDE_TFLAG_OUT_DATA = (1 << 3), 245 IDE_TFLAG_OUT_HOB_NSECT = (1 << 2),
273 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 246 IDE_TFLAG_OUT_HOB_LBAL = (1 << 3),
274 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), 247 IDE_TFLAG_OUT_HOB_LBAM = (1 << 4),
275 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), 248 IDE_TFLAG_OUT_HOB_LBAH = (1 << 5),
276 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
277 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
278 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | 249 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
279 IDE_TFLAG_OUT_HOB_NSECT | 250 IDE_TFLAG_OUT_HOB_NSECT |
280 IDE_TFLAG_OUT_HOB_LBAL | 251 IDE_TFLAG_OUT_HOB_LBAL |
281 IDE_TFLAG_OUT_HOB_LBAM | 252 IDE_TFLAG_OUT_HOB_LBAM |
282 IDE_TFLAG_OUT_HOB_LBAH, 253 IDE_TFLAG_OUT_HOB_LBAH,
283 IDE_TFLAG_OUT_FEATURE = (1 << 9), 254 IDE_TFLAG_OUT_FEATURE = (1 << 6),
284 IDE_TFLAG_OUT_NSECT = (1 << 10), 255 IDE_TFLAG_OUT_NSECT = (1 << 7),
285 IDE_TFLAG_OUT_LBAL = (1 << 11), 256 IDE_TFLAG_OUT_LBAL = (1 << 8),
286 IDE_TFLAG_OUT_LBAM = (1 << 12), 257 IDE_TFLAG_OUT_LBAM = (1 << 9),
287 IDE_TFLAG_OUT_LBAH = (1 << 13), 258 IDE_TFLAG_OUT_LBAH = (1 << 10),
288 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | 259 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
289 IDE_TFLAG_OUT_NSECT | 260 IDE_TFLAG_OUT_NSECT |
290 IDE_TFLAG_OUT_LBAL | 261 IDE_TFLAG_OUT_LBAL |
291 IDE_TFLAG_OUT_LBAM | 262 IDE_TFLAG_OUT_LBAM |
292 IDE_TFLAG_OUT_LBAH, 263 IDE_TFLAG_OUT_LBAH,
293 IDE_TFLAG_OUT_DEVICE = (1 << 14), 264 IDE_TFLAG_OUT_DEVICE = (1 << 11),
294 IDE_TFLAG_WRITE = (1 << 15), 265 IDE_TFLAG_WRITE = (1 << 12),
295 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), 266 IDE_TFLAG_CUSTOM_HANDLER = (1 << 13),
296 IDE_TFLAG_IN_DATA = (1 << 17), 267 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14),
297 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), 268 IDE_TFLAG_IN_HOB_ERROR = (1 << 15),
298 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), 269 IDE_TFLAG_IN_HOB_NSECT = (1 << 16),
299 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), 270 IDE_TFLAG_IN_HOB_LBAL = (1 << 17),
300 IDE_TFLAG_IN_HOB_NSECT = (1 << 21), 271 IDE_TFLAG_IN_HOB_LBAM = (1 << 18),
301 IDE_TFLAG_IN_HOB_LBAL = (1 << 22), 272 IDE_TFLAG_IN_HOB_LBAH = (1 << 19),
302 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
303 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
304 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | 273 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
305 IDE_TFLAG_IN_HOB_LBAM | 274 IDE_TFLAG_IN_HOB_LBAM |
306 IDE_TFLAG_IN_HOB_LBAH, 275 IDE_TFLAG_IN_HOB_LBAH,
307 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | 276 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_ERROR |
308 IDE_TFLAG_IN_HOB_NSECT | 277 IDE_TFLAG_IN_HOB_NSECT |
309 IDE_TFLAG_IN_HOB_LBA, 278 IDE_TFLAG_IN_HOB_LBA,
310 IDE_TFLAG_IN_FEATURE = (1 << 1), 279 IDE_TFLAG_IN_ERROR = (1 << 20),
311 IDE_TFLAG_IN_NSECT = (1 << 25), 280 IDE_TFLAG_IN_NSECT = (1 << 21),
312 IDE_TFLAG_IN_LBAL = (1 << 26), 281 IDE_TFLAG_IN_LBAL = (1 << 22),
313 IDE_TFLAG_IN_LBAM = (1 << 27), 282 IDE_TFLAG_IN_LBAM = (1 << 23),
314 IDE_TFLAG_IN_LBAH = (1 << 28), 283 IDE_TFLAG_IN_LBAH = (1 << 24),
315 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | 284 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
316 IDE_TFLAG_IN_LBAM | 285 IDE_TFLAG_IN_LBAM |
317 IDE_TFLAG_IN_LBAH, 286 IDE_TFLAG_IN_LBAH,
318 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | 287 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
319 IDE_TFLAG_IN_LBA, 288 IDE_TFLAG_IN_LBA,
320 IDE_TFLAG_IN_DEVICE = (1 << 29), 289 IDE_TFLAG_IN_DEVICE = (1 << 25),
321 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | 290 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
322 IDE_TFLAG_IN_HOB, 291 IDE_TFLAG_IN_HOB,
323 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | 292 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
@@ -325,15 +294,28 @@ enum {
325 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | 294 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
326 IDE_TFLAG_IN_DEVICE, 295 IDE_TFLAG_IN_DEVICE,
327 /* force 16-bit I/O operations */ 296 /* force 16-bit I/O operations */
328 IDE_TFLAG_IO_16BIT = (1 << 30), 297 IDE_TFLAG_IO_16BIT = (1 << 26),
329 /* ide_task_t was allocated using kmalloc() */ 298 /* struct ide_cmd was allocated using kmalloc() */
330 IDE_TFLAG_DYN = (1 << 31), 299 IDE_TFLAG_DYN = (1 << 27),
300 IDE_TFLAG_FS = (1 << 28),
301 IDE_TFLAG_MULTI_PIO = (1 << 29),
302};
303
304enum {
305 IDE_FTFLAG_FLAGGED = (1 << 0),
306 IDE_FTFLAG_SET_IN_FLAGS = (1 << 1),
307 IDE_FTFLAG_OUT_DATA = (1 << 2),
308 IDE_FTFLAG_IN_DATA = (1 << 3),
331}; 309};
332 310
333struct ide_taskfile { 311struct ide_taskfile {
334 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ 312 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
313 /* 1-5: additional data to support LBA48 */
314 union {
315 u8 hob_error; /* read: error */
316 u8 hob_feature; /* write: feature */
317 };
335 318
336 u8 hob_feature; /* 1-5: additional data to support LBA48 */
337 u8 hob_nsect; 319 u8 hob_nsect;
338 u8 hob_lbal; 320 u8 hob_lbal;
339 u8 hob_lbam; 321 u8 hob_lbam;
@@ -359,16 +341,29 @@ struct ide_taskfile {
359 }; 341 };
360}; 342};
361 343
362typedef struct ide_task_s { 344struct ide_cmd {
363 union { 345 union {
364 struct ide_taskfile tf; 346 struct ide_taskfile tf;
365 u8 tf_array[14]; 347 u8 tf_array[14];
366 }; 348 };
349 u8 ftf_flags; /* for TASKFILE ioctl */
367 u32 tf_flags; 350 u32 tf_flags;
368 int data_phase; 351 int protocol;
352
353 int sg_nents; /* number of sg entries */
354 int orig_sg_nents;
355 int sg_dma_direction; /* DMA transfer direction */
356
357 unsigned int nbytes;
358 unsigned int nleft;
359 unsigned int last_xfer_len;
360
361 struct scatterlist *cursg;
362 unsigned int cursg_ofs;
363
369 struct request *rq; /* copy of request */ 364 struct request *rq; /* copy of request */
370 void *special; /* valid_t generally */ 365 void *special; /* valid_t generally */
371} ide_task_t; 366};
372 367
373/* ATAPI packet command flags */ 368/* ATAPI packet command flags */
374enum { 369enum {
@@ -380,15 +375,13 @@ enum {
380 PC_FLAG_DMA_IN_PROGRESS = (1 << 4), 375 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
381 PC_FLAG_DMA_ERROR = (1 << 5), 376 PC_FLAG_DMA_ERROR = (1 << 5),
382 PC_FLAG_WRITING = (1 << 6), 377 PC_FLAG_WRITING = (1 << 6),
383 /* command timed out */
384 PC_FLAG_TIMEDOUT = (1 << 7),
385}; 378};
386 379
387/* 380/*
388 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. 381 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
389 * This is used for several packet commands (not for READ/WRITE commands). 382 * This is used for several packet commands (not for READ/WRITE commands).
390 */ 383 */
391#define IDE_PC_BUFFER_SIZE 256 384#define IDE_PC_BUFFER_SIZE 64
392#define ATAPI_WAIT_PC (60 * HZ) 385#define ATAPI_WAIT_PC (60 * HZ)
393 386
394struct ide_atapi_pc { 387struct ide_atapi_pc {
@@ -426,9 +419,6 @@ struct ide_atapi_pc {
426 struct idetape_bh *bh; 419 struct idetape_bh *bh;
427 char *b_data; 420 char *b_data;
428 421
429 struct scatterlist *sg;
430 unsigned int sg_cnt;
431
432 unsigned long timeout; 422 unsigned long timeout;
433}; 423};
434 424
@@ -452,7 +442,6 @@ struct ide_disk_ops {
452 int); 442 int);
453 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, 443 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
454 sector_t); 444 sector_t);
455 int (*end_request)(struct ide_drive_s *, int, int);
456 int (*ioctl)(struct ide_drive_s *, struct block_device *, 445 int (*ioctl)(struct ide_drive_s *, struct block_device *,
457 fmode_t, unsigned int, unsigned long); 446 fmode_t, unsigned int, unsigned long);
458}; 447};
@@ -470,11 +459,6 @@ enum {
470 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), 459 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
471 /* TOC track numbers are in BCD. */ 460 /* TOC track numbers are in BCD. */
472 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), 461 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
473 /*
474 * Drive does not provide data in multiples of SECTOR_SIZE
475 * when more than one interrupt is needed.
476 */
477 IDE_AFLAG_LIMIT_NFRAMES = (1 << 5),
478 /* Saved TOC information is current. */ 462 /* Saved TOC information is current. */
479 IDE_AFLAG_TOC_VALID = (1 << 6), 463 IDE_AFLAG_TOC_VALID = (1 << 6),
480 /* We think that the drive door is locked. */ 464 /* We think that the drive door is locked. */
@@ -528,8 +512,6 @@ enum {
528 IDE_DFLAG_NICE1 = (1 << 5), 512 IDE_DFLAG_NICE1 = (1 << 5),
529 /* device is physically present */ 513 /* device is physically present */
530 IDE_DFLAG_PRESENT = (1 << 6), 514 IDE_DFLAG_PRESENT = (1 << 6),
531 /* device ejected hint */
532 IDE_DFLAG_DEAD = (1 << 7),
533 /* id read from device (synthetic if not set) */ 515 /* id read from device (synthetic if not set) */
534 IDE_DFLAG_ID_READ = (1 << 8), 516 IDE_DFLAG_ID_READ = (1 << 8),
535 IDE_DFLAG_NOPROBE = (1 << 9), 517 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -621,7 +603,7 @@ struct ide_drive_s {
621 603
622 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 604 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
623 unsigned int cyl; /* "real" number of cyls */ 605 unsigned int cyl; /* "real" number of cyls */
624 unsigned int drive_data; /* used by set_pio_mode/selectproc */ 606 unsigned int drive_data; /* used by set_pio_mode/dev_select() */
625 unsigned int failures; /* current failure count */ 607 unsigned int failures; /* current failure count */
626 unsigned int max_failures; /* maximum allowed failure count */ 608 unsigned int max_failures; /* maximum allowed failure count */
627 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 609 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -643,8 +625,11 @@ struct ide_drive_s {
643 /* current packet command */ 625 /* current packet command */
644 struct ide_atapi_pc *pc; 626 struct ide_atapi_pc *pc;
645 627
628 /* last failed packet command */
629 struct ide_atapi_pc *failed_pc;
630
646 /* callback for packet commands */ 631 /* callback for packet commands */
647 void (*pc_callback)(struct ide_drive_s *, int); 632 int (*pc_callback)(struct ide_drive_s *, int);
648 633
649 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); 634 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
650 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 635 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
@@ -674,16 +659,16 @@ struct ide_tp_ops {
674 void (*exec_command)(struct hwif_s *, u8); 659 void (*exec_command)(struct hwif_s *, u8);
675 u8 (*read_status)(struct hwif_s *); 660 u8 (*read_status)(struct hwif_s *);
676 u8 (*read_altstatus)(struct hwif_s *); 661 u8 (*read_altstatus)(struct hwif_s *);
662 void (*write_devctl)(struct hwif_s *, u8);
677 663
678 void (*set_irq)(struct hwif_s *, int); 664 void (*dev_select)(ide_drive_t *);
665 void (*tf_load)(ide_drive_t *, struct ide_cmd *);
666 void (*tf_read)(ide_drive_t *, struct ide_cmd *);
679 667
680 void (*tf_load)(ide_drive_t *, struct ide_task_s *); 668 void (*input_data)(ide_drive_t *, struct ide_cmd *,
681 void (*tf_read)(ide_drive_t *, struct ide_task_s *); 669 void *, unsigned int);
682 670 void (*output_data)(ide_drive_t *, struct ide_cmd *,
683 void (*input_data)(ide_drive_t *, struct request *, void *, 671 void *, unsigned int);
684 unsigned int);
685 void (*output_data)(ide_drive_t *, struct request *, void *,
686 unsigned int);
687}; 672};
688 673
689extern const struct ide_tp_ops default_tp_ops; 674extern const struct ide_tp_ops default_tp_ops;
@@ -694,7 +679,6 @@ extern const struct ide_tp_ops default_tp_ops;
694 * @init_dev: host specific initialization of a device 679 * @init_dev: host specific initialization of a device
695 * @set_pio_mode: routine to program host for PIO mode 680 * @set_pio_mode: routine to program host for PIO mode
696 * @set_dma_mode: routine to program host for DMA mode 681 * @set_dma_mode: routine to program host for DMA mode
697 * @selectproc: tweaks hardware to select drive
698 * @reset_poll: chipset polling based on hba specifics 682 * @reset_poll: chipset polling based on hba specifics
699 * @pre_reset: chipset specific changes to default for device-hba resets 683 * @pre_reset: chipset specific changes to default for device-hba resets
700 * @resetproc: routine to reset controller after a disk reset 684 * @resetproc: routine to reset controller after a disk reset
@@ -711,7 +695,6 @@ struct ide_port_ops {
711 void (*init_dev)(ide_drive_t *); 695 void (*init_dev)(ide_drive_t *);
712 void (*set_pio_mode)(ide_drive_t *, const u8); 696 void (*set_pio_mode)(ide_drive_t *, const u8);
713 void (*set_dma_mode)(ide_drive_t *, const u8); 697 void (*set_dma_mode)(ide_drive_t *, const u8);
714 void (*selectproc)(ide_drive_t *);
715 int (*reset_poll)(ide_drive_t *); 698 int (*reset_poll)(ide_drive_t *);
716 void (*pre_reset)(ide_drive_t *); 699 void (*pre_reset)(ide_drive_t *);
717 void (*resetproc)(ide_drive_t *); 700 void (*resetproc)(ide_drive_t *);
@@ -727,13 +710,15 @@ struct ide_port_ops {
727 710
728struct ide_dma_ops { 711struct ide_dma_ops {
729 void (*dma_host_set)(struct ide_drive_s *, int); 712 void (*dma_host_set)(struct ide_drive_s *, int);
730 int (*dma_setup)(struct ide_drive_s *); 713 int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *);
731 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
732 void (*dma_start)(struct ide_drive_s *); 714 void (*dma_start)(struct ide_drive_s *);
733 int (*dma_end)(struct ide_drive_s *); 715 int (*dma_end)(struct ide_drive_s *);
734 int (*dma_test_irq)(struct ide_drive_s *); 716 int (*dma_test_irq)(struct ide_drive_s *);
735 void (*dma_lost_irq)(struct ide_drive_s *); 717 void (*dma_lost_irq)(struct ide_drive_s *);
736 void (*dma_timeout)(struct ide_drive_s *); 718 /* below ones are optional */
719 int (*dma_check)(struct ide_drive_s *, struct ide_cmd *);
720 int (*dma_timer_expiry)(struct ide_drive_s *);
721 void (*dma_clear)(struct ide_drive_s *);
737 /* 722 /*
738 * The following method is optional and only required to be 723 * The following method is optional and only required to be
739 * implemented for the SFF-8038i compatible controllers. 724 * implemented for the SFF-8038i compatible controllers.
@@ -796,19 +781,8 @@ typedef struct hwif_s {
796 /* Scatter-gather list used to build the above */ 781 /* Scatter-gather list used to build the above */
797 struct scatterlist *sg_table; 782 struct scatterlist *sg_table;
798 int sg_max_nents; /* Maximum number of entries in it */ 783 int sg_max_nents; /* Maximum number of entries in it */
799 int sg_nents; /* Current number of entries in it */
800 int orig_sg_nents;
801 int sg_dma_direction; /* dma transfer direction */
802
803 /* data phase of the active command (currently only valid for PIO/DMA) */
804 int data_phase;
805 784
806 struct ide_task_s task; /* current command */ 785 struct ide_cmd cmd; /* current command */
807
808 unsigned int nsect;
809 unsigned int nleft;
810 struct scatterlist *cursg;
811 unsigned int cursg_ofs;
812 786
813 int rqsize; /* max sectors per request */ 787 int rqsize; /* max sectors per request */
814 int irq; /* our irq number */ 788 int irq; /* our irq number */
@@ -866,9 +840,18 @@ struct ide_host {
866 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 840 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
867 unsigned int n_ports; 841 unsigned int n_ports;
868 struct device *dev[2]; 842 struct device *dev[2];
869 unsigned int (*init_chipset)(struct pci_dev *); 843
844 int (*init_chipset)(struct pci_dev *);
845
846 void (*get_lock)(irq_handler_t, void *);
847 void (*release_lock)(void);
848
870 irq_handler_t irq_handler; 849 irq_handler_t irq_handler;
850
871 unsigned long host_flags; 851 unsigned long host_flags;
852
853 int irq_flags;
854
872 void *host_priv; 855 void *host_priv;
873 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 856 ide_hwif_t *cur_port; /* for hosts requiring serialization */
874 857
@@ -885,7 +868,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
885typedef int (ide_expiry_t)(ide_drive_t *); 868typedef int (ide_expiry_t)(ide_drive_t *);
886 869
887/* used by ide-cd, ide-floppy, etc. */ 870/* used by ide-cd, ide-floppy, etc. */
888typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 871typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
889 872
890extern struct mutex ide_setting_mtx; 873extern struct mutex ide_setting_mtx;
891 874
@@ -1061,10 +1044,11 @@ enum {
1061}; 1044};
1062 1045
1063/* DRV_NAME has to be defined in the driver before using the macro below */ 1046/* DRV_NAME has to be defined in the driver before using the macro below */
1064#define __ide_debug_log(lvl, fmt, args...) \ 1047#define __ide_debug_log(lvl, fmt, args...) \
1065{ \ 1048{ \
1066 if (unlikely(drive->debug_mask & lvl)) \ 1049 if (unlikely(drive->debug_mask & lvl)) \
1067 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ 1050 printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \
1051 __func__, ## args); \
1068} 1052}
1069 1053
1070/* 1054/*
@@ -1103,7 +1087,7 @@ int generic_ide_resume(struct device *);
1103 1087
1104void ide_complete_power_step(ide_drive_t *, struct request *); 1088void ide_complete_power_step(ide_drive_t *, struct request *);
1105ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); 1089ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1106void ide_complete_pm_request(ide_drive_t *, struct request *); 1090void ide_complete_pm_rq(ide_drive_t *, struct request *);
1107void ide_check_pm_state(ide_drive_t *, struct request *); 1091void ide_check_pm_state(ide_drive_t *, struct request *);
1108 1092
1109/* 1093/*
@@ -1115,7 +1099,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
1115struct ide_driver { 1099struct ide_driver {
1116 const char *version; 1100 const char *version;
1117 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1101 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1118 int (*end_request)(ide_drive_t *, int, int);
1119 struct device_driver gen_driver; 1102 struct device_driver gen_driver;
1120 int (*probe)(ide_drive_t *); 1103 int (*probe)(ide_drive_t *);
1121 void (*remove)(ide_drive_t *); 1104 void (*remove)(ide_drive_t *);
@@ -1146,16 +1129,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1146extern int ide_vlb_clk; 1129extern int ide_vlb_clk;
1147extern int ide_pci_clk; 1130extern int ide_pci_clk;
1148 1131
1149extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1132unsigned int ide_rq_bytes(struct request *);
1150int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1133int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
1151 int uptodate, int nr_sectors); 1134void ide_kill_rq(ide_drive_t *, struct request *);
1152
1153extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1154 1135
1155void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 1136void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1156 ide_expiry_t *); 1137void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1157 1138
1158void ide_execute_pkt_cmd(ide_drive_t *); 1139void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
1140 unsigned int);
1159 1141
1160void ide_pad_transfer(ide_drive_t *, int, int); 1142void ide_pad_transfer(ide_drive_t *, int, int);
1161 1143
@@ -1169,41 +1151,36 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1169 1151
1170int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1152int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1171 1153
1154ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
1155ide_startstop_t ide_do_devset(ide_drive_t *, struct request *);
1156
1172extern ide_startstop_t ide_do_reset (ide_drive_t *); 1157extern ide_startstop_t ide_do_reset (ide_drive_t *);
1173 1158
1174extern int ide_devset_execute(ide_drive_t *drive, 1159extern int ide_devset_execute(ide_drive_t *drive,
1175 const struct ide_devset *setting, int arg); 1160 const struct ide_devset *setting, int arg);
1176 1161
1177extern void ide_do_drive_cmd(ide_drive_t *, struct request *); 1162void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
1178 1163int ide_complete_rq(ide_drive_t *, int, unsigned int);
1179extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1180 1164
1181void ide_tf_dump(const char *, struct ide_taskfile *); 1165void ide_tf_dump(const char *, struct ide_taskfile *);
1182 1166
1183void ide_exec_command(ide_hwif_t *, u8); 1167void ide_exec_command(ide_hwif_t *, u8);
1184u8 ide_read_status(ide_hwif_t *); 1168u8 ide_read_status(ide_hwif_t *);
1185u8 ide_read_altstatus(ide_hwif_t *); 1169u8 ide_read_altstatus(ide_hwif_t *);
1170void ide_write_devctl(ide_hwif_t *, u8);
1186 1171
1187void ide_set_irq(ide_hwif_t *, int); 1172void ide_dev_select(ide_drive_t *);
1173void ide_tf_load(ide_drive_t *, struct ide_cmd *);
1174void ide_tf_read(ide_drive_t *, struct ide_cmd *);
1188 1175
1189void ide_tf_load(ide_drive_t *, ide_task_t *); 1176void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1190void ide_tf_read(ide_drive_t *, ide_task_t *); 1177void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1191 1178
1192void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
1193void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
1194
1195int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1196
1197extern void SELECT_DRIVE(ide_drive_t *);
1198void SELECT_MASK(ide_drive_t *, int); 1179void SELECT_MASK(ide_drive_t *, int);
1199 1180
1200u8 ide_read_error(ide_drive_t *); 1181u8 ide_read_error(ide_drive_t *);
1201void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1182void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1202 1183
1203extern int drive_is_ready(ide_drive_t *);
1204
1205void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1206
1207int ide_check_atapi_device(ide_drive_t *, const char *); 1184int ide_check_atapi_device(ide_drive_t *, const char *);
1208 1185
1209void ide_init_pc(struct ide_atapi_pc *); 1186void ide_init_pc(struct ide_atapi_pc *);
@@ -1240,16 +1217,20 @@ int ide_cd_expiry(ide_drive_t *);
1240 1217
1241int ide_cd_get_xferlen(struct request *); 1218int ide_cd_get_xferlen(struct request *);
1242 1219
1243ide_startstop_t ide_issue_pc(ide_drive_t *); 1220ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
1221
1222ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
1244 1223
1245ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1224void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int);
1246 1225
1247void task_end_request(ide_drive_t *, struct request *, u8); 1226void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
1248 1227
1249int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); 1228int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
1250int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1229int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1251 1230
1252int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1231int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1232
1233int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1253 1234
1254extern int ide_driveid_update(ide_drive_t *); 1235extern int ide_driveid_update(ide_drive_t *);
1255extern int ide_config_drive_speed(ide_drive_t *, u8); 1236extern int ide_config_drive_speed(ide_drive_t *, u8);
@@ -1280,7 +1261,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1280 return 0; 1261 return 0;
1281} 1262}
1282 1263
1283void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, 1264void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
1284 hw_regs_t *, hw_regs_t **); 1265 hw_regs_t *, hw_regs_t **);
1285void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1266void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1286 1267
@@ -1349,10 +1330,10 @@ enum {
1349 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1330 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1350 /* serialize ports */ 1331 /* serialize ports */
1351 IDE_HFLAG_SERIALIZE = (1 << 20), 1332 IDE_HFLAG_SERIALIZE = (1 << 20),
1352 /* use legacy IRQs */ 1333 /* host is DTC2278 */
1353 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1334 IDE_HFLAG_DTC2278 = (1 << 21),
1354 /* force use of legacy IRQs */ 1335 /* 4 devices on a single set of I/O ports */
1355 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), 1336 IDE_HFLAG_4DRIVES = (1 << 22),
1356 /* host is TRM290 */ 1337 /* host is TRM290 */
1357 IDE_HFLAG_TRM290 = (1 << 23), 1338 IDE_HFLAG_TRM290 = (1 << 23),
1358 /* use 32-bit I/O ops */ 1339 /* use 32-bit I/O ops */
@@ -1380,7 +1361,12 @@ enum {
1380 1361
1381struct ide_port_info { 1362struct ide_port_info {
1382 char *name; 1363 char *name;
1383 unsigned int (*init_chipset)(struct pci_dev *); 1364
1365 int (*init_chipset)(struct pci_dev *);
1366
1367 void (*get_lock)(irq_handler_t, void *);
1368 void (*release_lock)(void);
1369
1384 void (*init_iops)(ide_hwif_t *); 1370 void (*init_iops)(ide_hwif_t *);
1385 void (*init_hwif)(ide_hwif_t *); 1371 void (*init_hwif)(ide_hwif_t *);
1386 int (*init_dma)(ide_hwif_t *, 1372 int (*init_dma)(ide_hwif_t *,
@@ -1397,6 +1383,9 @@ struct ide_port_info {
1397 u16 max_sectors; /* if < than the default one */ 1383 u16 max_sectors; /* if < than the default one */
1398 1384
1399 u32 host_flags; 1385 u32 host_flags;
1386
1387 int irq_flags;
1388
1400 u8 pio_mask; 1389 u8 pio_mask;
1401 u8 swdma_mask; 1390 u8 swdma_mask;
1402 u8 mwdma_mask; 1391 u8 mwdma_mask;
@@ -1416,8 +1405,8 @@ int ide_pci_resume(struct pci_dev *);
1416#define ide_pci_resume NULL 1405#define ide_pci_resume NULL
1417#endif 1406#endif
1418 1407
1419void ide_map_sg(ide_drive_t *, struct request *); 1408void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1420void ide_init_sg_cmd(ide_drive_t *, struct request *); 1409void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1421 1410
1422#define BAD_DMA_DRIVE 0 1411#define BAD_DMA_DRIVE 0
1423#define GOOD_DMA_DRIVE 1 1412#define GOOD_DMA_DRIVE 1
@@ -1451,18 +1440,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *);
1451int ide_allocate_dma_engine(ide_hwif_t *); 1440int ide_allocate_dma_engine(ide_hwif_t *);
1452void ide_release_dma_engine(ide_hwif_t *); 1441void ide_release_dma_engine(ide_hwif_t *);
1453 1442
1454int ide_build_sglist(ide_drive_t *, struct request *); 1443int ide_dma_prepare(ide_drive_t *, struct ide_cmd *);
1455void ide_destroy_dmatable(ide_drive_t *); 1444void ide_dma_unmap_sg(ide_drive_t *, struct ide_cmd *);
1456 1445
1457#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1446#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1458int config_drive_for_dma(ide_drive_t *); 1447int config_drive_for_dma(ide_drive_t *);
1459extern int ide_build_dmatable(ide_drive_t *, struct request *); 1448int ide_build_dmatable(ide_drive_t *, struct ide_cmd *);
1460void ide_dma_host_set(ide_drive_t *, int); 1449void ide_dma_host_set(ide_drive_t *, int);
1461extern int ide_dma_setup(ide_drive_t *); 1450int ide_dma_setup(ide_drive_t *, struct ide_cmd *);
1462void ide_dma_exec_cmd(ide_drive_t *, u8);
1463extern void ide_dma_start(ide_drive_t *); 1451extern void ide_dma_start(ide_drive_t *);
1464int ide_dma_end(ide_drive_t *); 1452int ide_dma_end(ide_drive_t *);
1465int ide_dma_test_irq(ide_drive_t *); 1453int ide_dma_test_irq(ide_drive_t *);
1454int ide_dma_sff_timer_expiry(ide_drive_t *);
1466u8 ide_dma_sff_read_status(ide_hwif_t *); 1455u8 ide_dma_sff_read_status(ide_hwif_t *);
1467extern const struct ide_dma_ops sff_dma_ops; 1456extern const struct ide_dma_ops sff_dma_ops;
1468#else 1457#else
@@ -1470,7 +1459,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1470#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1459#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1471 1460
1472void ide_dma_lost_irq(ide_drive_t *); 1461void ide_dma_lost_irq(ide_drive_t *);
1473void ide_dma_timeout(ide_drive_t *); 1462ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
1474 1463
1475#else 1464#else
1476static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1465static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
@@ -1482,21 +1471,29 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1482static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1471static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1483static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1472static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1484static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1473static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1474static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; }
1475static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
1485static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1476static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1477static inline int ide_dma_prepare(ide_drive_t *drive,
1478 struct ide_cmd *cmd) { return 1; }
1479static inline void ide_dma_unmap_sg(ide_drive_t *drive,
1480 struct ide_cmd *cmd) { ; }
1486#endif /* CONFIG_BLK_DEV_IDEDMA */ 1481#endif /* CONFIG_BLK_DEV_IDEDMA */
1487 1482
1488#ifdef CONFIG_BLK_DEV_IDEACPI 1483#ifdef CONFIG_BLK_DEV_IDEACPI
1484int ide_acpi_init(void);
1489extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1485extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1490extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1486extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1491extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1487extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1492extern void ide_acpi_init(ide_hwif_t *hwif); 1488void ide_acpi_init_port(ide_hwif_t *);
1493void ide_acpi_port_init_devices(ide_hwif_t *); 1489void ide_acpi_port_init_devices(ide_hwif_t *);
1494extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1490extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1495#else 1491#else
1492static inline int ide_acpi_init(void) { return 0; }
1496static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1493static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1497static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1494static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1498static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1495static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1499static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1496static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; }
1500static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } 1497static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1501static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1498static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1502#endif 1499#endif
@@ -1530,9 +1527,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1530 hwif->hwif_data = data; 1527 hwif->hwif_data = data;
1531} 1528}
1532 1529
1533const char *ide_xfer_verbose(u8 mode);
1534extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1530extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1535extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1536 1531
1537u64 ide_get_lba_addr(struct ide_taskfile *, int); 1532u64 ide_get_lba_addr(struct ide_taskfile *, int);
1538u8 ide_dump_status(ide_drive_t *, const char *, u8); 1533u8 ide_dump_status(ide_drive_t *, const char *, u8);
@@ -1571,14 +1566,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1571 struct ide_timing *, unsigned int); 1566 struct ide_timing *, unsigned int);
1572int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); 1567int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1573 1568
1569#ifdef CONFIG_IDE_XFER_MODE
1574int ide_scan_pio_blacklist(char *); 1570int ide_scan_pio_blacklist(char *);
1575 1571const char *ide_xfer_verbose(u8);
1576u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1572u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1577
1578int ide_set_pio_mode(ide_drive_t *, u8); 1573int ide_set_pio_mode(ide_drive_t *, u8);
1579int ide_set_dma_mode(ide_drive_t *, u8); 1574int ide_set_dma_mode(ide_drive_t *, u8);
1580
1581void ide_set_pio(ide_drive_t *, u8); 1575void ide_set_pio(ide_drive_t *, u8);
1576int ide_set_xfer_rate(ide_drive_t *, u8);
1577#else
1578static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; }
1579static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; }
1580#endif
1582 1581
1583static inline void ide_set_max_pio(ide_drive_t *drive) 1582static inline void ide_set_max_pio(ide_drive_t *drive)
1584{ 1583{
@@ -1611,6 +1610,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1611#define ide_port_for_each_dev(i, dev, port) \ 1610#define ide_port_for_each_dev(i, dev, port) \
1612 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1611 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1613 1612
1613#define ide_port_for_each_present_dev(i, dev, port) \
1614 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \
1615 if ((dev)->dev_flags & IDE_DFLAG_PRESENT)
1616
1614#define ide_host_for_each_port(i, port, host) \ 1617#define ide_host_for_each_port(i, port, host) \
1615 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) 1618 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1616 1619
diff --git a/include/linux/idr.h b/include/linux/idr.h
index dd846df8cd32..e968db71e33a 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -106,6 +106,7 @@ int idr_get_new(struct idr *idp, void *ptr, int *id);
106int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 106int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
107int idr_for_each(struct idr *idp, 107int idr_for_each(struct idr *idp,
108 int (*fn)(int id, void *p, void *data), void *data); 108 int (*fn)(int id, void *p, void *data), void *data);
109void *idr_get_next(struct idr *idp, int *nextid);
109void *idr_replace(struct idr *idp, void *ptr, int id); 110void *idr_replace(struct idr *idp, void *ptr, int id);
110void idr_remove(struct idr *idp, int id); 111void idr_remove(struct idr *idp, int id);
111void idr_remove_all(struct idr *idp); 112void idr_remove_all(struct idr *idp);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index c4e6ca1a6306..4b501b48ce86 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -18,6 +18,22 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
20 20
21/*
22 * DS bit usage
23 *
24 * TA = transmitter address
25 * RA = receiver address
26 * DA = destination address
27 * SA = source address
28 *
29 * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
30 * -----------------------------------------------------------------
31 * 0 0 DA SA BSSID - IBSS/DLS
32 * 0 1 DA BSSID SA - AP -> STA
33 * 1 0 BSSID SA DA - AP <- STA
34 * 1 1 RA TA DA SA unspecified (WDS)
35 */
36
21#define FCS_LEN 4 37#define FCS_LEN 4
22 38
23#define IEEE80211_FCTL_VERS 0x0003 39#define IEEE80211_FCTL_VERS 0x0003
@@ -527,6 +543,8 @@ struct ieee80211_tim_ie {
527 u8 virtual_map[0]; 543 u8 virtual_map[0];
528} __attribute__ ((packed)); 544} __attribute__ ((packed));
529 545
546#define WLAN_SA_QUERY_TR_ID_LEN 16
547
530struct ieee80211_mgmt { 548struct ieee80211_mgmt {
531 __le16 frame_control; 549 __le16 frame_control;
532 __le16 duration; 550 __le16 duration;
@@ -646,6 +664,10 @@ struct ieee80211_mgmt {
646 u8 action_code; 664 u8 action_code;
647 u8 variable[0]; 665 u8 variable[0];
648 } __attribute__((packed)) mesh_action; 666 } __attribute__((packed)) mesh_action;
667 struct {
668 u8 action;
669 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
670 } __attribute__ ((packed)) sa_query;
649 } u; 671 } u;
650 } __attribute__ ((packed)) action; 672 } __attribute__ ((packed)) action;
651 } u; 673 } u;
@@ -655,6 +677,15 @@ struct ieee80211_mgmt {
655#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 677#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
656 678
657 679
680/* Management MIC information element (IEEE 802.11w) */
681struct ieee80211_mmie {
682 u8 element_id;
683 u8 length;
684 __le16 key_id;
685 u8 sequence_number[6];
686 u8 mic[8];
687} __attribute__ ((packed));
688
658/* Control frames */ 689/* Control frames */
659struct ieee80211_rts { 690struct ieee80211_rts {
660 __le16 frame_control; 691 __le16 frame_control;
@@ -836,6 +867,7 @@ struct ieee80211_ht_info {
836/* Authentication algorithms */ 867/* Authentication algorithms */
837#define WLAN_AUTH_OPEN 0 868#define WLAN_AUTH_OPEN 0
838#define WLAN_AUTH_SHARED_KEY 1 869#define WLAN_AUTH_SHARED_KEY 1
870#define WLAN_AUTH_FT 2
839#define WLAN_AUTH_LEAP 128 871#define WLAN_AUTH_LEAP 128
840 872
841#define WLAN_AUTH_CHALLENGE_LEN 128 873#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -899,6 +931,9 @@ enum ieee80211_statuscode {
899 /* 802.11g */ 931 /* 802.11g */
900 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, 932 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
901 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, 933 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
934 /* 802.11w */
935 WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
936 WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
902 /* 802.11i */ 937 /* 802.11i */
903 WLAN_STATUS_INVALID_IE = 40, 938 WLAN_STATUS_INVALID_IE = 40,
904 WLAN_STATUS_INVALID_GROUP_CIPHER = 41, 939 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
@@ -1018,6 +1053,8 @@ enum ieee80211_eid {
1018 WLAN_EID_HT_INFORMATION = 61, 1053 WLAN_EID_HT_INFORMATION = 61,
1019 /* 802.11i */ 1054 /* 802.11i */
1020 WLAN_EID_RSN = 48, 1055 WLAN_EID_RSN = 48,
1056 WLAN_EID_TIMEOUT_INTERVAL = 56,
1057 WLAN_EID_MMIE = 76 /* 802.11w */,
1021 WLAN_EID_WPA = 221, 1058 WLAN_EID_WPA = 221,
1022 WLAN_EID_GENERIC = 221, 1059 WLAN_EID_GENERIC = 221,
1023 WLAN_EID_VENDOR_SPECIFIC = 221, 1060 WLAN_EID_VENDOR_SPECIFIC = 221,
@@ -1030,6 +1067,8 @@ enum ieee80211_category {
1030 WLAN_CATEGORY_QOS = 1, 1067 WLAN_CATEGORY_QOS = 1,
1031 WLAN_CATEGORY_DLS = 2, 1068 WLAN_CATEGORY_DLS = 2,
1032 WLAN_CATEGORY_BACK = 3, 1069 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4,
1071 WLAN_CATEGORY_SA_QUERY = 8,
1033 WLAN_CATEGORY_WMM = 17, 1072 WLAN_CATEGORY_WMM = 17,
1034}; 1073};
1035 1074
@@ -1104,6 +1143,12 @@ struct ieee80211_country_ie_triplet {
1104 }; 1143 };
1105} __attribute__ ((packed)); 1144} __attribute__ ((packed));
1106 1145
1146enum ieee80211_timeout_interval_type {
1147 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
1148 WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
1149 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
1150};
1151
1107/* BACK action code */ 1152/* BACK action code */
1108enum ieee80211_back_actioncode { 1153enum ieee80211_back_actioncode {
1109 WLAN_ACTION_ADDBA_REQ = 0, 1154 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1118,6 +1163,13 @@ enum ieee80211_back_parties {
1118 WLAN_BACK_TIMER = 2, 1163 WLAN_BACK_TIMER = 2,
1119}; 1164};
1120 1165
1166/* SA Query action */
1167enum ieee80211_sa_query_action {
1168 WLAN_ACTION_SA_QUERY_REQUEST = 0,
1169 WLAN_ACTION_SA_QUERY_RESPONSE = 1,
1170};
1171
1172
1121/* A-MSDU 802.11n */ 1173/* A-MSDU 802.11n */
1122#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 1174#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1123 1175
@@ -1128,6 +1180,7 @@ enum ieee80211_back_parties {
1128/* reserved: 0x000FAC03 */ 1180/* reserved: 0x000FAC03 */
1129#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 1181#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
1130#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1182#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1183#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1131 1184
1132#define WLAN_MAX_KEY_LEN 32 1185#define WLAN_MAX_KEY_LEN 32
1133 1186
@@ -1185,4 +1238,149 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1185 return hdr->addr1; 1238 return hdr->addr1;
1186} 1239}
1187 1240
1241/**
1242 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
1243 * @hdr: the frame (buffer must include at least the first octet of payload)
1244 */
1245static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1246{
1247 if (ieee80211_is_disassoc(hdr->frame_control) ||
1248 ieee80211_is_deauth(hdr->frame_control))
1249 return true;
1250
1251 if (ieee80211_is_action(hdr->frame_control)) {
1252 u8 *category;
1253
1254 /*
1255 * Action frames, excluding Public Action frames, are Robust
1256 * Management Frames. However, if we are looking at a Protected
1257 * frame, skip the check since the data may be encrypted and
1258 * the frame has already been found to be a Robust Management
1259 * Frame (by the other end).
1260 */
1261 if (ieee80211_has_protected(hdr->frame_control))
1262 return true;
1263 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC;
1265 }
1266
1267 return false;
1268}
1269
1270/**
1271 * ieee80211_fhss_chan_to_freq - get channel frequency
1272 * @channel: the FHSS channel
1273 *
1274 * Convert IEEE802.11 FHSS channel to frequency (MHz)
1275 * Ref IEEE 802.11-2007 section 14.6
1276 */
1277static inline int ieee80211_fhss_chan_to_freq(int channel)
1278{
1279 if ((channel > 1) && (channel < 96))
1280 return channel + 2400;
1281 else
1282 return -1;
1283}
1284
1285/**
1286 * ieee80211_freq_to_fhss_chan - get channel
1287 * @freq: the channels frequency
1288 *
1289 * Convert frequency (MHz) to IEEE802.11 FHSS channel
1290 * Ref IEEE 802.11-2007 section 14.6
1291 */
1292static inline int ieee80211_freq_to_fhss_chan(int freq)
1293{
1294 if ((freq > 2401) && (freq < 2496))
1295 return freq - 2400;
1296 else
1297 return -1;
1298}
1299
1300/**
1301 * ieee80211_dsss_chan_to_freq - get channel center frequency
1302 * @channel: the DSSS channel
1303 *
1304 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
1305 * Ref IEEE 802.11-2007 section 15.6
1306 */
1307static inline int ieee80211_dsss_chan_to_freq(int channel)
1308{
1309 if ((channel > 0) && (channel < 14))
1310 return 2407 + (channel * 5);
1311 else if (channel == 14)
1312 return 2484;
1313 else
1314 return -1;
1315}
1316
1317/**
1318 * ieee80211_freq_to_dsss_chan - get channel
1319 * @freq: the frequency
1320 *
1321 * Convert frequency (MHz) to IEEE802.11 DSSS channel
1322 * Ref IEEE 802.11-2007 section 15.6
1323 *
1324 * This routine selects the channel with the closest center frequency.
1325 */
1326static inline int ieee80211_freq_to_dsss_chan(int freq)
1327{
1328 if ((freq >= 2410) && (freq < 2475))
1329 return (freq - 2405) / 5;
1330 else if ((freq >= 2482) && (freq < 2487))
1331 return 14;
1332 else
1333 return -1;
1334}
1335
1336/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
1337 * Ref IEEE 802.11-2007 section 18.4.6.2
1338 *
1339 * The channels and frequencies are the same as those defined for DSSS
1340 */
1341#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
1342#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
1343
1344/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
1345 * Ref IEEE 802.11-2007 section 19.4.2
1346 */
1347#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
1348#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
1349
1350/**
1351 * ieee80211_ofdm_chan_to_freq - get channel center frequency
1352 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1353 * @channel: the OFDM channel
1354 *
1355 * Convert IEEE802.11 OFDM channel to center frequency (MHz)
1356 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1357 */
1358static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
1359{
1360 if ((channel > 0) && (channel <= 200) &&
1361 (s_freq >= 4000))
1362 return s_freq + (channel * 5);
1363 else
1364 return -1;
1365}
1366
1367/**
1368 * ieee80211_freq_to_ofdm_channel - get channel
1369 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1370 * @freq: the frequency
1371 *
1372 * Convert frequency (MHz) to IEEE802.11 OFDM channel
1373 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1374 *
1375 * This routine selects the channel with the closest center frequency.
1376 */
1377static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1378{
1379 if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
1380 (s_freq >= 4000))
1381 return (freq + 2 - s_freq) / 5;
1382 else
1383 return -1;
1384}
1385
1188#endif /* LINUX_IEEE80211_H */ 1386#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 2a6e29620a96..1108f3e099e3 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -66,6 +66,7 @@
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ 68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
69 70
70#define IF_GET_IFACE 0x0001 /* for querying only */ 71#define IF_GET_IFACE 0x0001 /* for querying only */
71#define IF_GET_PROTO 0x0002 72#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h
index 27ea2ac445ad..0835debab115 100644
--- a/include/linux/if_arcnet.h
+++ b/include/linux/if_arcnet.h
@@ -16,6 +16,7 @@
16#ifndef _LINUX_IF_ARCNET_H 16#ifndef _LINUX_IF_ARCNET_H
17#define _LINUX_IF_ARCNET_H 17#define _LINUX_IF_ARCNET_H
18 18
19#include <linux/types.h>
19#include <linux/if_ether.h> 20#include <linux/if_ether.h>
20 21
21 22
@@ -57,10 +58,10 @@
57 */ 58 */
58struct arc_rfc1201 59struct arc_rfc1201
59{ 60{
60 uint8_t proto; /* protocol ID field - varies */ 61 __u8 proto; /* protocol ID field - varies */
61 uint8_t split_flag; /* for use with split packets */ 62 __u8 split_flag; /* for use with split packets */
62 __be16 sequence; /* sequence number */ 63 __be16 sequence; /* sequence number */
63 uint8_t payload[0]; /* space remaining in packet (504 bytes)*/ 64 __u8 payload[0]; /* space remaining in packet (504 bytes)*/
64}; 65};
65#define RFC1201_HDR_SIZE 4 66#define RFC1201_HDR_SIZE 4
66 67
@@ -70,8 +71,8 @@ struct arc_rfc1201
70 */ 71 */
71struct arc_rfc1051 72struct arc_rfc1051
72{ 73{
73 uint8_t proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ 74 __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
74 uint8_t payload[0]; /* 507 bytes */ 75 __u8 payload[0]; /* 507 bytes */
75}; 76};
76#define RFC1051_HDR_SIZE 1 77#define RFC1051_HDR_SIZE 1
77 78
@@ -82,20 +83,20 @@ struct arc_rfc1051
82 */ 83 */
83struct arc_eth_encap 84struct arc_eth_encap
84{ 85{
85 uint8_t proto; /* Always ARC_P_ETHER */ 86 __u8 proto; /* Always ARC_P_ETHER */
86 struct ethhdr eth; /* standard ethernet header (yuck!) */ 87 struct ethhdr eth; /* standard ethernet header (yuck!) */
87 uint8_t payload[0]; /* 493 bytes */ 88 __u8 payload[0]; /* 493 bytes */
88}; 89};
89#define ETH_ENCAP_HDR_SIZE 14 90#define ETH_ENCAP_HDR_SIZE 14
90 91
91 92
92struct arc_cap 93struct arc_cap
93{ 94{
94 uint8_t proto; 95 __u8 proto;
95 uint8_t cookie[sizeof(int)]; /* Actually NOT sent over the network */ 96 __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */
96 union { 97 union {
97 uint8_t ack; 98 __u8 ack;
98 uint8_t raw[0]; /* 507 bytes */ 99 __u8 raw[0]; /* 507 bytes */
99 } mes; 100 } mes;
100}; 101};
101 102
@@ -109,7 +110,7 @@ struct arc_cap
109 */ 110 */
110struct arc_hardware 111struct arc_hardware
111{ 112{
112 uint8_t source, /* source ARCnet - filled in automagically */ 113 __u8 source, /* source ARCnet - filled in automagically */
113 dest, /* destination ARCnet - 0 for broadcast */ 114 dest, /* destination ARCnet - 0 for broadcast */
114 offset[2]; /* offset bytes (some weird semantics) */ 115 offset[2]; /* offset bytes (some weird semantics) */
115}; 116};
@@ -130,7 +131,7 @@ struct archdr
130 struct arc_rfc1051 rfc1051; 131 struct arc_rfc1051 rfc1051;
131 struct arc_eth_encap eth_encap; 132 struct arc_eth_encap eth_encap;
132 struct arc_cap cap; 133 struct arc_cap cap;
133 uint8_t raw[0]; /* 508 bytes */ 134 __u8 raw[0]; /* 508 bytes */
134 } soft; 135 } soft;
135}; 136};
136 137
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 7f3c735f422b..cfe4fe1b7132 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -17,7 +17,7 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20 20
21#ifndef _LINUX_IF_ETHER_H 21#ifndef _LINUX_IF_ETHER_H
22#define _LINUX_IF_ETHER_H 22#define _LINUX_IF_ETHER_H
23 23
@@ -25,7 +25,7 @@
25 25
26/* 26/*
27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble 27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
28 * and FCS/CRC (frame check sequence). 28 * and FCS/CRC (frame check sequence).
29 */ 29 */
30 30
31#define ETH_ALEN 6 /* Octets in one ethernet addr */ 31#define ETH_ALEN 6 /* Octets in one ethernet addr */
@@ -78,12 +78,13 @@
78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
80#define ETH_P_TIPC 0x88CA /* TIPC */ 80#define ETH_P_TIPC 0x88CA /* TIPC */
81#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
81#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 82#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
82 83
83/* 84/*
84 * Non DIX types. Won't clash for 1500 types. 85 * Non DIX types. Won't clash for 1500 types.
85 */ 86 */
86 87
87#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ 88#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
88#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ 89#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
89#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ 90#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
@@ -109,7 +110,7 @@
109/* 110/*
110 * This is an Ethernet frame header. 111 * This is an Ethernet frame header.
111 */ 112 */
112 113
113struct ethhdr { 114struct ethhdr {
114 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 115 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
115 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 116 unsigned char h_source[ETH_ALEN]; /* source ether addr */
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 60e16a551dd6..673f2209453d 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -153,7 +153,6 @@ struct frhdr
153 153
154struct dlci_local 154struct dlci_local
155{ 155{
156 struct net_device_stats stats;
157 struct net_device *master; 156 struct net_device *master;
158 struct net_device *slave; 157 struct net_device *slave;
159 struct dlci_conf config; 158 struct dlci_conf config;
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index c7a66882b6d0..3a14b088c8ec 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -26,7 +26,7 @@
26 */ 26 */
27struct pppol2tp_addr 27struct pppol2tp_addr
28{ 28{
29 pid_t pid; /* pid that owns the fd. 29 __kernel_pid_t pid; /* pid that owns the fd.
30 * 0 => current */ 30 * 0 => current */
31 int fd; /* FD of UDP socket to use */ 31 int fd; /* FD of UDP socket to use */
32 32
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 30c88b2245ff..90b5fae5d714 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -95,16 +95,16 @@ struct pppoe_tag {
95} __attribute ((packed)); 95} __attribute ((packed));
96 96
97/* Tag identifiers */ 97/* Tag identifiers */
98#define PTT_EOL __constant_htons(0x0000) 98#define PTT_EOL __cpu_to_be16(0x0000)
99#define PTT_SRV_NAME __constant_htons(0x0101) 99#define PTT_SRV_NAME __cpu_to_be16(0x0101)
100#define PTT_AC_NAME __constant_htons(0x0102) 100#define PTT_AC_NAME __cpu_to_be16(0x0102)
101#define PTT_HOST_UNIQ __constant_htons(0x0103) 101#define PTT_HOST_UNIQ __cpu_to_be16(0x0103)
102#define PTT_AC_COOKIE __constant_htons(0x0104) 102#define PTT_AC_COOKIE __cpu_to_be16(0x0104)
103#define PTT_VENDOR __constant_htons(0x0105) 103#define PTT_VENDOR __cpu_to_be16(0x0105)
104#define PTT_RELAY_SID __constant_htons(0x0110) 104#define PTT_RELAY_SID __cpu_to_be16(0x0110)
105#define PTT_SRV_ERR __constant_htons(0x0201) 105#define PTT_SRV_ERR __cpu_to_be16(0x0201)
106#define PTT_SYS_ERR __constant_htons(0x0202) 106#define PTT_SYS_ERR __cpu_to_be16(0x0202)
107#define PTT_GEN_ERR __constant_htons(0x0203) 107#define PTT_GEN_ERR __cpu_to_be16(0x0203)
108 108
109struct pppoe_hdr { 109struct pppoe_hdr {
110#if defined(__LITTLE_ENDIAN_BITFIELD) 110#if defined(__LITTLE_ENDIAN_BITFIELD)
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 8529f57ba263..049d6c9428db 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -46,6 +46,8 @@
46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) 46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
47#define TUNSETTXFILTER _IOW('T', 209, unsigned int) 47#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
48#define TUNGETIFF _IOR('T', 210, unsigned int) 48#define TUNGETIFF _IOR('T', 210, unsigned int)
49#define TUNGETSNDBUF _IOR('T', 211, int)
50#define TUNSETSNDBUF _IOW('T', 212, int)
49 51
50/* TUNSETIFF ifr flags */ 52/* TUNSETIFF ifr flags */
51#define IFF_TUN 0x0001 53#define IFF_TUN 0x0001
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 82c43624c067..5a9aae4adb44 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -16,14 +16,14 @@
16#define SIOCDELPRL (SIOCDEVPRIVATE + 6) 16#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
17#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) 17#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
18 18
19#define GRE_CSUM __constant_htons(0x8000) 19#define GRE_CSUM __cpu_to_be16(0x8000)
20#define GRE_ROUTING __constant_htons(0x4000) 20#define GRE_ROUTING __cpu_to_be16(0x4000)
21#define GRE_KEY __constant_htons(0x2000) 21#define GRE_KEY __cpu_to_be16(0x2000)
22#define GRE_SEQ __constant_htons(0x1000) 22#define GRE_SEQ __cpu_to_be16(0x1000)
23#define GRE_STRICT __constant_htons(0x0800) 23#define GRE_STRICT __cpu_to_be16(0x0800)
24#define GRE_REC __constant_htons(0x0700) 24#define GRE_REC __cpu_to_be16(0x0700)
25#define GRE_FLAGS __constant_htons(0x00F8) 25#define GRE_FLAGS __cpu_to_be16(0x00F8)
26#define GRE_VERSION __constant_htons(0x0007) 26#define GRE_VERSION __cpu_to_be16(0x0007)
27 27
28struct ip_tunnel_parm 28struct ip_tunnel_parm
29{ 29{
diff --git a/include/linux/ima.h b/include/linux/ima.h
new file mode 100644
index 000000000000..0e2aa45cb0ce
--- /dev/null
+++ b/include/linux/ima.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2008 IBM Corporation
3 * Author: Mimi Zohar <zohar@us.ibm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
8 */
9
10#ifndef _LINUX_IMA_H
11#define _LINUX_IMA_H
12
13#include <linux/fs.h>
14struct linux_binprm;
15
16#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_inode_alloc(struct inode *inode);
19extern void ima_inode_free(struct inode *inode);
20extern int ima_path_check(struct path *path, int mask);
21extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_shm_check(struct file *file);
24
25#else
26static inline int ima_bprm_check(struct linux_binprm *bprm)
27{
28 return 0;
29}
30
31static inline int ima_inode_alloc(struct inode *inode)
32{
33 return 0;
34}
35
36static inline void ima_inode_free(struct inode *inode)
37{
38 return;
39}
40
41static inline int ima_path_check(struct path *path, int mask)
42{
43 return 0;
44}
45
46static inline void ima_file_free(struct file *file)
47{
48 return;
49}
50
51static inline int ima_file_mmap(struct file *file, unsigned long prot)
52{
53 return 0;
54}
55
56static inline void ima_shm_check(struct file *file)
57{
58 return;
59}
60#endif /* CONFIG_IMA_H */
61#endif /* _LINUX_IMA_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 06fcdb45106b..acef2a770b6b 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -108,6 +108,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
108#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) 108#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER)
109#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) 109#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
110#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) 110#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
111#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
111 112
112struct in_ifaddr 113struct in_ifaddr
113{ 114{
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index cada05447bc8..dcfb93337e9a 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -148,6 +148,7 @@ extern struct cred init_cred;
148 .nr_cpus_allowed = NR_CPUS, \ 148 .nr_cpus_allowed = NR_CPUS, \
149 }, \ 149 }, \
150 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 150 .tasks = LIST_HEAD_INIT(tsk.tasks), \
151 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
151 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ 152 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
152 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ 153 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
153 .real_parent = &tsk, \ 154 .real_parent = &tsk, \
diff --git a/include/linux/input.h b/include/linux/input.h
index 1249a0c20a38..6b28048fc568 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -661,6 +661,7 @@ struct input_absinfo {
661#define SW_DOCK 0x05 /* set = plugged into dock */ 661#define SW_DOCK 0x05 /* set = plugged into dock */
662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ 662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ 663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
664#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
664#define SW_MAX 0x0f 665#define SW_MAX 0x0f
665#define SW_CNT (SW_MAX+1) 666#define SW_CNT (SW_MAX+1)
666 667
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index d2e3cbfba14f..aa8c53171233 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -123,7 +123,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
123#define ecap_eim_support(e) ((e >> 4) & 0x1) 123#define ecap_eim_support(e) ((e >> 4) & 0x1)
124#define ecap_ir_support(e) ((e >> 3) & 0x1) 124#define ecap_ir_support(e) ((e >> 3) & 0x1)
125#define ecap_max_handle_mask(e) ((e >> 20) & 0xf) 125#define ecap_max_handle_mask(e) ((e >> 20) & 0xf)
126 126#define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */
127 127
128/* IOTLB_REG */ 128/* IOTLB_REG */
129#define DMA_TLB_FLUSH_GRANU_OFFSET 60 129#define DMA_TLB_FLUSH_GRANU_OFFSET 60
@@ -164,6 +164,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
164#define DMA_GCMD_QIE (((u32)1) << 26) 164#define DMA_GCMD_QIE (((u32)1) << 26)
165#define DMA_GCMD_SIRTP (((u32)1) << 24) 165#define DMA_GCMD_SIRTP (((u32)1) << 24)
166#define DMA_GCMD_IRE (((u32) 1) << 25) 166#define DMA_GCMD_IRE (((u32) 1) << 25)
167#define DMA_GCMD_CFI (((u32) 1) << 23)
167 168
168/* GSTS_REG */ 169/* GSTS_REG */
169#define DMA_GSTS_TES (((u32)1) << 31) 170#define DMA_GSTS_TES (((u32)1) << 31)
@@ -174,6 +175,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
174#define DMA_GSTS_QIES (((u32)1) << 26) 175#define DMA_GSTS_QIES (((u32)1) << 26)
175#define DMA_GSTS_IRTPS (((u32)1) << 24) 176#define DMA_GSTS_IRTPS (((u32)1) << 24)
176#define DMA_GSTS_IRES (((u32)1) << 25) 177#define DMA_GSTS_IRES (((u32)1) << 25)
178#define DMA_GSTS_CFIS (((u32)1) << 23)
177 179
178/* CCMD_REG */ 180/* CCMD_REG */
179#define DMA_CCMD_ICC (((u64)1) << 63) 181#define DMA_CCMD_ICC (((u64)1) << 63)
@@ -284,6 +286,14 @@ struct iommu_flush {
284 unsigned int size_order, u64 type, int non_present_entry_flush); 286 unsigned int size_order, u64 type, int non_present_entry_flush);
285}; 287};
286 288
289enum {
290 SR_DMAR_FECTL_REG,
291 SR_DMAR_FEDATA_REG,
292 SR_DMAR_FEADDR_REG,
293 SR_DMAR_FEUADDR_REG,
294 MAX_SR_DMAR_REGS
295};
296
287struct intel_iommu { 297struct intel_iommu {
288 void __iomem *reg; /* Pointer to hardware regs, virtual addr */ 298 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
289 u64 cap; 299 u64 cap;
@@ -292,6 +302,8 @@ struct intel_iommu {
292 spinlock_t register_lock; /* protect register handling */ 302 spinlock_t register_lock; /* protect register handling */
293 int seq_id; /* sequence id of the iommu */ 303 int seq_id; /* sequence id of the iommu */
294 int agaw; /* agaw of this iommu */ 304 int agaw; /* agaw of this iommu */
305 unsigned int irq;
306 unsigned char name[13]; /* Device Name */
295 307
296#ifdef CONFIG_DMAR 308#ifdef CONFIG_DMAR
297 unsigned long *domain_ids; /* bitmap of domains */ 309 unsigned long *domain_ids; /* bitmap of domains */
@@ -299,11 +311,11 @@ struct intel_iommu {
299 spinlock_t lock; /* protect context, domain ids */ 311 spinlock_t lock; /* protect context, domain ids */
300 struct root_entry *root_entry; /* virtual address */ 312 struct root_entry *root_entry; /* virtual address */
301 313
302 unsigned int irq;
303 unsigned char name[7]; /* Device Name */
304 struct iommu_flush flush; 314 struct iommu_flush flush;
305#endif 315#endif
306 struct q_inval *qi; /* Queued invalidation info */ 316 struct q_inval *qi; /* Queued invalidation info */
317 u32 *iommu_state; /* Store iommu states between suspend and resume.*/
318
307#ifdef CONFIG_INTR_REMAP 319#ifdef CONFIG_INTR_REMAP
308 struct ir_table *ir_table; /* Interrupt remapping info */ 320 struct ir_table *ir_table; /* Interrupt remapping info */
309#endif 321#endif
@@ -321,6 +333,8 @@ extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
321extern int alloc_iommu(struct dmar_drhd_unit *drhd); 333extern int alloc_iommu(struct dmar_drhd_unit *drhd);
322extern void free_iommu(struct intel_iommu *iommu); 334extern void free_iommu(struct intel_iommu *iommu);
323extern int dmar_enable_qi(struct intel_iommu *iommu); 335extern int dmar_enable_qi(struct intel_iommu *iommu);
336extern void dmar_disable_qi(struct intel_iommu *iommu);
337extern int dmar_reenable_qi(struct intel_iommu *iommu);
324extern void qi_global_iec(struct intel_iommu *iommu); 338extern void qi_global_iec(struct intel_iommu *iommu);
325 339
326extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, 340extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
@@ -331,11 +345,4 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
331 345
332extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 346extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
333 347
334extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
335extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
336extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
337extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
338extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
339extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
340
341#endif 348#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 9b7e9d743476..91bb76f44f14 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -59,8 +59,34 @@
59#define IRQF_NOBALANCING 0x00000800 59#define IRQF_NOBALANCING 0x00000800
60#define IRQF_IRQPOLL 0x00001000 60#define IRQF_IRQPOLL 0x00001000
61 61
62/*
63 * Bits used by threaded handlers:
64 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
65 * IRQTF_DIED - handler thread died
66 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
67 */
68enum {
69 IRQTF_RUNTHREAD,
70 IRQTF_DIED,
71 IRQTF_WARNED,
72};
73
62typedef irqreturn_t (*irq_handler_t)(int, void *); 74typedef irqreturn_t (*irq_handler_t)(int, void *);
63 75
76/**
77 * struct irqaction - per interrupt action descriptor
78 * @handler: interrupt handler function
79 * @flags: flags (see IRQF_* above)
80 * @mask: no comment as it is useless and about to be removed
81 * @name: name of the device
82 * @dev_id: cookie to identify the device
83 * @next: pointer to the next irqaction for shared interrupts
84 * @irq: interrupt number
85 * @dir: pointer to the proc/irq/NN/name entry
86 * @thread_fn: interupt handler function for threaded interrupts
87 * @thread: thread pointer for threaded interrupts
88 * @thread_flags: flags related to @thread
89 */
64struct irqaction { 90struct irqaction {
65 irq_handler_t handler; 91 irq_handler_t handler;
66 unsigned long flags; 92 unsigned long flags;
@@ -70,18 +96,68 @@ struct irqaction {
70 struct irqaction *next; 96 struct irqaction *next;
71 int irq; 97 int irq;
72 struct proc_dir_entry *dir; 98 struct proc_dir_entry *dir;
99 irq_handler_t thread_fn;
100 struct task_struct *thread;
101 unsigned long thread_flags;
73}; 102};
74 103
75extern irqreturn_t no_action(int cpl, void *dev_id); 104extern irqreturn_t no_action(int cpl, void *dev_id);
76extern int __must_check request_irq(unsigned int, irq_handler_t handler, 105
77 unsigned long, const char *, void *); 106#ifdef CONFIG_GENERIC_HARDIRQS
107extern int __must_check
108request_threaded_irq(unsigned int irq, irq_handler_t handler,
109 irq_handler_t thread_fn,
110 unsigned long flags, const char *name, void *dev);
111
112static inline int __must_check
113request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
114 const char *name, void *dev)
115{
116 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
117}
118
119extern void exit_irq_thread(void);
120#else
121
122extern int __must_check
123request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
124 const char *name, void *dev);
125
126/*
127 * Special function to avoid ifdeffery in kernel/irq/devres.c which
128 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
129 * m68k). I really love these $@%#!* obvious Makefile references:
130 * ../../../kernel/irq/devres.o
131 */
132static inline int __must_check
133request_threaded_irq(unsigned int irq, irq_handler_t handler,
134 irq_handler_t thread_fn,
135 unsigned long flags, const char *name, void *dev)
136{
137 return request_irq(irq, handler, flags, name, dev);
138}
139
140static inline void exit_irq_thread(void) { }
141#endif
142
78extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
79 144
80struct device; 145struct device;
81 146
82extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, 147extern int __must_check
83 irq_handler_t handler, unsigned long irqflags, 148devm_request_threaded_irq(struct device *dev, unsigned int irq,
84 const char *devname, void *dev_id); 149 irq_handler_t handler, irq_handler_t thread_fn,
150 unsigned long irqflags, const char *devname,
151 void *dev_id);
152
153static inline int __must_check
154devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
155 unsigned long irqflags, const char *devname, void *dev_id)
156{
157 return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
158 devname, dev_id);
159}
160
85extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id); 161extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
86 162
87/* 163/*
@@ -106,6 +182,15 @@ extern void disable_irq_nosync(unsigned int irq);
106extern void disable_irq(unsigned int irq); 182extern void disable_irq(unsigned int irq);
107extern void enable_irq(unsigned int irq); 183extern void enable_irq(unsigned int irq);
108 184
185/* The following three functions are for the core kernel use only. */
186extern void suspend_device_irqs(void);
187extern void resume_device_irqs(void);
188#ifdef CONFIG_PM_SLEEP
189extern int check_wakeup_irqs(void);
190#else
191static inline int check_wakeup_irqs(void) { return 0; }
192#endif
193
109#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 194#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
110 195
111extern cpumask_var_t irq_default_affinity; 196extern cpumask_var_t irq_default_affinity;
@@ -279,6 +364,7 @@ extern void softirq_init(void);
279#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 364#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
280extern void raise_softirq_irqoff(unsigned int nr); 365extern void raise_softirq_irqoff(unsigned int nr);
281extern void raise_softirq(unsigned int nr); 366extern void raise_softirq(unsigned int nr);
367extern void wakeup_softirqd(void);
282 368
283/* This is the worklist that queues up per-cpu softirq work. 369/* This is the worklist that queues up per-cpu softirq work.
284 * 370 *
@@ -467,6 +553,12 @@ static inline void init_irq_proc(void)
467} 553}
468#endif 554#endif
469 555
556#if defined(CONFIG_GENERIC_HARDIRQS) && defined(CONFIG_DEBUG_SHIRQ)
557extern void debug_poll_all_shared_irqs(void);
558#else
559static inline void debug_poll_all_shared_irqs(void) { }
560#endif
561
470int show_interrupts(struct seq_file *p, void *v); 562int show_interrupts(struct seq_file *p, void *v);
471 563
472struct irq_desc; 564struct irq_desc;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 8a7bfb1b6ca0..3af4ffd591b9 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -21,6 +21,7 @@
21 21
22#define IOMMU_READ (1) 22#define IOMMU_READ (1)
23#define IOMMU_WRITE (2) 23#define IOMMU_WRITE (2)
24#define IOMMU_CACHE (4) /* DMA cache coherency */
24 25
25struct device; 26struct device;
26 27
@@ -28,6 +29,8 @@ struct iommu_domain {
28 void *priv; 29 void *priv;
29}; 30};
30 31
32#define IOMMU_CAP_CACHE_COHERENCY 0x1
33
31struct iommu_ops { 34struct iommu_ops {
32 int (*domain_init)(struct iommu_domain *domain); 35 int (*domain_init)(struct iommu_domain *domain);
33 void (*domain_destroy)(struct iommu_domain *domain); 36 void (*domain_destroy)(struct iommu_domain *domain);
@@ -39,6 +42,8 @@ struct iommu_ops {
39 size_t size); 42 size_t size);
40 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
41 unsigned long iova); 44 unsigned long iova);
45 int (*domain_has_cap)(struct iommu_domain *domain,
46 unsigned long cap);
42}; 47};
43 48
44#ifdef CONFIG_IOMMU_API 49#ifdef CONFIG_IOMMU_API
@@ -57,6 +62,8 @@ extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova,
57 size_t size); 62 size_t size);
58extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
59 unsigned long iova); 64 unsigned long iova);
65extern int iommu_domain_has_cap(struct iommu_domain *domain,
66 unsigned long cap);
60 67
61#else /* CONFIG_IOMMU_API */ 68#else /* CONFIG_IOMMU_API */
62 69
@@ -107,6 +114,12 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
107 return 0; 114 return 0;
108} 115}
109 116
117static inline int domain_has_cap(struct iommu_domain *domain,
118 unsigned long cap)
119{
120 return 0;
121}
122
110#endif /* CONFIG_IOMMU_API */ 123#endif /* CONFIG_IOMMU_API */
111 124
112#endif /* __LINUX_IOMMU_H */ 125#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 0f434a28fb58..148265e63e8d 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -96,10 +96,10 @@
96 */ 96 */
97struct ip_vs_service_user { 97struct ip_vs_service_user {
98 /* virtual service addresses */ 98 /* virtual service addresses */
99 u_int16_t protocol; 99 __u16 protocol;
100 __be32 addr; /* virtual ip address */ 100 __be32 addr; /* virtual ip address */
101 __be16 port; 101 __be16 port;
102 u_int32_t fwmark; /* firwall mark of service */ 102 __u32 fwmark; /* firwall mark of service */
103 103
104 /* virtual service options */ 104 /* virtual service options */
105 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 105 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
@@ -119,8 +119,8 @@ struct ip_vs_dest_user {
119 int weight; /* destination weight */ 119 int weight; /* destination weight */
120 120
121 /* thresholds for active connections */ 121 /* thresholds for active connections */
122 u_int32_t u_threshold; /* upper threshold */ 122 __u32 u_threshold; /* upper threshold */
123 u_int32_t l_threshold; /* lower threshold */ 123 __u32 l_threshold; /* lower threshold */
124}; 124};
125 125
126 126
@@ -159,10 +159,10 @@ struct ip_vs_getinfo {
159/* The argument to IP_VS_SO_GET_SERVICE */ 159/* The argument to IP_VS_SO_GET_SERVICE */
160struct ip_vs_service_entry { 160struct ip_vs_service_entry {
161 /* which service: user fills in these */ 161 /* which service: user fills in these */
162 u_int16_t protocol; 162 __u16 protocol;
163 __be32 addr; /* virtual address */ 163 __be32 addr; /* virtual address */
164 __be16 port; 164 __be16 port;
165 u_int32_t fwmark; /* firwall mark of service */ 165 __u32 fwmark; /* firwall mark of service */
166 166
167 /* service options */ 167 /* service options */
168 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 168 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
@@ -184,12 +184,12 @@ struct ip_vs_dest_entry {
184 unsigned conn_flags; /* connection flags */ 184 unsigned conn_flags; /* connection flags */
185 int weight; /* destination weight */ 185 int weight; /* destination weight */
186 186
187 u_int32_t u_threshold; /* upper threshold */ 187 __u32 u_threshold; /* upper threshold */
188 u_int32_t l_threshold; /* lower threshold */ 188 __u32 l_threshold; /* lower threshold */
189 189
190 u_int32_t activeconns; /* active connections */ 190 __u32 activeconns; /* active connections */
191 u_int32_t inactconns; /* inactive connections */ 191 __u32 inactconns; /* inactive connections */
192 u_int32_t persistconns; /* persistent connections */ 192 __u32 persistconns; /* persistent connections */
193 193
194 /* statistics */ 194 /* statistics */
195 struct ip_vs_stats_user stats; 195 struct ip_vs_stats_user stats;
@@ -199,10 +199,10 @@ struct ip_vs_dest_entry {
199/* The argument to IP_VS_SO_GET_DESTS */ 199/* The argument to IP_VS_SO_GET_DESTS */
200struct ip_vs_get_dests { 200struct ip_vs_get_dests {
201 /* which service: user fills in these */ 201 /* which service: user fills in these */
202 u_int16_t protocol; 202 __u16 protocol;
203 __be32 addr; /* virtual address */ 203 __be32 addr; /* virtual address */
204 __be16 port; 204 __be16 port;
205 u_int32_t fwmark; /* firwall mark of service */ 205 __u32 fwmark; /* firwall mark of service */
206 206
207 /* number of real servers */ 207 /* number of real servers */
208 unsigned int num_dests; 208 unsigned int num_dests;
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index ea330f9e7100..3bf40e246a80 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -25,7 +25,7 @@ struct ipc_ids {
25}; 25};
26 26
27struct ipc_namespace { 27struct ipc_namespace {
28 struct kref kref; 28 atomic_t count;
29 struct ipc_ids ids[3]; 29 struct ipc_ids ids[3];
30 30
31 int sem_ctls[4]; 31 int sem_ctls[4];
@@ -44,25 +44,57 @@ struct ipc_namespace {
44 int shm_tot; 44 int shm_tot;
45 45
46 struct notifier_block ipcns_nb; 46 struct notifier_block ipcns_nb;
47
48 /* The kern_mount of the mqueuefs sb. We take a ref on it */
49 struct vfsmount *mq_mnt;
50
51 /* # queues in this ns, protected by mq_lock */
52 unsigned int mq_queues_count;
53
54 /* next fields are set through sysctl */
55 unsigned int mq_queues_max; /* initialized to DFLT_QUEUESMAX */
56 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
57 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
58
47}; 59};
48 60
49extern struct ipc_namespace init_ipc_ns; 61extern struct ipc_namespace init_ipc_ns;
50extern atomic_t nr_ipc_ns; 62extern atomic_t nr_ipc_ns;
51 63
52#ifdef CONFIG_SYSVIPC 64extern spinlock_t mq_lock;
65#if defined(CONFIG_POSIX_MQUEUE) || defined(CONFIG_SYSVIPC)
53#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 66#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
67#else
68#define INIT_IPC_NS(ns)
69#endif
54 70
71#ifdef CONFIG_SYSVIPC
55extern int register_ipcns_notifier(struct ipc_namespace *); 72extern int register_ipcns_notifier(struct ipc_namespace *);
56extern int cond_register_ipcns_notifier(struct ipc_namespace *); 73extern int cond_register_ipcns_notifier(struct ipc_namespace *);
57extern void unregister_ipcns_notifier(struct ipc_namespace *); 74extern void unregister_ipcns_notifier(struct ipc_namespace *);
58extern int ipcns_notify(unsigned long); 75extern int ipcns_notify(unsigned long);
59
60#else /* CONFIG_SYSVIPC */ 76#else /* CONFIG_SYSVIPC */
61#define INIT_IPC_NS(ns) 77static inline int register_ipcns_notifier(struct ipc_namespace *ns)
78{ return 0; }
79static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns)
80{ return 0; }
81static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { }
82static inline int ipcns_notify(unsigned long l) { return 0; }
62#endif /* CONFIG_SYSVIPC */ 83#endif /* CONFIG_SYSVIPC */
63 84
64#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) 85#ifdef CONFIG_POSIX_MQUEUE
65extern void free_ipc_ns(struct kref *kref); 86extern int mq_init_ns(struct ipc_namespace *ns);
87/* default values */
88#define DFLT_QUEUESMAX 256 /* max number of message queues */
89#define DFLT_MSGMAX 10 /* max number of messages in each queue */
90#define HARD_MSGMAX (131072/sizeof(void *))
91#define DFLT_MSGSIZEMAX 8192 /* max message size */
92#else
93static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
94#endif
95
96#if defined(CONFIG_IPC_NS)
97extern void free_ipc_ns(struct ipc_namespace *ns);
66extern struct ipc_namespace *copy_ipcs(unsigned long flags, 98extern struct ipc_namespace *copy_ipcs(unsigned long flags,
67 struct ipc_namespace *ns); 99 struct ipc_namespace *ns);
68extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids, 100extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
@@ -72,14 +104,11 @@ extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
72static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 104static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
73{ 105{
74 if (ns) 106 if (ns)
75 kref_get(&ns->kref); 107 atomic_inc(&ns->count);
76 return ns; 108 return ns;
77} 109}
78 110
79static inline void put_ipc_ns(struct ipc_namespace *ns) 111extern void put_ipc_ns(struct ipc_namespace *ns);
80{
81 kref_put(&ns->kref, free_ipc_ns);
82}
83#else 112#else
84static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 113static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
85 struct ipc_namespace *ns) 114 struct ipc_namespace *ns)
@@ -99,4 +128,18 @@ static inline void put_ipc_ns(struct ipc_namespace *ns)
99{ 128{
100} 129}
101#endif 130#endif
131
132#ifdef CONFIG_POSIX_MQUEUE_SYSCTL
133
134struct ctl_table_header;
135extern struct ctl_table_header *mq_register_sysctl_table(void);
136
137#else /* CONFIG_POSIX_MQUEUE_SYSCTL */
138
139static inline struct ctl_table_header *mq_register_sysctl_table(void)
140{
141 return NULL;
142}
143
144#endif /* CONFIG_POSIX_MQUEUE_SYSCTL */
102#endif 145#endif
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 62b73668b602..f7c9c75a2775 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
230 automatically be dstroyed when the interface is destroyed. */ 230 automatically be dstroyed when the interface is destroyed. */
231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
232 read_proc_t *read_proc, 232 read_proc_t *read_proc,
233 void *data, struct module *owner); 233 void *data);
234 234
235#endif /* __LINUX_IPMI_SMI_H */ 235#endif /* __LINUX_IPMI_SMI_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 27a67536511e..ca507c9426b0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -17,9 +17,12 @@
17#include <linux/cache.h> 17#include <linux/cache.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/gfp.h>
20#include <linux/irqreturn.h> 21#include <linux/irqreturn.h>
21#include <linux/irqnr.h> 22#include <linux/irqnr.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h>
25#include <linux/wait.h>
23 26
24#include <asm/irq.h> 27#include <asm/irq.h>
25#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -65,6 +68,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
65#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 68#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
66#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
67#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */
68 72
69#ifdef CONFIG_IRQ_PER_CPU 73#ifdef CONFIG_IRQ_PER_CPU
70# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 74# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -155,17 +159,17 @@ struct irq_2_iommu;
155 * @affinity: IRQ affinity on SMP 159 * @affinity: IRQ affinity on SMP
156 * @cpu: cpu index useful for balancing 160 * @cpu: cpu index useful for balancing
157 * @pending_mask: pending rebalanced interrupts 161 * @pending_mask: pending rebalanced interrupts
162 * @threads_active: number of irqaction threads currently running
163 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
158 * @dir: /proc/irq/ procfs entry 164 * @dir: /proc/irq/ procfs entry
159 * @name: flow handler name for /proc/interrupts output 165 * @name: flow handler name for /proc/interrupts output
160 */ 166 */
161struct irq_desc { 167struct irq_desc {
162 unsigned int irq; 168 unsigned int irq;
163#ifdef CONFIG_SPARSE_IRQ
164 struct timer_rand_state *timer_rand_state; 169 struct timer_rand_state *timer_rand_state;
165 unsigned int *kstat_irqs; 170 unsigned int *kstat_irqs;
166# ifdef CONFIG_INTR_REMAP 171#ifdef CONFIG_INTR_REMAP
167 struct irq_2_iommu *irq_2_iommu; 172 struct irq_2_iommu *irq_2_iommu;
168# endif
169#endif 173#endif
170 irq_flow_handler_t handle_irq; 174 irq_flow_handler_t handle_irq;
171 struct irq_chip *chip; 175 struct irq_chip *chip;
@@ -188,6 +192,8 @@ struct irq_desc {
188 cpumask_var_t pending_mask; 192 cpumask_var_t pending_mask;
189#endif 193#endif
190#endif 194#endif
195 atomic_t threads_active;
196 wait_queue_head_t wait_for_threads;
191#ifdef CONFIG_PROC_FS 197#ifdef CONFIG_PROC_FS
192 struct proc_dir_entry *dir; 198 struct proc_dir_entry *dir;
193#endif 199#endif
@@ -202,12 +208,6 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc
202extern struct irq_desc irq_desc[NR_IRQS]; 208extern struct irq_desc irq_desc[NR_IRQS];
203#else /* CONFIG_SPARSE_IRQ */ 209#else /* CONFIG_SPARSE_IRQ */
204extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); 210extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
205
206#define kstat_irqs_this_cpu(DESC) \
207 ((DESC)->kstat_irqs[smp_processor_id()])
208#define kstat_incr_irqs_this_cpu(irqno, DESC) \
209 ((DESC)->kstat_irqs[smp_processor_id()]++)
210
211#endif /* CONFIG_SPARSE_IRQ */ 211#endif /* CONFIG_SPARSE_IRQ */
212 212
213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); 213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
@@ -226,7 +226,6 @@ irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
226 * Migration helpers for obsolete names, they will go away: 226 * Migration helpers for obsolete names, they will go away:
227 */ 227 */
228#define hw_interrupt_type irq_chip 228#define hw_interrupt_type irq_chip
229typedef struct irq_chip hw_irq_controller;
230#define no_irq_type no_irq_chip 229#define no_irq_type no_irq_chip
231typedef struct irq_desc irq_desc_t; 230typedef struct irq_desc irq_desc_t;
232 231
@@ -236,6 +235,7 @@ typedef struct irq_desc irq_desc_t;
236#include <asm/hw_irq.h> 235#include <asm/hw_irq.h>
237 236
238extern int setup_irq(unsigned int irq, struct irqaction *new); 237extern int setup_irq(unsigned int irq, struct irqaction *new);
238extern void remove_irq(unsigned int irq, struct irqaction *act);
239 239
240#ifdef CONFIG_GENERIC_HARDIRQS 240#ifdef CONFIG_GENERIC_HARDIRQS
241 241
@@ -280,7 +280,7 @@ static inline int irq_balancing_disabled(unsigned int irq)
280} 280}
281 281
282/* Handle irq action chains: */ 282/* Handle irq action chains: */
283extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); 283extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
284 284
285/* 285/*
286 * Built-in IRQ handlers for various IRQ types, 286 * Built-in IRQ handlers for various IRQ types,
@@ -325,7 +325,7 @@ static inline void generic_handle_irq(unsigned int irq)
325 325
326/* Handling of unhandled and spurious interrupts: */ 326/* Handling of unhandled and spurious interrupts: */
327extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 327extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
328 int action_ret); 328 irqreturn_t action_ret);
329 329
330/* Resending of interrupts :*/ 330/* Resending of interrupts :*/
331void check_irq_resend(struct irq_desc *desc, unsigned int irq); 331void check_irq_resend(struct irq_desc *desc, unsigned int irq);
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 887477bc2ab0..ec87b212ff7d 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -29,13 +29,17 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
29# define for_each_irq_desc(irq, desc) \ 29# define for_each_irq_desc(irq, desc) \
30 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ 30 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
31 irq++, desc = irq_to_desc(irq)) \ 31 irq++, desc = irq_to_desc(irq)) \
32 if (desc) 32 if (!desc) \
33 ; \
34 else
33 35
34 36
35# define for_each_irq_desc_reverse(irq, desc) \ 37# define for_each_irq_desc_reverse(irq, desc) \
36 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ 38 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
37 irq--, desc = irq_to_desc(irq)) \ 39 irq--, desc = irq_to_desc(irq)) \
38 if (desc) 40 if (!desc) \
41 ; \
42 else
39 43
40#endif /* CONFIG_GENERIC_HARDIRQS */ 44#endif /* CONFIG_GENERIC_HARDIRQS */
41 45
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index 881883c2009d..819acaaac3f5 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -1,25 +1,19 @@
1/* irqreturn.h */
2#ifndef _LINUX_IRQRETURN_H 1#ifndef _LINUX_IRQRETURN_H
3#define _LINUX_IRQRETURN_H 2#define _LINUX_IRQRETURN_H
4 3
5/* 4/**
6 * For 2.4.x compatibility, 2.4.x can use 5 * enum irqreturn
7 * 6 * @IRQ_NONE interrupt was not from this device
8 * typedef void irqreturn_t; 7 * @IRQ_HANDLED interrupt was handled by this device
9 * #define IRQ_NONE 8 * @IRQ_WAKE_THREAD handler requests to wake the handler thread
10 * #define IRQ_HANDLED
11 * #define IRQ_RETVAL(x)
12 *
13 * To mix old-style and new-style irq handler returns.
14 *
15 * IRQ_NONE means we didn't handle it.
16 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
17 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
18 */ 9 */
19typedef int irqreturn_t; 10enum irqreturn {
11 IRQ_NONE,
12 IRQ_HANDLED,
13 IRQ_WAKE_THREAD,
14};
20 15
21#define IRQ_NONE (0) 16typedef enum irqreturn irqreturn_t;
22#define IRQ_HANDLED (1) 17#define IRQ_RETVAL(x) ((x) != IRQ_NONE)
23#define IRQ_RETVAL(x) ((x) != 0)
24 18
25#endif 19#endif
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index f2720280b9ec..062d20f74322 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -60,10 +60,10 @@ struct ivtv_dma_frame {
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62 62
63/* These are the VBI types as they appear in the embedded VBI private packets. */ 63/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B (1) 64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
65#define IVTV_SLICED_TYPE_CAPTION_525 (4) 65#define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525
66#define IVTV_SLICED_TYPE_WSS_625 (5) 66#define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625
67#define IVTV_SLICED_TYPE_VPS (7) 67#define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS
68 68
69#endif /* _LINUX_IVTV_H */ 69#endif /* _LINUX_IVTV_H */
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
index e20af47b59ad..9d88b29ddf55 100644
--- a/include/linux/ivtvfb.h
+++ b/include/linux/ivtvfb.h
@@ -33,6 +33,6 @@ struct ivtvfb_dma_frame {
33}; 33};
34 34
35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) 35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) 36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
37 37
38#endif 38#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 64246dce5663..53ae4399da2d 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -35,7 +35,7 @@
35#define journal_oom_retry 1 35#define journal_oom_retry 1
36 36
37/* 37/*
38 * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds 38 * Define JBD_PARANOID_IOFAIL to cause a kernel BUG() if ext3 finds
39 * certain classes of error which can occur due to failed IOs. Under 39 * certain classes of error which can occur due to failed IOs. Under
40 * normal use we want ext3 to continue after such errors, because 40 * normal use we want ext3 to continue after such errors, because
41 * hardware _can_ fail, but for debugging purposes when running tests on 41 * hardware _can_ fail, but for debugging purposes when running tests on
@@ -552,6 +552,11 @@ struct transaction_s
552 */ 552 */
553 int t_handle_count; 553 int t_handle_count;
554 554
555 /*
556 * This transaction is being forced and some process is
557 * waiting for it to finish.
558 */
559 int t_synchronous_commit:1;
555}; 560};
556 561
557/** 562/**
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 4d248b3f1323..8815a3456b3b 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -649,6 +649,12 @@ struct transaction_s
649 int t_handle_count; 649 int t_handle_count;
650 650
651 /* 651 /*
652 * This transaction is being forced and some process is
653 * waiting for it to finish.
654 */
655 int t_synchronous_commit:1;
656
657 /*
652 * For use by the filesystem to store fs-specific data 658 * For use by the filesystem to store fs-specific data
653 * structures associated with the transaction 659 * structures associated with the transaction
654 */ 660 */
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index da720bc3eb15..2b32d638147d 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -12,6 +12,7 @@
12#ifndef __LINUX_JFFS2_H__ 12#ifndef __LINUX_JFFS2_H__
13#define __LINUX_JFFS2_H__ 13#define __LINUX_JFFS2_H__
14 14
15#include <linux/types.h>
15#include <linux/magic.h> 16#include <linux/magic.h>
16 17
17/* You must include something which defines the C99 uintXX_t types. 18/* You must include something which defines the C99 uintXX_t types.
@@ -91,15 +92,15 @@
91 byteswapping */ 92 byteswapping */
92 93
93typedef struct { 94typedef struct {
94 uint32_t v32; 95 __u32 v32;
95} __attribute__((packed)) jint32_t; 96} __attribute__((packed)) jint32_t;
96 97
97typedef struct { 98typedef struct {
98 uint32_t m; 99 __u32 m;
99} __attribute__((packed)) jmode_t; 100} __attribute__((packed)) jmode_t;
100 101
101typedef struct { 102typedef struct {
102 uint16_t v16; 103 __u16 v16;
103} __attribute__((packed)) jint16_t; 104} __attribute__((packed)) jint16_t;
104 105
105struct jffs2_unknown_node 106struct jffs2_unknown_node
@@ -121,12 +122,12 @@ struct jffs2_raw_dirent
121 jint32_t version; 122 jint32_t version;
122 jint32_t ino; /* == zero for unlink */ 123 jint32_t ino; /* == zero for unlink */
123 jint32_t mctime; 124 jint32_t mctime;
124 uint8_t nsize; 125 __u8 nsize;
125 uint8_t type; 126 __u8 type;
126 uint8_t unused[2]; 127 __u8 unused[2];
127 jint32_t node_crc; 128 jint32_t node_crc;
128 jint32_t name_crc; 129 jint32_t name_crc;
129 uint8_t name[0]; 130 __u8 name[0];
130}; 131};
131 132
132/* The JFFS2 raw inode structure: Used for storage on physical media. */ 133/* The JFFS2 raw inode structure: Used for storage on physical media. */
@@ -153,12 +154,12 @@ struct jffs2_raw_inode
153 jint32_t offset; /* Where to begin to write. */ 154 jint32_t offset; /* Where to begin to write. */
154 jint32_t csize; /* (Compressed) data size */ 155 jint32_t csize; /* (Compressed) data size */
155 jint32_t dsize; /* Size of the node's data. (after decompression) */ 156 jint32_t dsize; /* Size of the node's data. (after decompression) */
156 uint8_t compr; /* Compression algorithm used */ 157 __u8 compr; /* Compression algorithm used */
157 uint8_t usercompr; /* Compression algorithm requested by the user */ 158 __u8 usercompr; /* Compression algorithm requested by the user */
158 jint16_t flags; /* See JFFS2_INO_FLAG_* */ 159 jint16_t flags; /* See JFFS2_INO_FLAG_* */
159 jint32_t data_crc; /* CRC for the (compressed) data. */ 160 jint32_t data_crc; /* CRC for the (compressed) data. */
160 jint32_t node_crc; /* CRC for the raw inode (excluding data) */ 161 jint32_t node_crc; /* CRC for the raw inode (excluding data) */
161 uint8_t data[0]; 162 __u8 data[0];
162}; 163};
163 164
164struct jffs2_raw_xattr { 165struct jffs2_raw_xattr {
@@ -168,12 +169,12 @@ struct jffs2_raw_xattr {
168 jint32_t hdr_crc; 169 jint32_t hdr_crc;
169 jint32_t xid; /* XATTR identifier number */ 170 jint32_t xid; /* XATTR identifier number */
170 jint32_t version; 171 jint32_t version;
171 uint8_t xprefix; 172 __u8 xprefix;
172 uint8_t name_len; 173 __u8 name_len;
173 jint16_t value_len; 174 jint16_t value_len;
174 jint32_t data_crc; 175 jint32_t data_crc;
175 jint32_t node_crc; 176 jint32_t node_crc;
176 uint8_t data[0]; 177 __u8 data[0];
177} __attribute__((packed)); 178} __attribute__((packed));
178 179
179struct jffs2_raw_xref 180struct jffs2_raw_xref
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index f3fe34391d8e..792274269f2b 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -13,10 +13,17 @@
13#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 13#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
14 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) 14 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
15 15
16struct module;
17
16#ifdef CONFIG_KALLSYMS 18#ifdef CONFIG_KALLSYMS
17/* Lookup the address for a symbol. Returns 0 if not found. */ 19/* Lookup the address for a symbol. Returns 0 if not found. */
18unsigned long kallsyms_lookup_name(const char *name); 20unsigned long kallsyms_lookup_name(const char *name);
19 21
22/* Call a function on each kallsyms symbol in the core kernel */
23int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
24 unsigned long),
25 void *data);
26
20extern int kallsyms_lookup_size_offset(unsigned long addr, 27extern int kallsyms_lookup_size_offset(unsigned long addr,
21 unsigned long *symbolsize, 28 unsigned long *symbolsize,
22 unsigned long *offset); 29 unsigned long *offset);
@@ -43,6 +50,14 @@ static inline unsigned long kallsyms_lookup_name(const char *name)
43 return 0; 50 return 0;
44} 51}
45 52
53static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
54 struct module *,
55 unsigned long),
56 void *data)
57{
58 return 0;
59}
60
46static inline int kallsyms_lookup_size_offset(unsigned long addr, 61static inline int kallsyms_lookup_size_offset(unsigned long addr,
47 unsigned long *symbolsize, 62 unsigned long *symbolsize,
48 unsigned long *offset) 63 unsigned long *offset)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 1daca3b062bb..d9e75ec7def5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -16,7 +16,7 @@
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h> 17#include <linux/typecheck.h>
18#include <linux/ratelimit.h> 18#include <linux/ratelimit.h>
19#include <linux/dynamic_printk.h> 19#include <linux/dynamic_debug.h>
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21#include <asm/bug.h> 21#include <asm/bug.h>
22 22
@@ -255,6 +255,7 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
255 } \ 255 } \
256}) 256})
257 257
258void log_buf_kexec_setup(void);
258#else 259#else
259static inline int vprintk(const char *s, va_list args) 260static inline int vprintk(const char *s, va_list args)
260 __attribute__ ((format (printf, 1, 0))); 261 __attribute__ ((format (printf, 1, 0)));
@@ -270,6 +271,9 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
270/* No effect, but we still get type checking even in the !PRINTK case: */ 271/* No effect, but we still get type checking even in the !PRINTK case: */
271#define printk_once(x...) printk(x) 272#define printk_once(x...) printk(x)
272 273
274static inline void log_buf_kexec_setup(void)
275{
276}
273#endif 277#endif
274 278
275extern int printk_needs_cpu(int cpu); 279extern int printk_needs_cpu(int cpu);
@@ -370,14 +374,17 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
370 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 374 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
371#define pr_info(fmt, ...) \ 375#define pr_info(fmt, ...) \
372 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 376 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
377#define pr_cont(fmt, ...) \
378 printk(KERN_CONT fmt, ##__VA_ARGS__)
373 379
374/* If you are writing a driver, please use dev_dbg instead */ 380/* If you are writing a driver, please use dev_dbg instead */
375#if defined(DEBUG) 381#if defined(DEBUG)
376#define pr_debug(fmt, ...) \ 382#define pr_debug(fmt, ...) \
377 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 383 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
378#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 384#elif defined(CONFIG_DYNAMIC_DEBUG)
385/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
379#define pr_debug(fmt, ...) do { \ 386#define pr_debug(fmt, ...) do { \
380 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 387 dynamic_pr_debug(fmt, ##__VA_ARGS__); \
381 } while (0) 388 } while (0)
382#else 389#else
383#define pr_debug(fmt, ...) \ 390#define pr_debug(fmt, ...) \
@@ -528,18 +535,6 @@ static inline void ftrace_dump(void) { }
528 ((unsigned char *)&addr)[3] 535 ((unsigned char *)&addr)[3]
529#define NIPQUAD_FMT "%u.%u.%u.%u" 536#define NIPQUAD_FMT "%u.%u.%u.%u"
530 537
531#if defined(__LITTLE_ENDIAN)
532#define HIPQUAD(addr) \
533 ((unsigned char *)&addr)[3], \
534 ((unsigned char *)&addr)[2], \
535 ((unsigned char *)&addr)[1], \
536 ((unsigned char *)&addr)[0]
537#elif defined(__BIG_ENDIAN)
538#define HIPQUAD NIPQUAD
539#else
540#error "Please fix asm/byteorder.h"
541#endif /* __LITTLE_ENDIAN */
542
543/* 538/*
544 * min()/max()/clamp() macros that also do 539 * min()/max()/clamp() macros that also do
545 * strict type-checking.. See the 540 * strict type-checking.. See the
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 570d20413119..0c8b89f28a95 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -28,7 +28,7 @@ struct cpu_usage_stat {
28 28
29struct kernel_stat { 29struct kernel_stat {
30 struct cpu_usage_stat cpustat; 30 struct cpu_usage_stat cpustat;
31#ifndef CONFIG_SPARSE_IRQ 31#ifndef CONFIG_GENERIC_HARDIRQS
32 unsigned int irqs[NR_IRQS]; 32 unsigned int irqs[NR_IRQS];
33#endif 33#endif
34}; 34};
@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
41 41
42extern unsigned long long nr_context_switches(void); 42extern unsigned long long nr_context_switches(void);
43 43
44#ifndef CONFIG_SPARSE_IRQ 44#ifndef CONFIG_GENERIC_HARDIRQS
45#define kstat_irqs_this_cpu(irq) \ 45#define kstat_irqs_this_cpu(irq) \
46 (kstat_this_cpu.irqs[irq]) 46 (kstat_this_cpu.irqs[irq])
47 47
@@ -52,16 +52,19 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
52{ 52{
53 kstat_this_cpu.irqs[irq]++; 53 kstat_this_cpu.irqs[irq]++;
54} 54}
55#endif
56
57 55
58#ifndef CONFIG_SPARSE_IRQ
59static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) 56static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
60{ 57{
61 return kstat_cpu(cpu).irqs[irq]; 58 return kstat_cpu(cpu).irqs[irq];
62} 59}
63#else 60#else
61#include <linux/irq.h>
64extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 62extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
63#define kstat_irqs_this_cpu(DESC) \
64 ((DESC)->kstat_irqs[smp_processor_id()])
65#define kstat_incr_irqs_this_cpu(irqno, DESC) \
66 ((DESC)->kstat_irqs[smp_processor_id()]++)
67
65#endif 68#endif
66 69
67/* 70/*
diff --git a/include/linux/key.h b/include/linux/key.h
index 21d32a142c00..e544f466d69a 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -20,6 +20,7 @@
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/rwsem.h>
23#include <asm/atomic.h> 24#include <asm/atomic.h>
24 25
25#ifdef __KERNEL__ 26#ifdef __KERNEL__
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 92213a9194e1..d5fa565086d1 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -29,10 +29,15 @@
29#ifdef CONFIG_MODULES 29#ifdef CONFIG_MODULES
30/* modprobe exit status on success, -ve on error. Return value 30/* modprobe exit status on success, -ve on error. Return value
31 * usually useless though. */ 31 * usually useless though. */
32extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); 32extern int __request_module(bool wait, const char *name, ...) \
33#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 33 __attribute__((format(printf, 2, 3)));
34#define request_module(mod...) __request_module(true, mod)
35#define request_module_nowait(mod...) __request_module(false, mod)
36#define try_then_request_module(x, mod...) \
37 ((x) ?: (__request_module(false, mod), (x)))
34#else 38#else
35static inline int request_module(const char * name, ...) { return -ENOSYS; } 39static inline int request_module(const char *name, ...) { return -ENOSYS; }
40static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; }
36#define try_then_request_module(x, mod...) (x) 41#define try_then_request_module(x, mod...) (x)
37#endif 42#endif
38 43
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 5437ac0276e2..58ae8e00fcdd 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -68,10 +68,13 @@ struct kobject {
68 unsigned int state_in_sysfs:1; 68 unsigned int state_in_sysfs:1;
69 unsigned int state_add_uevent_sent:1; 69 unsigned int state_add_uevent_sent:1;
70 unsigned int state_remove_uevent_sent:1; 70 unsigned int state_remove_uevent_sent:1;
71 unsigned int uevent_suppress:1;
71}; 72};
72 73
73extern int kobject_set_name(struct kobject *kobj, const char *name, ...) 74extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
74 __attribute__((format(printf, 2, 3))); 75 __attribute__((format(printf, 2, 3)));
76extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
77 va_list vargs);
75 78
76static inline const char *kobject_name(const struct kobject *kobj) 79static inline const char *kobject_name(const struct kobject *kobj)
77{ 80{
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 2ec6cc14a114..bcd9c07848be 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -94,12 +94,16 @@ struct kprobe {
94 /* Called after addr is executed, unless... */ 94 /* Called after addr is executed, unless... */
95 kprobe_post_handler_t post_handler; 95 kprobe_post_handler_t post_handler;
96 96
97 /* ... called if executing addr causes a fault (eg. page fault). 97 /*
98 * Return 1 if it handled fault, otherwise kernel will see it. */ 98 * ... called if executing addr causes a fault (eg. page fault).
99 * Return 1 if it handled fault, otherwise kernel will see it.
100 */
99 kprobe_fault_handler_t fault_handler; 101 kprobe_fault_handler_t fault_handler;
100 102
101 /* ... called if breakpoint trap occurs in probe handler. 103 /*
102 * Return 1 if it handled break, otherwise kernel will see it. */ 104 * ... called if breakpoint trap occurs in probe handler.
105 * Return 1 if it handled break, otherwise kernel will see it.
106 */
103 kprobe_break_handler_t break_handler; 107 kprobe_break_handler_t break_handler;
104 108
105 /* Saved opcode (which has been replaced with breakpoint) */ 109 /* Saved opcode (which has been replaced with breakpoint) */
@@ -108,18 +112,28 @@ struct kprobe {
108 /* copy of the original instruction */ 112 /* copy of the original instruction */
109 struct arch_specific_insn ainsn; 113 struct arch_specific_insn ainsn;
110 114
111 /* Indicates various status flags. Protected by kprobe_mutex. */ 115 /*
116 * Indicates various status flags.
117 * Protected by kprobe_mutex after this kprobe is registered.
118 */
112 u32 flags; 119 u32 flags;
113}; 120};
114 121
115/* Kprobe status flags */ 122/* Kprobe status flags */
116#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */ 123#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
124#define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */
117 125
126/* Has this kprobe gone ? */
118static inline int kprobe_gone(struct kprobe *p) 127static inline int kprobe_gone(struct kprobe *p)
119{ 128{
120 return p->flags & KPROBE_FLAG_GONE; 129 return p->flags & KPROBE_FLAG_GONE;
121} 130}
122 131
132/* Is this kprobe disabled ? */
133static inline int kprobe_disabled(struct kprobe *p)
134{
135 return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE);
136}
123/* 137/*
124 * Special probe type that uses setjmp-longjmp type tricks to resume 138 * Special probe type that uses setjmp-longjmp type tricks to resume
125 * execution at a specified entry with a matching prototype corresponding 139 * execution at a specified entry with a matching prototype corresponding
@@ -279,6 +293,9 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
279void kprobe_flush_task(struct task_struct *tk); 293void kprobe_flush_task(struct task_struct *tk);
280void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 294void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
281 295
296int disable_kprobe(struct kprobe *kp);
297int enable_kprobe(struct kprobe *kp);
298
282#else /* !CONFIG_KPROBES: */ 299#else /* !CONFIG_KPROBES: */
283 300
284static inline int kprobes_built_in(void) 301static inline int kprobes_built_in(void)
@@ -345,5 +362,30 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
345static inline void kprobe_flush_task(struct task_struct *tk) 362static inline void kprobe_flush_task(struct task_struct *tk)
346{ 363{
347} 364}
365static inline int disable_kprobe(struct kprobe *kp)
366{
367 return -ENOSYS;
368}
369static inline int enable_kprobe(struct kprobe *kp)
370{
371 return -ENOSYS;
372}
348#endif /* CONFIG_KPROBES */ 373#endif /* CONFIG_KPROBES */
374static inline int disable_kretprobe(struct kretprobe *rp)
375{
376 return disable_kprobe(&rp->kp);
377}
378static inline int enable_kretprobe(struct kretprobe *rp)
379{
380 return enable_kprobe(&rp->kp);
381}
382static inline int disable_jprobe(struct jprobe *jp)
383{
384 return disable_kprobe(&jp->kp);
385}
386static inline int enable_jprobe(struct jprobe *jp)
387{
388 return enable_kprobe(&jp->kp);
389}
390
349#endif /* _LINUX_KPROBES_H */ 391#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 0424326f1679..311a073afe8a 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -48,7 +48,10 @@ struct kvm_irq_level {
48 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. 48 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47..
49 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. 49 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23..
50 */ 50 */
51 __u32 irq; 51 union {
52 __u32 irq;
53 __s32 status;
54 };
52 __u32 level; 55 __u32 level;
53}; 56};
54 57
@@ -126,6 +129,7 @@ struct kvm_run {
126 __u64 data_offset; /* relative to kvm_run start */ 129 __u64 data_offset; /* relative to kvm_run start */
127 } io; 130 } io;
128 struct { 131 struct {
132 struct kvm_debug_exit_arch arch;
129 } debug; 133 } debug;
130 /* KVM_EXIT_MMIO */ 134 /* KVM_EXIT_MMIO */
131 struct { 135 struct {
@@ -217,21 +221,6 @@ struct kvm_interrupt {
217 __u32 irq; 221 __u32 irq;
218}; 222};
219 223
220struct kvm_breakpoint {
221 __u32 enabled;
222 __u32 padding;
223 __u64 address;
224};
225
226/* for KVM_DEBUG_GUEST */
227struct kvm_debug_guest {
228 /* int */
229 __u32 enabled;
230 __u32 pad;
231 struct kvm_breakpoint breakpoints[4];
232 __u32 singlestep;
233};
234
235/* for KVM_GET_DIRTY_LOG */ 224/* for KVM_GET_DIRTY_LOG */
236struct kvm_dirty_log { 225struct kvm_dirty_log {
237 __u32 slot; 226 __u32 slot;
@@ -292,6 +281,17 @@ struct kvm_s390_interrupt {
292 __u64 parm64; 281 __u64 parm64;
293}; 282};
294 283
284/* for KVM_SET_GUEST_DEBUG */
285
286#define KVM_GUESTDBG_ENABLE 0x00000001
287#define KVM_GUESTDBG_SINGLESTEP 0x00000002
288
289struct kvm_guest_debug {
290 __u32 control;
291 __u32 pad;
292 struct kvm_guest_debug_arch arch;
293};
294
295#define KVM_TRC_SHIFT 16 295#define KVM_TRC_SHIFT 16
296/* 296/*
297 * kvm trace categories 297 * kvm trace categories
@@ -396,6 +396,57 @@ struct kvm_trace_rec {
396#ifdef __KVM_HAVE_USER_NMI 396#ifdef __KVM_HAVE_USER_NMI
397#define KVM_CAP_USER_NMI 22 397#define KVM_CAP_USER_NMI 22
398#endif 398#endif
399#ifdef __KVM_HAVE_GUEST_DEBUG
400#define KVM_CAP_SET_GUEST_DEBUG 23
401#endif
402#ifdef __KVM_HAVE_PIT
403#define KVM_CAP_REINJECT_CONTROL 24
404#endif
405#ifdef __KVM_HAVE_IOAPIC
406#define KVM_CAP_IRQ_ROUTING 25
407#endif
408#define KVM_CAP_IRQ_INJECT_STATUS 26
409#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
410#define KVM_CAP_DEVICE_DEASSIGNMENT 27
411#endif
412
413#ifdef KVM_CAP_IRQ_ROUTING
414
415struct kvm_irq_routing_irqchip {
416 __u32 irqchip;
417 __u32 pin;
418};
419
420struct kvm_irq_routing_msi {
421 __u32 address_lo;
422 __u32 address_hi;
423 __u32 data;
424 __u32 pad;
425};
426
427/* gsi routing entry types */
428#define KVM_IRQ_ROUTING_IRQCHIP 1
429#define KVM_IRQ_ROUTING_MSI 2
430
431struct kvm_irq_routing_entry {
432 __u32 gsi;
433 __u32 type;
434 __u32 flags;
435 __u32 pad;
436 union {
437 struct kvm_irq_routing_irqchip irqchip;
438 struct kvm_irq_routing_msi msi;
439 __u32 pad[8];
440 } u;
441};
442
443struct kvm_irq_routing {
444 __u32 nr;
445 __u32 flags;
446 struct kvm_irq_routing_entry entries[0];
447};
448
449#endif
399 450
400/* 451/*
401 * ioctls for VM fds 452 * ioctls for VM fds
@@ -421,14 +472,19 @@ struct kvm_trace_rec {
421#define KVM_CREATE_PIT _IO(KVMIO, 0x64) 472#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
422#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) 473#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
423#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) 474#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
475#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
424#define KVM_REGISTER_COALESCED_MMIO \ 476#define KVM_REGISTER_COALESCED_MMIO \
425 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 477 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
426#define KVM_UNREGISTER_COALESCED_MMIO \ 478#define KVM_UNREGISTER_COALESCED_MMIO \
427 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 479 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
428#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ 480#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
429 struct kvm_assigned_pci_dev) 481 struct kvm_assigned_pci_dev)
482#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
430#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ 483#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
431 struct kvm_assigned_irq) 484 struct kvm_assigned_irq)
485#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
486#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \
487 struct kvm_assigned_pci_dev)
432 488
433/* 489/*
434 * ioctls for vcpu fds 490 * ioctls for vcpu fds
@@ -440,7 +496,8 @@ struct kvm_trace_rec {
440#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) 496#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
441#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) 497#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
442#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) 498#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
443#define KVM_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest) 499/* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */
500#define KVM_DEBUG_GUEST __KVM_DEPRECATED_DEBUG_GUEST
444#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) 501#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
445#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) 502#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
446#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) 503#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
@@ -469,6 +526,29 @@ struct kvm_trace_rec {
469#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 526#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
470/* Available with KVM_CAP_NMI */ 527/* Available with KVM_CAP_NMI */
471#define KVM_NMI _IO(KVMIO, 0x9a) 528#define KVM_NMI _IO(KVMIO, 0x9a)
529/* Available with KVM_CAP_SET_GUEST_DEBUG */
530#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
531
532/*
533 * Deprecated interfaces
534 */
535struct kvm_breakpoint {
536 __u32 enabled;
537 __u32 padding;
538 __u64 address;
539};
540
541struct kvm_debug_guest {
542 __u32 enabled;
543 __u32 pad;
544 struct kvm_breakpoint breakpoints[4];
545 __u32 singlestep;
546};
547
548#define __KVM_DEPRECATED_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest)
549
550#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *)
551#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *)
472 552
473#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 553#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
474#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 554#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
@@ -522,6 +602,7 @@ struct kvm_assigned_irq {
522 602
523#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 603#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
524 604
605#define KVM_DEV_IRQ_ASSIGN_MSI_ACTION KVM_DEV_IRQ_ASSIGN_ENABLE_MSI
525#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0) 606#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0)
526 607
527#endif 608#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index bf6f703642fc..894a56e365e8 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -37,6 +37,7 @@
37#define KVM_REQ_PENDING_TIMER 5 37#define KVM_REQ_PENDING_TIMER 5
38#define KVM_REQ_UNHALT 6 38#define KVM_REQ_UNHALT 6
39#define KVM_REQ_MMU_SYNC 7 39#define KVM_REQ_MMU_SYNC 7
40#define KVM_REQ_KVMCLOCK_UPDATE 8
40 41
41#define KVM_USERSPACE_IRQ_SOURCE_ID 0 42#define KVM_USERSPACE_IRQ_SOURCE_ID 0
42 43
@@ -73,7 +74,7 @@ struct kvm_vcpu {
73 struct kvm_run *run; 74 struct kvm_run *run;
74 int guest_mode; 75 int guest_mode;
75 unsigned long requests; 76 unsigned long requests;
76 struct kvm_guest_debug guest_debug; 77 unsigned long guest_debug;
77 int fpu_active; 78 int fpu_active;
78 int guest_fpu_loaded; 79 int guest_fpu_loaded;
79 wait_queue_head_t wq; 80 wait_queue_head_t wq;
@@ -107,6 +108,20 @@ struct kvm_memory_slot {
107 int user_alloc; 108 int user_alloc;
108}; 109};
109 110
111struct kvm_kernel_irq_routing_entry {
112 u32 gsi;
113 int (*set)(struct kvm_kernel_irq_routing_entry *e,
114 struct kvm *kvm, int level);
115 union {
116 struct {
117 unsigned irqchip;
118 unsigned pin;
119 } irqchip;
120 struct msi_msg msi;
121 };
122 struct list_head link;
123};
124
110struct kvm { 125struct kvm {
111 struct mutex lock; /* protects the vcpus array and APIC accesses */ 126 struct mutex lock; /* protects the vcpus array and APIC accesses */
112 spinlock_t mmu_lock; 127 spinlock_t mmu_lock;
@@ -127,6 +142,11 @@ struct kvm {
127 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 142 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
128#endif 143#endif
129 144
145#ifdef CONFIG_HAVE_KVM_IRQCHIP
146 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
147 struct hlist_head mask_notifier_list;
148#endif
149
130#ifdef KVM_ARCH_WANT_MMU_NOTIFIER 150#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
131 struct mmu_notifier mmu_notifier; 151 struct mmu_notifier mmu_notifier;
132 unsigned long mmu_notifier_seq; 152 unsigned long mmu_notifier_seq;
@@ -237,7 +257,6 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
237 int user_alloc); 257 int user_alloc);
238long kvm_arch_vm_ioctl(struct file *filp, 258long kvm_arch_vm_ioctl(struct file *filp,
239 unsigned int ioctl, unsigned long arg); 259 unsigned int ioctl, unsigned long arg);
240void kvm_arch_destroy_vm(struct kvm *kvm);
241 260
242int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); 261int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
243int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); 262int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
@@ -255,8 +274,8 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
255 struct kvm_mp_state *mp_state); 274 struct kvm_mp_state *mp_state);
256int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, 275int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
257 struct kvm_mp_state *mp_state); 276 struct kvm_mp_state *mp_state);
258int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 277int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
259 struct kvm_debug_guest *dbg); 278 struct kvm_guest_debug *dbg);
260int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); 279int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
261 280
262int kvm_arch_init(void *opaque); 281int kvm_arch_init(void *opaque);
@@ -310,7 +329,6 @@ struct kvm_assigned_dev_kernel {
310 int host_irq; 329 int host_irq;
311 bool host_irq_disabled; 330 bool host_irq_disabled;
312 int guest_irq; 331 int guest_irq;
313 struct msi_msg guest_msi;
314#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) 332#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0)
315#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1) 333#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1)
316#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) 334#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8)
@@ -321,8 +339,21 @@ struct kvm_assigned_dev_kernel {
321 struct pci_dev *dev; 339 struct pci_dev *dev;
322 struct kvm *kvm; 340 struct kvm *kvm;
323}; 341};
324void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); 342
325void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); 343struct kvm_irq_mask_notifier {
344 void (*func)(struct kvm_irq_mask_notifier *kimn, bool masked);
345 int irq;
346 struct hlist_node link;
347};
348
349void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
350 struct kvm_irq_mask_notifier *kimn);
351void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
352 struct kvm_irq_mask_notifier *kimn);
353void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask);
354
355int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
356void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
326void kvm_register_irq_ack_notifier(struct kvm *kvm, 357void kvm_register_irq_ack_notifier(struct kvm *kvm,
327 struct kvm_irq_ack_notifier *kian); 358 struct kvm_irq_ack_notifier *kian);
328void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); 359void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian);
@@ -464,4 +495,21 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
464} 495}
465#endif 496#endif
466 497
498#ifdef CONFIG_HAVE_KVM_IRQCHIP
499
500#define KVM_MAX_IRQ_ROUTES 1024
501
502int kvm_setup_default_irq_routing(struct kvm *kvm);
503int kvm_set_irq_routing(struct kvm *kvm,
504 const struct kvm_irq_routing_entry *entries,
505 unsigned nr,
506 unsigned flags);
507void kvm_free_irq_routing(struct kvm *kvm);
508
509#else
510
511static inline void kvm_free_irq_routing(struct kvm *kvm) {}
512
513#endif
514
467#endif 515#endif
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 9b6f395c9625..2b8318c83e53 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -40,17 +40,4 @@ typedef unsigned long hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
43struct kvm_pio_request {
44 unsigned long count;
45 int cur_count;
46 struct page *guest_pages[2];
47 unsigned guest_page_offset;
48 int in;
49 int port;
50 int size;
51 int string;
52 int down;
53 int rep;
54};
55
56#endif /* __KVM_TYPES_H__ */ 43#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
index 901c2d6377a8..b0e99898527c 100644
--- a/include/linux/latencytop.h
+++ b/include/linux/latencytop.h
@@ -9,6 +9,7 @@
9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_ 9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_
10#define _INCLUDE_GUARD_LATENCYTOP_H_ 10#define _INCLUDE_GUARD_LATENCYTOP_H_
11 11
12#include <linux/compiler.h>
12#ifdef CONFIG_LATENCYTOP 13#ifdef CONFIG_LATENCYTOP
13 14
14#define LT_SAVECOUNT 32 15#define LT_SAVECOUNT 32
@@ -24,7 +25,14 @@ struct latency_record {
24 25
25struct task_struct; 26struct task_struct;
26 27
27void account_scheduler_latency(struct task_struct *task, int usecs, int inter); 28extern int latencytop_enabled;
29void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
30static inline void
31account_scheduler_latency(struct task_struct *task, int usecs, int inter)
32{
33 if (unlikely(latencytop_enabled))
34 __account_scheduler_latency(task, usecs, inter);
35}
28 36
29void clear_all_latency_tracing(struct task_struct *p); 37void clear_all_latency_tracing(struct task_struct *p);
30 38
diff --git a/include/linux/leds-bd2802.h b/include/linux/leds-bd2802.h
new file mode 100644
index 000000000000..42f854a1a199
--- /dev/null
+++ b/include/linux/leds-bd2802.h
@@ -0,0 +1,26 @@
1/*
2 * leds-bd2802.h - RGB LED Driver
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Kim Kyuwon <q1.kim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Datasheet: http://www.rohm.com/products/databook/driver/pdf/bd2802gu-e.pdf
12 *
13 */
14#ifndef _LEDS_BD2802_H_
15#define _LEDS_BD2802_H_
16
17struct bd2802_led_platform_data{
18 int reset_gpio;
19 u8 rgb_time;
20};
21
22#define RGB_TIME(slopedown, slopeup, waveform) \
23 ((slopedown) << 6 | (slopeup) << 4 | (waveform))
24
25#endif /* _LEDS_BD2802_H_ */
26
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 24489da701e3..376fe07732ea 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -30,6 +30,7 @@ enum led_brightness {
30struct led_classdev { 30struct led_classdev {
31 const char *name; 31 const char *name;
32 int brightness; 32 int brightness;
33 int max_brightness;
33 int flags; 34 int flags;
34 35
35 /* Lower 16 bits reflect status */ 36 /* Lower 16 bits reflect status */
@@ -140,7 +141,8 @@ struct gpio_led {
140 const char *name; 141 const char *name;
141 const char *default_trigger; 142 const char *default_trigger;
142 unsigned gpio; 143 unsigned gpio;
143 u8 active_low; 144 u8 active_low : 1;
145 u8 retain_state_suspended : 1;
144}; 146};
145 147
146struct gpio_led_platform_data { 148struct gpio_led_platform_data {
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
new file mode 100644
index 000000000000..33a071167489
--- /dev/null
+++ b/include/linux/leds_pwm.h
@@ -0,0 +1,21 @@
1/*
2 * PWM LED driver data - see drivers/leds/leds-pwm.c
3 */
4#ifndef __LINUX_LEDS_PWM_H
5#define __LINUX_LEDS_PWM_H
6
7struct led_pwm {
8 const char *name;
9 const char *default_trigger;
10 unsigned pwm_id;
11 u8 active_low;
12 unsigned max_brightness;
13 unsigned pwm_period_ns;
14};
15
16struct led_pwm_platform_data {
17 int num_leds;
18 struct led_pwm *leds;
19};
20
21#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index dc18b87ed722..b450a2628855 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -379,7 +379,7 @@ enum {
379 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ 379 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */
380 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands 380 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
381 not multiple of 16 bytes */ 381 not multiple of 16 bytes */
382 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ 382 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */
383 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 383 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
384 384
385 /* DMA mask for user DMA control: User visible values; DO NOT 385 /* DMA mask for user DMA control: User visible values; DO NOT
@@ -795,6 +795,7 @@ struct ata_port_operations {
795 ata_reset_fn_t pmp_hardreset; 795 ata_reset_fn_t pmp_hardreset;
796 ata_postreset_fn_t pmp_postreset; 796 ata_postreset_fn_t pmp_postreset;
797 void (*error_handler)(struct ata_port *ap); 797 void (*error_handler)(struct ata_port *ap);
798 void (*lost_interrupt)(struct ata_port *ap);
798 void (*post_internal_cmd)(struct ata_queued_cmd *qc); 799 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
799 800
800 /* 801 /*
@@ -836,6 +837,8 @@ struct ata_port_operations {
836 void (*bmdma_start)(struct ata_queued_cmd *qc); 837 void (*bmdma_start)(struct ata_queued_cmd *qc);
837 void (*bmdma_stop)(struct ata_queued_cmd *qc); 838 void (*bmdma_stop)(struct ata_queued_cmd *qc);
838 u8 (*bmdma_status)(struct ata_port *ap); 839 u8 (*bmdma_status)(struct ata_port *ap);
840
841 void (*drain_fifo)(struct ata_queued_cmd *qc);
839#endif /* CONFIG_ATA_SFF */ 842#endif /* CONFIG_ATA_SFF */
840 843
841 ssize_t (*em_show)(struct ata_port *ap, char *buf); 844 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -1008,6 +1011,9 @@ extern int ata_cable_sata(struct ata_port *ap);
1008extern int ata_cable_ignore(struct ata_port *ap); 1011extern int ata_cable_ignore(struct ata_port *ap);
1009extern int ata_cable_unknown(struct ata_port *ap); 1012extern int ata_cable_unknown(struct ata_port *ap);
1010 1013
1014extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1015 unsigned long delay);
1016
1011/* Timing helpers */ 1017/* Timing helpers */
1012extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1018extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1013extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1019extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1572,6 +1578,7 @@ extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1572extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1578extern unsigned int ata_sff_host_intr(struct ata_port *ap,
1573 struct ata_queued_cmd *qc); 1579 struct ata_queued_cmd *qc);
1574extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); 1580extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1581extern void ata_sff_lost_interrupt(struct ata_port *ap);
1575extern void ata_sff_freeze(struct ata_port *ap); 1582extern void ata_sff_freeze(struct ata_port *ap);
1576extern void ata_sff_thaw(struct ata_port *ap); 1583extern void ata_sff_thaw(struct ata_port *ap);
1577extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline); 1584extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline);
@@ -1584,6 +1591,7 @@ extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1584extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class, 1591extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1585 unsigned long deadline); 1592 unsigned long deadline);
1586extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1593extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1594extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1587extern void ata_sff_error_handler(struct ata_port *ap); 1595extern void ata_sff_error_handler(struct ata_port *ap);
1588extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); 1596extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1589extern int ata_sff_port_start(struct ata_port *ap); 1597extern int ata_sff_port_start(struct ata_port *ap);
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
deleted file mode 100644
index 2ed8fa1b762b..000000000000
--- a/include/linux/lm_interface.h
+++ /dev/null
@@ -1,277 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __LM_INTERFACE_DOT_H__
11#define __LM_INTERFACE_DOT_H__
12
13
14typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
15
16/*
17 * lm_mount() flags
18 *
19 * LM_MFLAG_SPECTATOR
20 * GFS is asking to join the filesystem's lockspace, but it doesn't want to
21 * modify the filesystem. The lock module shouldn't assign a journal to the FS
22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node
23 * dies or withdraws, all locks can be wiped immediately.
24 *
25 * LM_MFLAG_CONV_NODROP
26 * Do not allow the dlm to internally resolve conversion deadlocks by demoting
27 * the lock to unlocked and then reacquiring it in the requested mode. Instead,
28 * it should cancel the request and return LM_OUT_CONV_DEADLK.
29 */
30
31#define LM_MFLAG_SPECTATOR 0x00000001
32#define LM_MFLAG_CONV_NODROP 0x00000002
33
34/*
35 * lm_lockstruct flags
36 *
37 * LM_LSFLAG_LOCAL
38 * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
39 * can make single-node optimizations.
40 */
41
42#define LM_LSFLAG_LOCAL 0x00000001
43
44/*
45 * lm_lockname types
46 */
47
48#define LM_TYPE_RESERVED 0x00
49#define LM_TYPE_NONDISK 0x01
50#define LM_TYPE_INODE 0x02
51#define LM_TYPE_RGRP 0x03
52#define LM_TYPE_META 0x04
53#define LM_TYPE_IOPEN 0x05
54#define LM_TYPE_FLOCK 0x06
55#define LM_TYPE_PLOCK 0x07
56#define LM_TYPE_QUOTA 0x08
57#define LM_TYPE_JOURNAL 0x09
58
59/*
60 * lm_lock() states
61 *
62 * SHARED is compatible with SHARED, not with DEFERRED or EX.
63 * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
64 */
65
66#define LM_ST_UNLOCKED 0
67#define LM_ST_EXCLUSIVE 1
68#define LM_ST_DEFERRED 2
69#define LM_ST_SHARED 3
70
71/*
72 * lm_lock() flags
73 *
74 * LM_FLAG_TRY
75 * Don't wait to acquire the lock if it can't be granted immediately.
76 *
77 * LM_FLAG_TRY_1CB
78 * Send one blocking callback if TRY is set and the lock is not granted.
79 *
80 * LM_FLAG_NOEXP
81 * GFS sets this flag on lock requests it makes while doing journal recovery.
82 * These special requests should not be blocked due to the recovery like
83 * ordinary locks would be.
84 *
85 * LM_FLAG_ANY
86 * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
87 * also be granted in SHARED. The preferred state is whichever is compatible
88 * with other granted locks, or the specified state if no other locks exist.
89 *
90 * LM_FLAG_PRIORITY
91 * Override fairness considerations. Suppose a lock is held in a shared state
92 * and there is a pending request for the deferred state. A shared lock
93 * request with the priority flag would be allowed to bypass the deferred
94 * request and directly join the other shared lock. A shared lock request
95 * without the priority flag might be forced to wait until the deferred
96 * requested had acquired and released the lock.
97 */
98
99#define LM_FLAG_TRY 0x00000001
100#define LM_FLAG_TRY_1CB 0x00000002
101#define LM_FLAG_NOEXP 0x00000004
102#define LM_FLAG_ANY 0x00000008
103#define LM_FLAG_PRIORITY 0x00000010
104
105/*
106 * lm_lock() and lm_async_cb return flags
107 *
108 * LM_OUT_ST_MASK
109 * Masks the lower two bits of lock state in the returned value.
110 *
111 * LM_OUT_CACHEABLE
112 * The lock hasn't been released so GFS can continue to cache data for it.
113 *
114 * LM_OUT_CANCELED
115 * The lock request was canceled.
116 *
117 * LM_OUT_ASYNC
118 * The result of the request will be returned in an LM_CB_ASYNC callback.
119 *
120 * LM_OUT_CONV_DEADLK
121 * The lock request was canceled do to a conversion deadlock.
122 */
123
124#define LM_OUT_ST_MASK 0x00000003
125#define LM_OUT_CANCELED 0x00000008
126#define LM_OUT_ASYNC 0x00000080
127#define LM_OUT_ERROR 0x00000100
128
129/*
130 * lm_callback_t types
131 *
132 * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
133 * Blocking callback, a remote node is requesting the given lock in
134 * EXCLUSIVE, DEFERRED, or SHARED.
135 *
136 * LM_CB_NEED_RECOVERY
137 * The given journal needs to be recovered.
138 *
139 * LM_CB_ASYNC
140 * The given lock has been granted.
141 */
142
143#define LM_CB_NEED_E 257
144#define LM_CB_NEED_D 258
145#define LM_CB_NEED_S 259
146#define LM_CB_NEED_RECOVERY 260
147#define LM_CB_ASYNC 262
148
149/*
150 * lm_recovery_done() messages
151 */
152
153#define LM_RD_GAVEUP 308
154#define LM_RD_SUCCESS 309
155
156
157struct lm_lockname {
158 u64 ln_number;
159 unsigned int ln_type;
160};
161
162#define lm_name_equal(name1, name2) \
163 (((name1)->ln_number == (name2)->ln_number) && \
164 ((name1)->ln_type == (name2)->ln_type)) \
165
166struct lm_async_cb {
167 struct lm_lockname lc_name;
168 int lc_ret;
169};
170
171struct lm_lockstruct;
172
173struct lm_lockops {
174 const char *lm_proto_name;
175
176 /*
177 * Mount/Unmount
178 */
179
180 int (*lm_mount) (char *table_name, char *host_data,
181 lm_callback_t cb, void *cb_data,
182 unsigned int min_lvb_size, int flags,
183 struct lm_lockstruct *lockstruct,
184 struct kobject *fskobj);
185
186 void (*lm_others_may_mount) (void *lockspace);
187
188 void (*lm_unmount) (void *lockspace);
189
190 void (*lm_withdraw) (void *lockspace);
191
192 /*
193 * Lock oriented operations
194 */
195
196 int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
197
198 void (*lm_put_lock) (void *lock);
199
200 unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
201 unsigned int req_state, unsigned int flags);
202
203 unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
204
205 void (*lm_cancel) (void *lock);
206
207 int (*lm_hold_lvb) (void *lock, char **lvbp);
208 void (*lm_unhold_lvb) (void *lock, char *lvb);
209
210 /*
211 * Posix Lock oriented operations
212 */
213
214 int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
215 struct file *file, struct file_lock *fl);
216
217 int (*lm_plock) (void *lockspace, struct lm_lockname *name,
218 struct file *file, int cmd, struct file_lock *fl);
219
220 int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
221 struct file *file, struct file_lock *fl);
222
223 /*
224 * Client oriented operations
225 */
226
227 void (*lm_recovery_done) (void *lockspace, unsigned int jid,
228 unsigned int message);
229
230 struct module *lm_owner;
231};
232
233/*
234 * lm_mount() return values
235 *
236 * ls_jid - the journal ID this node should use
237 * ls_first - this node is the first to mount the file system
238 * ls_lvb_size - size in bytes of lock value blocks
239 * ls_lockspace - lock module's context for this file system
240 * ls_ops - lock module's functions
241 * ls_flags - lock module features
242 */
243
244struct lm_lockstruct {
245 unsigned int ls_jid;
246 unsigned int ls_first;
247 unsigned int ls_lvb_size;
248 void *ls_lockspace;
249 const struct lm_lockops *ls_ops;
250 int ls_flags;
251};
252
253/*
254 * Lock module bottom interface. A lock module makes itself available to GFS
255 * with these functions.
256 */
257
258int gfs2_register_lockproto(const struct lm_lockops *proto);
259void gfs2_unregister_lockproto(const struct lm_lockops *proto);
260
261/*
262 * Lock module top interface. GFS calls these functions when mounting or
263 * unmounting a file system.
264 */
265
266int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
267 lm_callback_t cb, void *cb_data,
268 unsigned int min_lvb_size, int flags,
269 struct lm_lockstruct *lockstruct,
270 struct kobject *fskobj);
271
272void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct);
273
274void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct);
275
276#endif /* __LM_INTERFACE_DOT_H__ */
277
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 7dc5b6cb44cd..d39ed1cc5fbf 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -25,13 +25,13 @@ struct svc_rqst;
25#define NLM_MAXCOOKIELEN 32 25#define NLM_MAXCOOKIELEN 32
26#define NLM_MAXSTRLEN 1024 26#define NLM_MAXSTRLEN 1024
27 27
28#define nlm_granted __constant_htonl(NLM_LCK_GRANTED) 28#define nlm_granted cpu_to_be32(NLM_LCK_GRANTED)
29#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) 29#define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED)
30#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) 30#define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS)
31#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) 31#define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED)
32#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) 32#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
33 33
34#define nlm_drop_reply __constant_htonl(30000) 34#define nlm_drop_reply cpu_to_be32(30000)
35 35
36/* Lock info passed via NLM */ 36/* Lock info passed via NLM */
37struct nlm_lock { 37struct nlm_lock {
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 12bfe09de2b1..7353821341ed 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -15,11 +15,11 @@
15#include <linux/lockd/xdr.h> 15#include <linux/lockd/xdr.h>
16 16
17/* error codes new to NLMv4 */ 17/* error codes new to NLMv4 */
18#define nlm4_deadlock __constant_htonl(NLM_DEADLCK) 18#define nlm4_deadlock cpu_to_be32(NLM_DEADLCK)
19#define nlm4_rofs __constant_htonl(NLM_ROFS) 19#define nlm4_rofs cpu_to_be32(NLM_ROFS)
20#define nlm4_stale_fh __constant_htonl(NLM_STALE_FH) 20#define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH)
21#define nlm4_fbig __constant_htonl(NLM_FBIG) 21#define nlm4_fbig cpu_to_be32(NLM_FBIG)
22#define nlm4_failed __constant_htonl(NLM_FAILED) 22#define nlm4_failed cpu_to_be32(NLM_FAILED)
23 23
24 24
25 25
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 5a58ea3e91e9..da5a5a1f4cd2 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -364,6 +364,23 @@ do { \
364 364
365#endif /* CONFIG_LOCK_STAT */ 365#endif /* CONFIG_LOCK_STAT */
366 366
367#ifdef CONFIG_LOCKDEP
368
369/*
370 * On lockdep we dont want the hand-coded irq-enable of
371 * _raw_*_lock_flags() code, because lockdep assumes
372 * that interrupts are not re-enabled during lock-acquire:
373 */
374#define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
375 LOCK_CONTENDED((_lock), (try), (lock))
376
377#else /* CONFIG_LOCKDEP */
378
379#define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
380 lockfl((_lock), (flags))
381
382#endif /* CONFIG_LOCKDEP */
383
367#ifdef CONFIG_GENERIC_HARDIRQS 384#ifdef CONFIG_GENERIC_HARDIRQS
368extern void early_init_irq_lock_class(void); 385extern void early_init_irq_lock_class(void);
369#else 386#else
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 6ffd6db5bb0d..40725447f5e0 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -160,5 +160,6 @@ int loop_unregister_transfer(int number);
160#define LOOP_SET_STATUS64 0x4C04 160#define LOOP_SET_STATUS64 0x4C04
161#define LOOP_GET_STATUS64 0x4C05 161#define LOOP_GET_STATUS64 0x4C05
162#define LOOP_CHANGE_FD 0x4C06 162#define LOOP_CHANGE_FD 0x4C06
163#define LOOP_SET_CAPACITY 0x4C07
163 164
164#endif 165#endif
diff --git a/include/linux/major.h b/include/linux/major.h
index 88249452b935..058ec15dd060 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -171,5 +171,6 @@
171#define VIOTAPE_MAJOR 230 171#define VIOTAPE_MAJOR 230
172 172
173#define BLOCK_EXT_MAJOR 259 173#define BLOCK_EXT_MAJOR 259
174#define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */
174 175
175#endif 176#endif
diff --git a/include/linux/maple.h b/include/linux/maple.h
index c23d3f51ba40..d9a51b9b3300 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -8,33 +8,49 @@ extern struct bus_type maple_bus_type;
8 8
9/* Maple Bus command and response codes */ 9/* Maple Bus command and response codes */
10enum maple_code { 10enum maple_code {
11 MAPLE_RESPONSE_FILEERR = -5, 11 MAPLE_RESPONSE_FILEERR = -5,
12 MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */ 12 MAPLE_RESPONSE_AGAIN, /* retransmit */
13 MAPLE_RESPONSE_BADCMD = -3, 13 MAPLE_RESPONSE_BADCMD,
14 MAPLE_RESPONSE_BADFUNC = -2, 14 MAPLE_RESPONSE_BADFUNC,
15 MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */ 15 MAPLE_RESPONSE_NONE, /* unit didn't respond*/
16 MAPLE_COMMAND_DEVINFO = 1, 16 MAPLE_COMMAND_DEVINFO = 1,
17 MAPLE_COMMAND_ALLINFO = 2, 17 MAPLE_COMMAND_ALLINFO,
18 MAPLE_COMMAND_RESET = 3, 18 MAPLE_COMMAND_RESET,
19 MAPLE_COMMAND_KILL = 4, 19 MAPLE_COMMAND_KILL,
20 MAPLE_RESPONSE_DEVINFO = 5, 20 MAPLE_RESPONSE_DEVINFO,
21 MAPLE_RESPONSE_ALLINFO = 6, 21 MAPLE_RESPONSE_ALLINFO,
22 MAPLE_RESPONSE_OK = 7, 22 MAPLE_RESPONSE_OK,
23 MAPLE_RESPONSE_DATATRF = 8, 23 MAPLE_RESPONSE_DATATRF,
24 MAPLE_COMMAND_GETCOND = 9, 24 MAPLE_COMMAND_GETCOND,
25 MAPLE_COMMAND_GETMINFO = 10, 25 MAPLE_COMMAND_GETMINFO,
26 MAPLE_COMMAND_BREAD = 11, 26 MAPLE_COMMAND_BREAD,
27 MAPLE_COMMAND_BWRITE = 12, 27 MAPLE_COMMAND_BWRITE,
28 MAPLE_COMMAND_SETCOND = 14 28 MAPLE_COMMAND_BSYNC,
29 MAPLE_COMMAND_SETCOND,
30 MAPLE_COMMAND_MICCONTROL
31};
32
33enum maple_file_errors {
34 MAPLE_FILEERR_INVALID_PARTITION = 0x01000000,
35 MAPLE_FILEERR_PHASE_ERROR = 0x02000000,
36 MAPLE_FILEERR_INVALID_BLOCK = 0x04000000,
37 MAPLE_FILEERR_WRITE_ERROR = 0x08000000,
38 MAPLE_FILEERR_INVALID_WRITE_LENGTH = 0x10000000,
39 MAPLE_FILEERR_BAD_CRC = 0x20000000
40};
41
42struct maple_buffer {
43 char bufx[0x400];
44 void *buf;
29}; 45};
30 46
31struct mapleq { 47struct mapleq {
32 struct list_head list; 48 struct list_head list;
33 struct maple_device *dev; 49 struct maple_device *dev;
34 void *sendbuf, *recvbuf, *recvbufdcsp; 50 struct maple_buffer *recvbuf;
51 void *sendbuf, *recvbuf_p2;
35 unsigned char length; 52 unsigned char length;
36 enum maple_code command; 53 enum maple_code command;
37 struct mutex mutex;
38}; 54};
39 55
40struct maple_devinfo { 56struct maple_devinfo {
@@ -52,11 +68,15 @@ struct maple_device {
52 struct maple_driver *driver; 68 struct maple_driver *driver;
53 struct mapleq *mq; 69 struct mapleq *mq;
54 void (*callback) (struct mapleq * mq); 70 void (*callback) (struct mapleq * mq);
71 void (*fileerr_handler)(struct maple_device *mdev, void *recvbuf);
72 int (*can_unload)(struct maple_device *mdev);
55 unsigned long when, interval, function; 73 unsigned long when, interval, function;
56 struct maple_devinfo devinfo; 74 struct maple_devinfo devinfo;
57 unsigned char port, unit; 75 unsigned char port, unit;
58 char product_name[32]; 76 char product_name[32];
59 char product_licence[64]; 77 char product_licence[64];
78 atomic_t busy;
79 wait_queue_head_t maple_wait;
60 struct device dev; 80 struct device dev;
61}; 81};
62 82
@@ -72,7 +92,7 @@ void maple_getcond_callback(struct maple_device *dev,
72int maple_driver_register(struct maple_driver *); 92int maple_driver_register(struct maple_driver *);
73void maple_driver_unregister(struct maple_driver *); 93void maple_driver_unregister(struct maple_driver *);
74 94
75int maple_add_packet_sleeps(struct maple_device *mdev, u32 function, 95int maple_add_packet(struct maple_device *mdev, u32 function,
76 u32 command, u32 length, void *data); 96 u32 command, u32 length, void *data);
77void maple_clear_dev(struct maple_device *mdev); 97void maple_clear_dev(struct maple_device *mdev);
78 98
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index 404f678e734b..2203121a43e9 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -37,7 +37,7 @@ enum matroxfb_ctrl_id {
37 MATROXFB_CID_LAST 37 MATROXFB_CID_LAST
38}; 38};
39 39
40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) 40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41 41
42#endif 42#endif
43 43
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 326f45c86530..18146c980b68 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -88,9 +88,6 @@ extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
88/* 88/*
89 * For memory reclaim. 89 * For memory reclaim.
90 */ 90 */
91extern int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem);
92extern long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem);
93
94extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem); 91extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
95extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, 92extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
96 int priority); 93 int priority);
@@ -104,6 +101,8 @@ struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
104 struct zone *zone); 101 struct zone *zone);
105struct zone_reclaim_stat* 102struct zone_reclaim_stat*
106mem_cgroup_get_reclaim_stat_from_page(struct page *page); 103mem_cgroup_get_reclaim_stat_from_page(struct page *page);
104extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
105 struct task_struct *p);
107 106
108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 107#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
109extern int do_swap_account; 108extern int do_swap_account;
@@ -209,16 +208,6 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
209{ 208{
210} 209}
211 210
212static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
213{
214 return 0;
215}
216
217static inline int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
218{
219 return 0;
220}
221
222static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem) 211static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
223{ 212{
224 return 0; 213 return 0;
@@ -270,6 +259,11 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
270 return NULL; 259 return NULL;
271} 260}
272 261
262static inline void
263mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
264{
265}
266
273#endif /* CONFIG_CGROUP_MEM_CONT */ 267#endif /* CONFIG_CGROUP_MEM_CONT */
274 268
275#endif /* _LINUX_MEMCONTROL_H */ 269#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 86a6c0f0518d..37fa19b34ef5 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -100,6 +100,17 @@ enum mem_add_context { BOOT, HOTPLUG };
100#endif 100#endif
101 101
102/* 102/*
103 * 'struct memory_accessor' is a generic interface to provide
104 * in-kernel access to persistent memory such as i2c or SPI EEPROMs
105 */
106struct memory_accessor {
107 ssize_t (*read)(struct memory_accessor *, char *buf, off_t offset,
108 size_t count);
109 ssize_t (*write)(struct memory_accessor *, const char *buf,
110 off_t offset, size_t count);
111};
112
113/*
103 * Kernel text modification mutex, used for code patching. Users of this lock 114 * Kernel text modification mutex, used for code patching. Users of this lock
104 * can sleep. 115 * can sleep.
105 */ 116 */
diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h
new file mode 100644
index 000000000000..be469a357cbb
--- /dev/null
+++ b/include/linux/mfd/ds1wm.h
@@ -0,0 +1,6 @@
1/* MFD cell driver data for the DS1WM driver */
2
3struct ds1wm_driver_data {
4 int active_high;
5 int clock_rate;
6};
diff --git a/include/linux/mfd/htc-pasic3.h b/include/linux/mfd/htc-pasic3.h
index b4294f12c4f8..3d3ed67bd969 100644
--- a/include/linux/mfd/htc-pasic3.h
+++ b/include/linux/mfd/htc-pasic3.h
@@ -48,7 +48,6 @@ struct pasic3_leds_machinfo {
48 48
49struct pasic3_platform_data { 49struct pasic3_platform_data {
50 struct pasic3_leds_machinfo *led_pdata; 50 struct pasic3_leds_machinfo *led_pdata;
51 unsigned int bus_shift;
52 unsigned int clock_rate; 51 unsigned int clock_rate;
53}; 52};
54 53
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index af95a1d2f3a1..d899dc0223ba 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -490,6 +490,7 @@
490/* 490/*
491 * R231 (0xE7) - Jack Status 491 * R231 (0xE7) - Jack Status
492 */ 492 */
493#define WM8350_JACK_L_LVL 0x0800
493#define WM8350_JACK_R_LVL 0x0400 494#define WM8350_JACK_R_LVL 0x0400
494 495
495/* 496/*
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 980669d50dca..42cca672f340 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -640,9 +640,11 @@ struct wm8350 {
640 * 640 *
641 * @init: Function called during driver initialisation. Should be 641 * @init: Function called during driver initialisation. Should be
642 * used by the platform to configure GPIO functions and similar. 642 * used by the platform to configure GPIO functions and similar.
643 * @irq_high: Set if WM8350 IRQ is active high.
643 */ 644 */
644struct wm8350_platform_data { 645struct wm8350_platform_data {
645 int (*init)(struct wm8350 *wm8350); 646 int (*init)(struct wm8350 *wm8350);
647 int irq_high;
646}; 648};
647 649
648 650
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h
index b6640e018046..e06ed3eb1d0a 100644
--- a/include/linux/mfd/wm8400-audio.h
+++ b/include/linux/mfd/wm8400-audio.h
@@ -1181,6 +1181,7 @@
1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */ 1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */
1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */ 1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */
1183 1183
1184struct wm8400;
1184void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400); 1185void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400);
1185 1186
1186#endif 1187#endif
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
new file mode 100644
index 000000000000..1f76b1ebf627
--- /dev/null
+++ b/include/linux/mg_disk.h
@@ -0,0 +1,206 @@
1/*
2 * include/linux/mg_disk.c
3 *
4 * Support for the mGine m[g]flash IO mode.
5 * Based on legacy hd.c
6 *
7 * (c) 2008 mGine Co.,LTD
8 * (c) 2008 unsik Kim <donari75@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __MG_DISK_H__
16#define __MG_DISK_H__
17
18#include <linux/blkdev.h>
19#include <linux/ata.h>
20
21/* name for block device */
22#define MG_DISK_NAME "mgd"
23/* name for platform device */
24#define MG_DEV_NAME "mg_disk"
25
26#define MG_DISK_MAJ 0
27#define MG_DISK_MAX_PART 16
28#define MG_SECTOR_SIZE 512
29#define MG_MAX_SECTS 256
30
31/* Register offsets */
32#define MG_BUFF_OFFSET 0x8000
33#define MG_STORAGE_BUFFER_SIZE 0x200
34#define MG_REG_OFFSET 0xC000
35#define MG_REG_FEATURE (MG_REG_OFFSET + 2) /* write case */
36#define MG_REG_ERROR (MG_REG_OFFSET + 2) /* read case */
37#define MG_REG_SECT_CNT (MG_REG_OFFSET + 4)
38#define MG_REG_SECT_NUM (MG_REG_OFFSET + 6)
39#define MG_REG_CYL_LOW (MG_REG_OFFSET + 8)
40#define MG_REG_CYL_HIGH (MG_REG_OFFSET + 0xA)
41#define MG_REG_DRV_HEAD (MG_REG_OFFSET + 0xC)
42#define MG_REG_COMMAND (MG_REG_OFFSET + 0xE) /* write case */
43#define MG_REG_STATUS (MG_REG_OFFSET + 0xE) /* read case */
44#define MG_REG_DRV_CTRL (MG_REG_OFFSET + 0x10)
45#define MG_REG_BURST_CTRL (MG_REG_OFFSET + 0x12)
46
47/* "Drive Select/Head Register" bit values */
48#define MG_REG_HEAD_MUST_BE_ON 0xA0 /* These 2 bits are always on */
49#define MG_REG_HEAD_DRIVE_MASTER (0x00 | MG_REG_HEAD_MUST_BE_ON)
50#define MG_REG_HEAD_DRIVE_SLAVE (0x10 | MG_REG_HEAD_MUST_BE_ON)
51#define MG_REG_HEAD_LBA_MODE (0x40 | MG_REG_HEAD_MUST_BE_ON)
52
53
54/* "Device Control Register" bit values */
55#define MG_REG_CTRL_INTR_ENABLE 0x0
56#define MG_REG_CTRL_INTR_DISABLE (0x1<<1)
57#define MG_REG_CTRL_RESET (0x1<<2)
58#define MG_REG_CTRL_INTR_POLA_ACTIVE_HIGH 0x0
59#define MG_REG_CTRL_INTR_POLA_ACTIVE_LOW (0x1<<4)
60#define MG_REG_CTRL_DPD_POLA_ACTIVE_LOW 0x0
61#define MG_REG_CTRL_DPD_POLA_ACTIVE_HIGH (0x1<<5)
62#define MG_REG_CTRL_DPD_DISABLE 0x0
63#define MG_REG_CTRL_DPD_ENABLE (0x1<<6)
64
65/* Status register bit */
66/* error bit in status register */
67#define MG_REG_STATUS_BIT_ERROR 0x01
68/* corrected error in status register */
69#define MG_REG_STATUS_BIT_CORRECTED_ERROR 0x04
70/* data request bit in status register */
71#define MG_REG_STATUS_BIT_DATA_REQ 0x08
72/* DSC - Drive Seek Complete */
73#define MG_REG_STATUS_BIT_SEEK_DONE 0x10
74/* DWF - Drive Write Fault */
75#define MG_REG_STATUS_BIT_WRITE_FAULT 0x20
76#define MG_REG_STATUS_BIT_READY 0x40
77#define MG_REG_STATUS_BIT_BUSY 0x80
78
79/* handy status */
80#define MG_STAT_READY (MG_REG_STATUS_BIT_READY | MG_REG_STATUS_BIT_SEEK_DONE)
81#define MG_READY_OK(s) (((s) & (MG_STAT_READY | \
82 (MG_REG_STATUS_BIT_BUSY | \
83 MG_REG_STATUS_BIT_WRITE_FAULT | \
84 MG_REG_STATUS_BIT_ERROR))) == MG_STAT_READY)
85
86/* Error register */
87#define MG_REG_ERR_AMNF 0x01
88#define MG_REG_ERR_ABRT 0x04
89#define MG_REG_ERR_IDNF 0x10
90#define MG_REG_ERR_UNC 0x40
91#define MG_REG_ERR_BBK 0x80
92
93/* error code for others */
94#define MG_ERR_NONE 0
95#define MG_ERR_TIMEOUT 0x100
96#define MG_ERR_INIT_STAT 0x101
97#define MG_ERR_TRANSLATION 0x102
98#define MG_ERR_CTRL_RST 0x103
99#define MG_ERR_INV_STAT 0x104
100#define MG_ERR_RSTOUT 0x105
101
102#define MG_MAX_ERRORS 6 /* Max read/write errors */
103
104/* command */
105#define MG_CMD_RD 0x20
106#define MG_CMD_WR 0x30
107#define MG_CMD_SLEEP 0x99
108#define MG_CMD_WAKEUP 0xC3
109#define MG_CMD_ID 0xEC
110#define MG_CMD_WR_CONF 0x3C
111#define MG_CMD_RD_CONF 0x40
112
113/* operation mode */
114#define MG_OP_CASCADE (1 << 0)
115#define MG_OP_CASCADE_SYNC_RD (1 << 1)
116#define MG_OP_CASCADE_SYNC_WR (1 << 2)
117#define MG_OP_INTERLEAVE (1 << 3)
118
119/* synchronous */
120#define MG_BURST_LAT_4 (3 << 4)
121#define MG_BURST_LAT_5 (4 << 4)
122#define MG_BURST_LAT_6 (5 << 4)
123#define MG_BURST_LAT_7 (6 << 4)
124#define MG_BURST_LAT_8 (7 << 4)
125#define MG_BURST_LEN_4 (1 << 1)
126#define MG_BURST_LEN_8 (2 << 1)
127#define MG_BURST_LEN_16 (3 << 1)
128#define MG_BURST_LEN_32 (4 << 1)
129#define MG_BURST_LEN_CONT (0 << 1)
130
131/* timeout value (unit: ms) */
132#define MG_TMAX_CONF_TO_CMD 1
133#define MG_TMAX_WAIT_RD_DRQ 10
134#define MG_TMAX_WAIT_WR_DRQ 500
135#define MG_TMAX_RST_TO_BUSY 10
136#define MG_TMAX_HDRST_TO_RDY 500
137#define MG_TMAX_SWRST_TO_RDY 500
138#define MG_TMAX_RSTOUT 3000
139
140/* device attribution */
141/* use mflash as boot device */
142#define MG_BOOT_DEV (1 << 0)
143/* use mflash as storage device */
144#define MG_STORAGE_DEV (1 << 1)
145/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
146#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
147
148#define MG_DEV_MASK (MG_BOOT_DEV | MG_STORAGE_DEV | MG_STORAGE_DEV_SKIP_RST)
149
150/* names of GPIO resource */
151#define MG_RST_PIN "mg_rst"
152/* except MG_BOOT_DEV, reset-out pin should be assigned */
153#define MG_RSTOUT_PIN "mg_rstout"
154
155/* private driver data */
156struct mg_drv_data {
157 /* disk resource */
158 u32 use_polling;
159
160 /* device attribution */
161 u32 dev_attr;
162
163 /* internally used */
164 struct mg_host *host;
165};
166
167/* main structure for mflash driver */
168struct mg_host {
169 struct device *dev;
170
171 struct request_queue *breq;
172 spinlock_t lock;
173 struct gendisk *gd;
174
175 struct timer_list timer;
176 void (*mg_do_intr) (struct mg_host *);
177
178 u16 id[ATA_ID_WORDS];
179
180 u16 cyls;
181 u16 heads;
182 u16 sectors;
183 u32 n_sectors;
184 u32 nres_sectors;
185
186 void __iomem *dev_base;
187 unsigned int irq;
188 unsigned int rst;
189 unsigned int rstout;
190
191 u32 major;
192 u32 error;
193};
194
195/*
196 * Debugging macro and defines
197 */
198#undef DO_MG_DEBUG
199#ifdef DO_MG_DEBUG
200# define MG_DBG(fmt, args...) \
201 printk(KERN_DEBUG "%s:%d "fmt, __func__, __LINE__, ##args)
202#else /* CONFIG_MG_DEBUG */
203# define MG_DBG(fmt, args...) do { } while (0)
204#endif /* CONFIG_MG_DEBUG */
205
206#endif
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index a820f816a49e..beb6ec99cfef 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -26,6 +26,7 @@
26#define TUN_MINOR 200 26#define TUN_MINOR 200
27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
28#define MPT_MINOR 220 28#define MPT_MINOR 220
29#define MPT2SAS_MINOR 221
29#define HPET_MINOR 228 30#define HPET_MINOR 228
30#define FUSE_MINOR 229 31#define FUSE_MINOR 229
31#define KVM_MINOR 232 32#define KVM_MINOR 232
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index cf9c679ab38b..0f82293a82ed 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -55,6 +55,7 @@ enum {
55 MLX4_CMD_CLOSE_PORT = 0xa, 55 MLX4_CMD_CLOSE_PORT = 0xa,
56 MLX4_CMD_QUERY_HCA = 0xb, 56 MLX4_CMD_QUERY_HCA = 0xb,
57 MLX4_CMD_QUERY_PORT = 0x43, 57 MLX4_CMD_QUERY_PORT = 0x43,
58 MLX4_CMD_SENSE_PORT = 0x4d,
58 MLX4_CMD_SET_PORT = 0xc, 59 MLX4_CMD_SET_PORT = 0xc,
59 MLX4_CMD_ACCESS_DDR = 0x2e, 60 MLX4_CMD_ACCESS_DDR = 0x2e,
60 MLX4_CMD_MAP_ICM = 0xffa, 61 MLX4_CMD_MAP_ICM = 0xffa,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 8f659cc29960..3aff8a6a389e 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -155,8 +155,9 @@ enum mlx4_qp_region {
155}; 155};
156 156
157enum mlx4_port_type { 157enum mlx4_port_type {
158 MLX4_PORT_TYPE_IB = 1 << 0, 158 MLX4_PORT_TYPE_IB = 1,
159 MLX4_PORT_TYPE_ETH = 1 << 1, 159 MLX4_PORT_TYPE_ETH = 2,
160 MLX4_PORT_TYPE_AUTO = 3
160}; 161};
161 162
162enum mlx4_special_vlan_idx { 163enum mlx4_special_vlan_idx {
@@ -237,6 +238,7 @@ struct mlx4_caps {
237 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 238 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
238 u8 supported_type[MLX4_MAX_PORTS + 1]; 239 u8 supported_type[MLX4_MAX_PORTS + 1];
239 u32 port_mask; 240 u32 port_mask;
241 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
240}; 242};
241 243
242struct mlx4_buf_list { 244struct mlx4_buf_list {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 065cdf8c09fb..bff1f0d475c7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -104,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107 108
108#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
109#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -134,6 +135,7 @@ extern pgprot_t protection_map[16];
134 135
135#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 136#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
136#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 137#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
138#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
137 139
138/* 140/*
139 * This interface is used by x86 PAT code to identify a pfn mapping that is 141 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -145,7 +147,7 @@ extern pgprot_t protection_map[16];
145 */ 147 */
146static inline int is_linear_pfn_mapping(struct vm_area_struct *vma) 148static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
147{ 149{
148 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff); 150 return (vma->vm_flags & VM_PFN_AT_MMAP);
149} 151}
150 152
151static inline int is_pfn_mapping(struct vm_area_struct *vma) 153static inline int is_pfn_mapping(struct vm_area_struct *vma)
@@ -186,7 +188,7 @@ struct vm_operations_struct {
186 188
187 /* notification that a previously read-only page is about to become 189 /* notification that a previously read-only page is about to become
188 * writable, if an error is returned it will cause a SIGBUS */ 190 * writable, if an error is returned it will cause a SIGBUS */
189 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 191 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
190 192
191 /* called by access_process_vm when get_user_pages() fails, typically 193 /* called by access_process_vm when get_user_pages() fails, typically
192 * for use by special VMAs that can switch between memory and hardware 194 * for use by special VMAs that can switch between memory and hardware
@@ -833,6 +835,7 @@ int __set_page_dirty_nobuffers(struct page *page);
833int __set_page_dirty_no_writeback(struct page *page); 835int __set_page_dirty_no_writeback(struct page *page);
834int redirty_page_for_writepage(struct writeback_control *wbc, 836int redirty_page_for_writepage(struct writeback_control *wbc,
835 struct page *page); 837 struct page *page);
838void account_page_dirtied(struct page *page, struct address_space *mapping);
836int set_page_dirty(struct page *page); 839int set_page_dirty(struct page *page);
837int set_page_dirty_lock(struct page *page); 840int set_page_dirty_lock(struct page *page);
838int clear_page_dirty_for_io(struct page *page); 841int clear_page_dirty_for_io(struct page *page);
@@ -1076,7 +1079,7 @@ static inline void setup_per_cpu_pageset(void) {}
1076#endif 1079#endif
1077 1080
1078/* nommu.c */ 1081/* nommu.c */
1079extern atomic_t mmap_pages_allocated; 1082extern atomic_long_t mmap_pages_allocated;
1080 1083
1081/* prio_tree.c */ 1084/* prio_tree.c */
1082void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1085void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index d84feb7bdbf0..0e80e26ecf21 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -11,6 +11,7 @@
11#include <linux/rwsem.h> 11#include <linux/rwsem.h>
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/page-debug-flags.h>
14#include <asm/page.h> 15#include <asm/page.h>
15#include <asm/mmu.h> 16#include <asm/mmu.h>
16 17
@@ -94,6 +95,9 @@ struct page {
94 void *virtual; /* Kernel virtual address (NULL if 95 void *virtual; /* Kernel virtual address (NULL if
95 not kmapped, ie. highmem) */ 96 not kmapped, ie. highmem) */
96#endif /* WANT_PAGE_VIRTUAL */ 97#endif /* WANT_PAGE_VIRTUAL */
98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
99 unsigned long debug_flags; /* Use atomic bitops on this */
100#endif
97}; 101};
98 102
99/* 103/*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 4e457256bd33..3e7615e9087e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -192,5 +192,10 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
192 wake_up_process(host->sdio_irq_thread); 192 wake_up_process(host->sdio_irq_thread);
193} 193}
194 194
195struct regulator;
196
197int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199
195#endif 200#endif
196 201
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1aca6cebbb78..186ec6ab334d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -764,12 +764,6 @@ extern int numa_zonelist_order_handler(struct ctl_table *, int,
764extern char numa_zonelist_order[]; 764extern char numa_zonelist_order[];
765#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ 765#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
766 766
767#include <linux/topology.h>
768/* Returns the number of the current Node. */
769#ifndef numa_node_id
770#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
771#endif
772
773#ifndef CONFIG_NEED_MULTIPLE_NODES 767#ifndef CONFIG_NEED_MULTIPLE_NODES
774 768
775extern struct pglist_data contig_page_data; 769extern struct pglist_data contig_page_data;
@@ -806,6 +800,14 @@ extern struct zone *next_zone(struct zone *zone);
806 zone; \ 800 zone; \
807 zone = next_zone(zone)) 801 zone = next_zone(zone))
808 802
803#define for_each_populated_zone(zone) \
804 for (zone = (first_online_pgdat())->node_zones; \
805 zone; \
806 zone = next_zone(zone)) \
807 if (!populated_zone(zone)) \
808 ; /* do nothing */ \
809 else
810
809static inline struct zone *zonelist_zone(struct zoneref *zoneref) 811static inline struct zone *zonelist_zone(struct zoneref *zoneref)
810{ 812{
811 return zoneref->zone; 813 return zoneref->zone;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 830bbcd449d6..3a059298cc19 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -22,6 +22,8 @@ struct proc_mounts {
22 int event; 22 int event;
23}; 23};
24 24
25struct fs_struct;
26
25extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 27extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
26 struct fs_struct *); 28 struct fs_struct *);
27extern void __put_mnt_ns(struct mnt_namespace *ns); 29extern void __put_mnt_ns(struct mnt_namespace *ns);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index fde86671f48f..1bf5900ffe43 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -454,4 +454,13 @@ struct dmi_system_id {
454 454
455#define DMI_MATCH(a, b) { a, b } 455#define DMI_MATCH(a, b) { a, b }
456 456
457#define PLATFORM_NAME_SIZE 20
458#define PLATFORM_MODULE_PREFIX "platform:"
459
460struct platform_device_id {
461 char name[PLATFORM_NAME_SIZE];
462 kernel_ulong_t driver_data
463 __attribute__((aligned(sizeof(kernel_ulong_t))));
464};
465
457#endif /* LINUX_MOD_DEVICETABLE_H */ 466#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 22d9878e868c..627ac082e2a6 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -248,6 +248,10 @@ struct module
248 const unsigned long *crcs; 248 const unsigned long *crcs;
249 unsigned int num_syms; 249 unsigned int num_syms;
250 250
251 /* Kernel parameters. */
252 struct kernel_param *kp;
253 unsigned int num_kp;
254
251 /* GPL-only exported symbols. */ 255 /* GPL-only exported symbols. */
252 unsigned int num_gpl_syms; 256 unsigned int num_gpl_syms;
253 const struct kernel_symbol *gpl_syms; 257 const struct kernel_symbol *gpl_syms;
@@ -355,6 +359,8 @@ struct module
355#define MODULE_ARCH_INIT {} 359#define MODULE_ARCH_INIT {}
356#endif 360#endif
357 361
362extern struct mutex module_mutex;
363
358/* FIXME: It'd be nice to isolate modules during init, too, so they 364/* FIXME: It'd be nice to isolate modules during init, too, so they
359 aren't used before they (may) fail. But presently too much code 365 aren't used before they (may) fail. But presently too much code
360 (IDE & SCSI) require entry into the module during init.*/ 366 (IDE & SCSI) require entry into the module during init.*/
@@ -363,10 +369,10 @@ static inline int module_is_live(struct module *mod)
363 return mod->state != MODULE_STATE_GOING; 369 return mod->state != MODULE_STATE_GOING;
364} 370}
365 371
366/* Is this address in a module? (second is with no locks, for oops) */
367struct module *module_text_address(unsigned long addr);
368struct module *__module_text_address(unsigned long addr); 372struct module *__module_text_address(unsigned long addr);
369int is_module_address(unsigned long addr); 373struct module *__module_address(unsigned long addr);
374bool is_module_address(unsigned long addr);
375bool is_module_text_address(unsigned long addr);
370 376
371static inline int within_module_core(unsigned long addr, struct module *mod) 377static inline int within_module_core(unsigned long addr, struct module *mod)
372{ 378{
@@ -380,6 +386,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod)
380 addr < (unsigned long)mod->module_init + mod->init_size; 386 addr < (unsigned long)mod->module_init + mod->init_size;
381} 387}
382 388
389/* Search for module by name: must hold module_mutex. */
390struct module *find_module(const char *name);
391
392struct symsearch {
393 const struct kernel_symbol *start, *stop;
394 const unsigned long *crcs;
395 enum {
396 NOT_GPL_ONLY,
397 GPL_ONLY,
398 WILL_BE_GPL_ONLY,
399 } licence;
400 bool unused;
401};
402
403/* Search for an exported symbol by name. */
404const struct kernel_symbol *find_symbol(const char *name,
405 struct module **owner,
406 const unsigned long **crc,
407 bool gplok,
408 bool warn);
409
410/* Walk the exported symbol table */
411bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner,
412 unsigned int symnum, void *data), void *data);
413
383/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 414/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
384 symnum out of range. */ 415 symnum out of range. */
385int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 416int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@@ -388,6 +419,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
388/* Look for this name: can be of form module:name. */ 419/* Look for this name: can be of form module:name. */
389unsigned long module_kallsyms_lookup_name(const char *name); 420unsigned long module_kallsyms_lookup_name(const char *name);
390 421
422int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
423 struct module *, unsigned long),
424 void *data);
425
391extern void __module_put_and_exit(struct module *mod, long code) 426extern void __module_put_and_exit(struct module *mod, long code)
392 __attribute__((noreturn)); 427 __attribute__((noreturn));
393#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 428#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
@@ -449,6 +484,7 @@ static inline void __module_get(struct module *module)
449#define symbol_put_addr(p) do { } while(0) 484#define symbol_put_addr(p) do { } while(0)
450 485
451#endif /* CONFIG_MODULE_UNLOAD */ 486#endif /* CONFIG_MODULE_UNLOAD */
487int use_module(struct module *a, struct module *b);
452 488
453/* This is a #define so the string doesn't get put in every .o file */ 489/* This is a #define so the string doesn't get put in every .o file */
454#define module_name(mod) \ 490#define module_name(mod) \
@@ -495,21 +531,24 @@ search_module_extables(unsigned long addr)
495 return NULL; 531 return NULL;
496} 532}
497 533
498/* Is this address in a module? */ 534static inline struct module *__module_address(unsigned long addr)
499static inline struct module *module_text_address(unsigned long addr)
500{ 535{
501 return NULL; 536 return NULL;
502} 537}
503 538
504/* Is this address in a module? (don't take a lock, we're oopsing) */
505static inline struct module *__module_text_address(unsigned long addr) 539static inline struct module *__module_text_address(unsigned long addr)
506{ 540{
507 return NULL; 541 return NULL;
508} 542}
509 543
510static inline int is_module_address(unsigned long addr) 544static inline bool is_module_address(unsigned long addr)
511{ 545{
512 return 0; 546 return false;
547}
548
549static inline bool is_module_text_address(unsigned long addr)
550{
551 return false;
513} 552}
514 553
515/* Get/put a kernel symbol (calls should be symmetric) */ 554/* Get/put a kernel symbol (calls should be symmetric) */
@@ -564,6 +603,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name)
564 return 0; 603 return 0;
565} 604}
566 605
606static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
607 struct module *,
608 unsigned long),
609 void *data)
610{
611 return 0;
612}
613
567static inline int register_module_notifier(struct notifier_block * nb) 614static inline int register_module_notifier(struct notifier_block * nb)
568{ 615{
569 /* no events will happen anyway, so this can always succeed */ 616 /* no events will happen anyway, so this can always succeed */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index e4af3399ef48..a4f0b931846c 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -138,6 +138,16 @@ extern int parse_args(const char *name,
138 unsigned num, 138 unsigned num,
139 int (*unknown)(char *param, char *val)); 139 int (*unknown)(char *param, char *val));
140 140
141/* Called by module remove. */
142#ifdef CONFIG_SYSFS
143extern void destroy_params(const struct kernel_param *params, unsigned num);
144#else
145static inline void destroy_params(const struct kernel_param *params,
146 unsigned num)
147{
148}
149#endif /* !CONFIG_SYSFS */
150
141/* All the helper functions */ 151/* All the helper functions */
142/* The macros to do compile-time type checking stolen from Jakub 152/* The macros to do compile-time type checking stolen from Jakub
143 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ 153 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index cab2a85e2ee8..51f55f903aff 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -27,6 +27,7 @@ struct mnt_namespace;
27#define MNT_NODIRATIME 0x10 27#define MNT_NODIRATIME 0x10
28#define MNT_RELATIME 0x20 28#define MNT_RELATIME 0x20
29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ 29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
30#define MNT_STRICTATIME 0x80
30 31
31#define MNT_SHRINKABLE 0x100 32#define MNT_SHRINKABLE 0x100
32#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */ 33#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 5c42821da2d1..068a0c9946af 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -11,21 +11,11 @@
11 */ 11 */
12#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
13 13
14struct mpage_data {
15 struct bio *bio;
16 sector_t last_block_in_bio;
17 get_block_t *get_block;
18 unsigned use_writepage;
19};
20
21struct writeback_control; 14struct writeback_control;
22 15
23struct bio *mpage_bio_submit(int rw, struct bio *bio);
24int mpage_readpages(struct address_space *mapping, struct list_head *pages, 16int mpage_readpages(struct address_space *mapping, struct list_head *pages,
25 unsigned nr_pages, get_block_t get_block); 17 unsigned nr_pages, get_block_t get_block);
26int mpage_readpage(struct page *page, get_block_t get_block); 18int mpage_readpage(struct page *page, get_block_t get_block);
27int __mpage_writepage(struct page *page, struct writeback_control *wbc,
28 void *data);
29int mpage_writepages(struct address_space *mapping, 19int mpage_writepages(struct address_space *mapping,
30 struct writeback_control *wbc, get_block_t get_block); 20 struct writeback_control *wbc, get_block_t get_block);
31int mpage_writepage(struct page *page, get_block_t *get_block, 21int mpage_writepage(struct page *page, get_block_t *get_block,
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 8a455694d682..0d45b4e8d367 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -193,6 +193,9 @@ struct vif_device
193struct mfc_cache 193struct mfc_cache
194{ 194{
195 struct mfc_cache *next; /* Next entry on cache line */ 195 struct mfc_cache *next; /* Next entry on cache line */
196#ifdef CONFIG_NET_NS
197 struct net *mfc_net;
198#endif
196 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 199 __be32 mfc_mcastgrp; /* Group the entry belongs to */
197 __be32 mfc_origin; /* Source of packet */ 200 __be32 mfc_origin; /* Source of packet */
198 vifi_t mfc_parent; /* Source interface */ 201 vifi_t mfc_parent; /* Source interface */
@@ -215,6 +218,18 @@ struct mfc_cache
215 } mfc_un; 218 } mfc_un;
216}; 219};
217 220
221static inline
222struct net *mfc_net(const struct mfc_cache *mfc)
223{
224 return read_pnet(&mfc->mfc_net);
225}
226
227static inline
228void mfc_net_set(struct mfc_cache *mfc, struct net *net)
229{
230 write_pnet(&mfc->mfc_net, hold_net(net));
231}
232
218#define MFC_STATIC 1 233#define MFC_STATIC 1
219#define MFC_NOTIFY 2 234#define MFC_NOTIFY 2
220 235
@@ -241,7 +256,8 @@ struct mfc_cache
241 256
242#ifdef __KERNEL__ 257#ifdef __KERNEL__
243struct rtmsg; 258struct rtmsg;
244extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 259extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
260 struct rtmsg *rtm, int nowait);
245#endif 261#endif
246 262
247#endif 263#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 5375faca1f72..43dc97e32183 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -65,7 +65,7 @@ struct mif6ctl {
65 mifi_t mif6c_mifi; /* Index of MIF */ 65 mifi_t mif6c_mifi; /* Index of MIF */
66 unsigned char mif6c_flags; /* MIFF_ flags */ 66 unsigned char mif6c_flags; /* MIFF_ flags */
67 unsigned char vifc_threshold; /* ttl limit */ 67 unsigned char vifc_threshold; /* ttl limit */
68 u_short mif6c_pifi; /* the index of the physical IF */ 68 __u16 mif6c_pifi; /* the index of the physical IF */
69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ 69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
70}; 70};
71 71
diff --git a/include/linux/msi.h b/include/linux/msi.h
index d2b8a1e8ca11..6991ab5b24d1 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -20,20 +20,23 @@ extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
20 20
21struct msi_desc { 21struct msi_desc {
22 struct { 22 struct {
23 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ 23 __u8 is_msix : 1;
24 __u8 multiple: 3; /* log2 number of messages */
24 __u8 maskbit : 1; /* mask-pending bit supported ? */ 25 __u8 maskbit : 1; /* mask-pending bit supported ? */
25 __u8 masked : 1;
26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
27 __u8 pos; /* Location of the msi capability */ 27 __u8 pos; /* Location of the msi capability */
28 __u32 maskbits_mask; /* mask bits mask */
29 __u16 entry_nr; /* specific enabled entry */ 28 __u16 entry_nr; /* specific enabled entry */
30 unsigned default_irq; /* default pre-assigned irq */ 29 unsigned default_irq; /* default pre-assigned irq */
31 }msi_attrib; 30 } msi_attrib;
32 31
32 u32 masked; /* mask bits */
33 unsigned int irq; 33 unsigned int irq;
34 struct list_head list; 34 struct list_head list;
35 35
36 void __iomem *mask_base; 36 union {
37 void __iomem *mask_base;
38 u8 mask_pos;
39 };
37 struct pci_dev *dev; 40 struct pci_dev *dev;
38 41
39 /* Last set MSI message */ 42 /* Last set MSI message */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3aa5d77c2cdb..5675b63a0631 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/notifier.h> 13#include <linux/notifier.h>
14#include <linux/device.h>
14 15
15#include <linux/mtd/compatmac.h> 16#include <linux/mtd/compatmac.h>
16#include <mtd/mtd-abi.h> 17#include <mtd/mtd-abi.h>
@@ -162,6 +163,20 @@ struct mtd_info {
162 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 163 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
163 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 164 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
164 165
166 /* Allow NOMMU mmap() to directly map the device (if not NULL)
167 * - return the address to which the offset maps
168 * - return -ENOSYS to indicate refusal to do the mapping
169 */
170 unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
171 unsigned long len,
172 unsigned long offset,
173 unsigned long flags);
174
175 /* Backing device capabilities for this device
176 * - provides mmap capabilities
177 */
178 struct backing_dev_info *backing_dev_info;
179
165 180
166 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 181 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
167 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); 182 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
@@ -223,6 +238,7 @@ struct mtd_info {
223 void *priv; 238 void *priv;
224 239
225 struct module *owner; 240 struct module *owner;
241 struct device dev;
226 int usecount; 242 int usecount;
227 243
228 /* If the driver is something smart, like UBI, it may need to maintain 244 /* If the driver is something smart, like UBI, it may need to maintain
@@ -233,6 +249,11 @@ struct mtd_info {
233 void (*put_device) (struct mtd_info *mtd); 249 void (*put_device) (struct mtd_info *mtd);
234}; 250};
235 251
252static inline struct mtd_info *dev_to_mtd(struct device *dev)
253{
254 return dev ? container_of(dev, struct mtd_info, dev) : NULL;
255}
256
236static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 257static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
237{ 258{
238 if (mtd->erasesize_shift) 259 if (mtd->erasesize_shift)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index db5b63da2a7e..7efb9be34662 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -43,8 +43,8 @@ extern void nand_wait_ready(struct mtd_info *mtd);
43 * is supported now. If you add a chip with bigger oobsize/page 43 * is supported now. If you add a chip with bigger oobsize/page
44 * adjust this accordingly. 44 * adjust this accordingly.
45 */ 45 */
46#define NAND_MAX_OOBSIZE 64 46#define NAND_MAX_OOBSIZE 128
47#define NAND_MAX_PAGESIZE 2048 47#define NAND_MAX_PAGESIZE 4096
48 48
49/* 49/*
50 * Constants for hardware specific CLE/ALE/NCE function 50 * Constants for hardware specific CLE/ALE/NCE function
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index a45dd831b3f8..7535a74083b9 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -76,4 +76,16 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
76 struct device_node *node, 76 struct device_node *node,
77 struct mtd_partition **pparts); 77 struct mtd_partition **pparts);
78 78
79#ifdef CONFIG_MTD_PARTITIONS
80static inline int mtd_has_partitions(void) { return 1; }
81#else
82static inline int mtd_has_partitions(void) { return 0; }
83#endif
84
85#ifdef CONFIG_MTD_CMDLINE_PARTS
86static inline int mtd_has_cmdlinepart(void) { return 1; }
87#else
88static inline int mtd_has_cmdlinepart(void) { return 0; }
89#endif
90
79#endif 91#endif
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index f69e66d151cc..30b06c893944 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,7 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern struct dentry_operations ncp_root_dentry_operations; 207extern const struct dentry_operations ncp_root_dentry_operations;
208int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
209int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
diff --git a/include/linux/ncp_no.h b/include/linux/ncp_no.h
index f56a696a7cc6..cddaa48fb182 100644
--- a/include/linux/ncp_no.h
+++ b/include/linux/ncp_no.h
@@ -2,18 +2,18 @@
2#define _NCP_NO 2#define _NCP_NO
3 3
4/* these define the attribute byte as seen by NCP */ 4/* these define the attribute byte as seen by NCP */
5#define aRONLY (__constant_cpu_to_le32(1)) 5#define aRONLY (__cpu_to_le32(1))
6#define aHIDDEN (__constant_cpu_to_le32(2)) 6#define aHIDDEN (__cpu_to_le32(2))
7#define aSYSTEM (__constant_cpu_to_le32(4)) 7#define aSYSTEM (__cpu_to_le32(4))
8#define aEXECUTE (__constant_cpu_to_le32(8)) 8#define aEXECUTE (__cpu_to_le32(8))
9#define aDIR (__constant_cpu_to_le32(0x10)) 9#define aDIR (__cpu_to_le32(0x10))
10#define aARCH (__constant_cpu_to_le32(0x20)) 10#define aARCH (__cpu_to_le32(0x20))
11#define aSHARED (__constant_cpu_to_le32(0x80)) 11#define aSHARED (__cpu_to_le32(0x80))
12#define aDONTSUBALLOCATE (__constant_cpu_to_le32(1L<<11)) 12#define aDONTSUBALLOCATE (__cpu_to_le32(1L<<11))
13#define aTRANSACTIONAL (__constant_cpu_to_le32(1L<<12)) 13#define aTRANSACTIONAL (__cpu_to_le32(1L<<12))
14#define aPURGE (__constant_cpu_to_le32(1L<<16)) 14#define aPURGE (__cpu_to_le32(1L<<16))
15#define aRENAMEINHIBIT (__constant_cpu_to_le32(1L<<17)) 15#define aRENAMEINHIBIT (__cpu_to_le32(1L<<17))
16#define aDELETEINHIBIT (__constant_cpu_to_le32(1L<<18)) 16#define aDELETEINHIBIT (__cpu_to_le32(1L<<18))
17#define aDONTCOMPRESS (__constant_cpu_to_le32(1L<<27)) 17#define aDONTCOMPRESS (__cpu_to_le32(1L<<27))
18 18
19#endif /* _NCP_NO */ 19#endif /* _NCP_NO */
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index 8730d5dae1bc..12c9de138451 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -31,6 +31,7 @@ enum
31 * Neighbor Cache Entry Flags 31 * Neighbor Cache Entry Flags
32 */ 32 */
33 33
34#define NTF_USE 0x01
34#define NTF_PROXY 0x08 /* == ATF_PUBL */ 35#define NTF_PROXY 0x08 /* == ATF_PUBL */
35#define NTF_ROUTER 0x80 36#define NTF_ROUTER 0x80
36 37
diff --git a/include/linux/net.h b/include/linux/net.h
index 4515efae4c39..4fc2ffd527f9 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -129,11 +129,15 @@ struct socket {
129 socket_state state; 129 socket_state state;
130 short type; 130 short type;
131 unsigned long flags; 131 unsigned long flags;
132 const struct proto_ops *ops; 132 /*
133 * Please keep fasync_list & wait fields in the same cache line
134 */
133 struct fasync_struct *fasync_list; 135 struct fasync_struct *fasync_list;
136 wait_queue_head_t wait;
137
134 struct file *file; 138 struct file *file;
135 struct sock *sk; 139 struct sock *sk;
136 wait_queue_head_t wait; 140 const struct proto_ops *ops;
137}; 141};
138 142
139struct vm_area_struct; 143struct vm_area_struct;
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
new file mode 100644
index 000000000000..0217fb81a630
--- /dev/null
+++ b/include/linux/net_dropmon.h
@@ -0,0 +1,56 @@
1#ifndef __NET_DROPMON_H
2#define __NET_DROPMON_H
3
4#include <linux/netlink.h>
5
6struct net_dm_drop_point {
7 __u8 pc[8];
8 __u32 count;
9};
10
11#define NET_DM_CFG_VERSION 0
12#define NET_DM_CFG_ALERT_COUNT 1
13#define NET_DM_CFG_ALERT_DELAY 2
14#define NET_DM_CFG_MAX 3
15
16struct net_dm_config_entry {
17 __u32 type;
18 __u64 data __attribute__((aligned(8)));
19};
20
21struct net_dm_config_msg {
22 __u32 entries;
23 struct net_dm_config_entry options[0];
24};
25
26struct net_dm_alert_msg {
27 __u32 entries;
28 struct net_dm_drop_point points[0];
29};
30
31struct net_dm_user_msg {
32 union {
33 struct net_dm_config_msg user;
34 struct net_dm_alert_msg alert;
35 } u;
36};
37
38
39/* These are the netlink message types for this protocol */
40
41enum {
42 NET_DM_CMD_UNSPEC = 0,
43 NET_DM_CMD_ALERT,
44 NET_DM_CMD_CONFIG,
45 NET_DM_CMD_START,
46 NET_DM_CMD_STOP,
47 _NET_DM_CMD_MAX,
48};
49
50#define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1)
51
52/*
53 * Our group identifiers
54 */
55#define NET_DM_GRP_ALERT 1
56#endif
diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h
new file mode 100644
index 000000000000..a3b8546354ac
--- /dev/null
+++ b/include/linux/net_tstamp.h
@@ -0,0 +1,104 @@
1/*
2 * Userspace API for hardware time stamping of network packets
3 *
4 * Copyright (C) 2008,2009 Intel Corporation
5 * Author: Patrick Ohly <patrick.ohly@intel.com>
6 *
7 */
8
9#ifndef _NET_TIMESTAMPING_H
10#define _NET_TIMESTAMPING_H
11
12#include <linux/socket.h> /* for SO_TIMESTAMPING */
13
14/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
15enum {
16 SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
17 SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
18 SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
19 SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
20 SOF_TIMESTAMPING_SOFTWARE = (1<<4),
21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
23 SOF_TIMESTAMPING_MASK =
24 (SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
25 SOF_TIMESTAMPING_RAW_HARDWARE
26};
27
28/**
29 * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
30 *
31 * @flags: no flags defined right now, must be zero
32 * @tx_type: one of HWTSTAMP_TX_*
33 * @rx_type: one of one of HWTSTAMP_FILTER_*
34 *
35 * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
36 * this structure. dev_ifsioc() in the kernel takes care of the
37 * translation between 32 bit userspace and 64 bit kernel. The
38 * structure is intentionally chosen so that it has the same layout on
39 * 32 and 64 bit systems, don't break this!
40 */
41struct hwtstamp_config {
42 int flags;
43 int tx_type;
44 int rx_filter;
45};
46
47/* possible values for hwtstamp_config->tx_type */
48enum {
49 /*
50 * No outgoing packet will need hardware time stamping;
51 * should a packet arrive which asks for it, no hardware
52 * time stamping will be done.
53 */
54 HWTSTAMP_TX_OFF,
55
56 /*
57 * Enables hardware time stamping for outgoing packets;
58 * the sender of the packet decides which are to be
59 * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
60 * before sending the packet.
61 */
62 HWTSTAMP_TX_ON,
63};
64
65/* possible values for hwtstamp_config->rx_filter */
66enum {
67 /* time stamp no incoming packet at all */
68 HWTSTAMP_FILTER_NONE,
69
70 /* time stamp any incoming packet */
71 HWTSTAMP_FILTER_ALL,
72
73 /* return value: time stamp all packets requested plus some others */
74 HWTSTAMP_FILTER_SOME,
75
76 /* PTP v1, UDP, any kind of event packet */
77 HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
78 /* PTP v1, UDP, Sync packet */
79 HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
80 /* PTP v1, UDP, Delay_req packet */
81 HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
82 /* PTP v2, UDP, any kind of event packet */
83 HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
84 /* PTP v2, UDP, Sync packet */
85 HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
86 /* PTP v2, UDP, Delay_req packet */
87 HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
88
89 /* 802.AS1, Ethernet, any kind of event packet */
90 HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
91 /* 802.AS1, Ethernet, Sync packet */
92 HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
93 /* 802.AS1, Ethernet, Delay_req packet */
94 HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
95
96 /* PTP v2/802.AS1, any layer, any kind of event packet */
97 HWTSTAMP_FILTER_PTP_V2_EVENT,
98 /* PTP v2/802.AS1, any layer, Sync packet */
99 HWTSTAMP_FILTER_PTP_V2_SYNC,
100 /* PTP v2/802.AS1, any layer, Delay_req packet */
101 HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
102};
103
104#endif /* _NET_TIMESTAMPING_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 659366734f3f..2e7783f4a755 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -32,6 +32,7 @@
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/mm.h>
35#include <asm/atomic.h> 36#include <asm/atomic.h>
36#include <asm/cache.h> 37#include <asm/cache.h>
37#include <asm/byteorder.h> 38#include <asm/byteorder.h>
@@ -96,7 +97,7 @@ struct wireless_dev;
96 * Compute the worst case header length according to the protocols 97 * Compute the worst case header length according to the protocols
97 * used. 98 * used.
98 */ 99 */
99 100
100#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 101#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
101# if defined(CONFIG_MAC80211_MESH) 102# if defined(CONFIG_MAC80211_MESH)
102# define LL_MAX_HEADER 128 103# define LL_MAX_HEADER 128
@@ -124,7 +125,7 @@ struct wireless_dev;
124 * Network device statistics. Akin to the 2.0 ether stats but 125 * Network device statistics. Akin to the 2.0 ether stats but
125 * with byte counters. 126 * with byte counters.
126 */ 127 */
127 128
128struct net_device_stats 129struct net_device_stats
129{ 130{
130 unsigned long rx_packets; /* total packets received */ 131 unsigned long rx_packets; /* total packets received */
@@ -285,7 +286,7 @@ enum netdev_state_t
285 286
286/* 287/*
287 * This structure holds at boot time configured netdevice settings. They 288 * This structure holds at boot time configured netdevice settings. They
288 * are then used in the device probing. 289 * are then used in the device probing.
289 */ 290 */
290struct netdev_boot_setup { 291struct netdev_boot_setup {
291 char name[IFNAMSIZ]; 292 char name[IFNAMSIZ];
@@ -314,6 +315,9 @@ struct napi_struct {
314 spinlock_t poll_lock; 315 spinlock_t poll_lock;
315 int poll_owner; 316 int poll_owner;
316#endif 317#endif
318
319 unsigned int gro_count;
320
317 struct net_device *dev; 321 struct net_device *dev;
318 struct list_head dev_list; 322 struct list_head dev_list;
319 struct sk_buff *gro_list; 323 struct sk_buff *gro_list;
@@ -327,6 +331,14 @@ enum
327 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 331 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
328}; 332};
329 333
334enum {
335 GRO_MERGED,
336 GRO_MERGED_FREE,
337 GRO_HELD,
338 GRO_NORMAL,
339 GRO_DROP,
340};
341
330extern void __napi_schedule(struct napi_struct *n); 342extern void __napi_schedule(struct napi_struct *n);
331 343
332static inline int napi_disable_pending(struct napi_struct *n) 344static inline int napi_disable_pending(struct napi_struct *n)
@@ -582,6 +594,14 @@ struct net_device_ops {
582#define HAVE_NETDEV_POLL 594#define HAVE_NETDEV_POLL
583 void (*ndo_poll_controller)(struct net_device *dev); 595 void (*ndo_poll_controller)(struct net_device *dev);
584#endif 596#endif
597#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
598 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
599 u16 xid,
600 struct scatterlist *sgl,
601 unsigned int sgc);
602 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
603 u16 xid);
604#endif
585}; 605};
586 606
587/* 607/*
@@ -650,14 +670,17 @@ struct net_device
650#define NETIF_F_GRO 16384 /* Generic receive offload */ 670#define NETIF_F_GRO 16384 /* Generic receive offload */
651#define NETIF_F_LRO 32768 /* large receive offload */ 671#define NETIF_F_LRO 32768 /* large receive offload */
652 672
673#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
674
653 /* Segmentation offload features */ 675 /* Segmentation offload features */
654#define NETIF_F_GSO_SHIFT 16 676#define NETIF_F_GSO_SHIFT 16
655#define NETIF_F_GSO_MASK 0xffff0000 677#define NETIF_F_GSO_MASK 0x00ff0000
656#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) 678#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
657#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) 679#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
658#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) 680#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
659#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) 681#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
660#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) 682#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
683#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
661 684
662 /* List of features with software fallbacks. */ 685 /* List of features with software fallbacks. */
663#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) 686#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
@@ -740,7 +763,7 @@ struct net_device
740 void *dsa_ptr; /* dsa specific data */ 763 void *dsa_ptr; /* dsa specific data */
741#endif 764#endif
742 void *atalk_ptr; /* AppleTalk link */ 765 void *atalk_ptr; /* AppleTalk link */
743 void *ip_ptr; /* IPv4 specific data */ 766 void *ip_ptr; /* IPv4 specific data */
744 void *dn_ptr; /* DECnet specific data */ 767 void *dn_ptr; /* DECnet specific data */
745 void *ip6_ptr; /* IPv6 specific data */ 768 void *ip6_ptr; /* IPv6 specific data */
746 void *ec_ptr; /* Econet specific data */ 769 void *ec_ptr; /* Econet specific data */
@@ -753,7 +776,7 @@ struct net_device
753 */ 776 */
754 unsigned long last_rx; /* Time of last Rx */ 777 unsigned long last_rx; /* Time of last Rx */
755 /* Interface address info used in eth_type_trans() */ 778 /* Interface address info used in eth_type_trans() */
756 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 779 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
757 because most packets are unicast) */ 780 because most packets are unicast) */
758 781
759 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 782 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
@@ -840,6 +863,11 @@ struct net_device
840 struct dcbnl_rtnl_ops *dcbnl_ops; 863 struct dcbnl_rtnl_ops *dcbnl_ops;
841#endif 864#endif
842 865
866#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
867 /* max exchange id for FCoE LRO by ddp */
868 unsigned int fcoe_ddp_xid;
869#endif
870
843#ifdef CONFIG_COMPAT_NET_DEV_OPS 871#ifdef CONFIG_COMPAT_NET_DEV_OPS
844 struct { 872 struct {
845 int (*init)(struct net_device *dev); 873 int (*init)(struct net_device *dev);
@@ -984,6 +1012,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
984void netif_napi_del(struct napi_struct *napi); 1012void netif_napi_del(struct napi_struct *napi);
985 1013
986struct napi_gro_cb { 1014struct napi_gro_cb {
1015 /* This indicates where we are processing relative to skb->data. */
1016 int data_offset;
1017
987 /* This is non-zero if the packet may be of the same flow. */ 1018 /* This is non-zero if the packet may be of the same flow. */
988 int same_flow; 1019 int same_flow;
989 1020
@@ -1088,6 +1119,36 @@ extern int dev_restart(struct net_device *dev);
1088#ifdef CONFIG_NETPOLL_TRAP 1119#ifdef CONFIG_NETPOLL_TRAP
1089extern int netpoll_trap(void); 1120extern int netpoll_trap(void);
1090#endif 1121#endif
1122extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1123extern int skb_gro_receive(struct sk_buff **head,
1124 struct sk_buff *skb);
1125
1126static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1127{
1128 return NAPI_GRO_CB(skb)->data_offset;
1129}
1130
1131static inline unsigned int skb_gro_len(const struct sk_buff *skb)
1132{
1133 return skb->len - NAPI_GRO_CB(skb)->data_offset;
1134}
1135
1136static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1137{
1138 NAPI_GRO_CB(skb)->data_offset += len;
1139}
1140
1141static inline void skb_gro_reset_offset(struct sk_buff *skb)
1142{
1143 NAPI_GRO_CB(skb)->data_offset = 0;
1144}
1145
1146static inline void *skb_gro_mac_header(struct sk_buff *skb)
1147{
1148 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) :
1149 page_address(skb_shinfo(skb)->frags[0].page) +
1150 skb_shinfo(skb)->frags[0].page_offset;
1151}
1091 1152
1092static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1153static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1093 unsigned short type, 1154 unsigned short type,
@@ -1376,12 +1437,15 @@ extern int netif_receive_skb(struct sk_buff *skb);
1376extern void napi_gro_flush(struct napi_struct *napi); 1437extern void napi_gro_flush(struct napi_struct *napi);
1377extern int dev_gro_receive(struct napi_struct *napi, 1438extern int dev_gro_receive(struct napi_struct *napi,
1378 struct sk_buff *skb); 1439 struct sk_buff *skb);
1440extern int napi_skb_finish(int ret, struct sk_buff *skb);
1379extern int napi_gro_receive(struct napi_struct *napi, 1441extern int napi_gro_receive(struct napi_struct *napi,
1380 struct sk_buff *skb); 1442 struct sk_buff *skb);
1381extern void napi_reuse_skb(struct napi_struct *napi, 1443extern void napi_reuse_skb(struct napi_struct *napi,
1382 struct sk_buff *skb); 1444 struct sk_buff *skb);
1383extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1445extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1384 struct napi_gro_fraginfo *info); 1446 struct napi_gro_fraginfo *info);
1447extern int napi_frags_finish(struct napi_struct *napi,
1448 struct sk_buff *skb, int ret);
1385extern int napi_gro_frags(struct napi_struct *napi, 1449extern int napi_gro_frags(struct napi_struct *napi,
1386 struct napi_gro_fraginfo *info); 1450 struct napi_gro_fraginfo *info);
1387extern void netif_nit_deliver(struct sk_buff *skb); 1451extern void netif_nit_deliver(struct sk_buff *skb);
@@ -1575,56 +1639,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1575 return (1 << debug_value) - 1; 1639 return (1 << debug_value) - 1;
1576} 1640}
1577 1641
1578/* Test if receive needs to be scheduled but only if up */
1579static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1580{
1581 return napi_schedule_prep(napi);
1582}
1583
1584/* Add interface to tail of rx poll list. This assumes that _prep has
1585 * already been called and returned 1.
1586 */
1587static inline void __netif_rx_schedule(struct napi_struct *napi)
1588{
1589 __napi_schedule(napi);
1590}
1591
1592/* Try to reschedule poll. Called by irq handler. */
1593
1594static inline void netif_rx_schedule(struct napi_struct *napi)
1595{
1596 if (netif_rx_schedule_prep(napi))
1597 __netif_rx_schedule(napi);
1598}
1599
1600/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1601static inline int netif_rx_reschedule(struct napi_struct *napi)
1602{
1603 if (napi_schedule_prep(napi)) {
1604 __netif_rx_schedule(napi);
1605 return 1;
1606 }
1607 return 0;
1608}
1609
1610/* same as netif_rx_complete, except that local_irq_save(flags)
1611 * has already been issued
1612 */
1613static inline void __netif_rx_complete(struct napi_struct *napi)
1614{
1615 __napi_complete(napi);
1616}
1617
1618/* Remove interface from poll list: it must be in the poll list
1619 * on current cpu. This primitive is called by dev->poll(), when
1620 * it completes the work. The device cannot be out of poll list at this
1621 * moment, it is BUG().
1622 */
1623static inline void netif_rx_complete(struct napi_struct *napi)
1624{
1625 napi_complete(napi);
1626}
1627
1628static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1642static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
1629{ 1643{
1630 spin_lock(&txq->_xmit_lock); 1644 spin_lock(&txq->_xmit_lock);
@@ -1875,7 +1889,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1875 1889
1876 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1890 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1877 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1891 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1878 skb->protocol == __constant_htons(ETH_P_ARP)) 1892 skb->protocol == __cpu_to_be16(ETH_P_ARP))
1879 return 0; 1893 return 0;
1880 1894
1881 if (master->priv_flags & IFF_MASTER_ALB) { 1895 if (master->priv_flags & IFF_MASTER_ALB) {
@@ -1884,7 +1898,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1884 return 0; 1898 return 0;
1885 } 1899 }
1886 if (master->priv_flags & IFF_MASTER_8023AD && 1900 if (master->priv_flags & IFF_MASTER_8023AD &&
1887 skb->protocol == __constant_htons(ETH_P_SLOW)) 1901 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
1888 return 0; 1902 return 0;
1889 1903
1890 return 1; 1904 return 1;
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 5a8af875bce2..af9d2fb97212 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -7,16 +7,21 @@ header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h 7header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h 8header-y += xt_CONNSECMARK.h
9header-y += xt_DSCP.h 9header-y += xt_DSCP.h
10header-y += xt_LED.h
10header-y += xt_MARK.h 11header-y += xt_MARK.h
11header-y += xt_NFLOG.h 12header-y += xt_NFLOG.h
12header-y += xt_NFQUEUE.h 13header-y += xt_NFQUEUE.h
13header-y += xt_RATEEST.h 14header-y += xt_RATEEST.h
14header-y += xt_SECMARK.h 15header-y += xt_SECMARK.h
15header-y += xt_TCPMSS.h 16header-y += xt_TCPMSS.h
17header-y += xt_TCPOPTSTRIP.h
18header-y += xt_TPROXY.h
16header-y += xt_comment.h 19header-y += xt_comment.h
17header-y += xt_connbytes.h 20header-y += xt_connbytes.h
21header-y += xt_connlimit.h
18header-y += xt_connmark.h 22header-y += xt_connmark.h
19header-y += xt_conntrack.h 23header-y += xt_conntrack.h
24header-y += xt_cluster.h
20header-y += xt_dccp.h 25header-y += xt_dccp.h
21header-y += xt_dscp.h 26header-y += xt_dscp.h
22header-y += xt_esp.h 27header-y += xt_esp.h
@@ -30,6 +35,7 @@ header-y += xt_mark.h
30header-y += xt_multiport.h 35header-y += xt_multiport.h
31header-y += xt_owner.h 36header-y += xt_owner.h
32header-y += xt_pkttype.h 37header-y += xt_pkttype.h
38header-y += xt_quota.h
33header-y += xt_rateest.h 39header-y += xt_rateest.h
34header-y += xt_realm.h 40header-y += xt_realm.h
35header-y += xt_recent.h 41header-y += xt_recent.h
@@ -39,6 +45,8 @@ header-y += xt_statistic.h
39header-y += xt_string.h 45header-y += xt_string.h
40header-y += xt_tcpmss.h 46header-y += xt_tcpmss.h
41header-y += xt_tcpudp.h 47header-y += xt_tcpudp.h
48header-y += xt_time.h
49header-y += xt_u32.h
42 50
43unifdef-y += nf_conntrack_common.h 51unifdef-y += nf_conntrack_common.h
44unifdef-y += nf_conntrack_ftp.h 52unifdef-y += nf_conntrack_ftp.h
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index a049df4f2236..3066789b972a 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -2,6 +2,8 @@
2#define _NF_CONNTRACK_TCP_H 2#define _NF_CONNTRACK_TCP_H
3/* TCP tracking. */ 3/* TCP tracking. */
4 4
5#include <linux/types.h>
6
5/* This is exposed to userspace (ctnetlink) */ 7/* This is exposed to userspace (ctnetlink) */
6enum tcp_conntrack { 8enum tcp_conntrack {
7 TCP_CONNTRACK_NONE, 9 TCP_CONNTRACK_NONE,
@@ -34,8 +36,8 @@ enum tcp_conntrack {
34#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 36#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
35 37
36struct nf_ct_tcp_flags { 38struct nf_ct_tcp_flags {
37 u_int8_t flags; 39 __u8 flags;
38 u_int8_t mask; 40 __u8 mask;
39}; 41};
40 42
41#ifdef __KERNEL__ 43#ifdef __KERNEL__
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 7d8e0455ccac..c600083cbdf5 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -25,8 +25,8 @@ enum nfnetlink_groups {
25/* General form of address family dependent message. 25/* General form of address family dependent message.
26 */ 26 */
27struct nfgenmsg { 27struct nfgenmsg {
28 u_int8_t nfgen_family; /* AF_xxx */ 28 __u8 nfgen_family; /* AF_xxx */
29 u_int8_t version; /* nfnetlink version */ 29 __u8 version; /* nfnetlink version */
30 __be16 res_id; /* resource id */ 30 __be16 res_id; /* resource id */
31}; 31};
32 32
@@ -76,6 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
76extern int nfnetlink_has_listeners(unsigned int group); 76extern int nfnetlink_has_listeners(unsigned int group);
77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 78 int echo);
79extern void nfnetlink_set_err(u32 pid, u32 group, int error);
79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 80extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
80 81
81extern void nfnl_lock(void); 82extern void nfnl_lock(void);
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h
index e1451760c9cd..eda55cabceec 100644
--- a/include/linux/netfilter/nfnetlink_compat.h
+++ b/include/linux/netfilter/nfnetlink_compat.h
@@ -1,5 +1,8 @@
1#ifndef _NFNETLINK_COMPAT_H 1#ifndef _NFNETLINK_COMPAT_H
2#define _NFNETLINK_COMPAT_H 2#define _NFNETLINK_COMPAT_H
3
4#include <linux/types.h>
5
3#ifndef __KERNEL__ 6#ifndef __KERNEL__
4/* Old nfnetlink macros for userspace */ 7/* Old nfnetlink macros for userspace */
5 8
@@ -20,8 +23,8 @@
20 23
21struct nfattr 24struct nfattr
22{ 25{
23 u_int16_t nfa_len; 26 __u16 nfa_len;
24 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest 27 __u16 nfa_type; /* we use 15 bits for the type, and the highest
25 * bit to indicate whether the payload is nested */ 28 * bit to indicate whether the payload is nested */
26}; 29};
27 30
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index f661731f3cb1..d3bab7a2c9b7 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -17,14 +17,14 @@ enum nfulnl_msg_types {
17 17
18struct nfulnl_msg_packet_hdr { 18struct nfulnl_msg_packet_hdr {
19 __be16 hw_protocol; /* hw protocol (network order) */ 19 __be16 hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 __u8 hook; /* netfilter hook */
21 u_int8_t _pad; 21 __u8 _pad;
22}; 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 __be16 hw_addrlen; 25 __be16 hw_addrlen;
26 u_int16_t _pad; 26 __u16 _pad;
27 u_int8_t hw_addr[8]; 27 __u8 hw_addr[8];
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
@@ -35,12 +35,12 @@ struct nfulnl_msg_packet_timestamp {
35enum nfulnl_attr_type { 35enum nfulnl_attr_type {
36 NFULA_UNSPEC, 36 NFULA_UNSPEC,
37 NFULA_PACKET_HDR, 37 NFULA_PACKET_HDR,
38 NFULA_MARK, /* u_int32_t nfmark */ 38 NFULA_MARK, /* __u32 nfmark */
39 NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ 39 NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
40 NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */ 40 NFULA_IFINDEX_INDEV, /* __u32 ifindex */
41 NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ 41 NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */
42 NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ 42 NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
43 NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ 43 NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
44 NFULA_HWADDR, /* nfulnl_msg_packet_hw */ 44 NFULA_HWADDR, /* nfulnl_msg_packet_hw */
45 NFULA_PAYLOAD, /* opaque data payload */ 45 NFULA_PAYLOAD, /* opaque data payload */
46 NFULA_PREFIX, /* string prefix */ 46 NFULA_PREFIX, /* string prefix */
@@ -65,23 +65,23 @@ enum nfulnl_msg_config_cmds {
65}; 65};
66 66
67struct nfulnl_msg_config_cmd { 67struct nfulnl_msg_config_cmd {
68 u_int8_t command; /* nfulnl_msg_config_cmds */ 68 __u8 command; /* nfulnl_msg_config_cmds */
69} __attribute__ ((packed)); 69} __attribute__ ((packed));
70 70
71struct nfulnl_msg_config_mode { 71struct nfulnl_msg_config_mode {
72 __be32 copy_range; 72 __be32 copy_range;
73 u_int8_t copy_mode; 73 __u8 copy_mode;
74 u_int8_t _pad; 74 __u8 _pad;
75} __attribute__ ((packed)); 75} __attribute__ ((packed));
76 76
77enum nfulnl_attr_config { 77enum nfulnl_attr_config {
78 NFULA_CFG_UNSPEC, 78 NFULA_CFG_UNSPEC,
79 NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ 79 NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */
80 NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ 80 NFULA_CFG_MODE, /* nfulnl_msg_config_mode */
81 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */ 81 NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */
82 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */ 82 NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */
83 NFULA_CFG_QTHRESH, /* u_int32_t */ 83 NFULA_CFG_QTHRESH, /* __u32 */
84 NFULA_CFG_FLAGS, /* u_int16_t */ 84 NFULA_CFG_FLAGS, /* __u16 */
85 __NFULA_CFG_MAX 85 __NFULA_CFG_MAX
86}; 86};
87#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) 87#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 83e789633e35..2455fe5f4e01 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -15,13 +15,13 @@ enum nfqnl_msg_types {
15struct nfqnl_msg_packet_hdr { 15struct nfqnl_msg_packet_hdr {
16 __be32 packet_id; /* unique ID of packet in queue */ 16 __be32 packet_id; /* unique ID of packet in queue */
17 __be16 hw_protocol; /* hw protocol (network order) */ 17 __be16 hw_protocol; /* hw protocol (network order) */
18 u_int8_t hook; /* netfilter hook */ 18 __u8 hook; /* netfilter hook */
19} __attribute__ ((packed)); 19} __attribute__ ((packed));
20 20
21struct nfqnl_msg_packet_hw { 21struct nfqnl_msg_packet_hw {
22 __be16 hw_addrlen; 22 __be16 hw_addrlen;
23 u_int16_t _pad; 23 __u16 _pad;
24 u_int8_t hw_addr[8]; 24 __u8 hw_addr[8];
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
@@ -33,12 +33,12 @@ enum nfqnl_attr_type {
33 NFQA_UNSPEC, 33 NFQA_UNSPEC,
34 NFQA_PACKET_HDR, 34 NFQA_PACKET_HDR,
35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ 35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */
36 NFQA_MARK, /* u_int32_t nfmark */ 36 NFQA_MARK, /* __u32 nfmark */
37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ 37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */
38 NFQA_IFINDEX_INDEV, /* u_int32_t ifindex */ 38 NFQA_IFINDEX_INDEV, /* __u32 ifindex */
39 NFQA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ 39 NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */
40 NFQA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ 40 NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
41 NFQA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ 41 NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */ 42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */
43 NFQA_PAYLOAD, /* opaque data payload */ 43 NFQA_PAYLOAD, /* opaque data payload */
44 44
@@ -61,8 +61,8 @@ enum nfqnl_msg_config_cmds {
61}; 61};
62 62
63struct nfqnl_msg_config_cmd { 63struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 __u8 command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 __u8 _pad;
66 __be16 pf; /* AF_xxx for PF_[UN]BIND */ 66 __be16 pf; /* AF_xxx for PF_[UN]BIND */
67}; 67};
68 68
@@ -74,7 +74,7 @@ enum nfqnl_config_mode {
74 74
75struct nfqnl_msg_config_params { 75struct nfqnl_msg_config_params {
76 __be32 copy_range; 76 __be32 copy_range;
77 u_int8_t copy_mode; /* enum nfqnl_config_mode */ 77 __u8 copy_mode; /* enum nfqnl_config_mode */
78} __attribute__ ((packed)); 78} __attribute__ ((packed));
79 79
80 80
@@ -82,7 +82,7 @@ enum nfqnl_attr_config {
82 NFQA_CFG_UNSPEC, 82 NFQA_CFG_UNSPEC,
83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ 83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ 84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
85 NFQA_CFG_QUEUE_MAXLEN, /* u_int32_t */ 85 NFQA_CFG_QUEUE_MAXLEN, /* __u32 */
86 __NFQA_CFG_MAX 86 __NFQA_CFG_MAX
87}; 87};
88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) 88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index c7ee8744d26b..7b1a652066c0 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,6 +1,8 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3 3
4#include <linux/types.h>
5
4#define XT_FUNCTION_MAXNAMELEN 30 6#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32 7#define XT_TABLE_MAXNAMELEN 32
6 8
@@ -8,22 +10,22 @@ struct xt_entry_match
8{ 10{
9 union { 11 union {
10 struct { 12 struct {
11 u_int16_t match_size; 13 __u16 match_size;
12 14
13 /* Used by userspace */ 15 /* Used by userspace */
14 char name[XT_FUNCTION_MAXNAMELEN-1]; 16 char name[XT_FUNCTION_MAXNAMELEN-1];
15 17
16 u_int8_t revision; 18 __u8 revision;
17 } user; 19 } user;
18 struct { 20 struct {
19 u_int16_t match_size; 21 __u16 match_size;
20 22
21 /* Used inside the kernel */ 23 /* Used inside the kernel */
22 struct xt_match *match; 24 struct xt_match *match;
23 } kernel; 25 } kernel;
24 26
25 /* Total length */ 27 /* Total length */
26 u_int16_t match_size; 28 __u16 match_size;
27 } u; 29 } u;
28 30
29 unsigned char data[0]; 31 unsigned char data[0];
@@ -33,22 +35,22 @@ struct xt_entry_target
33{ 35{
34 union { 36 union {
35 struct { 37 struct {
36 u_int16_t target_size; 38 __u16 target_size;
37 39
38 /* Used by userspace */ 40 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1]; 41 char name[XT_FUNCTION_MAXNAMELEN-1];
40 42
41 u_int8_t revision; 43 __u8 revision;
42 } user; 44 } user;
43 struct { 45 struct {
44 u_int16_t target_size; 46 __u16 target_size;
45 47
46 /* Used inside the kernel */ 48 /* Used inside the kernel */
47 struct xt_target *target; 49 struct xt_target *target;
48 } kernel; 50 } kernel;
49 51
50 /* Total length */ 52 /* Total length */
51 u_int16_t target_size; 53 __u16 target_size;
52 } u; 54 } u;
53 55
54 unsigned char data[0]; 56 unsigned char data[0];
@@ -74,7 +76,7 @@ struct xt_get_revision
74{ 76{
75 char name[XT_FUNCTION_MAXNAMELEN-1]; 77 char name[XT_FUNCTION_MAXNAMELEN-1];
76 78
77 u_int8_t revision; 79 __u8 revision;
78}; 80};
79 81
80/* CONTINUE verdict for targets */ 82/* CONTINUE verdict for targets */
@@ -90,10 +92,10 @@ struct xt_get_revision
90 */ 92 */
91struct _xt_align 93struct _xt_align
92{ 94{
93 u_int8_t u8; 95 __u8 u8;
94 u_int16_t u16; 96 __u16 u16;
95 u_int32_t u32; 97 __u32 u32;
96 u_int64_t u64; 98 __u64 u64;
97}; 99};
98 100
99#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ 101#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \
@@ -109,7 +111,7 @@ struct _xt_align
109 111
110struct xt_counters 112struct xt_counters
111{ 113{
112 u_int64_t pcnt, bcnt; /* Packet and byte counters */ 114 __u64 pcnt, bcnt; /* Packet and byte counters */
113}; 115};
114 116
115/* The argument to IPT_SO_ADD_COUNTERS. */ 117/* The argument to IPT_SO_ADD_COUNTERS. */
@@ -349,23 +351,22 @@ struct xt_table
349{ 351{
350 struct list_head list; 352 struct list_head list;
351 353
352 /* A unique name... */
353 const char name[XT_TABLE_MAXNAMELEN];
354
355 /* What hooks you will enter on */ 354 /* What hooks you will enter on */
356 unsigned int valid_hooks; 355 unsigned int valid_hooks;
357 356
358 /* Lock for the curtain */ 357 /* Lock for the curtain */
359 rwlock_t lock; 358 struct mutex lock;
360 359
361 /* Man behind the curtain... */ 360 /* Man behind the curtain... */
362 //struct ip6t_table_info *private; 361 struct xt_table_info *private;
363 void *private;
364 362
365 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 363 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
366 struct module *me; 364 struct module *me;
367 365
368 u_int8_t af; /* address/protocol family */ 366 u_int8_t af; /* address/protocol family */
367
368 /* A unique name... */
369 const char name[XT_TABLE_MAXNAMELEN];
369}; 370};
370 371
371#include <linux/netfilter_ipv4.h> 372#include <linux/netfilter_ipv4.h>
@@ -386,7 +387,7 @@ struct xt_table_info
386 387
387 /* ipt_entry tables: one per CPU */ 388 /* ipt_entry tables: one per CPU */
388 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ 389 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
389 char *entries[1]; 390 void *entries[1];
390}; 391};
391 392
392#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \ 393#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
@@ -433,6 +434,31 @@ extern void xt_proto_fini(struct net *net, u_int8_t af);
433 434
434extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 435extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
435extern void xt_free_table_info(struct xt_table_info *info); 436extern void xt_free_table_info(struct xt_table_info *info);
437extern void xt_table_entry_swap_rcu(struct xt_table_info *old,
438 struct xt_table_info *new);
439
440/*
441 * This helper is performance critical and must be inlined
442 */
443static inline unsigned long ifname_compare_aligned(const char *_a,
444 const char *_b,
445 const char *_mask)
446{
447 const unsigned long *a = (const unsigned long *)_a;
448 const unsigned long *b = (const unsigned long *)_b;
449 const unsigned long *mask = (const unsigned long *)_mask;
450 unsigned long ret;
451
452 ret = (a[0] ^ b[0]) & mask[0];
453 if (IFNAMSIZ > sizeof(unsigned long))
454 ret |= (a[1] ^ b[1]) & mask[1];
455 if (IFNAMSIZ > 2 * sizeof(unsigned long))
456 ret |= (a[2] ^ b[2]) & mask[2];
457 if (IFNAMSIZ > 3 * sizeof(unsigned long))
458 ret |= (a[3] ^ b[3]) & mask[3];
459 BUILD_BUG_ON(IFNAMSIZ > 4 * sizeof(unsigned long));
460 return ret;
461}
436 462
437#ifdef CONFIG_COMPAT 463#ifdef CONFIG_COMPAT
438#include <net/compat.h> 464#include <net/compat.h>
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
index 58111355255d..a813bf14dd63 100644
--- a/include/linux/netfilter/xt_CLASSIFY.h
+++ b/include/linux/netfilter/xt_CLASSIFY.h
@@ -1,8 +1,10 @@
1#ifndef _XT_CLASSIFY_H 1#ifndef _XT_CLASSIFY_H
2#define _XT_CLASSIFY_H 2#define _XT_CLASSIFY_H
3 3
4#include <linux/types.h>
5
4struct xt_classify_target_info { 6struct xt_classify_target_info {
5 u_int32_t priority; 7 __u32 priority;
6}; 8};
7 9
8#endif /*_XT_CLASSIFY_H */ 10#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 4e58ba43c289..7635c8ffdadb 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -1,6 +1,8 @@
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>
5
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com> 7 * by Henrik Nordstrom <hno@marasystems.com>
6 * 8 *
@@ -19,12 +21,12 @@ enum {
19struct xt_connmark_target_info { 21struct xt_connmark_target_info {
20 unsigned long mark; 22 unsigned long mark;
21 unsigned long mask; 23 unsigned long mask;
22 u_int8_t mode; 24 __u8 mode;
23}; 25};
24 26
25struct xt_connmark_tginfo1 { 27struct xt_connmark_tginfo1 {
26 u_int32_t ctmark, ctmask, nfmask; 28 __u32 ctmark, ctmask, nfmask;
27 u_int8_t mode; 29 __u8 mode;
28}; 30};
29 31
30#endif /*_XT_CONNMARK_H_target*/ 32#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/linux/netfilter/xt_CONNSECMARK.h
index c6bd75469ba2..b973ff80fa1e 100644
--- a/include/linux/netfilter/xt_CONNSECMARK.h
+++ b/include/linux/netfilter/xt_CONNSECMARK.h
@@ -1,13 +1,15 @@
1#ifndef _XT_CONNSECMARK_H_target 1#ifndef _XT_CONNSECMARK_H_target
2#define _XT_CONNSECMARK_H_target 2#define _XT_CONNSECMARK_H_target
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 CONNSECMARK_SAVE = 1, 7 CONNSECMARK_SAVE = 1,
6 CONNSECMARK_RESTORE, 8 CONNSECMARK_RESTORE,
7}; 9};
8 10
9struct xt_connsecmark_target_info { 11struct xt_connsecmark_target_info {
10 u_int8_t mode; 12 __u8 mode;
11}; 13};
12 14
13#endif /*_XT_CONNSECMARK_H_target */ 15#endif /*_XT_CONNSECMARK_H_target */
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
index 14da1968e2c6..648e0b3bed29 100644
--- a/include/linux/netfilter/xt_DSCP.h
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -11,15 +11,16 @@
11#ifndef _XT_DSCP_TARGET_H 11#ifndef _XT_DSCP_TARGET_H
12#define _XT_DSCP_TARGET_H 12#define _XT_DSCP_TARGET_H
13#include <linux/netfilter/xt_dscp.h> 13#include <linux/netfilter/xt_dscp.h>
14#include <linux/types.h>
14 15
15/* target info */ 16/* target info */
16struct xt_DSCP_info { 17struct xt_DSCP_info {
17 u_int8_t dscp; 18 __u8 dscp;
18}; 19};
19 20
20struct xt_tos_target_info { 21struct xt_tos_target_info {
21 u_int8_t tos_value; 22 __u8 tos_value;
22 u_int8_t tos_mask; 23 __u8 tos_mask;
23}; 24};
24 25
25#endif /* _XT_DSCP_TARGET_H */ 26#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_LED.h b/include/linux/netfilter/xt_LED.h
new file mode 100644
index 000000000000..4c91a0d770d0
--- /dev/null
+++ b/include/linux/netfilter/xt_LED.h
@@ -0,0 +1,13 @@
1#ifndef _XT_LED_H
2#define _XT_LED_H
3
4struct xt_led_info {
5 char id[27]; /* Unique ID for this trigger in the LED class */
6 __u8 always_blink; /* Blink even if the LED is already on */
7 __u32 delay; /* Delay until LED is switched off after trigger */
8
9 /* Kernel data used in the module */
10 void *internal_data __attribute__((aligned(8)));
11};
12
13#endif /* _XT_LED_H */
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index 778b278fd9f2..028304bcc0b1 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -1,6 +1,8 @@
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>
5
4/* Version 0 */ 6/* Version 0 */
5struct xt_mark_target_info { 7struct xt_mark_target_info {
6 unsigned long mark; 8 unsigned long mark;
@@ -15,11 +17,11 @@ enum {
15 17
16struct xt_mark_target_info_v1 { 18struct xt_mark_target_info_v1 {
17 unsigned long mark; 19 unsigned long mark;
18 u_int8_t mode; 20 __u8 mode;
19}; 21};
20 22
21struct xt_mark_tginfo2 { 23struct xt_mark_tginfo2 {
22 u_int32_t mark, mask; 24 __u32 mark, mask;
23}; 25};
24 26
25#endif /*_XT_MARK_H_target */ 27#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h
index 4b36aeb46a10..87b58311ce6b 100644
--- a/include/linux/netfilter/xt_NFLOG.h
+++ b/include/linux/netfilter/xt_NFLOG.h
@@ -1,17 +1,19 @@
1#ifndef _XT_NFLOG_TARGET 1#ifndef _XT_NFLOG_TARGET
2#define _XT_NFLOG_TARGET 2#define _XT_NFLOG_TARGET
3 3
4#include <linux/types.h>
5
4#define XT_NFLOG_DEFAULT_GROUP 0x1 6#define XT_NFLOG_DEFAULT_GROUP 0x1
5#define XT_NFLOG_DEFAULT_THRESHOLD 0 7#define XT_NFLOG_DEFAULT_THRESHOLD 0
6 8
7#define XT_NFLOG_MASK 0x0 9#define XT_NFLOG_MASK 0x0
8 10
9struct xt_nflog_info { 11struct xt_nflog_info {
10 u_int32_t len; 12 __u32 len;
11 u_int16_t group; 13 __u16 group;
12 u_int16_t threshold; 14 __u16 threshold;
13 u_int16_t flags; 15 __u16 flags;
14 u_int16_t pad; 16 __u16 pad;
15 char prefix[64]; 17 char prefix[64];
16}; 18};
17 19
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 9a9af79f74d2..982a89f78272 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -8,9 +8,11 @@
8#ifndef _XT_NFQ_TARGET_H 8#ifndef _XT_NFQ_TARGET_H
9#define _XT_NFQ_TARGET_H 9#define _XT_NFQ_TARGET_H
10 10
11#include <linux/types.h>
12
11/* target info */ 13/* target info */
12struct xt_NFQ_info { 14struct xt_NFQ_info {
13 u_int16_t queuenum; 15 __u16 queuenum;
14}; 16};
15 17
16#endif /* _XT_NFQ_TARGET_H */ 18#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h
index f79e3133cbea..6605e20ad8cf 100644
--- a/include/linux/netfilter/xt_RATEEST.h
+++ b/include/linux/netfilter/xt_RATEEST.h
@@ -1,10 +1,12 @@
1#ifndef _XT_RATEEST_TARGET_H 1#ifndef _XT_RATEEST_TARGET_H
2#define _XT_RATEEST_TARGET_H 2#define _XT_RATEEST_TARGET_H
3 3
4#include <linux/types.h>
5
4struct xt_rateest_target_info { 6struct xt_rateest_target_info {
5 char name[IFNAMSIZ]; 7 char name[IFNAMSIZ];
6 int8_t interval; 8 __s8 interval;
7 u_int8_t ewma_log; 9 __u8 ewma_log;
8 10
9 /* Used internally by the kernel */ 11 /* Used internally by the kernel */
10 struct xt_rateest *est __attribute__((aligned(8))); 12 struct xt_rateest *est __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/linux/netfilter/xt_SECMARK.h
index c53fbffa997d..6fcd3448b186 100644
--- a/include/linux/netfilter/xt_SECMARK.h
+++ b/include/linux/netfilter/xt_SECMARK.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SECMARK_H_target 1#ifndef _XT_SECMARK_H_target
2#define _XT_SECMARK_H_target 2#define _XT_SECMARK_H_target
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * This is intended for use by various security subsystems (but not 7 * This is intended for use by various security subsystems (but not
6 * at the same time). 8 * at the same time).
@@ -12,12 +14,12 @@
12#define SECMARK_SELCTX_MAX 256 14#define SECMARK_SELCTX_MAX 256
13 15
14struct xt_secmark_target_selinux_info { 16struct xt_secmark_target_selinux_info {
15 u_int32_t selsid; 17 __u32 selsid;
16 char selctx[SECMARK_SELCTX_MAX]; 18 char selctx[SECMARK_SELCTX_MAX];
17}; 19};
18 20
19struct xt_secmark_target_info { 21struct xt_secmark_target_info {
20 u_int8_t mode; 22 __u8 mode;
21 union { 23 union {
22 struct xt_secmark_target_selinux_info sel; 24 struct xt_secmark_target_selinux_info sel;
23 } u; 25 } u;
diff --git a/include/linux/netfilter/xt_TCPMSS.h b/include/linux/netfilter/xt_TCPMSS.h
index 53a292cd47f3..9a6960afc134 100644
--- a/include/linux/netfilter/xt_TCPMSS.h
+++ b/include/linux/netfilter/xt_TCPMSS.h
@@ -1,8 +1,10 @@
1#ifndef _XT_TCPMSS_H 1#ifndef _XT_TCPMSS_H
2#define _XT_TCPMSS_H 2#define _XT_TCPMSS_H
3 3
4#include <linux/types.h>
5
4struct xt_tcpmss_info { 6struct xt_tcpmss_info {
5 u_int16_t mss; 7 __u16 mss;
6}; 8};
7 9
8#define XT_TCPMSS_CLAMP_PMTU 0xffff 10#define XT_TCPMSS_CLAMP_PMTU 0xffff
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
new file mode 100644
index 000000000000..5e0a0d07b526
--- /dev/null
+++ b/include/linux/netfilter/xt_cluster.h
@@ -0,0 +1,15 @@
1#ifndef _XT_CLUSTER_MATCH_H
2#define _XT_CLUSTER_MATCH_H
3
4enum xt_cluster_flags {
5 XT_CLUSTER_F_INV = (1 << 0)
6};
7
8struct xt_cluster_match_info {
9 u_int32_t total_nodes;
10 u_int32_t node_mask;
11 u_int32_t hash_seed;
12 u_int32_t flags;
13};
14
15#endif /* _XT_CLUSTER_MATCH_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
index c022c989754d..52bd6153b996 100644
--- a/include/linux/netfilter/xt_connbytes.h
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -1,6 +1,8 @@
1#ifndef _XT_CONNBYTES_H 1#ifndef _XT_CONNBYTES_H
2#define _XT_CONNBYTES_H 2#define _XT_CONNBYTES_H
3 3
4#include <linux/types.h>
5
4enum xt_connbytes_what { 6enum xt_connbytes_what {
5 XT_CONNBYTES_PKTS, 7 XT_CONNBYTES_PKTS,
6 XT_CONNBYTES_BYTES, 8 XT_CONNBYTES_BYTES,
@@ -19,7 +21,7 @@ struct xt_connbytes_info
19 aligned_u64 from; /* count to be matched */ 21 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */ 22 aligned_u64 to; /* count to be matched */
21 } count; 23 } count;
22 u_int8_t what; /* ipt_connbytes_what */ 24 __u8 what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */ 25 __u8 direction; /* ipt_connbytes_direction */
24}; 26};
25#endif 27#endif
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 359ef86918dc..571e266d004c 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -1,6 +1,8 @@
1#ifndef _XT_CONNMARK_H 1#ifndef _XT_CONNMARK_H
2#define _XT_CONNMARK_H 2#define _XT_CONNMARK_H
3 3
4#include <linux/types.h>
5
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com> 7 * by Henrik Nordstrom <hno@marasystems.com>
6 * 8 *
@@ -12,12 +14,12 @@
12 14
13struct xt_connmark_info { 15struct xt_connmark_info {
14 unsigned long mark, mask; 16 unsigned long mark, mask;
15 u_int8_t invert; 17 __u8 invert;
16}; 18};
17 19
18struct xt_connmark_mtinfo1 { 20struct xt_connmark_mtinfo1 {
19 u_int32_t mark, mask; 21 __u32 mark, mask;
20 u_int8_t invert; 22 __u8 invert;
21}; 23};
22 24
23#endif /*_XT_CONNMARK_H*/ 25#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 8f5345275393..3430c7751948 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -63,9 +63,9 @@ struct xt_conntrack_info
63 unsigned long expires_min, expires_max; 63 unsigned long expires_min, expires_max;
64 64
65 /* Flags word */ 65 /* Flags word */
66 u_int8_t flags; 66 __u8 flags;
67 /* Inverse flags */ 67 /* Inverse flags */
68 u_int8_t invflags; 68 __u8 invflags;
69}; 69};
70 70
71struct xt_conntrack_mtinfo1 { 71struct xt_conntrack_mtinfo1 {
@@ -73,12 +73,12 @@ struct xt_conntrack_mtinfo1 {
73 union nf_inet_addr origdst_addr, origdst_mask; 73 union nf_inet_addr origdst_addr, origdst_mask;
74 union nf_inet_addr replsrc_addr, replsrc_mask; 74 union nf_inet_addr replsrc_addr, replsrc_mask;
75 union nf_inet_addr repldst_addr, repldst_mask; 75 union nf_inet_addr repldst_addr, repldst_mask;
76 u_int32_t expires_min, expires_max; 76 __u32 expires_min, expires_max;
77 u_int16_t l4proto; 77 __u16 l4proto;
78 __be16 origsrc_port, origdst_port; 78 __be16 origsrc_port, origdst_port;
79 __be16 replsrc_port, repldst_port; 79 __be16 replsrc_port, repldst_port;
80 u_int16_t match_flags, invert_flags; 80 __u16 match_flags, invert_flags;
81 u_int8_t state_mask, status_mask; 81 __u8 state_mask, status_mask;
82}; 82};
83 83
84#endif /*_XT_CONNTRACK_H*/ 84#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h
index e0221b9d32cb..a579e1b6f040 100644
--- a/include/linux/netfilter/xt_dccp.h
+++ b/include/linux/netfilter/xt_dccp.h
@@ -1,6 +1,8 @@
1#ifndef _XT_DCCP_H_ 1#ifndef _XT_DCCP_H_
2#define _XT_DCCP_H_ 2#define _XT_DCCP_H_
3 3
4#include <linux/types.h>
5
4#define XT_DCCP_SRC_PORTS 0x01 6#define XT_DCCP_SRC_PORTS 0x01
5#define XT_DCCP_DEST_PORTS 0x02 7#define XT_DCCP_DEST_PORTS 0x02
6#define XT_DCCP_TYPE 0x04 8#define XT_DCCP_TYPE 0x04
@@ -9,14 +11,14 @@
9#define XT_DCCP_VALID_FLAGS 0x0f 11#define XT_DCCP_VALID_FLAGS 0x0f
10 12
11struct xt_dccp_info { 13struct xt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */ 14 __u16 dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */ 15 __u16 spts[2]; /* Min, Max */
14 16
15 u_int16_t flags; 17 __u16 flags;
16 u_int16_t invflags; 18 __u16 invflags;
17 19
18 u_int16_t typemask; 20 __u16 typemask;
19 u_int8_t option; 21 __u8 option;
20}; 22};
21 23
22#endif /* _XT_DCCP_H_ */ 24#endif /* _XT_DCCP_H_ */
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
index f49bc1a648dc..15f8932ad5ce 100644
--- a/include/linux/netfilter/xt_dscp.h
+++ b/include/linux/netfilter/xt_dscp.h
@@ -10,20 +10,22 @@
10#ifndef _XT_DSCP_H 10#ifndef _XT_DSCP_H
11#define _XT_DSCP_H 11#define _XT_DSCP_H
12 12
13#include <linux/types.h>
14
13#define XT_DSCP_MASK 0xfc /* 11111100 */ 15#define XT_DSCP_MASK 0xfc /* 11111100 */
14#define XT_DSCP_SHIFT 2 16#define XT_DSCP_SHIFT 2
15#define XT_DSCP_MAX 0x3f /* 00111111 */ 17#define XT_DSCP_MAX 0x3f /* 00111111 */
16 18
17/* match info */ 19/* match info */
18struct xt_dscp_info { 20struct xt_dscp_info {
19 u_int8_t dscp; 21 __u8 dscp;
20 u_int8_t invert; 22 __u8 invert;
21}; 23};
22 24
23struct xt_tos_match_info { 25struct xt_tos_match_info {
24 u_int8_t tos_mask; 26 __u8 tos_mask;
25 u_int8_t tos_value; 27 __u8 tos_value;
26 u_int8_t invert; 28 __u8 invert;
27}; 29};
28 30
29#endif /* _XT_DSCP_H */ 31#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter/xt_esp.h b/include/linux/netfilter/xt_esp.h
index 9380fb1c27da..ef6fa4747d0a 100644
--- a/include/linux/netfilter/xt_esp.h
+++ b/include/linux/netfilter/xt_esp.h
@@ -1,10 +1,12 @@
1#ifndef _XT_ESP_H 1#ifndef _XT_ESP_H
2#define _XT_ESP_H 2#define _XT_ESP_H
3 3
4#include <linux/types.h>
5
4struct xt_esp 6struct xt_esp
5{ 7{
6 u_int32_t spis[2]; /* Security Parameter Index */ 8 __u32 spis[2]; /* Security Parameter Index */
7 u_int8_t invflags; /* Inverse flags */ 9 __u8 invflags; /* Inverse flags */
8}; 10};
9 11
10/* Values for "invflags" field in struct xt_esp. */ 12/* Values for "invflags" field in struct xt_esp. */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index 51b18d83b477..b1925b5925e9 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -1,6 +1,8 @@
1#ifndef _XT_HASHLIMIT_H 1#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H 2#define _XT_HASHLIMIT_H
3 3
4#include <linux/types.h>
5
4/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
5#define XT_HASHLIMIT_SCALE 10000 7#define XT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
@@ -18,15 +20,15 @@ enum {
18}; 20};
19 21
20struct hashlimit_cfg { 22struct hashlimit_cfg {
21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 23 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
22 u_int32_t avg; /* Average secs between packets * scale */ 24 __u32 avg; /* Average secs between packets * scale */
23 u_int32_t burst; /* Period multiplier for upper limit. */ 25 __u32 burst; /* Period multiplier for upper limit. */
24 26
25 /* user specified */ 27 /* user specified */
26 u_int32_t size; /* how many buckets */ 28 __u32 size; /* how many buckets */
27 u_int32_t max; /* max number of entries */ 29 __u32 max; /* max number of entries */
28 u_int32_t gc_interval; /* gc interval */ 30 __u32 gc_interval; /* gc interval */
29 u_int32_t expire; /* when do entries expire? */ 31 __u32 expire; /* when do entries expire? */
30}; 32};
31 33
32struct xt_hashlimit_info { 34struct xt_hashlimit_info {
@@ -42,17 +44,17 @@ struct xt_hashlimit_info {
42}; 44};
43 45
44struct hashlimit_cfg1 { 46struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 47 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */ 48 __u32 avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */ 49 __u32 burst; /* Period multiplier for upper limit. */
48 50
49 /* user specified */ 51 /* user specified */
50 u_int32_t size; /* how many buckets */ 52 __u32 size; /* how many buckets */
51 u_int32_t max; /* max number of entries */ 53 __u32 max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */ 54 __u32 gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */ 55 __u32 expire; /* when do entries expire? */
54 56
55 u_int8_t srcmask, dstmask; 57 __u8 srcmask, dstmask;
56}; 58};
57 59
58struct xt_hashlimit_mtinfo1 { 60struct xt_hashlimit_mtinfo1 {
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h
index a4299c7d3680..c1f21a779a45 100644
--- a/include/linux/netfilter/xt_iprange.h
+++ b/include/linux/netfilter/xt_iprange.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H 1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H
2#define _LINUX_NETFILTER_XT_IPRANGE_H 1 2#define _LINUX_NETFILTER_XT_IPRANGE_H 1
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 IPRANGE_SRC = 1 << 0, /* match source IP address */ 7 IPRANGE_SRC = 1 << 0, /* match source IP address */
6 IPRANGE_DST = 1 << 1, /* match destination IP address */ 8 IPRANGE_DST = 1 << 1, /* match destination IP address */
@@ -11,7 +13,7 @@ enum {
11struct xt_iprange_mtinfo { 13struct xt_iprange_mtinfo {
12 union nf_inet_addr src_min, src_max; 14 union nf_inet_addr src_min, src_max;
13 union nf_inet_addr dst_min, dst_max; 15 union nf_inet_addr dst_min, dst_max;
14 u_int8_t flags; 16 __u8 flags;
15}; 17};
16 18
17#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ 19#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h
index 7c2b439f73fe..b82ed7c4b1e0 100644
--- a/include/linux/netfilter/xt_length.h
+++ b/include/linux/netfilter/xt_length.h
@@ -1,9 +1,11 @@
1#ifndef _XT_LENGTH_H 1#ifndef _XT_LENGTH_H
2#define _XT_LENGTH_H 2#define _XT_LENGTH_H
3 3
4#include <linux/types.h>
5
4struct xt_length_info { 6struct xt_length_info {
5 u_int16_t min, max; 7 __u16 min, max;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9#endif /*_XT_LENGTH_H*/ 11#endif /*_XT_LENGTH_H*/
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h
index b3ce65375ecb..bb47fc4d2ade 100644
--- a/include/linux/netfilter/xt_limit.h
+++ b/include/linux/netfilter/xt_limit.h
@@ -1,21 +1,24 @@
1#ifndef _XT_RATE_H 1#ifndef _XT_RATE_H
2#define _XT_RATE_H 2#define _XT_RATE_H
3 3
4#include <linux/types.h>
5
4/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
5#define XT_LIMIT_SCALE 10000 7#define XT_LIMIT_SCALE 10000
6 8
9struct xt_limit_priv;
10
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 11/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */ 12 seconds, or one every 59 hours. */
9struct xt_rateinfo { 13struct xt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */ 14 __u32 avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */ 15 __u32 burst; /* Period multiplier for upper limit. */
12 16
13 /* Used internally by the kernel */ 17 /* Used internally by the kernel */
14 unsigned long prev; 18 unsigned long prev; /* moved to xt_limit_priv */
15 u_int32_t credit; 19 __u32 credit; /* moved to xt_limit_priv */
16 u_int32_t credit_cap, cost; 20 __u32 credit_cap, cost;
17 21
18 /* Ugly, ugly fucker. */ 22 struct xt_limit_priv *master;
19 struct xt_rateinfo *master;
20}; 23};
21#endif /*_XT_RATE_H*/ 24#endif /*_XT_RATE_H*/
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index fae74bc3f34e..6fa460a3cc29 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -1,14 +1,16 @@
1#ifndef _XT_MARK_H 1#ifndef _XT_MARK_H
2#define _XT_MARK_H 2#define _XT_MARK_H
3 3
4#include <linux/types.h>
5
4struct xt_mark_info { 6struct xt_mark_info {
5 unsigned long mark, mask; 7 unsigned long mark, mask;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9struct xt_mark_mtinfo1 { 11struct xt_mark_mtinfo1 {
10 u_int32_t mark, mask; 12 __u32 mark, mask;
11 u_int8_t invert; 13 __u8 invert;
12}; 14};
13 15
14#endif /*_XT_MARK_H*/ 16#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_multiport.h b/include/linux/netfilter/xt_multiport.h
index d49ee4183710..185db499fcbc 100644
--- a/include/linux/netfilter/xt_multiport.h
+++ b/include/linux/netfilter/xt_multiport.h
@@ -1,6 +1,8 @@
1#ifndef _XT_MULTIPORT_H 1#ifndef _XT_MULTIPORT_H
2#define _XT_MULTIPORT_H 2#define _XT_MULTIPORT_H
3 3
4#include <linux/types.h>
5
4enum xt_multiport_flags 6enum xt_multiport_flags
5{ 7{
6 XT_MULTIPORT_SOURCE, 8 XT_MULTIPORT_SOURCE,
@@ -13,18 +15,18 @@ enum xt_multiport_flags
13/* Must fit inside union xt_matchinfo: 16 bytes */ 15/* Must fit inside union xt_matchinfo: 16 bytes */
14struct xt_multiport 16struct xt_multiport
15{ 17{
16 u_int8_t flags; /* Type of comparison */ 18 __u8 flags; /* Type of comparison */
17 u_int8_t count; /* Number of ports */ 19 __u8 count; /* Number of ports */
18 u_int16_t ports[XT_MULTI_PORTS]; /* Ports */ 20 __u16 ports[XT_MULTI_PORTS]; /* Ports */
19}; 21};
20 22
21struct xt_multiport_v1 23struct xt_multiport_v1
22{ 24{
23 u_int8_t flags; /* Type of comparison */ 25 __u8 flags; /* Type of comparison */
24 u_int8_t count; /* Number of ports */ 26 __u8 count; /* Number of ports */
25 u_int16_t ports[XT_MULTI_PORTS]; /* Ports */ 27 __u16 ports[XT_MULTI_PORTS]; /* Ports */
26 u_int8_t pflags[XT_MULTI_PORTS]; /* Port flags */ 28 __u8 pflags[XT_MULTI_PORTS]; /* Port flags */
27 u_int8_t invert; /* Invert flag */ 29 __u8 invert; /* Invert flag */
28}; 30};
29 31
30#endif /*_XT_MULTIPORT_H*/ 32#endif /*_XT_MULTIPORT_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
index c84e52cfe415..2081761714b5 100644
--- a/include/linux/netfilter/xt_owner.h
+++ b/include/linux/netfilter/xt_owner.h
@@ -1,6 +1,8 @@
1#ifndef _XT_OWNER_MATCH_H 1#ifndef _XT_OWNER_MATCH_H
2#define _XT_OWNER_MATCH_H 2#define _XT_OWNER_MATCH_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_OWNER_UID = 1 << 0, 7 XT_OWNER_UID = 1 << 0,
6 XT_OWNER_GID = 1 << 1, 8 XT_OWNER_GID = 1 << 1,
@@ -8,9 +10,9 @@ enum {
8}; 10};
9 11
10struct xt_owner_match_info { 12struct xt_owner_match_info {
11 u_int32_t uid_min, uid_max; 13 __u32 uid_min, uid_max;
12 u_int32_t gid_min, gid_max; 14 __u32 gid_min, gid_max;
13 u_int8_t match, invert; 15 __u8 match, invert;
14}; 16};
15 17
16#endif /* _XT_OWNER_MATCH_H */ 18#endif /* _XT_OWNER_MATCH_H */
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
index 25a7a1815b5b..8555e399886d 100644
--- a/include/linux/netfilter/xt_physdev.h
+++ b/include/linux/netfilter/xt_physdev.h
@@ -1,6 +1,8 @@
1#ifndef _XT_PHYSDEV_H 1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H 2#define _XT_PHYSDEV_H
3 3
4#include <linux/types.h>
5
4#ifdef __KERNEL__ 6#ifdef __KERNEL__
5#include <linux/if.h> 7#include <linux/if.h>
6#endif 8#endif
@@ -17,8 +19,8 @@ struct xt_physdev_info {
17 char in_mask[IFNAMSIZ]; 19 char in_mask[IFNAMSIZ];
18 char physoutdev[IFNAMSIZ]; 20 char physoutdev[IFNAMSIZ];
19 char out_mask[IFNAMSIZ]; 21 char out_mask[IFNAMSIZ];
20 u_int8_t invert; 22 __u8 invert;
21 u_int8_t bitmask; 23 __u8 bitmask;
22}; 24};
23 25
24#endif /*_XT_PHYSDEV_H*/ 26#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index 053d8cc65464..7bb64e7c853d 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _XT_POLICY_H 1#ifndef _XT_POLICY_H
2#define _XT_POLICY_H 2#define _XT_POLICY_H
3 3
4#include <linux/types.h>
5
4#define XT_POLICY_MAX_ELEM 4 6#define XT_POLICY_MAX_ELEM 4
5 7
6enum xt_policy_flags 8enum xt_policy_flags
@@ -19,7 +21,7 @@ enum xt_policy_modes
19 21
20struct xt_policy_spec 22struct xt_policy_spec
21{ 23{
22 u_int8_t saddr:1, 24 __u8 saddr:1,
23 daddr:1, 25 daddr:1,
24 proto:1, 26 proto:1,
25 mode:1, 27 mode:1,
@@ -55,9 +57,9 @@ struct xt_policy_elem
55#endif 57#endif
56 }; 58 };
57 __be32 spi; 59 __be32 spi;
58 u_int32_t reqid; 60 __u32 reqid;
59 u_int8_t proto; 61 __u8 proto;
60 u_int8_t mode; 62 __u8 mode;
61 63
62 struct xt_policy_spec match; 64 struct xt_policy_spec match;
63 struct xt_policy_spec invert; 65 struct xt_policy_spec invert;
@@ -66,8 +68,8 @@ struct xt_policy_elem
66struct xt_policy_info 68struct xt_policy_info
67{ 69{
68 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; 70 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM];
69 u_int16_t flags; 71 __u16 flags;
70 u_int16_t len; 72 __u16 len;
71}; 73};
72 74
73#endif /* _XT_POLICY_H */ 75#endif /* _XT_POLICY_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index 4c8368d781e5..8dc89dfc1361 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -6,13 +6,15 @@ enum xt_quota_flags {
6}; 6};
7#define XT_QUOTA_MASK 0x1 7#define XT_QUOTA_MASK 0x1
8 8
9struct xt_quota_priv;
10
9struct xt_quota_info { 11struct xt_quota_info {
10 u_int32_t flags; 12 u_int32_t flags;
11 u_int32_t pad; 13 u_int32_t pad;
12 14
13 /* Used internally by the kernel */ 15 /* Used internally by the kernel */
14 aligned_u64 quota; 16 aligned_u64 quota;
15 struct xt_quota_info *master; 17 struct xt_quota_priv *master;
16}; 18};
17 19
18#endif /* _XT_QUOTA_H */ 20#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h
index 2010cb74250f..d40a6196842a 100644
--- a/include/linux/netfilter/xt_rateest.h
+++ b/include/linux/netfilter/xt_rateest.h
@@ -1,6 +1,8 @@
1#ifndef _XT_RATEEST_MATCH_H 1#ifndef _XT_RATEEST_MATCH_H
2#define _XT_RATEEST_MATCH_H 2#define _XT_RATEEST_MATCH_H
3 3
4#include <linux/types.h>
5
4enum xt_rateest_match_flags { 6enum xt_rateest_match_flags {
5 XT_RATEEST_MATCH_INVERT = 1<<0, 7 XT_RATEEST_MATCH_INVERT = 1<<0,
6 XT_RATEEST_MATCH_ABS = 1<<1, 8 XT_RATEEST_MATCH_ABS = 1<<1,
@@ -20,12 +22,12 @@ enum xt_rateest_match_mode {
20struct xt_rateest_match_info { 22struct xt_rateest_match_info {
21 char name1[IFNAMSIZ]; 23 char name1[IFNAMSIZ];
22 char name2[IFNAMSIZ]; 24 char name2[IFNAMSIZ];
23 u_int16_t flags; 25 __u16 flags;
24 u_int16_t mode; 26 __u16 mode;
25 u_int32_t bps1; 27 __u32 bps1;
26 u_int32_t pps1; 28 __u32 pps1;
27 u_int32_t bps2; 29 __u32 bps2;
28 u_int32_t pps2; 30 __u32 pps2;
29 31
30 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
31 struct xt_rateest *est1 __attribute__((aligned(8))); 33 struct xt_rateest *est1 __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h
index 220e87245716..d4a82ee56a02 100644
--- a/include/linux/netfilter/xt_realm.h
+++ b/include/linux/netfilter/xt_realm.h
@@ -1,10 +1,12 @@
1#ifndef _XT_REALM_H 1#ifndef _XT_REALM_H
2#define _XT_REALM_H 2#define _XT_REALM_H
3 3
4#include <linux/types.h>
5
4struct xt_realm_info { 6struct xt_realm_info {
5 u_int32_t id; 7 __u32 id;
6 u_int32_t mask; 8 __u32 mask;
7 u_int8_t invert; 9 __u8 invert;
8}; 10};
9 11
10#endif /* _XT_REALM_H */ 12#endif /* _XT_REALM_H */
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index 5cfeb81c6794..d2c276609925 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_NETFILTER_XT_RECENT_H 1#ifndef _LINUX_NETFILTER_XT_RECENT_H
2#define _LINUX_NETFILTER_XT_RECENT_H 1 2#define _LINUX_NETFILTER_XT_RECENT_H 1
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_RECENT_CHECK = 1 << 0, 7 XT_RECENT_CHECK = 1 << 0,
6 XT_RECENT_SET = 1 << 1, 8 XT_RECENT_SET = 1 << 1,
@@ -15,12 +17,12 @@ enum {
15}; 17};
16 18
17struct xt_recent_mtinfo { 19struct xt_recent_mtinfo {
18 u_int32_t seconds; 20 __u32 seconds;
19 u_int32_t hit_count; 21 __u32 hit_count;
20 u_int8_t check_set; 22 __u8 check_set;
21 u_int8_t invert; 23 __u8 invert;
22 char name[XT_RECENT_NAME_LEN]; 24 char name[XT_RECENT_NAME_LEN];
23 u_int8_t side; 25 __u8 side;
24}; 26};
25 27
26#endif /* _LINUX_NETFILTER_XT_RECENT_H */ 28#endif /* _LINUX_NETFILTER_XT_RECENT_H */
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index 32000ba6ecef..29287be696a2 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SCTP_H_ 1#ifndef _XT_SCTP_H_
2#define _XT_SCTP_H_ 2#define _XT_SCTP_H_
3 3
4#include <linux/types.h>
5
4#define XT_SCTP_SRC_PORTS 0x01 6#define XT_SCTP_SRC_PORTS 0x01
5#define XT_SCTP_DEST_PORTS 0x02 7#define XT_SCTP_DEST_PORTS 0x02
6#define XT_SCTP_CHUNK_TYPES 0x04 8#define XT_SCTP_CHUNK_TYPES 0x04
@@ -8,49 +10,49 @@
8#define XT_SCTP_VALID_FLAGS 0x07 10#define XT_SCTP_VALID_FLAGS 0x07
9 11
10struct xt_sctp_flag_info { 12struct xt_sctp_flag_info {
11 u_int8_t chunktype; 13 __u8 chunktype;
12 u_int8_t flag; 14 __u8 flag;
13 u_int8_t flag_mask; 15 __u8 flag_mask;
14}; 16};
15 17
16#define XT_NUM_SCTP_FLAGS 4 18#define XT_NUM_SCTP_FLAGS 4
17 19
18struct xt_sctp_info { 20struct xt_sctp_info {
19 u_int16_t dpts[2]; /* Min, Max */ 21 __u16 dpts[2]; /* Min, Max */
20 u_int16_t spts[2]; /* Min, Max */ 22 __u16 spts[2]; /* Min, Max */
21 23
22 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */ 24 __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */
23 25
24#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ 26#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
25#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ 27#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
26#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ 28#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
27 29
28 u_int32_t chunk_match_type; 30 __u32 chunk_match_type;
29 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; 31 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
30 int flag_count; 32 int flag_count;
31 33
32 u_int32_t flags; 34 __u32 flags;
33 u_int32_t invflags; 35 __u32 invflags;
34}; 36};
35 37
36#define bytes(type) (sizeof(type) * 8) 38#define bytes(type) (sizeof(type) * 8)
37 39
38#define SCTP_CHUNKMAP_SET(chunkmap, type) \ 40#define SCTP_CHUNKMAP_SET(chunkmap, type) \
39 do { \ 41 do { \
40 (chunkmap)[type / bytes(u_int32_t)] |= \ 42 (chunkmap)[type / bytes(__u32)] |= \
41 1 << (type % bytes(u_int32_t)); \ 43 1 << (type % bytes(__u32)); \
42 } while (0) 44 } while (0)
43 45
44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 46#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
45 do { \ 47 do { \
46 (chunkmap)[type / bytes(u_int32_t)] &= \ 48 (chunkmap)[type / bytes(__u32)] &= \
47 ~(1 << (type % bytes(u_int32_t))); \ 49 ~(1 << (type % bytes(__u32))); \
48 } while (0) 50 } while (0)
49 51
50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 52#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
51({ \ 53({ \
52 ((chunkmap)[type / bytes (u_int32_t)] & \ 54 ((chunkmap)[type / bytes (__u32)] & \
53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ 55 (1 << (type % bytes (__u32)))) ? 1: 0; \
54}) 56})
55 57
56#define SCTP_CHUNKMAP_RESET(chunkmap) \ 58#define SCTP_CHUNKMAP_RESET(chunkmap) \
@@ -65,7 +67,7 @@ struct xt_sctp_info {
65#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 67#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
66 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) 68 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
67static inline bool 69static inline bool
68__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n) 70__sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
69{ 71{
70 unsigned int i; 72 unsigned int i;
71 for (i = 0; i < n; ++i) 73 for (i = 0; i < n; ++i)
@@ -77,7 +79,7 @@ __sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
77#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ 79#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
78 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) 80 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
79static inline bool 81static inline bool
80__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n) 82__sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n)
81{ 83{
82 unsigned int i; 84 unsigned int i;
83 for (i = 0; i < n; ++i) 85 for (i = 0; i < n; ++i)
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
index 3d38bc975048..4e983ef0c968 100644
--- a/include/linux/netfilter/xt_statistic.h
+++ b/include/linux/netfilter/xt_statistic.h
@@ -1,6 +1,8 @@
1#ifndef _XT_STATISTIC_H 1#ifndef _XT_STATISTIC_H
2#define _XT_STATISTIC_H 2#define _XT_STATISTIC_H
3 3
4#include <linux/types.h>
5
4enum xt_statistic_mode { 6enum xt_statistic_mode {
5 XT_STATISTIC_MODE_RANDOM, 7 XT_STATISTIC_MODE_RANDOM,
6 XT_STATISTIC_MODE_NTH, 8 XT_STATISTIC_MODE_NTH,
@@ -13,21 +15,22 @@ enum xt_statistic_flags {
13}; 15};
14#define XT_STATISTIC_MASK 0x1 16#define XT_STATISTIC_MASK 0x1
15 17
18struct xt_statistic_priv;
19
16struct xt_statistic_info { 20struct xt_statistic_info {
17 u_int16_t mode; 21 __u16 mode;
18 u_int16_t flags; 22 __u16 flags;
19 union { 23 union {
20 struct { 24 struct {
21 u_int32_t probability; 25 __u32 probability;
22 } random; 26 } random;
23 struct { 27 struct {
24 u_int32_t every; 28 __u32 every;
25 u_int32_t packet; 29 __u32 packet;
26 /* Used internally by the kernel */ 30 __u32 count; /* unused */
27 u_int32_t count;
28 } nth; 31 } nth;
29 } u; 32 } u;
30 struct xt_statistic_info *master __attribute__((aligned(8))); 33 struct xt_statistic_priv *master __attribute__((aligned(8)));
31}; 34};
32 35
33#endif /* _XT_STATISTIC_H */ 36#endif /* _XT_STATISTIC_H */
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index 8a6ba7bbef9f..ecbb95fc89ed 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -1,6 +1,8 @@
1#ifndef _XT_STRING_H 1#ifndef _XT_STRING_H
2#define _XT_STRING_H 2#define _XT_STRING_H
3 3
4#include <linux/types.h>
5
4#define XT_STRING_MAX_PATTERN_SIZE 128 6#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16 7#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6 8
@@ -11,18 +13,18 @@ enum {
11 13
12struct xt_string_info 14struct xt_string_info
13{ 15{
14 u_int16_t from_offset; 16 __u16 from_offset;
15 u_int16_t to_offset; 17 __u16 to_offset;
16 char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; 18 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
17 char pattern[XT_STRING_MAX_PATTERN_SIZE]; 19 char pattern[XT_STRING_MAX_PATTERN_SIZE];
18 u_int8_t patlen; 20 __u8 patlen;
19 union { 21 union {
20 struct { 22 struct {
21 u_int8_t invert; 23 __u8 invert;
22 } v0; 24 } v0;
23 25
24 struct { 26 struct {
25 u_int8_t flags; 27 __u8 flags;
26 } v1; 28 } v1;
27 } u; 29 } u;
28 30
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h
index e03274c4c790..fbac56b9e667 100644
--- a/include/linux/netfilter/xt_tcpmss.h
+++ b/include/linux/netfilter/xt_tcpmss.h
@@ -1,9 +1,11 @@
1#ifndef _XT_TCPMSS_MATCH_H 1#ifndef _XT_TCPMSS_MATCH_H
2#define _XT_TCPMSS_MATCH_H 2#define _XT_TCPMSS_MATCH_H
3 3
4#include <linux/types.h>
5
4struct xt_tcpmss_match_info { 6struct xt_tcpmss_match_info {
5 u_int16_t mss_min, mss_max; 7 __u16 mss_min, mss_max;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9#endif /*_XT_TCPMSS_MATCH_H*/ 11#endif /*_XT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h
index 78bc65f11adf..a490a0bc1d29 100644
--- a/include/linux/netfilter/xt_tcpudp.h
+++ b/include/linux/netfilter/xt_tcpudp.h
@@ -1,15 +1,17 @@
1#ifndef _XT_TCPUDP_H 1#ifndef _XT_TCPUDP_H
2#define _XT_TCPUDP_H 2#define _XT_TCPUDP_H
3 3
4#include <linux/types.h>
5
4/* TCP matching stuff */ 6/* TCP matching stuff */
5struct xt_tcp 7struct xt_tcp
6{ 8{
7 u_int16_t spts[2]; /* Source port range. */ 9 __u16 spts[2]; /* Source port range. */
8 u_int16_t dpts[2]; /* Destination port range. */ 10 __u16 dpts[2]; /* Destination port range. */
9 u_int8_t option; /* TCP Option iff non-zero*/ 11 __u8 option; /* TCP Option iff non-zero*/
10 u_int8_t flg_mask; /* TCP flags mask byte */ 12 __u8 flg_mask; /* TCP flags mask byte */
11 u_int8_t flg_cmp; /* TCP flags compare byte */ 13 __u8 flg_cmp; /* TCP flags compare byte */
12 u_int8_t invflags; /* Inverse flags */ 14 __u8 invflags; /* Inverse flags */
13}; 15};
14 16
15/* Values for "inv" field in struct ipt_tcp. */ 17/* Values for "inv" field in struct ipt_tcp. */
@@ -22,9 +24,9 @@ struct xt_tcp
22/* UDP matching stuff */ 24/* UDP matching stuff */
23struct xt_udp 25struct xt_udp
24{ 26{
25 u_int16_t spts[2]; /* Source port range. */ 27 __u16 spts[2]; /* Source port range. */
26 u_int16_t dpts[2]; /* Destination port range. */ 28 __u16 dpts[2]; /* Destination port range. */
27 u_int8_t invflags; /* Inverse flags */ 29 __u8 invflags; /* Inverse flags */
28}; 30};
29 31
30/* Values for "invflags" field in struct ipt_udp. */ 32/* Values for "invflags" field in struct ipt_udp. */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 499aa9375901..f8105e54716a 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -59,9 +59,9 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
59static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 59static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
60{ 60{
61 switch (skb->protocol) { 61 switch (skb->protocol) {
62 case __constant_htons(ETH_P_8021Q): 62 case __cpu_to_be16(ETH_P_8021Q):
63 return VLAN_HLEN; 63 return VLAN_HLEN;
64 case __constant_htons(ETH_P_PPP_SES): 64 case __cpu_to_be16(ETH_P_PPP_SES):
65 return PPPOE_SES_HLEN; 65 return PPPOE_SES_HLEN;
66 default: 66 default:
67 return 0; 67 return 0;
diff --git a/include/linux/netfilter_ipv4/ipt_owner.h b/include/linux/netfilter_ipv4/ipt_owner.h
index 92f4bdac54ef..a78445be9992 100644
--- a/include/linux/netfilter_ipv4/ipt_owner.h
+++ b/include/linux/netfilter_ipv4/ipt_owner.h
@@ -9,10 +9,10 @@
9#define IPT_OWNER_COMM 0x10 9#define IPT_OWNER_COMM 0x10
10 10
11struct ipt_owner_info { 11struct ipt_owner_info {
12 uid_t uid; 12 __kernel_uid32_t uid;
13 gid_t gid; 13 __kernel_gid32_t gid;
14 pid_t pid; 14 __kernel_pid_t pid;
15 pid_t sid; 15 __kernel_pid_t sid;
16 char comm[16]; 16 char comm[16];
17 u_int8_t match, invert; /* flags */ 17 u_int8_t match, invert; /* flags */
18}; 18};
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index 8887a5fcd1d0..aca4bd1f6d7c 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -11,6 +11,7 @@ header-y += ip6t_length.h
11header-y += ip6t_limit.h 11header-y += ip6t_limit.h
12header-y += ip6t_mac.h 12header-y += ip6t_mac.h
13header-y += ip6t_mark.h 13header-y += ip6t_mark.h
14header-y += ip6t_mh.h
14header-y += ip6t_multiport.h 15header-y += ip6t_multiport.h
15header-y += ip6t_opts.h 16header-y += ip6t_opts.h
16header-y += ip6t_owner.h 17header-y += ip6t_owner.h
diff --git a/include/linux/netfilter_ipv6/ip6t_owner.h b/include/linux/netfilter_ipv6/ip6t_owner.h
index 19937da3d101..ec5cc7a38c42 100644
--- a/include/linux/netfilter_ipv6/ip6t_owner.h
+++ b/include/linux/netfilter_ipv6/ip6t_owner.h
@@ -8,10 +8,10 @@
8#define IP6T_OWNER_SID 0x08 8#define IP6T_OWNER_SID 0x08
9 9
10struct ip6t_owner_info { 10struct ip6t_owner_info {
11 uid_t uid; 11 __kernel_uid32_t uid;
12 gid_t gid; 12 __kernel_gid32_t gid;
13 pid_t pid; 13 __kernel_pid_t pid;
14 pid_t sid; 14 __kernel_pid_t sid;
15 u_int8_t match, invert; /* flags */ 15 u_int8_t match, invert; /* flags */
16}; 16};
17 17
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 51b09a1f46c3..5ba398e90304 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -103,6 +103,8 @@ struct nlmsgerr
103#define NETLINK_ADD_MEMBERSHIP 1 103#define NETLINK_ADD_MEMBERSHIP 1
104#define NETLINK_DROP_MEMBERSHIP 2 104#define NETLINK_DROP_MEMBERSHIP 2
105#define NETLINK_PKTINFO 3 105#define NETLINK_PKTINFO 3
106#define NETLINK_BROADCAST_ERROR 4
107#define NETLINK_NO_ENOBUFS 5
106 108
107struct nl_pktinfo 109struct nl_pktinfo
108{ 110{
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e38d3c9dccda..2524267210d3 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -18,7 +18,7 @@ struct netpoll {
18 const char *name; 18 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 19 void (*rx_hook)(struct netpoll *, int, char *, int);
20 20
21 u32 local_ip, remote_ip; 21 __be32 local_ip, remote_ip;
22 u16 local_port, remote_port; 22 u16 local_port, remote_port;
23 u8 remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24}; 24};
@@ -63,6 +63,13 @@ static inline int netpoll_rx(struct sk_buff *skb)
63 return ret; 63 return ret;
64} 64}
65 65
66static inline int netpoll_rx_on(struct sk_buff *skb)
67{
68 struct netpoll_info *npinfo = skb->dev->npinfo;
69
70 return npinfo && (npinfo->rx_np || npinfo->rx_flags);
71}
72
66static inline int netpoll_receive_skb(struct sk_buff *skb) 73static inline int netpoll_receive_skb(struct sk_buff *skb)
67{ 74{
68 if (!list_empty(&skb->dev->napi_list)) 75 if (!list_empty(&skb->dev->napi_list))
@@ -99,6 +106,10 @@ static inline int netpoll_rx(struct sk_buff *skb)
99{ 106{
100 return 0; 107 return 0;
101} 108}
109static inline int netpoll_rx_on(struct sk_buff *skb)
110{
111 return 0;
112}
102static inline int netpoll_receive_skb(struct sk_buff *skb) 113static inline int netpoll_receive_skb(struct sk_buff *skb)
103{ 114{
104 return 0; 115 return 0;
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 54af92c1c70b..214d499718f7 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -109,7 +109,6 @@
109 NFSERR_FILE_OPEN = 10046, /* v4 */ 109 NFSERR_FILE_OPEN = 10046, /* v4 */
110 NFSERR_ADMIN_REVOKED = 10047, /* v4 */ 110 NFSERR_ADMIN_REVOKED = 10047, /* v4 */
111 NFSERR_CB_PATH_DOWN = 10048, /* v4 */ 111 NFSERR_CB_PATH_DOWN = 10048, /* v4 */
112 NFSERR_REPLAY_ME = 10049 /* v4 */
113}; 112};
114 113
115/* NFSv2 file types - beware, these are not the same in NFSv3 */ 114/* NFSv2 file types - beware, these are not the same in NFSv3 */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index b912311a56b1..e3f0cbcbd0db 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -21,6 +21,7 @@
21#define NFS4_FHSIZE 128 21#define NFS4_FHSIZE 128
22#define NFS4_MAXPATHLEN PATH_MAX 22#define NFS4_MAXPATHLEN PATH_MAX
23#define NFS4_MAXNAMLEN NAME_MAX 23#define NFS4_MAXNAMLEN NAME_MAX
24#define NFS4_MAX_SESSIONID_LEN 16
24 25
25#define NFS4_ACCESS_READ 0x0001 26#define NFS4_ACCESS_READ 0x0001
26#define NFS4_ACCESS_LOOKUP 0x0002 27#define NFS4_ACCESS_LOOKUP 0x0002
@@ -38,6 +39,7 @@
38#define NFS4_OPEN_RESULT_CONFIRM 0x0002 39#define NFS4_OPEN_RESULT_CONFIRM 0x0002
39#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 40#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
40 41
42#define NFS4_SHARE_ACCESS_MASK 0x000F
41#define NFS4_SHARE_ACCESS_READ 0x0001 43#define NFS4_SHARE_ACCESS_READ 0x0001
42#define NFS4_SHARE_ACCESS_WRITE 0x0002 44#define NFS4_SHARE_ACCESS_WRITE 0x0002
43#define NFS4_SHARE_ACCESS_BOTH 0x0003 45#define NFS4_SHARE_ACCESS_BOTH 0x0003
@@ -45,6 +47,19 @@
45#define NFS4_SHARE_DENY_WRITE 0x0002 47#define NFS4_SHARE_DENY_WRITE 0x0002
46#define NFS4_SHARE_DENY_BOTH 0x0003 48#define NFS4_SHARE_DENY_BOTH 0x0003
47 49
50/* nfs41 */
51#define NFS4_SHARE_WANT_MASK 0xFF00
52#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000
53#define NFS4_SHARE_WANT_READ_DELEG 0x0100
54#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200
55#define NFS4_SHARE_WANT_ANY_DELEG 0x0300
56#define NFS4_SHARE_WANT_NO_DELEG 0x0400
57#define NFS4_SHARE_WANT_CANCEL 0x0500
58
59#define NFS4_SHARE_WHEN_MASK 0xF0000
60#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
61#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
62
48#define NFS4_SET_TO_SERVER_TIME 0 63#define NFS4_SET_TO_SERVER_TIME 0
49#define NFS4_SET_TO_CLIENT_TIME 1 64#define NFS4_SET_TO_CLIENT_TIME 1
50 65
@@ -88,6 +103,31 @@
88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 103#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
89#define NFS4_ACE_MASK_ALL 0x001F01FF 104#define NFS4_ACE_MASK_ALL 0x001F01FF
90 105
106#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
107#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
108#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
109#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
110#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
111#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
112#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
113/*
114 * Since the validity of these bits depends on whether
115 * they're set in the argument or response, have separate
116 * invalid flag masks for arg (_A) and resp (_R).
117 */
118#define EXCHGID4_FLAG_MASK_A 0x40070003
119#define EXCHGID4_FLAG_MASK_R 0x80070003
120
121#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
122#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
123#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
124#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008
125#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010
126#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020
127#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040
128#define SEQ4_STATUS_LEASE_MOVED 0x00000080
129#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100
130
91#define NFS4_MAX_UINT64 (~(u64)0) 131#define NFS4_MAX_UINT64 (~(u64)0)
92 132
93enum nfs4_acl_whotype { 133enum nfs4_acl_whotype {
@@ -154,6 +194,28 @@ enum nfs_opnum4 {
154 OP_VERIFY = 37, 194 OP_VERIFY = 37,
155 OP_WRITE = 38, 195 OP_WRITE = 38,
156 OP_RELEASE_LOCKOWNER = 39, 196 OP_RELEASE_LOCKOWNER = 39,
197
198 /* nfs41 */
199 OP_BACKCHANNEL_CTL = 40,
200 OP_BIND_CONN_TO_SESSION = 41,
201 OP_EXCHANGE_ID = 42,
202 OP_CREATE_SESSION = 43,
203 OP_DESTROY_SESSION = 44,
204 OP_FREE_STATEID = 45,
205 OP_GET_DIR_DELEGATION = 46,
206 OP_GETDEVICEINFO = 47,
207 OP_GETDEVICELIST = 48,
208 OP_LAYOUTCOMMIT = 49,
209 OP_LAYOUTGET = 50,
210 OP_LAYOUTRETURN = 51,
211 OP_SECINFO_NO_NAME = 52,
212 OP_SEQUENCE = 53,
213 OP_SET_SSV = 54,
214 OP_TEST_STATEID = 55,
215 OP_WANT_DELEGATION = 56,
216 OP_DESTROY_CLIENTID = 57,
217 OP_RECLAIM_COMPLETE = 58,
218
157 OP_ILLEGAL = 10044, 219 OP_ILLEGAL = 10044,
158}; 220};
159 221
@@ -230,7 +292,48 @@ enum nfsstat4 {
230 NFS4ERR_DEADLOCK = 10045, 292 NFS4ERR_DEADLOCK = 10045,
231 NFS4ERR_FILE_OPEN = 10046, 293 NFS4ERR_FILE_OPEN = 10046,
232 NFS4ERR_ADMIN_REVOKED = 10047, 294 NFS4ERR_ADMIN_REVOKED = 10047,
233 NFS4ERR_CB_PATH_DOWN = 10048 295 NFS4ERR_CB_PATH_DOWN = 10048,
296
297 /* nfs41 */
298 NFS4ERR_BADIOMODE = 10049,
299 NFS4ERR_BADLAYOUT = 10050,
300 NFS4ERR_BAD_SESSION_DIGEST = 10051,
301 NFS4ERR_BADSESSION = 10052,
302 NFS4ERR_BADSLOT = 10053,
303 NFS4ERR_COMPLETE_ALREADY = 10054,
304 NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
305 NFS4ERR_DELEG_ALREADY_WANTED = 10056,
306 NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */
307 NFS4ERR_LAYOUTTRYLATER = 10058,
308 NFS4ERR_LAYOUTUNAVAILABLE = 10059,
309 NFS4ERR_NOMATCHING_LAYOUT = 10060,
310 NFS4ERR_RECALLCONFLICT = 10061,
311 NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
312 NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */
313 NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */
314 NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */
315 NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */
316 NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */
317 NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */
318 NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */
319 NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */
320 NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */
321 NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */
322 /* Error 10073 is unused. */
323 NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */
324 NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */
325 NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */
326 NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */
327 NFS4ERR_DEADSESSION = 10078, /* persistent session dead */
328 NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */
329 NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */
330 NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */
331 NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */
332 NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */
333 NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */
334 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
335 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
336 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
234}; 337};
235 338
236/* 339/*
@@ -265,7 +368,13 @@ enum opentype4 {
265enum createmode4 { 368enum createmode4 {
266 NFS4_CREATE_UNCHECKED = 0, 369 NFS4_CREATE_UNCHECKED = 0,
267 NFS4_CREATE_GUARDED = 1, 370 NFS4_CREATE_GUARDED = 1,
268 NFS4_CREATE_EXCLUSIVE = 2 371 NFS4_CREATE_EXCLUSIVE = 2,
372 /*
373 * New to NFSv4.1. If session is persistent,
374 * GUARDED4 MUST be used. Otherwise, use
375 * EXCLUSIVE4_1 instead of EXCLUSIVE4.
376 */
377 NFS4_CREATE_EXCLUSIVE4_1 = 3
269}; 378};
270 379
271enum limit_by4 { 380enum limit_by4 {
@@ -301,6 +410,8 @@ enum lock_type4 {
301#define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) 410#define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
302#define FATTR4_WORD0_LEASE_TIME (1UL << 10) 411#define FATTR4_WORD0_LEASE_TIME (1UL << 10)
303#define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) 412#define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
413/* Mandatory in NFSv4.1 */
414#define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
304 415
305/* Recommended Attributes */ 416/* Recommended Attributes */
306#define FATTR4_WORD0_ACL (1UL << 12) 417#define FATTR4_WORD0_ACL (1UL << 12)
@@ -391,6 +502,29 @@ enum {
391 NFSPROC4_CLNT_GETACL, 502 NFSPROC4_CLNT_GETACL,
392 NFSPROC4_CLNT_SETACL, 503 NFSPROC4_CLNT_SETACL,
393 NFSPROC4_CLNT_FS_LOCATIONS, 504 NFSPROC4_CLNT_FS_LOCATIONS,
505
506 /* nfs41 */
507 NFSPROC4_CLNT_EXCHANGE_ID,
508 NFSPROC4_CLNT_CREATE_SESSION,
509 NFSPROC4_CLNT_DESTROY_SESSION,
510 NFSPROC4_CLNT_SEQUENCE,
511 NFSPROC4_CLNT_GET_LEASE_TIME,
512};
513
514/* nfs41 types */
515struct nfs4_sessionid {
516 unsigned char data[NFS4_MAX_SESSIONID_LEN];
517};
518
519/* Create Session Flags */
520#define SESSION4_PERSIST 0x001
521#define SESSION4_BACK_CHAN 0x002
522#define SESSION4_RDMA 0x004
523
524enum state_protect_how4 {
525 SP4_NONE = 0,
526 SP4_MACH_CRED = 1,
527 SP4_SSV = 2
394}; 528};
395 529
396#endif 530#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index db867b04ac3c..fdffb413b192 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -166,8 +166,7 @@ struct nfs_inode {
166 */ 166 */
167 struct radix_tree_root nfs_page_tree; 167 struct radix_tree_root nfs_page_tree;
168 168
169 unsigned long ncommit, 169 unsigned long npages;
170 npages;
171 170
172 /* Open contexts for shared mmap writes */ 171 /* Open contexts for shared mmap writes */
173 struct list_head open_files; 172 struct list_head open_files;
@@ -186,6 +185,9 @@ struct nfs_inode {
186 fmode_t delegation_state; 185 fmode_t delegation_state;
187 struct rw_semaphore rwsem; 186 struct rw_semaphore rwsem;
188#endif /* CONFIG_NFS_V4*/ 187#endif /* CONFIG_NFS_V4*/
188#ifdef CONFIG_NFS_FSCACHE
189 struct fscache_cookie *fscache;
190#endif
189 struct inode vfs_inode; 191 struct inode vfs_inode;
190}; 192};
191 193
@@ -207,6 +209,9 @@ struct nfs_inode {
207#define NFS_INO_STALE (1) /* possible stale inode */ 209#define NFS_INO_STALE (1) /* possible stale inode */
208#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */ 210#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */
209#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */ 211#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */
212#define NFS_INO_FLUSHING (4) /* inode is flushing out data */
213#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
214#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
210 215
211static inline struct nfs_inode *NFS_I(const struct inode *inode) 216static inline struct nfs_inode *NFS_I(const struct inode *inode)
212{ 217{
@@ -260,6 +265,11 @@ static inline int NFS_STALE(const struct inode *inode)
260 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 265 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
261} 266}
262 267
268static inline int NFS_FSCACHE(const struct inode *inode)
269{
270 return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags);
271}
272
263static inline __u64 NFS_FILEID(const struct inode *inode) 273static inline __u64 NFS_FILEID(const struct inode *inode)
264{ 274{
265 return NFS_I(inode)->fileid; 275 return NFS_I(inode)->fileid;
@@ -415,7 +425,7 @@ extern const struct inode_operations nfs_dir_inode_operations;
415extern const struct inode_operations nfs3_dir_inode_operations; 425extern const struct inode_operations nfs3_dir_inode_operations;
416#endif /* CONFIG_NFS_V3 */ 426#endif /* CONFIG_NFS_V3 */
417extern const struct file_operations nfs_dir_operations; 427extern const struct file_operations nfs_dir_operations;
418extern struct dentry_operations nfs_dentry_operations; 428extern const struct dentry_operations nfs_dentry_operations;
419 429
420extern void nfs_force_lookup_revalidate(struct inode *dir); 430extern void nfs_force_lookup_revalidate(struct inode *dir);
421extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 431extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
@@ -506,6 +516,8 @@ extern int nfs_readpages(struct file *, struct address_space *,
506 struct list_head *, unsigned); 516 struct list_head *, unsigned);
507extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); 517extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
508extern void nfs_readdata_release(void *data); 518extern void nfs_readdata_release(void *data);
519extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
520 struct page *);
509 521
510/* 522/*
511 * Allocate nfs_read_data structures 523 * Allocate nfs_read_data structures
@@ -583,6 +595,7 @@ extern void * nfs_root_data(void);
583#define NFSDBG_CALLBACK 0x0100 595#define NFSDBG_CALLBACK 0x0100
584#define NFSDBG_CLIENT 0x0200 596#define NFSDBG_CLIENT 0x0200
585#define NFSDBG_MOUNT 0x0400 597#define NFSDBG_MOUNT 0x0400
598#define NFSDBG_FSCACHE 0x0800
586#define NFSDBG_ALL 0xFFFF 599#define NFSDBG_ALL 0xFFFF
587 600
588#ifdef __KERNEL__ 601#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 9bb81aec91cf..6ad75948cbf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -64,6 +64,10 @@ struct nfs_client {
64 char cl_ipaddr[48]; 64 char cl_ipaddr[48];
65 unsigned char cl_id_uniquifier; 65 unsigned char cl_id_uniquifier;
66#endif 66#endif
67
68#ifdef CONFIG_NFS_FSCACHE
69 struct fscache_cookie *fscache; /* client index cache cookie */
70#endif
67}; 71};
68 72
69/* 73/*
@@ -96,16 +100,28 @@ struct nfs_server {
96 unsigned int acdirmin; 100 unsigned int acdirmin;
97 unsigned int acdirmax; 101 unsigned int acdirmax;
98 unsigned int namelen; 102 unsigned int namelen;
103 unsigned int options; /* extra options enabled by mount */
104#define NFS_OPTION_FSCACHE 0x00000001 /* - local caching enabled */
99 105
100 struct nfs_fsid fsid; 106 struct nfs_fsid fsid;
101 __u64 maxfilesize; /* maximum file size */ 107 __u64 maxfilesize; /* maximum file size */
102 unsigned long mount_time; /* when this fs was mounted */ 108 unsigned long mount_time; /* when this fs was mounted */
103 dev_t s_dev; /* superblock dev numbers */ 109 dev_t s_dev; /* superblock dev numbers */
104 110
111#ifdef CONFIG_NFS_FSCACHE
112 struct nfs_fscache_key *fscache_key; /* unique key for superblock */
113 struct fscache_cookie *fscache; /* superblock cookie */
114#endif
115
105#ifdef CONFIG_NFS_V4 116#ifdef CONFIG_NFS_V4
106 u32 attr_bitmask[2];/* V4 bitmask representing the set 117 u32 attr_bitmask[2];/* V4 bitmask representing the set
107 of attributes supported on this 118 of attributes supported on this
108 filesystem */ 119 filesystem */
120 u32 cache_consistency_bitmask[2];
121 /* V4 bitmask representing the subset
122 of change attribute, size, ctime
123 and mtime attributes supported by
124 the server */
109 u32 acl_bitmask; /* V4 bitmask representing the ACEs 125 u32 acl_bitmask; /* V4 bitmask representing the ACEs
110 that are supported on this 126 that are supported on this
111 filesystem */ 127 filesystem */
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 1cb9a3fed2b3..68b10f5f8907 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -116,4 +116,16 @@ enum nfs_stat_eventcounters {
116 __NFSIOS_COUNTSMAX, 116 __NFSIOS_COUNTSMAX,
117}; 117};
118 118
119/*
120 * NFS local caching servicing counters
121 */
122enum nfs_stat_fscachecounters {
123 NFSIOS_FSCACHE_PAGES_READ_OK,
124 NFSIOS_FSCACHE_PAGES_READ_FAIL,
125 NFSIOS_FSCACHE_PAGES_WRITTEN_OK,
126 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL,
127 NFSIOS_FSCACHE_PAGES_UNCACHED,
128 __NFSIOS_FSCACHEMAX,
129};
130
119#endif /* _LINUX_NFS_IOSTAT */ 131#endif /* _LINUX_NFS_IOSTAT */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2e5f00066afd..b89c34e40bc2 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -27,12 +27,8 @@ static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid
27} 27}
28 28
29struct nfs_fattr { 29struct nfs_fattr {
30 unsigned short valid; /* which fields are valid */ 30 unsigned int valid; /* which fields are valid */
31 __u64 pre_size; /* pre_op_attr.size */ 31 umode_t mode;
32 struct timespec pre_mtime; /* pre_op_attr.mtime */
33 struct timespec pre_ctime; /* pre_op_attr.ctime */
34 enum nfs_ftype type; /* always use NFSv2 types */
35 __u32 mode;
36 __u32 nlink; 32 __u32 nlink;
37 __u32 uid; 33 __u32 uid;
38 __u32 gid; 34 __u32 gid;
@@ -52,19 +48,55 @@ struct nfs_fattr {
52 struct timespec atime; 48 struct timespec atime;
53 struct timespec mtime; 49 struct timespec mtime;
54 struct timespec ctime; 50 struct timespec ctime;
55 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
56 __u64 change_attr; /* NFSv4 change attribute */ 51 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ 52 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
53 __u64 pre_size; /* pre_op_attr.size */
54 struct timespec pre_mtime; /* pre_op_attr.mtime */
55 struct timespec pre_ctime; /* pre_op_attr.ctime */
58 unsigned long time_start; 56 unsigned long time_start;
59 unsigned long gencount; 57 unsigned long gencount;
60}; 58};
61 59
62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 60#define NFS_ATTR_FATTR_TYPE (1U << 0)
63#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 61#define NFS_ATTR_FATTR_MODE (1U << 1)
64#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 62#define NFS_ATTR_FATTR_NLINK (1U << 2)
65#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ 63#define NFS_ATTR_FATTR_OWNER (1U << 3)
66#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */ 64#define NFS_ATTR_FATTR_GROUP (1U << 4)
67#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */ 65#define NFS_ATTR_FATTR_RDEV (1U << 5)
66#define NFS_ATTR_FATTR_SIZE (1U << 6)
67#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
68#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
69#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
70#define NFS_ATTR_FATTR_FSID (1U << 10)
71#define NFS_ATTR_FATTR_FILEID (1U << 11)
72#define NFS_ATTR_FATTR_ATIME (1U << 12)
73#define NFS_ATTR_FATTR_MTIME (1U << 13)
74#define NFS_ATTR_FATTR_CTIME (1U << 14)
75#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
76#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
77#define NFS_ATTR_FATTR_CHANGE (1U << 17)
78#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
79#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
80
81#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
82 | NFS_ATTR_FATTR_MODE \
83 | NFS_ATTR_FATTR_NLINK \
84 | NFS_ATTR_FATTR_OWNER \
85 | NFS_ATTR_FATTR_GROUP \
86 | NFS_ATTR_FATTR_RDEV \
87 | NFS_ATTR_FATTR_SIZE \
88 | NFS_ATTR_FATTR_FSID \
89 | NFS_ATTR_FATTR_FILEID \
90 | NFS_ATTR_FATTR_ATIME \
91 | NFS_ATTR_FATTR_MTIME \
92 | NFS_ATTR_FATTR_CTIME)
93#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
94 | NFS_ATTR_FATTR_BLOCKS_USED)
95#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
96 | NFS_ATTR_FATTR_SPACE_USED)
97#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
98 | NFS_ATTR_FATTR_SPACE_USED \
99 | NFS_ATTR_FATTR_CHANGE)
68 100
69/* 101/*
70 * Info on the file system 102 * Info on the file system
@@ -785,7 +817,7 @@ struct nfs_access_entry;
785 */ 817 */
786struct nfs_rpc_ops { 818struct nfs_rpc_ops {
787 u32 version; /* Protocol version */ 819 u32 version; /* Protocol version */
788 struct dentry_operations *dentry_ops; 820 const struct dentry_operations *dentry_ops;
789 const struct inode_operations *dir_inode_ops; 821 const struct inode_operations *dir_inode_ops;
790 const struct inode_operations *file_inode_ops; 822 const struct inode_operations *file_inode_ops;
791 823
@@ -836,6 +868,7 @@ struct nfs_rpc_ops {
836 int (*lock)(struct file *, int, struct file_lock *); 868 int (*lock)(struct file *, int, struct file_lock *);
837 int (*lock_check_bounds)(const struct file_lock *); 869 int (*lock_check_bounds)(const struct file_lock *);
838 void (*clear_acl_cache)(struct inode *); 870 void (*clear_acl_cache)(struct inode *);
871 void (*close_context)(struct nfs_open_context *ctx, int);
839}; 872};
840 873
841/* 874/*
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 04b355c801d8..5bccaab81056 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -76,4 +76,12 @@ void nfsd_reply_cache_shutdown(void);
76int nfsd_cache_lookup(struct svc_rqst *, int); 76int nfsd_cache_lookup(struct svc_rqst *, int);
77void nfsd_cache_update(struct svc_rqst *, int, __be32 *); 77void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
78 78
79#ifdef CONFIG_NFSD_V4
80void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp);
81#else /* CONFIG_NFSD_V4 */
82static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp)
83{
84}
85#endif /* CONFIG_NFSD_V4 */
86
79#endif /* NFSCACHE_H */ 87#endif /* NFSCACHE_H */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index e19f45991b2e..2b49d676d0c9 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -23,7 +23,7 @@
23/* 23/*
24 * nfsd version 24 * nfsd version
25 */ 25 */
26#define NFSD_SUPPORTED_MINOR_VERSION 0 26#define NFSD_SUPPORTED_MINOR_VERSION 1
27 27
28/* 28/*
29 * Flags for nfsd_permission 29 * Flags for nfsd_permission
@@ -53,6 +53,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
53extern struct svc_program nfsd_program; 53extern struct svc_program nfsd_program;
54extern struct svc_version nfsd_version2, nfsd_version3, 54extern struct svc_version nfsd_version2, nfsd_version3,
55 nfsd_version4; 55 nfsd_version4;
56extern u32 nfsd_supported_minorversion;
56extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
57extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
58 59
@@ -105,7 +106,7 @@ void nfsd_close(struct file *);
105__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, 106__be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *,
106 loff_t, struct kvec *, int, unsigned long *); 107 loff_t, struct kvec *, int, unsigned long *);
107__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, 108__be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *,
108 loff_t, struct kvec *,int, unsigned long, int *); 109 loff_t, struct kvec *,int, unsigned long *, int *);
109__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, 110__be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *,
110 char *, int *); 111 char *, int *);
111__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, 112__be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,
@@ -149,6 +150,7 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *);
149 150
150enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; 151enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL };
151int nfsd_vers(int vers, enum vers_op change); 152int nfsd_vers(int vers, enum vers_op change);
153int nfsd_minorversion(u32 minorversion, enum vers_op change);
152void nfsd_reset_versions(void); 154void nfsd_reset_versions(void);
153int nfsd_create_serv(void); 155int nfsd_create_serv(void);
154 156
@@ -186,78 +188,119 @@ void nfsd_lockd_shutdown(void);
186/* 188/*
187 * These macros provide pre-xdr'ed values for faster operation. 189 * These macros provide pre-xdr'ed values for faster operation.
188 */ 190 */
189#define nfs_ok __constant_htonl(NFS_OK) 191#define nfs_ok cpu_to_be32(NFS_OK)
190#define nfserr_perm __constant_htonl(NFSERR_PERM) 192#define nfserr_perm cpu_to_be32(NFSERR_PERM)
191#define nfserr_noent __constant_htonl(NFSERR_NOENT) 193#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
192#define nfserr_io __constant_htonl(NFSERR_IO) 194#define nfserr_io cpu_to_be32(NFSERR_IO)
193#define nfserr_nxio __constant_htonl(NFSERR_NXIO) 195#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
194#define nfserr_eagain __constant_htonl(NFSERR_EAGAIN) 196#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)
195#define nfserr_acces __constant_htonl(NFSERR_ACCES) 197#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
196#define nfserr_exist __constant_htonl(NFSERR_EXIST) 198#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
197#define nfserr_xdev __constant_htonl(NFSERR_XDEV) 199#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
198#define nfserr_nodev __constant_htonl(NFSERR_NODEV) 200#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
199#define nfserr_notdir __constant_htonl(NFSERR_NOTDIR) 201#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
200#define nfserr_isdir __constant_htonl(NFSERR_ISDIR) 202#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
201#define nfserr_inval __constant_htonl(NFSERR_INVAL) 203#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
202#define nfserr_fbig __constant_htonl(NFSERR_FBIG) 204#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
203#define nfserr_nospc __constant_htonl(NFSERR_NOSPC) 205#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
204#define nfserr_rofs __constant_htonl(NFSERR_ROFS) 206#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
205#define nfserr_mlink __constant_htonl(NFSERR_MLINK) 207#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
206#define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP) 208#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)
207#define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG) 209#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
208#define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY) 210#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
209#define nfserr_dquot __constant_htonl(NFSERR_DQUOT) 211#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
210#define nfserr_stale __constant_htonl(NFSERR_STALE) 212#define nfserr_stale cpu_to_be32(NFSERR_STALE)
211#define nfserr_remote __constant_htonl(NFSERR_REMOTE) 213#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
212#define nfserr_wflush __constant_htonl(NFSERR_WFLUSH) 214#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
213#define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE) 215#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
214#define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC) 216#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
215#define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE) 217#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
216#define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP) 218#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
217#define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL) 219#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
218#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT) 220#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
219#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE) 221#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
220#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX) 222#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
221#define nfserr_denied __constant_htonl(NFSERR_DENIED) 223#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
222#define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK) 224#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
223#define nfserr_expired __constant_htonl(NFSERR_EXPIRED) 225#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
224#define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE) 226#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
225#define nfserr_same __constant_htonl(NFSERR_SAME) 227#define nfserr_same cpu_to_be32(NFSERR_SAME)
226#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) 228#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
227#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) 229#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
228#define nfserr_resource __constant_htonl(NFSERR_RESOURCE) 230#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
229#define nfserr_moved __constant_htonl(NFSERR_MOVED) 231#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
230#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) 232#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
231#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) 233#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
232#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED) 234#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
233#define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID) 235#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
234#define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID) 236#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
235#define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID) 237#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
236#define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID) 238#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
237#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK) 239#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
238#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME) 240#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
239#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH) 241#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
240#define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP) 242#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
241#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) 243#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
242#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE) 244#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
243#define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD) 245#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
244#define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL) 246#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
245#define nfserr_grace __constant_htonl(NFSERR_GRACE) 247#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
246#define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE) 248#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
247#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) 249#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
248#define nfserr_badname __constant_htonl(NFSERR_BADNAME) 250#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
249#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) 251#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
250#define nfserr_locked __constant_htonl(NFSERR_LOCKED) 252#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
251#define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC) 253#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
252#define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME) 254#define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
255#define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
256#define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
257#define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION)
258#define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT)
259#define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
260#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
261#define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
262#define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
263#define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
264#define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
265#define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
266#define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT)
267#define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
268#define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
269#define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS)
270#define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
271#define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG)
272#define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
273#define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
274#define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
275#define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
276#define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
277#define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
278#define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
279#define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
280#define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
281#define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
282#define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION)
283#define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
284#define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
285#define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
286#define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED)
287#define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE)
288#define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
289#define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG)
290#define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT)
291#define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED)
253 292
254/* error codes for internal use */ 293/* error codes for internal use */
255/* if a request fails due to kmalloc failure, it gets dropped. 294/* if a request fails due to kmalloc failure, it gets dropped.
256 * Client should resend eventually 295 * Client should resend eventually
257 */ 296 */
258#define nfserr_dropit __constant_htonl(30000) 297#define nfserr_dropit cpu_to_be32(30000)
259/* end-of-file indicator in readdir */ 298/* end-of-file indicator in readdir */
260#define nfserr_eof __constant_htonl(30001) 299#define nfserr_eof cpu_to_be32(30001)
300/* replay detected */
301#define nfserr_replay_me cpu_to_be32(11001)
302/* nfs41 replay detected */
303#define nfserr_replay_cache cpu_to_be32(11002)
261 304
262/* Check for dir entries '.' and '..' */ 305/* Check for dir entries '.' and '..' */
263#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) 306#define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
@@ -300,7 +343,7 @@ extern struct timeval nfssvc_boot;
300 * TIME_BACKUP (unlikely to be supported any time soon) 343 * TIME_BACKUP (unlikely to be supported any time soon)
301 * TIME_CREATE (unlikely to be supported any time soon) 344 * TIME_CREATE (unlikely to be supported any time soon)
302 */ 345 */
303#define NFSD_SUPPORTED_ATTRS_WORD0 \ 346#define NFSD4_SUPPORTED_ATTRS_WORD0 \
304(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ 347(FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \
305 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ 348 | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \
306 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ 349 | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \
@@ -312,7 +355,7 @@ extern struct timeval nfssvc_boot;
312 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ 355 | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \
313 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) 356 | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL)
314 357
315#define NFSD_SUPPORTED_ATTRS_WORD1 \ 358#define NFSD4_SUPPORTED_ATTRS_WORD1 \
316(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ 359(FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \
317 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ 360 | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \
318 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ 361 | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \
@@ -320,6 +363,35 @@ extern struct timeval nfssvc_boot;
320 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ 363 | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
321 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) 364 | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
322 365
366#define NFSD4_SUPPORTED_ATTRS_WORD2 0
367
368#define NFSD4_1_SUPPORTED_ATTRS_WORD0 \
369 NFSD4_SUPPORTED_ATTRS_WORD0
370
371#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \
372 NFSD4_SUPPORTED_ATTRS_WORD1
373
374#define NFSD4_1_SUPPORTED_ATTRS_WORD2 \
375 (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
376
377static inline u32 nfsd_suppattrs0(u32 minorversion)
378{
379 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
380 : NFSD4_SUPPORTED_ATTRS_WORD0;
381}
382
383static inline u32 nfsd_suppattrs1(u32 minorversion)
384{
385 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1
386 : NFSD4_SUPPORTED_ATTRS_WORD1;
387}
388
389static inline u32 nfsd_suppattrs2(u32 minorversion)
390{
391 return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2
392 : NFSD4_SUPPORTED_ATTRS_WORD2;
393}
394
323/* These will return ERR_INVAL if specified in GETATTR or READDIR. */ 395/* These will return ERR_INVAL if specified in GETATTR or READDIR. */
324#define NFSD_WRITEONLY_ATTRS_WORD1 \ 396#define NFSD_WRITEONLY_ATTRS_WORD1 \
325(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 397(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
@@ -330,6 +402,19 @@ extern struct timeval nfssvc_boot;
330#define NFSD_WRITEABLE_ATTRS_WORD1 \ 402#define NFSD_WRITEABLE_ATTRS_WORD1 \
331(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ 403(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
332 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) 404 | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
405#define NFSD_WRITEABLE_ATTRS_WORD2 0
406
407#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
408 NFSD_WRITEABLE_ATTRS_WORD0
409/*
410 * we currently store the exclusive create verifier in the v_{a,m}time
411 * attributes so the client can't set these at create time using EXCLUSIVE4_1
412 */
413#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
414 (NFSD_WRITEABLE_ATTRS_WORD1 & \
415 ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
416#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
417 NFSD_WRITEABLE_ATTRS_WORD2
333 418
334#endif /* CONFIG_NFSD_V4 */ 419#endif /* CONFIG_NFSD_V4 */
335 420
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index fa317f6c154b..afa19016c4a8 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -269,6 +269,13 @@ fh_copy(struct svc_fh *dst, struct svc_fh *src)
269 return dst; 269 return dst;
270} 270}
271 271
272static inline void
273fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src)
274{
275 dst->fh_size = src->fh_size;
276 memcpy(&dst->fh_base, &src->fh_base, src->fh_size);
277}
278
272static __inline__ struct svc_fh * 279static __inline__ struct svc_fh *
273fh_init(struct svc_fh *fhp, int maxsize) 280fh_init(struct svc_fh *fhp, int maxsize)
274{ 281{
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 128298c0362d..4d61c873feed 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -66,8 +66,7 @@ struct nfs4_cb_recall {
66 u32 cbr_ident; 66 u32 cbr_ident;
67 int cbr_trunc; 67 int cbr_trunc;
68 stateid_t cbr_stateid; 68 stateid_t cbr_stateid;
69 u32 cbr_fhlen; 69 struct knfsd_fh cbr_fh;
70 char cbr_fhval[NFS4_FHSIZE];
71 struct nfs4_delegation *cbr_dp; 70 struct nfs4_delegation *cbr_dp;
72}; 71};
73 72
@@ -86,8 +85,7 @@ struct nfs4_delegation {
86}; 85};
87 86
88#define dl_stateid dl_recall.cbr_stateid 87#define dl_stateid dl_recall.cbr_stateid
89#define dl_fhlen dl_recall.cbr_fhlen 88#define dl_fh dl_recall.cbr_fh
90#define dl_fhval dl_recall.cbr_fhval
91 89
92/* client delegation callback info */ 90/* client delegation callback info */
93struct nfs4_callback { 91struct nfs4_callback {
@@ -101,6 +99,64 @@ struct nfs4_callback {
101 struct rpc_clnt * cb_client; 99 struct rpc_clnt * cb_client;
102}; 100};
103 101
102/* Maximum number of slots per session. 128 is useful for long haul TCP */
103#define NFSD_MAX_SLOTS_PER_SESSION 128
104/* Maximum number of pages per slot cache entry */
105#define NFSD_PAGES_PER_SLOT 1
106/* Maximum number of operations per session compound */
107#define NFSD_MAX_OPS_PER_COMPOUND 16
108
109struct nfsd4_cache_entry {
110 __be32 ce_status;
111 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */
112 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1];
113 int ce_cachethis;
114 short ce_resused;
115 int ce_opcnt;
116 int ce_rpchdrlen;
117};
118
119struct nfsd4_slot {
120 bool sl_inuse;
121 u32 sl_seqid;
122 struct nfsd4_cache_entry sl_cache_entry;
123};
124
125struct nfsd4_session {
126 struct kref se_ref;
127 struct list_head se_hash; /* hash by sessionid */
128 struct list_head se_perclnt;
129 u32 se_flags;
130 struct nfs4_client *se_client; /* for expire_client */
131 struct nfs4_sessionid se_sessionid;
132 u32 se_fmaxreq_sz;
133 u32 se_fmaxresp_sz;
134 u32 se_fmaxresp_cached;
135 u32 se_fmaxops;
136 u32 se_fnumslots;
137 struct nfsd4_slot se_slots[]; /* forward channel slots */
138};
139
140static inline void
141nfsd4_put_session(struct nfsd4_session *ses)
142{
143 extern void free_session(struct kref *kref);
144 kref_put(&ses->se_ref, free_session);
145}
146
147static inline void
148nfsd4_get_session(struct nfsd4_session *ses)
149{
150 kref_get(&ses->se_ref);
151}
152
153/* formatted contents of nfs4_sessionid */
154struct nfsd4_sessionid {
155 clientid_t clientid;
156 u32 sequence;
157 u32 reserved;
158};
159
104#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ 160#define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */
105 161
106/* 162/*
@@ -132,6 +188,12 @@ struct nfs4_client {
132 struct nfs4_callback cl_callback; /* callback info */ 188 struct nfs4_callback cl_callback; /* callback info */
133 atomic_t cl_count; /* ref count */ 189 atomic_t cl_count; /* ref count */
134 u32 cl_firststate; /* recovery dir creation */ 190 u32 cl_firststate; /* recovery dir creation */
191
192 /* for nfs41 */
193 struct list_head cl_sessions;
194 struct nfsd4_slot cl_slot; /* create_session slot */
195 u32 cl_exchange_flags;
196 struct nfs4_sessionid cl_sessionid;
135}; 197};
136 198
137/* struct nfs4_client_reset 199/* struct nfs4_client_reset
@@ -168,8 +230,7 @@ struct nfs4_replay {
168 unsigned int rp_buflen; 230 unsigned int rp_buflen;
169 char *rp_buf; 231 char *rp_buf;
170 unsigned intrp_allocated; 232 unsigned intrp_allocated;
171 int rp_openfh_len; 233 struct knfsd_fh rp_openfh;
172 char rp_openfh[NFS4_FHSIZE];
173 char rp_ibuf[NFSD4_REPLAY_ISIZE]; 234 char rp_ibuf[NFSD4_REPLAY_ISIZE];
174}; 235};
175 236
@@ -217,7 +278,7 @@ struct nfs4_stateowner {
217* share_acces, share_deny on the file. 278* share_acces, share_deny on the file.
218*/ 279*/
219struct nfs4_file { 280struct nfs4_file {
220 struct kref fi_ref; 281 atomic_t fi_ref;
221 struct list_head fi_hash; /* hash by "struct inode *" */ 282 struct list_head fi_hash; /* hash by "struct inode *" */
222 struct list_head fi_stateids; 283 struct list_head fi_stateids;
223 struct list_head fi_delegations; 284 struct list_head fi_delegations;
@@ -259,14 +320,13 @@ struct nfs4_stateid {
259}; 320};
260 321
261/* flags for preprocess_seqid_op() */ 322/* flags for preprocess_seqid_op() */
262#define CHECK_FH 0x00000001 323#define HAS_SESSION 0x00000001
263#define CONFIRM 0x00000002 324#define CONFIRM 0x00000002
264#define OPEN_STATE 0x00000004 325#define OPEN_STATE 0x00000004
265#define LOCK_STATE 0x00000008 326#define LOCK_STATE 0x00000008
266#define RD_STATE 0x00000010 327#define RD_STATE 0x00000010
267#define WR_STATE 0x00000020 328#define WR_STATE 0x00000020
268#define CLOSE_STATE 0x00000040 329#define CLOSE_STATE 0x00000040
269#define DELEG_RET 0x00000080
270 330
271#define seqid_mutating_err(err) \ 331#define seqid_mutating_err(err) \
272 (((err) != nfserr_stale_clientid) && \ 332 (((err) != nfserr_stale_clientid) && \
@@ -274,7 +334,9 @@ struct nfs4_stateid {
274 ((err) != nfserr_stale_stateid) && \ 334 ((err) != nfserr_stale_stateid) && \
275 ((err) != nfserr_bad_stateid)) 335 ((err) != nfserr_bad_stateid))
276 336
277extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh, 337struct nfsd4_compound_state;
338
339extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate,
278 stateid_t *stateid, int flags, struct file **filp); 340 stateid_t *stateid, int flags, struct file **filp);
279extern void nfs4_lock_state(void); 341extern void nfs4_lock_state(void);
280extern void nfs4_unlock_state(void); 342extern void nfs4_unlock_state(void);
@@ -290,7 +352,7 @@ extern void nfsd4_init_recdir(char *recdir_name);
290extern int nfsd4_recdir_load(void); 352extern int nfsd4_recdir_load(void);
291extern void nfsd4_shutdown_recdir(void); 353extern void nfsd4_shutdown_recdir(void);
292extern int nfs4_client_to_reclaim(const char *name); 354extern int nfs4_client_to_reclaim(const char *name);
293extern int nfs4_has_reclaimed_state(const char *name); 355extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id);
294extern void nfsd4_recdir_purge_old(void); 356extern void nfsd4_recdir_purge_old(void);
295extern int nfsd4_create_clid_dir(struct nfs4_client *clp); 357extern int nfsd4_create_clid_dir(struct nfs4_client *clp);
296extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); 358extern void nfsd4_remove_clid_dir(struct nfs4_client *clp);
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index 7678cfbe9960..2693ef647df6 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -11,6 +11,11 @@
11 11
12#include <linux/nfs4.h> 12#include <linux/nfs4.h>
13 13
14/* thread usage wraps very million seconds (approx one fortnight) */
15#define NFSD_USAGE_WRAP (HZ*1000000)
16
17#ifdef __KERNEL__
18
14struct nfsd_stats { 19struct nfsd_stats {
15 unsigned int rchits; /* repcache hits */ 20 unsigned int rchits; /* repcache hits */
16 unsigned int rcmisses; /* repcache hits */ 21 unsigned int rcmisses; /* repcache hits */
@@ -35,10 +40,6 @@ struct nfsd_stats {
35 40
36}; 41};
37 42
38/* thread usage wraps very million seconds (approx one fortnight) */
39#define NFSD_USAGE_WRAP (HZ*1000000)
40
41#ifdef __KERNEL__
42 43
43extern struct nfsd_stats nfsdstats; 44extern struct nfsd_stats nfsdstats;
44extern struct svc_stat nfsd_svcstats; 45extern struct svc_stat nfsd_svcstats;
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 27bd3e38ec5a..f80d6013fdc3 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -45,10 +45,22 @@
45#define XDR_LEN(n) (((n) + 3) & ~3) 45#define XDR_LEN(n) (((n) + 3) & ~3)
46 46
47struct nfsd4_compound_state { 47struct nfsd4_compound_state {
48 struct svc_fh current_fh; 48 struct svc_fh current_fh;
49 struct svc_fh save_fh; 49 struct svc_fh save_fh;
50 struct nfs4_stateowner *replay_owner; 50 struct nfs4_stateowner *replay_owner;
51}; 51 /* For sessions DRC */
52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot;
54 __be32 *statp;
55 size_t iovlen;
56 u32 minorversion;
57 u32 status;
58};
59
60static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
61{
62 return cs->slot != NULL;
63}
52 64
53struct nfsd4_change_info { 65struct nfsd4_change_info {
54 u32 atomic; 66 u32 atomic;
@@ -90,7 +102,7 @@ struct nfsd4_create {
90 u32 specdata2; 102 u32 specdata2;
91 } dev; /* NF4BLK, NF4CHR */ 103 } dev; /* NF4BLK, NF4CHR */
92 } u; 104 } u;
93 u32 cr_bmval[2]; /* request */ 105 u32 cr_bmval[3]; /* request */
94 struct iattr cr_iattr; /* request */ 106 struct iattr cr_iattr; /* request */
95 struct nfsd4_change_info cr_cinfo; /* response */ 107 struct nfsd4_change_info cr_cinfo; /* response */
96 struct nfs4_acl *cr_acl; 108 struct nfs4_acl *cr_acl;
@@ -105,7 +117,7 @@ struct nfsd4_delegreturn {
105}; 117};
106 118
107struct nfsd4_getattr { 119struct nfsd4_getattr {
108 u32 ga_bmval[2]; /* request */ 120 u32 ga_bmval[3]; /* request */
109 struct svc_fh *ga_fhp; /* response */ 121 struct svc_fh *ga_fhp; /* response */
110}; 122};
111 123
@@ -206,11 +218,9 @@ struct nfsd4_open {
206 stateid_t op_delegate_stateid; /* request - response */ 218 stateid_t op_delegate_stateid; /* request - response */
207 u32 op_create; /* request */ 219 u32 op_create; /* request */
208 u32 op_createmode; /* request */ 220 u32 op_createmode; /* request */
209 u32 op_bmval[2]; /* request */ 221 u32 op_bmval[3]; /* request */
210 union { /* request */ 222 struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
211 struct iattr iattr; /* UNCHECKED4,GUARDED4 */ 223 nfs4_verifier verf; /* EXCLUSIVE4 */
212 nfs4_verifier verf; /* EXCLUSIVE4 */
213 } u;
214 clientid_t op_clientid; /* request */ 224 clientid_t op_clientid; /* request */
215 struct xdr_netobj op_owner; /* request */ 225 struct xdr_netobj op_owner; /* request */
216 u32 op_seqid; /* request */ 226 u32 op_seqid; /* request */
@@ -224,8 +234,8 @@ struct nfsd4_open {
224 struct nfs4_stateowner *op_stateowner; /* used during processing */ 234 struct nfs4_stateowner *op_stateowner; /* used during processing */
225 struct nfs4_acl *op_acl; 235 struct nfs4_acl *op_acl;
226}; 236};
227#define op_iattr u.iattr 237#define op_iattr iattr
228#define op_verf u.verf 238#define op_verf verf
229 239
230struct nfsd4_open_confirm { 240struct nfsd4_open_confirm {
231 stateid_t oc_req_stateid /* request */; 241 stateid_t oc_req_stateid /* request */;
@@ -259,7 +269,7 @@ struct nfsd4_readdir {
259 nfs4_verifier rd_verf; /* request */ 269 nfs4_verifier rd_verf; /* request */
260 u32 rd_dircount; /* request */ 270 u32 rd_dircount; /* request */
261 u32 rd_maxcount; /* request */ 271 u32 rd_maxcount; /* request */
262 u32 rd_bmval[2]; /* request */ 272 u32 rd_bmval[3]; /* request */
263 struct svc_rqst *rd_rqstp; /* response */ 273 struct svc_rqst *rd_rqstp; /* response */
264 struct svc_fh * rd_fhp; /* response */ 274 struct svc_fh * rd_fhp; /* response */
265 275
@@ -301,7 +311,7 @@ struct nfsd4_secinfo {
301 311
302struct nfsd4_setattr { 312struct nfsd4_setattr {
303 stateid_t sa_stateid; /* request */ 313 stateid_t sa_stateid; /* request */
304 u32 sa_bmval[2]; /* request */ 314 u32 sa_bmval[3]; /* request */
305 struct iattr sa_iattr; /* request */ 315 struct iattr sa_iattr; /* request */
306 struct nfs4_acl *sa_acl; 316 struct nfs4_acl *sa_acl;
307}; 317};
@@ -327,7 +337,7 @@ struct nfsd4_setclientid_confirm {
327 337
328/* also used for NVERIFY */ 338/* also used for NVERIFY */
329struct nfsd4_verify { 339struct nfsd4_verify {
330 u32 ve_bmval[2]; /* request */ 340 u32 ve_bmval[3]; /* request */
331 u32 ve_attrlen; /* request */ 341 u32 ve_attrlen; /* request */
332 char * ve_attrval; /* request */ 342 char * ve_attrval; /* request */
333}; 343};
@@ -344,6 +354,54 @@ struct nfsd4_write {
344 nfs4_verifier wr_verifier; /* response */ 354 nfs4_verifier wr_verifier; /* response */
345}; 355};
346 356
357struct nfsd4_exchange_id {
358 nfs4_verifier verifier;
359 struct xdr_netobj clname;
360 u32 flags;
361 clientid_t clientid;
362 u32 seqid;
363 int spa_how;
364};
365
366struct nfsd4_channel_attrs {
367 u32 headerpadsz;
368 u32 maxreq_sz;
369 u32 maxresp_sz;
370 u32 maxresp_cached;
371 u32 maxops;
372 u32 maxreqs;
373 u32 nr_rdma_attrs;
374 u32 rdma_attrs;
375};
376
377struct nfsd4_create_session {
378 clientid_t clientid;
379 struct nfs4_sessionid sessionid;
380 u32 seqid;
381 u32 flags;
382 struct nfsd4_channel_attrs fore_channel;
383 struct nfsd4_channel_attrs back_channel;
384 u32 callback_prog;
385 u32 uid;
386 u32 gid;
387};
388
389struct nfsd4_sequence {
390 struct nfs4_sessionid sessionid; /* request/response */
391 u32 seqid; /* request/response */
392 u32 slotid; /* request/response */
393 u32 maxslots; /* request/response */
394 u32 cachethis; /* request */
395#if 0
396 u32 target_maxslots; /* response */
397 u32 status_flags; /* response */
398#endif /* not yet */
399};
400
401struct nfsd4_destroy_session {
402 struct nfs4_sessionid sessionid;
403};
404
347struct nfsd4_op { 405struct nfsd4_op {
348 int opnum; 406 int opnum;
349 __be32 status; 407 __be32 status;
@@ -378,6 +436,12 @@ struct nfsd4_op {
378 struct nfsd4_verify verify; 436 struct nfsd4_verify verify;
379 struct nfsd4_write write; 437 struct nfsd4_write write;
380 struct nfsd4_release_lockowner release_lockowner; 438 struct nfsd4_release_lockowner release_lockowner;
439
440 /* NFSv4.1 */
441 struct nfsd4_exchange_id exchange_id;
442 struct nfsd4_create_session create_session;
443 struct nfsd4_destroy_session destroy_session;
444 struct nfsd4_sequence sequence;
381 } u; 445 } u;
382 struct nfs4_replay * replay; 446 struct nfs4_replay * replay;
383}; 447};
@@ -416,9 +480,22 @@ struct nfsd4_compoundres {
416 u32 taglen; 480 u32 taglen;
417 char * tag; 481 char * tag;
418 u32 opcnt; 482 u32 opcnt;
419 __be32 * tagp; /* where to encode tag and opcount */ 483 __be32 * tagp; /* tag, opcount encode location */
484 struct nfsd4_compound_state cstate;
420}; 485};
421 486
487static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
488{
489 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
490 return args->opcnt == 1;
491}
492
493static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
494{
495 return !resp->cstate.slot->sl_cache_entry.ce_cachethis ||
496 nfsd4_is_solo_sequence(resp);
497}
498
422#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 499#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
423 500
424static inline void 501static inline void
@@ -448,7 +525,23 @@ extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
448extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 525extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
449 struct nfsd4_compound_state *, 526 struct nfsd4_compound_state *,
450 struct nfsd4_setclientid_confirm *setclientid_confirm); 527 struct nfsd4_setclientid_confirm *setclientid_confirm);
451extern __be32 nfsd4_process_open1(struct nfsd4_open *open); 528extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp);
529extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
530 struct nfsd4_sequence *seq);
531extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
532 struct nfsd4_compound_state *,
533struct nfsd4_exchange_id *);
534 extern __be32 nfsd4_create_session(struct svc_rqst *,
535 struct nfsd4_compound_state *,
536 struct nfsd4_create_session *);
537extern __be32 nfsd4_sequence(struct svc_rqst *,
538 struct nfsd4_compound_state *,
539 struct nfsd4_sequence *);
540extern __be32 nfsd4_destroy_session(struct svc_rqst *,
541 struct nfsd4_compound_state *,
542 struct nfsd4_destroy_session *);
543extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
544 struct nfsd4_open *open);
452extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, 545extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
453 struct svc_fh *current_fh, struct nfsd4_open *open); 546 struct svc_fh *current_fh, struct nfsd4_open *open);
454extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, 547extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
new file mode 100644
index 000000000000..79fec6af3f9f
--- /dev/null
+++ b/include/linux/nilfs2_fs.h
@@ -0,0 +1,801 @@
1/*
2 * nilfs2_fs.h - NILFS2 on-disk structures and common declarations.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Written by Koji Sato <koji@osrg.net>
21 * Ryusuke Konishi <ryusuke@osrg.net>
22 */
23/*
24 * linux/include/linux/ext2_fs.h
25 *
26 * Copyright (C) 1992, 1993, 1994, 1995
27 * Remy Card (card@masi.ibp.fr)
28 * Laboratoire MASI - Institut Blaise Pascal
29 * Universite Pierre et Marie Curie (Paris VI)
30 *
31 * from
32 *
33 * linux/include/linux/minix_fs.h
34 *
35 * Copyright (C) 1991, 1992 Linus Torvalds
36 */
37
38#ifndef _LINUX_NILFS_FS_H
39#define _LINUX_NILFS_FS_H
40
41#include <linux/types.h>
42#include <linux/ioctl.h>
43
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63
64
65#define NILFS_INODE_BMAP_SIZE 7
66/**
67 * struct nilfs_inode - structure of an inode on disk
68 * @i_blocks: blocks count
69 * @i_size: size in bytes
70 * @i_ctime: creation time (seconds)
71 * @i_mtime: modification time (seconds)
72 * @i_ctime_nsec: creation time (nano seconds)
73 * @i_mtime_nsec: modification time (nano seconds)
74 * @i_uid: user id
75 * @i_gid: group id
76 * @i_mode: file mode
77 * @i_links_count: links count
78 * @i_flags: file flags
79 * @i_bmap: block mapping
80 * @i_xattr: extended attributes
81 * @i_generation: file generation (for NFS)
82 * @i_pad: padding
83 */
84struct nilfs_inode {
85 __le64 i_blocks;
86 __le64 i_size;
87 __le64 i_ctime;
88 __le64 i_mtime;
89 __le32 i_ctime_nsec;
90 __le32 i_mtime_nsec;
91 __le32 i_uid;
92 __le32 i_gid;
93 __le16 i_mode;
94 __le16 i_links_count;
95 __le32 i_flags;
96 __le64 i_bmap[NILFS_INODE_BMAP_SIZE];
97#define i_device_code i_bmap[0]
98 __le64 i_xattr;
99 __le32 i_generation;
100 __le32 i_pad;
101};
102
103/**
104 * struct nilfs_super_root - structure of super root
105 * @sr_sum: check sum
106 * @sr_bytes: byte count of the structure
107 * @sr_flags: flags (reserved)
108 * @sr_nongc_ctime: write time of the last segment not for cleaner operation
109 * @sr_dat: DAT file inode
110 * @sr_cpfile: checkpoint file inode
111 * @sr_sufile: segment usage file inode
112 */
113struct nilfs_super_root {
114 __le32 sr_sum;
115 __le16 sr_bytes;
116 __le16 sr_flags;
117 __le64 sr_nongc_ctime;
118 struct nilfs_inode sr_dat;
119 struct nilfs_inode sr_cpfile;
120 struct nilfs_inode sr_sufile;
121};
122
123#define NILFS_SR_MDT_OFFSET(inode_size, i) \
124 ((unsigned long)&((struct nilfs_super_root *)0)->sr_dat + \
125 (inode_size) * (i))
126#define NILFS_SR_DAT_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 0)
127#define NILFS_SR_CPFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 1)
128#define NILFS_SR_SUFILE_OFFSET(inode_size) NILFS_SR_MDT_OFFSET(inode_size, 2)
129#define NILFS_SR_BYTES (sizeof(struct nilfs_super_root))
130
131/*
132 * Maximal mount counts
133 */
134#define NILFS_DFL_MAX_MNT_COUNT 50 /* 50 mounts */
135
136/*
137 * File system states (sbp->s_state, nilfs->ns_mount_state)
138 */
139#define NILFS_VALID_FS 0x0001 /* Unmounted cleanly */
140#define NILFS_ERROR_FS 0x0002 /* Errors detected */
141#define NILFS_RESIZE_FS 0x0004 /* Resize required */
142
143/*
144 * Mount flags (sbi->s_mount_opt)
145 */
146#define NILFS_MOUNT_ERROR_MODE 0x0070 /* Error mode mask */
147#define NILFS_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */
148#define NILFS_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */
149#define NILFS_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
150#define NILFS_MOUNT_SNAPSHOT 0x0080 /* Snapshot flag */
151#define NILFS_MOUNT_BARRIER 0x1000 /* Use block barriers */
152#define NILFS_MOUNT_STRICT_ORDER 0x2000 /* Apply strict in-order
153 semantics also for data */
154
155
156/**
157 * struct nilfs_super_block - structure of super block on disk
158 */
159struct nilfs_super_block {
160 __le32 s_rev_level; /* Revision level */
161 __le16 s_minor_rev_level; /* minor revision level */
162 __le16 s_magic; /* Magic signature */
163
164 __le16 s_bytes; /* Bytes count of CRC calculation
165 for this structure. s_reserved
166 is excluded. */
167 __le16 s_flags; /* flags */
168 __le32 s_crc_seed; /* Seed value of CRC calculation */
169 __le32 s_sum; /* Check sum of super block */
170
171 __le32 s_log_block_size; /* Block size represented as follows
172 blocksize =
173 1 << (s_log_block_size + 10) */
174 __le64 s_nsegments; /* Number of segments in filesystem */
175 __le64 s_dev_size; /* block device size in bytes */
176 __le64 s_first_data_block; /* 1st seg disk block number */
177 __le32 s_blocks_per_segment; /* number of blocks per full segment */
178 __le32 s_r_segments_percentage; /* Reserved segments percentage */
179
180 __le64 s_last_cno; /* Last checkpoint number */
181 __le64 s_last_pseg; /* disk block addr pseg written last */
182 __le64 s_last_seq; /* seq. number of seg written last */
183 __le64 s_free_blocks_count; /* Free blocks count */
184
185 __le64 s_ctime; /* Creation time (execution time of
186 newfs) */
187 __le64 s_mtime; /* Mount time */
188 __le64 s_wtime; /* Write time */
189 __le16 s_mnt_count; /* Mount count */
190 __le16 s_max_mnt_count; /* Maximal mount count */
191 __le16 s_state; /* File system state */
192 __le16 s_errors; /* Behaviour when detecting errors */
193 __le64 s_lastcheck; /* time of last check */
194
195 __le32 s_checkinterval; /* max. time between checks */
196 __le32 s_creator_os; /* OS */
197 __le16 s_def_resuid; /* Default uid for reserved blocks */
198 __le16 s_def_resgid; /* Default gid for reserved blocks */
199 __le32 s_first_ino; /* First non-reserved inode */
200
201 __le16 s_inode_size; /* Size of an inode */
202 __le16 s_dat_entry_size; /* Size of a dat entry */
203 __le16 s_checkpoint_size; /* Size of a checkpoint */
204 __le16 s_segment_usage_size; /* Size of a segment usage */
205
206 __u8 s_uuid[16]; /* 128-bit uuid for volume */
207 char s_volume_name[16]; /* volume name */
208 char s_last_mounted[64]; /* directory where last mounted */
209
210 __le32 s_c_interval; /* Commit interval of segment */
211 __le32 s_c_block_max; /* Threshold of data amount for
212 the segment construction */
213 __u32 s_reserved[192]; /* padding to the end of the block */
214};
215
216/*
217 * Codes for operating systems
218 */
219#define NILFS_OS_LINUX 0
220/* Codes from 1 to 4 are reserved to keep compatibility with ext2 creator-OS */
221
222/*
223 * Revision levels
224 */
225#define NILFS_CURRENT_REV 2 /* current major revision */
226#define NILFS_MINOR_REV 0 /* minor revision */
227
228/*
229 * Bytes count of super_block for CRC-calculation
230 */
231#define NILFS_SB_BYTES \
232 ((long)&((struct nilfs_super_block *)0)->s_reserved)
233
234/*
235 * Special inode number
236 */
237#define NILFS_ROOT_INO 2 /* Root file inode */
238#define NILFS_DAT_INO 3 /* DAT file */
239#define NILFS_CPFILE_INO 4 /* checkpoint file */
240#define NILFS_SUFILE_INO 5 /* segment usage file */
241#define NILFS_IFILE_INO 6 /* ifile */
242#define NILFS_ATIME_INO 7 /* Atime file (reserved) */
243#define NILFS_XATTR_INO 8 /* Xattribute file (reserved) */
244#define NILFS_SKETCH_INO 10 /* Sketch file */
245#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
246
247#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
248#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
249
250#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
251 a full segment */
252#define NILFS_PSEG_MIN_BLOCKS 2 /* Minimum number of blocks in
253 a partial segment */
254#define NILFS_MIN_NRSVSEGS 8 /* Minimum number of reserved
255 segments */
256
257/*
258 * bytes offset of secondary super block
259 */
260#define NILFS_SB2_OFFSET_BYTES(devsize) ((((devsize) >> 12) - 1) << 12)
261
262/*
263 * Maximal count of links to a file
264 */
265#define NILFS_LINK_MAX 32000
266
267/*
268 * Structure of a directory entry
269 * (Same as ext2)
270 */
271
272#define NILFS_NAME_LEN 255
273
274/*
275 * The new version of the directory entry. Since V0 structures are
276 * stored in intel byte order, and the name_len field could never be
277 * bigger than 255 chars, it's safe to reclaim the extra byte for the
278 * file_type field.
279 */
280struct nilfs_dir_entry {
281 __le64 inode; /* Inode number */
282 __le16 rec_len; /* Directory entry length */
283 __u8 name_len; /* Name length */
284 __u8 file_type;
285 char name[NILFS_NAME_LEN]; /* File name */
286 char pad;
287};
288
289/*
290 * NILFS directory file types. Only the low 3 bits are used. The
291 * other bits are reserved for now.
292 */
293enum {
294 NILFS_FT_UNKNOWN,
295 NILFS_FT_REG_FILE,
296 NILFS_FT_DIR,
297 NILFS_FT_CHRDEV,
298 NILFS_FT_BLKDEV,
299 NILFS_FT_FIFO,
300 NILFS_FT_SOCK,
301 NILFS_FT_SYMLINK,
302 NILFS_FT_MAX
303};
304
305/*
306 * NILFS_DIR_PAD defines the directory entries boundaries
307 *
308 * NOTE: It must be a multiple of 8
309 */
310#define NILFS_DIR_PAD 8
311#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
312#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \
313 ~NILFS_DIR_ROUND)
314
315
316/**
317 * struct nilfs_finfo - file information
318 * @fi_ino: inode number
319 * @fi_cno: checkpoint number
320 * @fi_nblocks: number of blocks (including intermediate blocks)
321 * @fi_ndatablk: number of file data blocks
322 */
323struct nilfs_finfo {
324 __le64 fi_ino;
325 __le64 fi_cno;
326 __le32 fi_nblocks;
327 __le32 fi_ndatablk;
328 /* array of virtual block numbers */
329};
330
331/**
332 * struct nilfs_binfo_v - information for the block to which a virtual block number is assigned
333 * @bi_vblocknr: virtual block number
334 * @bi_blkoff: block offset
335 */
336struct nilfs_binfo_v {
337 __le64 bi_vblocknr;
338 __le64 bi_blkoff;
339};
340
341/**
342 * struct nilfs_binfo_dat - information for the block which belongs to the DAT file
343 * @bi_blkoff: block offset
344 * @bi_level: level
345 * @bi_pad: padding
346 */
347struct nilfs_binfo_dat {
348 __le64 bi_blkoff;
349 __u8 bi_level;
350 __u8 bi_pad[7];
351};
352
353/**
354 * union nilfs_binfo: block information
355 * @bi_v: nilfs_binfo_v structure
356 * @bi_dat: nilfs_binfo_dat structure
357 */
358union nilfs_binfo {
359 struct nilfs_binfo_v bi_v;
360 struct nilfs_binfo_dat bi_dat;
361};
362
363/**
364 * struct nilfs_segment_summary - segment summary
365 * @ss_datasum: checksum of data
366 * @ss_sumsum: checksum of segment summary
367 * @ss_magic: magic number
368 * @ss_bytes: size of this structure in bytes
369 * @ss_flags: flags
370 * @ss_seq: sequence number
371 * @ss_create: creation timestamp
372 * @ss_next: next segment
373 * @ss_nblocks: number of blocks
374 * @ss_nfinfo: number of finfo structures
375 * @ss_sumbytes: total size of segment summary in bytes
376 * @ss_pad: padding
377 */
378struct nilfs_segment_summary {
379 __le32 ss_datasum;
380 __le32 ss_sumsum;
381 __le32 ss_magic;
382 __le16 ss_bytes;
383 __le16 ss_flags;
384 __le64 ss_seq;
385 __le64 ss_create;
386 __le64 ss_next;
387 __le32 ss_nblocks;
388 __le32 ss_nfinfo;
389 __le32 ss_sumbytes;
390 __le32 ss_pad;
391 /* array of finfo structures */
392};
393
394#define NILFS_SEGSUM_MAGIC 0x1eaffa11 /* segment summary magic number */
395
396/*
397 * Segment summary flags
398 */
399#define NILFS_SS_LOGBGN 0x0001 /* begins a logical segment */
400#define NILFS_SS_LOGEND 0x0002 /* ends a logical segment */
401#define NILFS_SS_SR 0x0004 /* has super root */
402#define NILFS_SS_SYNDT 0x0008 /* includes data only updates */
403#define NILFS_SS_GC 0x0010 /* segment written for cleaner operation */
404
405/**
406 * struct nilfs_palloc_group_desc - block group descriptor
407 * @pg_nfrees: number of free entries in block group
408 */
409struct nilfs_palloc_group_desc {
410 __le32 pg_nfrees;
411};
412
413/**
414 * struct nilfs_dat_entry - disk address translation entry
415 * @dt_blocknr: block number
416 * @dt_start: start checkpoint number
417 * @dt_end: end checkpoint number
418 * @dt_rsv: reserved for future use
419 */
420struct nilfs_dat_entry {
421 __le64 de_blocknr;
422 __le64 de_start;
423 __le64 de_end;
424 __le64 de_rsv;
425};
426
427/**
428 * struct nilfs_dat_group_desc - block group descriptor
429 * @dg_nfrees: number of free virtual block numbers in block group
430 */
431struct nilfs_dat_group_desc {
432 __le32 dg_nfrees;
433};
434
435
436/**
437 * struct nilfs_snapshot_list - snapshot list
438 * @ssl_next: next checkpoint number on snapshot list
439 * @ssl_prev: previous checkpoint number on snapshot list
440 */
441struct nilfs_snapshot_list {
442 __le64 ssl_next;
443 __le64 ssl_prev;
444};
445
446/**
447 * struct nilfs_checkpoint - checkpoint structure
448 * @cp_flags: flags
449 * @cp_checkpoints_count: checkpoints count in a block
450 * @cp_snapshot_list: snapshot list
451 * @cp_cno: checkpoint number
452 * @cp_create: creation timestamp
453 * @cp_nblk_inc: number of blocks incremented by this checkpoint
454 * @cp_inodes_count: inodes count
455 * @cp_blocks_count: blocks count
456 * @cp_ifile_inode: inode of ifile
457 */
458struct nilfs_checkpoint {
459 __le32 cp_flags;
460 __le32 cp_checkpoints_count;
461 struct nilfs_snapshot_list cp_snapshot_list;
462 __le64 cp_cno;
463 __le64 cp_create;
464 __le64 cp_nblk_inc;
465 __le64 cp_inodes_count;
466 __le64 cp_blocks_count; /* Reserved (might be deleted) */
467
468 /* Do not change the byte offset of ifile inode.
469 To keep the compatibility of the disk format,
470 additional fields should be added behind cp_ifile_inode. */
471 struct nilfs_inode cp_ifile_inode;
472};
473
474/* checkpoint flags */
475enum {
476 NILFS_CHECKPOINT_SNAPSHOT,
477 NILFS_CHECKPOINT_INVALID,
478 NILFS_CHECKPOINT_SKETCH,
479 NILFS_CHECKPOINT_MINOR,
480};
481
482#define NILFS_CHECKPOINT_FNS(flag, name) \
483static inline void \
484nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \
485{ \
486 cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \
487 (1UL << NILFS_CHECKPOINT_##flag)); \
488} \
489static inline void \
490nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \
491{ \
492 cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \
493 ~(1UL << NILFS_CHECKPOINT_##flag)); \
494} \
495static inline int \
496nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \
497{ \
498 return !!(le32_to_cpu(cp->cp_flags) & \
499 (1UL << NILFS_CHECKPOINT_##flag)); \
500}
501
502NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
503NILFS_CHECKPOINT_FNS(INVALID, invalid)
504NILFS_CHECKPOINT_FNS(MINOR, minor)
505
506/**
507 * struct nilfs_cpinfo - checkpoint information
508 * @ci_flags: flags
509 * @ci_pad: padding
510 * @ci_cno: checkpoint number
511 * @ci_create: creation timestamp
512 * @ci_nblk_inc: number of blocks incremented by this checkpoint
513 * @ci_inodes_count: inodes count
514 * @ci_blocks_count: blocks count
515 * @ci_next: next checkpoint number in snapshot list
516 */
517struct nilfs_cpinfo {
518 __u32 ci_flags;
519 __u32 ci_pad;
520 __u64 ci_cno;
521 __u64 ci_create;
522 __u64 ci_nblk_inc;
523 __u64 ci_inodes_count;
524 __u64 ci_blocks_count;
525 __u64 ci_next;
526};
527
528#define NILFS_CPINFO_FNS(flag, name) \
529static inline int \
530nilfs_cpinfo_##name(const struct nilfs_cpinfo *cpinfo) \
531{ \
532 return !!(cpinfo->ci_flags & (1UL << NILFS_CHECKPOINT_##flag)); \
533}
534
535NILFS_CPINFO_FNS(SNAPSHOT, snapshot)
536NILFS_CPINFO_FNS(INVALID, invalid)
537NILFS_CPINFO_FNS(MINOR, minor)
538
539
540/**
541 * struct nilfs_cpfile_header - checkpoint file header
542 * @ch_ncheckpoints: number of checkpoints
543 * @ch_nsnapshots: number of snapshots
544 * @ch_snapshot_list: snapshot list
545 */
546struct nilfs_cpfile_header {
547 __le64 ch_ncheckpoints;
548 __le64 ch_nsnapshots;
549 struct nilfs_snapshot_list ch_snapshot_list;
550};
551
552#define NILFS_CPFILE_FIRST_CHECKPOINT_OFFSET \
553 ((sizeof(struct nilfs_cpfile_header) + \
554 sizeof(struct nilfs_checkpoint) - 1) / \
555 sizeof(struct nilfs_checkpoint))
556
557/**
558 * struct nilfs_segment_usage - segment usage
559 * @su_lastmod: last modified timestamp
560 * @su_nblocks: number of blocks in segment
561 * @su_flags: flags
562 */
563struct nilfs_segment_usage {
564 __le64 su_lastmod;
565 __le32 su_nblocks;
566 __le32 su_flags;
567};
568
569/* segment usage flag */
570enum {
571 NILFS_SEGMENT_USAGE_ACTIVE,
572 NILFS_SEGMENT_USAGE_DIRTY,
573 NILFS_SEGMENT_USAGE_ERROR,
574
575 /* ... */
576};
577
578#define NILFS_SEGMENT_USAGE_FNS(flag, name) \
579static inline void \
580nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \
581{ \
582 su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \
583 (1UL << NILFS_SEGMENT_USAGE_##flag));\
584} \
585static inline void \
586nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \
587{ \
588 su->su_flags = \
589 cpu_to_le32(le32_to_cpu(su->su_flags) & \
590 ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \
591} \
592static inline int \
593nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \
594{ \
595 return !!(le32_to_cpu(su->su_flags) & \
596 (1UL << NILFS_SEGMENT_USAGE_##flag)); \
597}
598
599NILFS_SEGMENT_USAGE_FNS(ACTIVE, active)
600NILFS_SEGMENT_USAGE_FNS(DIRTY, dirty)
601NILFS_SEGMENT_USAGE_FNS(ERROR, error)
602
603static inline void
604nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su)
605{
606 su->su_lastmod = cpu_to_le64(0);
607 su->su_nblocks = cpu_to_le32(0);
608 su->su_flags = cpu_to_le32(0);
609}
610
611static inline int
612nilfs_segment_usage_clean(const struct nilfs_segment_usage *su)
613{
614 return !le32_to_cpu(su->su_flags);
615}
616
617/**
618 * struct nilfs_sufile_header - segment usage file header
619 * @sh_ncleansegs: number of clean segments
620 * @sh_ndirtysegs: number of dirty segments
621 * @sh_last_alloc: last allocated segment number
622 */
623struct nilfs_sufile_header {
624 __le64 sh_ncleansegs;
625 __le64 sh_ndirtysegs;
626 __le64 sh_last_alloc;
627 /* ... */
628};
629
630#define NILFS_SUFILE_FIRST_SEGMENT_USAGE_OFFSET \
631 ((sizeof(struct nilfs_sufile_header) + \
632 sizeof(struct nilfs_segment_usage) - 1) / \
633 sizeof(struct nilfs_segment_usage))
634
635/**
636 * nilfs_suinfo - segment usage information
637 * @sui_lastmod:
638 * @sui_nblocks:
639 * @sui_flags:
640 */
641struct nilfs_suinfo {
642 __u64 sui_lastmod;
643 __u32 sui_nblocks;
644 __u32 sui_flags;
645};
646
647#define NILFS_SUINFO_FNS(flag, name) \
648static inline int \
649nilfs_suinfo_##name(const struct nilfs_suinfo *si) \
650{ \
651 return si->sui_flags & (1UL << NILFS_SEGMENT_USAGE_##flag); \
652}
653
654NILFS_SUINFO_FNS(ACTIVE, active)
655NILFS_SUINFO_FNS(DIRTY, dirty)
656NILFS_SUINFO_FNS(ERROR, error)
657
658static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si)
659{
660 return !si->sui_flags;
661}
662
663/* ioctl */
664enum {
665 NILFS_CHECKPOINT,
666 NILFS_SNAPSHOT,
667};
668
669/**
670 * struct nilfs_cpmode -
671 * @cc_cno:
672 * @cc_mode:
673 */
674struct nilfs_cpmode {
675 __u64 cm_cno;
676 __u32 cm_mode;
677 __u32 cm_pad;
678};
679
680/**
681 * struct nilfs_argv - argument vector
682 * @v_base:
683 * @v_nmembs:
684 * @v_size:
685 * @v_flags:
686 * @v_index:
687 */
688struct nilfs_argv {
689 __u64 v_base;
690 __u32 v_nmembs; /* number of members */
691 __u16 v_size; /* size of members */
692 __u16 v_flags;
693 __u64 v_index;
694};
695
696/**
697 * struct nilfs_period -
698 * @p_start:
699 * @p_end:
700 */
701struct nilfs_period {
702 __u64 p_start;
703 __u64 p_end;
704};
705
706/**
707 * struct nilfs_cpstat -
708 * @cs_cno: checkpoint number
709 * @cs_ncps: number of checkpoints
710 * @cs_nsss: number of snapshots
711 */
712struct nilfs_cpstat {
713 __u64 cs_cno;
714 __u64 cs_ncps;
715 __u64 cs_nsss;
716};
717
718/**
719 * struct nilfs_sustat -
720 * @ss_nsegs: number of segments
721 * @ss_ncleansegs: number of clean segments
722 * @ss_ndirtysegs: number of dirty segments
723 * @ss_ctime: creation time of the last segment
724 * @ss_nongc_ctime: creation time of the last segment not for GC
725 * @ss_prot_seq: least sequence number of segments which must not be reclaimed
726 */
727struct nilfs_sustat {
728 __u64 ss_nsegs;
729 __u64 ss_ncleansegs;
730 __u64 ss_ndirtysegs;
731 __u64 ss_ctime;
732 __u64 ss_nongc_ctime;
733 __u64 ss_prot_seq;
734};
735
736/**
737 * struct nilfs_vinfo - virtual block number information
738 * @vi_vblocknr:
739 * @vi_start:
740 * @vi_end:
741 * @vi_blocknr:
742 */
743struct nilfs_vinfo {
744 __u64 vi_vblocknr;
745 __u64 vi_start;
746 __u64 vi_end;
747 __u64 vi_blocknr;
748};
749
750/**
751 * struct nilfs_vdesc -
752 */
753struct nilfs_vdesc {
754 __u64 vd_ino;
755 __u64 vd_cno;
756 __u64 vd_vblocknr;
757 struct nilfs_period vd_period;
758 __u64 vd_blocknr;
759 __u64 vd_offset;
760 __u32 vd_flags;
761 __u32 vd_pad;
762};
763
764/**
765 * struct nilfs_bdesc -
766 */
767struct nilfs_bdesc {
768 __u64 bd_ino;
769 __u64 bd_oblocknr;
770 __u64 bd_blocknr;
771 __u64 bd_offset;
772 __u32 bd_level;
773 __u32 bd_pad;
774};
775
776#define NILFS_IOCTL_IDENT 'n'
777
778#define NILFS_IOCTL_CHANGE_CPMODE \
779 _IOW(NILFS_IOCTL_IDENT, 0x80, struct nilfs_cpmode)
780#define NILFS_IOCTL_DELETE_CHECKPOINT \
781 _IOW(NILFS_IOCTL_IDENT, 0x81, __u64)
782#define NILFS_IOCTL_GET_CPINFO \
783 _IOR(NILFS_IOCTL_IDENT, 0x82, struct nilfs_argv)
784#define NILFS_IOCTL_GET_CPSTAT \
785 _IOR(NILFS_IOCTL_IDENT, 0x83, struct nilfs_cpstat)
786#define NILFS_IOCTL_GET_SUINFO \
787 _IOR(NILFS_IOCTL_IDENT, 0x84, struct nilfs_argv)
788#define NILFS_IOCTL_GET_SUSTAT \
789 _IOR(NILFS_IOCTL_IDENT, 0x85, struct nilfs_sustat)
790#define NILFS_IOCTL_GET_VINFO \
791 _IOWR(NILFS_IOCTL_IDENT, 0x86, struct nilfs_argv)
792#define NILFS_IOCTL_GET_BDESCS \
793 _IOWR(NILFS_IOCTL_IDENT, 0x87, struct nilfs_argv)
794#define NILFS_IOCTL_CLEAN_SEGMENTS \
795 _IOW(NILFS_IOCTL_IDENT, 0x88, struct nilfs_argv[5])
796#define NILFS_IOCTL_SYNC \
797 _IOR(NILFS_IOCTL_IDENT, 0x8A, __u64)
798#define NILFS_IOCTL_RESIZE \
799 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
800
801#endif /* _LINUX_NILFS_FS_H */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e86ed59f9ad5..cbe8ce3bf486 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -47,7 +47,7 @@
47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or 49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET. 50 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
53 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -72,8 +72,8 @@
72 * 72 *
73 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified 73 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
74 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. 74 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or 75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
76 * %NL80211_ATTR_KEY_THRESHOLD. 76 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER 78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
79 * attributes. 79 * attributes.
@@ -84,7 +84,7 @@
84 * %NL80222_CMD_NEW_BEACON message) 84 * %NL80222_CMD_NEW_BEACON message)
85 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface 85 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
86 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, 86 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
87 * %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes. 87 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
88 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 88 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
89 * parameters are like for %NL80211_CMD_SET_BEACON. 89 * parameters are like for %NL80211_CMD_SET_BEACON.
90 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it 90 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -113,6 +113,8 @@
113 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by 113 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
114 * %NL80211_ATTR_IFINDEX. 114 * %NL80211_ATTR_IFINDEX.
115 * 115 *
116 * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
117 * regulatory domain.
116 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command 118 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
117 * after being queried by the kernel. CRDA replies by sending a regulatory 119 * after being queried by the kernel. CRDA replies by sending a regulatory
118 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our 120 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
@@ -133,6 +135,70 @@
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the 135 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX 136 * interface identified by %NL80211_ATTR_IFINDEX
135 * 137 *
138 * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
139 * interface is identified with %NL80211_ATTR_IFINDEX and the management
140 * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
141 * added to the end of the specified management frame is specified with
142 * %NL80211_ATTR_IE. If the command succeeds, the requested data will be
143 * added to all specified management frames generated by
144 * kernel/firmware/driver.
145 * Note: This command has been removed and it is only reserved at this
146 * point to avoid re-using existing command number. The functionality this
147 * command was planned for has been provided with cleaner design with the
148 * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN,
149 * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE,
150 * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE.
151 *
152 * @NL80211_CMD_GET_SCAN: get scan results
153 * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
154 * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
155 * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
156 * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
157 * partial scan results may be available
158 *
159 * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
160 * has been changed and provides details of the request information
161 * that caused the change such as who initiated the regulatory request
162 * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx
163 * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if
164 * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or
165 * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain
166 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
167 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
168 * to (%NL80211_ATTR_REG_ALPHA2).
169 *
170 * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
171 * This command is used both as a command (request to authenticate) and
172 * as an event on the "mlme" multicast group indicating completion of the
173 * authentication process.
174 * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
175 * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
176 * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
177 * the SSID (mainly for association, but is included in authentication
178 * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used
179 * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE
180 * is used to specify the authentication type. %NL80211_ATTR_IE is used to
181 * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs)
182 * to be added to the frame.
183 * When used as an event, this reports reception of an Authentication
184 * frame in station and IBSS modes when the local MLME processed the
185 * frame, i.e., it was for the local STA and was received in correct
186 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
187 * MLME SAP interface (kernel providing MLME, userspace SME). The
188 * included NL80211_ATTR_FRAME attribute contains the management frame
189 * (including both the header and frame body, but not FCS).
190 * @NL80211_CMD_ASSOCIATE: association request and notification; like
191 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
192 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
193 * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
194 * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
195 * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
196 * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
197 * primitives).
198 * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like
199 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
200 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
201 *
136 * @NL80211_CMD_MAX: highest used command number 202 * @NL80211_CMD_MAX: highest used command number
137 * @__NL80211_CMD_AFTER_LAST: internal use 203 * @__NL80211_CMD_AFTER_LAST: internal use
138 */ 204 */
@@ -178,6 +244,22 @@ enum nl80211_commands {
178 NL80211_CMD_GET_MESH_PARAMS, 244 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS, 245 NL80211_CMD_SET_MESH_PARAMS,
180 246
247 NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
248
249 NL80211_CMD_GET_REG,
250
251 NL80211_CMD_GET_SCAN,
252 NL80211_CMD_TRIGGER_SCAN,
253 NL80211_CMD_NEW_SCAN_RESULTS,
254 NL80211_CMD_SCAN_ABORTED,
255
256 NL80211_CMD_REG_CHANGE,
257
258 NL80211_CMD_AUTHENTICATE,
259 NL80211_CMD_ASSOCIATE,
260 NL80211_CMD_DEAUTHENTICATE,
261 NL80211_CMD_DISASSOCIATE,
262
181 /* add new commands above here */ 263 /* add new commands above here */
182 264
183 /* used to define NL80211_CMD_MAX below */ 265 /* used to define NL80211_CMD_MAX below */
@@ -190,6 +272,12 @@ enum nl80211_commands {
190 * here 272 * here
191 */ 273 */
192#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS 274#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
275#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE
276#define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE
277#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE
278#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
279#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
280#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
193 281
194/** 282/**
195 * enum nl80211_attrs - nl80211 netlink attributes 283 * enum nl80211_attrs - nl80211 netlink attributes
@@ -284,6 +372,42 @@ enum nl80211_commands {
284 * supported interface types, each a flag attribute with the number 372 * supported interface types, each a flag attribute with the number
285 * of the interface mode. 373 * of the interface mode.
286 * 374 *
375 * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for
376 * %NL80211_CMD_SET_MGMT_EXTRA_IE.
377 *
378 * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with
379 * %NL80211_CMD_SET_MGMT_EXTRA_IE).
380 *
381 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
382 * a single scan request, a wiphy attribute.
383 *
384 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
385 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
386 * scanning and include a zero-length SSID (wildcard) for wildcard scan
387 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
388 * scan result list changes (BSS expired or added) so that applications
389 * can verify that they got a single, consistent snapshot (when all dump
390 * messages carried the same generation number)
391 * @NL80211_ATTR_BSS: scan result BSS
392 *
393 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
394 * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_*
395 * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently
396 * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*)
397 *
398 * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies
399 * an array of command numbers (i.e. a mapping index to command number)
400 * that the driver for the given wiphy supports.
401 *
402 * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header
403 * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and
404 * NL80211_CMD_ASSOCIATE events
405 * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets)
406 * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type,
407 * represented as a u32
408 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
409 * %NL80211_CMD_DISASSOCIATE, u16
410 *
287 * @NL80211_ATTR_MAX: highest attribute number currently defined 411 * @NL80211_ATTR_MAX: highest attribute number currently defined
288 * @__NL80211_ATTR_AFTER_LAST: internal use 412 * @__NL80211_ATTR_AFTER_LAST: internal use
289 */ 413 */
@@ -346,6 +470,28 @@ enum nl80211_attrs {
346 NL80211_ATTR_WIPHY_FREQ, 470 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE, 471 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348 472
473 NL80211_ATTR_KEY_DEFAULT_MGMT,
474
475 NL80211_ATTR_MGMT_SUBTYPE,
476 NL80211_ATTR_IE,
477
478 NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
479
480 NL80211_ATTR_SCAN_FREQUENCIES,
481 NL80211_ATTR_SCAN_SSIDS,
482 NL80211_ATTR_SCAN_GENERATION,
483 NL80211_ATTR_BSS,
484
485 NL80211_ATTR_REG_INITIATOR,
486 NL80211_ATTR_REG_TYPE,
487
488 NL80211_ATTR_SUPPORTED_COMMANDS,
489
490 NL80211_ATTR_FRAME,
491 NL80211_ATTR_SSID,
492 NL80211_ATTR_AUTH_TYPE,
493 NL80211_ATTR_REASON_CODE,
494
349 /* add attributes here, update the policy in nl80211.c */ 495 /* add attributes here, update the policy in nl80211.c */
350 496
351 __NL80211_ATTR_AFTER_LAST, 497 __NL80211_ATTR_AFTER_LAST,
@@ -360,7 +506,15 @@ enum nl80211_attrs {
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES 506#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS 507#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ 508#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET 509#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE
510#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE
511#define NL80211_ATTR_IE NL80211_ATTR_IE
512#define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR
513#define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE
514#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME
515#define NL80211_ATTR_SSID NL80211_ATTR_SSID
516#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
517#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
364 518
365#define NL80211_MAX_SUPP_RATES 32 519#define NL80211_MAX_SUPP_RATES 32
366#define NL80211_MAX_SUPP_REG_RULES 32 520#define NL80211_MAX_SUPP_REG_RULES 32
@@ -412,12 +566,14 @@ enum nl80211_iftype {
412 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 566 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
413 * with short barker preamble 567 * with short barker preamble
414 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 568 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
569 * @NL80211_STA_FLAG_MFP: station uses management frame protection
415 */ 570 */
416enum nl80211_sta_flags { 571enum nl80211_sta_flags {
417 __NL80211_STA_FLAG_INVALID, 572 __NL80211_STA_FLAG_INVALID,
418 NL80211_STA_FLAG_AUTHORIZED, 573 NL80211_STA_FLAG_AUTHORIZED,
419 NL80211_STA_FLAG_SHORT_PREAMBLE, 574 NL80211_STA_FLAG_SHORT_PREAMBLE,
420 NL80211_STA_FLAG_WME, 575 NL80211_STA_FLAG_WME,
576 NL80211_STA_FLAG_MFP,
421 577
422 /* keep last */ 578 /* keep last */
423 __NL80211_STA_FLAG_AFTER_LAST, 579 __NL80211_STA_FLAG_AFTER_LAST,
@@ -465,6 +621,9 @@ enum nl80211_rate_info {
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) 621 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute 622 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate. 623 * containing info as possible, see &enum nl80211_sta_info_txrate.
624 * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
625 * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
626 * station)
468 */ 627 */
469enum nl80211_sta_info { 628enum nl80211_sta_info {
470 __NL80211_STA_INFO_INVALID, 629 __NL80211_STA_INFO_INVALID,
@@ -476,6 +635,8 @@ enum nl80211_sta_info {
476 NL80211_STA_INFO_PLINK_STATE, 635 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL, 636 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE, 637 NL80211_STA_INFO_TX_BITRATE,
638 NL80211_STA_INFO_RX_PACKETS,
639 NL80211_STA_INFO_TX_PACKETS,
479 640
480 /* keep last */ 641 /* keep last */
481 __NL80211_STA_INFO_AFTER_LAST, 642 __NL80211_STA_INFO_AFTER_LAST,
@@ -607,6 +768,48 @@ enum nl80211_bitrate_attr {
607}; 768};
608 769
609/** 770/**
771 * enum nl80211_initiator - Indicates the initiator of a reg domain request
772 * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world
773 * regulatory domain.
774 * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the
775 * regulatory domain.
776 * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the
777 * wireless core it thinks its knows the regulatory domain we should be in.
778 * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an
779 * 802.11 country information element with regulatory information it
780 * thinks we should consider.
781 */
782enum nl80211_reg_initiator {
783 NL80211_REGDOM_SET_BY_CORE,
784 NL80211_REGDOM_SET_BY_USER,
785 NL80211_REGDOM_SET_BY_DRIVER,
786 NL80211_REGDOM_SET_BY_COUNTRY_IE,
787};
788
789/**
790 * enum nl80211_reg_type - specifies the type of regulatory domain
791 * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains
792 * to a specific country. When this is set you can count on the
793 * ISO / IEC 3166 alpha2 country code being valid.
794 * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory
795 * domain.
796 * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom
797 * driver specific world regulatory domain. These do not apply system-wide
798 * and are only applicable to the individual devices which have requested
799 * them to be applied.
800 * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product
801 * of an intersection between two regulatory domains -- the previously
802 * set regulatory domain on the system and the last accepted regulatory
803 * domain request to be processed.
804 */
805enum nl80211_reg_type {
806 NL80211_REGDOM_TYPE_COUNTRY,
807 NL80211_REGDOM_TYPE_WORLD,
808 NL80211_REGDOM_TYPE_CUSTOM_WORLD,
809 NL80211_REGDOM_TYPE_INTERSECTION,
810};
811
812/**
610 * enum nl80211_reg_rule_attr - regulatory rule attributes 813 * enum nl80211_reg_rule_attr - regulatory rule attributes
611 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional 814 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
612 * considerations for a given frequency range. These are the 815 * considerations for a given frequency range. These are the
@@ -811,4 +1014,52 @@ enum nl80211_channel_type {
811 NL80211_CHAN_HT40MINUS, 1014 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS 1015 NL80211_CHAN_HT40PLUS
813}; 1016};
1017
1018/**
1019 * enum nl80211_bss - netlink attributes for a BSS
1020 *
1021 * @__NL80211_BSS_INVALID: invalid
1022 * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
1023 * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
1024 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
1025 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
1026 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
1027 * raw information elements from the probe response/beacon (bin)
1028 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
1029 * in mBm (100 * dBm) (s32)
1030 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
1031 * in unspecified units, scaled to 0..100 (u8)
1032 * @__NL80211_BSS_AFTER_LAST: internal
1033 * @NL80211_BSS_MAX: highest BSS attribute
1034 */
1035enum nl80211_bss {
1036 __NL80211_BSS_INVALID,
1037 NL80211_BSS_BSSID,
1038 NL80211_BSS_FREQUENCY,
1039 NL80211_BSS_TSF,
1040 NL80211_BSS_BEACON_INTERVAL,
1041 NL80211_BSS_CAPABILITY,
1042 NL80211_BSS_INFORMATION_ELEMENTS,
1043 NL80211_BSS_SIGNAL_MBM,
1044 NL80211_BSS_SIGNAL_UNSPEC,
1045
1046 /* keep last */
1047 __NL80211_BSS_AFTER_LAST,
1048 NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
1049};
1050
1051/**
1052 * enum nl80211_auth_type - AuthenticationType
1053 *
1054 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
1055 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
1056 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
1057 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
1058 */
1059enum nl80211_auth_type {
1060 NL80211_AUTHTYPE_OPEN_SYSTEM,
1061 NL80211_AUTHTYPE_SHARED_KEY,
1062 NL80211_AUTHTYPE_FT,
1063 NL80211_AUTHTYPE_NETWORK_EAP,
1064};
814#endif /* __LINUX_NL80211_H */ 1065#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index afad7dec1b36..7b370c7cfeff 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -8,6 +8,7 @@ struct mnt_namespace;
8struct uts_namespace; 8struct uts_namespace;
9struct ipc_namespace; 9struct ipc_namespace;
10struct pid_namespace; 10struct pid_namespace;
11struct fs_struct;
11 12
12/* 13/*
13 * A structure to contain pointers to all per-process 14 * A structure to contain pointers to all per-process
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
new file mode 100644
index 000000000000..b0638fd91e92
--- /dev/null
+++ b/include/linux/page-debug-flags.h
@@ -0,0 +1,30 @@
1#ifndef LINUX_PAGE_DEBUG_FLAGS_H
2#define LINUX_PAGE_DEBUG_FLAGS_H
3
4/*
5 * page->debug_flags bits:
6 *
7 * PAGE_DEBUG_FLAG_POISON is set for poisoned pages. This is used to
8 * implement generic debug pagealloc feature. The pages are filled with
9 * poison patterns and set this flag after free_pages(). The poisoned
10 * pages are verified whether the patterns are not corrupted and clear
11 * the flag before alloc_pages().
12 */
13
14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16};
17
18/*
19 * Ensure that CONFIG_WANT_PAGE_DEBUG_FLAGS reliably
20 * gets turned off when no debug features are enabling it!
21 */
22
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif
28#endif /* CONFIG_WANT_PAGE_DEBUG_FLAGS */
29
30#endif /* LINUX_PAGE_DEBUG_FLAGS_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 219a523ecdb0..62214c7d2d93 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -82,6 +82,7 @@ enum pageflags {
82 PG_arch_1, 82 PG_arch_1,
83 PG_reserved, 83 PG_reserved,
84 PG_private, /* If pagecache, has fs-private data */ 84 PG_private, /* If pagecache, has fs-private data */
85 PG_private_2, /* If pagecache, has fs aux data */
85 PG_writeback, /* Page is under writeback */ 86 PG_writeback, /* Page is under writeback */
86#ifdef CONFIG_PAGEFLAGS_EXTENDED 87#ifdef CONFIG_PAGEFLAGS_EXTENDED
87 PG_head, /* A head page */ 88 PG_head, /* A head page */
@@ -96,6 +97,8 @@ enum pageflags {
96 PG_swapbacked, /* Page is backed by RAM/swap */ 97 PG_swapbacked, /* Page is backed by RAM/swap */
97#ifdef CONFIG_UNEVICTABLE_LRU 98#ifdef CONFIG_UNEVICTABLE_LRU
98 PG_unevictable, /* Page is "unevictable" */ 99 PG_unevictable, /* Page is "unevictable" */
100#endif
101#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
99 PG_mlocked, /* Page is vma mlocked */ 102 PG_mlocked, /* Page is vma mlocked */
100#endif 103#endif
101#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 104#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -106,6 +109,12 @@ enum pageflags {
106 /* Filesystems */ 109 /* Filesystems */
107 PG_checked = PG_owner_priv_1, 110 PG_checked = PG_owner_priv_1,
108 111
112 /* Two page bits are conscripted by FS-Cache to maintain local caching
113 * state. These bits are set on pages belonging to the netfs's inodes
114 * when those inodes are being locally cached.
115 */
116 PG_fscache = PG_private_2, /* page backed by cache */
117
109 /* XEN */ 118 /* XEN */
110 PG_pinned = PG_owner_priv_1, 119 PG_pinned = PG_owner_priv_1,
111 PG_savepinned = PG_dirty, 120 PG_savepinned = PG_dirty,
@@ -180,7 +189,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; }
180 189
181struct page; /* forward declaration */ 190struct page; /* forward declaration */
182 191
183TESTPAGEFLAG(Locked, locked) 192TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
184PAGEFLAG(Error, error) 193PAGEFLAG(Error, error)
185PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 194PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
186PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 195PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
@@ -192,8 +201,6 @@ PAGEFLAG(Checked, checked) /* Used by some filesystems */
192PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ 201PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
193PAGEFLAG(SavePinned, savepinned); /* Xen */ 202PAGEFLAG(SavePinned, savepinned); /* Xen */
194PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 203PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
195PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
196 __SETPAGEFLAG(Private, private)
197PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 204PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
198 205
199__PAGEFLAG(SlobPage, slob_page) 206__PAGEFLAG(SlobPage, slob_page)
@@ -203,6 +210,16 @@ __PAGEFLAG(SlubFrozen, slub_frozen)
203__PAGEFLAG(SlubDebug, slub_debug) 210__PAGEFLAG(SlubDebug, slub_debug)
204 211
205/* 212/*
213 * Private page markings that may be used by the filesystem that owns the page
214 * for its own purposes.
215 * - PG_private and PG_private_2 cause releasepage() and co to be invoked
216 */
217PAGEFLAG(Private, private) __SETPAGEFLAG(Private, private)
218 __CLEARPAGEFLAG(Private, private)
219PAGEFLAG(Private2, private_2) TESTSCFLAG(Private2, private_2)
220PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1)
221
222/*
206 * Only test-and-set exist for PG_writeback. The unconditional operators are 223 * Only test-and-set exist for PG_writeback. The unconditional operators are
207 * risky: they bypass page accounting. 224 * risky: they bypass page accounting.
208 */ 225 */
@@ -234,20 +251,20 @@ PAGEFLAG_FALSE(SwapCache)
234#ifdef CONFIG_UNEVICTABLE_LRU 251#ifdef CONFIG_UNEVICTABLE_LRU
235PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 252PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
236 TESTCLEARFLAG(Unevictable, unevictable) 253 TESTCLEARFLAG(Unevictable, unevictable)
254#else
255PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
256 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
257 __CLEARPAGEFLAG_NOOP(Unevictable)
258#endif
237 259
260#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
238#define MLOCK_PAGES 1 261#define MLOCK_PAGES 1
239PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 262PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
240 TESTSCFLAG(Mlocked, mlocked) 263 TESTSCFLAG(Mlocked, mlocked)
241
242#else 264#else
243
244#define MLOCK_PAGES 0 265#define MLOCK_PAGES 0
245PAGEFLAG_FALSE(Mlocked) 266PAGEFLAG_FALSE(Mlocked)
246 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) 267 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked)
247
248PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
249 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
250 __CLEARPAGEFLAG_NOOP(Unevictable)
251#endif 268#endif
252 269
253#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 270#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -367,9 +384,13 @@ static inline void __ClearPageTail(struct page *page)
367 384
368#ifdef CONFIG_UNEVICTABLE_LRU 385#ifdef CONFIG_UNEVICTABLE_LRU
369#define __PG_UNEVICTABLE (1 << PG_unevictable) 386#define __PG_UNEVICTABLE (1 << PG_unevictable)
370#define __PG_MLOCKED (1 << PG_mlocked)
371#else 387#else
372#define __PG_UNEVICTABLE 0 388#define __PG_UNEVICTABLE 0
389#endif
390
391#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
392#define __PG_MLOCKED (1 << PG_mlocked)
393#else
373#define __PG_MLOCKED 0 394#define __PG_MLOCKED 0
374#endif 395#endif
375 396
@@ -378,9 +399,10 @@ static inline void __ClearPageTail(struct page *page)
378 * these flags set. It they are, there is a problem. 399 * these flags set. It they are, there is a problem.
379 */ 400 */
380#define PAGE_FLAGS_CHECK_AT_FREE \ 401#define PAGE_FLAGS_CHECK_AT_FREE \
381 (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ 402 (1 << PG_lru | 1 << PG_locked | \
382 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 403 1 << PG_private | 1 << PG_private_2 | \
383 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 404 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
405 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
384 __PG_UNEVICTABLE | __PG_MLOCKED) 406 __PG_UNEVICTABLE | __PG_MLOCKED)
385 407
386/* 408/*
@@ -391,4 +413,16 @@ static inline void __ClearPageTail(struct page *page)
391#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 413#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
392 414
393#endif /* !__GENERATING_BOUNDS_H */ 415#endif /* !__GENERATING_BOUNDS_H */
416
417/**
418 * page_has_private - Determine if page has private stuff
419 * @page: The page to be checked
420 *
421 * Determine if a page has private stuff, indicating that release routines
422 * should be invoked upon it.
423 */
424#define page_has_private(page) \
425 ((page)->flags & ((1 << PG_private) | \
426 (1 << PG_private_2)))
427
394#endif /* PAGE_FLAGS_H */ 428#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 602cc1fdee90..7339c7bf7331 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -91,24 +91,23 @@ static inline void page_cgroup_init(void)
91 91
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
93#include <linux/swap.h> 93#include <linux/swap.h>
94extern struct mem_cgroup * 94extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
95swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem); 95extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
96extern struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent);
97extern int swap_cgroup_swapon(int type, unsigned long max_pages); 96extern int swap_cgroup_swapon(int type, unsigned long max_pages);
98extern void swap_cgroup_swapoff(int type); 97extern void swap_cgroup_swapoff(int type);
99#else 98#else
100#include <linux/swap.h> 99#include <linux/swap.h>
101 100
102static inline 101static inline
103struct mem_cgroup *swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem) 102unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
104{ 103{
105 return NULL; 104 return 0;
106} 105}
107 106
108static inline 107static inline
109struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent) 108unsigned short lookup_swap_cgroup(swp_entry_t ent)
110{ 109{
111 return NULL; 110 return 0;
112} 111}
113 112
114static inline int 113static inline int
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 01ca0856caff..34da5230faab 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -18,9 +18,14 @@
18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
19 * allocation mode flags. 19 * allocation mode flags.
20 */ 20 */
21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 21enum mapping_flags {
22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
23#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */ 23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
25#ifdef CONFIG_UNEVICTABLE_LRU
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27#endif
28};
24 29
25static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
26{ 31{
@@ -33,7 +38,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
33} 38}
34 39
35#ifdef CONFIG_UNEVICTABLE_LRU 40#ifdef CONFIG_UNEVICTABLE_LRU
36#define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2) /* e.g., ramdisk, SHM_LOCK */
37 41
38static inline void mapping_set_unevictable(struct address_space *mapping) 42static inline void mapping_set_unevictable(struct address_space *mapping)
39{ 43{
@@ -380,6 +384,11 @@ static inline void wait_on_page_writeback(struct page *page)
380extern void end_page_writeback(struct page *page); 384extern void end_page_writeback(struct page *page);
381 385
382/* 386/*
387 * Add an arbitrary waiter to a page's wait queue
388 */
389extern void add_page_wait_queue(struct page *page, wait_queue_t *waiter);
390
391/*
383 * Fault a userspace page into pagetables. Return non-zero on a fault. 392 * Fault a userspace page into pagetables. Return non-zero on a fault.
384 * 393 *
385 * This assumes that two userspace pages are always sufficient. That's 394 * This assumes that two userspace pages are always sufficient. That's
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 7b2886fa7fdc..bab82f4c571c 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -24,7 +24,6 @@ void __pagevec_release(struct pagevec *pvec);
24void __pagevec_free(struct pagevec *pvec); 24void __pagevec_free(struct pagevec *pvec);
25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
26void pagevec_strip(struct pagevec *pvec); 26void pagevec_strip(struct pagevec *pvec);
27void pagevec_swap_free(struct pagevec *pvec);
28unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 27unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
29 pgoff_t start, unsigned nr_pages); 28 pgoff_t start, unsigned nr_pages);
30unsigned pagevec_lookup_tag(struct pagevec *pvec, 29unsigned pagevec_lookup_tag(struct pagevec *pvec,
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index ea8c6d84996d..cc1767f5cca8 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -228,10 +228,11 @@ extern void parport_pc_release_resources(struct parport *p);
228extern int parport_pc_claim_resources(struct parport *p); 228extern int parport_pc_claim_resources(struct parport *p);
229 229
230/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ 230/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */
231extern struct parport *parport_pc_probe_port (unsigned long base, 231extern struct parport *parport_pc_probe_port(unsigned long base,
232 unsigned long base_hi, 232 unsigned long base_hi,
233 int irq, int dma, 233 int irq, int dma,
234 struct device *dev); 234 struct device *dev,
235extern void parport_pc_unregister_port (struct parport *p); 235 int irqflags);
236extern void parport_pc_unregister_port(struct parport *p);
236 237
237#endif 238#endif
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 042c166f65d5..092e82e0048c 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -10,72 +10,25 @@
10 10
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#define OSC_QUERY_TYPE 0
14#define OSC_SUPPORT_TYPE 1
15#define OSC_CONTROL_TYPE 2
16#define OSC_SUPPORT_MASKS 0x1f
17
18/*
19 * _OSC DW0 Definition
20 */
21#define OSC_QUERY_ENABLE 1
22#define OSC_REQUEST_ERROR 2
23#define OSC_INVALID_UUID_ERROR 4
24#define OSC_INVALID_REVISION_ERROR 8
25#define OSC_CAPABILITIES_MASK_ERROR 16
26
27/*
28 * _OSC DW1 Definition (OS Support Fields)
29 */
30#define OSC_EXT_PCI_CONFIG_SUPPORT 1
31#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
32#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
33#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
34#define OSC_MSI_SUPPORT 16
35
36/*
37 * _OSC DW1 Definition (OS Control Fields)
38 */
39#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
40#define OSC_SHPC_NATIVE_HP_CONTROL 2
41#define OSC_PCI_EXPRESS_PME_CONTROL 4
42#define OSC_PCI_EXPRESS_AER_CONTROL 8
43#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
44
45#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
46 OSC_SHPC_NATIVE_HP_CONTROL | \
47 OSC_PCI_EXPRESS_PME_CONTROL | \
48 OSC_PCI_EXPRESS_AER_CONTROL | \
49 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
50
51#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
52extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
53int pci_acpi_osc_support(acpi_handle handle, u32 flags);
54static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 14static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
55{ 15{
56 /* Find root host bridge */ 16 struct pci_bus *pbus = pdev->bus;
57 while (pdev->bus->self) 17 /* Find a PCI root bus */
58 pdev = pdev->bus->self; 18 while (pbus->parent)
59 19 pbus = pbus->parent;
60 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 20 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
61 pdev->bus->number); 21 pbus->number);
62} 22}
63 23
64static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 24static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
65{ 25{
66 int seg = pci_domain_nr(pbus), busnr = pbus->number; 26 if (pbus->parent)
67 struct pci_dev *bridge = pbus->self; 27 return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
68 if (bridge) 28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
69 return DEVICE_ACPI_HANDLE(&(bridge->dev)); 29 pbus->number);
70 return acpi_get_pci_rootbridge_handle(seg, busnr);
71} 30}
72#else 31#else
73#if !defined(AE_ERROR)
74typedef u32 acpi_status;
75#define AE_ERROR (acpi_status) (0x0001)
76#endif
77static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
78{return AE_ERROR;}
79static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 32static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
80{ return NULL; } 33{ return NULL; }
81#endif 34#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7bd624bfdcfd..72698d89e767 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -52,6 +52,7 @@
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/irqreturn.h>
55 56
56/* Include the ID list */ 57/* Include the ID list */
57#include <linux/pci_ids.h> 58#include <linux/pci_ids.h>
@@ -93,6 +94,12 @@ enum {
93 /* #6: expansion ROM resource */ 94 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE, 95 PCI_ROM_RESOURCE,
95 96
97 /* device specific resources */
98#ifdef CONFIG_PCI_IOV
99 PCI_IOV_RESOURCES,
100 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
101#endif
102
96 /* resources assigned to buses behind the bridge */ 103 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4 104#define PCI_BRIDGE_RESOURCE_NUM 4
98 105
@@ -180,6 +187,7 @@ struct pci_cap_saved_state {
180 187
181struct pcie_link_state; 188struct pcie_link_state;
182struct pci_vpd; 189struct pci_vpd;
190struct pci_sriov;
183 191
184/* 192/*
185 * The pci_dev structure is used to describe PCI devices. 193 * The pci_dev structure is used to describe PCI devices.
@@ -257,6 +265,8 @@ struct pci_dev {
257 unsigned int is_managed:1; 265 unsigned int is_managed:1;
258 unsigned int is_pcie:1; 266 unsigned int is_pcie:1;
259 unsigned int state_saved:1; 267 unsigned int state_saved:1;
268 unsigned int is_physfn:1;
269 unsigned int is_virtfn:1;
260 pci_dev_flags_t dev_flags; 270 pci_dev_flags_t dev_flags;
261 atomic_t enable_cnt; /* pci_enable_device has been called */ 271 atomic_t enable_cnt; /* pci_enable_device has been called */
262 272
@@ -270,6 +280,12 @@ struct pci_dev {
270 struct list_head msi_list; 280 struct list_head msi_list;
271#endif 281#endif
272 struct pci_vpd *vpd; 282 struct pci_vpd *vpd;
283#ifdef CONFIG_PCI_IOV
284 union {
285 struct pci_sriov *sriov; /* SR-IOV capability related */
286 struct pci_dev *physfn; /* the PF this VF is associated with */
287 };
288#endif
273}; 289};
274 290
275extern struct pci_dev *alloc_pci_dev(void); 291extern struct pci_dev *alloc_pci_dev(void);
@@ -341,6 +357,15 @@ struct pci_bus {
341#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 357#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
342#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 358#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
343 359
360/*
361 * Returns true if the pci bus is root (behind host-pci bridge),
362 * false otherwise
363 */
364static inline bool pci_is_root_bus(struct pci_bus *pbus)
365{
366 return !(pbus->parent);
367}
368
344#ifdef CONFIG_PCI_MSI 369#ifdef CONFIG_PCI_MSI
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 370static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
346{ 371{
@@ -528,7 +553,7 @@ void pcibios_update_irq(struct pci_dev *, int irq);
528/* Generic PCI functions used internally */ 553/* Generic PCI functions used internally */
529 554
530extern struct pci_bus *pci_find_bus(int domain, int busnr); 555extern struct pci_bus *pci_find_bus(int domain, int busnr);
531void pci_bus_add_devices(struct pci_bus *bus); 556void pci_bus_add_devices(const struct pci_bus *bus);
532struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 557struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
533 struct pci_ops *ops, void *sysdata); 558 struct pci_ops *ops, void *sysdata);
534static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 559static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
@@ -649,6 +674,11 @@ int __must_check pci_reenable_device(struct pci_dev *);
649int __must_check pcim_enable_device(struct pci_dev *pdev); 674int __must_check pcim_enable_device(struct pci_dev *pdev);
650void pcim_pin_device(struct pci_dev *pdev); 675void pcim_pin_device(struct pci_dev *pdev);
651 676
677static inline int pci_is_enabled(struct pci_dev *pdev)
678{
679 return (atomic_read(&pdev->enable_cnt) > 0);
680}
681
652static inline int pci_is_managed(struct pci_dev *pdev) 682static inline int pci_is_managed(struct pci_dev *pdev)
653{ 683{
654 return pdev->is_managed; 684 return pdev->is_managed;
@@ -689,6 +719,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
689/* Power management related routines */ 719/* Power management related routines */
690int pci_save_state(struct pci_dev *dev); 720int pci_save_state(struct pci_dev *dev);
691int pci_restore_state(struct pci_dev *dev); 721int pci_restore_state(struct pci_dev *dev);
722int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
692int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 723int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
693pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 724pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
694bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 725bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
@@ -701,6 +732,9 @@ int pci_back_from_sleep(struct pci_dev *dev);
701 732
702/* Functions for PCI Hotplug drivers to use */ 733/* Functions for PCI Hotplug drivers to use */
703int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 734int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
735#ifdef CONFIG_HOTPLUG
736unsigned int pci_rescan_bus(struct pci_bus *bus);
737#endif
704 738
705/* Vital product data routines */ 739/* Vital product data routines */
706ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 740ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -708,7 +742,7 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
708int pci_vpd_truncate(struct pci_dev *dev, size_t size); 742int pci_vpd_truncate(struct pci_dev *dev, size_t size);
709 743
710/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 744/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
711void pci_bus_assign_resources(struct pci_bus *bus); 745void pci_bus_assign_resources(const struct pci_bus *bus);
712void pci_bus_size_bridges(struct pci_bus *bus); 746void pci_bus_size_bridges(struct pci_bus *bus);
713int pci_claim_resource(struct pci_dev *, int); 747int pci_claim_resource(struct pci_dev *, int);
714void pci_assign_unassigned_resources(void); 748void pci_assign_unassigned_resources(void);
@@ -789,7 +823,7 @@ struct msix_entry {
789 823
790 824
791#ifndef CONFIG_PCI_MSI 825#ifndef CONFIG_PCI_MSI
792static inline int pci_enable_msi(struct pci_dev *dev) 826static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
793{ 827{
794 return -1; 828 return -1;
795} 829}
@@ -799,6 +833,10 @@ static inline void pci_msi_shutdown(struct pci_dev *dev)
799static inline void pci_disable_msi(struct pci_dev *dev) 833static inline void pci_disable_msi(struct pci_dev *dev)
800{ } 834{ }
801 835
836static inline int pci_msix_table_size(struct pci_dev *dev)
837{
838 return 0;
839}
802static inline int pci_enable_msix(struct pci_dev *dev, 840static inline int pci_enable_msix(struct pci_dev *dev,
803 struct msix_entry *entries, int nvec) 841 struct msix_entry *entries, int nvec)
804{ 842{
@@ -820,9 +858,10 @@ static inline int pci_msi_enabled(void)
820 return 0; 858 return 0;
821} 859}
822#else 860#else
823extern int pci_enable_msi(struct pci_dev *dev); 861extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
824extern void pci_msi_shutdown(struct pci_dev *dev); 862extern void pci_msi_shutdown(struct pci_dev *dev);
825extern void pci_disable_msi(struct pci_dev *dev); 863extern void pci_disable_msi(struct pci_dev *dev);
864extern int pci_msix_table_size(struct pci_dev *dev);
826extern int pci_enable_msix(struct pci_dev *dev, 865extern int pci_enable_msix(struct pci_dev *dev,
827 struct msix_entry *entries, int nvec); 866 struct msix_entry *entries, int nvec);
828extern void pci_msix_shutdown(struct pci_dev *dev); 867extern void pci_msix_shutdown(struct pci_dev *dev);
@@ -841,6 +880,8 @@ static inline int pcie_aspm_enabled(void)
841extern int pcie_aspm_enabled(void); 880extern int pcie_aspm_enabled(void);
842#endif 881#endif
843 882
883#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
884
844#ifdef CONFIG_HT_IRQ 885#ifdef CONFIG_HT_IRQ
845/* The functions a driver should call */ 886/* The functions a driver should call */
846int ht_create_irq(struct pci_dev *dev, int idx); 887int ht_create_irq(struct pci_dev *dev, int idx);
@@ -1194,5 +1235,23 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
1194 1235
1195void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1236void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1196 1237
1238#ifdef CONFIG_PCI_IOV
1239extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1240extern void pci_disable_sriov(struct pci_dev *dev);
1241extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1242#else
1243static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1244{
1245 return -ENODEV;
1246}
1247static inline void pci_disable_sriov(struct pci_dev *dev)
1248{
1249}
1250static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1251{
1252 return IRQ_NONE;
1253}
1254#endif
1255
1197#endif /* __KERNEL__ */ 1256#endif /* __KERNEL__ */
1198#endif /* LINUX_PCI_H */ 1257#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index aca8c458aa8a..ee98cd570885 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -526,6 +526,7 @@
526#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 526#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443
527#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 527#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443
528#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445 528#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445
529#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
529#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468 530#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468
530#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469 531#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469
531#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a 532#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a
@@ -834,6 +835,8 @@
834#define PCI_DEVICE_ID_PROMISE_20276 0x5275 835#define PCI_DEVICE_ID_PROMISE_20276 0x5275
835#define PCI_DEVICE_ID_PROMISE_20277 0x7275 836#define PCI_DEVICE_ID_PROMISE_20277 0x7275
836 837
838#define PCI_VENDOR_ID_FOXCONN 0x105b
839
837#define PCI_VENDOR_ID_UMC 0x1060 840#define PCI_VENDOR_ID_UMC 0x1060
838#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 841#define PCI_DEVICE_ID_UMC_UM8673F 0x0101
839#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 842#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
@@ -941,6 +944,32 @@
941#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 944#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801
942#define PCI_DEVICE_ID_SUN_CASSINI 0xabba 945#define PCI_DEVICE_ID_SUN_CASSINI 0xabba
943 946
947#define PCI_VENDOR_ID_NI 0x1093
948#define PCI_DEVICE_ID_NI_PCI2322 0xd130
949#define PCI_DEVICE_ID_NI_PCI2324 0xd140
950#define PCI_DEVICE_ID_NI_PCI2328 0xd150
951#define PCI_DEVICE_ID_NI_PXI8422_2322 0xd190
952#define PCI_DEVICE_ID_NI_PXI8422_2324 0xd1a0
953#define PCI_DEVICE_ID_NI_PXI8420_2322 0xd1d0
954#define PCI_DEVICE_ID_NI_PXI8420_2324 0xd1e0
955#define PCI_DEVICE_ID_NI_PXI8420_2328 0xd1f0
956#define PCI_DEVICE_ID_NI_PXI8420_23216 0xd1f1
957#define PCI_DEVICE_ID_NI_PCI2322I 0xd250
958#define PCI_DEVICE_ID_NI_PCI2324I 0xd270
959#define PCI_DEVICE_ID_NI_PCI23216 0xd2b0
960#define PCI_DEVICE_ID_NI_PXI8430_2322 0x7080
961#define PCI_DEVICE_ID_NI_PCI8430_2322 0x70db
962#define PCI_DEVICE_ID_NI_PXI8430_2324 0x70dd
963#define PCI_DEVICE_ID_NI_PCI8430_2324 0x70df
964#define PCI_DEVICE_ID_NI_PXI8430_2328 0x70e2
965#define PCI_DEVICE_ID_NI_PCI8430_2328 0x70e4
966#define PCI_DEVICE_ID_NI_PXI8430_23216 0x70e6
967#define PCI_DEVICE_ID_NI_PCI8430_23216 0x70e7
968#define PCI_DEVICE_ID_NI_PXI8432_2322 0x70e8
969#define PCI_DEVICE_ID_NI_PCI8432_2322 0x70ea
970#define PCI_DEVICE_ID_NI_PXI8432_2324 0x70ec
971#define PCI_DEVICE_ID_NI_PCI8432_2324 0x70ee
972
944#define PCI_VENDOR_ID_CMD 0x1095 973#define PCI_VENDOR_ID_CMD 0x1095
945#define PCI_DEVICE_ID_CMD_643 0x0643 974#define PCI_DEVICE_ID_CMD_643 0x0643
946#define PCI_DEVICE_ID_CMD_646 0x0646 975#define PCI_DEVICE_ID_CMD_646 0x0646
@@ -1235,6 +1264,7 @@
1235#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1264#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1236#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1265#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1237#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 1266#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1267#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542
1238#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C 1268#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D 1269#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E 1270#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
@@ -1245,11 +1275,14 @@
1245#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF 1275#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF
1246#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1276#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1247#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1277#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1278#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752
1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1279#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1249#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760 1280#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760
1250#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 1281#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1251#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 1282#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 1283#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1284#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8
1285#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0 1286#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1254#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1 1287#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1255#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2 1288#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
@@ -1473,6 +1506,7 @@
1473#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 1506#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214
1474#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 1507#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
1475#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 1508#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
1509#define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408
1476 1510
1477#define PCI_VENDOR_ID_SBE 0x1176 1511#define PCI_VENDOR_ID_SBE 0x1176
1478#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 1512#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
@@ -1971,6 +2005,8 @@
1971 2005
1972#define PCI_VENDOR_ID_SAMSUNG 0x144d 2006#define PCI_VENDOR_ID_SAMSUNG 0x144d
1973 2007
2008#define PCI_VENDOR_ID_AMBIT 0x1468
2009
1974#define PCI_VENDOR_ID_MYRICOM 0x14c1 2010#define PCI_VENDOR_ID_MYRICOM 0x14c1
1975 2011
1976#define PCI_VENDOR_ID_TITAN 0x14D2 2012#define PCI_VENDOR_ID_TITAN 0x14D2
@@ -2112,6 +2148,8 @@
2112#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c 2148#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
2113#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 2149#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274
2114 2150
2151#define PCI_VENDOR_ID_DFI 0x15bd
2152
2115#define PCI_VENDOR_ID_QUICKNET 0x15e2 2153#define PCI_VENDOR_ID_QUICKNET 0x15e2
2116#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 2154#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
2117 2155
@@ -2215,10 +2253,20 @@
2215 2253
2216#define PCI_VENDOR_ID_TOPSPIN 0x1867 2254#define PCI_VENDOR_ID_TOPSPIN 0x1867
2217 2255
2256#define PCI_VENDOR_ID_SILAN 0x1904
2257
2218#define PCI_VENDOR_ID_TDI 0x192E 2258#define PCI_VENDOR_ID_TDI 0x192E
2219#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2259#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2220 2260
2221#define PCI_VENDOR_ID_FREESCALE 0x1957 2261#define PCI_VENDOR_ID_FREESCALE 0x1957
2262#define PCI_DEVICE_ID_MPC8315E 0x00b4
2263#define PCI_DEVICE_ID_MPC8315 0x00b5
2264#define PCI_DEVICE_ID_MPC8314E 0x00b6
2265#define PCI_DEVICE_ID_MPC8314 0x00b7
2266#define PCI_DEVICE_ID_MPC8378E 0x00c4
2267#define PCI_DEVICE_ID_MPC8378 0x00c5
2268#define PCI_DEVICE_ID_MPC8377E 0x00c6
2269#define PCI_DEVICE_ID_MPC8377 0x00c7
2222#define PCI_DEVICE_ID_MPC8548E 0x0012 2270#define PCI_DEVICE_ID_MPC8548E 0x0012
2223#define PCI_DEVICE_ID_MPC8548 0x0013 2271#define PCI_DEVICE_ID_MPC8548 0x0013
2224#define PCI_DEVICE_ID_MPC8543E 0x0014 2272#define PCI_DEVICE_ID_MPC8543E 0x0014
@@ -2263,6 +2311,8 @@
2263#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2311#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
2264#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff 2312#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff
2265 2313
2314#define PCI_VENDOR_ID_QMI 0x1a32
2315
2266#define PCI_VENDOR_ID_TEKRAM 0x1de1 2316#define PCI_VENDOR_ID_TEKRAM 0x1de1
2267#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2317#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2268 2318
@@ -2373,6 +2423,7 @@
2373#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c 2423#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
2374#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 2424#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0
2375#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 2425#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1
2426#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2
2376#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 2427#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3
2377#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 2428#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5
2378#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 2429#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 027815b4635e..e4d08c1b2e0b 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -235,7 +235,7 @@
235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ 235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */
236#define PCI_PM_CTRL 4 /* PM control and status register */ 236#define PCI_PM_CTRL 4 /* PM control and status register */
237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ 237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ 238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */
239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ 239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ 240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ 241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
@@ -375,6 +375,7 @@
375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ 375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
378#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
378#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 379#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
379#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 380#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
380#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 381#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -487,6 +488,8 @@
487#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ 488#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
488#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ 489#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
489#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ 490#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */
491#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
492#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
490 493
491/* Extended Capabilities (PCI-X 2.0 and Express) */ 494/* Extended Capabilities (PCI-X 2.0 and Express) */
492#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) 495#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
@@ -498,6 +501,7 @@
498#define PCI_EXT_CAP_ID_DSN 3 501#define PCI_EXT_CAP_ID_DSN 3
499#define PCI_EXT_CAP_ID_PWR 4 502#define PCI_EXT_CAP_ID_PWR 4
500#define PCI_EXT_CAP_ID_ARI 14 503#define PCI_EXT_CAP_ID_ARI 14
504#define PCI_EXT_CAP_ID_SRIOV 16
501 505
502/* Advanced Error Reporting */ 506/* Advanced Error Reporting */
503#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 507#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -615,4 +619,35 @@
615#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ 619#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
616#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ 620#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
617 621
622/* Single Root I/O Virtualization */
623#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
624#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */
625#define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */
626#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */
627#define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */
628#define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */
629#define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */
630#define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */
631#define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */
632#define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */
633#define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */
634#define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */
635#define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */
636#define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */
637#define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */
638#define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */
639#define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */
640#define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */
641#define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */
642#define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */
643#define PCI_SRIOV_BAR 0x24 /* VF BAR0 */
644#define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */
645#define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/
646#define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */
647#define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */
648#define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */
649#define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */
650#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
651#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
652
618#endif /* LINUX_PCI_REGS_H */ 653#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 6cd91e3f9820..b4c79545330b 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -16,29 +16,30 @@
16#define PCIE_ANY_PORT 7 16#define PCIE_ANY_PORT 7
17 17
18/* Service Type */ 18/* Service Type */
19#define PCIE_PORT_SERVICE_PME 1 /* Power Management Event */ 19#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
20#define PCIE_PORT_SERVICE_AER 2 /* Advanced Error Reporting */ 20#define PCIE_PORT_SERVICE_PME (1 << PCIE_PORT_SERVICE_PME_SHIFT)
21#define PCIE_PORT_SERVICE_HP 4 /* Native Hotplug */ 21#define PCIE_PORT_SERVICE_AER_SHIFT 1 /* Advanced Error Reporting */
22#define PCIE_PORT_SERVICE_VC 8 /* Virtual Channel */ 22#define PCIE_PORT_SERVICE_AER (1 << PCIE_PORT_SERVICE_AER_SHIFT)
23#define PCIE_PORT_SERVICE_HP_SHIFT 2 /* Native Hotplug */
24#define PCIE_PORT_SERVICE_HP (1 << PCIE_PORT_SERVICE_HP_SHIFT)
25#define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
26#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
23 27
24/* Root/Upstream/Downstream Port's Interrupt Mode */ 28/* Root/Upstream/Downstream Port's Interrupt Mode */
29#define PCIE_PORT_NO_IRQ (-1)
25#define PCIE_PORT_INTx_MODE 0 30#define PCIE_PORT_INTx_MODE 0
26#define PCIE_PORT_MSI_MODE 1 31#define PCIE_PORT_MSI_MODE 1
27#define PCIE_PORT_MSIX_MODE 2 32#define PCIE_PORT_MSIX_MODE 2
28 33
29struct pcie_port_service_id { 34struct pcie_port_data {
30 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ 35 int port_type; /* Type of the port */
31 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ 36 int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */
32 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
33 __u32 port_type, service_type; /* Port Entity */
34 kernel_ulong_t driver_data;
35}; 37};
36 38
37struct pcie_device { 39struct pcie_device {
38 int irq; /* Service IRQ/MSI/MSI-X Vector */ 40 int irq; /* Service IRQ/MSI/MSI-X Vector */
39 int interrupt_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ 41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
40 struct pcie_port_service_id id; /* Service ID */ 42 u32 service; /* Port service this device represents */
41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
42 void *priv_data; /* Service Private Data */ 43 void *priv_data; /* Service Private Data */
43 struct device device; /* Generic Device Interface */ 44 struct device device; /* Generic Device Interface */
44}; 45};
@@ -56,10 +57,9 @@ static inline void* get_service_data(struct pcie_device *dev)
56 57
57struct pcie_port_service_driver { 58struct pcie_port_service_driver {
58 const char *name; 59 const char *name;
59 int (*probe) (struct pcie_device *dev, 60 int (*probe) (struct pcie_device *dev);
60 const struct pcie_port_service_id *id);
61 void (*remove) (struct pcie_device *dev); 61 void (*remove) (struct pcie_device *dev);
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */ 65 /* Service Error Recovery Handler */
@@ -68,7 +68,9 @@ struct pcie_port_service_driver {
68 /* Link Reset Capability - AER service driver specific */ 68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev); 69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70 70
71 const struct pcie_port_service_id *id_table; 71 int port_type; /* Type of the port this driver can handle */
72 u32 service; /* Port service this device represents */
73
72 struct device_driver driver; 74 struct device_driver driver;
73}; 75};
74#define to_service_driver(d) \ 76#define to_service_driver(d) \
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 54a968b4b924..ee5615d65211 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -107,10 +107,14 @@ typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr);
107 107
108extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, 108extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
109 size_t static_size, size_t reserved_size, 109 size_t static_size, size_t reserved_size,
110 ssize_t unit_size, ssize_t dyn_size, 110 ssize_t dyn_size, ssize_t unit_size,
111 void *base_addr, 111 void *base_addr,
112 pcpu_populate_pte_fn_t populate_pte_fn); 112 pcpu_populate_pte_fn_t populate_pte_fn);
113 113
114extern ssize_t __init pcpu_embed_first_chunk(
115 size_t static_size, size_t reserved_size,
116 ssize_t dyn_size, ssize_t unit_size);
117
114/* 118/*
115 * Use this to get to a cpu's version of the per-cpu object 119 * Use this to get to a cpu's version of the per-cpu object
116 * dynamically allocated. Non-atomic access to the current CPU's 120 * dynamically allocated. Non-atomic access to the current CPU's
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 01b262959f2e..228b0b6306b0 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -12,187 +12,187 @@
12#define PFKEYV2_REVISION 199806L 12#define PFKEYV2_REVISION 199806L
13 13
14struct sadb_msg { 14struct sadb_msg {
15 uint8_t sadb_msg_version; 15 __u8 sadb_msg_version;
16 uint8_t sadb_msg_type; 16 __u8 sadb_msg_type;
17 uint8_t sadb_msg_errno; 17 __u8 sadb_msg_errno;
18 uint8_t sadb_msg_satype; 18 __u8 sadb_msg_satype;
19 uint16_t sadb_msg_len; 19 __u16 sadb_msg_len;
20 uint16_t sadb_msg_reserved; 20 __u16 sadb_msg_reserved;
21 uint32_t sadb_msg_seq; 21 __u32 sadb_msg_seq;
22 uint32_t sadb_msg_pid; 22 __u32 sadb_msg_pid;
23} __attribute__((packed)); 23} __attribute__((packed));
24/* sizeof(struct sadb_msg) == 16 */ 24/* sizeof(struct sadb_msg) == 16 */
25 25
26struct sadb_ext { 26struct sadb_ext {
27 uint16_t sadb_ext_len; 27 __u16 sadb_ext_len;
28 uint16_t sadb_ext_type; 28 __u16 sadb_ext_type;
29} __attribute__((packed)); 29} __attribute__((packed));
30/* sizeof(struct sadb_ext) == 4 */ 30/* sizeof(struct sadb_ext) == 4 */
31 31
32struct sadb_sa { 32struct sadb_sa {
33 uint16_t sadb_sa_len; 33 __u16 sadb_sa_len;
34 uint16_t sadb_sa_exttype; 34 __u16 sadb_sa_exttype;
35 __be32 sadb_sa_spi; 35 __be32 sadb_sa_spi;
36 uint8_t sadb_sa_replay; 36 __u8 sadb_sa_replay;
37 uint8_t sadb_sa_state; 37 __u8 sadb_sa_state;
38 uint8_t sadb_sa_auth; 38 __u8 sadb_sa_auth;
39 uint8_t sadb_sa_encrypt; 39 __u8 sadb_sa_encrypt;
40 uint32_t sadb_sa_flags; 40 __u32 sadb_sa_flags;
41} __attribute__((packed)); 41} __attribute__((packed));
42/* sizeof(struct sadb_sa) == 16 */ 42/* sizeof(struct sadb_sa) == 16 */
43 43
44struct sadb_lifetime { 44struct sadb_lifetime {
45 uint16_t sadb_lifetime_len; 45 __u16 sadb_lifetime_len;
46 uint16_t sadb_lifetime_exttype; 46 __u16 sadb_lifetime_exttype;
47 uint32_t sadb_lifetime_allocations; 47 __u32 sadb_lifetime_allocations;
48 uint64_t sadb_lifetime_bytes; 48 __u64 sadb_lifetime_bytes;
49 uint64_t sadb_lifetime_addtime; 49 __u64 sadb_lifetime_addtime;
50 uint64_t sadb_lifetime_usetime; 50 __u64 sadb_lifetime_usetime;
51} __attribute__((packed)); 51} __attribute__((packed));
52/* sizeof(struct sadb_lifetime) == 32 */ 52/* sizeof(struct sadb_lifetime) == 32 */
53 53
54struct sadb_address { 54struct sadb_address {
55 uint16_t sadb_address_len; 55 __u16 sadb_address_len;
56 uint16_t sadb_address_exttype; 56 __u16 sadb_address_exttype;
57 uint8_t sadb_address_proto; 57 __u8 sadb_address_proto;
58 uint8_t sadb_address_prefixlen; 58 __u8 sadb_address_prefixlen;
59 uint16_t sadb_address_reserved; 59 __u16 sadb_address_reserved;
60} __attribute__((packed)); 60} __attribute__((packed));
61/* sizeof(struct sadb_address) == 8 */ 61/* sizeof(struct sadb_address) == 8 */
62 62
63struct sadb_key { 63struct sadb_key {
64 uint16_t sadb_key_len; 64 __u16 sadb_key_len;
65 uint16_t sadb_key_exttype; 65 __u16 sadb_key_exttype;
66 uint16_t sadb_key_bits; 66 __u16 sadb_key_bits;
67 uint16_t sadb_key_reserved; 67 __u16 sadb_key_reserved;
68} __attribute__((packed)); 68} __attribute__((packed));
69/* sizeof(struct sadb_key) == 8 */ 69/* sizeof(struct sadb_key) == 8 */
70 70
71struct sadb_ident { 71struct sadb_ident {
72 uint16_t sadb_ident_len; 72 __u16 sadb_ident_len;
73 uint16_t sadb_ident_exttype; 73 __u16 sadb_ident_exttype;
74 uint16_t sadb_ident_type; 74 __u16 sadb_ident_type;
75 uint16_t sadb_ident_reserved; 75 __u16 sadb_ident_reserved;
76 uint64_t sadb_ident_id; 76 __u64 sadb_ident_id;
77} __attribute__((packed)); 77} __attribute__((packed));
78/* sizeof(struct sadb_ident) == 16 */ 78/* sizeof(struct sadb_ident) == 16 */
79 79
80struct sadb_sens { 80struct sadb_sens {
81 uint16_t sadb_sens_len; 81 __u16 sadb_sens_len;
82 uint16_t sadb_sens_exttype; 82 __u16 sadb_sens_exttype;
83 uint32_t sadb_sens_dpd; 83 __u32 sadb_sens_dpd;
84 uint8_t sadb_sens_sens_level; 84 __u8 sadb_sens_sens_level;
85 uint8_t sadb_sens_sens_len; 85 __u8 sadb_sens_sens_len;
86 uint8_t sadb_sens_integ_level; 86 __u8 sadb_sens_integ_level;
87 uint8_t sadb_sens_integ_len; 87 __u8 sadb_sens_integ_len;
88 uint32_t sadb_sens_reserved; 88 __u32 sadb_sens_reserved;
89} __attribute__((packed)); 89} __attribute__((packed));
90/* sizeof(struct sadb_sens) == 16 */ 90/* sizeof(struct sadb_sens) == 16 */
91 91
92/* followed by: 92/* followed by:
93 uint64_t sadb_sens_bitmap[sens_len]; 93 __u64 sadb_sens_bitmap[sens_len];
94 uint64_t sadb_integ_bitmap[integ_len]; */ 94 __u64 sadb_integ_bitmap[integ_len]; */
95 95
96struct sadb_prop { 96struct sadb_prop {
97 uint16_t sadb_prop_len; 97 __u16 sadb_prop_len;
98 uint16_t sadb_prop_exttype; 98 __u16 sadb_prop_exttype;
99 uint8_t sadb_prop_replay; 99 __u8 sadb_prop_replay;
100 uint8_t sadb_prop_reserved[3]; 100 __u8 sadb_prop_reserved[3];
101} __attribute__((packed)); 101} __attribute__((packed));
102/* sizeof(struct sadb_prop) == 8 */ 102/* sizeof(struct sadb_prop) == 8 */
103 103
104/* followed by: 104/* followed by:
105 struct sadb_comb sadb_combs[(sadb_prop_len + 105 struct sadb_comb sadb_combs[(sadb_prop_len +
106 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 106 sizeof(__u64) - sizeof(struct sadb_prop)) /
107 sizeof(struct sadb_comb)]; */ 107 sizeof(struct sadb_comb)]; */
108 108
109struct sadb_comb { 109struct sadb_comb {
110 uint8_t sadb_comb_auth; 110 __u8 sadb_comb_auth;
111 uint8_t sadb_comb_encrypt; 111 __u8 sadb_comb_encrypt;
112 uint16_t sadb_comb_flags; 112 __u16 sadb_comb_flags;
113 uint16_t sadb_comb_auth_minbits; 113 __u16 sadb_comb_auth_minbits;
114 uint16_t sadb_comb_auth_maxbits; 114 __u16 sadb_comb_auth_maxbits;
115 uint16_t sadb_comb_encrypt_minbits; 115 __u16 sadb_comb_encrypt_minbits;
116 uint16_t sadb_comb_encrypt_maxbits; 116 __u16 sadb_comb_encrypt_maxbits;
117 uint32_t sadb_comb_reserved; 117 __u32 sadb_comb_reserved;
118 uint32_t sadb_comb_soft_allocations; 118 __u32 sadb_comb_soft_allocations;
119 uint32_t sadb_comb_hard_allocations; 119 __u32 sadb_comb_hard_allocations;
120 uint64_t sadb_comb_soft_bytes; 120 __u64 sadb_comb_soft_bytes;
121 uint64_t sadb_comb_hard_bytes; 121 __u64 sadb_comb_hard_bytes;
122 uint64_t sadb_comb_soft_addtime; 122 __u64 sadb_comb_soft_addtime;
123 uint64_t sadb_comb_hard_addtime; 123 __u64 sadb_comb_hard_addtime;
124 uint64_t sadb_comb_soft_usetime; 124 __u64 sadb_comb_soft_usetime;
125 uint64_t sadb_comb_hard_usetime; 125 __u64 sadb_comb_hard_usetime;
126} __attribute__((packed)); 126} __attribute__((packed));
127/* sizeof(struct sadb_comb) == 72 */ 127/* sizeof(struct sadb_comb) == 72 */
128 128
129struct sadb_supported { 129struct sadb_supported {
130 uint16_t sadb_supported_len; 130 __u16 sadb_supported_len;
131 uint16_t sadb_supported_exttype; 131 __u16 sadb_supported_exttype;
132 uint32_t sadb_supported_reserved; 132 __u32 sadb_supported_reserved;
133} __attribute__((packed)); 133} __attribute__((packed));
134/* sizeof(struct sadb_supported) == 8 */ 134/* sizeof(struct sadb_supported) == 8 */
135 135
136/* followed by: 136/* followed by:
137 struct sadb_alg sadb_algs[(sadb_supported_len + 137 struct sadb_alg sadb_algs[(sadb_supported_len +
138 sizeof(uint64_t) - sizeof(struct sadb_supported)) / 138 sizeof(__u64) - sizeof(struct sadb_supported)) /
139 sizeof(struct sadb_alg)]; */ 139 sizeof(struct sadb_alg)]; */
140 140
141struct sadb_alg { 141struct sadb_alg {
142 uint8_t sadb_alg_id; 142 __u8 sadb_alg_id;
143 uint8_t sadb_alg_ivlen; 143 __u8 sadb_alg_ivlen;
144 uint16_t sadb_alg_minbits; 144 __u16 sadb_alg_minbits;
145 uint16_t sadb_alg_maxbits; 145 __u16 sadb_alg_maxbits;
146 uint16_t sadb_alg_reserved; 146 __u16 sadb_alg_reserved;
147} __attribute__((packed)); 147} __attribute__((packed));
148/* sizeof(struct sadb_alg) == 8 */ 148/* sizeof(struct sadb_alg) == 8 */
149 149
150struct sadb_spirange { 150struct sadb_spirange {
151 uint16_t sadb_spirange_len; 151 __u16 sadb_spirange_len;
152 uint16_t sadb_spirange_exttype; 152 __u16 sadb_spirange_exttype;
153 uint32_t sadb_spirange_min; 153 __u32 sadb_spirange_min;
154 uint32_t sadb_spirange_max; 154 __u32 sadb_spirange_max;
155 uint32_t sadb_spirange_reserved; 155 __u32 sadb_spirange_reserved;
156} __attribute__((packed)); 156} __attribute__((packed));
157/* sizeof(struct sadb_spirange) == 16 */ 157/* sizeof(struct sadb_spirange) == 16 */
158 158
159struct sadb_x_kmprivate { 159struct sadb_x_kmprivate {
160 uint16_t sadb_x_kmprivate_len; 160 __u16 sadb_x_kmprivate_len;
161 uint16_t sadb_x_kmprivate_exttype; 161 __u16 sadb_x_kmprivate_exttype;
162 uint32_t sadb_x_kmprivate_reserved; 162 __u32 sadb_x_kmprivate_reserved;
163} __attribute__((packed)); 163} __attribute__((packed));
164/* sizeof(struct sadb_x_kmprivate) == 8 */ 164/* sizeof(struct sadb_x_kmprivate) == 8 */
165 165
166struct sadb_x_sa2 { 166struct sadb_x_sa2 {
167 uint16_t sadb_x_sa2_len; 167 __u16 sadb_x_sa2_len;
168 uint16_t sadb_x_sa2_exttype; 168 __u16 sadb_x_sa2_exttype;
169 uint8_t sadb_x_sa2_mode; 169 __u8 sadb_x_sa2_mode;
170 uint8_t sadb_x_sa2_reserved1; 170 __u8 sadb_x_sa2_reserved1;
171 uint16_t sadb_x_sa2_reserved2; 171 __u16 sadb_x_sa2_reserved2;
172 uint32_t sadb_x_sa2_sequence; 172 __u32 sadb_x_sa2_sequence;
173 uint32_t sadb_x_sa2_reqid; 173 __u32 sadb_x_sa2_reqid;
174} __attribute__((packed)); 174} __attribute__((packed));
175/* sizeof(struct sadb_x_sa2) == 16 */ 175/* sizeof(struct sadb_x_sa2) == 16 */
176 176
177struct sadb_x_policy { 177struct sadb_x_policy {
178 uint16_t sadb_x_policy_len; 178 __u16 sadb_x_policy_len;
179 uint16_t sadb_x_policy_exttype; 179 __u16 sadb_x_policy_exttype;
180 uint16_t sadb_x_policy_type; 180 __u16 sadb_x_policy_type;
181 uint8_t sadb_x_policy_dir; 181 __u8 sadb_x_policy_dir;
182 uint8_t sadb_x_policy_reserved; 182 __u8 sadb_x_policy_reserved;
183 uint32_t sadb_x_policy_id; 183 __u32 sadb_x_policy_id;
184 uint32_t sadb_x_policy_priority; 184 __u32 sadb_x_policy_priority;
185} __attribute__((packed)); 185} __attribute__((packed));
186/* sizeof(struct sadb_x_policy) == 16 */ 186/* sizeof(struct sadb_x_policy) == 16 */
187 187
188struct sadb_x_ipsecrequest { 188struct sadb_x_ipsecrequest {
189 uint16_t sadb_x_ipsecrequest_len; 189 __u16 sadb_x_ipsecrequest_len;
190 uint16_t sadb_x_ipsecrequest_proto; 190 __u16 sadb_x_ipsecrequest_proto;
191 uint8_t sadb_x_ipsecrequest_mode; 191 __u8 sadb_x_ipsecrequest_mode;
192 uint8_t sadb_x_ipsecrequest_level; 192 __u8 sadb_x_ipsecrequest_level;
193 uint16_t sadb_x_ipsecrequest_reserved1; 193 __u16 sadb_x_ipsecrequest_reserved1;
194 uint32_t sadb_x_ipsecrequest_reqid; 194 __u32 sadb_x_ipsecrequest_reqid;
195 uint32_t sadb_x_ipsecrequest_reserved2; 195 __u32 sadb_x_ipsecrequest_reserved2;
196} __attribute__((packed)); 196} __attribute__((packed));
197/* sizeof(struct sadb_x_ipsecrequest) == 16 */ 197/* sizeof(struct sadb_x_ipsecrequest) == 16 */
198 198
@@ -200,38 +200,38 @@ struct sadb_x_ipsecrequest {
200 * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 200 * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06
201 */ 201 */
202struct sadb_x_nat_t_type { 202struct sadb_x_nat_t_type {
203 uint16_t sadb_x_nat_t_type_len; 203 __u16 sadb_x_nat_t_type_len;
204 uint16_t sadb_x_nat_t_type_exttype; 204 __u16 sadb_x_nat_t_type_exttype;
205 uint8_t sadb_x_nat_t_type_type; 205 __u8 sadb_x_nat_t_type_type;
206 uint8_t sadb_x_nat_t_type_reserved[3]; 206 __u8 sadb_x_nat_t_type_reserved[3];
207} __attribute__((packed)); 207} __attribute__((packed));
208/* sizeof(struct sadb_x_nat_t_type) == 8 */ 208/* sizeof(struct sadb_x_nat_t_type) == 8 */
209 209
210/* Pass a NAT Traversal port (Source or Dest port) */ 210/* Pass a NAT Traversal port (Source or Dest port) */
211struct sadb_x_nat_t_port { 211struct sadb_x_nat_t_port {
212 uint16_t sadb_x_nat_t_port_len; 212 __u16 sadb_x_nat_t_port_len;
213 uint16_t sadb_x_nat_t_port_exttype; 213 __u16 sadb_x_nat_t_port_exttype;
214 __be16 sadb_x_nat_t_port_port; 214 __be16 sadb_x_nat_t_port_port;
215 uint16_t sadb_x_nat_t_port_reserved; 215 __u16 sadb_x_nat_t_port_reserved;
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
218 218
219/* Generic LSM security context */ 219/* Generic LSM security context */
220struct sadb_x_sec_ctx { 220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len; 221 __u16 sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype; 222 __u16 sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ 223 __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi; 224 __u8 sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len; 225 __u16 sadb_x_ctx_len;
226} __attribute__((packed)); 226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */ 227/* sizeof(struct sadb_sec_ctx) = 8 */
228 228
229/* Used by MIGRATE to pass addresses IKE will use to perform 229/* Used by MIGRATE to pass addresses IKE will use to perform
230 * negotiation with the peer */ 230 * negotiation with the peer */
231struct sadb_x_kmaddress { 231struct sadb_x_kmaddress {
232 uint16_t sadb_x_kmaddress_len; 232 __u16 sadb_x_kmaddress_len;
233 uint16_t sadb_x_kmaddress_exttype; 233 __u16 sadb_x_kmaddress_exttype;
234 uint32_t sadb_x_kmaddress_reserved; 234 __u32 sadb_x_kmaddress_reserved;
235} __attribute__((packed)); 235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */ 236/* sizeof(struct sadb_x_kmaddress) == 8 */
237 237
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d7e54d98869f..32cf14a4b034 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -315,8 +315,7 @@ struct phy_device {
315 315
316 /* Interrupt and Polling infrastructure */ 316 /* Interrupt and Polling infrastructure */
317 struct work_struct phy_queue; 317 struct work_struct phy_queue;
318 struct work_struct state_queue; 318 struct delayed_work state_queue;
319 struct timer_list phy_timer;
320 atomic_t irq_disable; 319 atomic_t irq_disable;
321 320
322 struct mutex lock; 321 struct mutex lock;
diff --git a/include/linux/pim.h b/include/linux/pim.h
index 1ba0661561a4..252bf6644c51 100644
--- a/include/linux/pim.h
+++ b/include/linux/pim.h
@@ -4,14 +4,14 @@
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5 5
6/* Message types - V1 */ 6/* Message types - V1 */
7#define PIM_V1_VERSION __constant_htonl(0x10000000) 7#define PIM_V1_VERSION cpu_to_be32(0x10000000)
8#define PIM_V1_REGISTER 1 8#define PIM_V1_REGISTER 1
9 9
10/* Message types - V2 */ 10/* Message types - V2 */
11#define PIM_VERSION 2 11#define PIM_VERSION 2
12#define PIM_REGISTER 1 12#define PIM_REGISTER 1
13 13
14#define PIM_NULL_REGISTER __constant_htonl(0x40000000) 14#define PIM_NULL_REGISTER cpu_to_be32(0x40000000)
15 15
16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ 16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
17struct pimreghdr 17struct pimreghdr
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9a342699c607..76e470a299bf 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -12,6 +12,7 @@
12#define _PLATFORM_DEVICE_H_ 12#define _PLATFORM_DEVICE_H_
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h>
15 16
16struct platform_device { 17struct platform_device {
17 const char * name; 18 const char * name;
@@ -19,8 +20,13 @@ struct platform_device {
19 struct device dev; 20 struct device dev;
20 u32 num_resources; 21 u32 num_resources;
21 struct resource * resource; 22 struct resource * resource;
23 void *platform_data;
24
25 struct platform_device_id *id_entry;
22}; 26};
23 27
28#define platform_get_device_id(pdev) ((pdev)->id_entry)
29
24#define to_platform_device(x) container_of((x), struct platform_device, dev) 30#define to_platform_device(x) container_of((x), struct platform_device, dev)
25 31
26extern int platform_device_register(struct platform_device *); 32extern int platform_device_register(struct platform_device *);
@@ -56,6 +62,7 @@ struct platform_driver {
56 int (*resume_early)(struct platform_device *); 62 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 63 int (*resume)(struct platform_device *);
58 struct device_driver driver; 64 struct device_driver driver;
65 struct platform_device_id *id_table;
59}; 66};
60 67
61extern int platform_driver_register(struct platform_driver *); 68extern int platform_driver_register(struct platform_driver *);
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 85de2f055874..45926d77d6ac 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -96,6 +96,10 @@ struct plist_node {
96# define PLIST_HEAD_LOCK_INIT(_lock) 96# define PLIST_HEAD_LOCK_INIT(_lock)
97#endif 97#endif
98 98
99#define _PLIST_HEAD_INIT(head) \
100 .prio_list = LIST_HEAD_INIT((head).prio_list), \
101 .node_list = LIST_HEAD_INIT((head).node_list)
102
99/** 103/**
100 * PLIST_HEAD_INIT - static struct plist_head initializer 104 * PLIST_HEAD_INIT - static struct plist_head initializer
101 * @head: struct plist_head variable name 105 * @head: struct plist_head variable name
@@ -103,8 +107,7 @@ struct plist_node {
103 */ 107 */
104#define PLIST_HEAD_INIT(head, _lock) \ 108#define PLIST_HEAD_INIT(head, _lock) \
105{ \ 109{ \
106 .prio_list = LIST_HEAD_INIT((head).prio_list), \ 110 _PLIST_HEAD_INIT(head), \
107 .node_list = LIST_HEAD_INIT((head).node_list), \
108 PLIST_HEAD_LOCK_INIT(&(_lock)) \ 111 PLIST_HEAD_LOCK_INIT(&(_lock)) \
109} 112}
110 113
@@ -116,7 +119,7 @@ struct plist_node {
116#define PLIST_NODE_INIT(node, __prio) \ 119#define PLIST_NODE_INIT(node, __prio) \
117{ \ 120{ \
118 .prio = (__prio), \ 121 .prio = (__prio), \
119 .plist = PLIST_HEAD_INIT((node).plist, NULL), \ 122 .plist = { _PLIST_HEAD_INIT((node).plist) }, \
120} 123}
121 124
122/** 125/**
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 24ba5f67b3a3..1d4e2d289821 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -400,6 +400,9 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
400 400
401#else /* !CONFIG_PM_SLEEP */ 401#else /* !CONFIG_PM_SLEEP */
402 402
403#define device_pm_lock() do {} while (0)
404#define device_pm_unlock() do {} while (0)
405
403static inline int device_suspend(pm_message_t state) 406static inline int device_suspend(pm_message_t state)
404{ 407{
405 return 0; 408 return 0;
@@ -409,6 +412,14 @@ static inline int device_suspend(pm_message_t state)
409 412
410#endif /* !CONFIG_PM_SLEEP */ 413#endif /* !CONFIG_PM_SLEEP */
411 414
415/* How to reorder dpm_list after device_move() */
416enum dpm_order {
417 DPM_ORDER_NONE,
418 DPM_ORDER_DEV_AFTER_PARENT,
419 DPM_ORDER_PARENT_BEFORE_DEV,
420 DPM_ORDER_DEV_LAST,
421};
422
412/* 423/*
413 * Global Power Management flags 424 * Global Power Management flags
414 * Used to keep APM and ACPI from both being active 425 * Used to keep APM and ACPI from both being active
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 9f31683728fd..6729f7dcd60e 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -17,6 +17,9 @@
17 */ 17 */
18#define TIMER_ENTRY_STATIC ((void *) 0x74737461) 18#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
19 19
20/********** mm/debug-pagealloc.c **********/
21#define PAGE_POISON 0xaa
22
20/********** mm/slab.c **********/ 23/********** mm/slab.c **********/
21/* 24/*
22 * Magic nums for obj red zoning. 25 * Magic nums for obj red zoning.
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 8ff25e0e7f7a..594c494ac3f0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -73,6 +73,8 @@ enum power_supply_property {
73 POWER_SUPPLY_PROP_VOLTAGE_AVG, 73 POWER_SUPPLY_PROP_VOLTAGE_AVG,
74 POWER_SUPPLY_PROP_CURRENT_NOW, 74 POWER_SUPPLY_PROP_CURRENT_NOW,
75 POWER_SUPPLY_PROP_CURRENT_AVG, 75 POWER_SUPPLY_PROP_CURRENT_AVG,
76 POWER_SUPPLY_PROP_POWER_NOW,
77 POWER_SUPPLY_PROP_POWER_AVG,
76 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 78 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
77 POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, 79 POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
78 POWER_SUPPLY_PROP_CHARGE_FULL, 80 POWER_SUPPLY_PROP_CHARGE_FULL,
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index a942892d6dfe..0d3fa63e90ea 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -22,6 +22,7 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <linux/poll.h> 24#include <linux/poll.h>
25#include <net/net_namespace.h>
25 26
26struct ppp_channel; 27struct ppp_channel;
27 28
@@ -39,8 +40,8 @@ struct ppp_channel {
39 int mtu; /* max transmit packet size */ 40 int mtu; /* max transmit packet size */
40 int hdrlen; /* amount of headroom channel needs */ 41 int hdrlen; /* amount of headroom channel needs */
41 void *ppp; /* opaque to channel */ 42 void *ppp; /* opaque to channel */
42 /* the following are not used at present */
43 int speed; /* transfer rate (bytes/second) */ 43 int speed; /* transfer rate (bytes/second) */
44 /* the following is not used at present */
44 int latency; /* overhead time in milliseconds */ 45 int latency; /* overhead time in milliseconds */
45}; 46};
46 47
@@ -56,6 +57,9 @@ extern void ppp_input(struct ppp_channel *, struct sk_buff *);
56 that we may have missed a packet. */ 57 that we may have missed a packet. */
57extern void ppp_input_error(struct ppp_channel *, int code); 58extern void ppp_input_error(struct ppp_channel *, int code);
58 59
60/* Attach a channel to a given PPP unit in specified net. */
61extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
62
59/* Attach a channel to a given PPP unit. */ 63/* Attach a channel to a given PPP unit. */
60extern int ppp_register_channel(struct ppp_channel *); 64extern int ppp_register_channel(struct ppp_channel *);
61 65
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index 1c866bda2018..0f93ed6b4a88 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -177,8 +177,8 @@ struct ppp_comp_stats {
177 * the last NP packet was sent or received. 177 * the last NP packet was sent or received.
178 */ 178 */
179struct ppp_idle { 179struct ppp_idle {
180 time_t xmit_idle; /* time since last NP packet sent */ 180 __kernel_time_t xmit_idle; /* time since last NP packet sent */
181 time_t recv_idle; /* time since last NP packet received */ 181 __kernel_time_t recv_idle; /* time since last NP packet received */
182}; 182};
183 183
184#endif /* _PPP_DEFS_H_ */ 184#endif /* _PPP_DEFS_H_ */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index b8bdb96eff78..fbfa3d44d33d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -41,9 +41,6 @@ enum {
41 * while parent/subdir create the directory structure (every 41 * while parent/subdir create the directory structure (every
42 * /proc file has a parent, but "subdir" is NULL for all 42 * /proc file has a parent, but "subdir" is NULL for all
43 * non-directory entries). 43 * non-directory entries).
44 *
45 * "owner" is used to protect module
46 * from unloading while proc_dir_entry is in use
47 */ 44 */
48 45
49typedef int (read_proc_t)(char *page, char **start, off_t off, 46typedef int (read_proc_t)(char *page, char **start, off_t off,
@@ -70,7 +67,6 @@ struct proc_dir_entry {
70 * somewhere. 67 * somewhere.
71 */ 68 */
72 const struct file_operations *proc_fops; 69 const struct file_operations *proc_fops;
73 struct module *owner;
74 struct proc_dir_entry *next, *parent, *subdir; 70 struct proc_dir_entry *next, *parent, *subdir;
75 void *data; 71 void *data;
76 read_proc_t *read_proc; 72 read_proc_t *read_proc;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 98b93ca4db06..67c15653fc23 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void exit_ptrace(struct task_struct *tracer);
97extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags); 98extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
98#define PTRACE_MODE_READ 1 99#define PTRACE_MODE_READ 1
99#define PTRACE_MODE_ATTACH 2 100#define PTRACE_MODE_ATTACH 2
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 3945f803d514..7c775751392c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -28,4 +28,4 @@ int pwm_enable(struct pwm_device *pwm);
28 */ 28 */
29void pwm_disable(struct pwm_device *pwm); 29void pwm_disable(struct pwm_device *pwm);
30 30
31#endif /* __ASM_ARCH_PWM_H */ 31#endif /* __LINUX_PWM_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d72d5d84fde5..78c48895b12a 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -198,6 +198,7 @@ struct mem_dqblk {
198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ 198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */ 199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
200 qsize_t dqb_curspace; /* current used space */ 200 qsize_t dqb_curspace; /* current used space */
201 qsize_t dqb_rsvspace; /* current reserved space for delalloc*/
201 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */ 202 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
202 qsize_t dqb_isoftlimit; /* preferred inode limit */ 203 qsize_t dqb_isoftlimit; /* preferred inode limit */
203 qsize_t dqb_curinodes; /* current # allocated inodes */ 204 qsize_t dqb_curinodes; /* current # allocated inodes */
@@ -276,8 +277,6 @@ struct dquot {
276 struct mem_dqblk dq_dqb; /* Diskquota usage */ 277 struct mem_dqblk dq_dqb; /* Diskquota usage */
277}; 278};
278 279
279#define NODQUOT (struct dquot *)NULL
280
281#define QUOTA_OK 0 280#define QUOTA_OK 0
282#define NO_QUOTA 1 281#define NO_QUOTA 1
283 282
@@ -308,6 +307,14 @@ struct dquot_operations {
308 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 307 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
309 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 308 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
310 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ 309 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
310 /* reserve quota for delayed block allocation */
311 int (*reserve_space) (struct inode *, qsize_t, int);
312 /* claim reserved quota for delayed alloc */
313 int (*claim_space) (struct inode *, qsize_t);
314 /* release rsved quota for delayed alloc */
315 void (*release_rsv) (struct inode *, qsize_t);
316 /* get reserved quota for delayed alloc */
317 qsize_t (*get_reserved_space) (struct inode *);
311}; 318};
312 319
313/* Operations handling requests from userspace */ 320/* Operations handling requests from userspace */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 0b35b3a1be05..36353d95c8db 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -35,6 +35,11 @@ void dquot_destroy(struct dquot *dquot);
35int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 35int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
36int dquot_alloc_inode(const struct inode *inode, qsize_t number); 36int dquot_alloc_inode(const struct inode *inode, qsize_t number);
37 37
38int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
39int dquot_claim_space(struct inode *inode, qsize_t number);
40void dquot_release_reserved_space(struct inode *inode, qsize_t number);
41qsize_t dquot_get_reserved_space(struct inode *inode);
42
38int dquot_free_space(struct inode *inode, qsize_t number); 43int dquot_free_space(struct inode *inode, qsize_t number);
39int dquot_free_inode(const struct inode *inode, qsize_t number); 44int dquot_free_inode(const struct inode *inode, qsize_t number);
40 45
@@ -183,6 +188,16 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
183 return ret; 188 return ret;
184} 189}
185 190
191static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
192{
193 if (sb_any_quota_active(inode->i_sb)) {
194 /* Used space is updated in alloc_space() */
195 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
196 return 1;
197 }
198 return 0;
199}
200
186static inline int vfs_dq_alloc_inode(struct inode *inode) 201static inline int vfs_dq_alloc_inode(struct inode *inode)
187{ 202{
188 if (sb_any_quota_active(inode->i_sb)) { 203 if (sb_any_quota_active(inode->i_sb)) {
@@ -193,6 +208,31 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
193 return 0; 208 return 0;
194} 209}
195 210
211/*
212 * Convert in-memory reserved quotas to real consumed quotas
213 */
214static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
215{
216 if (sb_any_quota_active(inode->i_sb)) {
217 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
218 return 1;
219 } else
220 inode_add_bytes(inode, nr);
221
222 mark_inode_dirty(inode);
223 return 0;
224}
225
226/*
227 * Release reserved (in-memory) quotas
228 */
229static inline
230void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
231{
232 if (sb_any_quota_active(inode->i_sb))
233 inode->i_sb->dq_op->release_rsv(inode, nr);
234}
235
196static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 236static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
197{ 237{
198 if (sb_any_quota_active(inode->i_sb)) 238 if (sb_any_quota_active(inode->i_sb))
@@ -339,6 +379,22 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
339 return 0; 379 return 0;
340} 380}
341 381
382static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
383{
384 return 0;
385}
386
387static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
388{
389 return vfs_dq_alloc_space(inode, nr);
390}
391
392static inline
393int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
394{
395 return 0;
396}
397
342static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 398static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
343{ 399{
344 inode_sub_bytes(inode, nr); 400 inode_sub_bytes(inode, nr);
@@ -354,67 +410,48 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
354 410
355static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) 411static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
356{ 412{
357 return vfs_dq_prealloc_space_nodirty(inode, 413 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
358 nr << inode->i_sb->s_blocksize_bits);
359} 414}
360 415
361static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) 416static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
362{ 417{
363 return vfs_dq_prealloc_space(inode, 418 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
364 nr << inode->i_sb->s_blocksize_bits);
365} 419}
366 420
367static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) 421static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
368{ 422{
369 return vfs_dq_alloc_space_nodirty(inode, 423 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
370 nr << inode->i_sb->s_blocksize_bits);
371} 424}
372 425
373static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) 426static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
374{ 427{
375 return vfs_dq_alloc_space(inode, 428 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
376 nr << inode->i_sb->s_blocksize_bits); 429}
430
431static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
432{
433 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
434}
435
436static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
437{
438 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
439}
440
441static inline
442void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
443{
444 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
377} 445}
378 446
379static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) 447static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
380{ 448{
381 vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); 449 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
382} 450}
383 451
384static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) 452static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
385{ 453{
386 vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); 454 vfs_dq_free_space(inode, nr << inode->i_blkbits);
387} 455}
388 456
389/*
390 * Define uppercase equivalents for compatibility with old function names
391 * Can go away when we think all users have been converted (15/04/2008)
392 */
393#define DQUOT_INIT(inode) vfs_dq_init(inode)
394#define DQUOT_DROP(inode) vfs_dq_drop(inode)
395#define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \
396 vfs_dq_prealloc_space_nodirty(inode, nr)
397#define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr)
398#define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \
399 vfs_dq_alloc_space_nodirty(inode, nr)
400#define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr)
401#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \
402 vfs_dq_prealloc_block_nodirty(inode, nr)
403#define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr)
404#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \
405 vfs_dq_alloc_block_nodirty(inode, nr)
406#define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
407#define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
408#define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
409 vfs_dq_free_space_nodirty(inode, nr)
410#define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr)
411#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \
412 vfs_dq_free_block_nodirty(inode, nr)
413#define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr)
414#define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode)
415#define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr)
416#define DQUOT_SYNC(sb) vfs_dq_sync(sb)
417#define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
418#define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb)
419
420#endif /* _LINUX_QUOTAOPS_ */ 457#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
deleted file mode 100644
index e98900671ca9..000000000000
--- a/include/linux/raid/bitmap.h
+++ /dev/null
@@ -1,288 +0,0 @@
1/*
2 * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
3 *
4 * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
5 */
6#ifndef BITMAP_H
7#define BITMAP_H 1
8
9#define BITMAP_MAJOR_LO 3
10/* version 4 insists the bitmap is in little-endian order
11 * with version 3, it is host-endian which is non-portable
12 */
13#define BITMAP_MAJOR_HI 4
14#define BITMAP_MAJOR_HOSTENDIAN 3
15
16#define BITMAP_MINOR 39
17
18/*
19 * in-memory bitmap:
20 *
21 * Use 16 bit block counters to track pending writes to each "chunk".
22 * The 2 high order bits are special-purpose, the first is a flag indicating
23 * whether a resync is needed. The second is a flag indicating whether a
24 * resync is active.
25 * This means that the counter is actually 14 bits:
26 *
27 * +--------+--------+------------------------------------------------+
28 * | resync | resync | counter |
29 * | needed | active | |
30 * | (0-1) | (0-1) | (0-16383) |
31 * +--------+--------+------------------------------------------------+
32 *
33 * The "resync needed" bit is set when:
34 * a '1' bit is read from storage at startup.
35 * a write request fails on some drives
36 * a resync is aborted on a chunk with 'resync active' set
37 * It is cleared (and resync-active set) when a resync starts across all drives
38 * of the chunk.
39 *
40 *
41 * The "resync active" bit is set when:
42 * a resync is started on all drives, and resync_needed is set.
43 * resync_needed will be cleared (as long as resync_active wasn't already set).
44 * It is cleared when a resync completes.
45 *
46 * The counter counts pending write requests, plus the on-disk bit.
47 * When the counter is '1' and the resync bits are clear, the on-disk
48 * bit can be cleared aswell, thus setting the counter to 0.
49 * When we set a bit, or in the counter (to start a write), if the fields is
50 * 0, we first set the disk bit and set the counter to 1.
51 *
52 * If the counter is 0, the on-disk bit is clear and the stipe is clean
53 * Anything that dirties the stipe pushes the counter to 2 (at least)
54 * and sets the on-disk bit (lazily).
55 * If a periodic sweep find the counter at 2, it is decremented to 1.
56 * If the sweep find the counter at 1, the on-disk bit is cleared and the
57 * counter goes to zero.
58 *
59 * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
60 * counters as a fallback when "page" memory cannot be allocated:
61 *
62 * Normal case (page memory allocated):
63 *
64 * page pointer (32-bit)
65 *
66 * [ ] ------+
67 * |
68 * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
69 * c1 c2 c2048
70 *
71 * Hijacked case (page memory allocation failed):
72 *
73 * hijacked page pointer (32-bit)
74 *
75 * [ ][ ] (no page memory allocated)
76 * counter #1 (16-bit) counter #2 (16-bit)
77 *
78 */
79
80#ifdef __KERNEL__
81
82#define PAGE_BITS (PAGE_SIZE << 3)
83#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
84
85typedef __u16 bitmap_counter_t;
86#define COUNTER_BITS 16
87#define COUNTER_BIT_SHIFT 4
88#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
89#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
90
91#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
92#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
93#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
94#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
95#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
96#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
97
98/* how many counters per page? */
99#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
100/* same, except a shift value for more efficient bitops */
101#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
102/* same, except a mask value for more efficient bitops */
103#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
104
105#define BITMAP_BLOCK_SIZE 512
106#define BITMAP_BLOCK_SHIFT 9
107
108/* how many blocks per chunk? (this is variable) */
109#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
110#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
111#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
112
113/* when hijacked, the counters and bits represent even larger "chunks" */
114/* there will be 1024 chunks represented by each counter in the page pointers */
115#define PAGEPTR_BLOCK_RATIO(bitmap) \
116 (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
117#define PAGEPTR_BLOCK_SHIFT(bitmap) \
118 (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
119#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
120
121/*
122 * on-disk bitmap:
123 *
124 * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
125 * file a page at a time. There's a superblock at the start of the file.
126 */
127
128/* map chunks (bits) to file pages - offset by the size of the superblock */
129#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
130
131#endif
132
133/*
134 * bitmap structures:
135 */
136
137#define BITMAP_MAGIC 0x6d746962
138
139/* use these for bitmap->flags and bitmap->sb->state bit-fields */
140enum bitmap_state {
141 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
142 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
143 BITMAP_HOSTENDIAN = 0x8000,
144};
145
146/* the superblock at the front of the bitmap file -- little endian */
147typedef struct bitmap_super_s {
148 __le32 magic; /* 0 BITMAP_MAGIC */
149 __le32 version; /* 4 the bitmap major for now, could change... */
150 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
151 __le64 events; /* 24 event counter for the bitmap (1)*/
152 __le64 events_cleared;/*32 event counter when last bit cleared (2) */
153 __le64 sync_size; /* 40 the size of the md device's sync range(3) */
154 __le32 state; /* 48 bitmap state information */
155 __le32 chunksize; /* 52 the bitmap chunk size in bytes */
156 __le32 daemon_sleep; /* 56 seconds between disk flushes */
157 __le32 write_behind; /* 60 number of outstanding write-behind writes */
158
159 __u8 pad[256 - 64]; /* set to zero */
160} bitmap_super_t;
161
162/* notes:
163 * (1) This event counter is updated before the eventcounter in the md superblock
164 * When a bitmap is loaded, it is only accepted if this event counter is equal
165 * to, or one greater than, the event counter in the superblock.
166 * (2) This event counter is updated when the other one is *if*and*only*if* the
167 * array is not degraded. As bits are not cleared when the array is degraded,
168 * this represents the last time that any bits were cleared.
169 * If a device is being added that has an event count with this value or
170 * higher, it is accepted as conforming to the bitmap.
171 * (3)This is the number of sectors represented by the bitmap, and is the range that
172 * resync happens across. For raid1 and raid5/6 it is the size of individual
173 * devices. For raid10 it is the size of the array.
174 */
175
176#ifdef __KERNEL__
177
178/* the in-memory bitmap is represented by bitmap_pages */
179struct bitmap_page {
180 /*
181 * map points to the actual memory page
182 */
183 char *map;
184 /*
185 * in emergencies (when map cannot be alloced), hijack the map
186 * pointer and use it as two counters itself
187 */
188 unsigned int hijacked:1;
189 /*
190 * count of dirty bits on the page
191 */
192 unsigned int count:31;
193};
194
195/* keep track of bitmap file pages that have pending writes on them */
196struct page_list {
197 struct list_head list;
198 struct page *page;
199};
200
201/* the main bitmap structure - one per mddev */
202struct bitmap {
203 struct bitmap_page *bp;
204 unsigned long pages; /* total number of pages in the bitmap */
205 unsigned long missing_pages; /* number of pages not yet allocated */
206
207 mddev_t *mddev; /* the md device that the bitmap is for */
208
209 int counter_bits; /* how many bits per block counter */
210
211 /* bitmap chunksize -- how much data does each bit represent? */
212 unsigned long chunksize;
213 unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
214 unsigned long chunks; /* total number of data chunks for the array */
215
216 /* We hold a count on the chunk currently being synced, and drop
217 * it when the last block is started. If the resync is aborted
218 * midway, we need to be able to drop that count, so we remember
219 * the counted chunk..
220 */
221 unsigned long syncchunk;
222
223 __u64 events_cleared;
224 int need_sync;
225
226 /* bitmap spinlock */
227 spinlock_t lock;
228
229 long offset; /* offset from superblock if file is NULL */
230 struct file *file; /* backing disk file */
231 struct page *sb_page; /* cached copy of the bitmap file superblock */
232 struct page **filemap; /* list of cache pages for the file */
233 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
234 unsigned long file_pages; /* number of pages in the file */
235 int last_page_size; /* bytes in the last page */
236
237 unsigned long flags;
238
239 int allclean;
240
241 unsigned long max_write_behind; /* write-behind mode */
242 atomic_t behind_writes;
243
244 /*
245 * the bitmap daemon - periodically wakes up and sweeps the bitmap
246 * file, cleaning up bits and flushing out pages to disk as necessary
247 */
248 unsigned long daemon_lastrun; /* jiffies of last run */
249 unsigned long daemon_sleep; /* how many seconds between updates? */
250 unsigned long last_end_sync; /* when we lasted called end_sync to
251 * update bitmap with resync progress */
252
253 atomic_t pending_writes; /* pending writes to the bitmap file */
254 wait_queue_head_t write_wait;
255 wait_queue_head_t overflow_wait;
256
257};
258
259/* the bitmap API */
260
261/* these are used only by md/bitmap */
262int bitmap_create(mddev_t *mddev);
263void bitmap_flush(mddev_t *mddev);
264void bitmap_destroy(mddev_t *mddev);
265
266void bitmap_print_sb(struct bitmap *bitmap);
267void bitmap_update_sb(struct bitmap *bitmap);
268
269int bitmap_setallbits(struct bitmap *bitmap);
270void bitmap_write_all(struct bitmap *bitmap);
271
272void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e);
273
274/* these are exported */
275int bitmap_startwrite(struct bitmap *bitmap, sector_t offset,
276 unsigned long sectors, int behind);
277void bitmap_endwrite(struct bitmap *bitmap, sector_t offset,
278 unsigned long sectors, int success, int behind);
279int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded);
280void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
281void bitmap_close_sync(struct bitmap *bitmap);
282void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
283
284void bitmap_unplug(struct bitmap *bitmap);
285void bitmap_daemon_work(struct bitmap *bitmap);
286#endif
287
288#endif
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
deleted file mode 100644
index f38b9c586afb..000000000000
--- a/include/linux/raid/linear.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _LINEAR_H
2#define _LINEAR_H
3
4#include <linux/raid/md.h>
5
6struct dev_info {
7 mdk_rdev_t *rdev;
8 sector_t num_sectors;
9 sector_t start_sector;
10};
11
12typedef struct dev_info dev_info_t;
13
14struct linear_private_data
15{
16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table;
18 sector_t spacing;
19 sector_t array_sectors;
20 int sector_shift; /* shift before dividing
21 * by spacing
22 */
23 dev_info_t disks[0];
24};
25
26
27typedef struct linear_private_data linear_conf_t;
28
29#define mddev_to_conf(mddev) ((linear_conf_t *) mddev->private)
30
31#endif
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
deleted file mode 100644
index 82bea14cae1a..000000000000
--- a/include/linux/raid/md.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 md.h : Multiple Devices driver for Linux
3 Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
4 Copyright (C) 1994-96 Marc ZYNGIER
5 <zyngier@ufr-info-p7.ibp.fr> or
6 <maz@gloups.fdn.fr>
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, or (at your option)
11 any later version.
12
13 You should have received a copy of the GNU General Public License
14 (for example /usr/src/linux/COPYING); if not, write to the Free
15 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16*/
17
18#ifndef _MD_H
19#define _MD_H
20
21#include <linux/blkdev.h>
22#include <linux/seq_file.h>
23
24/*
25 * 'md_p.h' holds the 'physical' layout of RAID devices
26 * 'md_u.h' holds the user <=> kernel API
27 *
28 * 'md_k.h' holds kernel internal definitions
29 */
30
31#include <linux/raid/md_p.h>
32#include <linux/raid/md_u.h>
33#include <linux/raid/md_k.h>
34
35#ifdef CONFIG_MD
36
37/*
38 * Different major versions are not compatible.
39 * Different minor versions are only downward compatible.
40 * Different patchlevel versions are downward and upward compatible.
41 */
42#define MD_MAJOR_VERSION 0
43#define MD_MINOR_VERSION 90
44/*
45 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
46 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
47 * and major_version/minor_version accordingly
48 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
49 * in the super status byte
50 * >=3 means that bitmap superblock version 4 is supported, which uses
51 * little-ending representation rather than host-endian
52 */
53#define MD_PATCHLEVEL_VERSION 3
54
55extern int mdp_major;
56
57extern int register_md_personality(struct mdk_personality *p);
58extern int unregister_md_personality(struct mdk_personality *p);
59extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
60 mddev_t *mddev, const char *name);
61extern void md_unregister_thread(mdk_thread_t *thread);
62extern void md_wakeup_thread(mdk_thread_t *thread);
63extern void md_check_recovery(mddev_t *mddev);
64extern void md_write_start(mddev_t *mddev, struct bio *bi);
65extern void md_write_end(mddev_t *mddev);
66extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
67extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
68
69extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
70 sector_t sector, int size, struct page *page);
71extern void md_super_wait(mddev_t *mddev);
72extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
73 struct page *page, int rw);
74extern void md_do_sync(mddev_t *mddev);
75extern void md_new_event(mddev_t *mddev);
76extern int md_allow_write(mddev_t *mddev);
77extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
78
79#endif /* CONFIG_MD */
80#endif
81
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
deleted file mode 100644
index 9743e4dbc918..000000000000
--- a/include/linux/raid/md_k.h
+++ /dev/null
@@ -1,402 +0,0 @@
1/*
2 md_k.h : kernel internal structure of the Linux MD driver
3 Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 You should have received a copy of the GNU General Public License
11 (for example /usr/src/linux/COPYING); if not, write to the Free
12 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13*/
14
15#ifndef _MD_K_H
16#define _MD_K_H
17
18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h"
20
21#ifdef CONFIG_BLOCK
22
23#define LEVEL_MULTIPATH (-4)
24#define LEVEL_LINEAR (-1)
25#define LEVEL_FAULTY (-5)
26
27/* we need a value for 'no level specified' and 0
28 * means 'raid0', so we need something else. This is
29 * for internal use only
30 */
31#define LEVEL_NONE (-1000000)
32
33#define MaxSector (~(sector_t)0)
34
35typedef struct mddev_s mddev_t;
36typedef struct mdk_rdev_s mdk_rdev_t;
37
38/*
39 * options passed in raidrun:
40 */
41
42/* Currently this must fit in an 'int' */
43#define MAX_CHUNK_SIZE (1<<30)
44
45/*
46 * MD's 'extended' device
47 */
48struct mdk_rdev_s
49{
50 struct list_head same_set; /* RAID devices within the same set */
51
52 sector_t size; /* Device size (in blocks) */
53 mddev_t *mddev; /* RAID array if running */
54 long last_events; /* IO event timestamp */
55
56 struct block_device *bdev; /* block device handle */
57
58 struct page *sb_page;
59 int sb_loaded;
60 __u64 sb_events;
61 sector_t data_offset; /* start of data in array */
62 sector_t sb_start; /* offset of the super block (in 512byte sectors) */
63 int sb_size; /* bytes in the superblock */
64 int preferred_minor; /* autorun support */
65
66 struct kobject kobj;
67
68 /* A device can be in one of three states based on two flags:
69 * Not working: faulty==1 in_sync==0
70 * Fully working: faulty==0 in_sync==1
71 * Working, but not
72 * in sync with array
73 * faulty==0 in_sync==0
74 *
75 * It can never have faulty==1, in_sync==1
76 * This reduces the burden of testing multiple flags in many cases
77 */
78
79 unsigned long flags;
80#define Faulty 1 /* device is known to have a fault */
81#define In_sync 2 /* device is in_sync with rest of array */
82#define WriteMostly 4 /* Avoid reading if at all possible */
83#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
84#define AllReserved 6 /* If whole device is reserved for
85 * one array */
86#define AutoDetected 7 /* added by auto-detect */
87#define Blocked 8 /* An error occured on an externally
88 * managed array, don't allow writes
89 * until it is cleared */
90#define StateChanged 9 /* Faulty or Blocked has changed during
91 * interrupt, so it needs to be
92 * notified by the thread */
93 wait_queue_head_t blocked_wait;
94
95 int desc_nr; /* descriptor index in the superblock */
96 int raid_disk; /* role of device in array */
97 int saved_raid_disk; /* role that device used to have in the
98 * array and could again if we did a partial
99 * resync from the bitmap
100 */
101 sector_t recovery_offset;/* If this device has been partially
102 * recovered, this is where we were
103 * up to.
104 */
105
106 atomic_t nr_pending; /* number of pending requests.
107 * only maintained for arrays that
108 * support hot removal
109 */
110 atomic_t read_errors; /* number of consecutive read errors that
111 * we have tried to ignore.
112 */
113 atomic_t corrected_errors; /* number of corrected read errors,
114 * for reporting to userspace and storing
115 * in superblock.
116 */
117 struct work_struct del_work; /* used for delayed sysfs removal */
118
119 struct sysfs_dirent *sysfs_state; /* handle for 'state'
120 * sysfs entry */
121};
122
123struct mddev_s
124{
125 void *private;
126 struct mdk_personality *pers;
127 dev_t unit;
128 int md_minor;
129 struct list_head disks;
130 unsigned long flags;
131#define MD_CHANGE_DEVS 0 /* Some device status has changed */
132#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
133#define MD_CHANGE_PENDING 2 /* superblock update in progress */
134
135 int ro;
136
137 struct gendisk *gendisk;
138
139 struct kobject kobj;
140 int hold_active;
141#define UNTIL_IOCTL 1
142#define UNTIL_STOP 2
143
144 /* Superblock information */
145 int major_version,
146 minor_version,
147 patch_version;
148 int persistent;
149 int external; /* metadata is
150 * managed externally */
151 char metadata_type[17]; /* externally set*/
152 int chunk_size;
153 time_t ctime, utime;
154 int level, layout;
155 char clevel[16];
156 int raid_disks;
157 int max_disks;
158 sector_t size; /* used size of component devices */
159 sector_t array_sectors; /* exported array size */
160 __u64 events;
161
162 char uuid[16];
163
164 /* If the array is being reshaped, we need to record the
165 * new shape and an indication of where we are up to.
166 * This is written to the superblock.
167 * If reshape_position is MaxSector, then no reshape is happening (yet).
168 */
169 sector_t reshape_position;
170 int delta_disks, new_level, new_layout, new_chunk;
171
172 struct mdk_thread_s *thread; /* management thread */
173 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
174 sector_t curr_resync; /* last block scheduled */
175 unsigned long resync_mark; /* a recent timestamp */
176 sector_t resync_mark_cnt;/* blocks written at resync_mark */
177 sector_t curr_mark_cnt; /* blocks scheduled now */
178
179 sector_t resync_max_sectors; /* may be set by personality */
180
181 sector_t resync_mismatches; /* count of sectors where
182 * parity/replica mismatch found
183 */
184
185 /* allow user-space to request suspension of IO to regions of the array */
186 sector_t suspend_lo;
187 sector_t suspend_hi;
188 /* if zero, use the system-wide default */
189 int sync_speed_min;
190 int sync_speed_max;
191
192 /* resync even though the same disks are shared among md-devices */
193 int parallel_resync;
194
195 int ok_start_degraded;
196 /* recovery/resync flags
197 * NEEDED: we might need to start a resync/recover
198 * RUNNING: a thread is running, or about to be started
199 * SYNC: actually doing a resync, not a recovery
200 * RECOVER: doing recovery, or need to try it.
201 * INTR: resync needs to be aborted for some reason
202 * DONE: thread is done and is waiting to be reaped
203 * REQUEST: user-space has requested a sync (used with SYNC)
204 * CHECK: user-space request for for check-only, no repair
205 * RESHAPE: A reshape is happening
206 *
207 * If neither SYNC or RESHAPE are set, then it is a recovery.
208 */
209#define MD_RECOVERY_RUNNING 0
210#define MD_RECOVERY_SYNC 1
211#define MD_RECOVERY_RECOVER 2
212#define MD_RECOVERY_INTR 3
213#define MD_RECOVERY_DONE 4
214#define MD_RECOVERY_NEEDED 5
215#define MD_RECOVERY_REQUESTED 6
216#define MD_RECOVERY_CHECK 7
217#define MD_RECOVERY_RESHAPE 8
218#define MD_RECOVERY_FROZEN 9
219
220 unsigned long recovery;
221 int recovery_disabled; /* if we detect that recovery
222 * will always fail, set this
223 * so we don't loop trying */
224
225 int in_sync; /* know to not need resync */
226 struct mutex reconfig_mutex;
227 atomic_t active; /* general refcount */
228 atomic_t openers; /* number of active opens */
229
230 int changed; /* true if we might need to reread partition info */
231 int degraded; /* whether md should consider
232 * adding a spare
233 */
234 int barriers_work; /* initialised to true, cleared as soon
235 * as a barrier request to slave
236 * fails. Only supported
237 */
238 struct bio *biolist; /* bios that need to be retried
239 * because BIO_RW_BARRIER is not supported
240 */
241
242 atomic_t recovery_active; /* blocks scheduled, but not written */
243 wait_queue_head_t recovery_wait;
244 sector_t recovery_cp;
245 sector_t resync_min; /* user requested sync
246 * starts here */
247 sector_t resync_max; /* resync should pause
248 * when it gets here */
249
250 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
251 * file in sysfs.
252 */
253 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
254
255 struct work_struct del_work; /* used for delayed sysfs removal */
256
257 spinlock_t write_lock;
258 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
259 atomic_t pending_writes; /* number of active superblock writes */
260
261 unsigned int safemode; /* if set, update "clean" superblock
262 * when no writes pending.
263 */
264 unsigned int safemode_delay;
265 struct timer_list safemode_timer;
266 atomic_t writes_pending;
267 struct request_queue *queue; /* for plugging ... */
268
269 atomic_t write_behind; /* outstanding async IO */
270 unsigned int max_write_behind; /* 0 = sync */
271
272 struct bitmap *bitmap; /* the bitmap for the device */
273 struct file *bitmap_file; /* the bitmap file */
274 long bitmap_offset; /* offset from superblock of
275 * start of bitmap. May be
276 * negative, but not '0'
277 */
278 long default_bitmap_offset; /* this is the offset to use when
279 * hot-adding a bitmap. It should
280 * eventually be settable by sysfs.
281 */
282
283 struct list_head all_mddevs;
284};
285
286
287static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
288{
289 int faulty = test_bit(Faulty, &rdev->flags);
290 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
291 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
292}
293
294static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
295{
296 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
297}
298
299struct mdk_personality
300{
301 char *name;
302 int level;
303 struct list_head list;
304 struct module *owner;
305 int (*make_request)(struct request_queue *q, struct bio *bio);
306 int (*run)(mddev_t *mddev);
307 int (*stop)(mddev_t *mddev);
308 void (*status)(struct seq_file *seq, mddev_t *mddev);
309 /* error_handler must set ->faulty and clear ->in_sync
310 * if appropriate, and should abort recovery if needed
311 */
312 void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
313 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
314 int (*hot_remove_disk) (mddev_t *mddev, int number);
315 int (*spare_active) (mddev_t *mddev);
316 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
317 int (*resize) (mddev_t *mddev, sector_t sectors);
318 int (*check_reshape) (mddev_t *mddev);
319 int (*start_reshape) (mddev_t *mddev);
320 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
321 /* quiesce moves between quiescence states
322 * 0 - fully active
323 * 1 - no new requests allowed
324 * others - reserved
325 */
326 void (*quiesce) (mddev_t *mddev, int state);
327};
328
329
330struct md_sysfs_entry {
331 struct attribute attr;
332 ssize_t (*show)(mddev_t *, char *);
333 ssize_t (*store)(mddev_t *, const char *, size_t);
334};
335
336
337static inline char * mdname (mddev_t * mddev)
338{
339 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
340}
341
342/*
343 * iterates through some rdev ringlist. It's safe to remove the
344 * current 'rdev'. Dont touch 'tmp' though.
345 */
346#define rdev_for_each_list(rdev, tmp, head) \
347 list_for_each_entry_safe(rdev, tmp, head, same_set)
348
349/*
350 * iterates through the 'same array disks' ringlist
351 */
352#define rdev_for_each(rdev, tmp, mddev) \
353 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
354
355#define rdev_for_each_rcu(rdev, mddev) \
356 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
357
358typedef struct mdk_thread_s {
359 void (*run) (mddev_t *mddev);
360 mddev_t *mddev;
361 wait_queue_head_t wqueue;
362 unsigned long flags;
363 struct task_struct *tsk;
364 unsigned long timeout;
365} mdk_thread_t;
366
367#define THREAD_WAKEUP 0
368
369#define __wait_event_lock_irq(wq, condition, lock, cmd) \
370do { \
371 wait_queue_t __wait; \
372 init_waitqueue_entry(&__wait, current); \
373 \
374 add_wait_queue(&wq, &__wait); \
375 for (;;) { \
376 set_current_state(TASK_UNINTERRUPTIBLE); \
377 if (condition) \
378 break; \
379 spin_unlock_irq(&lock); \
380 cmd; \
381 schedule(); \
382 spin_lock_irq(&lock); \
383 } \
384 current->state = TASK_RUNNING; \
385 remove_wait_queue(&wq, &__wait); \
386} while (0)
387
388#define wait_event_lock_irq(wq, condition, lock, cmd) \
389do { \
390 if (condition) \
391 break; \
392 __wait_event_lock_irq(wq, condition, lock, cmd); \
393} while (0)
394
395static inline void safe_put_page(struct page *p)
396{
397 if (p) put_page(p);
398}
399
400#endif /* CONFIG_BLOCK */
401#endif
402
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index 7192035fc4b0..fb1abb3367e9 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -15,6 +15,24 @@
15#ifndef _MD_U_H 15#ifndef _MD_U_H
16#define _MD_U_H 16#define _MD_U_H
17 17
18/*
19 * Different major versions are not compatible.
20 * Different minor versions are only downward compatible.
21 * Different patchlevel versions are downward and upward compatible.
22 */
23#define MD_MAJOR_VERSION 0
24#define MD_MINOR_VERSION 90
25/*
26 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
27 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
28 * and major_version/minor_version accordingly
29 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
30 * in the super status byte
31 * >=3 means that bitmap superblock version 4 is supported, which uses
32 * little-ending representation rather than host-endian
33 */
34#define MD_PATCHLEVEL_VERSION 3
35
18/* ioctls */ 36/* ioctls */
19 37
20/* status */ 38/* status */
@@ -46,6 +64,12 @@
46#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) 64#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
47#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) 65#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
48 66
67/* 63 partitions with the alternate major number (mdp) */
68#define MdpMinorShift 6
69#ifdef __KERNEL__
70extern int mdp_major;
71#endif
72
49typedef struct mdu_version_s { 73typedef struct mdu_version_s {
50 int major; 74 int major;
51 int minor; 75 int minor;
@@ -85,6 +109,17 @@ typedef struct mdu_array_info_s {
85 109
86} mdu_array_info_t; 110} mdu_array_info_t;
87 111
112/* non-obvious values for 'level' */
113#define LEVEL_MULTIPATH (-4)
114#define LEVEL_LINEAR (-1)
115#define LEVEL_FAULTY (-5)
116
117/* we need a value for 'no level specified' and 0
118 * means 'raid0', so we need something else. This is
119 * for internal use only
120 */
121#define LEVEL_NONE (-1000000)
122
88typedef struct mdu_disk_info_s { 123typedef struct mdu_disk_info_s {
89 /* 124 /*
90 * configuration/status of one particular disk 125 * configuration/status of one particular disk
diff --git a/include/linux/raid/multipath.h b/include/linux/raid/multipath.h
deleted file mode 100644
index 6f53fc177a47..000000000000
--- a/include/linux/raid/multipath.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _MULTIPATH_H
2#define _MULTIPATH_H
3
4#include <linux/raid/md.h>
5
6struct multipath_info {
7 mdk_rdev_t *rdev;
8};
9
10struct multipath_private_data {
11 mddev_t *mddev;
12 struct multipath_info *multipaths;
13 int raid_disks;
14 int working_disks;
15 spinlock_t device_lock;
16 struct list_head retry_list;
17
18 mempool_t *pool;
19};
20
21typedef struct multipath_private_data multipath_conf_t;
22
23/*
24 * this is the only point in the RAID code where we violate
25 * C type safety. mddev->private is an 'opaque' pointer.
26 */
27#define mddev_to_conf(mddev) ((multipath_conf_t *) mddev->private)
28
29/*
30 * this is our 'private' 'collective' MULTIPATH buffer head.
31 * it contains information about what kind of IO operations were started
32 * for this MULTIPATH operation, and about their status:
33 */
34
35struct multipath_bh {
36 mddev_t *mddev;
37 struct bio *master_bio;
38 struct bio bio;
39 int path;
40 struct list_head retry_list;
41};
42#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
new file mode 100644
index 000000000000..d92480f8285c
--- /dev/null
+++ b/include/linux/raid/pq.h
@@ -0,0 +1,132 @@
1/* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * Copyright 2003 H. Peter Anvin - All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13#ifndef LINUX_RAID_RAID6_H
14#define LINUX_RAID_RAID6_H
15
16#ifdef __KERNEL__
17
18/* Set to 1 to use kernel-wide empty_zero_page */
19#define RAID6_USE_EMPTY_ZERO_PAGE 0
20#include <linux/blkdev.h>
21
22/* We need a pre-zeroed page... if we don't want to use the kernel-provided
23 one define it here */
24#if RAID6_USE_EMPTY_ZERO_PAGE
25# define raid6_empty_zero_page empty_zero_page
26#else
27extern const char raid6_empty_zero_page[PAGE_SIZE];
28#endif
29
30#else /* ! __KERNEL__ */
31/* Used for testing in user space */
32
33#include <errno.h>
34#include <inttypes.h>
35#include <limits.h>
36#include <stddef.h>
37#include <sys/mman.h>
38#include <sys/types.h>
39
40/* Not standard, but glibc defines it */
41#define BITS_PER_LONG __WORDSIZE
42
43typedef uint8_t u8;
44typedef uint16_t u16;
45typedef uint32_t u32;
46typedef uint64_t u64;
47
48#ifndef PAGE_SIZE
49# define PAGE_SIZE 4096
50#endif
51extern const char raid6_empty_zero_page[PAGE_SIZE];
52
53#define __init
54#define __exit
55#define __attribute_const__ __attribute__((const))
56#define noinline __attribute__((noinline))
57
58#define preempt_enable()
59#define preempt_disable()
60#define cpu_has_feature(x) 1
61#define enable_kernel_altivec()
62#define disable_kernel_altivec()
63
64#define EXPORT_SYMBOL(sym)
65#define MODULE_LICENSE(licence)
66#define subsys_initcall(x)
67#define module_exit(x)
68#endif /* __KERNEL__ */
69
70/* Routine choices */
71struct raid6_calls {
72 void (*gen_syndrome)(int, size_t, void **);
73 int (*valid)(void); /* Returns 1 if this routine set is usable */
74 const char *name; /* Name of this routine set */
75 int prefer; /* Has special performance attribute */
76};
77
78/* Selected algorithm */
79extern struct raid6_calls raid6_call;
80
81/* Algorithm list */
82extern const struct raid6_calls * const raid6_algos[];
83int raid6_select_algo(void);
84
85/* Return values from chk_syndrome */
86#define RAID6_OK 0
87#define RAID6_P_BAD 1
88#define RAID6_Q_BAD 2
89#define RAID6_PQ_BAD 3
90
91/* Galois field tables */
92extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
93extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
94extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
95extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
96
97/* Recovery routines */
98void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
99 void **ptrs);
100void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs);
101void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
102 void **ptrs);
103
104/* Some definitions to allow code to be compiled for testing in userspace */
105#ifndef __KERNEL__
106
107# define jiffies raid6_jiffies()
108# define printk printf
109# define GFP_KERNEL 0
110# define __get_free_pages(x, y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), \
111 PROT_READ|PROT_WRITE, \
112 MAP_PRIVATE|MAP_ANONYMOUS,\
113 0, 0))
114# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE)
115
116static inline void cpu_relax(void)
117{
118 /* Nothing */
119}
120
121#undef HZ
122#define HZ 1000
123static inline uint32_t raid6_jiffies(void)
124{
125 struct timeval tv;
126 gettimeofday(&tv, NULL);
127 return tv.tv_sec*1000 + tv.tv_usec/1000;
128}
129
130#endif /* ! __KERNEL__ */
131
132#endif /* LINUX_RAID_RAID6_H */
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
deleted file mode 100644
index fd42aa87c391..000000000000
--- a/include/linux/raid/raid0.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _RAID0_H
2#define _RAID0_H
3
4#include <linux/raid/md.h>
5
6struct strip_zone
7{
8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */
13};
14
15struct raid0_private_data
16{
17 struct strip_zone **hash_table; /* Table of indexes into strip_zone */
18 struct strip_zone *strip_zone;
19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
20 int nr_strip_zones;
21
22 sector_t spacing;
23 int sector_shift; /* shift this before divide by spacing */
24};
25
26typedef struct raid0_private_data raid0_conf_t;
27
28#define mddev_to_conf(mddev) ((raid0_conf_t *) mddev->private)
29
30#endif
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
deleted file mode 100644
index 0a9ba7c3302e..000000000000
--- a/include/linux/raid/raid1.h
+++ /dev/null
@@ -1,134 +0,0 @@
1#ifndef _RAID1_H
2#define _RAID1_H
3
4#include <linux/raid/md.h>
5
6typedef struct mirror_info mirror_info_t;
7
8struct mirror_info {
9 mdk_rdev_t *rdev;
10 sector_t head_position;
11};
12
13/*
14 * memory pools need a pointer to the mddev, so they can force an unplug
15 * when memory is tight, and a count of the number of drives that the
16 * pool was allocated for, so they know how much to allocate and free.
17 * mddev->raid_disks cannot be used, as it can change while a pool is active
18 * These two datums are stored in a kmalloced struct.
19 */
20
21struct pool_info {
22 mddev_t *mddev;
23 int raid_disks;
24};
25
26
27typedef struct r1bio_s r1bio_t;
28
29struct r1_private_data_s {
30 mddev_t *mddev;
31 mirror_info_t *mirrors;
32 int raid_disks;
33 int last_used;
34 sector_t next_seq_sect;
35 spinlock_t device_lock;
36
37 struct list_head retry_list;
38 /* queue pending writes and submit them on unplug */
39 struct bio_list pending_bio_list;
40 /* queue of writes that have been unplugged */
41 struct bio_list flushing_bio_list;
42
43 /* for use when syncing mirrors: */
44
45 spinlock_t resync_lock;
46 int nr_pending;
47 int nr_waiting;
48 int nr_queued;
49 int barrier;
50 sector_t next_resync;
51 int fullsync; /* set to 1 if a full sync is needed,
52 * (fresh device added).
53 * Cleared when a sync completes.
54 */
55
56 wait_queue_head_t wait_barrier;
57
58 struct pool_info *poolinfo;
59
60 struct page *tmppage;
61
62 mempool_t *r1bio_pool;
63 mempool_t *r1buf_pool;
64};
65
66typedef struct r1_private_data_s conf_t;
67
68/*
69 * this is the only point in the RAID code where we violate
70 * C type safety. mddev->private is an 'opaque' pointer.
71 */
72#define mddev_to_conf(mddev) ((conf_t *) mddev->private)
73
74/*
75 * this is our 'private' RAID1 bio.
76 *
77 * it contains information about what kind of IO operations were started
78 * for this RAID1 operation, and about their status:
79 */
80
81struct r1bio_s {
82 atomic_t remaining; /* 'have we finished' count,
83 * used from IRQ handlers
84 */
85 atomic_t behind_remaining; /* number of write-behind ios remaining
86 * in this BehindIO request
87 */
88 sector_t sector;
89 int sectors;
90 unsigned long state;
91 mddev_t *mddev;
92 /*
93 * original bio going to /dev/mdx
94 */
95 struct bio *master_bio;
96 /*
97 * if the IO is in READ direction, then this is where we read
98 */
99 int read_disk;
100
101 struct list_head retry_list;
102 struct bitmap_update *bitmap_update;
103 /*
104 * if the IO is in WRITE direction, then multiple bios are used.
105 * We choose the number when they are allocated.
106 */
107 struct bio *bios[0];
108 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
109};
110
111/* when we get a read error on a read-only array, we redirect to another
112 * device without failing the first device, or trying to over-write to
113 * correct the read error. To keep track of bad blocks on a per-bio
114 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
115 */
116#define IO_BLOCKED ((struct bio*)1)
117
118/* bits for r1bio.state */
119#define R1BIO_Uptodate 0
120#define R1BIO_IsSync 1
121#define R1BIO_Degraded 2
122#define R1BIO_BehindIO 3
123#define R1BIO_Barrier 4
124#define R1BIO_BarrierRetry 5
125/* For write-behind requests, we call bi_end_io when
126 * the last non-write-behind device completes, providing
127 * any write was successful. Otherwise we call when
128 * any write-behind write succeeds, otherwise we call
129 * with failure when last write completes (and all failed).
130 * Record that bi_end_io was called with this flag...
131 */
132#define R1BIO_Returned 6
133
134#endif
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
deleted file mode 100644
index e9091cfeb286..000000000000
--- a/include/linux/raid/raid10.h
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifndef _RAID10_H
2#define _RAID10_H
3
4#include <linux/raid/md.h>
5
6typedef struct mirror_info mirror_info_t;
7
8struct mirror_info {
9 mdk_rdev_t *rdev;
10 sector_t head_position;
11};
12
13typedef struct r10bio_s r10bio_t;
14
15struct r10_private_data_s {
16 mddev_t *mddev;
17 mirror_info_t *mirrors;
18 int raid_disks;
19 spinlock_t device_lock;
20
21 /* geometry */
22 int near_copies; /* number of copies layed out raid0 style */
23 int far_copies; /* number of copies layed out
24 * at large strides across drives
25 */
26 int far_offset; /* far_copies are offset by 1 stripe
27 * instead of many
28 */
29 int copies; /* near_copies * far_copies.
30 * must be <= raid_disks
31 */
32 sector_t stride; /* distance between far copies.
33 * This is size / far_copies unless
34 * far_offset, in which case it is
35 * 1 stripe.
36 */
37
38 int chunk_shift; /* shift from chunks to sectors */
39 sector_t chunk_mask;
40
41 struct list_head retry_list;
42 /* queue pending writes and submit them on unplug */
43 struct bio_list pending_bio_list;
44
45
46 spinlock_t resync_lock;
47 int nr_pending;
48 int nr_waiting;
49 int nr_queued;
50 int barrier;
51 sector_t next_resync;
52 int fullsync; /* set to 1 if a full sync is needed,
53 * (fresh device added).
54 * Cleared when a sync completes.
55 */
56
57 wait_queue_head_t wait_barrier;
58
59 mempool_t *r10bio_pool;
60 mempool_t *r10buf_pool;
61 struct page *tmppage;
62};
63
64typedef struct r10_private_data_s conf_t;
65
66/*
67 * this is the only point in the RAID code where we violate
68 * C type safety. mddev->private is an 'opaque' pointer.
69 */
70#define mddev_to_conf(mddev) ((conf_t *) mddev->private)
71
72/*
73 * this is our 'private' RAID10 bio.
74 *
75 * it contains information about what kind of IO operations were started
76 * for this RAID10 operation, and about their status:
77 */
78
79struct r10bio_s {
80 atomic_t remaining; /* 'have we finished' count,
81 * used from IRQ handlers
82 */
83 sector_t sector; /* virtual sector number */
84 int sectors;
85 unsigned long state;
86 mddev_t *mddev;
87 /*
88 * original bio going to /dev/mdx
89 */
90 struct bio *master_bio;
91 /*
92 * if the IO is in READ direction, then this is where we read
93 */
94 int read_slot;
95
96 struct list_head retry_list;
97 /*
98 * if the IO is in WRITE direction, then multiple bios are used,
99 * one for each copy.
100 * When resyncing we also use one for each copy.
101 * When reconstructing, we use 2 bios, one for read, one for write.
102 * We choose the number when they are allocated.
103 */
104 struct {
105 struct bio *bio;
106 sector_t addr;
107 int devnum;
108 } devs[0];
109};
110
111/* when we get a read error on a read-only array, we redirect to another
112 * device without failing the first device, or trying to over-write to
113 * correct the read error. To keep track of bad blocks on a per-bio
114 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
115 */
116#define IO_BLOCKED ((struct bio*)1)
117
118/* bits for r10bio.state */
119#define R10BIO_Uptodate 0
120#define R10BIO_IsSync 1
121#define R10BIO_IsRecover 2
122#define R10BIO_Degraded 3
123#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
deleted file mode 100644
index 3b2672792457..000000000000
--- a/include/linux/raid/raid5.h
+++ /dev/null
@@ -1,402 +0,0 @@
1#ifndef _RAID5_H
2#define _RAID5_H
3
4#include <linux/raid/md.h>
5#include <linux/raid/xor.h>
6
7/*
8 *
9 * Each stripe contains one buffer per disc. Each buffer can be in
10 * one of a number of states stored in "flags". Changes between
11 * these states happen *almost* exclusively under a per-stripe
12 * spinlock. Some very specific changes can happen in bi_end_io, and
13 * these are not protected by the spin lock.
14 *
15 * The flag bits that are used to represent these states are:
16 * R5_UPTODATE and R5_LOCKED
17 *
18 * State Empty == !UPTODATE, !LOCK
19 * We have no data, and there is no active request
20 * State Want == !UPTODATE, LOCK
21 * A read request is being submitted for this block
22 * State Dirty == UPTODATE, LOCK
23 * Some new data is in this buffer, and it is being written out
24 * State Clean == UPTODATE, !LOCK
25 * We have valid data which is the same as on disc
26 *
27 * The possible state transitions are:
28 *
29 * Empty -> Want - on read or write to get old data for parity calc
30 * Empty -> Dirty - on compute_parity to satisfy write/sync request.(RECONSTRUCT_WRITE)
31 * Empty -> Clean - on compute_block when computing a block for failed drive
32 * Want -> Empty - on failed read
33 * Want -> Clean - on successful completion of read request
34 * Dirty -> Clean - on successful completion of write request
35 * Dirty -> Clean - on failed write
36 * Clean -> Dirty - on compute_parity to satisfy write/sync (RECONSTRUCT or RMW)
37 *
38 * The Want->Empty, Want->Clean, Dirty->Clean, transitions
39 * all happen in b_end_io at interrupt time.
40 * Each sets the Uptodate bit before releasing the Lock bit.
41 * This leaves one multi-stage transition:
42 * Want->Dirty->Clean
43 * This is safe because thinking that a Clean buffer is actually dirty
44 * will at worst delay some action, and the stripe will be scheduled
45 * for attention after the transition is complete.
46 *
47 * There is one possibility that is not covered by these states. That
48 * is if one drive has failed and there is a spare being rebuilt. We
49 * can't distinguish between a clean block that has been generated
50 * from parity calculations, and a clean block that has been
51 * successfully written to the spare ( or to parity when resyncing).
52 * To distingush these states we have a stripe bit STRIPE_INSYNC that
53 * is set whenever a write is scheduled to the spare, or to the parity
54 * disc if there is no spare. A sync request clears this bit, and
55 * when we find it set with no buffers locked, we know the sync is
56 * complete.
57 *
58 * Buffers for the md device that arrive via make_request are attached
59 * to the appropriate stripe in one of two lists linked on b_reqnext.
60 * One list (bh_read) for read requests, one (bh_write) for write.
61 * There should never be more than one buffer on the two lists
62 * together, but we are not guaranteed of that so we allow for more.
63 *
64 * If a buffer is on the read list when the associated cache buffer is
65 * Uptodate, the data is copied into the read buffer and it's b_end_io
66 * routine is called. This may happen in the end_request routine only
67 * if the buffer has just successfully been read. end_request should
68 * remove the buffers from the list and then set the Uptodate bit on
69 * the buffer. Other threads may do this only if they first check
70 * that the Uptodate bit is set. Once they have checked that they may
71 * take buffers off the read queue.
72 *
73 * When a buffer on the write list is committed for write it is copied
74 * into the cache buffer, which is then marked dirty, and moved onto a
75 * third list, the written list (bh_written). Once both the parity
76 * block and the cached buffer are successfully written, any buffer on
77 * a written list can be returned with b_end_io.
78 *
79 * The write list and read list both act as fifos. The read list is
80 * protected by the device_lock. The write and written lists are
81 * protected by the stripe lock. The device_lock, which can be
82 * claimed while the stipe lock is held, is only for list
83 * manipulations and will only be held for a very short time. It can
84 * be claimed from interrupts.
85 *
86 *
87 * Stripes in the stripe cache can be on one of two lists (or on
88 * neither). The "inactive_list" contains stripes which are not
89 * currently being used for any request. They can freely be reused
90 * for another stripe. The "handle_list" contains stripes that need
91 * to be handled in some way. Both of these are fifo queues. Each
92 * stripe is also (potentially) linked to a hash bucket in the hash
93 * table so that it can be found by sector number. Stripes that are
94 * not hashed must be on the inactive_list, and will normally be at
95 * the front. All stripes start life this way.
96 *
97 * The inactive_list, handle_list and hash bucket lists are all protected by the
98 * device_lock.
99 * - stripes on the inactive_list never have their stripe_lock held.
100 * - stripes have a reference counter. If count==0, they are on a list.
101 * - If a stripe might need handling, STRIPE_HANDLE is set.
102 * - When refcount reaches zero, then if STRIPE_HANDLE it is put on
103 * handle_list else inactive_list
104 *
105 * This, combined with the fact that STRIPE_HANDLE is only ever
106 * cleared while a stripe has a non-zero count means that if the
107 * refcount is 0 and STRIPE_HANDLE is set, then it is on the
108 * handle_list and if recount is 0 and STRIPE_HANDLE is not set, then
109 * the stripe is on inactive_list.
110 *
111 * The possible transitions are:
112 * activate an unhashed/inactive stripe (get_active_stripe())
113 * lockdev check-hash unlink-stripe cnt++ clean-stripe hash-stripe unlockdev
114 * activate a hashed, possibly active stripe (get_active_stripe())
115 * lockdev check-hash if(!cnt++)unlink-stripe unlockdev
116 * attach a request to an active stripe (add_stripe_bh())
117 * lockdev attach-buffer unlockdev
118 * handle a stripe (handle_stripe())
119 * lockstripe clrSTRIPE_HANDLE ...
120 * (lockdev check-buffers unlockdev) ..
121 * change-state ..
122 * record io/ops needed unlockstripe schedule io/ops
123 * release an active stripe (release_stripe())
124 * lockdev if (!--cnt) { if STRIPE_HANDLE, add to handle_list else add to inactive-list } unlockdev
125 *
126 * The refcount counts each thread that have activated the stripe,
127 * plus raid5d if it is handling it, plus one for each active request
128 * on a cached buffer, and plus one if the stripe is undergoing stripe
129 * operations.
130 *
131 * Stripe operations are performed outside the stripe lock,
132 * the stripe operations are:
133 * -copying data between the stripe cache and user application buffers
134 * -computing blocks to save a disk access, or to recover a missing block
135 * -updating the parity on a write operation (reconstruct write and
136 * read-modify-write)
137 * -checking parity correctness
138 * -running i/o to disk
139 * These operations are carried out by raid5_run_ops which uses the async_tx
140 * api to (optionally) offload operations to dedicated hardware engines.
141 * When requesting an operation handle_stripe sets the pending bit for the
142 * operation and increments the count. raid5_run_ops is then run whenever
143 * the count is non-zero.
144 * There are some critical dependencies between the operations that prevent some
145 * from being requested while another is in flight.
146 * 1/ Parity check operations destroy the in cache version of the parity block,
147 * so we prevent parity dependent operations like writes and compute_blocks
148 * from starting while a check is in progress. Some dma engines can perform
149 * the check without damaging the parity block, in these cases the parity
150 * block is re-marked up to date (assuming the check was successful) and is
151 * not re-read from disk.
152 * 2/ When a write operation is requested we immediately lock the affected
153 * blocks, and mark them as not up to date. This causes new read requests
154 * to be held off, as well as parity checks and compute block operations.
155 * 3/ Once a compute block operation has been requested handle_stripe treats
156 * that block as if it is up to date. raid5_run_ops guaruntees that any
157 * operation that is dependent on the compute block result is initiated after
158 * the compute block completes.
159 */
160
161/*
162 * Operations state - intermediate states that are visible outside of sh->lock
163 * In general _idle indicates nothing is running, _run indicates a data
164 * processing operation is active, and _result means the data processing result
165 * is stable and can be acted upon. For simple operations like biofill and
166 * compute that only have an _idle and _run state they are indicated with
167 * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN)
168 */
169/**
170 * enum check_states - handles syncing / repairing a stripe
171 * @check_state_idle - check operations are quiesced
172 * @check_state_run - check operation is running
173 * @check_state_result - set outside lock when check result is valid
174 * @check_state_compute_run - check failed and we are repairing
175 * @check_state_compute_result - set outside lock when compute result is valid
176 */
177enum check_states {
178 check_state_idle = 0,
179 check_state_run, /* parity check */
180 check_state_check_result,
181 check_state_compute_run, /* parity repair */
182 check_state_compute_result,
183};
184
185/**
186 * enum reconstruct_states - handles writing or expanding a stripe
187 */
188enum reconstruct_states {
189 reconstruct_state_idle = 0,
190 reconstruct_state_prexor_drain_run, /* prexor-write */
191 reconstruct_state_drain_run, /* write */
192 reconstruct_state_run, /* expand */
193 reconstruct_state_prexor_drain_result,
194 reconstruct_state_drain_result,
195 reconstruct_state_result,
196};
197
198struct stripe_head {
199 struct hlist_node hash;
200 struct list_head lru; /* inactive_list or handle_list */
201 struct raid5_private_data *raid_conf;
202 sector_t sector; /* sector of this row */
203 int pd_idx; /* parity disk index */
204 unsigned long state; /* state flags */
205 atomic_t count; /* nr of active thread/requests */
206 spinlock_t lock;
207 int bm_seq; /* sequence number for bitmap flushes */
208 int disks; /* disks in stripe */
209 enum check_states check_state;
210 enum reconstruct_states reconstruct_state;
211 /* stripe_operations
212 * @target - STRIPE_OP_COMPUTE_BLK target
213 */
214 struct stripe_operations {
215 int target;
216 u32 zero_sum_result;
217 } ops;
218 struct r5dev {
219 struct bio req;
220 struct bio_vec vec;
221 struct page *page;
222 struct bio *toread, *read, *towrite, *written;
223 sector_t sector; /* sector of this page */
224 unsigned long flags;
225 } dev[1]; /* allocated with extra space depending of RAID geometry */
226};
227
228/* stripe_head_state - collects and tracks the dynamic state of a stripe_head
229 * for handle_stripe. It is only valid under spin_lock(sh->lock);
230 */
231struct stripe_head_state {
232 int syncing, expanding, expanded;
233 int locked, uptodate, to_read, to_write, failed, written;
234 int to_fill, compute, req_compute, non_overwrite;
235 int failed_num;
236 unsigned long ops_request;
237};
238
239/* r6_state - extra state data only relevant to r6 */
240struct r6_state {
241 int p_failed, q_failed, qd_idx, failed_num[2];
242};
243
244/* Flags */
245#define R5_UPTODATE 0 /* page contains current data */
246#define R5_LOCKED 1 /* IO has been submitted on "req" */
247#define R5_OVERWRITE 2 /* towrite covers whole page */
248/* and some that are internal to handle_stripe */
249#define R5_Insync 3 /* rdev && rdev->in_sync at start */
250#define R5_Wantread 4 /* want to schedule a read */
251#define R5_Wantwrite 5
252#define R5_Overlap 7 /* There is a pending overlapping request on this block */
253#define R5_ReadError 8 /* seen a read error here recently */
254#define R5_ReWrite 9 /* have tried to over-write the readerror */
255
256#define R5_Expanded 10 /* This block now has post-expand data */
257#define R5_Wantcompute 11 /* compute_block in progress treat as
258 * uptodate
259 */
260#define R5_Wantfill 12 /* dev->toread contains a bio that needs
261 * filling
262 */
263#define R5_Wantdrain 13 /* dev->towrite needs to be drained */
264/*
265 * Write method
266 */
267#define RECONSTRUCT_WRITE 1
268#define READ_MODIFY_WRITE 2
269/* not a write method, but a compute_parity mode */
270#define CHECK_PARITY 3
271
272/*
273 * Stripe state
274 */
275#define STRIPE_HANDLE 2
276#define STRIPE_SYNCING 3
277#define STRIPE_INSYNC 4
278#define STRIPE_PREREAD_ACTIVE 5
279#define STRIPE_DELAYED 6
280#define STRIPE_DEGRADED 7
281#define STRIPE_BIT_DELAY 8
282#define STRIPE_EXPANDING 9
283#define STRIPE_EXPAND_SOURCE 10
284#define STRIPE_EXPAND_READY 11
285#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
286#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
287#define STRIPE_BIOFILL_RUN 14
288#define STRIPE_COMPUTE_RUN 15
289/*
290 * Operation request flags
291 */
292#define STRIPE_OP_BIOFILL 0
293#define STRIPE_OP_COMPUTE_BLK 1
294#define STRIPE_OP_PREXOR 2
295#define STRIPE_OP_BIODRAIN 3
296#define STRIPE_OP_POSTXOR 4
297#define STRIPE_OP_CHECK 5
298
299/*
300 * Plugging:
301 *
302 * To improve write throughput, we need to delay the handling of some
303 * stripes until there has been a chance that several write requests
304 * for the one stripe have all been collected.
305 * In particular, any write request that would require pre-reading
306 * is put on a "delayed" queue until there are no stripes currently
307 * in a pre-read phase. Further, if the "delayed" queue is empty when
308 * a stripe is put on it then we "plug" the queue and do not process it
309 * until an unplug call is made. (the unplug_io_fn() is called).
310 *
311 * When preread is initiated on a stripe, we set PREREAD_ACTIVE and add
312 * it to the count of prereading stripes.
313 * When write is initiated, or the stripe refcnt == 0 (just in case) we
314 * clear the PREREAD_ACTIVE flag and decrement the count
315 * Whenever the 'handle' queue is empty and the device is not plugged, we
316 * move any strips from delayed to handle and clear the DELAYED flag and set
317 * PREREAD_ACTIVE.
318 * In stripe_handle, if we find pre-reading is necessary, we do it if
319 * PREREAD_ACTIVE is set, else we set DELAYED which will send it to the delayed queue.
320 * HANDLE gets cleared if stripe_handle leave nothing locked.
321 */
322
323
324struct disk_info {
325 mdk_rdev_t *rdev;
326};
327
328struct raid5_private_data {
329 struct hlist_head *stripe_hashtbl;
330 mddev_t *mddev;
331 struct disk_info *spare;
332 int chunk_size, level, algorithm;
333 int max_degraded;
334 int raid_disks;
335 int max_nr_stripes;
336
337 /* used during an expand */
338 sector_t expand_progress; /* MaxSector when no expand happening */
339 sector_t expand_lo; /* from here up to expand_progress it out-of-bounds
340 * as we haven't flushed the metadata yet
341 */
342 int previous_raid_disks;
343
344 struct list_head handle_list; /* stripes needing handling */
345 struct list_head hold_list; /* preread ready stripes */
346 struct list_head delayed_list; /* stripes that have plugged requests */
347 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
348 struct bio *retry_read_aligned; /* currently retrying aligned bios */
349 struct bio *retry_read_aligned_list; /* aligned bios retry list */
350 atomic_t preread_active_stripes; /* stripes with scheduled io */
351 atomic_t active_aligned_reads;
352 atomic_t pending_full_writes; /* full write backlog */
353 int bypass_count; /* bypassed prereads */
354 int bypass_threshold; /* preread nice */
355 struct list_head *last_hold; /* detect hold_list promotions */
356
357 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
358 /* unfortunately we need two cache names as we temporarily have
359 * two caches.
360 */
361 int active_name;
362 char cache_name[2][20];
363 struct kmem_cache *slab_cache; /* for allocating stripes */
364
365 int seq_flush, seq_write;
366 int quiesce;
367
368 int fullsync; /* set to 1 if a full sync is needed,
369 * (fresh device added).
370 * Cleared when a sync completes.
371 */
372
373 struct page *spare_page; /* Used when checking P/Q in raid6 */
374
375 /*
376 * Free stripes pool
377 */
378 atomic_t active_stripes;
379 struct list_head inactive_list;
380 wait_queue_head_t wait_for_stripe;
381 wait_queue_head_t wait_for_overlap;
382 int inactive_blocked; /* release of inactive stripes blocked,
383 * waiting for 25% to be free
384 */
385 int pool_size; /* number of disks in stripeheads in pool */
386 spinlock_t device_lock;
387 struct disk_info *disks;
388};
389
390typedef struct raid5_private_data raid5_conf_t;
391
392#define mddev_to_conf(mddev) ((raid5_conf_t *) mddev->private)
393
394/*
395 * Our supported algorithms
396 */
397#define ALGORITHM_LEFT_ASYMMETRIC 0
398#define ALGORITHM_RIGHT_ASYMMETRIC 1
399#define ALGORITHM_LEFT_SYMMETRIC 2
400#define ALGORITHM_RIGHT_SYMMETRIC 3
401
402#endif
diff --git a/include/linux/raid/xor.h b/include/linux/raid/xor.h
index 3e120587eada..5a210959e3f8 100644
--- a/include/linux/raid/xor.h
+++ b/include/linux/raid/xor.h
@@ -1,8 +1,6 @@
1#ifndef _XOR_H 1#ifndef _XOR_H
2#define _XOR_H 2#define _XOR_H
3 3
4#include <linux/raid/md.h>
5
6#define MAX_XOR_BLOCKS 4 4#define MAX_XOR_BLOCKS 4
7 5
8extern void xor_blocks(unsigned int count, unsigned int bytes, 6extern void xor_blocks(unsigned int count, unsigned int bytes,
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 80044a4f3ab9..bfd92e1e5d2c 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -36,7 +36,6 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h>
40#include <linux/cpumask.h> 39#include <linux/cpumask.h>
41#include <linux/seqlock.h> 40#include <linux/seqlock.h>
42 41
@@ -108,25 +107,14 @@ struct rcu_data {
108 struct rcu_head barrier; 107 struct rcu_head barrier;
109}; 108};
110 109
111DECLARE_PER_CPU(struct rcu_data, rcu_data);
112DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
113
114/* 110/*
115 * Increment the quiescent state counter. 111 * Increment the quiescent state counter.
116 * The counter is a bit degenerated: We do not need to know 112 * The counter is a bit degenerated: We do not need to know
117 * how many quiescent states passed, just if there was at least 113 * how many quiescent states passed, just if there was at least
118 * one since the start of the grace period. Thus just a flag. 114 * one since the start of the grace period. Thus just a flag.
119 */ 115 */
120static inline void rcu_qsctr_inc(int cpu) 116extern void rcu_qsctr_inc(int cpu);
121{ 117extern void rcu_bh_qsctr_inc(int cpu);
122 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
123 rdp->passed_quiesc = 1;
124}
125static inline void rcu_bh_qsctr_inc(int cpu)
126{
127 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
128 rdp->passed_quiesc = 1;
129}
130 118
131extern int rcu_pending(int cpu); 119extern int rcu_pending(int cpu);
132extern int rcu_needs_cpu(int cpu); 120extern int rcu_needs_cpu(int cpu);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 528343e6da51..15fbb3ca634d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -36,7 +36,6 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h>
40#include <linux/cpumask.h> 39#include <linux/cpumask.h>
41#include <linux/seqlock.h> 40#include <linux/seqlock.h>
42#include <linux/lockdep.h> 41#include <linux/lockdep.h>
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 74304b4538d8..fce522782ffa 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -36,34 +36,19 @@
36#include <linux/cache.h> 36#include <linux/cache.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/threads.h> 38#include <linux/threads.h>
39#include <linux/percpu.h> 39#include <linux/smp.h>
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43struct rcu_dyntick_sched { 43extern void rcu_qsctr_inc(int cpu);
44 int dynticks; 44static inline void rcu_bh_qsctr_inc(int cpu) { }
45 int dynticks_snap;
46 int sched_qs;
47 int sched_qs_snap;
48 int sched_dynticks_snap;
49};
50
51DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
52
53static inline void rcu_qsctr_inc(int cpu)
54{
55 struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
56
57 rdssp->sched_qs++;
58}
59#define rcu_bh_qsctr_inc(cpu)
60 45
61/* 46/*
62 * Someone might want to pass call_rcu_bh as a function pointer. 47 * Someone might want to pass call_rcu_bh as a function pointer.
63 * So this needs to just be a rename and not a macro function. 48 * So this needs to just be a rename and not a macro function.
64 * (no parentheses) 49 * (no parentheses)
65 */ 50 */
66#define call_rcu_bh call_rcu 51#define call_rcu_bh call_rcu
67 52
68/** 53/**
69 * call_rcu_sched - Queue RCU callback for invocation after sched grace period. 54 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -117,30 +102,12 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
117struct softirq_action; 102struct softirq_action;
118 103
119#ifdef CONFIG_NO_HZ 104#ifdef CONFIG_NO_HZ
120 105extern void rcu_enter_nohz(void);
121static inline void rcu_enter_nohz(void) 106extern void rcu_exit_nohz(void);
122{ 107#else
123 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); 108# define rcu_enter_nohz() do { } while (0)
124 109# define rcu_exit_nohz() do { } while (0)
125 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ 110#endif
126 __get_cpu_var(rcu_dyntick_sched).dynticks++;
127 WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs);
128}
129
130static inline void rcu_exit_nohz(void)
131{
132 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
133
134 __get_cpu_var(rcu_dyntick_sched).dynticks++;
135 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
136 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
137 &rs);
138}
139
140#else /* CONFIG_NO_HZ */
141#define rcu_enter_nohz() do { } while (0)
142#define rcu_exit_nohz() do { } while (0)
143#endif /* CONFIG_NO_HZ */
144 111
145/* 112/*
146 * A context switch is a grace period for rcupreempt synchronize_rcu() 113 * A context switch is a grace period for rcupreempt synchronize_rcu()
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index a722fb67bb2d..0cdda00f2b2a 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -33,7 +33,6 @@
33#include <linux/cache.h> 33#include <linux/cache.h>
34#include <linux/spinlock.h> 34#include <linux/spinlock.h>
35#include <linux/threads.h> 35#include <linux/threads.h>
36#include <linux/percpu.h>
37#include <linux/cpumask.h> 36#include <linux/cpumask.h>
38#include <linux/seqlock.h> 37#include <linux/seqlock.h>
39 38
@@ -236,30 +235,8 @@ struct rcu_state {
236#endif /* #ifdef CONFIG_NO_HZ */ 235#endif /* #ifdef CONFIG_NO_HZ */
237}; 236};
238 237
239extern struct rcu_state rcu_state; 238extern void rcu_qsctr_inc(int cpu);
240DECLARE_PER_CPU(struct rcu_data, rcu_data); 239extern void rcu_bh_qsctr_inc(int cpu);
241
242extern struct rcu_state rcu_bh_state;
243DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
244
245/*
246 * Increment the quiescent state counter.
247 * The counter is a bit degenerated: We do not need to know
248 * how many quiescent states passed, just if there was at least
249 * one since the start of the grace period. Thus just a flag.
250 */
251static inline void rcu_qsctr_inc(int cpu)
252{
253 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
254 rdp->passed_quiesc = 1;
255 rdp->passed_quiesc_completed = rdp->completed;
256}
257static inline void rcu_bh_qsctr_inc(int cpu)
258{
259 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
260 rdp->passed_quiesc = 1;
261 rdp->passed_quiesc_completed = rdp->completed;
262}
263 240
264extern int rcu_pending(int cpu); 241extern int rcu_pending(int cpu);
265extern int rcu_needs_cpu(int cpu); 242extern int rcu_needs_cpu(int cpu);
diff --git a/include/linux/rds.h b/include/linux/rds.h
new file mode 100644
index 000000000000..d91dc91f5443
--- /dev/null
+++ b/include/linux/rds.h
@@ -0,0 +1,250 @@
1/*
2 * Copyright (c) 2008 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 */
33
34#ifndef _LINUX_RDS_H
35#define _LINUX_RDS_H
36
37#include <linux/types.h>
38
39/* These sparse annotated types shouldn't be in any user
40 * visible header file. We should clean this up rather
41 * than kludging around them. */
42#ifndef __KERNEL__
43#define __be16 u_int16_t
44#define __be32 u_int32_t
45#define __be64 u_int64_t
46#endif
47
48#define RDS_IB_ABI_VERSION 0x301
49
50/*
51 * setsockopt/getsockopt for SOL_RDS
52 */
53#define RDS_CANCEL_SENT_TO 1
54#define RDS_GET_MR 2
55#define RDS_FREE_MR 3
56/* deprecated: RDS_BARRIER 4 */
57#define RDS_RECVERR 5
58#define RDS_CONG_MONITOR 6
59
60/*
61 * Control message types for SOL_RDS.
62 *
63 * CMSG_RDMA_ARGS (sendmsg)
64 * Request a RDMA transfer to/from the specified
65 * memory ranges.
66 * The cmsg_data is a struct rds_rdma_args.
67 * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg)
68 * Kernel informs application about intended
69 * source/destination of a RDMA transfer
70 * RDS_CMSG_RDMA_MAP (sendmsg)
71 * Application asks kernel to map the given
72 * memory range into a IB MR, and send the
73 * R_Key along in an RDS extension header.
74 * The cmsg_data is a struct rds_get_mr_args,
75 * the same as for the GET_MR setsockopt.
76 * RDS_CMSG_RDMA_STATUS (recvmsg)
77 * Returns the status of a completed RDMA operation.
78 */
79#define RDS_CMSG_RDMA_ARGS 1
80#define RDS_CMSG_RDMA_DEST 2
81#define RDS_CMSG_RDMA_MAP 3
82#define RDS_CMSG_RDMA_STATUS 4
83#define RDS_CMSG_CONG_UPDATE 5
84
85#define RDS_INFO_FIRST 10000
86#define RDS_INFO_COUNTERS 10000
87#define RDS_INFO_CONNECTIONS 10001
88/* 10002 aka RDS_INFO_FLOWS is deprecated */
89#define RDS_INFO_SEND_MESSAGES 10003
90#define RDS_INFO_RETRANS_MESSAGES 10004
91#define RDS_INFO_RECV_MESSAGES 10005
92#define RDS_INFO_SOCKETS 10006
93#define RDS_INFO_TCP_SOCKETS 10007
94#define RDS_INFO_IB_CONNECTIONS 10008
95#define RDS_INFO_CONNECTION_STATS 10009
96#define RDS_INFO_IWARP_CONNECTIONS 10010
97#define RDS_INFO_LAST 10010
98
99struct rds_info_counter {
100 u_int8_t name[32];
101 u_int64_t value;
102} __attribute__((packed));
103
104#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
105#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
106#define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04
107
108#define TRANSNAMSIZ 16
109
110struct rds_info_connection {
111 u_int64_t next_tx_seq;
112 u_int64_t next_rx_seq;
113 __be32 laddr;
114 __be32 faddr;
115 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */
116 u_int8_t flags;
117} __attribute__((packed));
118
119struct rds_info_flow {
120 __be32 laddr;
121 __be32 faddr;
122 u_int32_t bytes;
123 __be16 lport;
124 __be16 fport;
125} __attribute__((packed));
126
127#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
128#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
129
130struct rds_info_message {
131 u_int64_t seq;
132 u_int32_t len;
133 __be32 laddr;
134 __be32 faddr;
135 __be16 lport;
136 __be16 fport;
137 u_int8_t flags;
138} __attribute__((packed));
139
140struct rds_info_socket {
141 u_int32_t sndbuf;
142 __be32 bound_addr;
143 __be32 connected_addr;
144 __be16 bound_port;
145 __be16 connected_port;
146 u_int32_t rcvbuf;
147 u_int64_t inum;
148} __attribute__((packed));
149
150#define RDS_IB_GID_LEN 16
151struct rds_info_rdma_connection {
152 __be32 src_addr;
153 __be32 dst_addr;
154 uint8_t src_gid[RDS_IB_GID_LEN];
155 uint8_t dst_gid[RDS_IB_GID_LEN];
156
157 uint32_t max_send_wr;
158 uint32_t max_recv_wr;
159 uint32_t max_send_sge;
160 uint32_t rdma_mr_max;
161 uint32_t rdma_mr_size;
162};
163
164/*
165 * Congestion monitoring.
166 * Congestion control in RDS happens at the host connection
167 * level by exchanging a bitmap marking congested ports.
168 * By default, a process sleeping in poll() is always woken
169 * up when the congestion map is updated.
170 * With explicit monitoring, an application can have more
171 * fine-grained control.
172 * The application installs a 64bit mask value in the socket,
173 * where each bit corresponds to a group of ports.
174 * When a congestion update arrives, RDS checks the set of
175 * ports that are now uncongested against the list bit mask
176 * installed in the socket, and if they overlap, we queue a
177 * cong_notification on the socket.
178 *
179 * To install the congestion monitor bitmask, use RDS_CONG_MONITOR
180 * with the 64bit mask.
181 * Congestion updates are received via RDS_CMSG_CONG_UPDATE
182 * control messages.
183 *
184 * The correspondence between bits and ports is
185 * 1 << (portnum % 64)
186 */
187#define RDS_CONG_MONITOR_SIZE 64
188#define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE)
189#define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port))
190
191/*
192 * RDMA related types
193 */
194
195/*
196 * This encapsulates a remote memory location.
197 * In the current implementation, it contains the R_Key
198 * of the remote memory region, and the offset into it
199 * (so that the application does not have to worry about
200 * alignment).
201 */
202typedef u_int64_t rds_rdma_cookie_t;
203
204struct rds_iovec {
205 u_int64_t addr;
206 u_int64_t bytes;
207};
208
209struct rds_get_mr_args {
210 struct rds_iovec vec;
211 u_int64_t cookie_addr;
212 uint64_t flags;
213};
214
215struct rds_free_mr_args {
216 rds_rdma_cookie_t cookie;
217 u_int64_t flags;
218};
219
220struct rds_rdma_args {
221 rds_rdma_cookie_t cookie;
222 struct rds_iovec remote_vec;
223 u_int64_t local_vec_addr;
224 u_int64_t nr_local;
225 u_int64_t flags;
226 u_int64_t user_token;
227};
228
229struct rds_rdma_notify {
230 u_int64_t user_token;
231 int32_t status;
232};
233
234#define RDS_RDMA_SUCCESS 0
235#define RDS_RDMA_REMOTE_ERROR 1
236#define RDS_RDMA_CANCELED 2
237#define RDS_RDMA_DROPPED 3
238#define RDS_RDMA_OTHER_ERROR 4
239
240/*
241 * Common set of flags for all RDMA related structs
242 */
243#define RDS_RDMA_READWRITE 0x0001
244#define RDS_RDMA_FENCE 0x0002 /* use FENCE for immediate send */
245#define RDS_RDMA_INVALIDATE 0x0004 /* invalidate R_Key after freeing MR */
246#define RDS_RDMA_USE_ONCE 0x0008 /* free MR after use */
247#define RDS_RDMA_DONTWAIT 0x0010 /* Don't wait in SET_BARRIER */
248#define RDS_RDMA_NOTIFY_ME 0x0020 /* Notify when operation completes */
249
250#endif /* IB_RDS_H */
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
index e84b0a9feda5..a6d014005d49 100644
--- a/include/linux/regulator/bq24022.h
+++ b/include/linux/regulator/bq24022.h
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13struct regulator_init_data;
14
13/** 15/**
14 * bq24022_mach_info - platform data for bq24022 16 * bq24022_mach_info - platform data for bq24022
15 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging 17 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
@@ -18,4 +20,5 @@
18struct bq24022_mach_info { 20struct bq24022_mach_info {
19 int gpio_nce; 21 int gpio_nce;
20 int gpio_iset2; 22 int gpio_iset2;
23 struct regulator_init_data *init_data;
21}; 24};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 801bf77ff4e2..277f4b964df5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -88,6 +88,7 @@
88 * FAIL Regulator output has failed. 88 * FAIL Regulator output has failed.
89 * OVER_TEMP Regulator over temp. 89 * OVER_TEMP Regulator over temp.
90 * FORCE_DISABLE Regulator shut down by software. 90 * FORCE_DISABLE Regulator shut down by software.
91 * VOLTAGE_CHANGE Regulator voltage changed.
91 * 92 *
92 * NOTE: These events can be OR'ed together when passed into handler. 93 * NOTE: These events can be OR'ed together when passed into handler.
93 */ 94 */
@@ -98,6 +99,7 @@
98#define REGULATOR_EVENT_FAIL 0x08 99#define REGULATOR_EVENT_FAIL 0x08
99#define REGULATOR_EVENT_OVER_TEMP 0x10 100#define REGULATOR_EVENT_OVER_TEMP 0x10
100#define REGULATOR_EVENT_FORCE_DISABLE 0x20 101#define REGULATOR_EVENT_FORCE_DISABLE 0x20
102#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
101 103
102struct regulator; 104struct regulator;
103 105
@@ -140,6 +142,8 @@ int regulator_bulk_disable(int num_consumers,
140void regulator_bulk_free(int num_consumers, 142void regulator_bulk_free(int num_consumers,
141 struct regulator_bulk_data *consumers); 143 struct regulator_bulk_data *consumers);
142 144
145int regulator_count_voltages(struct regulator *regulator);
146int regulator_list_voltage(struct regulator *regulator, unsigned selector);
143int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 147int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
144int regulator_get_voltage(struct regulator *regulator); 148int regulator_get_voltage(struct regulator *regulator);
145int regulator_set_current_limit(struct regulator *regulator, 149int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 2dae05705f13..4848d8dacd90 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -21,25 +21,38 @@
21struct regulator_dev; 21struct regulator_dev;
22struct regulator_init_data; 22struct regulator_init_data;
23 23
24enum regulator_status {
25 REGULATOR_STATUS_OFF,
26 REGULATOR_STATUS_ON,
27 REGULATOR_STATUS_ERROR,
28 /* fast/normal/idle/standby are flavors of "on" */
29 REGULATOR_STATUS_FAST,
30 REGULATOR_STATUS_NORMAL,
31 REGULATOR_STATUS_IDLE,
32 REGULATOR_STATUS_STANDBY,
33};
34
24/** 35/**
25 * struct regulator_ops - regulator operations. 36 * struct regulator_ops - regulator operations.
26 * 37 *
27 * This struct describes regulator operations which can be implemented by 38 * @enable: Configure the regulator as enabled.
28 * regulator chip drivers. 39 * @disable: Configure the regulator as disabled.
29 *
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. 40 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
33 * 41 *
34 * @set_voltage: Set the voltage for the regulator within the range specified. 42 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV. 43 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator. 44 * @get_voltage: Return the currently configured voltage for the regulator.
45 * @list_voltage: Return one of the supported voltages, in microvolts; zero
46 * if the selector indicates a voltage that is unusable on this system;
47 * or negative errno. Selectors range from zero to one less than
48 * regulator_desc.n_voltages. Voltages may be reported in any order.
37 * 49 *
38 * @set_current_limit: Configure a limit for a current-limited regulator. 50 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator. 51 * @get_current_limit: Get the configured limit for a current-limited regulator.
40 * 52 *
41 * @set_mode: Set the operating mode for the regulator. 53 * @get_mode: Get the configured operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator. 54 * @get_status: Return actual (not as-configured) status of regulator, as a
55 * REGULATOR_STATUS value (or negative errno)
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator 56 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters. 57 * when running with the specified parameters.
45 * 58 *
@@ -51,9 +64,15 @@ struct regulator_init_data;
51 * suspended. 64 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the 65 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended. 66 * system is suspended.
67 *
68 * This struct describes regulator operations which can be implemented by
69 * regulator chip drivers.
54 */ 70 */
55struct regulator_ops { 71struct regulator_ops {
56 72
73 /* enumerate supported voltages */
74 int (*list_voltage) (struct regulator_dev *, unsigned selector);
75
57 /* get/set regulator voltage */ 76 /* get/set regulator voltage */
58 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); 77 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
59 int (*get_voltage) (struct regulator_dev *); 78 int (*get_voltage) (struct regulator_dev *);
@@ -72,6 +91,13 @@ struct regulator_ops {
72 int (*set_mode) (struct regulator_dev *, unsigned int mode); 91 int (*set_mode) (struct regulator_dev *, unsigned int mode);
73 unsigned int (*get_mode) (struct regulator_dev *); 92 unsigned int (*get_mode) (struct regulator_dev *);
74 93
94 /* report regulator status ... most other accessors report
95 * control inputs, this reports results of combining inputs
96 * from Linux (and other sources) with the actual load.
97 * returns REGULATOR_STATUS_* or negative errno.
98 */
99 int (*get_status)(struct regulator_dev *);
100
75 /* get most efficient regulator operating mode for load */ 101 /* get most efficient regulator operating mode for load */
76 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, 102 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
77 int output_uV, int load_uA); 103 int output_uV, int load_uA);
@@ -106,6 +132,7 @@ enum regulator_type {
106 * 132 *
107 * @name: Identifying name for the regulator. 133 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator. 134 * @id: Numerical identifier for the regulator.
135 * @n_voltages: Number of selectors available for ops.list_voltage().
109 * @ops: Regulator operations table. 136 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator. 137 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator. 138 * @type: Indicates if the regulator is a voltage or current regulator.
@@ -114,14 +141,48 @@ enum regulator_type {
114struct regulator_desc { 141struct regulator_desc {
115 const char *name; 142 const char *name;
116 int id; 143 int id;
144 unsigned n_voltages;
117 struct regulator_ops *ops; 145 struct regulator_ops *ops;
118 int irq; 146 int irq;
119 enum regulator_type type; 147 enum regulator_type type;
120 struct module *owner; 148 struct module *owner;
121}; 149};
122 150
151/*
152 * struct regulator_dev
153 *
154 * Voltage / Current regulator class device. One for each
155 * regulator.
156 *
157 * This should *not* be used directly by anything except the regulator
158 * core and notification injection (which should take the mutex and do
159 * no other direct access).
160 */
161struct regulator_dev {
162 struct regulator_desc *desc;
163 int use_count;
164
165 /* lists we belong to */
166 struct list_head list; /* list of all regulators */
167 struct list_head slist; /* list of supplied regulators */
168
169 /* lists we own */
170 struct list_head consumer_list; /* consumers we supply */
171 struct list_head supply_list; /* regulators we supply */
172
173 struct blocking_notifier_head notifier;
174 struct mutex mutex; /* consumer lock */
175 struct module *owner;
176 struct device dev;
177 struct regulation_constraints *constraints;
178 struct regulator_dev *supply; /* for tree */
179
180 void *reg_data; /* regulator_dev data */
181};
182
123struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 183struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
124 struct device *dev, void *driver_data); 184 struct device *dev, struct regulator_init_data *init_data,
185 void *driver_data);
125void regulator_unregister(struct regulator_dev *rdev); 186void regulator_unregister(struct regulator_dev *rdev);
126 187
127int regulator_notifier_call_chain(struct regulator_dev *rdev, 188int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 1387a5d2190e..91b4da31f1b5 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -14,9 +14,12 @@
14#ifndef __REGULATOR_FIXED_H 14#ifndef __REGULATOR_FIXED_H
15#define __REGULATOR_FIXED_H 15#define __REGULATOR_FIXED_H
16 16
17struct regulator_init_data;
18
17struct fixed_voltage_config { 19struct fixed_voltage_config {
18 const char *supply_name; 20 const char *supply_name;
19 int microvolts; 21 int microvolts;
22 struct regulator_init_data *init_data;
20}; 23};
21 24
22#endif 25#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 3794773b23d2..bac64fa390f2 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -73,7 +73,9 @@ struct regulator_state {
73 * 73 *
74 * @always_on: Set if the regulator should never be disabled. 74 * @always_on: Set if the regulator should never be disabled.
75 * @boot_on: Set if the regulator is enabled when the system is initially 75 * @boot_on: Set if the regulator is enabled when the system is initially
76 * started. 76 * started. If the regulator is not enabled by the hardware or
77 * bootloader then it will be enabled when the constraints are
78 * applied.
77 * @apply_uV: Apply the voltage constraint when initialising. 79 * @apply_uV: Apply the voltage constraint when initialising.
78 * 80 *
79 * @input_uV: Input voltage for regulator when supplied by another regulator. 81 * @input_uV: Input voltage for regulator when supplied by another regulator.
@@ -83,6 +85,7 @@ struct regulator_state {
83 * @state_standby: State for regulator when system is suspended in standby 85 * @state_standby: State for regulator when system is suspended in standby
84 * mode. 86 * mode.
85 * @initial_state: Suspend state to set by default. 87 * @initial_state: Suspend state to set by default.
88 * @initial_mode: Mode to set at startup.
86 */ 89 */
87struct regulation_constraints { 90struct regulation_constraints {
88 91
@@ -111,6 +114,9 @@ struct regulation_constraints {
111 struct regulator_state state_standby; 114 struct regulator_state state_standby;
112 suspend_state_t initial_state; /* suspend state to set at init */ 115 suspend_state_t initial_state; /* suspend state to set at init */
113 116
117 /* mode to set on startup */
118 unsigned int initial_mode;
119
114 /* constriant flags */ 120 /* constriant flags */
115 unsigned always_on:1; /* regulator never off when system is on */ 121 unsigned always_on:1; /* regulator never off when system is on */
116 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
@@ -160,4 +166,6 @@ struct regulator_init_data {
160 166
161int regulator_suspend_prepare(suspend_state_t state); 167int regulator_suspend_prepare(suspend_state_t state);
162 168
169void regulator_has_full_constraints(void);
170
163#endif 171#endif
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index fe00f781a622..8cc65757e47a 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -49,13 +49,12 @@ static inline int reiserfs_acl_count(size_t size)
49#ifdef CONFIG_REISERFS_FS_POSIX_ACL 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51int reiserfs_acl_chmod(struct inode *inode); 51int reiserfs_acl_chmod(struct inode *inode);
52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, 52int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry,
53 struct inode *inode); 54 struct inode *inode);
54int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
55extern int reiserfs_xattr_posix_acl_init(void) __init; 56extern struct xattr_handler reiserfs_posix_acl_default_handler;
56extern int reiserfs_xattr_posix_acl_exit(void); 57extern struct xattr_handler reiserfs_posix_acl_access_handler;
57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59 58
60static inline void reiserfs_init_acl_access(struct inode *inode) 59static inline void reiserfs_init_acl_access(struct inode *inode)
61{ 60{
@@ -75,23 +74,14 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
75 return NULL; 74 return NULL;
76} 75}
77 76
78static inline int reiserfs_xattr_posix_acl_init(void)
79{
80 return 0;
81}
82
83static inline int reiserfs_xattr_posix_acl_exit(void)
84{
85 return 0;
86}
87
88static inline int reiserfs_acl_chmod(struct inode *inode) 77static inline int reiserfs_acl_chmod(struct inode *inode)
89{ 78{
90 return 0; 79 return 0;
91} 80}
92 81
93static inline int 82static inline int
94reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry, 83reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
84 const struct inode *dir, struct dentry *dentry,
95 struct inode *inode) 85 struct inode *inode)
96{ 86{
97 return 0; 87 return 0;
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index e356c99f0659..2245c78d5876 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -58,8 +58,6 @@
58#define reiserfs_write_lock( sb ) lock_kernel() 58#define reiserfs_write_lock( sb ) lock_kernel()
59#define reiserfs_write_unlock( sb ) unlock_kernel() 59#define reiserfs_write_unlock( sb ) unlock_kernel()
60 60
61/* xattr stuff */
62#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
63struct fid; 61struct fid;
64 62
65/* in reading the #defines, it may help to understand that they employ 63/* in reading the #defines, it may help to understand that they employ
@@ -104,15 +102,21 @@ struct fid;
104*/ 102*/
105#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 103#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
106 104
107void reiserfs_warning(struct super_block *s, const char *fmt, ...); 105void __reiserfs_warning(struct super_block *s, const char *id,
106 const char *func, const char *fmt, ...);
107#define reiserfs_warning(s, id, fmt, args...) \
108 __reiserfs_warning(s, id, __func__, fmt, ##args)
108/* assertions handling */ 109/* assertions handling */
109 110
110/** always check a condition and panic if it's false. */ 111/** always check a condition and panic if it's false. */
111#define __RASSERT( cond, scond, format, args... ) \ 112#define __RASSERT(cond, scond, format, args...) \
112if( !( cond ) ) \ 113do { \
113 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 114 if (!(cond)) \
114 __FILE__ ":%i:%s: " format "\n", \ 115 reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
115 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args ) 116 __FILE__ ":%i:%s: " format "\n", \
117 in_interrupt() ? -1 : task_pid_nr(current), \
118 __LINE__, __func__ , ##args); \
119} while (0)
116 120
117#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 121#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
118 122
@@ -196,7 +200,11 @@ struct reiserfs_super_block {
196 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ 200 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
197 unsigned char s_uuid[16]; /* filesystem unique identifier */ 201 unsigned char s_uuid[16]; /* filesystem unique identifier */
198 unsigned char s_label[16]; /* filesystem volume label */ 202 unsigned char s_label[16]; /* filesystem volume label */
199 char s_unused[88]; /* zero filled by mkreiserfs and 203 __le16 s_mnt_count; /* Count of mounts since last fsck */
204 __le16 s_max_mnt_count; /* Maximum mounts before check */
205 __le32 s_lastcheck; /* Timestamp of last fsck */
206 __le32 s_check_interval; /* Interval between checks */
207 char s_unused[76]; /* zero filled by mkreiserfs and
200 * reiserfs_convert_objectid_map_v1() 208 * reiserfs_convert_objectid_map_v1()
201 * so any additions must be updated 209 * so any additions must be updated
202 * there as well. */ 210 * there as well. */
@@ -578,10 +586,8 @@ static inline int uniqueness2type(__u32 uniqueness)
578 return TYPE_DIRECT; 586 return TYPE_DIRECT;
579 case V1_DIRENTRY_UNIQUENESS: 587 case V1_DIRENTRY_UNIQUENESS:
580 return TYPE_DIRENTRY; 588 return TYPE_DIRENTRY;
581 default:
582 reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
583 uniqueness);
584 case V1_ANY_UNIQUENESS: 589 case V1_ANY_UNIQUENESS:
590 default:
585 return TYPE_ANY; 591 return TYPE_ANY;
586 } 592 }
587} 593}
@@ -598,9 +604,8 @@ static inline __u32 type2uniqueness(int type)
598 return V1_DIRECT_UNIQUENESS; 604 return V1_DIRECT_UNIQUENESS;
599 case TYPE_DIRENTRY: 605 case TYPE_DIRENTRY:
600 return V1_DIRENTRY_UNIQUENESS; 606 return V1_DIRENTRY_UNIQUENESS;
601 default:
602 reiserfs_warning(NULL, "vs-501: unknown type %d", type);
603 case TYPE_ANY: 607 case TYPE_ANY:
608 default:
604 return V1_ANY_UNIQUENESS; 609 return V1_ANY_UNIQUENESS;
605 } 610 }
606} 611}
@@ -712,9 +717,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
712#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) 717#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
713#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) 718#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
714 719
715#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ 720#define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
716 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ 721 (!COMP_SHORT_KEYS(ih, key) && \
717 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) 722 I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
718 723
719/* maximal length of item */ 724/* maximal length of item */
720#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) 725#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
@@ -770,25 +775,25 @@ struct block_head {
770#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ 775#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
771 776
772/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 777/* Given the buffer head of a formatted node, resolve to the block head of that node. */
773#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 778#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
774/* Number of items that are in buffer. */ 779/* Number of items that are in buffer. */
775#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh))) 780#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
776#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh))) 781#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
777#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh))) 782#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
778 783
779#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0) 784#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
780#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 785#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
781#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 786#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
782 787
783/* Get right delimiting key. -- little endian */ 788/* Get right delimiting key. -- little endian */
784#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)))) 789#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
785 790
786/* Does the buffer contain a disk leaf. */ 791/* Does the buffer contain a disk leaf. */
787#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) 792#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
788 793
789/* Does the buffer contain a disk internal node */ 794/* Does the buffer contain a disk internal node */
790#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 795#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
791 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 796 && B_LEVEL(bh) <= MAX_HEIGHT)
792 797
793/***************************************************************************/ 798/***************************************************************************/
794/* STAT DATA */ 799/* STAT DATA */
@@ -1138,12 +1143,13 @@ struct disk_child {
1138#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) 1143#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
1139 1144
1140/* Get disk child by buffer header and position in the tree node. */ 1145/* Get disk child by buffer header and position in the tree node. */
1141#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\ 1146#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
1142((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos))) 1147((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
1143 1148
1144/* Get disk child number by buffer header and position in the tree node. */ 1149/* Get disk child number by buffer header and position in the tree node. */
1145#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1150#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
1146#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1151#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
1152 (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
1147 1153
1148 /* maximal value of field child_size in structure disk_child */ 1154 /* maximal value of field child_size in structure disk_child */
1149 /* child size is the combined size of all items and their headers */ 1155 /* child size is the combined size of all items and their headers */
@@ -1214,33 +1220,33 @@ struct treepath {
1214struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} 1220struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1215 1221
1216/* Get path element by path and path position. */ 1222/* Get path element by path and path position. */
1217#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset)) 1223#define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
1218 1224
1219/* Get buffer header at the path by path and path position. */ 1225/* Get buffer header at the path by path and path position. */
1220#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer) 1226#define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
1221 1227
1222/* Get position in the element at the path by path and path position. */ 1228/* Get position in the element at the path by path and path position. */
1223#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) 1229#define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
1224 1230
1225#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) 1231#define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
1226 /* you know, to the person who didn't 1232 /* you know, to the person who didn't
1227 write this the macro name does not 1233 write this the macro name does not
1228 at first suggest what it does. 1234 at first suggest what it does.
1229 Maybe POSITION_FROM_PATH_END? Or 1235 Maybe POSITION_FROM_PATH_END? Or
1230 maybe we should just focus on 1236 maybe we should just focus on
1231 dumping paths... -Hans */ 1237 dumping paths... -Hans */
1232#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) 1238#define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
1233 1239
1234#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) 1240#define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
1235 1241
1236/* in do_balance leaf has h == 0 in contrast with path structure, 1242/* in do_balance leaf has h == 0 in contrast with path structure,
1237 where root has level == 0. That is why we need these defines */ 1243 where root has level == 0. That is why we need these defines */
1238#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ 1244#define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
1239#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ 1245#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1240#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) 1246#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1241#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ 1247#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1242 1248
1243#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) 1249#define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
1244 1250
1245#define get_last_bh(path) PATH_PLAST_BUFFER(path) 1251#define get_last_bh(path) PATH_PLAST_BUFFER(path)
1246#define get_ih(path) PATH_PITEM_HEAD(path) 1252#define get_ih(path) PATH_PITEM_HEAD(path)
@@ -1470,6 +1476,16 @@ struct buffer_info {
1470 int bi_position; 1476 int bi_position;
1471}; 1477};
1472 1478
1479static inline struct super_block *sb_from_tb(struct tree_balance *tb)
1480{
1481 return tb ? tb->tb_sb : NULL;
1482}
1483
1484static inline struct super_block *sb_from_bi(struct buffer_info *bi)
1485{
1486 return bi ? sb_from_tb(bi->tb) : NULL;
1487}
1488
1473/* there are 4 types of items: stat data, directory item, indirect, direct. 1489/* there are 4 types of items: stat data, directory item, indirect, direct.
1474+-------------------+------------+--------------+------------+ 1490+-------------------+------------+--------------+------------+
1475| | k_offset | k_uniqueness | mergeable? | 1491| | k_offset | k_uniqueness | mergeable? |
@@ -1520,7 +1536,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1];
1520#define COMP_SHORT_KEYS comp_short_keys 1536#define COMP_SHORT_KEYS comp_short_keys
1521 1537
1522/* number of blocks pointed to by the indirect item */ 1538/* number of blocks pointed to by the indirect item */
1523#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE ) 1539#define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
1524 1540
1525/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ 1541/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
1526#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) 1542#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
@@ -1623,6 +1639,10 @@ struct reiserfs_journal_header {
1623#define JOURNAL_MAX_COMMIT_AGE 30 1639#define JOURNAL_MAX_COMMIT_AGE 30
1624#define JOURNAL_MAX_TRANS_AGE 30 1640#define JOURNAL_MAX_TRANS_AGE 30
1625#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1641#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1642#define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \
1643 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
1644 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1645
1626#ifdef CONFIG_QUOTA 1646#ifdef CONFIG_QUOTA
1627/* We need to update data and inode (atime) */ 1647/* We need to update data and inode (atime) */
1628#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1648#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
@@ -1697,7 +1717,7 @@ struct reiserfs_transaction_handle {
1697 int t_refcount; 1717 int t_refcount;
1698 int t_blocks_logged; /* number of blocks this writer has logged */ 1718 int t_blocks_logged; /* number of blocks this writer has logged */
1699 int t_blocks_allocated; /* number of blocks this writer allocated */ 1719 int t_blocks_allocated; /* number of blocks this writer allocated */
1700 unsigned long t_trans_id; /* sanity check, equals the current trans id */ 1720 unsigned int t_trans_id; /* sanity check, equals the current trans id */
1701 void *t_handle_save; /* save existing current->journal_info */ 1721 void *t_handle_save; /* save existing current->journal_info */
1702 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block 1722 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1703 should be displaced from others */ 1723 should be displaced from others */
@@ -1773,13 +1793,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1773int journal_mark_freed(struct reiserfs_transaction_handle *, 1793int journal_mark_freed(struct reiserfs_transaction_handle *,
1774 struct super_block *, b_blocknr_t blocknr); 1794 struct super_block *, b_blocknr_t blocknr);
1775int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); 1795int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1776int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr, 1796int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
1777 int bit_nr, int searchall, b_blocknr_t *next); 1797 int bit_nr, int searchall, b_blocknr_t *next);
1778int journal_begin(struct reiserfs_transaction_handle *, 1798int journal_begin(struct reiserfs_transaction_handle *,
1779 struct super_block *p_s_sb, unsigned long); 1799 struct super_block *sb, unsigned long);
1780int journal_join_abort(struct reiserfs_transaction_handle *, 1800int journal_join_abort(struct reiserfs_transaction_handle *,
1781 struct super_block *p_s_sb, unsigned long); 1801 struct super_block *sb, unsigned long);
1782void reiserfs_journal_abort(struct super_block *sb, int errno); 1802void reiserfs_abort_journal(struct super_block *sb, int errno);
1783void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); 1803void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1784int reiserfs_allocate_list_bitmaps(struct super_block *s, 1804int reiserfs_allocate_list_bitmaps(struct super_block *s,
1785 struct reiserfs_list_bitmap *, unsigned int); 1805 struct reiserfs_list_bitmap *, unsigned int);
@@ -1796,8 +1816,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *);
1796 1816
1797/* stree.c */ 1817/* stree.c */
1798int B_IS_IN_TREE(const struct buffer_head *); 1818int B_IS_IN_TREE(const struct buffer_head *);
1799extern void copy_item_head(struct item_head *p_v_to, 1819extern void copy_item_head(struct item_head *to,
1800 const struct item_head *p_v_from); 1820 const struct item_head *from);
1801 1821
1802// first key is in cpu form, second - le 1822// first key is in cpu form, second - le
1803extern int comp_short_keys(const struct reiserfs_key *le_key, 1823extern int comp_short_keys(const struct reiserfs_key *le_key,
@@ -1832,20 +1852,20 @@ static inline void copy_key(struct reiserfs_key *to,
1832 memcpy(to, from, KEY_SIZE); 1852 memcpy(to, from, KEY_SIZE);
1833} 1853}
1834 1854
1835int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path); 1855int comp_items(const struct item_head *stored_ih, const struct treepath *path);
1836const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, 1856const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
1837 const struct super_block *p_s_sb); 1857 const struct super_block *sb);
1838int search_by_key(struct super_block *, const struct cpu_key *, 1858int search_by_key(struct super_block *, const struct cpu_key *,
1839 struct treepath *, int); 1859 struct treepath *, int);
1840#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) 1860#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1841int search_for_position_by_key(struct super_block *p_s_sb, 1861int search_for_position_by_key(struct super_block *sb,
1842 const struct cpu_key *p_s_cpu_key, 1862 const struct cpu_key *cpu_key,
1843 struct treepath *p_s_search_path); 1863 struct treepath *search_path);
1844extern void decrement_bcount(struct buffer_head *p_s_bh); 1864extern void decrement_bcount(struct buffer_head *bh);
1845void decrement_counters_in_path(struct treepath *p_s_search_path); 1865void decrement_counters_in_path(struct treepath *search_path);
1846void pathrelse(struct treepath *p_s_search_path); 1866void pathrelse(struct treepath *search_path);
1847int reiserfs_check_path(struct treepath *p); 1867int reiserfs_check_path(struct treepath *p);
1848void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path); 1868void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
1849 1869
1850int reiserfs_insert_item(struct reiserfs_transaction_handle *th, 1870int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1851 struct treepath *path, 1871 struct treepath *path,
@@ -1868,14 +1888,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1868int reiserfs_delete_item(struct reiserfs_transaction_handle *th, 1888int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
1869 struct treepath *path, 1889 struct treepath *path,
1870 const struct cpu_key *key, 1890 const struct cpu_key *key,
1871 struct inode *inode, struct buffer_head *p_s_un_bh); 1891 struct inode *inode, struct buffer_head *un_bh);
1872 1892
1873void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, 1893void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
1874 struct inode *inode, struct reiserfs_key *key); 1894 struct inode *inode, struct reiserfs_key *key);
1875int reiserfs_delete_object(struct reiserfs_transaction_handle *th, 1895int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
1876 struct inode *p_s_inode); 1896 struct inode *inode);
1877int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, 1897int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1878 struct inode *p_s_inode, struct page *, 1898 struct inode *inode, struct page *,
1879 int update_timestamps); 1899 int update_timestamps);
1880 1900
1881#define i_block_size(inode) ((inode)->i_sb->s_blocksize) 1901#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
@@ -1919,10 +1939,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
1919 loff_t offset, int type, int length, int entry_count); 1939 loff_t offset, int type, int length, int entry_count);
1920struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); 1940struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
1921 1941
1942struct reiserfs_security_handle;
1922int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 1943int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1923 struct inode *dir, int mode, 1944 struct inode *dir, int mode,
1924 const char *symname, loff_t i_size, 1945 const char *symname, loff_t i_size,
1925 struct dentry *dentry, struct inode *inode); 1946 struct dentry *dentry, struct inode *inode,
1947 struct reiserfs_security_handle *security);
1926 1948
1927void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, 1949void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
1928 struct inode *inode, loff_t size); 1950 struct inode *inode, loff_t size);
@@ -1980,7 +2002,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1980#define PROC_INFO_MAX( sb, field, value ) VOID_V 2002#define PROC_INFO_MAX( sb, field, value ) VOID_V
1981#define PROC_INFO_INC( sb, field ) VOID_V 2003#define PROC_INFO_INC( sb, field ) VOID_V
1982#define PROC_INFO_ADD( sb, field, val ) VOID_V 2004#define PROC_INFO_ADD( sb, field, val ) VOID_V
1983#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V 2005#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
1984#endif 2006#endif
1985 2007
1986/* dir.c */ 2008/* dir.c */
@@ -1988,6 +2010,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
1988extern const struct inode_operations reiserfs_symlink_inode_operations; 2010extern const struct inode_operations reiserfs_symlink_inode_operations;
1989extern const struct inode_operations reiserfs_special_inode_operations; 2011extern const struct inode_operations reiserfs_special_inode_operations;
1990extern const struct file_operations reiserfs_dir_operations; 2012extern const struct file_operations reiserfs_dir_operations;
2013int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
1991 2014
1992/* tail_conversion.c */ 2015/* tail_conversion.c */
1993int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 2016int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -2004,13 +2027,20 @@ extern const struct address_space_operations reiserfs_address_space_operations;
2004 2027
2005/* fix_nodes.c */ 2028/* fix_nodes.c */
2006 2029
2007int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, 2030int fix_nodes(int n_op_mode, struct tree_balance *tb,
2008 struct item_head *p_s_ins_ih, const void *); 2031 struct item_head *ins_ih, const void *);
2009void unfix_nodes(struct tree_balance *); 2032void unfix_nodes(struct tree_balance *);
2010 2033
2011/* prints.c */ 2034/* prints.c */
2012void reiserfs_panic(struct super_block *s, const char *fmt, ...) 2035void __reiserfs_panic(struct super_block *s, const char *id,
2036 const char *function, const char *fmt, ...)
2013 __attribute__ ((noreturn)); 2037 __attribute__ ((noreturn));
2038#define reiserfs_panic(s, id, fmt, args...) \
2039 __reiserfs_panic(s, id, __func__, fmt, ##args)
2040void __reiserfs_error(struct super_block *s, const char *id,
2041 const char *function, const char *fmt, ...);
2042#define reiserfs_error(s, id, fmt, args...) \
2043 __reiserfs_error(s, id, __func__, fmt, ##args)
2014void reiserfs_info(struct super_block *s, const char *fmt, ...); 2044void reiserfs_info(struct super_block *s, const char *fmt, ...);
2015void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); 2045void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
2016void print_indirect_item(struct buffer_head *bh, int item_num); 2046void print_indirect_item(struct buffer_head *bh, int item_num);
@@ -2047,7 +2077,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2047 int zeros_number); 2077 int zeros_number);
2048void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, 2078void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2049 int pos_in_item, int cut_size); 2079 int pos_in_item, int cut_size);
2050void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, 2080void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
2051 int new_entry_count, struct reiserfs_de_head *new_dehs, 2081 int new_entry_count, struct reiserfs_de_head *new_dehs,
2052 const char *records, int paste_size); 2082 const char *records, int paste_size);
2053/* ibalance.c */ 2083/* ibalance.c */
@@ -2203,6 +2233,6 @@ long reiserfs_compat_ioctl(struct file *filp,
2203 unsigned int cmd, unsigned long arg); 2233 unsigned int cmd, unsigned long arg);
2204int reiserfs_unpack(struct inode *inode, struct file *filp); 2234int reiserfs_unpack(struct inode *inode, struct file *filp);
2205 2235
2206
2207#endif /* __KERNEL__ */ 2236#endif /* __KERNEL__ */
2237
2208#endif /* _LINUX_REISER_FS_H */ 2238#endif /* _LINUX_REISER_FS_H */
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index ce3663fb0101..76360b36ac33 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -51,7 +51,7 @@ struct reiserfs_inode_info {
51 /* we use these for fsync or O_SYNC to decide which transaction 51 /* we use these for fsync or O_SYNC to decide which transaction
52 ** needs to be committed in order for this inode to be properly 52 ** needs to be committed in order for this inode to be properly
53 ** flushed */ 53 ** flushed */
54 unsigned long i_trans_id; 54 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 55 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 56 struct mutex i_mmap;
57#ifdef CONFIG_REISERFS_FS_POSIX_ACL 57#ifdef CONFIG_REISERFS_FS_POSIX_ACL
@@ -59,7 +59,7 @@ struct reiserfs_inode_info {
59 struct posix_acl *i_acl_default; 59 struct posix_acl *i_acl_default;
60#endif 60#endif
61#ifdef CONFIG_REISERFS_FS_XATTR 61#ifdef CONFIG_REISERFS_FS_XATTR
62 struct rw_semaphore xattr_sem; 62 struct rw_semaphore i_xattr_sem;
63#endif 63#endif
64 struct inode vfs_inode; 64 struct inode vfs_inode;
65}; 65};
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index bda6b562a1e0..5621d87c4479 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -14,7 +14,7 @@ typedef enum {
14} reiserfs_super_block_flags; 14} reiserfs_super_block_flags;
15 15
16/* struct reiserfs_super_block accessors/mutators 16/* struct reiserfs_super_block accessors/mutators
17 * since this is a disk structure, it will always be in 17 * since this is a disk structure, it will always be in
18 * little endian format. */ 18 * little endian format. */
19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) 19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count))
20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) 20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v))
@@ -73,6 +73,9 @@ typedef enum {
73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) 73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version))
74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) 74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v))
75 75
76#define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count))
77#define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v))
78
76#define sb_reserved_for_journal(sbp) \ 79#define sb_reserved_for_journal(sbp) \
77 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) 80 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
78#define set_sb_reserved_for_journal(sbp,v) \ 81#define set_sb_reserved_for_journal(sbp,v) \
@@ -80,16 +83,16 @@ typedef enum {
80 83
81/* LOGGING -- */ 84/* LOGGING -- */
82 85
83/* These all interelate for performance. 86/* These all interelate for performance.
84** 87**
85** If the journal block count is smaller than n transactions, you lose speed. 88** If the journal block count is smaller than n transactions, you lose speed.
86** I don't know what n is yet, I'm guessing 8-16. 89** I don't know what n is yet, I'm guessing 8-16.
87** 90**
88** typical transaction size depends on the application, how often fsync is 91** typical transaction size depends on the application, how often fsync is
89** called, and how many metadata blocks you dirty in a 30 second period. 92** called, and how many metadata blocks you dirty in a 30 second period.
90** The more small files (<16k) you use, the larger your transactions will 93** The more small files (<16k) you use, the larger your transactions will
91** be. 94** be.
92** 95**
93** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal 96** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal
94** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough 97** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough
95** to prevent wrapping before dirty meta blocks get to disk. 98** to prevent wrapping before dirty meta blocks get to disk.
@@ -153,7 +156,7 @@ struct reiserfs_journal_list {
153 atomic_t j_commit_left; 156 atomic_t j_commit_left;
154 atomic_t j_older_commits_done; /* all commits older than this on disk */ 157 atomic_t j_older_commits_done; /* all commits older than this on disk */
155 struct mutex j_commit_mutex; 158 struct mutex j_commit_mutex;
156 unsigned long j_trans_id; 159 unsigned int j_trans_id;
157 time_t j_timestamp; 160 time_t j_timestamp;
158 struct reiserfs_list_bitmap *j_list_bitmap; 161 struct reiserfs_list_bitmap *j_list_bitmap;
159 struct buffer_head *j_commit_bh; /* commit buffer head */ 162 struct buffer_head *j_commit_bh; /* commit buffer head */
@@ -182,7 +185,7 @@ struct reiserfs_journal {
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 185 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 186
184 unsigned long j_state; 187 unsigned long j_state;
185 unsigned long j_trans_id; 188 unsigned int j_trans_id;
186 unsigned long j_mount_id; 189 unsigned long j_mount_id;
187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ 190 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len; /* length of current waiting commit */ 191 unsigned long j_len; /* length of current waiting commit */
@@ -223,10 +226,10 @@ struct reiserfs_journal {
223 int j_num_work_lists; /* number that need attention from kreiserfsd */ 226 int j_num_work_lists; /* number that need attention from kreiserfsd */
224 227
225 /* debugging to make sure things are flushed in order */ 228 /* debugging to make sure things are flushed in order */
226 int j_last_flush_id; 229 unsigned int j_last_flush_id;
227 230
228 /* debugging to make sure things are committed in order */ 231 /* debugging to make sure things are committed in order */
229 int j_last_commit_id; 232 unsigned int j_last_commit_id;
230 233
231 struct list_head j_bitmap_nodes; 234 struct list_head j_bitmap_nodes;
232 struct list_head j_dirty_buffers; 235 struct list_head j_dirty_buffers;
@@ -239,7 +242,7 @@ struct reiserfs_journal {
239 242
240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ 243 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ 244 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all 245 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
243 the transactions */ 246 the transactions */
244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 247 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
245 int j_persistent_trans; 248 int j_persistent_trans;
@@ -399,10 +402,7 @@ struct reiserfs_sb_info {
399 int reserved_blocks; /* amount of blocks reserved for further allocations */ 402 int reserved_blocks; /* amount of blocks reserved for further allocations */
400 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ 403 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
401 struct dentry *priv_root; /* root of /.reiserfs_priv */ 404 struct dentry *priv_root; /* root of /.reiserfs_priv */
402#ifdef CONFIG_REISERFS_FS_XATTR
403 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ 405 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
404 struct rw_semaphore xattr_dir_sem;
405#endif
406 int j_errno; 406 int j_errno;
407#ifdef CONFIG_QUOTA 407#ifdef CONFIG_QUOTA
408 char *s_qf_names[MAXQUOTAS]; 408 char *s_qf_names[MAXQUOTAS];
@@ -426,7 +426,7 @@ enum reiserfs_mount_options {
426 partition will be dealt with in a 426 partition will be dealt with in a
427 manner of 3.5.x */ 427 manner of 3.5.x */
428 428
429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
431** is not required. If the normal autodection code can't determine which 431** is not required. If the normal autodection code can't determine which
432** hash to use (because both hashes had the same value for a file) 432** hash to use (because both hashes had the same value for a file)
@@ -451,7 +451,6 @@ enum reiserfs_mount_options {
451 REISERFS_NO_UNHASHED_RELOCATION, 451 REISERFS_NO_UNHASHED_RELOCATION,
452 REISERFS_HASHED_RELOCATION, 452 REISERFS_HASHED_RELOCATION,
453 REISERFS_ATTRS, 453 REISERFS_ATTRS,
454 REISERFS_XATTRS,
455 REISERFS_XATTRS_USER, 454 REISERFS_XATTRS_USER,
456 REISERFS_POSIXACL, 455 REISERFS_POSIXACL,
457 REISERFS_BARRIER_NONE, 456 REISERFS_BARRIER_NONE,
@@ -489,7 +488,7 @@ enum reiserfs_mount_options {
489#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) 488#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
490#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) 489#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
491#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) 490#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
492#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS)) 491#define reiserfs_xattrs(s) ((s)->s_xattr != NULL)
493#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) 492#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
494#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) 493#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
495#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) 494#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index af135ae895db..dcae01e63e40 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -15,6 +15,12 @@ struct reiserfs_xattr_header {
15 __le32 h_hash; /* hash of the value */ 15 __le32 h_hash; /* hash of the value */
16}; 16};
17 17
18struct reiserfs_security_handle {
19 char *name;
20 void *value;
21 size_t length;
22};
23
18#ifdef __KERNEL__ 24#ifdef __KERNEL__
19 25
20#include <linux/init.h> 26#include <linux/init.h>
@@ -29,22 +35,13 @@ struct iattr;
29struct super_block; 35struct super_block;
30struct nameidata; 36struct nameidata;
31 37
32struct reiserfs_xattr_handler { 38int reiserfs_xattr_register_handlers(void) __init;
33 char *prefix; 39void reiserfs_xattr_unregister_handlers(void);
34 int (*init) (void); 40int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
35 void (*exit) (void); 41int reiserfs_delete_xattrs(struct inode *inode);
36 int (*get) (struct inode * inode, const char *name, void *buffer, 42int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
37 size_t size);
38 int (*set) (struct inode * inode, const char *name, const void *buffer,
39 size_t size, int flags);
40 int (*del) (struct inode * inode, const char *name);
41 int (*list) (struct inode * inode, const char *name, int namelen,
42 char *out);
43 struct list_head handlers;
44};
45 43
46#ifdef CONFIG_REISERFS_FS_XATTR 44#ifdef CONFIG_REISERFS_FS_XATTR
47#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
48#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 45#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
49ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 46ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
50 void *buffer, size_t size); 47 void *buffer, size_t size);
@@ -52,104 +49,97 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags); 49 const void *value, size_t size, int flags);
53ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 50ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
54int reiserfs_removexattr(struct dentry *dentry, const char *name); 51int reiserfs_removexattr(struct dentry *dentry, const char *name);
55int reiserfs_delete_xattrs(struct inode *inode);
56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
57int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
58int reiserfs_permission(struct inode *inode, int mask); 52int reiserfs_permission(struct inode *inode, int mask);
59 53
60int reiserfs_xattr_del(struct inode *, const char *); 54int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
62int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); 55int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
63 56int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
64extern struct reiserfs_xattr_handler user_handler; 57 struct inode *, const char *, const void *,
65extern struct reiserfs_xattr_handler trusted_handler; 58 size_t, int);
66extern struct reiserfs_xattr_handler security_handler; 59
67 60extern struct xattr_handler reiserfs_xattr_user_handler;
68int reiserfs_xattr_register_handlers(void) __init; 61extern struct xattr_handler reiserfs_xattr_trusted_handler;
69void reiserfs_xattr_unregister_handlers(void); 62extern struct xattr_handler reiserfs_xattr_security_handler;
70 63#ifdef CONFIG_REISERFS_FS_SECURITY
71static inline void reiserfs_write_lock_xattrs(struct super_block *sb) 64int reiserfs_security_init(struct inode *dir, struct inode *inode,
72{ 65 struct reiserfs_security_handle *sec);
73 down_write(&REISERFS_XATTR_DIR_SEM(sb)); 66int reiserfs_security_write(struct reiserfs_transaction_handle *th,
74} 67 struct inode *inode,
75static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) 68 struct reiserfs_security_handle *sec);
76{ 69void reiserfs_security_free(struct reiserfs_security_handle *sec);
77 up_write(&REISERFS_XATTR_DIR_SEM(sb)); 70#endif
78} 71
79static inline void reiserfs_read_lock_xattrs(struct super_block *sb) 72#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
80{ 73static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
81 down_read(&REISERFS_XATTR_DIR_SEM(sb));
82}
83
84static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
85{ 74{
86 up_read(&REISERFS_XATTR_DIR_SEM(sb)); 75 loff_t ret = 0;
76 if (reiserfs_file_data_log(inode)) {
77 ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
78 ret >>= inode->i_sb->s_blocksize_bits;
79 }
80 return ret;
87} 81}
88 82
89static inline void reiserfs_write_lock_xattr_i(struct inode *inode) 83/* We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
90{ 84 * Let's try to be smart about it.
91 down_write(&REISERFS_I(inode)->xattr_sem); 85 * xattr root: We cache it. If it's not cached, we may need to create it.
92} 86 * xattr dir: If anything has been loaded for this inode, we can set a flag
93static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) 87 * saying so.
88 * xattr file: Since we don't cache xattrs, we can't tell. We always include
89 * blocks for it.
90 *
91 * However, since root and dir can be created between calls - YOU MUST SAVE
92 * THIS VALUE.
93 */
94static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
94{ 95{
95 up_write(&REISERFS_I(inode)->xattr_sem); 96 size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
96}
97static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
98{
99 down_read(&REISERFS_I(inode)->xattr_sem);
100}
101 97
102static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) 98 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
103{ 99 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
104 up_read(&REISERFS_I(inode)->xattr_sem); 100 if (REISERFS_SB(inode->i_sb)->xattr_root == NULL)
105} 101 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
102 }
106 103
107static inline void reiserfs_mark_inode_private(struct inode *inode) 104 return nblocks;
108{
109 inode->i_flags |= S_PRIVATE;
110} 105}
111 106
112static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 107static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
113{ 108{
114 init_rwsem(&REISERFS_I(inode)->xattr_sem); 109 init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
115} 110}
116 111
117#else 112#else
118 113
119#define is_reiserfs_priv_object(inode) 0
120#define reiserfs_mark_inode_private(inode) do {;} while(0)
121#define reiserfs_getxattr NULL 114#define reiserfs_getxattr NULL
122#define reiserfs_setxattr NULL 115#define reiserfs_setxattr NULL
123#define reiserfs_listxattr NULL 116#define reiserfs_listxattr NULL
124#define reiserfs_removexattr NULL 117#define reiserfs_removexattr NULL
125#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
126#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
127#define reiserfs_read_lock_xattrs(sb)
128#define reiserfs_read_unlock_xattrs(sb)
129 118
130#define reiserfs_permission NULL 119#define reiserfs_permission NULL
131 120
132#define reiserfs_xattr_register_handlers() 0 121static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
133#define reiserfs_xattr_unregister_handlers()
134
135static inline int reiserfs_delete_xattrs(struct inode *inode)
136{ 122{
137 return 0; 123}
138}; 124#endif /* CONFIG_REISERFS_FS_XATTR */
139static inline int reiserfs_chown_xattrs(struct inode *inode, 125
140 struct iattr *attrs) 126#ifndef CONFIG_REISERFS_FS_SECURITY
127static inline int reiserfs_security_init(struct inode *dir,
128 struct inode *inode,
129 struct reiserfs_security_handle *sec)
141{ 130{
142 return 0; 131 return 0;
143}; 132}
144static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) 133static inline int
134reiserfs_security_write(struct reiserfs_transaction_handle *th,
135 struct inode *inode,
136 struct reiserfs_security_handle *sec)
145{ 137{
146 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
147 return 0; 138 return 0;
148};
149static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
150{
151} 139}
152#endif /* CONFIG_REISERFS_FS_XATTR */ 140static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
141{}
142#endif
153 143
154#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
155 145
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
index bf74e63c98fe..8ba646e610d9 100644
--- a/include/linux/rtc-v3020.h
+++ b/include/linux/rtc-v3020.h
@@ -14,6 +14,12 @@
14 * is used depends on the board. */ 14 * is used depends on the board. */
15struct v3020_platform_data { 15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */ 16 int leftshift; /* (1<<(leftshift)) & readl() */
17
18 int use_gpio:1;
19 unsigned int gpio_cs;
20 unsigned int gpio_wr;
21 unsigned int gpio_rd;
22 unsigned int gpio_io;
17}; 23};
18 24
19#define V3020_STATUS_0 0x00 25#define V3020_STATUS_0 0x00
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 4046b75563c1..60f88a7fb13d 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -99,6 +99,7 @@ struct rtc_pll_info {
99 99
100#ifdef __KERNEL__ 100#ifdef __KERNEL__
101 101
102#include <linux/types.h>
102#include <linux/interrupt.h> 103#include <linux/interrupt.h>
103 104
104extern int rtc_month_days(unsigned int month, unsigned int year); 105extern int rtc_month_days(unsigned int month, unsigned int year);
@@ -232,6 +233,11 @@ int rtc_register(rtc_task_t *task);
232int rtc_unregister(rtc_task_t *task); 233int rtc_unregister(rtc_task_t *task);
233int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 234int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
234 235
236static inline bool is_leap_year(unsigned int year)
237{
238 return (!(year % 4) && (year % 100)) || !(year % 400);
239}
240
235#endif /* __KERNEL__ */ 241#endif /* __KERNEL__ */
236 242
237#endif /* _LINUX_RTC_H_ */ 243#endif /* _LINUX_RTC_H_ */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 1e5f6730ff31..ba3254ecf7fb 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -217,6 +217,7 @@ enum
217#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ 217#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
218#define RTPROT_XORP 14 /* XORP */ 218#define RTPROT_XORP 14 /* XORP */
219#define RTPROT_NTK 15 /* Netsukuku */ 219#define RTPROT_NTK 15 /* Netsukuku */
220#define RTPROT_DHCP 16 /* DHCP client */
220 221
221/* rtm_scope 222/* rtm_scope
222 223
@@ -622,8 +623,8 @@ static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
622 623
623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); 624extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); 625extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, 626extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid,
626 struct nlmsghdr *nlh, gfp_t flags); 627 u32 group, struct nlmsghdr *nlh, gfp_t flags);
627extern void rtnl_set_sk_err(struct net *net, u32 group, int error); 628extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 629extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 630extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 471e36d30123..c96140210d1c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -68,7 +68,7 @@ struct sched_param {
68#include <linux/smp.h> 68#include <linux/smp.h>
69#include <linux/sem.h> 69#include <linux/sem.h>
70#include <linux/signal.h> 70#include <linux/signal.h>
71#include <linux/fs_struct.h> 71#include <linux/path.h>
72#include <linux/compiler.h> 72#include <linux/compiler.h>
73#include <linux/completion.h> 73#include <linux/completion.h>
74#include <linux/pid.h> 74#include <linux/pid.h>
@@ -97,6 +97,7 @@ struct futex_pi_state;
97struct robust_list_head; 97struct robust_list_head;
98struct bio; 98struct bio;
99struct bts_tracer; 99struct bts_tracer;
100struct fs_struct;
100 101
101/* 102/*
102 * List of flags we want to share for kernel threads, 103 * List of flags we want to share for kernel threads,
@@ -393,8 +394,15 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
393 (mm)->hiwater_vm = (mm)->total_vm; \ 394 (mm)->hiwater_vm = (mm)->total_vm; \
394} while (0) 395} while (0)
395 396
396#define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm)) 397static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
397#define get_mm_hiwater_vm(mm) max((mm)->hiwater_vm, (mm)->total_vm) 398{
399 return max(mm->hiwater_rss, get_mm_rss(mm));
400}
401
402static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
403{
404 return max(mm->hiwater_vm, mm->total_vm);
405}
398 406
399extern void set_dumpable(struct mm_struct *mm, int value); 407extern void set_dumpable(struct mm_struct *mm, int value);
400extern int get_dumpable(struct mm_struct *mm); 408extern int get_dumpable(struct mm_struct *mm);
@@ -542,25 +550,8 @@ struct signal_struct {
542 550
543 struct list_head cpu_timers[3]; 551 struct list_head cpu_timers[3];
544 552
545 /* job control IDs */
546
547 /*
548 * pgrp and session fields are deprecated.
549 * use the task_session_Xnr and task_pgrp_Xnr routines below
550 */
551
552 union {
553 pid_t pgrp __deprecated;
554 pid_t __pgrp;
555 };
556
557 struct pid *tty_old_pgrp; 553 struct pid *tty_old_pgrp;
558 554
559 union {
560 pid_t session __deprecated;
561 pid_t __session;
562 };
563
564 /* boolean value for session group leader */ 555 /* boolean value for session group leader */
565 int leader; 556 int leader;
566 557
@@ -1002,6 +993,7 @@ struct sched_class {
1002 struct rq *busiest, struct sched_domain *sd, 993 struct rq *busiest, struct sched_domain *sd,
1003 enum cpu_idle_type idle); 994 enum cpu_idle_type idle);
1004 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 995 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
996 int (*needs_post_schedule) (struct rq *this_rq);
1005 void (*post_schedule) (struct rq *this_rq); 997 void (*post_schedule) (struct rq *this_rq);
1006 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 998 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
1007 999
@@ -1056,6 +1048,10 @@ struct sched_entity {
1056 u64 last_wakeup; 1048 u64 last_wakeup;
1057 u64 avg_overlap; 1049 u64 avg_overlap;
1058 1050
1051 u64 start_runtime;
1052 u64 avg_wakeup;
1053 u64 nr_migrations;
1054
1059#ifdef CONFIG_SCHEDSTATS 1055#ifdef CONFIG_SCHEDSTATS
1060 u64 wait_start; 1056 u64 wait_start;
1061 u64 wait_max; 1057 u64 wait_max;
@@ -1071,7 +1067,6 @@ struct sched_entity {
1071 u64 exec_max; 1067 u64 exec_max;
1072 u64 slice_max; 1068 u64 slice_max;
1073 1069
1074 u64 nr_migrations;
1075 u64 nr_migrations_cold; 1070 u64 nr_migrations_cold;
1076 u64 nr_failed_migrations_affine; 1071 u64 nr_failed_migrations_affine;
1077 u64 nr_failed_migrations_running; 1072 u64 nr_failed_migrations_running;
@@ -1168,6 +1163,7 @@ struct task_struct {
1168#endif 1163#endif
1169 1164
1170 struct list_head tasks; 1165 struct list_head tasks;
1166 struct plist_node pushable_tasks;
1171 1167
1172 struct mm_struct *mm, *active_mm; 1168 struct mm_struct *mm, *active_mm;
1173 1169
@@ -1179,6 +1175,8 @@ struct task_struct {
1179 /* ??? */ 1175 /* ??? */
1180 unsigned int personality; 1176 unsigned int personality;
1181 unsigned did_exec:1; 1177 unsigned did_exec:1;
1178 unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1179 * execve */
1182 pid_t pid; 1180 pid_t pid;
1183 pid_t tgid; 1181 pid_t tgid;
1184 1182
@@ -1296,6 +1294,11 @@ struct task_struct {
1296/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1294/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
1297 spinlock_t alloc_lock; 1295 spinlock_t alloc_lock;
1298 1296
1297#ifdef CONFIG_GENERIC_HARDIRQS
1298 /* IRQ handler threads */
1299 struct irqaction *irqaction;
1300#endif
1301
1299 /* Protection of the PI data structures: */ 1302 /* Protection of the PI data structures: */
1300 spinlock_t pi_lock; 1303 spinlock_t pi_lock;
1301 1304
@@ -1459,16 +1462,6 @@ static inline int rt_task(struct task_struct *p)
1459 return rt_prio(p->prio); 1462 return rt_prio(p->prio);
1460} 1463}
1461 1464
1462static inline void set_task_session(struct task_struct *tsk, pid_t session)
1463{
1464 tsk->signal->__session = session;
1465}
1466
1467static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
1468{
1469 tsk->signal->__pgrp = pgrp;
1470}
1471
1472static inline struct pid *task_pid(struct task_struct *task) 1465static inline struct pid *task_pid(struct task_struct *task)
1473{ 1466{
1474 return task->pids[PIDTYPE_PID].pid; 1467 return task->pids[PIDTYPE_PID].pid;
@@ -1479,6 +1472,11 @@ static inline struct pid *task_tgid(struct task_struct *task)
1479 return task->group_leader->pids[PIDTYPE_PID].pid; 1472 return task->group_leader->pids[PIDTYPE_PID].pid;
1480} 1473}
1481 1474
1475/*
1476 * Without tasklist or rcu lock it is not safe to dereference
1477 * the result of task_pgrp/task_session even if task == current,
1478 * we can race with another thread doing sys_setsid/sys_setpgid.
1479 */
1482static inline struct pid *task_pgrp(struct task_struct *task) 1480static inline struct pid *task_pgrp(struct task_struct *task)
1483{ 1481{
1484 return task->group_leader->pids[PIDTYPE_PGID].pid; 1482 return task->group_leader->pids[PIDTYPE_PGID].pid;
@@ -1504,17 +1502,23 @@ struct pid_namespace;
1504 * 1502 *
1505 * see also pid_nr() etc in include/linux/pid.h 1503 * see also pid_nr() etc in include/linux/pid.h
1506 */ 1504 */
1505pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
1506 struct pid_namespace *ns);
1507 1507
1508static inline pid_t task_pid_nr(struct task_struct *tsk) 1508static inline pid_t task_pid_nr(struct task_struct *tsk)
1509{ 1509{
1510 return tsk->pid; 1510 return tsk->pid;
1511} 1511}
1512 1512
1513pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); 1513static inline pid_t task_pid_nr_ns(struct task_struct *tsk,
1514 struct pid_namespace *ns)
1515{
1516 return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
1517}
1514 1518
1515static inline pid_t task_pid_vnr(struct task_struct *tsk) 1519static inline pid_t task_pid_vnr(struct task_struct *tsk)
1516{ 1520{
1517 return pid_vnr(task_pid(tsk)); 1521 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1518} 1522}
1519 1523
1520 1524
@@ -1531,31 +1535,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1531} 1535}
1532 1536
1533 1537
1534static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1538static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1539 struct pid_namespace *ns)
1535{ 1540{
1536 return tsk->signal->__pgrp; 1541 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
1537} 1542}
1538 1543
1539pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1540
1541static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 1544static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1542{ 1545{
1543 return pid_vnr(task_pgrp(tsk)); 1546 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1544} 1547}
1545 1548
1546 1549
1547static inline pid_t task_session_nr(struct task_struct *tsk) 1550static inline pid_t task_session_nr_ns(struct task_struct *tsk,
1551 struct pid_namespace *ns)
1548{ 1552{
1549 return tsk->signal->__session; 1553 return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
1550} 1554}
1551 1555
1552pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1553
1554static inline pid_t task_session_vnr(struct task_struct *tsk) 1556static inline pid_t task_session_vnr(struct task_struct *tsk)
1555{ 1557{
1556 return pid_vnr(task_session(tsk)); 1558 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1557} 1559}
1558 1560
1561/* obsolete, do not use */
1562static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1563{
1564 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1565}
1559 1566
1560/** 1567/**
1561 * pid_alive - check that a task structure is not stale 1568 * pid_alive - check that a task structure is not stale
@@ -1965,7 +1972,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
1965/* Allocate a new mm structure and copy contents from tsk->mm */ 1972/* Allocate a new mm structure and copy contents from tsk->mm */
1966extern struct mm_struct *dup_mm(struct task_struct *tsk); 1973extern struct mm_struct *dup_mm(struct task_struct *tsk);
1967 1974
1968extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); 1975extern int copy_thread(unsigned long, unsigned long, unsigned long,
1976 struct task_struct *, struct pt_regs *);
1969extern void flush_thread(void); 1977extern void flush_thread(void);
1970extern void exit_thread(void); 1978extern void exit_thread(void);
1971 1979
@@ -2050,6 +2058,11 @@ static inline int thread_group_empty(struct task_struct *p)
2050#define delay_group_leader(p) \ 2058#define delay_group_leader(p) \
2051 (thread_group_leader(p) && !thread_group_empty(p)) 2059 (thread_group_leader(p) && !thread_group_empty(p))
2052 2060
2061static inline int task_detached(struct task_struct *p)
2062{
2063 return p->exit_signal == -1;
2064}
2065
2053/* 2066/*
2054 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2067 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2055 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2068 * subscriptions and synchronises with wait4(). Also used in procfs. Also
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 8ba1c320f975..c2731bfe04d8 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -60,7 +60,7 @@ typedef struct sctphdr {
60 __be16 source; 60 __be16 source;
61 __be16 dest; 61 __be16 dest;
62 __be32 vtag; 62 __be32 vtag;
63 __be32 checksum; 63 __le32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
@@ -172,35 +172,35 @@ typedef struct sctp_paramhdr {
172typedef enum { 172typedef enum {
173 173
174 /* RFC 2960 Section 3.3.5 */ 174 /* RFC 2960 Section 3.3.5 */
175 SCTP_PARAM_HEARTBEAT_INFO = __constant_htons(1), 175 SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1),
176 /* RFC 2960 Section 3.3.2.1 */ 176 /* RFC 2960 Section 3.3.2.1 */
177 SCTP_PARAM_IPV4_ADDRESS = __constant_htons(5), 177 SCTP_PARAM_IPV4_ADDRESS = cpu_to_be16(5),
178 SCTP_PARAM_IPV6_ADDRESS = __constant_htons(6), 178 SCTP_PARAM_IPV6_ADDRESS = cpu_to_be16(6),
179 SCTP_PARAM_STATE_COOKIE = __constant_htons(7), 179 SCTP_PARAM_STATE_COOKIE = cpu_to_be16(7),
180 SCTP_PARAM_UNRECOGNIZED_PARAMETERS = __constant_htons(8), 180 SCTP_PARAM_UNRECOGNIZED_PARAMETERS = cpu_to_be16(8),
181 SCTP_PARAM_COOKIE_PRESERVATIVE = __constant_htons(9), 181 SCTP_PARAM_COOKIE_PRESERVATIVE = cpu_to_be16(9),
182 SCTP_PARAM_HOST_NAME_ADDRESS = __constant_htons(11), 182 SCTP_PARAM_HOST_NAME_ADDRESS = cpu_to_be16(11),
183 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12), 183 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = cpu_to_be16(12),
184 SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000), 184 SCTP_PARAM_ECN_CAPABLE = cpu_to_be16(0x8000),
185 185
186 /* AUTH Extension Section 3 */ 186 /* AUTH Extension Section 3 */
187 SCTP_PARAM_RANDOM = __constant_htons(0x8002), 187 SCTP_PARAM_RANDOM = cpu_to_be16(0x8002),
188 SCTP_PARAM_CHUNKS = __constant_htons(0x8003), 188 SCTP_PARAM_CHUNKS = cpu_to_be16(0x8003),
189 SCTP_PARAM_HMAC_ALGO = __constant_htons(0x8004), 189 SCTP_PARAM_HMAC_ALGO = cpu_to_be16(0x8004),
190 190
191 /* Add-IP: Supported Extensions, Section 4.2 */ 191 /* Add-IP: Supported Extensions, Section 4.2 */
192 SCTP_PARAM_SUPPORTED_EXT = __constant_htons(0x8008), 192 SCTP_PARAM_SUPPORTED_EXT = cpu_to_be16(0x8008),
193 193
194 /* PR-SCTP Sec 3.1 */ 194 /* PR-SCTP Sec 3.1 */
195 SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000), 195 SCTP_PARAM_FWD_TSN_SUPPORT = cpu_to_be16(0xc000),
196 196
197 /* Add-IP Extension. Section 3.2 */ 197 /* Add-IP Extension. Section 3.2 */
198 SCTP_PARAM_ADD_IP = __constant_htons(0xc001), 198 SCTP_PARAM_ADD_IP = cpu_to_be16(0xc001),
199 SCTP_PARAM_DEL_IP = __constant_htons(0xc002), 199 SCTP_PARAM_DEL_IP = cpu_to_be16(0xc002),
200 SCTP_PARAM_ERR_CAUSE = __constant_htons(0xc003), 200 SCTP_PARAM_ERR_CAUSE = cpu_to_be16(0xc003),
201 SCTP_PARAM_SET_PRIMARY = __constant_htons(0xc004), 201 SCTP_PARAM_SET_PRIMARY = cpu_to_be16(0xc004),
202 SCTP_PARAM_SUCCESS_REPORT = __constant_htons(0xc005), 202 SCTP_PARAM_SUCCESS_REPORT = cpu_to_be16(0xc005),
203 SCTP_PARAM_ADAPTATION_LAYER_IND = __constant_htons(0xc006), 203 SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
204 204
205} sctp_param_t; /* enum */ 205} sctp_param_t; /* enum */
206 206
@@ -212,13 +212,13 @@ typedef enum {
212 * 212 *
213 */ 213 */
214typedef enum { 214typedef enum {
215 SCTP_PARAM_ACTION_DISCARD = __constant_htons(0x0000), 215 SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000),
216 SCTP_PARAM_ACTION_DISCARD_ERR = __constant_htons(0x4000), 216 SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
217 SCTP_PARAM_ACTION_SKIP = __constant_htons(0x8000), 217 SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000),
218 SCTP_PARAM_ACTION_SKIP_ERR = __constant_htons(0xc000), 218 SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000),
219} sctp_param_action_t; 219} sctp_param_action_t;
220 220
221enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), }; 221enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
222 222
223/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 223/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
224 224
@@ -457,17 +457,17 @@ typedef struct sctp_operr_chunk {
457 */ 457 */
458typedef enum { 458typedef enum {
459 459
460 SCTP_ERROR_NO_ERROR = __constant_htons(0x00), 460 SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00),
461 SCTP_ERROR_INV_STRM = __constant_htons(0x01), 461 SCTP_ERROR_INV_STRM = cpu_to_be16(0x01),
462 SCTP_ERROR_MISS_PARAM = __constant_htons(0x02), 462 SCTP_ERROR_MISS_PARAM = cpu_to_be16(0x02),
463 SCTP_ERROR_STALE_COOKIE = __constant_htons(0x03), 463 SCTP_ERROR_STALE_COOKIE = cpu_to_be16(0x03),
464 SCTP_ERROR_NO_RESOURCE = __constant_htons(0x04), 464 SCTP_ERROR_NO_RESOURCE = cpu_to_be16(0x04),
465 SCTP_ERROR_DNS_FAILED = __constant_htons(0x05), 465 SCTP_ERROR_DNS_FAILED = cpu_to_be16(0x05),
466 SCTP_ERROR_UNKNOWN_CHUNK = __constant_htons(0x06), 466 SCTP_ERROR_UNKNOWN_CHUNK = cpu_to_be16(0x06),
467 SCTP_ERROR_INV_PARAM = __constant_htons(0x07), 467 SCTP_ERROR_INV_PARAM = cpu_to_be16(0x07),
468 SCTP_ERROR_UNKNOWN_PARAM = __constant_htons(0x08), 468 SCTP_ERROR_UNKNOWN_PARAM = cpu_to_be16(0x08),
469 SCTP_ERROR_NO_DATA = __constant_htons(0x09), 469 SCTP_ERROR_NO_DATA = cpu_to_be16(0x09),
470 SCTP_ERROR_COOKIE_IN_SHUTDOWN = __constant_htons(0x0a), 470 SCTP_ERROR_COOKIE_IN_SHUTDOWN = cpu_to_be16(0x0a),
471 471
472 472
473 /* SCTP Implementation Guide: 473 /* SCTP Implementation Guide:
@@ -476,9 +476,9 @@ typedef enum {
476 * 13 Protocol Violation 476 * 13 Protocol Violation
477 */ 477 */
478 478
479 SCTP_ERROR_RESTART = __constant_htons(0x0b), 479 SCTP_ERROR_RESTART = cpu_to_be16(0x0b),
480 SCTP_ERROR_USER_ABORT = __constant_htons(0x0c), 480 SCTP_ERROR_USER_ABORT = cpu_to_be16(0x0c),
481 SCTP_ERROR_PROTO_VIOLATION = __constant_htons(0x0d), 481 SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
482 482
483 /* ADDIP Section 3.3 New Error Causes 483 /* ADDIP Section 3.3 New Error Causes
484 * 484 *
@@ -493,11 +493,11 @@ typedef enum {
493 * 0x0103 Association Aborted due to illegal ASCONF-ACK 493 * 0x0103 Association Aborted due to illegal ASCONF-ACK
494 * 0x0104 Request refused - no authorization. 494 * 0x0104 Request refused - no authorization.
495 */ 495 */
496 SCTP_ERROR_DEL_LAST_IP = __constant_htons(0x0100), 496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x0100),
497 SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101), 497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x0101),
498 SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102), 498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x0102),
499 SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103), 499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x0103),
500 SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104), 500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x0104),
501 501
502 /* AUTH Section 4. New Error Cause 502 /* AUTH Section 4. New Error Cause
503 * 503 *
@@ -509,7 +509,7 @@ typedef enum {
509 * -------------------------------------------------------------- 509 * --------------------------------------------------------------
510 * 0x0105 Unsupported HMAC Identifier 510 * 0x0105 Unsupported HMAC Identifier
511 */ 511 */
512 SCTP_ERROR_UNSUP_HMAC = __constant_htons(0x0105) 512 SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105)
513} sctp_error_t; 513} sctp_error_t;
514 514
515 515
diff --git a/include/linux/security.h b/include/linux/security.h
index 1f2ab6353c00..d5fd6163606f 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -32,6 +32,7 @@
32#include <linux/sched.h> 32#include <linux/sched.h>
33#include <linux/key.h> 33#include <linux/key.h>
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <linux/gfp.h>
35#include <net/flow.h> 36#include <net/flow.h>
36 37
37/* Maximum number of letters for an LSM name string */ 38/* Maximum number of letters for an LSM name string */
@@ -880,11 +881,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
880 * @sock contains the listening socket structure. 881 * @sock contains the listening socket structure.
881 * @newsock contains the newly created server socket for connection. 882 * @newsock contains the newly created server socket for connection.
882 * Return 0 if permission is granted. 883 * Return 0 if permission is granted.
883 * @socket_post_accept:
884 * This hook allows a security module to copy security
885 * information into the newly created socket's inode.
886 * @sock contains the listening socket structure.
887 * @newsock contains the newly created server socket for connection.
888 * @socket_sendmsg: 884 * @socket_sendmsg:
889 * Check permission before transmitting a message to another socket. 885 * Check permission before transmitting a message to another socket.
890 * @sock contains the socket structure. 886 * @sock contains the socket structure.
@@ -1554,8 +1550,6 @@ struct security_operations {
1554 struct sockaddr *address, int addrlen); 1550 struct sockaddr *address, int addrlen);
1555 int (*socket_listen) (struct socket *sock, int backlog); 1551 int (*socket_listen) (struct socket *sock, int backlog);
1556 int (*socket_accept) (struct socket *sock, struct socket *newsock); 1552 int (*socket_accept) (struct socket *sock, struct socket *newsock);
1557 void (*socket_post_accept) (struct socket *sock,
1558 struct socket *newsock);
1559 int (*socket_sendmsg) (struct socket *sock, 1553 int (*socket_sendmsg) (struct socket *sock,
1560 struct msghdr *msg, int size); 1554 struct msghdr *msg, int size);
1561 int (*socket_recvmsg) (struct socket *sock, 1555 int (*socket_recvmsg) (struct socket *sock,
@@ -2537,7 +2531,6 @@ int security_socket_bind(struct socket *sock, struct sockaddr *address, int addr
2537int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen); 2531int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
2538int security_socket_listen(struct socket *sock, int backlog); 2532int security_socket_listen(struct socket *sock, int backlog);
2539int security_socket_accept(struct socket *sock, struct socket *newsock); 2533int security_socket_accept(struct socket *sock, struct socket *newsock);
2540void security_socket_post_accept(struct socket *sock, struct socket *newsock);
2541int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size); 2534int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
2542int security_socket_recvmsg(struct socket *sock, struct msghdr *msg, 2535int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
2543 int size, int flags); 2536 int size, int flags);
@@ -2616,11 +2609,6 @@ static inline int security_socket_accept(struct socket *sock,
2616 return 0; 2609 return 0;
2617} 2610}
2618 2611
2619static inline void security_socket_post_accept(struct socket *sock,
2620 struct socket *newsock)
2621{
2622}
2623
2624static inline int security_socket_sendmsg(struct socket *sock, 2612static inline int security_socket_sendmsg(struct socket *sock,
2625 struct msghdr *msg, int size) 2613 struct msghdr *msg, int size)
2626{ 2614{
@@ -2966,5 +2954,28 @@ static inline void securityfs_remove(struct dentry *dentry)
2966 2954
2967#endif 2955#endif
2968 2956
2957#ifdef CONFIG_SECURITY
2958
2959static inline char *alloc_secdata(void)
2960{
2961 return (char *)get_zeroed_page(GFP_KERNEL);
2962}
2963
2964static inline void free_secdata(void *secdata)
2965{
2966 free_page((unsigned long)secdata);
2967}
2968
2969#else
2970
2971static inline char *alloc_secdata(void)
2972{
2973 return (char *)1;
2974}
2975
2976static inline void free_secdata(void *secdata)
2977{ }
2978#endif /* CONFIG_SECURITY */
2979
2969#endif /* ! __LINUX_SECURITY_H */ 2980#endif /* ! __LINUX_SECURITY_H */
2970 2981
diff --git a/include/linux/selinux_netlink.h b/include/linux/selinux_netlink.h
index bbf489decd84..d239797785cf 100644
--- a/include/linux/selinux_netlink.h
+++ b/include/linux/selinux_netlink.h
@@ -12,6 +12,8 @@
12#ifndef _LINUX_SELINUX_NETLINK_H 12#ifndef _LINUX_SELINUX_NETLINK_H
13#define _LINUX_SELINUX_NETLINK_H 13#define _LINUX_SELINUX_NETLINK_H
14 14
15#include <linux/types.h>
16
15/* Message types. */ 17/* Message types. */
16#define SELNL_MSG_BASE 0x10 18#define SELNL_MSG_BASE 0x10
17enum { 19enum {
@@ -38,11 +40,11 @@ enum selinux_nlgroups {
38 40
39/* Message structures */ 41/* Message structures */
40struct selnl_msg_setenforce { 42struct selnl_msg_setenforce {
41 int32_t val; 43 __s32 val;
42}; 44};
43 45
44struct selnl_msg_policyload { 46struct selnl_msg_policyload {
45 u_int32_t seqno; 47 __u32 seqno;
46}; 48};
47 49
48#endif /* _LINUX_SELINUX_NETLINK_H */ 50#endif /* _LINUX_SELINUX_NETLINK_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index f616f31576d7..004f3b3342c5 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -55,7 +55,7 @@ int seq_bitmap(struct seq_file *m, const unsigned long *bits,
55 unsigned int nr_bits); 55 unsigned int nr_bits);
56static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) 56static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
57{ 57{
58 return seq_bitmap(m, mask->bits, nr_cpu_ids); 58 return seq_bitmap(m, cpumask_bits(mask), nr_cpu_ids);
59} 59}
60 60
61static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) 61static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
@@ -63,12 +63,13 @@ static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
63 return seq_bitmap(m, mask->bits, MAX_NUMNODES); 63 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
64} 64}
65 65
66int seq_bitmap_list(struct seq_file *m, unsigned long *bits, 66int seq_bitmap_list(struct seq_file *m, const unsigned long *bits,
67 unsigned int nr_bits); 67 unsigned int nr_bits);
68 68
69static inline int seq_cpumask_list(struct seq_file *m, cpumask_t *mask) 69static inline int seq_cpumask_list(struct seq_file *m,
70 const struct cpumask *mask)
70{ 71{
71 return seq_bitmap_list(m, mask->bits, NR_CPUS); 72 return seq_bitmap_list(m, cpumask_bits(mask), nr_cpu_ids);
72} 73}
73 74
74static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) 75static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index df9245c7bd3b..57a97e52e58d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -164,6 +164,9 @@
164/* NWPSERIAL */ 164/* NWPSERIAL */
165#define PORT_NWPSERIAL 85 165#define PORT_NWPSERIAL 85
166 166
167/* MAX3100 */
168#define PORT_MAX3100 86
169
167#ifdef __KERNEL__ 170#ifdef __KERNEL__
168 171
169#include <linux/compiler.h> 172#include <linux/compiler.h>
@@ -277,7 +280,7 @@ struct uart_port {
277 struct uart_icount icount; /* statistics */ 280 struct uart_icount icount; /* statistics */
278 281
279 struct console *cons; /* struct console, if any */ 282 struct console *cons; /* struct console, if any */
280#ifdef CONFIG_SERIAL_CORE_CONSOLE 283#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ)
281 unsigned long sysrq; /* sysrq timeout */ 284 unsigned long sysrq; /* sysrq timeout */
282#endif 285#endif
283 286
diff --git a/include/linux/sh_cmt.h b/include/linux/sh_cmt.h
new file mode 100644
index 000000000000..68cacde5954f
--- /dev/null
+++ b/include/linux/sh_cmt.h
@@ -0,0 +1,13 @@
1#ifndef __SH_CMT_H__
2#define __SH_CMT_H__
3
4struct sh_cmt_config {
5 char *name;
6 unsigned long channel_offset;
7 int timer_bit;
8 char *clk;
9 unsigned long clockevent_rating;
10 unsigned long clocksource_rating;
11};
12
13#endif /* __SH_CMT_H__ */
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 68e212ff9dde..eb1423a0078d 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -85,6 +85,7 @@ struct intc_desc symbol __initdata = { \
85} 85}
86#endif 86#endif
87 87
88unsigned int intc_evt2irq(unsigned int vector);
88void __init register_intc_controller(struct intc_desc *desc); 89void __init register_intc_controller(struct intc_desc *desc);
89int intc_set_priority(unsigned int irq, unsigned int prio); 90int intc_set_priority(unsigned int irq, unsigned int prio);
90 91
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9dcf956ad18a..5fd389162f01 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -29,9 +29,6 @@
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h> 30#include <linux/hrtimer.h>
31 31
32#define HAVE_ALLOC_SKB /* For the drivers to know */
33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
34
35/* Don't change this without changing skb_csum_unnecessary! */ 32/* Don't change this without changing skb_csum_unnecessary! */
36#define CHECKSUM_NONE 0 33#define CHECKSUM_NONE 0
37#define CHECKSUM_UNNECESSARY 1 34#define CHECKSUM_UNNECESSARY 1
@@ -135,6 +132,56 @@ struct skb_frag_struct {
135 __u32 size; 132 __u32 size;
136}; 133};
137 134
135#define HAVE_HW_TIME_STAMP
136
137/**
138 * struct skb_shared_hwtstamps - hardware time stamps
139 * @hwtstamp: hardware time stamp transformed into duration
140 * since arbitrary point in time
141 * @syststamp: hwtstamp transformed to system time base
142 *
143 * Software time stamps generated by ktime_get_real() are stored in
144 * skb->tstamp. The relation between the different kinds of time
145 * stamps is as follows:
146 *
147 * syststamp and tstamp can be compared against each other in
148 * arbitrary combinations. The accuracy of a
149 * syststamp/tstamp/"syststamp from other device" comparison is
150 * limited by the accuracy of the transformation into system time
151 * base. This depends on the device driver and its underlying
152 * hardware.
153 *
154 * hwtstamps can only be compared against other hwtstamps from
155 * the same device.
156 *
157 * This structure is attached to packets as part of the
158 * &skb_shared_info. Use skb_hwtstamps() to get a pointer.
159 */
160struct skb_shared_hwtstamps {
161 ktime_t hwtstamp;
162 ktime_t syststamp;
163};
164
165/**
166 * struct skb_shared_tx - instructions for time stamping of outgoing packets
167 * @hardware: generate hardware time stamp
168 * @software: generate software time stamp
169 * @in_progress: device driver is going to provide
170 * hardware time stamp
171 * @flags: all shared_tx flags
172 *
173 * These flags are attached to packets as part of the
174 * &skb_shared_info. Use skb_tx() to get a pointer.
175 */
176union skb_shared_tx {
177 struct {
178 __u8 hardware:1,
179 software:1,
180 in_progress:1;
181 };
182 __u8 flags;
183};
184
138/* This data is invariant across clones and lives at 185/* This data is invariant across clones and lives at
139 * the end of the header data, ie. at skb->end. 186 * the end of the header data, ie. at skb->end.
140 */ 187 */
@@ -146,10 +193,12 @@ struct skb_shared_info {
146 unsigned short gso_segs; 193 unsigned short gso_segs;
147 unsigned short gso_type; 194 unsigned short gso_type;
148 __be32 ip6_frag_id; 195 __be32 ip6_frag_id;
196 union skb_shared_tx tx_flags;
149#ifdef CONFIG_HAS_DMA 197#ifdef CONFIG_HAS_DMA
150 unsigned int num_dma_maps; 198 unsigned int num_dma_maps;
151#endif 199#endif
152 struct sk_buff *frag_list; 200 struct sk_buff *frag_list;
201 struct skb_shared_hwtstamps hwtstamps;
153 skb_frag_t frags[MAX_SKB_FRAGS]; 202 skb_frag_t frags[MAX_SKB_FRAGS];
154#ifdef CONFIG_HAS_DMA 203#ifdef CONFIG_HAS_DMA
155 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; 204 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1];
@@ -188,6 +237,8 @@ enum {
188 SKB_GSO_TCP_ECN = 1 << 3, 237 SKB_GSO_TCP_ECN = 1 << 3,
189 238
190 SKB_GSO_TCPV6 = 1 << 4, 239 SKB_GSO_TCPV6 = 1 << 4,
240
241 SKB_GSO_FCOE = 1 << 5,
191}; 242};
192 243
193#if BITS_PER_LONG > 32 244#if BITS_PER_LONG > 32
@@ -373,6 +424,7 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
373#endif 424#endif
374 425
375extern void kfree_skb(struct sk_buff *skb); 426extern void kfree_skb(struct sk_buff *skb);
427extern void consume_skb(struct sk_buff *skb);
376extern void __kfree_skb(struct sk_buff *skb); 428extern void __kfree_skb(struct sk_buff *skb);
377extern struct sk_buff *__alloc_skb(unsigned int size, 429extern struct sk_buff *__alloc_skb(unsigned int size,
378 gfp_t priority, int fclone, int node); 430 gfp_t priority, int fclone, int node);
@@ -411,7 +463,8 @@ extern int skb_to_sgvec(struct sk_buff *skb,
411extern int skb_cow_data(struct sk_buff *skb, int tailbits, 463extern int skb_cow_data(struct sk_buff *skb, int tailbits,
412 struct sk_buff **trailer); 464 struct sk_buff **trailer);
413extern int skb_pad(struct sk_buff *skb, int pad); 465extern int skb_pad(struct sk_buff *skb, int pad);
414#define dev_kfree_skb(a) kfree_skb(a) 466#define dev_kfree_skb(a) consume_skb(a)
467#define dev_consume_skb(a) kfree_skb_clean(a)
415extern void skb_over_panic(struct sk_buff *skb, int len, 468extern void skb_over_panic(struct sk_buff *skb, int len,
416 void *here); 469 void *here);
417extern void skb_under_panic(struct sk_buff *skb, int len, 470extern void skb_under_panic(struct sk_buff *skb, int len,
@@ -459,6 +512,16 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
459/* Internal */ 512/* Internal */
460#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB))) 513#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
461 514
515static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
516{
517 return &skb_shinfo(skb)->hwtstamps;
518}
519
520static inline union skb_shared_tx *skb_tx(struct sk_buff *skb)
521{
522 return &skb_shinfo(skb)->tx_flags;
523}
524
462/** 525/**
463 * skb_queue_empty - check if a queue is empty 526 * skb_queue_empty - check if a queue is empty
464 * @list: queue head 527 * @list: queue head
@@ -1278,7 +1341,7 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1278 * The networking layer reserves some headroom in skb data (via 1341 * The networking layer reserves some headroom in skb data (via
1279 * dev_alloc_skb). This is used to avoid having to reallocate skb data when 1342 * dev_alloc_skb). This is used to avoid having to reallocate skb data when
1280 * the header has to grow. In the default case, if the header has to grow 1343 * the header has to grow. In the default case, if the header has to grow
1281 * 16 bytes or less we avoid the reallocation. 1344 * 32 bytes or less we avoid the reallocation.
1282 * 1345 *
1283 * Unfortunately this headroom changes the DMA alignment of the resulting 1346 * Unfortunately this headroom changes the DMA alignment of the resulting
1284 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive 1347 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
@@ -1286,11 +1349,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1286 * perhaps setting it to a cacheline in size (since that will maintain 1349 * perhaps setting it to a cacheline in size (since that will maintain
1287 * cacheline alignment of the DMA). It must be a power of 2. 1350 * cacheline alignment of the DMA). It must be a power of 2.
1288 * 1351 *
1289 * Various parts of the networking layer expect at least 16 bytes of 1352 * Various parts of the networking layer expect at least 32 bytes of
1290 * headroom, you should not reduce this. 1353 * headroom, you should not reduce this.
1291 */ 1354 */
1292#ifndef NET_SKB_PAD 1355#ifndef NET_SKB_PAD
1293#define NET_SKB_PAD 16 1356#define NET_SKB_PAD 32
1294#endif 1357#endif
1295 1358
1296extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1359extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1678,8 +1741,6 @@ extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1678 int shiftlen); 1741 int shiftlen);
1679 1742
1680extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1743extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1681extern int skb_gro_receive(struct sk_buff **head,
1682 struct sk_buff *skb);
1683 1744
1684static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1745static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1685 int len, void *buffer) 1746 int len, void *buffer)
@@ -1726,6 +1787,11 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1726 1787
1727extern void skb_init(void); 1788extern void skb_init(void);
1728 1789
1790static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
1791{
1792 return skb->tstamp;
1793}
1794
1729/** 1795/**
1730 * skb_get_timestamp - get timestamp from a skb 1796 * skb_get_timestamp - get timestamp from a skb
1731 * @skb: skb to get stamp from 1797 * @skb: skb to get stamp from
@@ -1735,11 +1801,18 @@ extern void skb_init(void);
1735 * This function converts the offset back to a struct timeval and stores 1801 * This function converts the offset back to a struct timeval and stores
1736 * it in stamp. 1802 * it in stamp.
1737 */ 1803 */
1738static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1804static inline void skb_get_timestamp(const struct sk_buff *skb,
1805 struct timeval *stamp)
1739{ 1806{
1740 *stamp = ktime_to_timeval(skb->tstamp); 1807 *stamp = ktime_to_timeval(skb->tstamp);
1741} 1808}
1742 1809
1810static inline void skb_get_timestampns(const struct sk_buff *skb,
1811 struct timespec *stamp)
1812{
1813 *stamp = ktime_to_timespec(skb->tstamp);
1814}
1815
1743static inline void __net_timestamp(struct sk_buff *skb) 1816static inline void __net_timestamp(struct sk_buff *skb)
1744{ 1817{
1745 skb->tstamp = ktime_get_real(); 1818 skb->tstamp = ktime_get_real();
@@ -1755,6 +1828,20 @@ static inline ktime_t net_invalid_timestamp(void)
1755 return ktime_set(0, 0); 1828 return ktime_set(0, 0);
1756} 1829}
1757 1830
1831/**
1832 * skb_tstamp_tx - queue clone of skb with send time stamps
1833 * @orig_skb: the original outgoing packet
1834 * @hwtstamps: hardware time stamps, may be NULL if not available
1835 *
1836 * If the skb has a socket associated, then this function clones the
1837 * skb (thus sharing the actual data and optional structures), stores
1838 * the optional hardware time stamping information (if non NULL) or
1839 * generates a software time stamp (otherwise), then queues the clone
1840 * to the error queue of the socket. Errors are silently ignored.
1841 */
1842extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1843 struct skb_shared_hwtstamps *hwtstamps);
1844
1758extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 1845extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1759extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1846extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1760 1847
@@ -1885,7 +1972,7 @@ static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
1885 skb->queue_mapping = queue_mapping; 1972 skb->queue_mapping = queue_mapping;
1886} 1973}
1887 1974
1888static inline u16 skb_get_queue_mapping(struct sk_buff *skb) 1975static inline u16 skb_get_queue_mapping(const struct sk_buff *skb)
1889{ 1976{
1890 return skb->queue_mapping; 1977 return skb->queue_mapping;
1891} 1978}
@@ -1895,6 +1982,24 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1895 to->queue_mapping = from->queue_mapping; 1982 to->queue_mapping = from->queue_mapping;
1896} 1983}
1897 1984
1985static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue)
1986{
1987 skb->queue_mapping = rx_queue + 1;
1988}
1989
1990static inline u16 skb_get_rx_queue(const struct sk_buff *skb)
1991{
1992 return skb->queue_mapping - 1;
1993}
1994
1995static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
1996{
1997 return (skb->queue_mapping != 0);
1998}
1999
2000extern u16 skb_tx_hash(const struct net_device *dev,
2001 const struct sk_buff *skb);
2002
1898#ifdef CONFIG_XFRM 2003#ifdef CONFIG_XFRM
1899static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2004static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1900{ 2005{
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index f4523651fa42..5ac9b0bcaf9a 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -73,8 +73,8 @@ found:
73 73
74 ret = kmem_cache_alloc_notrace(cachep, flags); 74 ret = kmem_cache_alloc_notrace(cachep, flags);
75 75
76 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, 76 trace_kmalloc(_THIS_IP_, ret,
77 size, slab_buffer_size(cachep), flags); 77 size, slab_buffer_size(cachep), flags);
78 78
79 return ret; 79 return ret;
80 } 80 }
@@ -128,9 +128,9 @@ found:
128 128
129 ret = kmem_cache_alloc_node_notrace(cachep, flags, node); 129 ret = kmem_cache_alloc_node_notrace(cachep, flags, node);
130 130
131 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, 131 trace_kmalloc_node(_THIS_IP_, ret,
132 ret, size, slab_buffer_size(cachep), 132 size, slab_buffer_size(cachep),
133 flags, node); 133 flags, node);
134 134
135 return ret; 135 return ret;
136 } 136 }
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
new file mode 100644
index 000000000000..85958277f83d
--- /dev/null
+++ b/include/linux/slow-work.h
@@ -0,0 +1,95 @@
1/* Worker thread pool for slow items, such as filesystem lookups or mkdirs
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 * See Documentation/slow-work.txt
12 */
13
14#ifndef _LINUX_SLOW_WORK_H
15#define _LINUX_SLOW_WORK_H
16
17#ifdef CONFIG_SLOW_WORK
18
19#include <linux/sysctl.h>
20
21struct slow_work;
22
23/*
24 * The operations used to support slow work items
25 */
26struct slow_work_ops {
27 /* get a ref on a work item
28 * - return 0 if successful, -ve if not
29 */
30 int (*get_ref)(struct slow_work *work);
31
32 /* discard a ref to a work item */
33 void (*put_ref)(struct slow_work *work);
34
35 /* execute a work item */
36 void (*execute)(struct slow_work *work);
37};
38
39/*
40 * A slow work item
41 * - A reference is held on the parent object by the thread pool when it is
42 * queued
43 */
44struct slow_work {
45 unsigned long flags;
46#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
47#define SLOW_WORK_EXECUTING 1 /* item currently executing */
48#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
49#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
50 const struct slow_work_ops *ops; /* operations table for this item */
51 struct list_head link; /* link in queue */
52};
53
54/**
55 * slow_work_init - Initialise a slow work item
56 * @work: The work item to initialise
57 * @ops: The operations to use to handle the slow work item
58 *
59 * Initialise a slow work item.
60 */
61static inline void slow_work_init(struct slow_work *work,
62 const struct slow_work_ops *ops)
63{
64 work->flags = 0;
65 work->ops = ops;
66 INIT_LIST_HEAD(&work->link);
67}
68
69/**
70 * slow_work_init - Initialise a very slow work item
71 * @work: The work item to initialise
72 * @ops: The operations to use to handle the slow work item
73 *
74 * Initialise a very slow work item. This item will be restricted such that
75 * only a certain number of the pool threads will be able to execute items of
76 * this type.
77 */
78static inline void vslow_work_init(struct slow_work *work,
79 const struct slow_work_ops *ops)
80{
81 work->flags = 1 << SLOW_WORK_VERY_SLOW;
82 work->ops = ops;
83 INIT_LIST_HEAD(&work->link);
84}
85
86extern int slow_work_enqueue(struct slow_work *work);
87extern int slow_work_register_user(void);
88extern void slow_work_unregister_user(void);
89
90#ifdef CONFIG_SYSCTL
91extern ctl_table slow_work_sysctls[];
92#endif
93
94#endif /* CONFIG_SLOW_WORK */
95#endif /* _LINUX_SLOW_WORK_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 9e3a575b2c30..5046f90c1171 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -47,7 +47,6 @@ struct kmem_cache_cpu {
47struct kmem_cache_node { 47struct kmem_cache_node {
48 spinlock_t list_lock; /* Protect partial list and nr_partial */ 48 spinlock_t list_lock; /* Protect partial list and nr_partial */
49 unsigned long nr_partial; 49 unsigned long nr_partial;
50 unsigned long min_partial;
51 struct list_head partial; 50 struct list_head partial;
52#ifdef CONFIG_SLUB_DEBUG 51#ifdef CONFIG_SLUB_DEBUG
53 atomic_long_t nr_slabs; 52 atomic_long_t nr_slabs;
@@ -90,6 +89,7 @@ struct kmem_cache {
90 void (*ctor)(void *); 89 void (*ctor)(void *);
91 int inuse; /* Offset to metadata */ 90 int inuse; /* Offset to metadata */
92 int align; /* Alignment */ 91 int align; /* Alignment */
92 unsigned long min_partial;
93 const char *name; /* Name (only for display!) */ 93 const char *name; /* Name (only for display!) */
94 struct list_head list; /* List of slab caches */ 94 struct list_head list; /* List of slab caches */
95#ifdef CONFIG_SLUB_DEBUG 95#ifdef CONFIG_SLUB_DEBUG
@@ -130,9 +130,9 @@ struct kmem_cache {
130 * This should be dropped to PAGE_SIZE / 2 once the page allocator 130 * This should be dropped to PAGE_SIZE / 2 once the page allocator
131 * "fastpath" becomes competitive with the slab allocator fastpaths. 131 * "fastpath" becomes competitive with the slab allocator fastpaths.
132 */ 132 */
133#define SLUB_MAX_SIZE (PAGE_SIZE) 133#define SLUB_MAX_SIZE (2 * PAGE_SIZE)
134 134
135#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 1) 135#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
136 136
137/* 137/*
138 * We keep the general caches in an array of slab caches that are used for 138 * We keep the general caches in an array of slab caches that are used for
@@ -233,8 +233,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
233 unsigned int order = get_order(size); 233 unsigned int order = get_order(size);
234 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); 234 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);
235 235
236 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, _THIS_IP_, ret, 236 trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags);
237 size, PAGE_SIZE << order, flags);
238 237
239 return ret; 238 return ret;
240} 239}
@@ -255,9 +254,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
255 254
256 ret = kmem_cache_alloc_notrace(s, flags); 255 ret = kmem_cache_alloc_notrace(s, flags);
257 256
258 kmemtrace_mark_alloc(KMEMTRACE_TYPE_KMALLOC, 257 trace_kmalloc(_THIS_IP_, ret, size, s->size, flags);
259 _THIS_IP_, ret,
260 size, s->size, flags);
261 258
262 return ret; 259 return ret;
263 } 260 }
@@ -296,9 +293,8 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
296 293
297 ret = kmem_cache_alloc_node_notrace(s, flags, node); 294 ret = kmem_cache_alloc_node_notrace(s, flags, node);
298 295
299 kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC, 296 trace_kmalloc_node(_THIS_IP_, ret,
300 _THIS_IP_, ret, 297 size, s->size, flags, node);
301 size, s->size, flags, node);
302 298
303 return ret; 299 return ret;
304 } 300 }
diff --git a/include/linux/smp.h b/include/linux/smp.h
index bbacb7baa446..a69db820eed6 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -38,7 +38,7 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
38/* 38/*
39 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. 39 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
40 * (defined in asm header): 40 * (defined in asm header):
41 */ 41 */
42 42
43/* 43/*
44 * stops all CPUs but the current one: 44 * stops all CPUs but the current one:
@@ -82,7 +82,8 @@ smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
82 return 0; 82 return 0;
83} 83}
84 84
85void __smp_call_function_single(int cpuid, struct call_single_data *data); 85void __smp_call_function_single(int cpuid, struct call_single_data *data,
86 int wait);
86 87
87/* 88/*
88 * Generic and arch helpers 89 * Generic and arch helpers
@@ -121,6 +122,8 @@ extern unsigned int setup_max_cpus;
121 122
122#else /* !SMP */ 123#else /* !SMP */
123 124
125static inline void smp_send_stop(void) { }
126
124/* 127/*
125 * These macros fold the SMP functionality into a single CPU system 128 * These macros fold the SMP functionality into a single CPU system
126 */ 129 */
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 1cbf0313adde..b32725075d71 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -43,5 +43,8 @@ struct smsc911x_platform_config {
43/* Constants for flags */ 43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0)) 44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1)) 45#define SMSC911X_USE_32BIT (BIT(1))
46#define SMSC911X_FORCE_INTERNAL_PHY (BIT(2))
47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3))
48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4))
46 49
47#endif /* __LINUX_SMSC911X_H__ */ 50#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index afc01909a428..421afb4d29b0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -181,6 +181,7 @@ struct ucred {
181#define AF_ASH 18 /* Ash */ 181#define AF_ASH 18 /* Ash */
182#define AF_ECONET 19 /* Acorn Econet */ 182#define AF_ECONET 19 /* Acorn Econet */
183#define AF_ATMSVC 20 /* ATM SVCs */ 183#define AF_ATMSVC 20 /* ATM SVCs */
184#define AF_RDS 21 /* RDS sockets */
184#define AF_SNA 22 /* Linux SNA Project (nutters!) */ 185#define AF_SNA 22 /* Linux SNA Project (nutters!) */
185#define AF_IRDA 23 /* IRDA sockets */ 186#define AF_IRDA 23 /* IRDA sockets */
186#define AF_PPPOX 24 /* PPPoX sockets */ 187#define AF_PPPOX 24 /* PPPoX sockets */
@@ -219,6 +220,7 @@ struct ucred {
219#define PF_ASH AF_ASH 220#define PF_ASH AF_ASH
220#define PF_ECONET AF_ECONET 221#define PF_ECONET AF_ECONET
221#define PF_ATMSVC AF_ATMSVC 222#define PF_ATMSVC AF_ATMSVC
223#define PF_RDS AF_RDS
222#define PF_SNA AF_SNA 224#define PF_SNA AF_SNA
223#define PF_IRDA AF_IRDA 225#define PF_IRDA AF_IRDA
224#define PF_PPPOX AF_PPPOX 226#define PF_PPPOX AF_PPPOX
@@ -300,6 +302,7 @@ struct ucred {
300#define SOL_PPPOL2TP 273 302#define SOL_PPPOL2TP 273
301#define SOL_BLUETOOTH 274 303#define SOL_BLUETOOTH 274
302#define SOL_PNPIPE 275 304#define SOL_PNPIPE 275
305#define SOL_RDS 276
303 306
304/* IPX options */ 307/* IPX options */
305#define IPX_TYPE 1 308#define IPX_TYPE 1
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index abef7596655a..241f179347d9 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -122,6 +122,9 @@
122#define SIOCBRADDIF 0x89a2 /* add interface to bridge */ 122#define SIOCBRADDIF 0x89a2 /* add interface to bridge */
123#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ 123#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */
124 124
125/* hardware time stamping: parameters in linux/net_tstamp.h */
126#define SIOCSHWTSTAMP 0x89b0
127
125/* Device private ioctl calls */ 128/* Device private ioctl calls */
126 129
127/* 130/*
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index f41ffd7c2dd9..34c4475ac4a2 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -103,6 +103,14 @@
103#define SONYPI_EVENT_WIRELESS_OFF 61 103#define SONYPI_EVENT_WIRELESS_OFF 61
104#define SONYPI_EVENT_ZOOM_IN_PRESSED 62 104#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
105#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 105#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
106#define SONYPI_EVENT_CD_EJECT_PRESSED 64
107#define SONYPI_EVENT_MODEKEY_PRESSED 65
108#define SONYPI_EVENT_PKEY_P4 66
109#define SONYPI_EVENT_PKEY_P5 67
110#define SONYPI_EVENT_SETTINGKEY_PRESSED 68
111#define SONYPI_EVENT_VOLUME_INC_PRESSED 69
112#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
113#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
106 114
107/* get/set brightness */ 115/* get/set brightness */
108#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 116#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 1085212c446e..306e7b1c69ed 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_SPI_EEPROM_H 1#ifndef __LINUX_SPI_EEPROM_H
2#define __LINUX_SPI_EEPROM_H 2#define __LINUX_SPI_EEPROM_H
3 3
4#include <linux/memory.h>
5
4/* 6/*
5 * Put one of these structures in platform_data for SPI EEPROMS handled 7 * Put one of these structures in platform_data for SPI EEPROMS handled
6 * by the "at25" driver. On SPI, most EEPROMS understand the same core 8 * by the "at25" driver. On SPI, most EEPROMS understand the same core
@@ -17,6 +19,10 @@ struct spi_eeprom {
17#define EE_ADDR2 0x0002 /* 16 bit addrs */ 19#define EE_ADDR2 0x0002 /* 16 bit addrs */
18#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
19#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22
23 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context;
20}; 26};
21 27
22#endif /* __LINUX_SPI_EEPROM_H */ 28#endif /* __LINUX_SPI_EEPROM_H */
diff --git a/include/linux/spi/libertas_spi.h b/include/linux/spi/libertas_spi.h
new file mode 100644
index 000000000000..79506f5f9e67
--- /dev/null
+++ b/include/linux/spi/libertas_spi.h
@@ -0,0 +1,32 @@
1/*
2 * board-specific data for the libertas_spi driver.
3 *
4 * Copyright 2008 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11#ifndef _LIBERTAS_SPI_H_
12#define _LIBERTAS_SPI_H_
13
14struct spi_device;
15
16struct libertas_spi_platform_data {
17 /* There are two ways to read data from the WLAN module's SPI
18 * interface. Setting 0 or 1 here controls which one is used.
19 *
20 * Usually you want to set use_dummy_writes = 1.
21 * However, if that doesn't work or if you are using a slow SPI clock
22 * speed, you may want to use 0 here. */
23 u16 use_dummy_writes;
24
25 /* GPIO number to use as chip select */
26 u16 gpio_cs;
27
28 /* Board specific setup/teardown */
29 int (*setup)(struct spi_device *spi);
30 int (*teardown)(struct spi_device *spi);
31};
32#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 68bb1c501d0d..2cc43fa380cb 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -204,6 +204,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
204 * SPI slaves, and are numbered from zero to num_chipselects. 204 * SPI slaves, and are numbered from zero to num_chipselects.
205 * each slave has a chipselect signal, but it's common that not 205 * each slave has a chipselect signal, but it's common that not
206 * every chipselect is connected to a slave. 206 * every chipselect is connected to a slave.
207 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
207 * @setup: updates the device mode and clocking records used by a 208 * @setup: updates the device mode and clocking records used by a
208 * device's SPI controller; protocol code may call this. This 209 * device's SPI controller; protocol code may call this. This
209 * must fail if an unrecognized or unsupported mode is requested. 210 * must fail if an unrecognized or unsupported mode is requested.
@@ -239,6 +240,11 @@ struct spi_master {
239 */ 240 */
240 u16 num_chipselect; 241 u16 num_chipselect;
241 242
243 /* some SPI controllers pose alignment requirements on DMAable
244 * buffers; let protocol drivers know about these requirements.
245 */
246 u16 dma_alignment;
247
242 /* setup mode and clock, etc (spi driver may call many times) */ 248 /* setup mode and clock, etc (spi driver may call many times) */
243 int (*setup)(struct spi_device *spi); 249 int (*setup)(struct spi_device *spi);
244 250
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
index 0f01a0f1f40c..ca6782ee4b9f 100644
--- a/include/linux/spi/spi_gpio.h
+++ b/include/linux/spi/spi_gpio.h
@@ -25,10 +25,16 @@
25 * ... 25 * ...
26 * }; 26 * };
27 * 27 *
28 * If chipselect is not used (there's only one device on the bus), assign
29 * SPI_GPIO_NO_CHIPSELECT to the controller_data:
30 * .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT;
31 *
28 * If the bitbanged bus is later switched to a "native" controller, 32 * If the bitbanged bus is later switched to a "native" controller,
29 * that platform_device and controller_data should be removed. 33 * that platform_device and controller_data should be removed.
30 */ 34 */
31 35
36#define SPI_GPIO_NO_CHIPSELECT ((unsigned long)-1l)
37
32/** 38/**
33 * struct spi_gpio_platform_data - parameter for bitbanged SPI master 39 * struct spi_gpio_platform_data - parameter for bitbanged SPI master
34 * @sck: number of the GPIO used for clock output 40 * @sck: number of the GPIO used for clock output
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index a0c66a2e00ad..252b245cfcf4 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -153,9 +153,11 @@ do { \
153 extern int _raw_spin_trylock(spinlock_t *lock); 153 extern int _raw_spin_trylock(spinlock_t *lock);
154 extern void _raw_spin_unlock(spinlock_t *lock); 154 extern void _raw_spin_unlock(spinlock_t *lock);
155 extern void _raw_read_lock(rwlock_t *lock); 155 extern void _raw_read_lock(rwlock_t *lock);
156#define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock)
156 extern int _raw_read_trylock(rwlock_t *lock); 157 extern int _raw_read_trylock(rwlock_t *lock);
157 extern void _raw_read_unlock(rwlock_t *lock); 158 extern void _raw_read_unlock(rwlock_t *lock);
158 extern void _raw_write_lock(rwlock_t *lock); 159 extern void _raw_write_lock(rwlock_t *lock);
160#define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock)
159 extern int _raw_write_trylock(rwlock_t *lock); 161 extern int _raw_write_trylock(rwlock_t *lock);
160 extern void _raw_write_unlock(rwlock_t *lock); 162 extern void _raw_write_unlock(rwlock_t *lock);
161#else 163#else
@@ -165,9 +167,13 @@ do { \
165# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) 167# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
166# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) 168# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
167# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 169# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
170# define _raw_read_lock_flags(lock, flags) \
171 __raw_read_lock_flags(&(lock)->raw_lock, *(flags))
168# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 172# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
169# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) 173# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
170# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) 174# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
175# define _raw_write_lock_flags(lock, flags) \
176 __raw_write_lock_flags(&(lock)->raw_lock, *(flags))
171# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 177# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
172# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) 178# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
173#endif 179#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 17d9b58f6379..5ae8fa22d331 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -339,6 +339,10 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
339 339
340extern void ssb_bus_unregister(struct ssb_bus *bus); 340extern void ssb_bus_unregister(struct ssb_bus *bus);
341 341
342/* Set a fallback SPROM.
343 * See kdoc at the function definition for complete documentation. */
344extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
345
342/* Suspend a SSB bus. 346/* Suspend a SSB bus.
343 * Call this from the parent bus suspend routine. */ 347 * Call this from the parent bus suspend routine. */
344extern int ssb_bus_suspend(struct ssb_bus *bus); 348extern int ssb_bus_suspend(struct ssb_bus *bus);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 7d7e03dcf77c..d3b1d18922f2 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -181,6 +181,16 @@
181#define SSB_CHIPCO_PROG_WAITCNT 0x0124 181#define SSB_CHIPCO_PROG_WAITCNT 0x0124
182#define SSB_CHIPCO_FLASH_CFG 0x0128 182#define SSB_CHIPCO_FLASH_CFG 0x0128
183#define SSB_CHIPCO_FLASH_WAITCNT 0x012C 183#define SSB_CHIPCO_FLASH_WAITCNT 0x012C
184#define SSB_CHIPCO_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */
185#define SSB_CHIPCO_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
186#define SSB_CHIPCO_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
187#define SSB_CHIPCO_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
188#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
189#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
190#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
191#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */
192#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */
193#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
184#define SSB_CHIPCO_UART0_DATA 0x0300 194#define SSB_CHIPCO_UART0_DATA 0x0300
185#define SSB_CHIPCO_UART0_IMR 0x0304 195#define SSB_CHIPCO_UART0_IMR 0x0304
186#define SSB_CHIPCO_UART0_FCR 0x0308 196#define SSB_CHIPCO_UART0_FCR 0x0308
@@ -197,6 +207,196 @@
197#define SSB_CHIPCO_UART1_LSR 0x0414 207#define SSB_CHIPCO_UART1_LSR 0x0414
198#define SSB_CHIPCO_UART1_MSR 0x0418 208#define SSB_CHIPCO_UART1_MSR 0x0418
199#define SSB_CHIPCO_UART1_SCRATCH 0x041C 209#define SSB_CHIPCO_UART1_SCRATCH 0x041C
210/* PMU registers (rev >= 20) */
211#define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */
212#define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
213#define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16
214#define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
215#define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
216#define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
217#define SSB_CHIPCO_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */
218#define SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT 2
219#define SSB_CHIPCO_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */
220#define SSB_CHIPCO_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */
221#define SSB_CHIPCO_PMU_CAP 0x0604 /* PMU capabilities */
222#define SSB_CHIPCO_PMU_CAP_REVISION 0x000000FF /* Revision mask */
223#define SSB_CHIPCO_PMU_STAT 0x0608 /* PMU status */
224#define SSB_CHIPCO_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
225#define SSB_CHIPCO_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
226#define SSB_CHIPCO_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
227#define SSB_CHIPCO_PMU_STAT_HAVEHT 0x00000004 /* HT available */
228#define SSB_CHIPCO_PMU_STAT_RESINIT 0x00000003 /* Res init */
229#define SSB_CHIPCO_PMU_RES_STAT 0x060C /* PMU res status */
230#define SSB_CHIPCO_PMU_RES_PEND 0x0610 /* PMU res pending */
231#define SSB_CHIPCO_PMU_TIMER 0x0614 /* PMU timer */
232#define SSB_CHIPCO_PMU_MINRES_MSK 0x0618 /* PMU min res mask */
233#define SSB_CHIPCO_PMU_MAXRES_MSK 0x061C /* PMU max res mask */
234#define SSB_CHIPCO_PMU_RES_TABSEL 0x0620 /* PMU res table sel */
235#define SSB_CHIPCO_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */
236#define SSB_CHIPCO_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */
237#define SSB_CHIPCO_PMU_RES_TIMER 0x062C /* PMU res timer */
238#define SSB_CHIPCO_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */
239#define SSB_CHIPCO_PMU_WATCHDOG 0x0634 /* PMU watchdog */
240#define SSB_CHIPCO_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
241#define SSB_CHIPCO_PMU_RES_REQT 0x0644 /* PMU res req timer */
242#define SSB_CHIPCO_PMU_RES_REQM 0x0648 /* PMU res req mask */
243#define SSB_CHIPCO_CHIPCTL_ADDR 0x0650
244#define SSB_CHIPCO_CHIPCTL_DATA 0x0654
245#define SSB_CHIPCO_REGCTL_ADDR 0x0658
246#define SSB_CHIPCO_REGCTL_DATA 0x065C
247#define SSB_CHIPCO_PLLCTL_ADDR 0x0660
248#define SSB_CHIPCO_PLLCTL_DATA 0x0664
249
250
251
252/** PMU PLL registers */
253
254/* PMU rev 0 PLL registers */
255#define SSB_PMU0_PLLCTL0 0
256#define SSB_PMU0_PLLCTL0_PDIV_MSK 0x00000001
257#define SSB_PMU0_PLLCTL0_PDIV_FREQ 25000 /* kHz */
258#define SSB_PMU0_PLLCTL1 1
259#define SSB_PMU0_PLLCTL1_WILD_IMSK 0xF0000000 /* Wild int mask (low nibble) */
260#define SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT 28
261#define SSB_PMU0_PLLCTL1_WILD_FMSK 0x0FFFFF00 /* Wild frac mask */
262#define SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT 8
263#define SSB_PMU0_PLLCTL1_STOPMOD 0x00000040 /* Stop mod */
264#define SSB_PMU0_PLLCTL2 2
265#define SSB_PMU0_PLLCTL2_WILD_IMSKHI 0x0000000F /* Wild int mask (high nibble) */
266#define SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT 0
267
268/* PMU rev 1 PLL registers */
269#define SSB_PMU1_PLLCTL0 0
270#define SSB_PMU1_PLLCTL0_P1DIV 0x00F00000 /* P1 div */
271#define SSB_PMU1_PLLCTL0_P1DIV_SHIFT 20
272#define SSB_PMU1_PLLCTL0_P2DIV 0x0F000000 /* P2 div */
273#define SSB_PMU1_PLLCTL0_P2DIV_SHIFT 24
274#define SSB_PMU1_PLLCTL1 1
275#define SSB_PMU1_PLLCTL1_M1DIV 0x000000FF /* M1 div */
276#define SSB_PMU1_PLLCTL1_M1DIV_SHIFT 0
277#define SSB_PMU1_PLLCTL1_M2DIV 0x0000FF00 /* M2 div */
278#define SSB_PMU1_PLLCTL1_M2DIV_SHIFT 8
279#define SSB_PMU1_PLLCTL1_M3DIV 0x00FF0000 /* M3 div */
280#define SSB_PMU1_PLLCTL1_M3DIV_SHIFT 16
281#define SSB_PMU1_PLLCTL1_M4DIV 0xFF000000 /* M4 div */
282#define SSB_PMU1_PLLCTL1_M4DIV_SHIFT 24
283#define SSB_PMU1_PLLCTL2 2
284#define SSB_PMU1_PLLCTL2_M5DIV 0x000000FF /* M5 div */
285#define SSB_PMU1_PLLCTL2_M5DIV_SHIFT 0
286#define SSB_PMU1_PLLCTL2_M6DIV 0x0000FF00 /* M6 div */
287#define SSB_PMU1_PLLCTL2_M6DIV_SHIFT 8
288#define SSB_PMU1_PLLCTL2_NDIVMODE 0x000E0000 /* NDIV mode */
289#define SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT 17
290#define SSB_PMU1_PLLCTL2_NDIVINT 0x1FF00000 /* NDIV int */
291#define SSB_PMU1_PLLCTL2_NDIVINT_SHIFT 20
292#define SSB_PMU1_PLLCTL3 3
293#define SSB_PMU1_PLLCTL3_NDIVFRAC 0x00FFFFFF /* NDIV frac */
294#define SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT 0
295#define SSB_PMU1_PLLCTL4 4
296#define SSB_PMU1_PLLCTL5 5
297#define SSB_PMU1_PLLCTL5_CLKDRV 0xFFFFFF00 /* clk drv */
298#define SSB_PMU1_PLLCTL5_CLKDRV_SHIFT 8
299
300/* BCM4312 PLL resource numbers. */
301#define SSB_PMURES_4312_SWITCHER_BURST 0
302#define SSB_PMURES_4312_SWITCHER_PWM 1
303#define SSB_PMURES_4312_PA_REF_LDO 2
304#define SSB_PMURES_4312_CORE_LDO_BURST 3
305#define SSB_PMURES_4312_CORE_LDO_PWM 4
306#define SSB_PMURES_4312_RADIO_LDO 5
307#define SSB_PMURES_4312_ILP_REQUEST 6
308#define SSB_PMURES_4312_BG_FILTBYP 7
309#define SSB_PMURES_4312_TX_FILTBYP 8
310#define SSB_PMURES_4312_RX_FILTBYP 9
311#define SSB_PMURES_4312_XTAL_PU 10
312#define SSB_PMURES_4312_ALP_AVAIL 11
313#define SSB_PMURES_4312_BB_PLL_FILTBYP 12
314#define SSB_PMURES_4312_RF_PLL_FILTBYP 13
315#define SSB_PMURES_4312_HT_AVAIL 14
316
317/* BCM4325 PLL resource numbers. */
318#define SSB_PMURES_4325_BUCK_BOOST_BURST 0
319#define SSB_PMURES_4325_CBUCK_BURST 1
320#define SSB_PMURES_4325_CBUCK_PWM 2
321#define SSB_PMURES_4325_CLDO_CBUCK_BURST 3
322#define SSB_PMURES_4325_CLDO_CBUCK_PWM 4
323#define SSB_PMURES_4325_BUCK_BOOST_PWM 5
324#define SSB_PMURES_4325_ILP_REQUEST 6
325#define SSB_PMURES_4325_ABUCK_BURST 7
326#define SSB_PMURES_4325_ABUCK_PWM 8
327#define SSB_PMURES_4325_LNLDO1_PU 9
328#define SSB_PMURES_4325_LNLDO2_PU 10
329#define SSB_PMURES_4325_LNLDO3_PU 11
330#define SSB_PMURES_4325_LNLDO4_PU 12
331#define SSB_PMURES_4325_XTAL_PU 13
332#define SSB_PMURES_4325_ALP_AVAIL 14
333#define SSB_PMURES_4325_RX_PWRSW_PU 15
334#define SSB_PMURES_4325_TX_PWRSW_PU 16
335#define SSB_PMURES_4325_RFPLL_PWRSW_PU 17
336#define SSB_PMURES_4325_LOGEN_PWRSW_PU 18
337#define SSB_PMURES_4325_AFE_PWRSW_PU 19
338#define SSB_PMURES_4325_BBPLL_PWRSW_PU 20
339#define SSB_PMURES_4325_HT_AVAIL 21
340
341/* BCM4328 PLL resource numbers. */
342#define SSB_PMURES_4328_EXT_SWITCHER_PWM 0
343#define SSB_PMURES_4328_BB_SWITCHER_PWM 1
344#define SSB_PMURES_4328_BB_SWITCHER_BURST 2
345#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST 3
346#define SSB_PMURES_4328_ILP_REQUEST 4
347#define SSB_PMURES_4328_RADIO_SWITCHER_PWM 5
348#define SSB_PMURES_4328_RADIO_SWITCHER_BURST 6
349#define SSB_PMURES_4328_ROM_SWITCH 7
350#define SSB_PMURES_4328_PA_REF_LDO 8
351#define SSB_PMURES_4328_RADIO_LDO 9
352#define SSB_PMURES_4328_AFE_LDO 10
353#define SSB_PMURES_4328_PLL_LDO 11
354#define SSB_PMURES_4328_BG_FILTBYP 12
355#define SSB_PMURES_4328_TX_FILTBYP 13
356#define SSB_PMURES_4328_RX_FILTBYP 14
357#define SSB_PMURES_4328_XTAL_PU 15
358#define SSB_PMURES_4328_XTAL_EN 16
359#define SSB_PMURES_4328_BB_PLL_FILTBYP 17
360#define SSB_PMURES_4328_RF_PLL_FILTBYP 18
361#define SSB_PMURES_4328_BB_PLL_PU 19
362
363/* BCM5354 PLL resource numbers. */
364#define SSB_PMURES_5354_EXT_SWITCHER_PWM 0
365#define SSB_PMURES_5354_BB_SWITCHER_PWM 1
366#define SSB_PMURES_5354_BB_SWITCHER_BURST 2
367#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST 3
368#define SSB_PMURES_5354_ILP_REQUEST 4
369#define SSB_PMURES_5354_RADIO_SWITCHER_PWM 5
370#define SSB_PMURES_5354_RADIO_SWITCHER_BURST 6
371#define SSB_PMURES_5354_ROM_SWITCH 7
372#define SSB_PMURES_5354_PA_REF_LDO 8
373#define SSB_PMURES_5354_RADIO_LDO 9
374#define SSB_PMURES_5354_AFE_LDO 10
375#define SSB_PMURES_5354_PLL_LDO 11
376#define SSB_PMURES_5354_BG_FILTBYP 12
377#define SSB_PMURES_5354_TX_FILTBYP 13
378#define SSB_PMURES_5354_RX_FILTBYP 14
379#define SSB_PMURES_5354_XTAL_PU 15
380#define SSB_PMURES_5354_XTAL_EN 16
381#define SSB_PMURES_5354_BB_PLL_FILTBYP 17
382#define SSB_PMURES_5354_RF_PLL_FILTBYP 18
383#define SSB_PMURES_5354_BB_PLL_PU 19
384
385
386
387/** Chip specific Chip-Status register contents. */
388#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 */
390#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
391#define SSB_CHIPCO_CHST_4325_OTP_SEL 2 /* OTP is powered up, no SPROM */
392#define SSB_CHIPCO_CHST_4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */
393#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE 0x00000004
394#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT 2
395#define SSB_CHIPCO_CHST_4325_RCAL_VALID 0x00000008
396#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT 3
397#define SSB_CHIPCO_CHST_4325_RCAL_VALUE 0x000001F0
398#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 */
200 400
201 401
202 402
@@ -353,11 +553,20 @@
353struct ssb_device; 553struct ssb_device;
354struct ssb_serial_port; 554struct ssb_serial_port;
355 555
556/* Data for the PMU, if available.
557 * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU)
558 */
559struct ssb_chipcommon_pmu {
560 u8 rev; /* PMU revision */
561 u32 crystalfreq; /* The active crystal frequency (in kHz) */
562};
563
356struct ssb_chipcommon { 564struct ssb_chipcommon {
357 struct ssb_device *dev; 565 struct ssb_device *dev;
358 u32 capabilities; 566 u32 capabilities;
359 /* Fast Powerup Delay constant */ 567 /* Fast Powerup Delay constant */
360 u16 fast_pwrup_delay; 568 u16 fast_pwrup_delay;
569 struct ssb_chipcommon_pmu pmu;
361}; 570};
362 571
363static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) 572static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
@@ -365,6 +574,17 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
365 return (cc->dev != NULL); 574 return (cc->dev != NULL);
366} 575}
367 576
577/* Register access */
578#define chipco_read32(cc, offset) ssb_read32((cc)->dev, offset)
579#define chipco_write32(cc, offset, val) ssb_write32((cc)->dev, offset, val)
580
581#define chipco_mask32(cc, offset, mask) \
582 chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask))
583#define chipco_set32(cc, offset, set) \
584 chipco_write32(cc, offset, chipco_read32(cc, offset) | (set))
585#define chipco_maskset32(cc, offset, mask, set) \
586 chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set))
587
368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); 588extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
369 589
370extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); 590extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
@@ -406,4 +626,8 @@ extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
406 struct ssb_serial_port *ports); 626 struct ssb_serial_port *ports);
407#endif /* CONFIG_SSB_SERIAL */ 627#endif /* CONFIG_SSB_SERIAL */
408 628
629/* PMU support */
630extern void ssb_pmu_init(struct ssb_chipcommon *cc);
631
632
409#endif /* LINUX_SSB_CHIPCO_H_ */ 633#endif /* LINUX_SSB_CHIPCO_H_ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 99a0f991e850..a01b982b5783 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -326,6 +326,42 @@
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ 326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 328
329/* SPROM Revision 8 */
330#define SSB_SPROM8_BFLLO 0x1084 /* Boardflags (low 16 bits) */
331#define SSB_SPROM8_BFLHI 0x1086 /* Boardflags Hi */
332#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */
333#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */
334#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/
335#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
336#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
337#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
338#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
339#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */
340#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
341#define SSB_SPROM8_AGAIN0_SHIFT 0
342#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
343#define SSB_SPROM8_AGAIN1_SHIFT 8
344#define SSB_SPROM8_AGAIN23 0x10A0
345#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
346#define SSB_SPROM8_AGAIN2_SHIFT 0
347#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
348#define SSB_SPROM8_AGAIN3_SHIFT 8
349#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */
350#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
351#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
352#define SSB_SPROM8_GPIOA_P1_SHIFT 8
353#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
354#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
355#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
356#define SSB_SPROM8_GPIOB_P3_SHIFT 8
357#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power BG in path 1 */
358#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
359#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
360#define SSB_SPROM8_ITSSI_BG_SHIFT 8
361#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power A in path 1 */
362#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
363#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
364#define SSB_SPROM8_ITSSI_A_SHIFT 8
329 365
330/* Values for SSB_SPROM1_BINF_CCODE */ 366/* Values for SSB_SPROM1_BINF_CCODE */
331enum { 367enum {
diff --git a/include/linux/string.h b/include/linux/string.h
index 27ac31784ad2..489019ef1694 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -13,6 +13,7 @@
13#include <stdarg.h> 13#include <stdarg.h>
14 14
15extern char *strndup_user(const char __user *, long); 15extern char *strndup_user(const char __user *, long);
16extern void *memdup_user(const void __user *, size_t);
16 17
17/* 18/*
18 * Include machine specific inline routines 19 * Include machine specific inline routines
@@ -121,5 +122,14 @@ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
121extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, 122extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
122 const void *from, size_t available); 123 const void *from, size_t available);
123 124
125/**
126 * strstarts - does @str start with @prefix?
127 * @str: string to examine
128 * @prefix: prefix to look for.
129 */
130static inline bool strstarts(const char *str, const char *prefix)
131{
132 return strncmp(str, prefix, strlen(prefix)) == 0;
133}
124#endif 134#endif
125#endif /* _LINUX_STRING_H_ */ 135#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 3435d24bfe55..2a30775959e9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -24,6 +24,15 @@
24 */ 24 */
25typedef int (*svc_thread_fn)(void *); 25typedef int (*svc_thread_fn)(void *);
26 26
27/* statistics for svc_pool structures */
28struct svc_pool_stats {
29 unsigned long packets;
30 unsigned long sockets_queued;
31 unsigned long threads_woken;
32 unsigned long overloads_avoided;
33 unsigned long threads_timedout;
34};
35
27/* 36/*
28 * 37 *
29 * RPC service thread pool. 38 * RPC service thread pool.
@@ -41,6 +50,8 @@ struct svc_pool {
41 struct list_head sp_sockets; /* pending sockets */ 50 struct list_head sp_sockets; /* pending sockets */
42 unsigned int sp_nrthreads; /* # of threads in pool */ 51 unsigned int sp_nrthreads; /* # of threads in pool */
43 struct list_head sp_all_threads; /* all server threads */ 52 struct list_head sp_all_threads; /* all server threads */
53 int sp_nwaking; /* number of threads woken but not yet active */
54 struct svc_pool_stats sp_stats; /* statistics on pool operation */
44} ____cacheline_aligned_in_smp; 55} ____cacheline_aligned_in_smp;
45 56
46/* 57/*
@@ -69,7 +80,6 @@ struct svc_serv {
69 struct list_head sv_tempsocks; /* all temporary sockets */ 80 struct list_head sv_tempsocks; /* all temporary sockets */
70 int sv_tmpcnt; /* count of temporary sockets */ 81 int sv_tmpcnt; /* count of temporary sockets */
71 struct timer_list sv_temptimer; /* timer for aging temporary sockets */ 82 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
72 sa_family_t sv_family; /* listener's address family */
73 83
74 char * sv_name; /* service name */ 84 char * sv_name; /* service name */
75 85
@@ -84,6 +94,8 @@ struct svc_serv {
84 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
85 * adding threads */ 95 * adding threads */
86 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
87}; 99};
88 100
89/* 101/*
@@ -219,6 +231,7 @@ struct svc_rqst {
219 struct svc_cred rq_cred; /* auth info */ 231 struct svc_cred rq_cred; /* auth info */
220 void * rq_xprt_ctxt; /* transport specific context ptr */ 232 void * rq_xprt_ctxt; /* transport specific context ptr */
221 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 233 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
234 int rq_usedeferral; /* use deferral */
222 235
223 size_t rq_xprt_hlen; /* xprt header len */ 236 size_t rq_xprt_hlen; /* xprt header len */
224 struct xdr_buf rq_arg; 237 struct xdr_buf rq_arg;
@@ -264,6 +277,7 @@ struct svc_rqst {
264 * cache pages */ 277 * cache pages */
265 wait_queue_head_t rq_wait; /* synchronization */ 278 wait_queue_head_t rq_wait; /* synchronization */
266 struct task_struct *rq_task; /* service thread */ 279 struct task_struct *rq_task; /* service thread */
280 int rq_waking; /* 1 if thread is being woken */
267}; 281};
268 282
269/* 283/*
@@ -385,19 +399,20 @@ struct svc_procedure {
385/* 399/*
386 * Function prototypes. 400 * Function prototypes.
387 */ 401 */
388struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t, 402struct svc_serv *svc_create(struct svc_program *, unsigned int,
389 void (*shutdown)(struct svc_serv *)); 403 void (*shutdown)(struct svc_serv *));
390struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 404struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
391 struct svc_pool *pool); 405 struct svc_pool *pool);
392void svc_exit_thread(struct svc_rqst *); 406void svc_exit_thread(struct svc_rqst *);
393struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 407struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
394 sa_family_t, void (*shutdown)(struct svc_serv *), 408 void (*shutdown)(struct svc_serv *),
395 svc_thread_fn, struct module *); 409 svc_thread_fn, struct module *);
396int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 410int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
411int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
397void svc_destroy(struct svc_serv *); 412void svc_destroy(struct svc_serv *);
398int svc_process(struct svc_rqst *); 413int svc_process(struct svc_rqst *);
399int svc_register(const struct svc_serv *, const unsigned short, 414int svc_register(const struct svc_serv *, const int,
400 const unsigned short); 415 const unsigned short, const unsigned short);
401 416
402void svc_wake_up(struct svc_serv *); 417void svc_wake_up(struct svc_serv *);
403void svc_reserve(struct svc_rqst *rqstp, int space); 418void svc_reserve(struct svc_rqst *rqstp, int space);
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 0127daca4354..0d9cb6ef28b0 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -71,7 +71,8 @@ int svc_reg_xprt_class(struct svc_xprt_class *);
71void svc_unreg_xprt_class(struct svc_xprt_class *); 71void svc_unreg_xprt_class(struct svc_xprt_class *);
72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
73 struct svc_serv *); 73 struct svc_serv *);
74int svc_create_xprt(struct svc_serv *, char *, unsigned short, int); 74int svc_create_xprt(struct svc_serv *, const char *, const int,
75 const unsigned short, int);
75void svc_xprt_enqueue(struct svc_xprt *xprt); 76void svc_xprt_enqueue(struct svc_xprt *xprt);
76void svc_xprt_received(struct svc_xprt *); 77void svc_xprt_received(struct svc_xprt *);
77void svc_xprt_put(struct svc_xprt *xprt); 78void svc_xprt_put(struct svc_xprt *xprt);
@@ -80,7 +81,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
80void svc_delete_xprt(struct svc_xprt *xprt); 81void svc_delete_xprt(struct svc_xprt *xprt);
81int svc_port_is_privileged(struct sockaddr *sin); 82int svc_port_is_privileged(struct sockaddr *sin);
82int svc_print_xprts(char *buf, int maxlen); 83int svc_print_xprts(char *buf, int maxlen);
83struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int); 84struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
85 const sa_family_t af, const unsigned short port);
84int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); 86int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
85 87
86static inline void svc_xprt_get(struct svc_xprt *xprt) 88static inline void svc_xprt_get(struct svc_xprt *xprt)
@@ -88,29 +90,32 @@ static inline void svc_xprt_get(struct svc_xprt *xprt)
88 kref_get(&xprt->xpt_ref); 90 kref_get(&xprt->xpt_ref);
89} 91}
90static inline void svc_xprt_set_local(struct svc_xprt *xprt, 92static inline void svc_xprt_set_local(struct svc_xprt *xprt,
91 struct sockaddr *sa, int salen) 93 const struct sockaddr *sa,
94 const size_t salen)
92{ 95{
93 memcpy(&xprt->xpt_local, sa, salen); 96 memcpy(&xprt->xpt_local, sa, salen);
94 xprt->xpt_locallen = salen; 97 xprt->xpt_locallen = salen;
95} 98}
96static inline void svc_xprt_set_remote(struct svc_xprt *xprt, 99static inline void svc_xprt_set_remote(struct svc_xprt *xprt,
97 struct sockaddr *sa, int salen) 100 const struct sockaddr *sa,
101 const size_t salen)
98{ 102{
99 memcpy(&xprt->xpt_remote, sa, salen); 103 memcpy(&xprt->xpt_remote, sa, salen);
100 xprt->xpt_remotelen = salen; 104 xprt->xpt_remotelen = salen;
101} 105}
102static inline unsigned short svc_addr_port(struct sockaddr *sa) 106static inline unsigned short svc_addr_port(const struct sockaddr *sa)
103{ 107{
104 unsigned short ret = 0; 108 const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
109 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sa;
110
105 switch (sa->sa_family) { 111 switch (sa->sa_family) {
106 case AF_INET: 112 case AF_INET:
107 ret = ntohs(((struct sockaddr_in *)sa)->sin_port); 113 return ntohs(sin->sin_port);
108 break;
109 case AF_INET6: 114 case AF_INET6:
110 ret = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); 115 return ntohs(sin6->sin6_port);
111 break;
112 } 116 }
113 return ret; 117
118 return 0;
114} 119}
115 120
116static inline size_t svc_addr_len(struct sockaddr *sa) 121static inline size_t svc_addr_len(struct sockaddr *sa)
@@ -124,36 +129,39 @@ static inline size_t svc_addr_len(struct sockaddr *sa)
124 return -EAFNOSUPPORT; 129 return -EAFNOSUPPORT;
125} 130}
126 131
127static inline unsigned short svc_xprt_local_port(struct svc_xprt *xprt) 132static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt)
128{ 133{
129 return svc_addr_port((struct sockaddr *)&xprt->xpt_local); 134 return svc_addr_port((const struct sockaddr *)&xprt->xpt_local);
130} 135}
131 136
132static inline unsigned short svc_xprt_remote_port(struct svc_xprt *xprt) 137static inline unsigned short svc_xprt_remote_port(const struct svc_xprt *xprt)
133{ 138{
134 return svc_addr_port((struct sockaddr *)&xprt->xpt_remote); 139 return svc_addr_port((const struct sockaddr *)&xprt->xpt_remote);
135} 140}
136 141
137static inline char *__svc_print_addr(struct sockaddr *addr, 142static inline char *__svc_print_addr(const struct sockaddr *addr,
138 char *buf, size_t len) 143 char *buf, const size_t len)
139{ 144{
145 const struct sockaddr_in *sin = (const struct sockaddr_in *)addr;
146 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)addr;
147
140 switch (addr->sa_family) { 148 switch (addr->sa_family) {
141 case AF_INET: 149 case AF_INET:
142 snprintf(buf, len, "%pI4, port=%u", 150 snprintf(buf, len, "%pI4, port=%u", &sin->sin_addr,
143 &((struct sockaddr_in *)addr)->sin_addr, 151 ntohs(sin->sin_port));
144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 152 break;
146 153
147 case AF_INET6: 154 case AF_INET6:
148 snprintf(buf, len, "%pI6, port=%u", 155 snprintf(buf, len, "%pI6, port=%u",
149 &((struct sockaddr_in6 *)addr)->sin6_addr, 156 &sin6->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 157 ntohs(sin6->sin6_port));
151 break; 158 break;
152 159
153 default: 160 default:
154 snprintf(buf, len, "unknown address type: %d", addr->sa_family); 161 snprintf(buf, len, "unknown address type: %d", addr->sa_family);
155 break; 162 break;
156 } 163 }
164
157 return buf; 165 return buf;
158} 166}
159#endif /* SUNRPC_SVC_XPRT_H */ 167#endif /* SUNRPC_SVC_XPRT_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 49e1eb454465..d8910b68e1bd 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -69,27 +69,27 @@ struct xdr_buf {
69 * pre-xdr'ed macros. 69 * pre-xdr'ed macros.
70 */ 70 */
71 71
72#define xdr_zero __constant_htonl(0) 72#define xdr_zero cpu_to_be32(0)
73#define xdr_one __constant_htonl(1) 73#define xdr_one cpu_to_be32(1)
74#define xdr_two __constant_htonl(2) 74#define xdr_two cpu_to_be32(2)
75 75
76#define rpc_success __constant_htonl(RPC_SUCCESS) 76#define rpc_success cpu_to_be32(RPC_SUCCESS)
77#define rpc_prog_unavail __constant_htonl(RPC_PROG_UNAVAIL) 77#define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL)
78#define rpc_prog_mismatch __constant_htonl(RPC_PROG_MISMATCH) 78#define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH)
79#define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) 79#define rpc_proc_unavail cpu_to_be32(RPC_PROC_UNAVAIL)
80#define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) 80#define rpc_garbage_args cpu_to_be32(RPC_GARBAGE_ARGS)
81#define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) 81#define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR)
82#define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY) 82#define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY)
83 83
84#define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) 84#define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK)
85#define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) 85#define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED)
86#define rpc_autherr_rejectedcred __constant_htonl(RPC_AUTH_REJECTEDCRED) 86#define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED)
87#define rpc_autherr_badverf __constant_htonl(RPC_AUTH_BADVERF) 87#define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF)
88#define rpc_autherr_rejectedverf __constant_htonl(RPC_AUTH_REJECTEDVERF) 88#define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
89#define rpc_autherr_tooweak __constant_htonl(RPC_AUTH_TOOWEAK) 89#define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK)
90#define rpcsec_gsserr_credproblem __constant_htonl(RPCSEC_GSS_CREDPROBLEM) 90#define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM)
91#define rpcsec_gsserr_ctxproblem __constant_htonl(RPCSEC_GSS_CTXPROBLEM) 91#define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM)
92#define rpc_autherr_oldseqnum __constant_htonl(101) 92#define rpc_autherr_oldseqnum cpu_to_be32(101)
93 93
94/* 94/*
95 * Miscellaneous XDR helper functions 95 * Miscellaneous XDR helper functions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 11fc71d50c1e..1758d9f5b5c3 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -235,6 +235,7 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *
235 */ 235 */
236int xprt_register_transport(struct xprt_class *type); 236int xprt_register_transport(struct xprt_class *type);
237int xprt_unregister_transport(struct xprt_class *type); 237int xprt_unregister_transport(struct xprt_class *type);
238int xprt_load_transport(const char *);
238void xprt_set_retrans_timeout_def(struct rpc_task *task); 239void xprt_set_retrans_timeout_def(struct rpc_task *task);
239void xprt_set_retrans_timeout_rtt(struct rpc_task *task); 240void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 241void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
@@ -259,6 +260,7 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
259#define XPRT_BOUND (4) 260#define XPRT_BOUND (4)
260#define XPRT_BINDING (5) 261#define XPRT_BINDING (5)
261#define XPRT_CLOSING (6) 262#define XPRT_CLOSING (6)
263#define XPRT_CONNECTION_ABORT (7)
262 264
263static inline void xprt_set_connected(struct rpc_xprt *xprt) 265static inline void xprt_set_connected(struct rpc_xprt *xprt)
264{ 266{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index c7d9bb1832ba..3e3a4364cbff 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -1,9 +1,6 @@
1#ifndef _LINUX_SUSPEND_H 1#ifndef _LINUX_SUSPEND_H
2#define _LINUX_SUSPEND_H 2#define _LINUX_SUSPEND_H
3 3
4#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
5#include <asm/suspend.h>
6#endif
7#include <linux/swap.h> 4#include <linux/swap.h>
8#include <linux/notifier.h> 5#include <linux/notifier.h>
9#include <linux/init.h> 6#include <linux/init.h>
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h
index 2c6faec96bde..0b30382984fe 100644
--- a/include/linux/suspend_ioctls.h
+++ b/include/linux/suspend_ioctls.h
@@ -1,14 +1,15 @@
1#ifndef _LINUX_SUSPEND_IOCTLS_H 1#ifndef _LINUX_SUSPEND_IOCTLS_H
2#define _LINUX_SUSPEND_IOCTLS_H 2#define _LINUX_SUSPEND_IOCTLS_H
3 3
4#include <linux/types.h>
4/* 5/*
5 * This structure is used to pass the values needed for the identification 6 * This structure is used to pass the values needed for the identification
6 * of the resume swap area from a user space to the kernel via the 7 * of the resume swap area from a user space to the kernel via the
7 * SNAPSHOT_SET_SWAP_AREA ioctl 8 * SNAPSHOT_SET_SWAP_AREA ioctl
8 */ 9 */
9struct resume_swap_area { 10struct resume_swap_area {
10 loff_t offset; 11 __kernel_loff_t offset;
11 u_int32_t dev; 12 __u32 dev;
12} __attribute__((packed)); 13} __attribute__((packed));
13 14
14#define SNAPSHOT_IOC_MAGIC '3' 15#define SNAPSHOT_IOC_MAGIC '3'
@@ -20,13 +21,13 @@ struct resume_swap_area {
20#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) 21#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
21#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ 22#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \
22 struct resume_swap_area) 23 struct resume_swap_area)
23#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t) 24#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t)
24#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) 25#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15)
25#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) 26#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16)
26#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) 27#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int)
27#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) 28#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18)
28#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t) 29#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t)
29#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, loff_t) 30#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t)
30#define SNAPSHOT_IOC_MAXNR 20 31#define SNAPSHOT_IOC_MAXNR 20
31 32
32#endif /* _LINUX_SUSPEND_IOCTLS_H */ 33#endif /* _LINUX_SUSPEND_IOCTLS_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d30215578877..62d81435347a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -212,7 +212,7 @@ static inline void lru_cache_add_active_file(struct page *page)
212 212
213/* linux/mm/vmscan.c */ 213/* linux/mm/vmscan.c */
214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
215 gfp_t gfp_mask); 215 gfp_t gfp_mask, nodemask_t *mask);
216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
217 gfp_t gfp_mask, bool noswap, 217 gfp_t gfp_mask, bool noswap,
218 unsigned int swappiness); 218 unsigned int swappiness);
@@ -382,6 +382,11 @@ static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
382 return NULL; 382 return NULL;
383} 383}
384 384
385static inline int swap_writepage(struct page *p, struct writeback_control *wbc)
386{
387 return 0;
388}
389
385static inline struct page *lookup_swap_cache(swp_entry_t swp) 390static inline struct page *lookup_swap_cache(swp_entry_t swp)
386{ 391{
387 return NULL; 392 return NULL;
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index dedd3c0cfe30..ac9ff54f7cb3 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -31,7 +31,7 @@ extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address); 31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); 32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
33 33
34extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size); 34extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
35 35
36extern void 36extern void
37*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 37*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -41,20 +41,13 @@ extern void
41swiotlb_free_coherent(struct device *hwdev, size_t size, 41swiotlb_free_coherent(struct device *hwdev, size_t size,
42 void *vaddr, dma_addr_t dma_handle); 42 void *vaddr, dma_addr_t dma_handle);
43 43
44extern dma_addr_t 44extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
45swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir); 45 unsigned long offset, size_t size,
46 46 enum dma_data_direction dir,
47extern void 47 struct dma_attrs *attrs);
48swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, 48extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
49 size_t size, int dir); 49 size_t size, enum dma_data_direction dir,
50 50 struct dma_attrs *attrs);
51extern dma_addr_t
52swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
53 int dir, struct dma_attrs *attrs);
54
55extern void
56swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
57 size_t size, int dir, struct dma_attrs *attrs);
58 51
59extern int 52extern int
60swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 53swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
@@ -66,36 +59,38 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
66 59
67extern int 60extern int
68swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 61swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
69 int dir, struct dma_attrs *attrs); 62 enum dma_data_direction dir, struct dma_attrs *attrs);
70 63
71extern void 64extern void
72swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, 65swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
73 int nelems, int dir, struct dma_attrs *attrs); 66 int nelems, enum dma_data_direction dir,
67 struct dma_attrs *attrs);
74 68
75extern void 69extern void
76swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 70swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
77 size_t size, int dir); 71 size_t size, enum dma_data_direction dir);
78 72
79extern void 73extern void
80swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, 74swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
81 int nelems, int dir); 75 int nelems, enum dma_data_direction dir);
82 76
83extern void 77extern void
84swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, 78swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
85 size_t size, int dir); 79 size_t size, enum dma_data_direction dir);
86 80
87extern void 81extern void
88swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 82swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
89 int nelems, int dir); 83 int nelems, enum dma_data_direction dir);
90 84
91extern void 85extern void
92swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 86swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
93 unsigned long offset, size_t size, int dir); 87 unsigned long offset, size_t size,
88 enum dma_data_direction dir);
94 89
95extern void 90extern void
96swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr, 91swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
97 unsigned long offset, size_t size, 92 unsigned long offset, size_t size,
98 int dir); 93 enum dma_data_direction dir);
99 94
100extern int 95extern int
101swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); 96swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 99b8bdb17b2b..0ff2779c44d0 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -125,6 +125,7 @@
125#define MGSL_MODE_MONOSYNC 3 125#define MGSL_MODE_MONOSYNC 3
126#define MGSL_MODE_BISYNC 4 126#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6 127#define MGSL_MODE_RAW 6
128#define MGSL_MODE_BASE_CLOCK 7
128 129
129#define MGSL_BUS_TYPE_ISA 1 130#define MGSL_BUS_TYPE_ISA 1
130#define MGSL_BUS_TYPE_EISA 2 131#define MGSL_BUS_TYPE_EISA 2
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 0cff9bb80b02..6470f74074af 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -517,6 +517,10 @@ asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
517 size_t count, loff_t pos); 517 size_t count, loff_t pos);
518asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, 518asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
519 size_t count, loff_t pos); 519 size_t count, loff_t pos);
520asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
521 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
522asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
523 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
520asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 524asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
521asmlinkage long sys_mkdir(const char __user *pathname, int mode); 525asmlinkage long sys_mkdir(const char __user *pathname, int mode);
522asmlinkage long sys_chdir(const char __user *filename); 526asmlinkage long sys_chdir(const char __user *filename);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 39d471d1163b..e76d3b22a466 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -490,6 +490,7 @@ enum
490 NET_IPV4_CONF_ARP_IGNORE=19, 490 NET_IPV4_CONF_ARP_IGNORE=19,
491 NET_IPV4_CONF_PROMOTE_SECONDARIES=20, 491 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
492 NET_IPV4_CONF_ARP_ACCEPT=21, 492 NET_IPV4_CONF_ARP_ACCEPT=21,
493 NET_IPV4_CONF_ARP_NOTIFY=22,
493 __NET_IPV4_CONF_MAX 494 __NET_IPV4_CONF_MAX
494}; 495};
495 496
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fe77e1499ab7..9d5078bd23a3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -69,16 +69,16 @@ union tcp_word_hdr {
69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
70 70
71enum { 71enum {
72 TCP_FLAG_CWR = __constant_htonl(0x00800000), 72 TCP_FLAG_CWR = __cpu_to_be32(0x00800000),
73 TCP_FLAG_ECE = __constant_htonl(0x00400000), 73 TCP_FLAG_ECE = __cpu_to_be32(0x00400000),
74 TCP_FLAG_URG = __constant_htonl(0x00200000), 74 TCP_FLAG_URG = __cpu_to_be32(0x00200000),
75 TCP_FLAG_ACK = __constant_htonl(0x00100000), 75 TCP_FLAG_ACK = __cpu_to_be32(0x00100000),
76 TCP_FLAG_PSH = __constant_htonl(0x00080000), 76 TCP_FLAG_PSH = __cpu_to_be32(0x00080000),
77 TCP_FLAG_RST = __constant_htonl(0x00040000), 77 TCP_FLAG_RST = __cpu_to_be32(0x00040000),
78 TCP_FLAG_SYN = __constant_htonl(0x00020000), 78 TCP_FLAG_SYN = __cpu_to_be32(0x00020000),
79 TCP_FLAG_FIN = __constant_htonl(0x00010000), 79 TCP_FLAG_FIN = __cpu_to_be32(0x00010000),
80 TCP_RESERVED_BITS = __constant_htonl(0x0F000000), 80 TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000),
81 TCP_DATA_OFFSET = __constant_htonl(0xF0000000) 81 TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
82}; 82};
83 83
84/* TCP socket options */ 84/* TCP socket options */
@@ -218,7 +218,6 @@ struct tcp_options_received {
218 snd_wscale : 4, /* Window scaling received from sender */ 218 snd_wscale : 4, /* Window scaling received from sender */
219 rcv_wscale : 4; /* Window scaling to send to receiver */ 219 rcv_wscale : 4; /* Window scaling to send to receiver */
220/* SACKs data */ 220/* SACKs data */
221 u8 eff_sacks; /* Size of SACK array to send with next packet */
222 u8 num_sacks; /* Number of SACK blocks */ 221 u8 num_sacks; /* Number of SACK blocks */
223 u16 user_mss; /* mss requested by user in ioctl */ 222 u16 user_mss; /* mss requested by user in ioctl */
224 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 223 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
@@ -249,7 +248,7 @@ struct tcp_sock {
249 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
250 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
251 u16 tcp_header_len; /* Bytes of tcp header to send */ 250 u16 tcp_header_len; /* Bytes of tcp header to send */
252 u16 xmit_size_goal; /* Goal for segmenting output packets */ 251 u16 xmit_size_goal_segs; /* Goal for segmenting output packets */
253 252
254/* 253/*
255 * Header prediction flags 254 * Header prediction flags
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 917707e6151d..1de8b9eb841b 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -27,27 +27,46 @@
27 27
28#include <linux/idr.h> 28#include <linux/idr.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h>
30 31
31struct thermal_zone_device; 32struct thermal_zone_device;
32struct thermal_cooling_device; 33struct thermal_cooling_device;
33 34
35enum thermal_device_mode {
36 THERMAL_DEVICE_DISABLED = 0,
37 THERMAL_DEVICE_ENABLED,
38};
39
40enum thermal_trip_type {
41 THERMAL_TRIP_ACTIVE = 0,
42 THERMAL_TRIP_PASSIVE,
43 THERMAL_TRIP_HOT,
44 THERMAL_TRIP_CRITICAL,
45};
46
34struct thermal_zone_device_ops { 47struct thermal_zone_device_ops {
35 int (*bind) (struct thermal_zone_device *, 48 int (*bind) (struct thermal_zone_device *,
36 struct thermal_cooling_device *); 49 struct thermal_cooling_device *);
37 int (*unbind) (struct thermal_zone_device *, 50 int (*unbind) (struct thermal_zone_device *,
38 struct thermal_cooling_device *); 51 struct thermal_cooling_device *);
39 int (*get_temp) (struct thermal_zone_device *, char *); 52 int (*get_temp) (struct thermal_zone_device *, unsigned long *);
40 int (*get_mode) (struct thermal_zone_device *, char *); 53 int (*get_mode) (struct thermal_zone_device *,
41 int (*set_mode) (struct thermal_zone_device *, const char *); 54 enum thermal_device_mode *);
42 int (*get_trip_type) (struct thermal_zone_device *, int, char *); 55 int (*set_mode) (struct thermal_zone_device *,
43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *); 56 enum thermal_device_mode);
57 int (*get_trip_type) (struct thermal_zone_device *, int,
58 enum thermal_trip_type *);
59 int (*get_trip_temp) (struct thermal_zone_device *, int,
60 unsigned long *);
44 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 61 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
62 int (*notify) (struct thermal_zone_device *, int,
63 enum thermal_trip_type);
45}; 64};
46 65
47struct thermal_cooling_device_ops { 66struct thermal_cooling_device_ops {
48 int (*get_max_state) (struct thermal_cooling_device *, char *); 67 int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
49 int (*get_cur_state) (struct thermal_cooling_device *, char *); 68 int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
50 int (*set_cur_state) (struct thermal_cooling_device *, unsigned int); 69 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
51}; 70};
52 71
53#define THERMAL_TRIPS_NONE -1 72#define THERMAL_TRIPS_NONE -1
@@ -88,11 +107,19 @@ struct thermal_zone_device {
88 struct device device; 107 struct device device;
89 void *devdata; 108 void *devdata;
90 int trips; 109 int trips;
110 int tc1;
111 int tc2;
112 int passive_delay;
113 int polling_delay;
114 int last_temperature;
115 bool passive;
116 unsigned int forced_passive;
91 struct thermal_zone_device_ops *ops; 117 struct thermal_zone_device_ops *ops;
92 struct list_head cooling_devices; 118 struct list_head cooling_devices;
93 struct idr idr; 119 struct idr idr;
94 struct mutex lock; /* protect cooling devices list */ 120 struct mutex lock; /* protect cooling devices list */
95 struct list_head node; 121 struct list_head node;
122 struct delayed_work poll_queue;
96#if defined(CONFIG_THERMAL_HWMON) 123#if defined(CONFIG_THERMAL_HWMON)
97 struct list_head hwmon_node; 124 struct list_head hwmon_node;
98 struct thermal_hwmon_device *hwmon; 125 struct thermal_hwmon_device *hwmon;
@@ -104,13 +131,16 @@ struct thermal_zone_device {
104struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, 131struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
105 struct 132 struct
106 thermal_zone_device_ops 133 thermal_zone_device_ops
107 *); 134 *, int tc1, int tc2,
135 int passive_freq,
136 int polling_freq);
108void thermal_zone_device_unregister(struct thermal_zone_device *); 137void thermal_zone_device_unregister(struct thermal_zone_device *);
109 138
110int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 139int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
111 struct thermal_cooling_device *); 140 struct thermal_cooling_device *);
112int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 141int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
113 struct thermal_cooling_device *); 142 struct thermal_cooling_device *);
143void thermal_zone_device_update(struct thermal_zone_device *);
114struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 144struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
115 struct 145 struct
116 thermal_cooling_device_ops 146 thermal_cooling_device_ops
diff --git a/include/linux/time.h b/include/linux/time.h
index fbbd2a1c92ba..242f62499bb7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -12,14 +12,14 @@
12#ifndef _STRUCT_TIMESPEC 12#ifndef _STRUCT_TIMESPEC
13#define _STRUCT_TIMESPEC 13#define _STRUCT_TIMESPEC
14struct timespec { 14struct timespec {
15 time_t tv_sec; /* seconds */ 15 __kernel_time_t tv_sec; /* seconds */
16 long tv_nsec; /* nanoseconds */ 16 long tv_nsec; /* nanoseconds */
17}; 17};
18#endif 18#endif
19 19
20struct timeval { 20struct timeval {
21 time_t tv_sec; /* seconds */ 21 __kernel_time_t tv_sec; /* seconds */
22 suseconds_t tv_usec; /* microseconds */ 22 __kernel_suseconds_t tv_usec; /* microseconds */
23}; 23};
24 24
25struct timezone { 25struct timezone {
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
new file mode 100644
index 000000000000..546e2234e4b3
--- /dev/null
+++ b/include/linux/timecompare.h
@@ -0,0 +1,125 @@
1/*
2 * Utility code which helps transforming between two different time
3 * bases, called "source" and "target" time in this code.
4 *
5 * Source time has to be provided via the timecounter API while target
6 * time is accessed via a function callback whose prototype
7 * intentionally matches ktime_get() and ktime_get_real(). These
8 * interfaces where chosen like this so that the code serves its
9 * initial purpose without additional glue code.
10 *
11 * This purpose is synchronizing a hardware clock in a NIC with system
12 * time, in order to implement the Precision Time Protocol (PTP,
13 * IEEE1588) with more accurate hardware assisted time stamping. In
14 * that context only synchronization against system time (=
15 * ktime_get_real()) is currently needed. But this utility code might
16 * become useful in other situations, which is why it was written as
17 * general purpose utility code.
18 *
19 * The source timecounter is assumed to return monotonically
20 * increasing time (but this code does its best to compensate if that
21 * is not the case) whereas target time may jump.
22 *
23 * The target time corresponding to a source time is determined by
24 * reading target time, reading source time, reading target time
25 * again, then assuming that average target time corresponds to source
26 * time. In other words, the assumption is that reading the source
27 * time is slow and involves equal time for sending the request and
28 * receiving the reply, whereas reading target time is assumed to be
29 * fast.
30 *
31 * Copyright (C) 2009 Intel Corporation.
32 * Author: Patrick Ohly <patrick.ohly@intel.com>
33 *
34 * This program is free software; you can redistribute it and/or modify it
35 * under the terms and conditions of the GNU General Public License,
36 * version 2, as published by the Free Software Foundation.
37 *
38 * This program is distributed in the hope it will be useful, but WITHOUT
39 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
40 * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
41 * more details.
42 *
43 * You should have received a copy of the GNU General Public License along with
44 * this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
46 */
47#ifndef _LINUX_TIMECOMPARE_H
48#define _LINUX_TIMECOMPARE_H
49
50#include <linux/clocksource.h>
51#include <linux/ktime.h>
52
53/**
54 * struct timecompare - stores state and configuration for the two clocks
55 *
56 * Initialize to zero, then set source/target/num_samples.
57 *
58 * Transformation between source time and target time is done with:
59 * target_time = source_time + offset +
60 * (source_time - last_update) * skew /
61 * TIMECOMPARE_SKEW_RESOLUTION
62 *
63 * @source: used to get source time stamps via timecounter_read()
64 * @target: function returning target time (for example, ktime_get
65 * for monotonic time, or ktime_get_real for wall clock)
66 * @num_samples: number of times that source time and target time are to
67 * be compared when determining their offset
68 * @offset: (target time - source time) at the time of the last update
69 * @skew: average (target time - source time) / delta source time *
70 * TIMECOMPARE_SKEW_RESOLUTION
71 * @last_update: last source time stamp when time offset was measured
72 */
73struct timecompare {
74 struct timecounter *source;
75 ktime_t (*target)(void);
76 int num_samples;
77
78 s64 offset;
79 s64 skew;
80 u64 last_update;
81};
82
83/**
84 * timecompare_transform - transform source time stamp into target time base
85 * @sync: context for time sync
86 * @source_tstamp: the result of timecounter_read() or
87 * timecounter_cyc2time()
88 */
89extern ktime_t timecompare_transform(struct timecompare *sync,
90 u64 source_tstamp);
91
92/**
93 * timecompare_offset - measure current (target time - source time) offset
94 * @sync: context for time sync
95 * @offset: average offset during sample period returned here
96 * @source_tstamp: average source time during sample period returned here
97 *
98 * Returns number of samples used. Might be zero (= no result) in the
99 * unlikely case that target time was monotonically decreasing for all
100 * samples (= broken).
101 */
102extern int timecompare_offset(struct timecompare *sync,
103 s64 *offset,
104 u64 *source_tstamp);
105
106extern void __timecompare_update(struct timecompare *sync,
107 u64 source_tstamp);
108
109/**
110 * timecompare_update - update offset and skew by measuring current offset
111 * @sync: context for time sync
112 * @source_tstamp: the result of timecounter_read() or
113 * timecounter_cyc2time(), pass zero to force update
114 *
115 * Updates are only done at most once per second.
116 */
117static inline void timecompare_update(struct timecompare *sync,
118 u64 source_tstamp)
119{
120 if (!source_tstamp ||
121 (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
122 __timecompare_update(sync, source_tstamp);
123}
124
125#endif /* _LINUX_TIMECOMPARE_H */
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 51774eb87cc6..6cdb6f3331f1 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -161,8 +161,8 @@ static inline int timer_pending(const struct timer_list * timer)
161 161
162extern void add_timer_on(struct timer_list *timer, int cpu); 162extern void add_timer_on(struct timer_list *timer, int cpu);
163extern int del_timer(struct timer_list * timer); 163extern int del_timer(struct timer_list * timer);
164extern int __mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer(struct timer_list *timer, unsigned long expires); 164extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166 166
167/* 167/*
168 * The jiffies value which is added to now, when there is no timer 168 * The jiffies value which is added to now, when there is no timer
@@ -221,25 +221,7 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
221} 221}
222#endif 222#endif
223 223
224/** 224extern void add_timer(struct timer_list *timer);
225 * add_timer - start a timer
226 * @timer: the timer to be added
227 *
228 * The kernel will do a ->function(->data) callback from the
229 * timer interrupt at the ->expires point in the future. The
230 * current time is 'jiffies'.
231 *
232 * The timer's ->expires, ->function (and if the handler uses it, ->data)
233 * fields must be set prior calling this function.
234 *
235 * Timers with an ->expires field in the past will be executed in the next
236 * timer tick.
237 */
238static inline void add_timer(struct timer_list *timer)
239{
240 BUG_ON(timer_pending(timer));
241 __mod_timer(timer, timer->expires);
242}
243 225
244#ifdef CONFIG_SMP 226#ifdef CONFIG_SMP
245 extern int try_to_del_timer_sync(struct timer_list *timer); 227 extern int try_to_del_timer_sync(struct timer_list *timer);
diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h
new file mode 100644
index 000000000000..3e08a1c86830
--- /dev/null
+++ b/include/linux/timeriomem-rng.h
@@ -0,0 +1,21 @@
1/*
2 * linux/include/linux/timeriomem-rng.h
3 *
4 * Copyright (c) 2009 Alexander Clouter <alex@digriz.org.uk>
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#include <linux/completion.h>
12
13struct timeriomem_rng_data {
14 struct completion completion;
15 unsigned int present:1;
16
17 void __iomem *address;
18
19 /* measures in usecs */
20 unsigned int period;
21};
diff --git a/include/linux/times.h b/include/linux/times.h
index e2d3020742a6..87b62615cedd 100644
--- a/include/linux/times.h
+++ b/include/linux/times.h
@@ -4,10 +4,10 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct tms { 6struct tms {
7 clock_t tms_utime; 7 __kernel_clock_t tms_utime;
8 clock_t tms_stime; 8 __kernel_clock_t tms_stime;
9 clock_t tms_cutime; 9 __kernel_clock_t tms_cutime;
10 clock_t tms_cstime; 10 __kernel_clock_t tms_cstime;
11}; 11};
12 12
13#endif 13#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 998a55d80acf..aa3475fcff64 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -190,7 +190,7 @@ struct timex {
190 * offset and maximum frequency tolerance. 190 * offset and maximum frequency tolerance.
191 */ 191 */
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 192#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 194#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 196 PPM_SCALE + 1)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index a16b9e06f2e5..7402c1a27c4f 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -38,11 +38,7 @@
38#endif 38#endif
39 39
40#ifndef nr_cpus_node 40#ifndef nr_cpus_node
41#define nr_cpus_node(node) \ 41#define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node))
42 ({ \
43 node_to_cpumask_ptr(__tmp__, node); \
44 cpus_weight(*__tmp__); \
45 })
46#endif 42#endif
47 43
48#define for_each_node_with_cpus(node) \ 44#define for_each_node_with_cpus(node) \
@@ -200,4 +196,9 @@ int arch_update_cpu_topology(void);
200#define topology_core_cpumask(cpu) cpumask_of(cpu) 196#define topology_core_cpumask(cpu) cpumask_of(cpu)
201#endif 197#endif
202 198
199/* Returns the number of the current Node. */
200#ifndef numa_node_id
201#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
202#endif
203
203#endif /* _LINUX_TOPOLOGY_H */ 204#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
new file mode 100644
index 000000000000..3338b3f5c21a
--- /dev/null
+++ b/include/linux/tpm.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2004,2007,2008 IBM Corporation
3 *
4 * Authors:
5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Dave Safford <safford@watson.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>
9 * Debora Velarde <dvelarde@us.ibm.com>
10 *
11 * Maintained by: <tpmdd_devel@lists.sourceforge.net>
12 *
13 * Device driver for TCG/TCPA TPM (trusted platform module).
14 * Specifications at www.trustedcomputinggroup.org
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation, version 2 of the
19 * License.
20 *
21 */
22#ifndef __LINUX_TPM_H__
23#define __LINUX_TPM_H__
24
25/*
26 * Chip num is this value or a valid tpm idx
27 */
28#define TPM_ANY_NUM 0xFFFF
29
30#if defined(CONFIG_TCG_TPM)
31
32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf);
33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash);
34#endif
35#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6186a789d6c7..c7aa154f4bfc 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -388,17 +388,14 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal 388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
389 * @task: task receiving the signal 389 * @task: task receiving the signal
390 * @sig: signal number being sent 390 * @sig: signal number being sent
391 * @handler: %SIG_IGN or %SIG_DFL
392 * 391 *
393 * Return zero iff tracing doesn't care to examine this ignored signal, 392 * Return zero iff tracing doesn't care to examine this ignored signal,
394 * so it can short-circuit normal delivery and never even get queued. 393 * so it can short-circuit normal delivery and never even get queued.
395 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
396 * 394 *
397 * Called with @task->sighand->siglock held. 395 * Called with @task->sighand->siglock held.
398 */ 396 */
399static inline int tracehook_consider_ignored_signal(struct task_struct *task, 397static inline int tracehook_consider_ignored_signal(struct task_struct *task,
400 int sig, 398 int sig)
401 void __user *handler)
402{ 399{
403 return (task_ptrace(task) & PT_PTRACED) != 0; 400 return (task_ptrace(task) & PT_PTRACED) != 0;
404} 401}
@@ -407,19 +404,17 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task,
407 * tracehook_consider_fatal_signal - suppress special handling of fatal signal 404 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
408 * @task: task receiving the signal 405 * @task: task receiving the signal
409 * @sig: signal number being sent 406 * @sig: signal number being sent
410 * @handler: %SIG_DFL or %SIG_IGN
411 * 407 *
412 * Return nonzero to prevent special handling of this termination signal. 408 * Return nonzero to prevent special handling of this termination signal.
413 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored, 409 * Normally handler for signal is %SIG_DFL. It can be %SIG_IGN if @sig is
414 * in which case force_sig() is about to reset it to %SIG_DFL. 410 * ignored, in which case force_sig() is about to reset it to %SIG_DFL.
415 * When this returns zero, this signal might cause a quick termination 411 * When this returns zero, this signal might cause a quick termination
416 * that does not give the debugger a chance to intercept the signal. 412 * that does not give the debugger a chance to intercept the signal.
417 * 413 *
418 * Called with or without @task->sighand->siglock held. 414 * Called with or without @task->sighand->siglock held.
419 */ 415 */
420static inline int tracehook_consider_fatal_signal(struct task_struct *task, 416static inline int tracehook_consider_fatal_signal(struct task_struct *task,
421 int sig, 417 int sig)
422 void __user *handler)
423{ 418{
424 return (task_ptrace(task) & PT_PTRACED) != 0; 419 return (task_ptrace(task) & PT_PTRACED) != 0;
425} 420}
@@ -507,7 +502,7 @@ static inline int tracehook_notify_jctl(int notify, int why)
507static inline int tracehook_notify_death(struct task_struct *task, 502static inline int tracehook_notify_death(struct task_struct *task,
508 void **death_cookie, int group_dead) 503 void **death_cookie, int group_dead)
509{ 504{
510 if (task->exit_signal == -1) 505 if (task_detached(task))
511 return task->ptrace ? SIGCHLD : DEATH_REAP; 506 return task->ptrace ? SIGCHLD : DEATH_REAP;
512 507
513 /* 508 /*
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 08e088334dba..bcba84ea2d86 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -252,8 +252,6 @@ struct tty_operations {
252 void (*set_ldisc)(struct tty_struct *tty); 252 void (*set_ldisc)(struct tty_struct *tty);
253 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 253 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
254 void (*send_xchar)(struct tty_struct *tty, char ch); 254 void (*send_xchar)(struct tty_struct *tty, char ch);
255 int (*read_proc)(char *page, char **start, off_t off,
256 int count, int *eof, void *data);
257 int (*tiocmget)(struct tty_struct *tty, struct file *file); 255 int (*tiocmget)(struct tty_struct *tty, struct file *file);
258 int (*tiocmset)(struct tty_struct *tty, struct file *file, 256 int (*tiocmset)(struct tty_struct *tty, struct file *file,
259 unsigned int set, unsigned int clear); 257 unsigned int set, unsigned int clear);
@@ -264,6 +262,7 @@ struct tty_operations {
264 int (*poll_get_char)(struct tty_driver *driver, int line); 262 int (*poll_get_char)(struct tty_driver *driver, int line);
265 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 263 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
266#endif 264#endif
265 const struct file_operations *proc_fops;
267}; 266};
268 267
269struct tty_driver { 268struct tty_driver {
@@ -310,7 +309,8 @@ extern void tty_set_operations(struct tty_driver *driver,
310extern struct tty_driver *tty_find_polling_driver(char *name, int *line); 309extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
311 310
312extern void tty_driver_kref_put(struct tty_driver *driver); 311extern void tty_driver_kref_put(struct tty_driver *driver);
313extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 312
313static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
314{ 314{
315 kref_get(&d->kref); 315 kref_get(&d->kref);
316 return d; 316 return d;
diff --git a/include/linux/types.h b/include/linux/types.h
index fca82ed55f49..5abe354020f9 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/posix_types.h> 14#include <linux/posix_types.h>
15 15
16#ifndef __KERNEL_STRICT_NAMES 16#ifdef __KERNEL__
17 17
18typedef __u32 __kernel_dev_t; 18typedef __u32 __kernel_dev_t;
19 19
@@ -31,7 +31,6 @@ typedef __kernel_timer_t timer_t;
31typedef __kernel_clockid_t clockid_t; 31typedef __kernel_clockid_t clockid_t;
32typedef __kernel_mqd_t mqd_t; 32typedef __kernel_mqd_t mqd_t;
33 33
34#ifdef __KERNEL__
35typedef _Bool bool; 34typedef _Bool bool;
36 35
37typedef __kernel_uid32_t uid_t; 36typedef __kernel_uid32_t uid_t;
@@ -47,14 +46,6 @@ typedef __kernel_old_uid_t old_uid_t;
47typedef __kernel_old_gid_t old_gid_t; 46typedef __kernel_old_gid_t old_gid_t;
48#endif /* CONFIG_UID16 */ 47#endif /* CONFIG_UID16 */
49 48
50/* libc5 includes this file to define uid_t, thus uid_t can never change
51 * when it is included by non-kernel code
52 */
53#else
54typedef __kernel_uid_t uid_t;
55typedef __kernel_gid_t gid_t;
56#endif /* __KERNEL__ */
57
58#if defined(__GNUC__) 49#if defined(__GNUC__)
59typedef __kernel_loff_t loff_t; 50typedef __kernel_loff_t loff_t;
60#endif 51#endif
@@ -156,7 +147,7 @@ typedef unsigned long blkcnt_t;
156#define pgoff_t unsigned long 147#define pgoff_t unsigned long
157#endif 148#endif
158 149
159#endif /* __KERNEL_STRICT_NAMES */ 150#endif /* __KERNEL__ */
160 151
161/* 152/*
162 * Below are truly Linux-specific types that should never collide with 153 * Below are truly Linux-specific types that should never collide with
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index a0bb6bd2e5c1..5dcc9ff72f69 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -22,6 +22,7 @@ struct uio_map;
22 22
23/** 23/**
24 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
25 * @name: name of the memory region for identification
25 * @addr: address of the device's memory 26 * @addr: address of the device's memory
26 * @size: size of IO 27 * @size: size of IO
27 * @memtype: type of memory addr points to 28 * @memtype: type of memory addr points to
@@ -29,6 +30,7 @@ struct uio_map;
29 * @map: for use by the UIO core only. 30 * @map: for use by the UIO core only.
30 */ 31 */
31struct uio_mem { 32struct uio_mem {
33 const char *name;
32 unsigned long addr; 34 unsigned long addr;
33 unsigned long size; 35 unsigned long size;
34 int memtype; 36 int memtype;
@@ -42,12 +44,14 @@ struct uio_portio;
42 44
43/** 45/**
44 * struct uio_port - description of a UIO port region 46 * struct uio_port - description of a UIO port region
47 * @name: name of the port region for identification
45 * @start: start of port region 48 * @start: start of port region
46 * @size: size of port region 49 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below) 50 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only. 51 * @portio: for use by the UIO core only.
49 */ 52 */
50struct uio_port { 53struct uio_port {
54 const char *name;
51 unsigned long start; 55 unsigned long start;
52 unsigned long size; 56 unsigned long size;
53 int porttype; 57 int porttype;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 88079fd60235..c6b2ab41b908 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -643,186 +643,6 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
643 643
644/*-------------------------------------------------------------------------*/ 644/*-------------------------------------------------------------------------*/
645 645
646/**
647 * usb_endpoint_num - get the endpoint's number
648 * @epd: endpoint to be checked
649 *
650 * Returns @epd's number: 0 to 15.
651 */
652static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
653{
654 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
655}
656
657/**
658 * usb_endpoint_type - get the endpoint's transfer type
659 * @epd: endpoint to be checked
660 *
661 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
662 * to @epd's transfer type.
663 */
664static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
665{
666 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
667}
668
669/**
670 * usb_endpoint_dir_in - check if the endpoint has IN direction
671 * @epd: endpoint to be checked
672 *
673 * Returns true if the endpoint is of type IN, otherwise it returns false.
674 */
675static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
676{
677 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
678}
679
680/**
681 * usb_endpoint_dir_out - check if the endpoint has OUT direction
682 * @epd: endpoint to be checked
683 *
684 * Returns true if the endpoint is of type OUT, otherwise it returns false.
685 */
686static inline int usb_endpoint_dir_out(
687 const struct usb_endpoint_descriptor *epd)
688{
689 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
690}
691
692/**
693 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
694 * @epd: endpoint to be checked
695 *
696 * Returns true if the endpoint is of type bulk, otherwise it returns false.
697 */
698static inline int usb_endpoint_xfer_bulk(
699 const struct usb_endpoint_descriptor *epd)
700{
701 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
702 USB_ENDPOINT_XFER_BULK);
703}
704
705/**
706 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
707 * @epd: endpoint to be checked
708 *
709 * Returns true if the endpoint is of type control, otherwise it returns false.
710 */
711static inline int usb_endpoint_xfer_control(
712 const struct usb_endpoint_descriptor *epd)
713{
714 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
715 USB_ENDPOINT_XFER_CONTROL);
716}
717
718/**
719 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
720 * @epd: endpoint to be checked
721 *
722 * Returns true if the endpoint is of type interrupt, otherwise it returns
723 * false.
724 */
725static inline int usb_endpoint_xfer_int(
726 const struct usb_endpoint_descriptor *epd)
727{
728 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
729 USB_ENDPOINT_XFER_INT);
730}
731
732/**
733 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
734 * @epd: endpoint to be checked
735 *
736 * Returns true if the endpoint is of type isochronous, otherwise it returns
737 * false.
738 */
739static inline int usb_endpoint_xfer_isoc(
740 const struct usb_endpoint_descriptor *epd)
741{
742 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
743 USB_ENDPOINT_XFER_ISOC);
744}
745
746/**
747 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
748 * @epd: endpoint to be checked
749 *
750 * Returns true if the endpoint has bulk transfer type and IN direction,
751 * otherwise it returns false.
752 */
753static inline int usb_endpoint_is_bulk_in(
754 const struct usb_endpoint_descriptor *epd)
755{
756 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
757}
758
759/**
760 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
761 * @epd: endpoint to be checked
762 *
763 * Returns true if the endpoint has bulk transfer type and OUT direction,
764 * otherwise it returns false.
765 */
766static inline int usb_endpoint_is_bulk_out(
767 const struct usb_endpoint_descriptor *epd)
768{
769 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
770}
771
772/**
773 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
774 * @epd: endpoint to be checked
775 *
776 * Returns true if the endpoint has interrupt transfer type and IN direction,
777 * otherwise it returns false.
778 */
779static inline int usb_endpoint_is_int_in(
780 const struct usb_endpoint_descriptor *epd)
781{
782 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
783}
784
785/**
786 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
787 * @epd: endpoint to be checked
788 *
789 * Returns true if the endpoint has interrupt transfer type and OUT direction,
790 * otherwise it returns false.
791 */
792static inline int usb_endpoint_is_int_out(
793 const struct usb_endpoint_descriptor *epd)
794{
795 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
796}
797
798/**
799 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
800 * @epd: endpoint to be checked
801 *
802 * Returns true if the endpoint has isochronous transfer type and IN direction,
803 * otherwise it returns false.
804 */
805static inline int usb_endpoint_is_isoc_in(
806 const struct usb_endpoint_descriptor *epd)
807{
808 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
809}
810
811/**
812 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
813 * @epd: endpoint to be checked
814 *
815 * Returns true if the endpoint has isochronous transfer type and OUT direction,
816 * otherwise it returns false.
817 */
818static inline int usb_endpoint_is_isoc_out(
819 const struct usb_endpoint_descriptor *epd)
820{
821 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
822}
823
824/*-------------------------------------------------------------------------*/
825
826#define USB_DEVICE_ID_MATCH_DEVICE \ 646#define USB_DEVICE_ID_MATCH_DEVICE \
827 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 647 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
828#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 648#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -1357,8 +1177,8 @@ struct urb {
1357 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1177 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1358 void *transfer_buffer; /* (in) associated data buffer */ 1178 void *transfer_buffer; /* (in) associated data buffer */
1359 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1179 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1360 int transfer_buffer_length; /* (in) data buffer length */ 1180 u32 transfer_buffer_length; /* (in) data buffer length */
1361 int actual_length; /* (return) actual transfer length */ 1181 u32 actual_length; /* (return) actual transfer length */
1362 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1182 unsigned char *setup_packet; /* (in) setup packet (control only) */
1363 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */ 1183 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
1364 int start_frame; /* (modify) start frame (ISO) */ 1184 int start_frame; /* (modify) start frame (ISO) */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 9b42baed3900..b145119a90da 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -102,7 +102,7 @@
102#define USB_REQ_LOOPBACK_DATA_READ 0x16 102#define USB_REQ_LOOPBACK_DATA_READ 0x16
103#define USB_REQ_SET_INTERFACE_DS 0x17 103#define USB_REQ_SET_INTERFACE_DS 0x17
104 104
105/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command, 105/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
106 * used by hubs to put ports into a new L1 suspend state, except that it 106 * used by hubs to put ports into a new L1 suspend state, except that it
107 * forgot to define its number ... 107 * forgot to define its number ...
108 */ 108 */
@@ -353,6 +353,185 @@ struct usb_endpoint_descriptor {
353#define USB_ENDPOINT_XFER_INT 3 353#define USB_ENDPOINT_XFER_INT 3
354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
355 355
356/*-------------------------------------------------------------------------*/
357
358/**
359 * usb_endpoint_num - get the endpoint's number
360 * @epd: endpoint to be checked
361 *
362 * Returns @epd's number: 0 to 15.
363 */
364static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
365{
366 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
367}
368
369/**
370 * usb_endpoint_type - get the endpoint's transfer type
371 * @epd: endpoint to be checked
372 *
373 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
374 * to @epd's transfer type.
375 */
376static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
377{
378 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
379}
380
381/**
382 * usb_endpoint_dir_in - check if the endpoint has IN direction
383 * @epd: endpoint to be checked
384 *
385 * Returns true if the endpoint is of type IN, otherwise it returns false.
386 */
387static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
388{
389 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
390}
391
392/**
393 * usb_endpoint_dir_out - check if the endpoint has OUT direction
394 * @epd: endpoint to be checked
395 *
396 * Returns true if the endpoint is of type OUT, otherwise it returns false.
397 */
398static inline int usb_endpoint_dir_out(
399 const struct usb_endpoint_descriptor *epd)
400{
401 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
402}
403
404/**
405 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
406 * @epd: endpoint to be checked
407 *
408 * Returns true if the endpoint is of type bulk, otherwise it returns false.
409 */
410static inline int usb_endpoint_xfer_bulk(
411 const struct usb_endpoint_descriptor *epd)
412{
413 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
414 USB_ENDPOINT_XFER_BULK);
415}
416
417/**
418 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
419 * @epd: endpoint to be checked
420 *
421 * Returns true if the endpoint is of type control, otherwise it returns false.
422 */
423static inline int usb_endpoint_xfer_control(
424 const struct usb_endpoint_descriptor *epd)
425{
426 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
427 USB_ENDPOINT_XFER_CONTROL);
428}
429
430/**
431 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
432 * @epd: endpoint to be checked
433 *
434 * Returns true if the endpoint is of type interrupt, otherwise it returns
435 * false.
436 */
437static inline int usb_endpoint_xfer_int(
438 const struct usb_endpoint_descriptor *epd)
439{
440 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
441 USB_ENDPOINT_XFER_INT);
442}
443
444/**
445 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
446 * @epd: endpoint to be checked
447 *
448 * Returns true if the endpoint is of type isochronous, otherwise it returns
449 * false.
450 */
451static inline int usb_endpoint_xfer_isoc(
452 const struct usb_endpoint_descriptor *epd)
453{
454 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
455 USB_ENDPOINT_XFER_ISOC);
456}
457
458/**
459 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
460 * @epd: endpoint to be checked
461 *
462 * Returns true if the endpoint has bulk transfer type and IN direction,
463 * otherwise it returns false.
464 */
465static inline int usb_endpoint_is_bulk_in(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
469}
470
471/**
472 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
473 * @epd: endpoint to be checked
474 *
475 * Returns true if the endpoint has bulk transfer type and OUT direction,
476 * otherwise it returns false.
477 */
478static inline int usb_endpoint_is_bulk_out(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
482}
483
484/**
485 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
486 * @epd: endpoint to be checked
487 *
488 * Returns true if the endpoint has interrupt transfer type and IN direction,
489 * otherwise it returns false.
490 */
491static inline int usb_endpoint_is_int_in(
492 const struct usb_endpoint_descriptor *epd)
493{
494 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
495}
496
497/**
498 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
499 * @epd: endpoint to be checked
500 *
501 * Returns true if the endpoint has interrupt transfer type and OUT direction,
502 * otherwise it returns false.
503 */
504static inline int usb_endpoint_is_int_out(
505 const struct usb_endpoint_descriptor *epd)
506{
507 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
508}
509
510/**
511 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
512 * @epd: endpoint to be checked
513 *
514 * Returns true if the endpoint has isochronous transfer type and IN direction,
515 * otherwise it returns false.
516 */
517static inline int usb_endpoint_is_isoc_in(
518 const struct usb_endpoint_descriptor *epd)
519{
520 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
521}
522
523/**
524 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
525 * @epd: endpoint to be checked
526 *
527 * Returns true if the endpoint has isochronous transfer type and OUT direction,
528 * otherwise it returns false.
529 */
530static inline int usb_endpoint_is_isoc_out(
531 const struct usb_endpoint_descriptor *epd)
532{
533 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
534}
356 535
357/*-------------------------------------------------------------------------*/ 536/*-------------------------------------------------------------------------*/
358 537
@@ -584,8 +763,8 @@ enum usb_device_state {
584 /* chapter 9 and authentication (wireless) device states */ 763 /* chapter 9 and authentication (wireless) device states */
585 USB_STATE_ATTACHED, 764 USB_STATE_ATTACHED,
586 USB_STATE_POWERED, /* wired */ 765 USB_STATE_POWERED, /* wired */
587 USB_STATE_UNAUTHENTICATED, /* auth */
588 USB_STATE_RECONNECTING, /* auth */ 766 USB_STATE_RECONNECTING, /* auth */
767 USB_STATE_UNAUTHENTICATED, /* auth */
589 USB_STATE_DEFAULT, /* limited function */ 768 USB_STATE_DEFAULT, /* limited function */
590 USB_STATE_ADDRESS, 769 USB_STATE_ADDRESS,
591 USB_STATE_CONFIGURED, /* most functions */ 770 USB_STATE_CONFIGURED, /* most functions */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 935c380ffe47..acd7b0f06c8a 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -244,6 +244,10 @@ int usb_add_config(struct usb_composite_dev *,
244 * value; it should return zero on successful initialization. 244 * value; it should return zero on successful initialization.
245 * @unbind: Reverses @bind(); called as a side effect of unregistering 245 * @unbind: Reverses @bind(); called as a side effect of unregistering
246 * this driver. 246 * this driver.
247 * @suspend: Notifies when the host stops sending USB traffic,
248 * after function notifications
249 * @resume: Notifies configuration when the host restarts USB traffic,
250 * before function notifications
247 * 251 *
248 * Devices default to reporting self powered operation. Devices which rely 252 * Devices default to reporting self powered operation. Devices which rely
249 * on bus powered operation should report this in their @bind() method. 253 * on bus powered operation should report this in their @bind() method.
@@ -268,6 +272,10 @@ struct usb_composite_driver {
268 272
269 int (*bind)(struct usb_composite_dev *); 273 int (*bind)(struct usb_composite_dev *);
270 int (*unbind)(struct usb_composite_dev *); 274 int (*unbind)(struct usb_composite_dev *);
275
276 /* global suspend hooks */
277 void (*suspend)(struct usb_composite_dev *);
278 void (*resume)(struct usb_composite_dev *);
271}; 279};
272 280
273extern int usb_composite_register(struct usb_composite_driver *); 281extern int usb_composite_register(struct usb_composite_driver *);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0460a746480c..bbf45d500b6d 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -598,6 +598,7 @@ static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
598/** 598/**
599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered 599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
600 * @gadget:The device which now has VBUS power. 600 * @gadget:The device which now has VBUS power.
601 * Context: can sleep
601 * 602 *
602 * This call is used by a driver for an external transceiver (or GPIO) 603 * This call is used by a driver for an external transceiver (or GPIO)
603 * that detects a VBUS power session starting. Common responses include 604 * that detects a VBUS power session starting. Common responses include
@@ -636,6 +637,7 @@ static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
636/** 637/**
637 * usb_gadget_vbus_disconnect - notify controller about VBUS session end 638 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
638 * @gadget:the device whose VBUS supply is being described 639 * @gadget:the device whose VBUS supply is being described
640 * Context: can sleep
639 * 641 *
640 * This call is used by a driver for an external transceiver (or GPIO) 642 * This call is used by a driver for an external transceiver (or GPIO)
641 * that detects a VBUS power session ending. Common responses include 643 * that detects a VBUS power session ending. Common responses include
@@ -792,19 +794,20 @@ struct usb_gadget_driver {
792/** 794/**
793 * usb_gadget_register_driver - register a gadget driver 795 * usb_gadget_register_driver - register a gadget driver
794 * @driver:the driver being registered 796 * @driver:the driver being registered
797 * Context: can sleep
795 * 798 *
796 * Call this in your gadget driver's module initialization function, 799 * Call this in your gadget driver's module initialization function,
797 * to tell the underlying usb controller driver about your driver. 800 * to tell the underlying usb controller driver about your driver.
798 * The driver's bind() function will be called to bind it to a 801 * The driver's bind() function will be called to bind it to a
799 * gadget before this registration call returns. It's expected that 802 * gadget before this registration call returns. It's expected that
800 * the bind() functions will be in init sections. 803 * the bind() functions will be in init sections.
801 * This function must be called in a context that can sleep.
802 */ 804 */
803int usb_gadget_register_driver(struct usb_gadget_driver *driver); 805int usb_gadget_register_driver(struct usb_gadget_driver *driver);
804 806
805/** 807/**
806 * usb_gadget_unregister_driver - unregister a gadget driver 808 * usb_gadget_unregister_driver - unregister a gadget driver
807 * @driver:the driver being unregistered 809 * @driver:the driver being unregistered
810 * Context: can sleep
808 * 811 *
809 * Call this in your gadget driver's module cleanup function, 812 * Call this in your gadget driver's module cleanup function,
810 * to tell the underlying usb controller that your driver is 813 * to tell the underlying usb controller that your driver is
@@ -813,7 +816,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver);
813 * to unbind() and clean up any device state, before this procedure 816 * to unbind() and clean up any device state, before this procedure
814 * finally returns. It's expected that the unbind() functions 817 * finally returns. It's expected that the unbind() functions
815 * will in in exit sections, so may not be linked in some kernels. 818 * will in in exit sections, so may not be linked in some kernels.
816 * This function must be called in a context that can sleep.
817 */ 819 */
818int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
819 821
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 94df4fe6c6c0..1aaa826396a1 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,12 +80,17 @@ struct otg_transceiver {
80 80
81/* for board-specific init logic */ 81/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 82extern int otg_set_transceiver(struct otg_transceiver *);
83#ifdef CONFIG_NOP_USB_XCEIV
84extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void);
86#endif
83 87
84 88
85/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 90extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *); 91extern void otg_put_transceiver(struct otg_transceiver *);
88 92
93/* Context: can sleep */
89static inline int 94static inline int
90otg_start_hnp(struct otg_transceiver *otg) 95otg_start_hnp(struct otg_transceiver *otg)
91{ 96{
@@ -102,6 +107,8 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
102 107
103 108
104/* for usb peripheral controller drivers */ 109/* for usb peripheral controller drivers */
110
111/* Context: can sleep */
105static inline int 112static inline int
106otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 113otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
107{ 114{
@@ -114,6 +121,7 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
114 return otg->set_power(otg, mA); 121 return otg->set_power(otg, mA);
115} 122}
116 123
124/* Context: can sleep */
117static inline int 125static inline int
118otg_set_suspend(struct otg_transceiver *otg, int suspend) 126otg_set_suspend(struct otg_transceiver *otg, int suspend)
119{ 127{
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 7f6c603db654..2526f3bbd273 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -16,4 +16,7 @@
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF 0x00000004
18 18
19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21
19#endif /* __LINUX_USB_QUIRKS_H */ 22#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 0a6e6d4b929a..37836b937d97 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -49,48 +49,45 @@ struct rndis_msg_hdr {
49 */ 49 */
50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) 50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
51 51
52 52#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
53#define ccpu2 __constant_cpu_to_le32
54
55#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
56 53
57/* codes for "msg_type" field of rndis messages; 54/* codes for "msg_type" field of rndis messages;
58 * only the data channel uses packet messages (maybe batched); 55 * only the data channel uses packet messages (maybe batched);
59 * everything else goes on the control channel. 56 * everything else goes on the control channel.
60 */ 57 */
61#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ 58#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
62#define RNDIS_MSG_INIT ccpu2(0x00000002) 59#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
63#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) 60#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
64#define RNDIS_MSG_HALT ccpu2(0x00000003) 61#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
65#define RNDIS_MSG_QUERY ccpu2(0x00000004) 62#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
66#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) 63#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
67#define RNDIS_MSG_SET ccpu2(0x00000005) 64#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
68#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) 65#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
69#define RNDIS_MSG_RESET ccpu2(0x00000006) 66#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
70#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) 67#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
71#define RNDIS_MSG_INDICATE ccpu2(0x00000007) 68#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
72#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) 69#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
73#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
74 71
75/* codes for "status" field of completion messages */ 72/* codes for "status" field of completion messages */
76#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) 73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
77#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001) 74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
78#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015) 75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
79#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb) 76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
80#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b) 77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
81#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c) 78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
82 79
83/* codes for OID_GEN_PHYSICAL_MEDIUM */ 80/* codes for OID_GEN_PHYSICAL_MEDIUM */
84#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000) 81#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
85#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001) 82#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
86#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002) 83#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
87#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003) 84#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
88#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004) 85#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
89#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005) 86#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
90#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006) 87#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
91#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007) 88#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
92#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008) 89#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
93#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009) 90#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
94 91
95struct rndis_data_hdr { 92struct rndis_data_hdr {
96 __le32 msg_type; /* RNDIS_MSG_PACKET */ 93 __le32 msg_type; /* RNDIS_MSG_PACKET */
@@ -228,24 +225,24 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
228 * there are gobs more that may optionally be supported. We'll avoid as much 225 * there are gobs more that may optionally be supported. We'll avoid as much
229 * of that mess as possible. 226 * of that mess as possible.
230 */ 227 */
231#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101) 228#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
232#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106) 229#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
233#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) 230#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
234#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202) 231#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
235 232
236/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ 233/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
237#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001) 234#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
238#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002) 235#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
239#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004) 236#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
240#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008) 237#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
241#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010) 238#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
242#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020) 239#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
243#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040) 240#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
244#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080) 241#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
245#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000) 242#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
246#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000) 243#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
247#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000) 244#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
248#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000) 245#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
249 246
250/* default filter used with RNDIS devices */ 247/* default filter used with RNDIS devices */
251#define RNDIS_DEFAULT_FILTER ( \ 248#define RNDIS_DEFAULT_FILTER ( \
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0b8617a9176d..b95842542590 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -130,7 +130,8 @@ struct usb_serial {
130 struct usb_device *dev; 130 struct usb_device *dev;
131 struct usb_serial_driver *type; 131 struct usb_serial_driver *type;
132 struct usb_interface *interface; 132 struct usb_interface *interface;
133 unsigned char disconnected; 133 unsigned char disconnected:1;
134 unsigned char suspending:1;
134 unsigned char minor; 135 unsigned char minor;
135 unsigned char num_ports; 136 unsigned char num_ports;
136 unsigned char num_port_pointers; 137 unsigned char num_port_pointers;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 7d3822243074..36fabb95c7d3 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of these */
176 size_t length; 176 size_t length;
177}; 177};
178 178
179extern int usbnet_open (struct net_device *net);
180extern int usbnet_stop (struct net_device *net);
181extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net);
182extern void usbnet_tx_timeout (struct net_device *net);
183extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
179 184
180extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
181extern void usbnet_defer_kevent (struct usbnet *, int); 186extern void usbnet_defer_kevent (struct usbnet *, int);
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 5f401b644ed5..429c631d2aad 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -80,8 +80,7 @@ struct wusb_ckhdid {
80 u8 data[16]; 80 u8 data[16];
81} __attribute__((packed)); 81} __attribute__((packed));
82 82
83const static 83static const struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
84struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
85 84
86#define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1) 85#define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1)
87 86
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1eea1ab68dc4..3d15fb9bc116 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -96,39 +96,26 @@ enum { US_DO_ALL_FLAGS };
96#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */ 96#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
97#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */ 97#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
98#define US_PR_BULK 0x50 /* bulk only */ 98#define US_PR_BULK 0x50 /* bulk only */
99#ifdef CONFIG_USB_STORAGE_USBAT 99
100#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */ 100#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
101#endif
102#ifdef CONFIG_USB_STORAGE_SDDR09
103#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ 101#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
104#endif
105#ifdef CONFIG_USB_STORAGE_SDDR55
106#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */ 102#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
107#endif
108#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ 103#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
109#ifdef CONFIG_USB_STORAGE_FREECOM
110#define US_PR_FREECOM 0xf1 /* Freecom */ 104#define US_PR_FREECOM 0xf1 /* Freecom */
111#endif
112#ifdef CONFIG_USB_STORAGE_DATAFAB
113#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */ 105#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
114#endif
115#ifdef CONFIG_USB_STORAGE_JUMPSHOT
116#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ 106#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
117#endif
118#ifdef CONFIG_USB_STORAGE_ALAUDA
119#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 107#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
120#endif
121#ifdef CONFIG_USB_STORAGE_KARMA
122#define US_PR_KARMA 0xf5 /* Rio Karma */ 108#define US_PR_KARMA 0xf5 /* Rio Karma */
123#endif
124 109
125#define US_PR_DEVICE 0xff /* Use device's value */ 110#define US_PR_DEVICE 0xff /* Use device's value */
126 111
127/* 112/*
128 */ 113 */
114extern int usb_usual_ignore_device(struct usb_interface *intf);
115extern struct usb_device_id usb_storage_usb_ids[];
116
129#ifdef CONFIG_USB_LIBUSUAL 117#ifdef CONFIG_USB_LIBUSUAL
130 118
131extern struct usb_device_id storage_usb_ids[];
132extern void usb_usual_set_present(int type); 119extern void usb_usual_set_present(int type);
133extern void usb_usual_clear_present(int type); 120extern void usb_usual_clear_present(int type);
134extern int usb_usual_check_type(const struct usb_device_id *, int type); 121extern int usb_usual_check_type(const struct usb_device_id *, int type);
diff --git a/include/linux/utime.h b/include/linux/utime.h
index 640be6a1959e..5cdf673afbdb 100644
--- a/include/linux/utime.h
+++ b/include/linux/utime.h
@@ -4,8 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct utimbuf { 6struct utimbuf {
7 time_t actime; 7 __kernel_time_t actime;
8 time_t modtime; 8 __kernel_time_t modtime;
9}; 9};
10 10
11#endif 11#endif
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
deleted file mode 100644
index e26c0c86a6ea..000000000000
--- a/include/linux/video_decoder.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H
3
4#include <linux/types.h>
5
6#define HAVE_VIDEO_DECODER 1
7
8struct video_decoder_capability { /* this name is too long */
9 __u32 flags;
10#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
11#define VIDEO_DECODER_NTSC 2 /* can decode NTSC */
12#define VIDEO_DECODER_SECAM 4 /* can decode SECAM */
13#define VIDEO_DECODER_AUTO 8 /* can autosense norm */
14#define VIDEO_DECODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
15 int inputs; /* number of inputs */
16 int outputs; /* number of outputs */
17};
18
19/*
20DECODER_GET_STATUS returns the following flags. The only one you need is
21DECODER_STATUS_GOOD, the others are just nice things to know.
22*/
23#define DECODER_STATUS_GOOD 1 /* receiving acceptable input */
24#define DECODER_STATUS_COLOR 2 /* receiving color information */
25#define DECODER_STATUS_PAL 4 /* auto detected */
26#define DECODER_STATUS_NTSC 8 /* auto detected */
27#define DECODER_STATUS_SECAM 16 /* auto detected */
28
29struct video_decoder_init {
30 unsigned char len;
31 const unsigned char *data;
32};
33
34#define DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability)
35#define DECODER_GET_STATUS _IOR('d', 2, int)
36#define DECODER_SET_NORM _IOW('d', 3, int)
37#define DECODER_SET_INPUT _IOW('d', 4, int) /* 0 <= input < #inputs */
38#define DECODER_SET_OUTPUT _IOW('d', 5, int) /* 0 <= output < #outputs */
39#define DECODER_ENABLE_OUTPUT _IOW('d', 6, int) /* boolean output enable control */
40#define DECODER_SET_PICTURE _IOW('d', 7, struct video_picture)
41#define DECODER_SET_GPIO _IOW('d', 8, int) /* switch general purpose pin */
42#define DECODER_INIT _IOW('d', 9, struct video_decoder_init) /* init internal registers at once */
43#define DECODER_SET_VBI_BYPASS _IOW('d', 10, int) /* switch vbi bypass */
44
45#define DECODER_DUMP _IO('d', 192) /* debug hook */
46
47
48#endif
diff --git a/include/linux/video_encoder.h b/include/linux/video_encoder.h
deleted file mode 100644
index b7b6423bbb8a..000000000000
--- a/include/linux/video_encoder.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _LINUX_VIDEO_ENCODER_H
2#define _LINUX_VIDEO_ENCODER_H
3
4#include <linux/types.h>
5
6struct video_encoder_capability { /* this name is too long */
7 __u32 flags;
8#define VIDEO_ENCODER_PAL 1 /* can encode PAL signal */
9#define VIDEO_ENCODER_NTSC 2 /* can encode NTSC */
10#define VIDEO_ENCODER_SECAM 4 /* can encode SECAM */
11#define VIDEO_ENCODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
12 int inputs; /* number of inputs */
13 int outputs; /* number of outputs */
14};
15
16#define ENCODER_GET_CAPABILITIES _IOR('e', 1, struct video_encoder_capability)
17#define ENCODER_SET_NORM _IOW('e', 2, int)
18#define ENCODER_SET_INPUT _IOW('e', 3, int) /* 0 <= input < #inputs */
19#define ENCODER_SET_OUTPUT _IOW('e', 4, int) /* 0 <= output < #outputs */
20#define ENCODER_ENABLE_OUTPUT _IOW('e', 5, int) /* boolean output enable control */
21
22
23#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 837f392fbe97..b19eab140977 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -16,6 +16,23 @@
16#include <linux/ioctl.h> 16#include <linux/ioctl.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18 18
19#if defined(__MIN_V4L1) && defined (__KERNEL__)
20
21/*
22 * Used by those V4L2 core functions that need a minimum V4L1 support,
23 * in order to allow V4L1 Compatibilty code compilation.
24 */
25
26struct video_mbuf
27{
28 int size; /* Total memory to map */
29 int frames; /* Frames */
30 int offsets[VIDEO_MAX_FRAME];
31};
32
33#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
34
35#else
19#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 36#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
20 37
21#define VID_TYPE_CAPTURE 1 /* Can capture */ 38#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -312,6 +329,7 @@ struct video_code
312#define VID_PLAY_END_MARK 14 329#define VID_PLAY_END_MARK 14
313 330
314#endif /* CONFIG_VIDEO_V4L1_COMPAT */ 331#endif /* CONFIG_VIDEO_V4L1_COMPAT */
332#endif /* __MIN_V4L1 */
315 333
316#endif /* __LINUX_VIDEODEV_H */ 334#endif /* __LINUX_VIDEODEV_H */
317 335
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5571dbe1c0ad..ebb2ea6b4995 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -344,6 +344,8 @@ struct v4l2_pix_format {
344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ 344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
347#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
348#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ 350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
349 351
@@ -735,6 +737,11 @@ struct v4l2_input {
735#define V4L2_IN_ST_NO_SIGNAL 0x00000002 737#define V4L2_IN_ST_NO_SIGNAL 0x00000002
736#define V4L2_IN_ST_NO_COLOR 0x00000004 738#define V4L2_IN_ST_NO_COLOR 0x00000004
737 739
740/* field 'status' - sensor orientation */
741/* If sensor is mounted upside down set both bits */
742#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
743#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
744
738/* field 'status' - analog */ 745/* field 'status' - analog */
739#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ 746#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
740#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ 747#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
@@ -829,6 +836,7 @@ struct v4l2_querymenu {
829#define V4L2_CTRL_FLAG_UPDATE 0x0008 836#define V4L2_CTRL_FLAG_UPDATE 0x0008
830#define V4L2_CTRL_FLAG_INACTIVE 0x0010 837#define V4L2_CTRL_FLAG_INACTIVE 0x0010
831#define V4L2_CTRL_FLAG_SLIDER 0x0020 838#define V4L2_CTRL_FLAG_SLIDER 0x0020
839#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
832 840
833/* Query flag, to be ORed with the control ID */ 841/* Query flag, to be ORed with the control ID */
834#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 842#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
@@ -879,8 +887,15 @@ enum v4l2_power_line_frequency {
879#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) 887#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
880#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) 888#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
881#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) 889#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
890#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
891enum v4l2_colorfx {
892 V4L2_COLORFX_NONE = 0,
893 V4L2_COLORFX_BW = 1,
894 V4L2_COLORFX_SEPIA = 2,
895};
896
882/* last CID + 1 */ 897/* last CID + 1 */
883#define V4L2_CID_LASTP1 (V4L2_CID_BASE+31) 898#define V4L2_CID_LASTP1 (V4L2_CID_BASE+32)
884 899
885/* MPEG-class control IDs defined by V4L2 */ 900/* MPEG-class control IDs defined by V4L2 */
886#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 901#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1339,6 +1354,53 @@ struct v4l2_sliced_vbi_data {
1339}; 1354};
1340 1355
1341/* 1356/*
1357 * Sliced VBI data inserted into MPEG Streams
1358 */
1359
1360/*
1361 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
1362 *
1363 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
1364 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
1365 * data
1366 *
1367 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
1368 * definitions are not included here. See the MPEG-2 specifications for details
1369 * on these headers.
1370 */
1371
1372/* Line type IDs */
1373#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
1374#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
1375#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
1376#define V4L2_MPEG_VBI_IVTV_VPS (7)
1377
1378struct v4l2_mpeg_vbi_itv0_line {
1379 __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
1380 __u8 data[42]; /* Sliced VBI data for the line */
1381} __attribute__ ((packed));
1382
1383struct v4l2_mpeg_vbi_itv0 {
1384 __le32 linemask[2]; /* Bitmasks of VBI service lines present */
1385 struct v4l2_mpeg_vbi_itv0_line line[35];
1386} __attribute__ ((packed));
1387
1388struct v4l2_mpeg_vbi_ITV0 {
1389 struct v4l2_mpeg_vbi_itv0_line line[36];
1390} __attribute__ ((packed));
1391
1392#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
1393#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
1394
1395struct v4l2_mpeg_vbi_fmt_ivtv {
1396 __u8 magic[4];
1397 union {
1398 struct v4l2_mpeg_vbi_itv0 itv0;
1399 struct v4l2_mpeg_vbi_ITV0 ITV0;
1400 };
1401} __attribute__ ((packed));
1402
1403/*
1342 * A G G R E G A T E S T R U C T U R E S 1404 * A G G R E G A T E S T R U C T U R E S
1343 */ 1405 */
1344 1406
@@ -1403,14 +1465,6 @@ struct v4l2_dbg_chip_ident {
1403 __u32 revision; /* chip revision, chip specific */ 1465 __u32 revision; /* chip revision, chip specific */
1404} __attribute__ ((packed)); 1466} __attribute__ ((packed));
1405 1467
1406/* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */
1407struct v4l2_chip_ident_old {
1408 __u32 match_type; /* Match type */
1409 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1410 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1411 __u32 revision; /* chip revision, chip specific */
1412};
1413
1414/* 1468/*
1415 * I O C T L C O D E S F O R V I D E O D E V I C E S 1469 * I O C T L C O D E S F O R V I D E O D E V I C E S
1416 * 1470 *
@@ -1488,8 +1542,6 @@ struct v4l2_chip_ident_old {
1488/* Experimental, meant for debugging, testing and internal use. 1542/* Experimental, meant for debugging, testing and internal use.
1489 Never use this ioctl in applications! */ 1543 Never use this ioctl in applications! */
1490#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) 1544#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1491/* This is deprecated and will go away in 2.6.30 */
1492#define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old)
1493#endif 1545#endif
1494 1546
1495#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1547#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 3efa86c3ecb3..242348bb3766 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -22,11 +22,19 @@
22#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 22#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
23#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 23#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
24#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ 24#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
25#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
26#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
27#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
28#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
29
30#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
25 31
26struct virtio_net_config 32struct virtio_net_config
27{ 33{
28 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 34 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
29 __u8 mac[6]; 35 __u8 mac[6];
36 /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
37 __u16 status;
30} __attribute__((packed)); 38} __attribute__((packed));
31 39
32/* This is the first element of the scatter-gather list. If you don't 40/* This is the first element of the scatter-gather list. If you don't
@@ -54,4 +62,67 @@ struct virtio_net_hdr_mrg_rxbuf {
54 __u16 num_buffers; /* Number of merged rx buffers */ 62 __u16 num_buffers; /* Number of merged rx buffers */
55}; 63};
56 64
65/*
66 * Control virtqueue data structures
67 *
68 * The control virtqueue expects a header in the first sg entry
69 * and an ack/status response in the last entry. Data for the
70 * command goes in between.
71 */
72struct virtio_net_ctrl_hdr {
73 __u8 class;
74 __u8 cmd;
75} __attribute__((packed));
76
77typedef __u8 virtio_net_ctrl_ack;
78
79#define VIRTIO_NET_OK 0
80#define VIRTIO_NET_ERR 1
81
82/*
83 * Control the RX mode, ie. promisucous and allmulti. PROMISC and
84 * ALLMULTI commands require an "out" sg entry containing a 1 byte
85 * state value, zero = disable, non-zero = enable. These commands
86 * are supported with the VIRTIO_NET_F_CTRL_RX feature.
87 */
88#define VIRTIO_NET_CTRL_RX 0
89 #define VIRTIO_NET_CTRL_RX_PROMISC 0
90 #define VIRTIO_NET_CTRL_RX_ALLMULTI 1
91
92/*
93 * Control the MAC filter table.
94 *
95 * The MAC filter table is managed by the hypervisor, the guest should
96 * assume the size is infinite. Filtering should be considered
97 * non-perfect, ie. based on hypervisor resources, the guest may
98 * received packets from sources not specified in the filter list.
99 *
100 * In addition to the class/cmd header, the TABLE_SET command requires
101 * two out scatterlists. Each contains a 4 byte count of entries followed
102 * by a concatenated byte stream of the ETH_ALEN MAC addresses. The
103 * first sg list contains unicast addresses, the second is for multicast.
104 * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature
105 * is available.
106 */
107struct virtio_net_ctrl_mac {
108 __u32 entries;
109 __u8 macs[][ETH_ALEN];
110} __attribute__((packed));
111
112#define VIRTIO_NET_CTRL_MAC 1
113 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
114
115/*
116 * Control VLAN filtering
117 *
118 * The VLAN filter table is controlled via a simple ADD/DEL interface.
119 * VLAN IDs not added may be filterd by the hypervisor. Del is the
120 * opposite of add. Both commands expect an out entry containing a 2
121 * byte VLAN ID. VLAN filterting is available with the
122 * VIRTIO_NET_F_CTRL_VLAN feature bit.
123 */
124#define VIRTIO_NET_CTRL_VLAN 2
125 #define VIRTIO_NET_CTRL_VLAN_ADD 0
126 #define VIRTIO_NET_CTRL_VLAN_DEL 1
127
57#endif /* _LINUX_VIRTIO_NET_H */ 128#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a210ede73b56..5d631c17eaee 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -135,8 +135,11 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
135void __wake_up_common(wait_queue_head_t *q, unsigned int mode, 135void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
136 int nr_exclusive, int sync, void *key); 136 int nr_exclusive, int sync, void *key);
137void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 137void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
138extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); 138void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
139extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 139void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr,
140 void *key);
141void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
142void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
140void __wake_up_bit(wait_queue_head_t *, void *, int); 143void __wake_up_bit(wait_queue_head_t *, void *, int);
141int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 144int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
142int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 145int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
@@ -155,21 +158,17 @@ wait_queue_head_t *bit_waitqueue(void *, int);
155#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) 158#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
156#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) 159#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1)
157 160
158#ifdef CONFIG_DEBUG_LOCK_ALLOC
159/* 161/*
160 * macro to avoid include hell 162 * Wakeup macros to be used to report events to the targets.
161 */ 163 */
162#define wake_up_nested(x, s) \ 164#define wake_up_poll(x, m) \
163do { \ 165 __wake_up(x, TASK_NORMAL, 1, (void *) (m))
164 unsigned long flags; \ 166#define wake_up_locked_poll(x, m) \
165 \ 167 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
166 spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \ 168#define wake_up_interruptible_poll(x, m) \
167 wake_up_locked(x); \ 169 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
168 spin_unlock_irqrestore(&(x)->lock, flags); \ 170#define wake_up_interruptible_sync_poll(x, m) \
169} while (0) 171 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
170#else
171#define wake_up_nested(x, s) wake_up(x)
172#endif
173 172
174#define __wait_event(wq, condition) \ 173#define __wait_event(wq, condition) \
175do { \ 174do { \
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index ba0c49399a83..c703e0340423 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -178,7 +178,7 @@ void __d_head(char *head, size_t head_size,
178 WARN_ON(1); 178 WARN_ON(1);
179 } else 179 } else
180 snprintf(head, head_size, "%s %s: ", 180 snprintf(head, head_size, "%s %s: ",
181 dev_driver_string(dev), dev->bus_id); 181 dev_driver_string(dev), dev_name(dev));
182} 182}
183 183
184 184
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
index 74198f5bb4dc..d5148a7889a6 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/linux/wimax/i2400m.h
@@ -207,6 +207,7 @@ enum i2400m_pt {
207 I2400M_PT_TRACE, /* For device debug */ 207 I2400M_PT_TRACE, /* For device debug */
208 I2400M_PT_RESET_WARM, /* device reset */ 208 I2400M_PT_RESET_WARM, /* device reset */
209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ 209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
210 I2400M_PT_EDATA, /* Extended RX data */
210 I2400M_PT_ILLEGAL 211 I2400M_PT_ILLEGAL
211}; 212};
212 213
@@ -221,6 +222,48 @@ struct i2400m_pl_data_hdr {
221} __attribute__((packed)); 222} __attribute__((packed));
222 223
223 224
225/*
226 * Payload for an extended data packet
227 *
228 * New in fw v1.4
229 *
230 * @reorder: if this payload has to be reorder or not (and how)
231 * @cs: the type of data in the packet, as defined per (802.16e
232 * T11.13.19.1). Currently only 2 (IPv4 packet) supported.
233 *
234 * This is prefixed to each and every INCOMING DATA packet.
235 */
236struct i2400m_pl_edata_hdr {
237 __le32 reorder; /* bits defined in i2400m_ro */
238 __u8 cs;
239 __u8 reserved[11];
240} __attribute__((packed));
241
242enum i2400m_cs {
243 I2400M_CS_IPV4_0 = 0,
244 I2400M_CS_IPV4 = 2,
245};
246
247enum i2400m_ro {
248 I2400M_RO_NEEDED = 0x01,
249 I2400M_RO_TYPE = 0x03,
250 I2400M_RO_TYPE_SHIFT = 1,
251 I2400M_RO_CIN = 0x0f,
252 I2400M_RO_CIN_SHIFT = 4,
253 I2400M_RO_FBN = 0x07ff,
254 I2400M_RO_FBN_SHIFT = 8,
255 I2400M_RO_SN = 0x07ff,
256 I2400M_RO_SN_SHIFT = 21,
257};
258
259enum i2400m_ro_type {
260 I2400M_RO_TYPE_RESET = 0,
261 I2400M_RO_TYPE_PACKET,
262 I2400M_RO_TYPE_WS,
263 I2400M_RO_TYPE_PACKET_WS,
264};
265
266
224/* Misc constants */ 267/* Misc constants */
225enum { 268enum {
226 I2400M_PL_PAD = 16, /* Payload data size alignment */ 269 I2400M_PL_PAD = 16, /* Payload data size alignment */
@@ -381,6 +424,9 @@ enum i2400m_tlv {
381 I2400M_TLV_RF_STATUS = 163, 424 I2400M_TLV_RF_STATUS = 163,
382 I2400M_TLV_DEVICE_RESET_TYPE = 132, 425 I2400M_TLV_DEVICE_RESET_TYPE = 132,
383 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, 426 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
427 I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611,
428 I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614,
429 I2400M_TLV_CONFIG_DL_HOST_REORDER = 615,
384}; 430};
385 431
386 432
@@ -509,4 +555,27 @@ struct i2400m_tlv_media_status {
509 __le32 media_status; 555 __le32 media_status;
510} __attribute__((packed)); 556} __attribute__((packed));
511 557
558
559/* New in v1.4 */
560struct i2400m_tlv_config_idle_timeout {
561 struct i2400m_tlv_hdr hdr;
562 __le32 timeout; /* 100 to 300000 ms [5min], 100 increments
563 * 0 disabled */
564} __attribute__((packed));
565
566/* New in v1.4 -- for backward compat, will be removed */
567struct i2400m_tlv_config_d2h_data_format {
568 struct i2400m_tlv_hdr hdr;
569 __u8 format; /* 0 old format, 1 enhanced */
570 __u8 reserved[3];
571} __attribute__((packed));
572
573/* New in v1.4 */
574struct i2400m_tlv_config_dl_host_reorder {
575 struct i2400m_tlv_hdr hdr;
576 __u8 reorder; /* 0 disabled, 1 enabled */
577 __u8 reserved[3];
578} __attribute__((packed));
579
580
512#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ 581#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index d7958f9b52cb..cb24204851f7 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -577,18 +577,22 @@
577#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 577#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
578#define IW_AUTH_ROAMING_CONTROL 9 578#define IW_AUTH_ROAMING_CONTROL 9
579#define IW_AUTH_PRIVACY_INVOKED 10 579#define IW_AUTH_PRIVACY_INVOKED 10
580#define IW_AUTH_CIPHER_GROUP_MGMT 11
581#define IW_AUTH_MFP 12
580 582
581/* IW_AUTH_WPA_VERSION values (bit field) */ 583/* IW_AUTH_WPA_VERSION values (bit field) */
582#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 584#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
583#define IW_AUTH_WPA_VERSION_WPA 0x00000002 585#define IW_AUTH_WPA_VERSION_WPA 0x00000002
584#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 586#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
585 587
586/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */ 588/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
589 * values (bit field) */
587#define IW_AUTH_CIPHER_NONE 0x00000001 590#define IW_AUTH_CIPHER_NONE 0x00000001
588#define IW_AUTH_CIPHER_WEP40 0x00000002 591#define IW_AUTH_CIPHER_WEP40 0x00000002
589#define IW_AUTH_CIPHER_TKIP 0x00000004 592#define IW_AUTH_CIPHER_TKIP 0x00000004
590#define IW_AUTH_CIPHER_CCMP 0x00000008 593#define IW_AUTH_CIPHER_CCMP 0x00000008
591#define IW_AUTH_CIPHER_WEP104 0x00000010 594#define IW_AUTH_CIPHER_WEP104 0x00000010
595#define IW_AUTH_CIPHER_AES_CMAC 0x00000020
592 596
593/* IW_AUTH_KEY_MGMT values (bit field) */ 597/* IW_AUTH_KEY_MGMT values (bit field) */
594#define IW_AUTH_KEY_MGMT_802_1X 1 598#define IW_AUTH_KEY_MGMT_802_1X 1
@@ -604,6 +608,11 @@
604#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming 608#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
605 * control */ 609 * control */
606 610
611/* IW_AUTH_MFP (management frame protection) values */
612#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */
613#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */
614#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */
615
607/* SIOCSIWENCODEEXT definitions */ 616/* SIOCSIWENCODEEXT definitions */
608#define IW_ENCODE_SEQ_MAX_SIZE 8 617#define IW_ENCODE_SEQ_MAX_SIZE 8
609/* struct iw_encode_ext ->alg */ 618/* struct iw_encode_ext ->alg */
@@ -612,6 +621,7 @@
612#define IW_ENCODE_ALG_TKIP 2 621#define IW_ENCODE_ALG_TKIP 2
613#define IW_ENCODE_ALG_CCMP 3 622#define IW_ENCODE_ALG_CCMP 3
614#define IW_ENCODE_ALG_PMK 4 623#define IW_ENCODE_ALG_PMK 4
624#define IW_ENCODE_ALG_AES_CMAC 5
615/* struct iw_encode_ext ->ext_flags */ 625/* struct iw_encode_ext ->ext_flags */
616#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 626#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
617#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 627#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 3cd51e579ab1..13e1adf55c4c 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -41,6 +41,11 @@ struct delayed_work {
41 struct timer_list timer; 41 struct timer_list timer;
42}; 42};
43 43
44static inline struct delayed_work *to_delayed_work(struct work_struct *work)
45{
46 return container_of(work, struct delayed_work, work);
47}
48
44struct execute_work { 49struct execute_work {
45 struct work_struct work; 50 struct work_struct work;
46}; 51};
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 7300ecdc480c..9c1ed1fb6ddb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -109,8 +109,8 @@ extern int dirty_background_ratio;
109extern unsigned long dirty_background_bytes; 109extern unsigned long dirty_background_bytes;
110extern int vm_dirty_ratio; 110extern int vm_dirty_ratio;
111extern unsigned long vm_dirty_bytes; 111extern unsigned long vm_dirty_bytes;
112extern int dirty_writeback_interval; 112extern unsigned int dirty_writeback_interval;
113extern int dirty_expire_interval; 113extern unsigned int dirty_expire_interval;
114extern int vm_highmem_is_dirtyable; 114extern int vm_highmem_is_dirtyable;
115extern int block_dump; 115extern int block_dump;
116extern int laptop_mode; 116extern int laptop_mode;
@@ -168,6 +168,8 @@ void writeback_set_ratelimit(void);
168/* pdflush.c */ 168/* pdflush.c */
169extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 169extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
170 read-only. */ 170 read-only. */
171extern int nr_pdflush_threads_max; /* Global so it can be exported to sysctl */
172extern int nr_pdflush_threads_min; /* Global so it can be exported to sysctl */
171 173
172 174
173#endif /* WRITEBACK_H */ 175#endif /* WRITEBACK_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 52f3abd453a1..2d4ec15abaca 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -58,7 +58,7 @@ struct xfrm_selector
58 __u8 prefixlen_s; 58 __u8 prefixlen_s;
59 __u8 proto; 59 __u8 proto;
60 int ifindex; 60 int ifindex;
61 uid_t user; 61 __kernel_uid32_t user;
62}; 62};
63 63
64#define XFRM_INF (~(__u64)0) 64#define XFRM_INF (~(__u64)0)
diff --git a/include/media/bt819.h b/include/media/bt819.h
new file mode 100644
index 000000000000..38f666bde77a
--- /dev/null
+++ b/include/media/bt819.h
@@ -0,0 +1,33 @@
1/*
2 bt819.h - bt819 notifications
3
4 Copyright (C) 2009 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _BT819_H_
22#define _BT819_H_
23
24#include <linux/ioctl.h>
25
26/* v4l2_device notifications. */
27
28/* Needed to reset the FIFO buffer when changing the input
29 or the video standard. */
30#define BT819_FIFO_RESET_LOW _IO('b', 0)
31#define BT819_FIFO_RESET_HIGH _IO('b', 1)
32
33#endif
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ec4d5889ef5..9ebe8558b9b6 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 cx23415/6 header containing common defines. 2 cx23415/6/8 header containing common defines.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@ enum cx2341x_port {
28enum cx2341x_cap { 28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, 29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30 CX2341X_CAP_HAS_TS = 1 << 1, 30 CX2341X_CAP_HAS_TS = 1 << 1,
31 CX2341X_CAP_HAS_AC3 = 1 << 2,
31}; 32};
32 33
33struct cx2341x_mpeg_params { 34struct cx2341x_mpeg_params {
@@ -47,11 +48,12 @@ struct cx2341x_mpeg_params {
47 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 48 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
48 enum v4l2_mpeg_audio_encoding audio_encoding; 49 enum v4l2_mpeg_audio_encoding audio_encoding;
49 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate; 50 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
51 enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate;
50 enum v4l2_mpeg_audio_mode audio_mode; 52 enum v4l2_mpeg_audio_mode audio_mode;
51 enum v4l2_mpeg_audio_mode_extension audio_mode_extension; 53 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
52 enum v4l2_mpeg_audio_emphasis audio_emphasis; 54 enum v4l2_mpeg_audio_emphasis audio_emphasis;
53 enum v4l2_mpeg_audio_crc audio_crc; 55 enum v4l2_mpeg_audio_crc audio_crc;
54 u16 audio_properties; 56 u32 audio_properties;
55 u16 audio_mute; 57 u16 audio_mute;
56 58
57 /* video */ 59 /* video */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index db431d513f2f..2c3fbaa33f74 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -21,6 +21,18 @@
21#ifndef _CX25840_H_ 21#ifndef _CX25840_H_
22#define _CX25840_H_ 22#define _CX25840_H_
23 23
24/* Note that the cx25840 driver requires that the bridge driver calls the
25 v4l2_subdev's init operation in order to load the driver's firmware.
26 Without this the audio standard detection will fail and you will
27 only get mono.
28
29 Since loading the firmware is often problematic when the driver is
30 compiled into the kernel I recommend postponing calling this function
31 until the first open of the video device. Another reason for
32 postponing it is that loading this firmware takes a long time (seconds)
33 due to the slow i2c bus speed. So it will speed up the boot process if
34 you can avoid loading the fw as long as the video device isn't used. */
35
24enum cx25840_video_input { 36enum cx25840_video_input {
25 /* Composite video inputs In1-In8 */ 37 /* Composite video inputs In1-In8 */
26 CX25840_COMPOSITE1 = 1, 38 CX25840_COMPOSITE1 = 1,
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 5bf2ea00678c..7b5b91f60425 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -111,6 +111,7 @@ extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; 113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 115extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
115extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 116extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
116extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 117extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE];
@@ -159,6 +160,8 @@ extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; 160extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
160extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE]; 161extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE];
161extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE]; 162extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE];
163extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE];
164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE];
162#endif 165#endif
163 166
164/* 167/*
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 00fa57eb9fde..07963d705400 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -14,8 +14,7 @@ struct IR_i2c {
14 /* Used to avoid fast repeating */ 14 /* Used to avoid fast repeating */
15 unsigned char old; 15 unsigned char old;
16 16
17 struct work_struct work; 17 struct delayed_work work;
18 struct timer_list timer;
19 char phys[32]; 18 char phys[32];
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 19 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 20};
diff --git a/include/media/msp3400.h b/include/media/msp3400.h
index 6ab854931c05..90cf22ada8b4 100644
--- a/include/media/msp3400.h
+++ b/include/media/msp3400.h
@@ -54,13 +54,13 @@
54 ======= 54 =======
55 55
56 So to specify a complete routing scheme for the msp3400 you will have to 56 So to specify a complete routing scheme for the msp3400 you will have to
57 specify in the 'input' field of the v4l2_routing struct: 57 specify in the 'input' arg of the s_routing function:
58 58
59 1) which tuner input to use 59 1) which tuner input to use
60 2) which SCART input to use 60 2) which SCART input to use
61 3) which DSP input to use for each DSP output 61 3) which DSP input to use for each DSP output
62 62
63 And in the 'output' field of the v4l2_routing struct you specify: 63 And in the 'output' arg of the s_routing function you specify:
64 64
65 1) which SCART input to use for each SCART output 65 1) which SCART input to use for each SCART output
66 66
diff --git a/include/media/ov772x.h b/include/media/ov772x.h
index e391d55edb95..30d9629198ef 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -13,9 +13,49 @@
13 13
14#include <media/soc_camera.h> 14#include <media/soc_camera.h>
15 15
16/* for flags */
17#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */
18#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */
19
20/*
21 * for Edge ctrl
22 *
23 * strength also control Auto or Manual Edge Control Mode
24 * see also OV772X_MANUAL_EDGE_CTRL
25 */
26struct ov772x_edge_ctrl {
27 unsigned char strength;
28 unsigned char threshold;
29 unsigned char upper;
30 unsigned char lower;
31};
32
33#define OV772X_MANUAL_EDGE_CTRL 0x80 /* un-used bit of strength */
34#define EDGE_STRENGTH_MASK 0x1F
35#define EDGE_THRESHOLD_MASK 0x0F
36#define EDGE_UPPER_MASK 0xFF
37#define EDGE_LOWER_MASK 0xFF
38
39#define OV772X_AUTO_EDGECTRL(u, l) \
40{ \
41 .upper = (u & EDGE_UPPER_MASK), \
42 .lower = (l & EDGE_LOWER_MASK), \
43}
44
45#define OV772X_MANUAL_EDGECTRL(s, t) \
46{ \
47 .strength = (s & EDGE_STRENGTH_MASK) | OV772X_MANUAL_EDGE_CTRL,\
48 .threshold = (t & EDGE_THRESHOLD_MASK), \
49}
50
51/*
52 * ov772x camera info
53 */
16struct ov772x_camera_info { 54struct ov772x_camera_info {
17 unsigned long buswidth; 55 unsigned long buswidth;
56 unsigned long flags;
18 struct soc_camera_link link; 57 struct soc_camera_link link;
58 struct ov772x_edge_ctrl edgectrl;
19}; 59};
20 60
21#endif /* __OV772X_H__ */ 61#endif /* __OV772X_H__ */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index c5a6e22a4b37..7a9f76ecbbbd 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -13,11 +13,12 @@
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <media/v4l2-device.h>
16 17
17#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
18#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
19 20
20#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ 21#define SAA7146_VERSION_CODE 0x000600 /* 0.6.0 */
21 22
22#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 23#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
23#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 24#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
@@ -110,6 +111,8 @@ struct saa7146_dev
110 111
111 struct list_head item; 112 struct list_head item;
112 113
114 struct v4l2_device v4l2_dev;
115
113 /* different device locks */ 116 /* different device locks */
114 spinlock_t slock; 117 spinlock_t slock;
115 struct mutex lock; 118 struct mutex lock;
@@ -145,6 +148,11 @@ struct saa7146_dev
145 struct saa7146_dma d_rps1; 148 struct saa7146_dma d_rps1;
146}; 149};
147 150
151static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
152{
153 return container_of(v4l2_dev, struct saa7146_dev, v4l2_dev);
154}
155
148/* from saa7146_i2c.c */ 156/* from saa7146_i2c.c */
149int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 157int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
150 158
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index c8d0b23fde29..eed5fccc83f3 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -150,16 +150,6 @@ struct saa7146_vv
150 unsigned int resources; /* resource management for device */ 150 unsigned int resources; /* resource management for device */
151}; 151};
152 152
153#define SAA7146_EXCLUSIVE 0x1
154#define SAA7146_BEFORE 0x2
155#define SAA7146_AFTER 0x4
156
157struct saa7146_extension_ioctls
158{
159 unsigned int cmd;
160 int flags;
161};
162
163/* flags */ 153/* flags */
164#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ 154#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */
165 155
@@ -176,8 +166,10 @@ struct saa7146_ext_vv
176 int num_stds; 166 int num_stds;
177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 167 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
178 168
179 struct saa7146_extension_ioctls *ioctls; 169 /* the extension can override this */
180 long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg); 170 struct v4l2_ioctl_ops ops;
171 /* pointer to the saa7146 core ops */
172 const struct v4l2_ioctl_ops *core_ops;
181 173
182 struct v4l2_file_operations vbi_fops; 174 struct v4l2_file_operations vbi_fops;
183}; 175};
@@ -213,6 +205,7 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sy
213void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); 205void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
214 206
215/* from saa7146_video.c */ 207/* from saa7146_video.c */
208extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
216extern struct saa7146_use_ops saa7146_video_uops; 209extern struct saa7146_use_ops saa7146_video_uops;
217int saa7146_start_preview(struct saa7146_fh *fh); 210int saa7146_start_preview(struct saa7146_fh *fh);
218int saa7146_stop_preview(struct saa7146_fh *fh); 211int saa7146_stop_preview(struct saa7146_fh *fh);
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b5dbefea3740..0f3524cff435 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -1,10 +1,11 @@
1#ifndef __ASM_SH_MOBILE_CEU_H__ 1#ifndef __ASM_SH_MOBILE_CEU_H__
2#define __ASM_SH_MOBILE_CEU_H__ 2#define __ASM_SH_MOBILE_CEU_H__
3 3
4#include <media/soc_camera.h> 4#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */
5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
5 6
6struct sh_mobile_ceu_info { 7struct sh_mobile_ceu_info {
7 unsigned long flags; /* SOCAM_... */ 8 unsigned long flags;
8}; 9};
9 10
10#endif /* __ASM_SH_MOBILE_CEU_H__ */ 11#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7440d9250665..37013688af44 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -45,6 +45,7 @@ struct soc_camera_device {
45 int num_formats; 45 int num_formats;
46 struct soc_camera_format_xlate *user_formats; 46 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats; 47 int num_user_formats;
48 enum v4l2_field field; /* Preserve field over close() */
48 struct module *owner; 49 struct module *owner;
49 void *host_priv; /* Per-device host private data */ 50 void *host_priv; /* Per-device host private data */
50 /* soc_camera.c private count. Only accessed with .video_lock held */ 51 /* soc_camera.c private count. Only accessed with .video_lock held */
@@ -74,7 +75,8 @@ struct soc_camera_host_ops {
74 int (*resume)(struct soc_camera_device *); 75 int (*resume)(struct soc_camera_device *);
75 int (*get_formats)(struct soc_camera_device *, int, 76 int (*get_formats)(struct soc_camera_device *, int,
76 struct soc_camera_format_xlate *); 77 struct soc_camera_format_xlate *);
77 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 78 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
79 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 80 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 81 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 82 struct soc_camera_device *);
@@ -93,13 +95,18 @@ struct soc_camera_host_ops {
93struct soc_camera_link { 95struct soc_camera_link {
94 /* Camera bus id, used to match a camera and a bus */ 96 /* Camera bus id, used to match a camera and a bus */
95 int bus_id; 97 int bus_id;
96 /* GPIO number to switch between 8 and 10 bit modes */
97 unsigned int gpio;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 98 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 99 unsigned long flags;
100 /* Optional callbacks to power on or off and reset the sensor */ 100 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 101 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 102 int (*reset)(struct device *);
103 /*
104 * some platforms may support different data widths than the sensors
105 * native ones due to different data line routing. Let the board code
106 * overwrite the width flags.
107 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *);
103}; 110};
104 111
105static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -159,7 +166,8 @@ struct soc_camera_ops {
159 int (*release)(struct soc_camera_device *); 166 int (*release)(struct soc_camera_device *);
160 int (*start_capture)(struct soc_camera_device *); 167 int (*start_capture)(struct soc_camera_device *);
161 int (*stop_capture)(struct soc_camera_device *); 168 int (*stop_capture)(struct soc_camera_device *);
162 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 169 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
170 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
163 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 171 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
164 unsigned long (*query_bus_param)(struct soc_camera_device *); 172 unsigned long (*query_bus_param)(struct soc_camera_device *);
165 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 173 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
@@ -239,15 +247,19 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
239static inline unsigned long soc_camera_bus_param_compatible( 247static inline unsigned long soc_camera_bus_param_compatible(
240 unsigned long camera_flags, unsigned long bus_flags) 248 unsigned long camera_flags, unsigned long bus_flags)
241{ 249{
242 unsigned long common_flags, hsync, vsync, pclk; 250 unsigned long common_flags, hsync, vsync, pclk, data, buswidth, mode;
243 251
244 common_flags = camera_flags & bus_flags; 252 common_flags = camera_flags & bus_flags;
245 253
246 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW); 254 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
247 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW); 255 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
248 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING); 256 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
257 data = common_flags & (SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW);
258 mode = common_flags & (SOCAM_MASTER | SOCAM_SLAVE);
259 buswidth = common_flags & SOCAM_DATAWIDTH_MASK;
249 260
250 return (!hsync || !vsync || !pclk) ? 0 : common_flags; 261 return (!hsync || !vsync || !pclk || !data || !mode || !buswidth) ? 0 :
262 common_flags;
251} 263}
252 264
253extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 265extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h
index 6915aafc875a..1ac8184693f8 100644
--- a/include/media/tvaudio.h
+++ b/include/media/tvaudio.h
@@ -21,10 +21,29 @@
21#ifndef _TVAUDIO_H 21#ifndef _TVAUDIO_H
22#define _TVAUDIO_H 22#define _TVAUDIO_H
23 23
24#include <media/i2c-addr.h>
25
24/* The tvaudio module accepts the following inputs: */ 26/* The tvaudio module accepts the following inputs: */
25#define TVAUDIO_INPUT_TUNER 0 27#define TVAUDIO_INPUT_TUNER 0
26#define TVAUDIO_INPUT_RADIO 1 28#define TVAUDIO_INPUT_RADIO 1
27#define TVAUDIO_INPUT_EXTERN 2 29#define TVAUDIO_INPUT_EXTERN 2
28#define TVAUDIO_INPUT_INTERN 3 30#define TVAUDIO_INPUT_INTERN 3
29 31
32static inline const unsigned short *tvaudio_addrs(void)
33{
34 static const unsigned short addrs[] = {
35 I2C_ADDR_TDA8425 >> 1,
36 I2C_ADDR_TEA6300 >> 1,
37 I2C_ADDR_TEA6420 >> 1,
38 I2C_ADDR_TDA9840 >> 1,
39 I2C_ADDR_TDA985x_L >> 1,
40 I2C_ADDR_TDA985x_H >> 1,
41 I2C_ADDR_TDA9874 >> 1,
42 I2C_ADDR_PIC16C54 >> 1,
43 I2C_CLIENT_END
44 };
45
46 return addrs;
47}
48
30#endif 49#endif
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 9aaf652b20ef..1be461a29077 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -37,10 +37,8 @@ enum {
37 /* module saa7110: just ident 100 */ 37 /* module saa7110: just ident 100 */
38 V4L2_IDENT_SAA7110 = 100, 38 V4L2_IDENT_SAA7110 = 100,
39 39
40 /* module saa7111: just ident 101 */ 40 /* module saa7115: reserved range 101-149 */
41 V4L2_IDENT_SAA7111 = 101, 41 V4L2_IDENT_SAA7111 = 101,
42
43 /* module saa7115: reserved range 102-149 */
44 V4L2_IDENT_SAA7113 = 103, 42 V4L2_IDENT_SAA7113 = 103,
45 V4L2_IDENT_SAA7114 = 104, 43 V4L2_IDENT_SAA7114 = 104,
46 V4L2_IDENT_SAA7115 = 105, 44 V4L2_IDENT_SAA7115 = 105,
@@ -63,44 +61,96 @@ enum {
63 V4L2_IDENT_OV7720 = 251, 61 V4L2_IDENT_OV7720 = 251,
64 V4L2_IDENT_OV7725 = 252, 62 V4L2_IDENT_OV7725 = 252,
65 63
66 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 64 /* module saa7146: reserved range 300-309 */
65 V4L2_IDENT_SAA7146 = 300,
66
67 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
68 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
67 V4L2_IDENT_CX23415 = 415, 69 V4L2_IDENT_CX23415 = 415,
68 V4L2_IDENT_CX23416 = 416, 70 V4L2_IDENT_CX23416 = 416,
69 V4L2_IDENT_CX23418 = 418, 71 V4L2_IDENT_CX23418 = 418,
70 72
73 /* module au0828 */
74 V4L2_IDENT_AU0828 = 828,
75
76 /* module indycam: just ident 2000 */
77 V4L2_IDENT_INDYCAM = 2000,
78
79 /* module bt819: reserved range 810-819 */
80 V4L2_IDENT_BT815A = 815,
81 V4L2_IDENT_BT817A = 817,
82 V4L2_IDENT_BT819A = 819,
83
84 /* module bt856: just ident 856 */
85 V4L2_IDENT_BT856 = 856,
86
87 /* module bt866: just ident 866 */
88 V4L2_IDENT_BT866 = 866,
89
90 /* module ks0127: reserved range 1120-1129 */
91 V4L2_IDENT_KS0122S = 1122,
92 V4L2_IDENT_KS0127 = 1127,
93 V4L2_IDENT_KS0127B = 1128,
94
71 /* module vp27smpx: just ident 2700 */ 95 /* module vp27smpx: just ident 2700 */
72 V4L2_IDENT_VP27SMPX = 2700, 96 V4L2_IDENT_VP27SMPX = 2700,
73 97
98 /* module vpx3220: reserved range: 3210-3229 */
99 V4L2_IDENT_VPX3214C = 3214,
100 V4L2_IDENT_VPX3216B = 3216,
101 V4L2_IDENT_VPX3220A = 3220,
102
74 /* module tvp5150 */ 103 /* module tvp5150 */
75 V4L2_IDENT_TVP5150 = 5150, 104 V4L2_IDENT_TVP5150 = 5150,
76 105
106 /* module saa5246a: just ident 5246 */
107 V4L2_IDENT_SAA5246A = 5246,
108
109 /* module saa5249: just ident 5249 */
110 V4L2_IDENT_SAA5249 = 5249,
111
77 /* module cs5345: just ident 5345 */ 112 /* module cs5345: just ident 5345 */
78 V4L2_IDENT_CS5345 = 5345, 113 V4L2_IDENT_CS5345 = 5345,
79 114
115 /* module tea6415c: just ident 6415 */
116 V4L2_IDENT_TEA6415C = 6415,
117
118 /* module tea6420: just ident 6420 */
119 V4L2_IDENT_TEA6420 = 6420,
120
121 /* module saa6588: just ident 6588 */
122 V4L2_IDENT_SAA6588 = 6588,
123
80 /* module saa6752hs: reserved range 6750-6759 */ 124 /* module saa6752hs: reserved range 6750-6759 */
81 V4L2_IDENT_SAA6752HS = 6752, 125 V4L2_IDENT_SAA6752HS = 6752,
82 V4L2_IDENT_SAA6752HS_AC3 = 6753, 126 V4L2_IDENT_SAA6752HS_AC3 = 6753,
83 127
128 /* module adv7170: just ident 7170 */
129 V4L2_IDENT_ADV7170 = 7170,
130
131 /* module adv7175: just ident 7175 */
132 V4L2_IDENT_ADV7175 = 7175,
133
134 /* module saa7185: just ident 7185 */
135 V4L2_IDENT_SAA7185 = 7185,
136
137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191,
139
84 /* module wm8739: just ident 8739 */ 140 /* module wm8739: just ident 8739 */
85 V4L2_IDENT_WM8739 = 8739, 141 V4L2_IDENT_WM8739 = 8739,
86 142
87 /* module wm8775: just ident 8775 */ 143 /* module wm8775: just ident 8775 */
88 V4L2_IDENT_WM8775 = 8775, 144 V4L2_IDENT_WM8775 = 8775,
89 145
90 /* module tw9910: just ident 9910 */ 146 /* module tda9840: just ident 9840 */
91 V4L2_IDENT_TW9910 = 9910, 147 V4L2_IDENT_TDA9840 = 9840,
92
93 /* module cs53132a: just ident 53132 */
94 V4L2_IDENT_CS53l32A = 53132,
95
96 /* module upd64031a: just ident 64031 */
97 V4L2_IDENT_UPD64031A = 64031,
98 148
99 /* module upd64083: just ident 64083 */ 149 /* module cafe_ccic, just ident 8801 */
100 V4L2_IDENT_UPD64083 = 64083, 150 V4L2_IDENT_CAFE = 8801,
101 151
102 /* module m52790: just ident 52790 */ 152 /* module tw9910: just ident 9910 */
103 V4L2_IDENT_M52790 = 52790, 153 V4L2_IDENT_TW9910 = 9910,
104 154
105 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 155 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
106 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 156 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
@@ -178,6 +228,18 @@ enum {
178 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 228 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
179 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 229 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
180 V4L2_IDENT_MT9T031 = 45020, 230 V4L2_IDENT_MT9T031 = 45020,
231
232 /* module cs53132a: just ident 53132 */
233 V4L2_IDENT_CS53l32A = 53132,
234
235 /* module upd64031a: just ident 64031 */
236 V4L2_IDENT_UPD64031A = 64031,
237
238 /* module upd64083: just ident 64083 */
239 V4L2_IDENT_UPD64083 = 64083,
240
241 /* module m52790: just ident 52790 */
242 V4L2_IDENT_M52790 = 52790,
181}; 243};
182 244
183#endif 245#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 95e74f1874e1..c48c24e4d0fa 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -102,11 +102,15 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
102const char *v4l2_ctrl_get_name(u32 id); 102const char *v4l2_ctrl_get_name(u32 id);
103const char **v4l2_ctrl_get_menu(u32 id); 103const char **v4l2_ctrl_get_menu(u32 id);
104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
105int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
106int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 105int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
107 struct v4l2_queryctrl *qctrl, const char **menu_items); 106 struct v4l2_queryctrl *qctrl, const char **menu_items);
108#define V4L2_CTRL_MENU_IDS_END (0xffffffff) 107#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
109int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); 108int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
109
110/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
111 0-terminated array of control IDs. Each array must be sorted low to high
112 and belong to the same control class. The array of u32 pointers must also
113 be sorted, from low class IDs to high class IDs. */
110u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); 114u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
111 115
112/* ------------------------------------------------------------------------- */ 116/* ------------------------------------------------------------------------- */
@@ -121,7 +125,7 @@ int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
121 125
122/* ------------------------------------------------------------------------- */ 126/* ------------------------------------------------------------------------- */
123 127
124/* Helper function for I2C legacy drivers */ 128/* I2C Helper functions */
125 129
126struct i2c_driver; 130struct i2c_driver;
127struct i2c_adapter; 131struct i2c_adapter;
@@ -131,157 +135,62 @@ struct v4l2_device;
131struct v4l2_subdev; 135struct v4l2_subdev;
132struct v4l2_subdev_ops; 136struct v4l2_subdev_ops;
133 137
134int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
135 const char *name,
136 int (*probe)(struct i2c_client *, const struct i2c_device_id *));
137 138
138/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
139 Only call request_module if module_name != NULL. 140 Only call request_module if module_name != NULL.
140 The client_type argument is the name of the chip that's on the adapter. */ 141 The client_type argument is the name of the chip that's on the adapter. */
141struct v4l2_subdev *v4l2_i2c_new_subdev(struct i2c_adapter *adapter, 142struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
143 struct i2c_adapter *adapter,
142 const char *module_name, const char *client_type, u8 addr); 144 const char *module_name, const char *client_type, u8 addr);
143/* Probe and load an i2c module and return an initialized v4l2_subdev struct. 145/* Probe and load an i2c module and return an initialized v4l2_subdev struct.
144 Only call request_module if module_name != NULL. 146 Only call request_module if module_name != NULL.
145 The client_type argument is the name of the chip that's on the adapter. */ 147 The client_type argument is the name of the chip that's on the adapter. */
146struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct i2c_adapter *adapter, 148struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter,
147 const char *module_name, const char *client_type, 150 const char *module_name, const char *client_type,
148 const unsigned short *addrs); 151 const unsigned short *addrs);
152/* Like v4l2_i2c_new_probed_subdev, except probe for a single address. */
153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev,
154 struct i2c_adapter *adapter,
155 const char *module_name, const char *client_type, u8 addr);
149/* Initialize an v4l2_subdev with data from an i2c_client struct */ 156/* Initialize an v4l2_subdev with data from an i2c_client struct */
150void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 157void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
151 const struct v4l2_subdev_ops *ops); 158 const struct v4l2_subdev_ops *ops);
159/* Return i2c client address of v4l2_subdev. */
160unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
161
162enum v4l2_i2c_tuner_type {
163 ADDRS_RADIO, /* Radio tuner addresses */
164 ADDRS_DEMOD, /* Demod tuner addresses */
165 ADDRS_TV, /* TV tuner addresses */
166 /* TV tuner addresses if demod is present, this excludes
167 addresses used by the demodulator from the list of
168 candidates. */
169 ADDRS_TV_WITH_DEMOD,
170};
171/* Return a list of I2C tuner addresses to probe. Use only if the tuner
172 addresses are unknown. */
173const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
152 174
153/* ------------------------------------------------------------------------- */ 175/* ------------------------------------------------------------------------- */
154 176
155/* Internal ioctls */ 177/* Note: these remaining ioctls/structs should be removed as well, but they are
156 178 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
157/* VIDIOC_INT_DECODE_VBI_LINE */ 179 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
158struct v4l2_decode_vbi_line { 180 is needed in those modules. */
159 u32 is_second_field; /* Set to 0 for the first (odd) field,
160 set to 1 for the second (even) field. */
161 u8 *p; /* Pointer to the sliced VBI data from the decoder.
162 On exit points to the start of the payload. */
163 u32 line; /* Line number of the sliced VBI data (1-23) */
164 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
165};
166 181
182/* s_config */
167struct v4l2_priv_tun_config { 183struct v4l2_priv_tun_config {
168 int tuner; 184 int tuner;
169 void *priv; 185 void *priv;
170}; 186};
171
172/* audio ioctls */
173
174/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
175#define AUDC_SET_RADIO _IO('d',88)
176
177/* tuner ioctls */
178
179/* Sets tuner type and its I2C addr */
180#define TUNER_SET_TYPE_ADDR _IOW('d', 90, int)
181
182/* Puts tuner on powersaving state, disabling it, except for i2c. To be replaced
183 by VIDIOC_INT_S_STANDBY. */
184#define TUNER_SET_STANDBY _IOW('d', 91, int)
185
186/* Sets tda9887 specific stuff, like port1, port2 and qss */
187#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config) 187#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config)
188 188
189/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */
190#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type)
191
192/* Generic standby command. Passing -1 (all bits set to 1) will put the whole
193 chip into standby mode, value 0 will make the chip fully active. Specific
194 bits can be used by certain chips to enable/disable specific subsystems.
195 Replacement of TUNER_SET_STANDBY. */
196#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
197
198/* 100, 101 used by VIDIOC_DBG_[SG]_REGISTER */
199
200/* Generic reset command. The argument selects which subsystems to reset.
201 Passing 0 will always reset the whole chip. */
202#define VIDIOC_INT_RESET _IOW ('d', 102, u32) 189#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
203 190
204/* Set the frequency (in Hz) of the audio clock output.
205 Used to slave an audio processor to the video decoder, ensuring that audio
206 and video remain synchronized.
207 Usual values for the frequency are 48000, 44100 or 32000 Hz.
208 If the frequency is not supported, then -EINVAL is returned. */
209#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32)
210
211/* Video decoders that support sliced VBI need to implement this ioctl.
212 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI
213 data that was generated by the decoder. The driver then parses the sliced
214 VBI data and sets the other fields in the struct accordingly. The pointer p
215 is updated to point to the start of the payload which can be copied
216 verbatim into the data field of the v4l2_sliced_vbi_data struct. If no
217 valid VBI data was found, then the type field is set to 0 on return. */
218#define VIDIOC_INT_DECODE_VBI_LINE _IOWR('d', 104, struct v4l2_decode_vbi_line)
219
220/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
221 filled with the data packets that should be output. Note that if you set
222 the line field to 0, then that VBI signal is disabled. If no
223 valid VBI data was found, then the type field is set to 0 on return. */
224#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data)
225
226/* Used to obtain the sliced VBI packet from a readback register. Not all
227 video decoders support this. If no data is available because the readback
228 register contains invalid or erroneous data -EIO is returned. Note that
229 you must fill in the 'id' member and the 'field' member (to determine
230 whether CC data from the first or second field should be obtained). */
231#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
232
233/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
234 clock used by driving digital audio streams at some board designs.
235 Usual values for the frequency are 1024000 and 2048000.
236 If the frequency is not supported, then -EINVAL is returned. */
237#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
238
239/* Routing definition, device dependent. It specifies which inputs (if any)
240 should be routed to which outputs (if any). */
241struct v4l2_routing { 191struct v4l2_routing {
242 u32 input; 192 u32 input;
243 u32 output; 193 u32 output;
244}; 194};
245 195
246/* These internal commands should be used to define the inputs and outputs
247 of an audio/video chip. They will replace the v4l2 API commands
248 VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT
249 that are meant to be used by the user.
250 The internal commands should be used to switch inputs/outputs
251 because only the driver knows how to map a 'Television' input to the precise
252 input/output routing of an A/D converter, or a DSP, or a video digitizer.
253 These four commands should only be sent directly to an i2c device, they
254 should not be broadcast as the routing is very device specific. */
255#define VIDIOC_INT_S_AUDIO_ROUTING _IOW ('d', 109, struct v4l2_routing)
256#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing)
257#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
258#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
259
260struct v4l2_crystal_freq {
261 u32 freq; /* frequency in Hz of the crystal */
262 u32 flags; /* device specific flags */
263};
264
265/* Sets the frequency of the crystal used to generate the clocks.
266 An extra flags field allows device specific configuration regarding
267 clock frequency dividers, etc. If not used, then set flags to 0.
268 If the frequency is not supported, then -EINVAL is returned. */
269#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW('d', 113, struct v4l2_crystal_freq)
270
271/* Initialize the sensor registors to some sort of reasonable
272 default values. */
273#define VIDIOC_INT_INIT _IOW('d', 114, u32)
274
275/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
276 video input devices. */
277#define VIDIOC_INT_S_STD_OUTPUT _IOW('d', 115, v4l2_std_id)
278
279/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
280 video input devices. */
281#define VIDIOC_INT_G_STD_OUTPUT _IOW('d', 116, v4l2_std_id)
282
283/* Set GPIO pins. Very simple right now, might need to be extended with
284 a v4l2_gpio struct if a direction is also needed. */
285#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
286
287#endif /* V4L2_COMMON_H_ */ 196#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index e36faab8459b..2058dd45e915 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -40,6 +40,8 @@ struct v4l2_file_operations {
40 unsigned int (*poll) (struct file *, struct poll_table_struct *); 40 unsigned int (*poll) (struct file *, struct poll_table_struct *);
41 long (*ioctl) (struct file *, unsigned int, unsigned long); 41 long (*ioctl) (struct file *, unsigned int, unsigned long);
42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
43 unsigned long (*get_unmapped_area) (struct file *, unsigned long,
44 unsigned long, unsigned long, unsigned long);
43 int (*mmap) (struct file *, struct vm_area_struct *); 45 int (*mmap) (struct file *, struct vm_area_struct *);
44 int (*open) (struct file *); 46 int (*open) (struct file *);
45 int (*release) (struct file *); 47 int (*release) (struct file *);
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 55e41afd95ef..0dd3e8e8653e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -33,7 +33,9 @@
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16)
34 34
35struct v4l2_device { 35struct v4l2_device {
36 /* dev->driver_data points to this struct */ 36 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device
38 as is the case with e.g. ISA devices. */
37 struct device *dev; 39 struct device *dev;
38 /* used to keep track of the registered subdevs */ 40 /* used to keep track of the registered subdevs */
39 struct list_head subdevs; 41 struct list_head subdevs;
@@ -42,33 +44,43 @@ struct v4l2_device {
42 spinlock_t lock; 44 spinlock_t lock;
43 /* unique device name, by default the driver name + bus ID */ 45 /* unique device name, by default the driver name + bus ID */
44 char name[V4L2_DEVICE_NAME_SIZE]; 46 char name[V4L2_DEVICE_NAME_SIZE];
47 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg);
45}; 50};
46 51
47/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev */ 52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
53 dev may be NULL in rare cases (ISA devices). In that case you
54 must fill in the v4l2_dev->name field before calling this function. */
48int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); 55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
49/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */ 56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
57 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */
50void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 61void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
51 62
52/* Register a subdev with a v4l2 device. While registered the subdev module 63/* Register a subdev with a v4l2 device. While registered the subdev module
53 is marked as in-use. An error is returned if the module is no longer 64 is marked as in-use. An error is returned if the module is no longer
54 loaded when you attempt to register it. */ 65 loaded when you attempt to register it. */
55int __must_check v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd); 66int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
67 struct v4l2_subdev *sd);
56/* Unregister a subdev with a v4l2 device. Can also be called if the subdev 68/* Unregister a subdev with a v4l2 device. Can also be called if the subdev
57 wasn't registered. In that case it will do nothing. */ 69 wasn't registered. In that case it will do nothing. */
58void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); 70void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
59 71
60/* Iterate over all subdevs. */ 72/* Iterate over all subdevs. */
61#define v4l2_device_for_each_subdev(sd, dev) \ 73#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
62 list_for_each_entry(sd, &(dev)->subdevs, list) 74 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
63 75
64/* Call the specified callback for all subdevs matching the condition. 76/* Call the specified callback for all subdevs matching the condition.
65 Ignore any errors. Note that you cannot add or delete a subdev 77 Ignore any errors. Note that you cannot add or delete a subdev
66 while walking the subdevs list. */ 78 while walking the subdevs list. */
67#define __v4l2_device_call_subdevs(dev, cond, o, f, args...) \ 79#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \
68 do { \ 80 do { \
69 struct v4l2_subdev *sd; \ 81 struct v4l2_subdev *sd; \
70 \ 82 \
71 list_for_each_entry(sd, &(dev)->subdevs, list) \ 83 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) \
72 if ((cond) && sd->ops->o && sd->ops->o->f) \ 84 if ((cond) && sd->ops->o && sd->ops->o->f) \
73 sd->ops->o->f(sd , ##args); \ 85 sd->ops->o->f(sd , ##args); \
74 } while (0) 86 } while (0)
@@ -77,12 +89,12 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
77 If the callback returns an error other than 0 or -ENOIOCTLCMD, then 89 If the callback returns an error other than 0 or -ENOIOCTLCMD, then
78 return with that error code. Note that you cannot add or delete a 90 return with that error code. Note that you cannot add or delete a
79 subdev while walking the subdevs list. */ 91 subdev while walking the subdevs list. */
80#define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ 92#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \
81({ \ 93({ \
82 struct v4l2_subdev *sd; \ 94 struct v4l2_subdev *sd; \
83 long err = 0; \ 95 long err = 0; \
84 \ 96 \
85 list_for_each_entry(sd, &(dev)->subdevs, list) { \ 97 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) { \
86 if ((cond) && sd->ops->o && sd->ops->o->f) \ 98 if ((cond) && sd->ops->o && sd->ops->o->f) \
87 err = sd->ops->o->f(sd , ##args); \ 99 err = sd->ops->o->f(sd , ##args); \
88 if (err && err != -ENOIOCTLCMD) \ 100 if (err && err != -ENOIOCTLCMD) \
@@ -94,16 +106,16 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
94/* Call the specified callback for all subdevs matching grp_id (if 0, then 106/* Call the specified callback for all subdevs matching grp_id (if 0, then
95 match them all). Ignore any errors. Note that you cannot add or delete 107 match them all). Ignore any errors. Note that you cannot add or delete
96 a subdev while walking the subdevs list. */ 108 a subdev while walking the subdevs list. */
97#define v4l2_device_call_all(dev, grpid, o, f, args...) \ 109#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \
98 __v4l2_device_call_subdevs(dev, \ 110 __v4l2_device_call_subdevs(v4l2_dev, \
99 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 111 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
100 112
101/* Call the specified callback for all subdevs matching grp_id (if 0, then 113/* Call the specified callback for all subdevs matching grp_id (if 0, then
102 match them all). If the callback returns an error other than 0 or 114 match them all). If the callback returns an error other than 0 or
103 -ENOIOCTLCMD, then return with that error code. Note that you cannot 115 -ENOIOCTLCMD, then return with that error code. Note that you cannot
104 add or delete a subdev while walking the subdevs list. */ 116 add or delete a subdev while walking the subdevs list. */
105#define v4l2_device_call_until_err(dev, grpid, o, f, args...) \ 117#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \
106 __v4l2_device_call_subdevs_until_err(dev, \ 118 __v4l2_device_call_subdevs_until_err(v4l2_dev, \
107 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 119 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
108 120
109#endif 121#endif
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
deleted file mode 100644
index e65dd9d84e8b..000000000000
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * v4l2-i2c-drv-legacy.h - contains I2C handling code that's identical
3 * for all V4L2 I2C drivers. Use this header if the
4 * I2C driver is used by both legacy drivers and
5 * drivers converted to the bus-based I2C API.
6 *
7 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
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 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
35struct v4l2_i2c_driver_data {
36 const char * const name;
37 int driverid;
38 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
39 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
40 int (*remove)(struct i2c_client *client);
41 int (*suspend)(struct i2c_client *client, pm_message_t state);
42 int (*resume)(struct i2c_client *client);
43 int (*legacy_probe)(struct i2c_adapter *adapter);
44 int legacy_class;
45 const struct i2c_device_id *id_table;
46};
47
48static struct v4l2_i2c_driver_data v4l2_i2c_data;
49static const struct i2c_client_address_data addr_data;
50static struct i2c_driver v4l2_i2c_driver_legacy;
51static char v4l2_i2c_drv_name_legacy[32];
52
53static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind)
54{
55 return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy,
56 v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe);
57}
58
59static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
60{
61 if (v4l2_i2c_data.legacy_probe) {
62 if (v4l2_i2c_data.legacy_probe(adapter))
63 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
64 return 0;
65 }
66 if (adapter->class & v4l2_i2c_data.legacy_class)
67 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
68 return 0;
69}
70
71static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
72{
73 int err;
74
75 if (v4l2_i2c_data.remove)
76 v4l2_i2c_data.remove(client);
77
78 err = i2c_detach_client(client);
79 if (err)
80 return err;
81 kfree(client);
82 return 0;
83}
84
85static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state)
86{
87 return v4l2_i2c_data.suspend ? v4l2_i2c_data.suspend(client, state) : 0;
88}
89
90static int v4l2_i2c_drv_resume_helper(struct i2c_client *client)
91{
92 return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0;
93}
94
95/* ----------------------------------------------------------------------- */
96
97/* i2c implementation */
98static struct i2c_driver v4l2_i2c_driver_legacy = {
99 .driver = {
100 .owner = THIS_MODULE,
101 },
102 .attach_adapter = v4l2_i2c_drv_probe_legacy,
103 .detach_client = v4l2_i2c_drv_detach_legacy,
104 .suspend = v4l2_i2c_drv_suspend_helper,
105 .resume = v4l2_i2c_drv_resume_helper,
106};
107
108/* ----------------------------------------------------------------------- */
109
110/* i2c implementation */
111static struct i2c_driver v4l2_i2c_driver = {
112 .suspend = v4l2_i2c_drv_suspend_helper,
113 .resume = v4l2_i2c_drv_resume_helper,
114};
115
116static int __init v4l2_i2c_drv_init(void)
117{
118 int err;
119
120 strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy));
121 strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy));
122
123 if (v4l2_i2c_data.legacy_class == 0)
124 v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG;
125
126 v4l2_i2c_driver_legacy.driver.name = v4l2_i2c_drv_name_legacy;
127 v4l2_i2c_driver_legacy.id = v4l2_i2c_data.driverid;
128 v4l2_i2c_driver_legacy.command = v4l2_i2c_data.command;
129 err = i2c_add_driver(&v4l2_i2c_driver_legacy);
130
131 if (err)
132 return err;
133 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
134 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
135 v4l2_i2c_driver.command = v4l2_i2c_data.command;
136 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
137 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
138 v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table;
139 err = i2c_add_driver(&v4l2_i2c_driver);
140 if (err)
141 i2c_del_driver(&v4l2_i2c_driver_legacy);
142 return err;
143}
144
145static void __exit v4l2_i2c_drv_cleanup(void)
146{
147 i2c_del_driver(&v4l2_i2c_driver_legacy);
148 i2c_del_driver(&v4l2_i2c_driver);
149}
150
151module_init(v4l2_i2c_drv_init);
152module_exit(v4l2_i2c_drv_cleanup);
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index efdc8bf27f87..10a2882c3cbf 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -39,14 +39,11 @@
39 39
40struct v4l2_i2c_driver_data { 40struct v4l2_i2c_driver_data {
41 const char * const name; 41 const char * const name;
42 int driverid;
43 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); 42 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
44 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); 43 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
45 int (*remove)(struct i2c_client *client); 44 int (*remove)(struct i2c_client *client);
46 int (*suspend)(struct i2c_client *client, pm_message_t state); 45 int (*suspend)(struct i2c_client *client, pm_message_t state);
47 int (*resume)(struct i2c_client *client); 46 int (*resume)(struct i2c_client *client);
48 int (*legacy_probe)(struct i2c_adapter *adapter);
49 int legacy_class;
50 const struct i2c_device_id *id_table; 47 const struct i2c_device_id *id_table;
51}; 48};
52 49
@@ -54,12 +51,11 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data;
54static struct i2c_driver v4l2_i2c_driver; 51static struct i2c_driver v4l2_i2c_driver;
55 52
56 53
57/* Bus-based I2C implementation for kernels >= 2.6.22 */ 54/* Bus-based I2C implementation for kernels >= 2.6.26 */
58 55
59static int __init v4l2_i2c_drv_init(void) 56static int __init v4l2_i2c_drv_init(void)
60{ 57{
61 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name; 58 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
62 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
63 v4l2_i2c_driver.command = v4l2_i2c_data.command; 59 v4l2_i2c_driver.command = v4l2_i2c_data.command;
64 v4l2_i2c_driver.probe = v4l2_i2c_data.probe; 60 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
65 v4l2_i2c_driver.remove = v4l2_i2c_data.remove; 61 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index b01c044868d0..7a4529defa88 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -15,6 +15,7 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */ 16#include <linux/compiler.h> /* need __user */
17#ifdef CONFIG_VIDEO_V4L1_COMPAT 17#ifdef CONFIG_VIDEO_V4L1_COMPAT
18#define __MIN_V4L1
18#include <linux/videodev.h> 19#include <linux/videodev.h>
19#else 20#else
20#include <linux/videodev2.h> 21#include <linux/videodev2.h>
@@ -267,6 +268,7 @@ struct v4l2_ioctl_ops {
267 268
268/* Video standard functions */ 269/* Video standard functions */
269extern const char *v4l2_norm_to_name(v4l2_std_id id); 270extern const char *v4l2_norm_to_name(v4l2_std_id id);
271extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
270extern int v4l2_video_std_construct(struct v4l2_standard *vs, 272extern int v4l2_video_std_construct(struct v4l2_standard *vs,
271 int id, const char *name); 273 int id, const char *name);
272/* Prints the ioctl in a human-readable format */ 274/* Prints the ioctl in a human-readable format */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 37b09e56e943..17856081c809 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -27,6 +27,16 @@ struct v4l2_device;
27struct v4l2_subdev; 27struct v4l2_subdev;
28struct tuner_setup; 28struct tuner_setup;
29 29
30/* decode_vbi_line */
31struct v4l2_decode_vbi_line {
32 u32 is_second_field; /* Set to 0 for the first (odd) field,
33 set to 1 for the second (even) field. */
34 u8 *p; /* Pointer to the sliced VBI data from the decoder.
35 On exit points to the start of the payload. */
36 u32 line; /* Line number of the sliced VBI data (1-23) */
37 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
38};
39
30/* Sub-devices are devices that are connected somehow to the main bridge 40/* Sub-devices are devices that are connected somehow to the main bridge
31 device. These devices are usually audio/video muxers/encoders/decoders or 41 device. These devices are usually audio/video muxers/encoders/decoders or
32 sensors and webcam controllers. 42 sensors and webcam controllers.
@@ -68,17 +78,36 @@ struct tuner_setup;
68 the use-case it might be better to use subdev-specific ops (currently 78 the use-case it might be better to use subdev-specific ops (currently
69 not yet implemented) since ops provide proper type-checking. 79 not yet implemented) since ops provide proper type-checking.
70 */ 80 */
81
82/* init: initialize the sensor registors to some sort of reasonable default
83 values. Do not use for new drivers and should be removed in existing
84 drivers.
85
86 load_fw: load firmware.
87
88 reset: generic reset command. The argument selects which subsystems to
89 reset. Passing 0 will always reset the whole chip. Do not use for new
90 drivers without discussing this first on the linux-media mailinglist.
91 There should be no reason normally to reset a device.
92
93 s_gpio: set GPIO pins. Very simple right now, might need to be extended with
94 a direction argument if needed.
95 */
71struct v4l2_subdev_core_ops { 96struct v4l2_subdev_core_ops {
72 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 97 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
73 int (*log_status)(struct v4l2_subdev *sd); 98 int (*log_status)(struct v4l2_subdev *sd);
74 int (*init)(struct v4l2_subdev *sd, u32 val); 99 int (*init)(struct v4l2_subdev *sd, u32 val);
75 int (*s_standby)(struct v4l2_subdev *sd, u32 standby); 100 int (*load_fw)(struct v4l2_subdev *sd);
76 int (*reset)(struct v4l2_subdev *sd, u32 val); 101 int (*reset)(struct v4l2_subdev *sd, u32 val);
77 int (*s_gpio)(struct v4l2_subdev *sd, u32 val); 102 int (*s_gpio)(struct v4l2_subdev *sd, u32 val);
78 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); 103 int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 104 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 105 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
106 int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
107 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
108 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
81 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 109 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
110 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
82 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 111 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
83#ifdef CONFIG_VIDEO_ADV_DEBUG 112#ifdef CONFIG_VIDEO_ADV_DEBUG
84 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 113 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
@@ -86,6 +115,16 @@ struct v4l2_subdev_core_ops {
86#endif 115#endif
87}; 116};
88 117
118/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
119
120 s_radio: v4l device was opened in Radio mode, to be replaced by s_mode.
121
122 s_type_addr: sets tuner type and its I2C addr.
123
124 s_config: sets tda9887 specific stuff, like port1, port2 and qss
125
126 s_standby: puts tuner on powersaving state, disabling it, except for i2c.
127 */
89struct v4l2_subdev_tuner_ops { 128struct v4l2_subdev_tuner_ops {
90 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 129 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
91 int (*s_radio)(struct v4l2_subdev *sd); 130 int (*s_radio)(struct v4l2_subdev *sd);
@@ -93,28 +132,93 @@ struct v4l2_subdev_tuner_ops {
93 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 132 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
94 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 133 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
95 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 134 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
96 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
97 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 135 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
98 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 136 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
137 int (*s_standby)(struct v4l2_subdev *sd);
99}; 138};
100 139
140/* s_clock_freq: set the frequency (in Hz) of the audio clock output.
141 Used to slave an audio processor to the video decoder, ensuring that
142 audio and video remain synchronized. Usual values for the frequency
143 are 48000, 44100 or 32000 Hz. If the frequency is not supported, then
144 -EINVAL is returned.
145
146 s_i2s_clock_freq: sets I2S speed in bps. This is used to provide a standard
147 way to select I2S clock used by driving digital audio streams at some
148 board designs. Usual values for the frequency are 1024000 and 2048000.
149 If the frequency is not supported, then -EINVAL is returned.
150
151 s_routing: used to define the input and/or output pins of an audio chip,
152 and any additional configuration data.
153 Never attempt to use user-level input IDs (e.g. Composite, S-Video,
154 Tuner) at this level. An i2c device shouldn't know about whether an
155 input pin is connected to a Composite connector, become on another
156 board or platform it might be connected to something else entirely.
157 The calling driver is responsible for mapping a user-level input to
158 the right pins on the i2c device.
159 */
101struct v4l2_subdev_audio_ops { 160struct v4l2_subdev_audio_ops {
102 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 161 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
103 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 162 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
104 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); 163 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
105}; 164};
106 165
166/*
167 decode_vbi_line: video decoders that support sliced VBI need to implement
168 this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
169 start of the VBI data that was generated by the decoder. The driver
170 then parses the sliced VBI data and sets the other fields in the
171 struct accordingly. The pointer p is updated to point to the start of
172 the payload which can be copied verbatim into the data field of the
173 v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
174 type field is set to 0 on return.
175
176 s_vbi_data: used to generate VBI signals on a video signal.
177 v4l2_sliced_vbi_data is filled with the data packets that should be
178 output. Note that if you set the line field to 0, then that VBI signal
179 is disabled. If no valid VBI data was found, then the type field is
180 set to 0 on return.
181
182 g_vbi_data: used to obtain the sliced VBI packet from a readback register.
183 Not all video decoders support this. If no data is available because
184 the readback register contains invalid or erroneous data -EIO is
185 returned. Note that you must fill in the 'id' member and the 'field'
186 member (to determine whether CC data from the first or second field
187 should be obtained).
188
189 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
190 video input devices.
191
192 s_crystal_freq: sets the frequency of the crystal used to generate the
193 clocks in Hz. An extra flags field allows device specific configuration
194 regarding clock frequency dividers, etc. If not used, then set flags
195 to 0. If the frequency is not supported, then -EINVAL is returned.
196
197 g_input_status: get input status. Same as the status field in the v4l2_input
198 struct.
199
200 s_routing: see s_routing in audio_ops, except this version is for video
201 devices.
202 */
107struct v4l2_subdev_video_ops { 203struct v4l2_subdev_video_ops {
108 int (*s_routing)(struct v4l2_subdev *sd, const struct v4l2_routing *route); 204 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
109 int (*s_crystal_freq)(struct v4l2_subdev *sd, struct v4l2_crystal_freq *freq); 205 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
110 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line); 206 int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
111 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data); 207 int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
112 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data); 208 int (*g_vbi_data)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_data *vbi_data);
113 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap); 209 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
114 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 210 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
211 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
212 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
115 int (*s_stream)(struct v4l2_subdev *sd, int enable); 213 int (*s_stream)(struct v4l2_subdev *sd, int enable);
116 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 214 int (*enum_fmt)(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmtdesc);
117 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 215 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
216 int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
217 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
218 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
219 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
220 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
221 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
118}; 222};
119 223
120struct v4l2_subdev_ops { 224struct v4l2_subdev_ops {
@@ -132,7 +236,7 @@ struct v4l2_subdev_ops {
132struct v4l2_subdev { 236struct v4l2_subdev {
133 struct list_head list; 237 struct list_head list;
134 struct module *owner; 238 struct module *owner;
135 struct v4l2_device *dev; 239 struct v4l2_device *v4l2_dev;
136 const struct v4l2_subdev_ops *ops; 240 const struct v4l2_subdev_ops *ops;
137 /* name must be unique */ 241 /* name must be unique */
138 char name[V4L2_SUBDEV_NAME_SIZE]; 242 char name[V4L2_SUBDEV_NAME_SIZE];
@@ -152,18 +256,6 @@ static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd)
152 return sd->priv; 256 return sd->priv;
153} 257}
154 258
155/* Convert an ioctl-type command to the proper v4l2_subdev_ops function call.
156 This is used by subdev modules that can be called by both old-style ioctl
157 commands and through the v4l2_subdev_ops.
158
159 The ioctl API of the subdev driver can call this function to call the
160 right ops based on the ioctl cmd and arg.
161
162 Once all subdev drivers have been converted and all drivers no longer
163 use the ioctl interface, then this function can be removed.
164 */
165int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg);
166
167static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 259static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
168 const struct v4l2_subdev_ops *ops) 260 const struct v4l2_subdev_ops *ops)
169{ 261{
@@ -171,7 +263,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
171 /* ops->core MUST be set */ 263 /* ops->core MUST be set */
172 BUG_ON(!ops || !ops->core); 264 BUG_ON(!ops || !ops->core);
173 sd->ops = ops; 265 sd->ops = ops;
174 sd->dev = NULL; 266 sd->v4l2_dev = NULL;
175 sd->name[0] = '\0'; 267 sd->name[0] = '\0';
176 sd->grp_id = 0; 268 sd->grp_id = 0;
177 sd->priv = NULL; 269 sd->priv = NULL;
@@ -186,4 +278,9 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
186 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ 278 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \
187 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 279 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
188 280
281/* Send a notification to v4l2_device. */
282#define v4l2_subdev_notify(sd, notification, arg) \
283 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
284 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
285
189#endif 286#endif
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 874f1340d049..1c5946c44758 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/poll.h> 19#include <linux/poll.h>
20#ifdef CONFIG_VIDEO_V4L1_COMPAT 20#ifdef CONFIG_VIDEO_V4L1_COMPAT
21#define __MIN_V4L1
21#include <linux/videodev.h> 22#include <linux/videodev.h>
22#endif 23#endif
23#include <linux/videodev2.h> 24#include <linux/videodev2.h>
diff --git a/include/mtd/inftl-user.h b/include/mtd/inftl-user.h
index d409d489d900..8376bd1a9e01 100644
--- a/include/mtd/inftl-user.h
+++ b/include/mtd/inftl-user.h
@@ -16,33 +16,33 @@
16/* Block Control Information */ 16/* Block Control Information */
17 17
18struct inftl_bci { 18struct inftl_bci {
19 uint8_t ECCsig[6]; 19 __u8 ECCsig[6];
20 uint8_t Status; 20 __u8 Status;
21 uint8_t Status1; 21 __u8 Status1;
22} __attribute__((packed)); 22} __attribute__((packed));
23 23
24struct inftl_unithead1 { 24struct inftl_unithead1 {
25 uint16_t virtualUnitNo; 25 __u16 virtualUnitNo;
26 uint16_t prevUnitNo; 26 __u16 prevUnitNo;
27 uint8_t ANAC; 27 __u8 ANAC;
28 uint8_t NACs; 28 __u8 NACs;
29 uint8_t parityPerField; 29 __u8 parityPerField;
30 uint8_t discarded; 30 __u8 discarded;
31} __attribute__((packed)); 31} __attribute__((packed));
32 32
33struct inftl_unithead2 { 33struct inftl_unithead2 {
34 uint8_t parityPerField; 34 __u8 parityPerField;
35 uint8_t ANAC; 35 __u8 ANAC;
36 uint16_t prevUnitNo; 36 __u16 prevUnitNo;
37 uint16_t virtualUnitNo; 37 __u16 virtualUnitNo;
38 uint8_t NACs; 38 __u8 NACs;
39 uint8_t discarded; 39 __u8 discarded;
40} __attribute__((packed)); 40} __attribute__((packed));
41 41
42struct inftl_unittail { 42struct inftl_unittail {
43 uint8_t Reserved[4]; 43 __u8 Reserved[4];
44 uint16_t EraseMark; 44 __u16 EraseMark;
45 uint16_t EraseMark1; 45 __u16 EraseMark1;
46} __attribute__((packed)); 46} __attribute__((packed));
47 47
48union inftl_uci { 48union inftl_uci {
diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
index 001685d7fa88..fa94b0eb67c1 100644
--- a/include/mtd/jffs2-user.h
+++ b/include/mtd/jffs2-user.h
@@ -7,6 +7,7 @@
7 7
8/* This file is blessed for inclusion by userspace */ 8/* This file is blessed for inclusion by userspace */
9#include <linux/jffs2.h> 9#include <linux/jffs2.h>
10#include <linux/types.h>
10#include <endian.h> 11#include <endian.h>
11#include <byteswap.h> 12#include <byteswap.h>
12 13
@@ -19,8 +20,8 @@
19 20
20extern int target_endian; 21extern int target_endian;
21 22
22#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) 23#define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
23#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) 24#define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
24 25
25#define cpu_to_je16(x) ((jint16_t){t16(x)}) 26#define cpu_to_je16(x) ((jint16_t){t16(x)})
26#define cpu_to_je32(x) ((jint32_t){t32(x)}) 27#define cpu_to_je32(x) ((jint32_t){t32(x)})
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index c6c61cd5a254..b6595b3c68b6 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -5,14 +5,16 @@
5#ifndef __MTD_ABI_H__ 5#ifndef __MTD_ABI_H__
6#define __MTD_ABI_H__ 6#define __MTD_ABI_H__
7 7
8#include <linux/types.h>
9
8struct erase_info_user { 10struct erase_info_user {
9 uint32_t start; 11 __u32 start;
10 uint32_t length; 12 __u32 length;
11}; 13};
12 14
13struct mtd_oob_buf { 15struct mtd_oob_buf {
14 uint32_t start; 16 __u32 start;
15 uint32_t length; 17 __u32 length;
16 unsigned char __user *ptr; 18 unsigned char __user *ptr;
17}; 19};
18 20
@@ -48,30 +50,30 @@ struct mtd_oob_buf {
48#define MTD_OTP_USER 2 50#define MTD_OTP_USER 2
49 51
50struct mtd_info_user { 52struct mtd_info_user {
51 uint8_t type; 53 __u8 type;
52 uint32_t flags; 54 __u32 flags;
53 uint32_t size; // Total size of the MTD 55 __u32 size; // Total size of the MTD
54 uint32_t erasesize; 56 __u32 erasesize;
55 uint32_t writesize; 57 __u32 writesize;
56 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 58 __u32 oobsize; // Amount of OOB data per block (e.g. 16)
57 /* The below two fields are obsolete and broken, do not use them 59 /* The below two fields are obsolete and broken, do not use them
58 * (TODO: remove at some point) */ 60 * (TODO: remove at some point) */
59 uint32_t ecctype; 61 __u32 ecctype;
60 uint32_t eccsize; 62 __u32 eccsize;
61}; 63};
62 64
63struct region_info_user { 65struct region_info_user {
64 uint32_t offset; /* At which this region starts, 66 __u32 offset; /* At which this region starts,
65 * from the beginning of the MTD */ 67 * from the beginning of the MTD */
66 uint32_t erasesize; /* For this region */ 68 __u32 erasesize; /* For this region */
67 uint32_t numblocks; /* Number of blocks in this region */ 69 __u32 numblocks; /* Number of blocks in this region */
68 uint32_t regionindex; 70 __u32 regionindex;
69}; 71};
70 72
71struct otp_info { 73struct otp_info {
72 uint32_t start; 74 __u32 start;
73 uint32_t length; 75 __u32 length;
74 uint32_t locked; 76 __u32 locked;
75}; 77};
76 78
77#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 79#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
@@ -84,8 +86,8 @@ struct otp_info {
84#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) 86#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
85#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) 87#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
86#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) 88#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
87#define MEMGETBADBLOCK _IOW('M', 11, loff_t) 89#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
88#define MEMSETBADBLOCK _IOW('M', 12, loff_t) 90#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
89#define OTPSELECT _IOR('M', 13, int) 91#define OTPSELECT _IOR('M', 13, int)
90#define OTPGETREGIONCOUNT _IOW('M', 14, int) 92#define OTPGETREGIONCOUNT _IOW('M', 14, int)
91#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) 93#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
@@ -99,15 +101,15 @@ struct otp_info {
99 * interfaces 101 * interfaces
100 */ 102 */
101struct nand_oobinfo { 103struct nand_oobinfo {
102 uint32_t useecc; 104 __u32 useecc;
103 uint32_t eccbytes; 105 __u32 eccbytes;
104 uint32_t oobfree[8][2]; 106 __u32 oobfree[8][2];
105 uint32_t eccpos[32]; 107 __u32 eccpos[32];
106}; 108};
107 109
108struct nand_oobfree { 110struct nand_oobfree {
109 uint32_t offset; 111 __u32 offset;
110 uint32_t length; 112 __u32 length;
111}; 113};
112 114
113#define MTD_MAX_OOBFREE_ENTRIES 8 115#define MTD_MAX_OOBFREE_ENTRIES 8
@@ -116,9 +118,9 @@ struct nand_oobfree {
116 * diagnosis and to allow creation of raw images 118 * diagnosis and to allow creation of raw images
117 */ 119 */
118struct nand_ecclayout { 120struct nand_ecclayout {
119 uint32_t eccbytes; 121 __u32 eccbytes;
120 uint32_t eccpos[64]; 122 __u32 eccpos[64];
121 uint32_t oobavail; 123 __u32 oobavail;
122 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; 124 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
123}; 125};
124 126
@@ -131,10 +133,10 @@ struct nand_ecclayout {
131 * @bbtblocks: number of blocks reserved for bad block tables 133 * @bbtblocks: number of blocks reserved for bad block tables
132 */ 134 */
133struct mtd_ecc_stats { 135struct mtd_ecc_stats {
134 uint32_t corrected; 136 __u32 corrected;
135 uint32_t failed; 137 __u32 failed;
136 uint32_t badblocks; 138 __u32 badblocks;
137 uint32_t bbtblocks; 139 __u32 bbtblocks;
138}; 140};
139 141
140/* 142/*
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h
index 390d21c080aa..98e9e57f22de 100644
--- a/include/mtd/nftl-user.h
+++ b/include/mtd/nftl-user.h
@@ -6,33 +6,35 @@
6#ifndef __MTD_NFTL_USER_H__ 6#ifndef __MTD_NFTL_USER_H__
7#define __MTD_NFTL_USER_H__ 7#define __MTD_NFTL_USER_H__
8 8
9#include <linux/types.h>
10
9/* Block Control Information */ 11/* Block Control Information */
10 12
11struct nftl_bci { 13struct nftl_bci {
12 unsigned char ECCSig[6]; 14 unsigned char ECCSig[6];
13 uint8_t Status; 15 __u8 Status;
14 uint8_t Status1; 16 __u8 Status1;
15}__attribute__((packed)); 17}__attribute__((packed));
16 18
17/* Unit Control Information */ 19/* Unit Control Information */
18 20
19struct nftl_uci0 { 21struct nftl_uci0 {
20 uint16_t VirtUnitNum; 22 __u16 VirtUnitNum;
21 uint16_t ReplUnitNum; 23 __u16 ReplUnitNum;
22 uint16_t SpareVirtUnitNum; 24 __u16 SpareVirtUnitNum;
23 uint16_t SpareReplUnitNum; 25 __u16 SpareReplUnitNum;
24} __attribute__((packed)); 26} __attribute__((packed));
25 27
26struct nftl_uci1 { 28struct nftl_uci1 {
27 uint32_t WearInfo; 29 __u32 WearInfo;
28 uint16_t EraseMark; 30 __u16 EraseMark;
29 uint16_t EraseMark1; 31 __u16 EraseMark1;
30} __attribute__((packed)); 32} __attribute__((packed));
31 33
32struct nftl_uci2 { 34struct nftl_uci2 {
33 uint16_t FoldMark; 35 __u16 FoldMark;
34 uint16_t FoldMark1; 36 __u16 FoldMark1;
35 uint32_t unused; 37 __u32 unused;
36} __attribute__((packed)); 38} __attribute__((packed));
37 39
38union nftl_uci { 40union nftl_uci {
@@ -50,9 +52,9 @@ struct nftl_oob {
50 52
51struct NFTLMediaHeader { 53struct NFTLMediaHeader {
52 char DataOrgID[6]; 54 char DataOrgID[6];
53 uint16_t NumEraseUnits; 55 __u16 NumEraseUnits;
54 uint16_t FirstPhysicalEUN; 56 __u16 FirstPhysicalEUN;
55 uint32_t FormattedSize; 57 __u32 FormattedSize;
56 unsigned char UnitSizeFactor; 58 unsigned char UnitSizeFactor;
57} __attribute__((packed)); 59} __attribute__((packed));
58 60
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 296efae3525e..466a8320f1e6 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -21,6 +21,8 @@
21#ifndef __UBI_USER_H__ 21#ifndef __UBI_USER_H__
22#define __UBI_USER_H__ 22#define __UBI_USER_H__
23 23
24#include <linux/types.h>
25
24/* 26/*
25 * UBI device creation (the same as MTD device attachment) 27 * UBI device creation (the same as MTD device attachment)
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -152,7 +154,7 @@
152/* Create an UBI volume */ 154/* Create an UBI volume */
153#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) 155#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
154/* Remove an UBI volume */ 156/* Remove an UBI volume */
155#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t) 157#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
156/* Re-size an UBI volume */ 158/* Re-size an UBI volume */
157#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) 159#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
158/* Re-name volumes */ 160/* Re-name volumes */
@@ -165,24 +167,24 @@
165/* Attach an MTD device */ 167/* Attach an MTD device */
166#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) 168#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
167/* Detach an MTD device */ 169/* Detach an MTD device */
168#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t) 170#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
169 171
170/* ioctl commands of UBI volume character devices */ 172/* ioctl commands of UBI volume character devices */
171 173
172#define UBI_VOL_IOC_MAGIC 'O' 174#define UBI_VOL_IOC_MAGIC 'O'
173 175
174/* Start UBI volume update */ 176/* Start UBI volume update */
175#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t) 177#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
176/* LEB erasure command, used for debugging, disabled by default */ 178/* LEB erasure command, used for debugging, disabled by default */
177#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t) 179#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
178/* Atomic LEB change command */ 180/* Atomic LEB change command */
179#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t) 181#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
180/* Map LEB command */ 182/* Map LEB command */
181#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) 183#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
182/* Unmap LEB command */ 184/* Unmap LEB command */
183#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) 185#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
184/* Check if LEB is mapped command */ 186/* Check if LEB is mapped command */
185#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) 187#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
186/* Set an UBI volume property */ 188/* Set an UBI volume property */
187#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) 189#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
188 190
@@ -260,10 +262,10 @@ enum {
260 * sub-page of the first page and add needed padding. 262 * sub-page of the first page and add needed padding.
261 */ 263 */
262struct ubi_attach_req { 264struct ubi_attach_req {
263 int32_t ubi_num; 265 __s32 ubi_num;
264 int32_t mtd_num; 266 __s32 mtd_num;
265 int32_t vid_hdr_offset; 267 __s32 vid_hdr_offset;
266 int8_t padding[12]; 268 __s8 padding[12];
267}; 269};
268 270
269/** 271/**
@@ -298,13 +300,13 @@ struct ubi_attach_req {
298 * BLOBs, without caring about how to properly align them. 300 * BLOBs, without caring about how to properly align them.
299 */ 301 */
300struct ubi_mkvol_req { 302struct ubi_mkvol_req {
301 int32_t vol_id; 303 __s32 vol_id;
302 int32_t alignment; 304 __s32 alignment;
303 int64_t bytes; 305 __s64 bytes;
304 int8_t vol_type; 306 __s8 vol_type;
305 int8_t padding1; 307 __s8 padding1;
306 int16_t name_len; 308 __s16 name_len;
307 int8_t padding2[4]; 309 __s8 padding2[4];
308 char name[UBI_MAX_VOLUME_NAME + 1]; 310 char name[UBI_MAX_VOLUME_NAME + 1];
309} __attribute__ ((packed)); 311} __attribute__ ((packed));
310 312
@@ -320,8 +322,8 @@ struct ubi_mkvol_req {
320 * zero number of bytes). 322 * zero number of bytes).
321 */ 323 */
322struct ubi_rsvol_req { 324struct ubi_rsvol_req {
323 int64_t bytes; 325 __s64 bytes;
324 int32_t vol_id; 326 __s32 vol_id;
325} __attribute__ ((packed)); 327} __attribute__ ((packed));
326 328
327/** 329/**
@@ -356,12 +358,12 @@ struct ubi_rsvol_req {
356 * re-name request. 358 * re-name request.
357 */ 359 */
358struct ubi_rnvol_req { 360struct ubi_rnvol_req {
359 int32_t count; 361 __s32 count;
360 int8_t padding1[12]; 362 __s8 padding1[12];
361 struct { 363 struct {
362 int32_t vol_id; 364 __s32 vol_id;
363 int16_t name_len; 365 __s16 name_len;
364 int8_t padding2[2]; 366 __s8 padding2[2];
365 char name[UBI_MAX_VOLUME_NAME + 1]; 367 char name[UBI_MAX_VOLUME_NAME + 1];
366 } ents[UBI_MAX_RNVOL]; 368 } ents[UBI_MAX_RNVOL];
367} __attribute__ ((packed)); 369} __attribute__ ((packed));
@@ -375,10 +377,10 @@ struct ubi_rnvol_req {
375 * @padding: reserved for future, not used, has to be zeroed 377 * @padding: reserved for future, not used, has to be zeroed
376 */ 378 */
377struct ubi_leb_change_req { 379struct ubi_leb_change_req {
378 int32_t lnum; 380 __s32 lnum;
379 int32_t bytes; 381 __s32 bytes;
380 int8_t dtype; 382 __s8 dtype;
381 int8_t padding[7]; 383 __s8 padding[7];
382} __attribute__ ((packed)); 384} __attribute__ ((packed));
383 385
384/** 386/**
@@ -388,9 +390,9 @@ struct ubi_leb_change_req {
388 * @padding: reserved for future, not used, has to be zeroed 390 * @padding: reserved for future, not used, has to be zeroed
389 */ 391 */
390struct ubi_map_req { 392struct ubi_map_req {
391 int32_t lnum; 393 __s32 lnum;
392 int8_t dtype; 394 __s8 dtype;
393 int8_t padding[3]; 395 __s8 padding[3];
394} __attribute__ ((packed)); 396} __attribute__ ((packed));
395 397
396 398
@@ -402,9 +404,9 @@ struct ubi_map_req {
402 * @value: value to set 404 * @value: value to set
403 */ 405 */
404struct ubi_set_prop_req { 406struct ubi_set_prop_req {
405 uint8_t property; 407 __u8 property;
406 uint8_t padding[7]; 408 __u8 padding[7];
407 uint64_t value; 409 __u64 value;
408} __attribute__ ((packed)); 410} __attribute__ ((packed));
409 411
410#endif /* __UBI_USER_H__ */ 412#endif /* __UBI_USER_H__ */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index c216de528b08..7b55ab215a64 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -88,8 +88,8 @@ extern int ipv6_dev_get_saddr(struct net *net,
88extern int ipv6_get_lladdr(struct net_device *dev, 88extern int ipv6_get_lladdr(struct net_device *dev,
89 struct in6_addr *addr, 89 struct in6_addr *addr,
90 unsigned char banned_flags); 90 unsigned char banned_flags);
91extern int ipv6_rcv_saddr_equal(const struct sock *sk, 91extern int ipv6_rcv_saddr_equal(const struct sock *sk,
92 const struct sock *sk2); 92 const struct sock *sk2);
93extern void addrconf_join_solict(struct net_device *dev, 93extern void addrconf_join_solict(struct net_device *dev,
94 struct in6_addr *addr); 94 struct in6_addr *addr);
95extern void addrconf_leave_solict(struct inet6_dev *idev, 95extern void addrconf_leave_solict(struct inet6_dev *idev,
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index b5a51a7bb364..467c531b8a7e 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -50,7 +50,6 @@ struct atmarp_entry {
50struct clip_priv { 50struct clip_priv {
51 int number; /* for convenience ... */ 51 int number; /* for convenience ... */
52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */ 52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */
53 struct net_device_stats stats;
54 struct net_device *next; /* next CLIP interface */ 53 struct net_device *next; /* next CLIP interface */
55}; 54};
56 55
diff --git a/include/net/ax88796.h b/include/net/ax88796.h
index 51329dae44e6..b9a3beca0ce4 100644
--- a/include/net/ax88796.h
+++ b/include/net/ax88796.h
@@ -15,14 +15,17 @@
15#define AXFLG_HAS_EEPROM (1<<0) 15#define AXFLG_HAS_EEPROM (1<<0)
16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ 16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ 17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */
18#define AXFLG_MAC_FROMPLATFORM (1<<3) /* MAC given by platform data */
18 19
19struct ax_plat_data { 20struct ax_plat_data {
20 unsigned int flags; 21 unsigned int flags;
21 unsigned char wordlength; /* 1 or 2 */ 22 unsigned char wordlength; /* 1 or 2 */
22 unsigned char dcr_val; /* default value for DCR */ 23 unsigned char dcr_val; /* default value for DCR */
23 unsigned char rcr_val; /* default value for RCR */ 24 unsigned char rcr_val; /* default value for RCR */
24 unsigned char gpoc_val; /* default value for GPOC */ 25 unsigned char gpoc_val; /* default value for GPOC */
25 u32 *reg_offsets; /* register offsets */ 26 u32 *reg_offsets; /* register offsets */
27 u8 *mac_addr; /* MAC addr (only used when
28 AXFLG_MAC_FROMPLATFORM is used */
26}; 29};
27 30
28#endif /* __NET_AX88796_PLAT_H */ 31#endif /* __NET_AX88796_PLAT_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a04f8463ac7e..3ad5390a4dd5 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -53,6 +53,17 @@
53#define SOL_SCO 17 53#define SOL_SCO 17
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_SECURITY 4
57struct bt_security {
58 __u8 level;
59};
60#define BT_SECURITY_SDP 0
61#define BT_SECURITY_LOW 1
62#define BT_SECURITY_MEDIUM 2
63#define BT_SECURITY_HIGH 3
64
65#define BT_DEFER_SETUP 7
66
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
@@ -108,6 +119,7 @@ struct bt_sock {
108 bdaddr_t dst; 119 bdaddr_t dst;
109 struct list_head accept_q; 120 struct list_head accept_q;
110 struct sock *parent; 121 struct sock *parent;
122 u32 defer_setup;
111}; 123};
112 124
113struct bt_sock_list { 125struct bt_sock_list {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3645139e68c7..f69f015bbcc0 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -133,8 +133,13 @@ enum {
133#define ESCO_EV3 0x0008 133#define ESCO_EV3 0x0008
134#define ESCO_EV4 0x0010 134#define ESCO_EV4 0x0010
135#define ESCO_EV5 0x0020 135#define ESCO_EV5 0x0020
136#define ESCO_2EV3 0x0040
137#define ESCO_3EV3 0x0080
138#define ESCO_2EV5 0x0100
139#define ESCO_3EV5 0x0200
136 140
137#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 141#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
142#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
138 143
139/* ACL flags */ 144/* ACL flags */
140#define ACL_CONT 0x01 145#define ACL_CONT 0x01
@@ -176,6 +181,9 @@ enum {
176#define LMP_EV5 0x02 181#define LMP_EV5 0x02
177 182
178#define LMP_SNIFF_SUBR 0x02 183#define LMP_SNIFF_SUBR 0x02
184#define LMP_EDR_ESCO_2M 0x20
185#define LMP_EDR_ESCO_3M 0x40
186#define LMP_EDR_3S_ESCO 0x80
179 187
180#define LMP_SIMPLE_PAIR 0x08 188#define LMP_SIMPLE_PAIR 0x08
181 189
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 46a43b721dd6..01f9316b4c23 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -169,6 +169,7 @@ struct hci_conn {
169 __u16 link_policy; 169 __u16 link_policy;
170 __u32 link_mode; 170 __u32 link_mode;
171 __u8 auth_type; 171 __u8 auth_type;
172 __u8 sec_level;
172 __u8 power_save; 173 __u8 power_save;
173 unsigned long pend; 174 unsigned long pend;
174 175
@@ -325,12 +326,11 @@ int hci_conn_del(struct hci_conn *conn);
325void hci_conn_hash_flush(struct hci_dev *hdev); 326void hci_conn_hash_flush(struct hci_dev *hdev);
326void hci_conn_check_pending(struct hci_dev *hdev); 327void hci_conn_check_pending(struct hci_dev *hdev);
327 328
328struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type); 329struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type);
329int hci_conn_check_link_mode(struct hci_conn *conn); 330int hci_conn_check_link_mode(struct hci_conn *conn);
330int hci_conn_auth(struct hci_conn *conn); 331int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
331int hci_conn_encrypt(struct hci_conn *conn);
332int hci_conn_change_link_key(struct hci_conn *conn); 332int hci_conn_change_link_key(struct hci_conn *conn);
333int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); 333int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
334 334
335void hci_conn_enter_active_mode(struct hci_conn *conn); 335void hci_conn_enter_active_mode(struct hci_conn *conn);
336void hci_conn_enter_sniff_mode(struct hci_conn *conn); 336void hci_conn_enter_sniff_mode(struct hci_conn *conn);
@@ -470,26 +470,26 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
470 470
471/* ----- HCI protocols ----- */ 471/* ----- HCI protocols ----- */
472struct hci_proto { 472struct hci_proto {
473 char *name; 473 char *name;
474 unsigned int id; 474 unsigned int id;
475 unsigned long flags; 475 unsigned long flags;
476 476
477 void *priv; 477 void *priv;
478 478
479 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); 479 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);
480 int (*connect_cfm) (struct hci_conn *conn, __u8 status); 480 int (*connect_cfm) (struct hci_conn *conn, __u8 status);
481 int (*disconn_ind) (struct hci_conn *conn, __u8 reason); 481 int (*disconn_ind) (struct hci_conn *conn);
482 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
482 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 483 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
483 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); 484 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
484 int (*auth_cfm) (struct hci_conn *conn, __u8 status); 485 int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
485 int (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
486}; 486};
487 487
488static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) 488static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
489{ 489{
490 register struct hci_proto *hp; 490 register struct hci_proto *hp;
491 int mask = 0; 491 int mask = 0;
492 492
493 hp = hci_proto[HCI_PROTO_L2CAP]; 493 hp = hci_proto[HCI_PROTO_L2CAP];
494 if (hp && hp->connect_ind) 494 if (hp && hp->connect_ind)
495 mask |= hp->connect_ind(hdev, bdaddr, type); 495 mask |= hp->connect_ind(hdev, bdaddr, type);
@@ -514,30 +514,52 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
514 hp->connect_cfm(conn, status); 514 hp->connect_cfm(conn, status);
515} 515}
516 516
517static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason) 517static inline int hci_proto_disconn_ind(struct hci_conn *conn)
518{ 518{
519 register struct hci_proto *hp; 519 register struct hci_proto *hp;
520 int reason = 0x13;
520 521
521 hp = hci_proto[HCI_PROTO_L2CAP]; 522 hp = hci_proto[HCI_PROTO_L2CAP];
522 if (hp && hp->disconn_ind) 523 if (hp && hp->disconn_ind)
523 hp->disconn_ind(conn, reason); 524 reason = hp->disconn_ind(conn);
524 525
525 hp = hci_proto[HCI_PROTO_SCO]; 526 hp = hci_proto[HCI_PROTO_SCO];
526 if (hp && hp->disconn_ind) 527 if (hp && hp->disconn_ind)
527 hp->disconn_ind(conn, reason); 528 reason = hp->disconn_ind(conn);
529
530 return reason;
531}
532
533static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
534{
535 register struct hci_proto *hp;
536
537 hp = hci_proto[HCI_PROTO_L2CAP];
538 if (hp && hp->disconn_cfm)
539 hp->disconn_cfm(conn, reason);
540
541 hp = hci_proto[HCI_PROTO_SCO];
542 if (hp && hp->disconn_cfm)
543 hp->disconn_cfm(conn, reason);
528} 544}
529 545
530static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 546static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
531{ 547{
532 register struct hci_proto *hp; 548 register struct hci_proto *hp;
549 __u8 encrypt;
550
551 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
552 return;
553
554 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
533 555
534 hp = hci_proto[HCI_PROTO_L2CAP]; 556 hp = hci_proto[HCI_PROTO_L2CAP];
535 if (hp && hp->auth_cfm) 557 if (hp && hp->security_cfm)
536 hp->auth_cfm(conn, status); 558 hp->security_cfm(conn, status, encrypt);
537 559
538 hp = hci_proto[HCI_PROTO_SCO]; 560 hp = hci_proto[HCI_PROTO_SCO];
539 if (hp && hp->auth_cfm) 561 if (hp && hp->security_cfm)
540 hp->auth_cfm(conn, status); 562 hp->security_cfm(conn, status, encrypt);
541} 563}
542 564
543static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 565static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
@@ -545,12 +567,12 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u
545 register struct hci_proto *hp; 567 register struct hci_proto *hp;
546 568
547 hp = hci_proto[HCI_PROTO_L2CAP]; 569 hp = hci_proto[HCI_PROTO_L2CAP];
548 if (hp && hp->encrypt_cfm) 570 if (hp && hp->security_cfm)
549 hp->encrypt_cfm(conn, status, encrypt); 571 hp->security_cfm(conn, status, encrypt);
550 572
551 hp = hci_proto[HCI_PROTO_SCO]; 573 hp = hci_proto[HCI_PROTO_SCO];
552 if (hp && hp->encrypt_cfm) 574 if (hp && hp->security_cfm)
553 hp->encrypt_cfm(conn, status, encrypt); 575 hp->security_cfm(conn, status, encrypt);
554} 576}
555 577
556int hci_register_proto(struct hci_proto *hproto); 578int hci_register_proto(struct hci_proto *hproto);
@@ -562,8 +584,7 @@ struct hci_cb {
562 584
563 char *name; 585 char *name;
564 586
565 void (*auth_cfm) (struct hci_conn *conn, __u8 status); 587 void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
566 void (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
567 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 588 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
568 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); 589 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
569}; 590};
@@ -571,14 +592,20 @@ struct hci_cb {
571static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 592static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
572{ 593{
573 struct list_head *p; 594 struct list_head *p;
595 __u8 encrypt;
574 596
575 hci_proto_auth_cfm(conn, status); 597 hci_proto_auth_cfm(conn, status);
576 598
599 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
600 return;
601
602 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
603
577 read_lock_bh(&hci_cb_list_lock); 604 read_lock_bh(&hci_cb_list_lock);
578 list_for_each(p, &hci_cb_list) { 605 list_for_each(p, &hci_cb_list) {
579 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 606 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
580 if (cb->auth_cfm) 607 if (cb->security_cfm)
581 cb->auth_cfm(conn, status); 608 cb->security_cfm(conn, status, encrypt);
582 } 609 }
583 read_unlock_bh(&hci_cb_list_lock); 610 read_unlock_bh(&hci_cb_list_lock);
584} 611}
@@ -587,13 +614,16 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encr
587{ 614{
588 struct list_head *p; 615 struct list_head *p;
589 616
617 if (conn->sec_level == BT_SECURITY_SDP)
618 conn->sec_level = BT_SECURITY_LOW;
619
590 hci_proto_encrypt_cfm(conn, status, encrypt); 620 hci_proto_encrypt_cfm(conn, status, encrypt);
591 621
592 read_lock_bh(&hci_cb_list_lock); 622 read_lock_bh(&hci_cb_list_lock);
593 list_for_each(p, &hci_cb_list) { 623 list_for_each(p, &hci_cb_list) {
594 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 624 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
595 if (cb->encrypt_cfm) 625 if (cb->security_cfm)
596 cb->encrypt_cfm(conn, status, encrypt); 626 cb->security_cfm(conn, status, encrypt);
597 } 627 }
598 read_unlock_bh(&hci_cb_list_lock); 628 read_unlock_bh(&hci_cb_list_lock);
599} 629}
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 73e115bc12dd..f566aa1f0a4c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -37,6 +37,7 @@ struct sockaddr_l2 {
37 sa_family_t l2_family; 37 sa_family_t l2_family;
38 __le16 l2_psm; 38 __le16 l2_psm;
39 bdaddr_t l2_bdaddr; 39 bdaddr_t l2_bdaddr;
40 __le16 l2_cid;
40}; 41};
41 42
42/* L2CAP socket options */ 43/* L2CAP socket options */
@@ -185,6 +186,7 @@ struct l2cap_info_rsp {
185/* info type */ 186/* info type */
186#define L2CAP_IT_CL_MTU 0x0001 187#define L2CAP_IT_CL_MTU 0x0001
187#define L2CAP_IT_FEAT_MASK 0x0002 188#define L2CAP_IT_FEAT_MASK 0x0002
189#define L2CAP_IT_FIXED_CHAN 0x0003
188 190
189/* info result */ 191/* info result */
190#define L2CAP_IR_SUCCESS 0x0000 192#define L2CAP_IR_SUCCESS 0x0000
@@ -219,11 +221,14 @@ struct l2cap_conn {
219 __u8 rx_ident; 221 __u8 rx_ident;
220 __u8 tx_ident; 222 __u8 tx_ident;
221 223
224 __u8 disc_reason;
225
222 struct l2cap_chan_list chan_list; 226 struct l2cap_chan_list chan_list;
223}; 227};
224 228
225#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 229#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
226#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x02 230#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
231#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
227 232
228/* ----- L2CAP channel and socket info ----- */ 233/* ----- L2CAP channel and socket info ----- */
229#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 234#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -237,8 +242,9 @@ struct l2cap_pinfo {
237 __u16 imtu; 242 __u16 imtu;
238 __u16 omtu; 243 __u16 omtu;
239 __u16 flush_to; 244 __u16 flush_to;
240 245 __u8 sec_level;
241 __u32 link_mode; 246 __u8 role_switch;
247 __u8 force_reliable;
242 248
243 __u8 conf_req[64]; 249 __u8 conf_req[64];
244 __u8 conf_len; 250 __u8 conf_len;
@@ -257,6 +263,7 @@ struct l2cap_pinfo {
257#define L2CAP_CONF_REQ_SENT 0x01 263#define L2CAP_CONF_REQ_SENT 0x01
258#define L2CAP_CONF_INPUT_DONE 0x02 264#define L2CAP_CONF_INPUT_DONE 0x02
259#define L2CAP_CONF_OUTPUT_DONE 0x04 265#define L2CAP_CONF_OUTPUT_DONE 0x04
266#define L2CAP_CONF_CONNECT_PEND 0x80
260 267
261#define L2CAP_CONF_MAX_RETRIES 2 268#define L2CAP_CONF_MAX_RETRIES 2
262 269
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 4dc8d92a4638..80072611d26a 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -183,8 +183,9 @@ struct rfcomm_dlc {
183 u8 remote_v24_sig; 183 u8 remote_v24_sig;
184 u8 mscex; 184 u8 mscex;
185 u8 out; 185 u8 out;
186 186 u8 sec_level;
187 u32 link_mode; 187 u8 role_switch;
188 u32 defer_setup;
188 189
189 uint mtu; 190 uint mtu;
190 uint cfc; 191 uint cfc;
@@ -202,10 +203,12 @@ struct rfcomm_dlc {
202#define RFCOMM_RX_THROTTLED 0 203#define RFCOMM_RX_THROTTLED 0
203#define RFCOMM_TX_THROTTLED 1 204#define RFCOMM_TX_THROTTLED 1
204#define RFCOMM_TIMED_OUT 2 205#define RFCOMM_TIMED_OUT 2
205#define RFCOMM_MSC_PENDING 3 206#define RFCOMM_MSC_PENDING 3
206#define RFCOMM_AUTH_PENDING 4 207#define RFCOMM_SEC_PENDING 4
207#define RFCOMM_AUTH_ACCEPT 5 208#define RFCOMM_AUTH_PENDING 5
208#define RFCOMM_AUTH_REJECT 6 209#define RFCOMM_AUTH_ACCEPT 6
210#define RFCOMM_AUTH_REJECT 7
211#define RFCOMM_DEFER_SETUP 8
209 212
210/* Scheduling flags and events */ 213/* Scheduling flags and events */
211#define RFCOMM_SCHED_STATE 0 214#define RFCOMM_SCHED_STATE 0
@@ -239,6 +242,7 @@ int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
239int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 242int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
240int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 243int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
241int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 244int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
245void rfcomm_dlc_accept(struct rfcomm_dlc *d);
242 246
243#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
244#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -304,7 +308,8 @@ struct rfcomm_pinfo {
304 struct bt_sock bt; 308 struct bt_sock bt;
305 struct rfcomm_dlc *dlc; 309 struct rfcomm_dlc *dlc;
306 u8 channel; 310 u8 channel;
307 u32 link_mode; 311 u8 sec_level;
312 u8 role_switch;
308}; 313};
309 314
310int rfcomm_init_sockets(void); 315int rfcomm_init_sockets(void);
@@ -333,7 +338,6 @@ struct rfcomm_dev_req {
333 bdaddr_t src; 338 bdaddr_t src;
334 bdaddr_t dst; 339 bdaddr_t dst;
335 u8 channel; 340 u8 channel;
336
337}; 341};
338 342
339struct rfcomm_dev_info { 343struct rfcomm_dev_info {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 23c0ab74ded6..5389afdc1297 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4,6 +4,10 @@
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <linux/if_ether.h>
8#include <linux/ieee80211.h>
9#include <linux/wireless.h>
10#include <net/iw_handler.h>
7#include <net/genetlink.h> 11#include <net/genetlink.h>
8/* remove once we remove the wext stuff */ 12/* remove once we remove the wext stuff */
9#include <net/iw_handler.h> 13#include <net/iw_handler.h>
@@ -112,12 +116,14 @@ struct beacon_parameters {
112 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
113 * with short preambles 117 * with short preambles
114 * @STATION_FLAG_WME: station is WME/QoS capable 118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
115 */ 120 */
116enum station_flags { 121enum station_flags {
117 STATION_FLAG_CHANGED = 1<<0, 122 STATION_FLAG_CHANGED = 1<<0,
118 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
119 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
120 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
121}; 127};
122 128
123/** 129/**
@@ -172,6 +178,8 @@ struct station_parameters {
172 * @STATION_INFO_SIGNAL: @signal filled 178 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 179 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 180 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
181 * @STATION_INFO_RX_PACKETS: @rx_packets filled
182 * @STATION_INFO_TX_PACKETS: @tx_packets filled
175 */ 183 */
176enum station_info_flags { 184enum station_info_flags {
177 STATION_INFO_INACTIVE_TIME = 1<<0, 185 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -182,6 +190,8 @@ enum station_info_flags {
182 STATION_INFO_PLINK_STATE = 1<<5, 190 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6, 191 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7, 192 STATION_INFO_TX_BITRATE = 1<<7,
193 STATION_INFO_RX_PACKETS = 1<<8,
194 STATION_INFO_TX_PACKETS = 1<<9,
185}; 195};
186 196
187/** 197/**
@@ -229,6 +239,8 @@ struct rate_info {
229 * @plink_state: mesh peer link state 239 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm 240 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station 241 * @txrate: current unicast bitrate to this station
242 * @rx_packets: packets received from this station
243 * @tx_packets: packets transmitted to this station
232 */ 244 */
233struct station_info { 245struct station_info {
234 u32 filled; 246 u32 filled;
@@ -240,6 +252,8 @@ struct station_info {
240 u8 plink_state; 252 u8 plink_state;
241 s8 signal; 253 s8 signal;
242 struct rate_info txrate; 254 struct rate_info txrate;
255 u32 rx_packets;
256 u32 tx_packets;
243}; 257};
244 258
245/** 259/**
@@ -335,24 +349,50 @@ struct bss_parameters {
335}; 349};
336 350
337/** 351/**
338 * enum reg_set_by - Indicates who is trying to set the regulatory domain 352 * enum environment_cap - Environment parsed from country IE
339 * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be 353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
340 * using a static world regulatory domain by default. 354 * outdoor operation.
341 * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. 355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
342 * @REGDOM_SET_BY_USER: User asked the wireless core to set the 356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
343 * regulatory domain. 357 */
344 * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core 358enum environment_cap {
345 * it thinks its knows the regulatory domain we should be in. 359 ENVIRON_ANY,
346 * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country 360 ENVIRON_INDOOR,
347 * information element with regulatory information it thinks we 361 ENVIRON_OUTDOOR,
348 * should consider. 362};
363
364/**
365 * struct regulatory_request - used to keep track of regulatory requests
366 *
367 * @wiphy_idx: this is set if this request's initiator is
368 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
369 * can be used by the wireless core to deal with conflicts
370 * and potentially inform users of which devices specifically
371 * cased the conflicts.
372 * @initiator: indicates who sent this request, could be any of
373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
374 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
375 * regulatory domain. We have a few special codes:
376 * 00 - World regulatory domain
377 * 99 - built by driver but a specific alpha2 cannot be determined
378 * 98 - result of an intersection between two regulatory domains
379 * @intersect: indicates whether the wireless core should intersect
380 * the requested regulatory domain with the presently set regulatory
381 * domain.
382 * @country_ie_checksum: checksum of the last processed and accepted
383 * country IE
384 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
385 * indoor, or if it doesn't matter
386 * @list: used to insert into the reg_requests_list linked list
349 */ 387 */
350enum reg_set_by { 388struct regulatory_request {
351 REGDOM_SET_BY_INIT, 389 int wiphy_idx;
352 REGDOM_SET_BY_CORE, 390 enum nl80211_reg_initiator initiator;
353 REGDOM_SET_BY_USER, 391 char alpha2[2];
354 REGDOM_SET_BY_DRIVER, 392 bool intersect;
355 REGDOM_SET_BY_COUNTRY_IE, 393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
356}; 396};
357 397
358struct ieee80211_freq_range { 398struct ieee80211_freq_range {
@@ -438,6 +478,187 @@ struct wiphy;
438struct ieee80211_channel; 478struct ieee80211_channel;
439 479
440/** 480/**
481 * struct cfg80211_ssid - SSID description
482 * @ssid: the SSID
483 * @ssid_len: length of the ssid
484 */
485struct cfg80211_ssid {
486 u8 ssid[IEEE80211_MAX_SSID_LEN];
487 u8 ssid_len;
488};
489
490/**
491 * struct cfg80211_scan_request - scan request description
492 *
493 * @ssids: SSIDs to scan for (active scan only)
494 * @n_ssids: number of SSIDs
495 * @channels: channels to scan on.
496 * @n_channels: number of channels for each band
497 * @ie: optional information element(s) to add into Probe Request or %NULL
498 * @ie_len: length of ie in octets
499 * @wiphy: the wiphy this was for
500 * @ifidx: the interface index
501 */
502struct cfg80211_scan_request {
503 struct cfg80211_ssid *ssids;
504 int n_ssids;
505 struct ieee80211_channel **channels;
506 u32 n_channels;
507 u8 *ie;
508 size_t ie_len;
509
510 /* internal */
511 struct wiphy *wiphy;
512 int ifidx;
513};
514
515/**
516 * enum cfg80211_signal_type - signal type
517 *
518 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
519 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
520 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
521 */
522enum cfg80211_signal_type {
523 CFG80211_SIGNAL_TYPE_NONE,
524 CFG80211_SIGNAL_TYPE_MBM,
525 CFG80211_SIGNAL_TYPE_UNSPEC,
526};
527
528/**
529 * struct cfg80211_bss - BSS description
530 *
531 * This structure describes a BSS (which may also be a mesh network)
532 * for use in scan results and similar.
533 *
534 * @bssid: BSSID of the BSS
535 * @tsf: timestamp of last received update
536 * @beacon_interval: the beacon interval as from the frame
537 * @capability: the capability field in host byte order
538 * @information_elements: the information elements (Note that there
539 * is no guarantee that these are well-formed!)
540 * @len_information_elements: total length of the information elements
541 * @signal: signal strength value (type depends on the wiphy's signal_type)
542 * @hold: BSS should not expire
543 * @free_priv: function pointer to free private data
544 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
545 */
546struct cfg80211_bss {
547 struct ieee80211_channel *channel;
548
549 u8 bssid[ETH_ALEN];
550 u64 tsf;
551 u16 beacon_interval;
552 u16 capability;
553 u8 *information_elements;
554 size_t len_information_elements;
555
556 s32 signal;
557
558 void (*free_priv)(struct cfg80211_bss *bss);
559 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
560};
561
562/**
563 * struct cfg80211_auth_request - Authentication request data
564 *
565 * This structure provides information needed to complete IEEE 802.11
566 * authentication.
567 * NOTE: This structure will likely change when more code from mac80211 is
568 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
569 * Before using this in a driver that does not use mac80211, it would be better
570 * to check the status of that work and better yet, volunteer to work on it.
571 *
572 * @chan: The channel to use or %NULL if not specified (auto-select based on
573 * scan results)
574 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
575 * this field is required to be present; if the driver wants to help with
576 * BSS selection, it should use (yet to be added) MLME event to allow user
577 * space SME to be notified of roaming candidate, so that the SME can then
578 * use the authentication request with the recommended BSSID and whatever
579 * other data may be needed for authentication/association
580 * @ssid: SSID or %NULL if not yet available
581 * @ssid_len: Length of ssid in octets
582 * @auth_type: Authentication type (algorithm)
583 * @ie: Extra IEs to add to Authentication frame or %NULL
584 * @ie_len: Length of ie buffer in octets
585 */
586struct cfg80211_auth_request {
587 struct ieee80211_channel *chan;
588 u8 *peer_addr;
589 const u8 *ssid;
590 size_t ssid_len;
591 enum nl80211_auth_type auth_type;
592 const u8 *ie;
593 size_t ie_len;
594};
595
596/**
597 * struct cfg80211_assoc_request - (Re)Association request data
598 *
599 * This structure provides information needed to complete IEEE 802.11
600 * (re)association.
601 * NOTE: This structure will likely change when more code from mac80211 is
602 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
603 * Before using this in a driver that does not use mac80211, it would be better
604 * to check the status of that work and better yet, volunteer to work on it.
605 *
606 * @chan: The channel to use or %NULL if not specified (auto-select based on
607 * scan results)
608 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
609 * to be present and the STA must be in State 2 (authenticated) with the
610 * peer STA
611 * @ssid: SSID
612 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets
615 */
616struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan;
618 u8 *peer_addr;
619 const u8 *ssid;
620 size_t ssid_len;
621 const u8 *ie;
622 size_t ie_len;
623};
624
625/**
626 * struct cfg80211_deauth_request - Deauthentication request data
627 *
628 * This structure provides information needed to complete IEEE 802.11
629 * deauthentication.
630 *
631 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
632 * to be present and the STA must be authenticated with the peer STA
633 * @ie: Extra IEs to add to Deauthentication frame or %NULL
634 * @ie_len: Length of ie buffer in octets
635 */
636struct cfg80211_deauth_request {
637 u8 *peer_addr;
638 u16 reason_code;
639 const u8 *ie;
640 size_t ie_len;
641};
642
643/**
644 * struct cfg80211_disassoc_request - Disassociation request data
645 *
646 * This structure provides information needed to complete IEEE 802.11
647 * disassocation.
648 *
649 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
650 * to be present and the STA must be associated with the peer STA
651 * @ie: Extra IEs to add to Disassociation frame or %NULL
652 * @ie_len: Length of ie buffer in octets
653 */
654struct cfg80211_disassoc_request {
655 u8 *peer_addr;
656 u16 reason_code;
657 const u8 *ie;
658 size_t ie_len;
659};
660
661/**
441 * struct cfg80211_ops - backend description for wireless configuration 662 * struct cfg80211_ops - backend description for wireless configuration
442 * 663 *
443 * This struct is registered by fullmac card drivers and/or wireless stacks 664 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -450,6 +671,9 @@ struct ieee80211_channel;
450 * wireless extensions but this is subject to reevaluation as soon as this 671 * wireless extensions but this is subject to reevaluation as soon as this
451 * code is used more widely and we have a first user without wext. 672 * code is used more widely and we have a first user without wext.
452 * 673 *
674 * @suspend: wiphy device needs to be suspended
675 * @resume: wiphy device needs to be resumed
676 *
453 * @add_virtual_intf: create a new virtual interface with the given name, 677 * @add_virtual_intf: create a new virtual interface with the given name,
454 * must set the struct wireless_dev's iftype. 678 * must set the struct wireless_dev's iftype.
455 * 679 *
@@ -471,6 +695,8 @@ struct ieee80211_channel;
471 * 695 *
472 * @set_default_key: set the default key on an interface 696 * @set_default_key: set the default key on an interface
473 * 697 *
698 * @set_default_mgmt_key: set the default management frame key on an interface
699 *
474 * @add_beacon: Add a beacon with given parameters, @head, @interval 700 * @add_beacon: Add a beacon with given parameters, @head, @interval
475 * and @dtim_period will be valid, @tail is optional. 701 * and @dtim_period will be valid, @tail is optional.
476 * @set_beacon: Change the beacon parameters for an access point mode 702 * @set_beacon: Change the beacon parameters for an access point mode
@@ -497,8 +723,21 @@ struct ieee80211_channel;
497 * @set_txq_params: Set TX queue parameters 723 * @set_txq_params: Set TX queue parameters
498 * 724 *
499 * @set_channel: Set channel 725 * @set_channel: Set channel
726 *
727 * @scan: Request to do a scan. If returning zero, the scan request is given
728 * the driver, and will be valid until passed to cfg80211_scan_done().
729 * For scan results, call cfg80211_inform_bss(); you can call this outside
730 * the scan/scan_done bracket too.
731 *
732 * @auth: Request to authenticate with the specified peer
733 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer
500 */ 736 */
501struct cfg80211_ops { 737struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy);
739 int (*resume)(struct wiphy *wiphy);
740
502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 741 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
503 enum nl80211_iftype type, u32 *flags, 742 enum nl80211_iftype type, u32 *flags,
504 struct vif_params *params); 743 struct vif_params *params);
@@ -518,6 +757,9 @@ struct cfg80211_ops {
518 int (*set_default_key)(struct wiphy *wiphy, 757 int (*set_default_key)(struct wiphy *wiphy,
519 struct net_device *netdev, 758 struct net_device *netdev,
520 u8 key_index); 759 u8 key_index);
760 int (*set_default_mgmt_key)(struct wiphy *wiphy,
761 struct net_device *netdev,
762 u8 key_index);
521 763
522 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 764 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
523 struct beacon_parameters *info); 765 struct beacon_parameters *info);
@@ -564,6 +806,18 @@ struct cfg80211_ops {
564 int (*set_channel)(struct wiphy *wiphy, 806 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan, 807 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type); 808 enum nl80211_channel_type channel_type);
809
810 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
811 struct cfg80211_scan_request *request);
812
813 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
814 struct cfg80211_auth_request *req);
815 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
816 struct cfg80211_assoc_request *req);
817 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
818 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req);
567}; 821};
568 822
569/* temporary wext handlers */ 823/* temporary wext handlers */
@@ -574,5 +828,134 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra); 828 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 829int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra); 830 u32 *mode, char *extra);
831int cfg80211_wext_siwscan(struct net_device *dev,
832 struct iw_request_info *info,
833 union iwreq_data *wrqu, char *extra);
834int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info,
836 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info,
839 struct iw_point *data, char *extra);
840
841/**
842 * cfg80211_scan_done - notify that scan finished
843 *
844 * @request: the corresponding scan request
845 * @aborted: set to true if the scan was aborted for any reason,
846 * userspace will be notified of that
847 */
848void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
849
850/**
851 * cfg80211_inform_bss - inform cfg80211 of a new BSS
852 *
853 * @wiphy: the wiphy reporting the BSS
854 * @bss: the found BSS
855 * @signal: the signal strength, type depends on the wiphy's signal_type
856 * @gfp: context flags
857 *
858 * This informs cfg80211 that BSS information was found and
859 * the BSS should be updated/added.
860 */
861struct cfg80211_bss*
862cfg80211_inform_bss_frame(struct wiphy *wiphy,
863 struct ieee80211_channel *channel,
864 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp);
866
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel,
869 const u8 *bssid,
870 const u8 *ssid, size_t ssid_len,
871 u16 capa_mask, u16 capa_val);
872static inline struct cfg80211_bss *
873cfg80211_get_ibss(struct wiphy *wiphy,
874 struct ieee80211_channel *channel,
875 const u8 *ssid, size_t ssid_len)
876{
877 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
878 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
879}
880
881struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
882 struct ieee80211_channel *channel,
883 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss);
886/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy
889 * @bss: the bss to remove
890 *
891 * This function removes the given BSS from the internal data structures
892 * thereby making it no longer show up in scan results etc. Use this
893 * function when you detect a BSS is gone. Normally BSSes will also time
894 * out, so it is not necessary to use this function at all.
895 */
896void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
897
898/**
899 * cfg80211_send_rx_auth - notification of processed authentication
900 * @dev: network device
901 * @buf: authentication frame (header + body)
902 * @len: length of the frame data
903 *
904 * This function is called whenever an authentication has been processed in
905 * station mode.
906 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908
909/**
910 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device
912 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data
914 *
915 * This function is called whenever a (re)association response has been
916 * processed in station mode.
917 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919
920/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication
922 * @dev: network device
923 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data
925 *
926 * This function is called whenever deauthentication has been processed in
927 * station mode.
928 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf,
930 size_t len);
931
932/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation
934 * @dev: network device
935 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data
937 *
938 * This function is called whenever disassociation has been processed in
939 * station mode.
940 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf,
942 size_t len);
943
944/**
945 * cfg80211_hold_bss - exclude bss from expiration
946 * @bss: bss which should not expire
947 *
948 * In a case when the BSS is not updated but it shouldn't expire this
949 * function can be used to mark the BSS to be excluded from expiration.
950 */
951void cfg80211_hold_bss(struct cfg80211_bss *bss);
952
953/**
954 * cfg80211_unhold_bss - remove expiration exception from the BSS
955 * @bss: bss which can expire again
956 *
957 * This function marks the BSS to be expirable again.
958 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss);
577 960
578#endif /* __NET_CFG80211_H */ 961#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index bedc7f62e35d..abd443604c9f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,6 +40,7 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <net/request_sock.h>
43#include <asm/atomic.h> 44#include <asm/atomic.h>
44 45
45/* known doi values */ 46/* known doi values */
@@ -215,6 +216,10 @@ int cipso_v4_sock_setattr(struct sock *sk,
215 const struct netlbl_lsm_secattr *secattr); 216 const struct netlbl_lsm_secattr *secattr);
216void cipso_v4_sock_delattr(struct sock *sk); 217void cipso_v4_sock_delattr(struct sock *sk);
217int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); 218int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
219int cipso_v4_req_setattr(struct request_sock *req,
220 const struct cipso_v4_doi *doi_def,
221 const struct netlbl_lsm_secattr *secattr);
222void cipso_v4_req_delattr(struct request_sock *req);
218int cipso_v4_skbuff_setattr(struct sk_buff *skb, 223int cipso_v4_skbuff_setattr(struct sk_buff *skb,
219 const struct cipso_v4_doi *doi_def, 224 const struct cipso_v4_doi *doi_def,
220 const struct netlbl_lsm_secattr *secattr); 225 const struct netlbl_lsm_secattr *secattr);
@@ -247,6 +252,18 @@ static inline int cipso_v4_sock_getattr(struct sock *sk,
247 return -ENOSYS; 252 return -ENOSYS;
248} 253}
249 254
255static inline int cipso_v4_req_setattr(struct request_sock *req,
256 const struct cipso_v4_doi *doi_def,
257 const struct netlbl_lsm_secattr *secattr)
258{
259 return -ENOSYS;
260}
261
262static inline void cipso_v4_req_delattr(struct request_sock *req)
263{
264 return;
265}
266
250static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb, 267static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb,
251 const struct cipso_v4_doi *doi_def, 268 const struct cipso_v4_doi *doi_def,
252 const struct netlbl_lsm_secattr *secattr) 269 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 52e97bfca5a1..839f768f9e35 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips 2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
3 * Copyright (c) 2008 Marvell Semiconductor 3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -11,23 +11,47 @@
11#ifndef __LINUX_NET_DSA_H 11#ifndef __LINUX_NET_DSA_H
12#define __LINUX_NET_DSA_H 12#define __LINUX_NET_DSA_H
13 13
14#define DSA_MAX_PORTS 12 14#define DSA_MAX_SWITCHES 4
15#define DSA_MAX_PORTS 12
16
17struct dsa_chip_data {
18 /*
19 * How to access the switch configuration registers.
20 */
21 struct device *mii_bus;
22 int sw_addr;
23
24 /*
25 * The names of the switch's ports. Use "cpu" to
26 * designate the switch port that the cpu is connected to,
27 * "dsa" to indicate that this port is a DSA link to
28 * another switch, NULL to indicate the port is unused,
29 * or any other string to indicate this is a physical port.
30 */
31 char *port_names[DSA_MAX_PORTS];
32
33 /*
34 * An array (with nr_chips elements) of which element [a]
35 * indicates which port on this switch should be used to
36 * send packets to that are destined for switch a. Can be
37 * NULL if there is only one switch chip.
38 */
39 s8 *rtable;
40};
15 41
16struct dsa_platform_data { 42struct dsa_platform_data {
17 /* 43 /*
18 * Reference to a Linux network interface that connects 44 * Reference to a Linux network interface that connects
19 * to the switch chip. 45 * to the root switch chip of the tree.
20 */ 46 */
21 struct device *netdev; 47 struct device *netdev;
22 48
23 /* 49 /*
24 * How to access the switch configuration registers, and 50 * Info structs describing each of the switch chips
25 * the names of the switch ports (use "cpu" to designate 51 * connected via this network interface.
26 * the switch port that the cpu is connected to).
27 */ 52 */
28 struct device *mii_bus; 53 int nr_chips;
29 int sw_addr; 54 struct dsa_chip_data *chip;
30 char *port_names[DSA_MAX_PORTS];
31}; 55};
32 56
33extern bool dsa_uses_dsa_tags(void *dsa_ptr); 57extern bool dsa_uses_dsa_tags(void *dsa_ptr);
diff --git a/include/net/ethoc.h b/include/net/ethoc.h
new file mode 100644
index 000000000000..96f3789b27bc
--- /dev/null
+++ b/include/net/ethoc.h
@@ -0,0 +1,22 @@
1/*
2 * linux/include/net/ethoc.h
3 *
4 * Copyright (C) 2008-2009 Avionic Design GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Written by Thierry Reding <thierry.reding@avionic-design.de>
11 */
12
13#ifndef LINUX_NET_ETHOC_H
14#define LINUX_NET_ETHOC_H 1
15
16struct ethoc_platform_data {
17 u8 hwaddr[IFHWADDRLEN];
18 s8 phy_id;
19};
20
21#endif /* !LINUX_NET_ETHOC_H */
22
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
deleted file mode 100644
index adb7cf31f781..000000000000
--- a/include/net/ieee80211.h
+++ /dev/null
@@ -1,1185 +0,0 @@
1/*
2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
4 *
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <j@w1.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004-2005, Intel Corporation
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation. See README and COPYING for
19 * more details.
20 *
21 * API Version History
22 * 1.0.x -- Initial version
23 * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs,
24 * various structure changes, and crypto API init method
25 */
26#ifndef IEEE80211_H
27#define IEEE80211_H
28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
34
35#define IEEE80211_VERSION "git-1.1.13"
36
37#define IEEE80211_DATA_LEN 2304
38/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
39 6.2.1.1.2.
40
41 The figure in section 7.1.2 suggests a body size of up to 2312
42 bytes is allowed, which is a bit confusing, I suspect this
43 represents the 2304 bytes of real data, plus a possible 8 bytes of
44 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
45
46#define IEEE80211_1ADDR_LEN 10
47#define IEEE80211_2ADDR_LEN 16
48#define IEEE80211_3ADDR_LEN 24
49#define IEEE80211_4ADDR_LEN 30
50#define IEEE80211_FCS_LEN 4
51#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
52#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
53
54#define MIN_FRAG_THRESHOLD 256U
55#define MAX_FRAG_THRESHOLD 2346U
56
57/* Frame control field constants */
58#define IEEE80211_FCTL_VERS 0x0003
59#define IEEE80211_FCTL_FTYPE 0x000c
60#define IEEE80211_FCTL_STYPE 0x00f0
61#define IEEE80211_FCTL_TODS 0x0100
62#define IEEE80211_FCTL_FROMDS 0x0200
63#define IEEE80211_FCTL_MOREFRAGS 0x0400
64#define IEEE80211_FCTL_RETRY 0x0800
65#define IEEE80211_FCTL_PM 0x1000
66#define IEEE80211_FCTL_MOREDATA 0x2000
67#define IEEE80211_FCTL_PROTECTED 0x4000
68#define IEEE80211_FCTL_ORDER 0x8000
69
70#define IEEE80211_FTYPE_MGMT 0x0000
71#define IEEE80211_FTYPE_CTL 0x0004
72#define IEEE80211_FTYPE_DATA 0x0008
73
74/* management */
75#define IEEE80211_STYPE_ASSOC_REQ 0x0000
76#define IEEE80211_STYPE_ASSOC_RESP 0x0010
77#define IEEE80211_STYPE_REASSOC_REQ 0x0020
78#define IEEE80211_STYPE_REASSOC_RESP 0x0030
79#define IEEE80211_STYPE_PROBE_REQ 0x0040
80#define IEEE80211_STYPE_PROBE_RESP 0x0050
81#define IEEE80211_STYPE_BEACON 0x0080
82#define IEEE80211_STYPE_ATIM 0x0090
83#define IEEE80211_STYPE_DISASSOC 0x00A0
84#define IEEE80211_STYPE_AUTH 0x00B0
85#define IEEE80211_STYPE_DEAUTH 0x00C0
86#define IEEE80211_STYPE_ACTION 0x00D0
87
88/* control */
89#define IEEE80211_STYPE_PSPOLL 0x00A0
90#define IEEE80211_STYPE_RTS 0x00B0
91#define IEEE80211_STYPE_CTS 0x00C0
92#define IEEE80211_STYPE_ACK 0x00D0
93#define IEEE80211_STYPE_CFEND 0x00E0
94#define IEEE80211_STYPE_CFENDACK 0x00F0
95
96/* data */
97#define IEEE80211_STYPE_DATA 0x0000
98#define IEEE80211_STYPE_DATA_CFACK 0x0010
99#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
100#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
101#define IEEE80211_STYPE_NULLFUNC 0x0040
102#define IEEE80211_STYPE_CFACK 0x0050
103#define IEEE80211_STYPE_CFPOLL 0x0060
104#define IEEE80211_STYPE_CFACKPOLL 0x0070
105#define IEEE80211_STYPE_QOS_DATA 0x0080
106
107#define IEEE80211_SCTL_FRAG 0x000F
108#define IEEE80211_SCTL_SEQ 0xFFF0
109
110/* QOS control */
111#define IEEE80211_QCTL_TID 0x000F
112
113/* debug macros */
114
115#ifdef CONFIG_IEEE80211_DEBUG
116extern u32 ieee80211_debug_level;
117#define IEEE80211_DEBUG(level, fmt, args...) \
118do { if (ieee80211_debug_level & (level)) \
119 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
120 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
121static inline bool ieee80211_ratelimit_debug(u32 level)
122{
123 return (ieee80211_debug_level & level) && net_ratelimit();
124}
125#else
126#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
127static inline bool ieee80211_ratelimit_debug(u32 level)
128{
129 return false;
130}
131#endif /* CONFIG_IEEE80211_DEBUG */
132
133/*
134 * To use the debug system:
135 *
136 * If you are defining a new debug classification, simply add it to the #define
137 * list here in the form of:
138 *
139 * #define IEEE80211_DL_xxxx VALUE
140 *
141 * shifting value to the left one bit from the previous entry. xxxx should be
142 * the name of the classification (for example, WEP)
143 *
144 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
145 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
146 * to send output to that classification.
147 *
148 * To add your debug level to the list of levels seen when you perform
149 *
150 * % cat /proc/net/ieee80211/debug_level
151 *
152 * you simply need to add your entry to the ieee80211_debug_level array.
153 *
154 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
155 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
156 *
157 */
158
159#define IEEE80211_DL_INFO (1<<0)
160#define IEEE80211_DL_WX (1<<1)
161#define IEEE80211_DL_SCAN (1<<2)
162#define IEEE80211_DL_STATE (1<<3)
163#define IEEE80211_DL_MGMT (1<<4)
164#define IEEE80211_DL_FRAG (1<<5)
165#define IEEE80211_DL_DROP (1<<7)
166
167#define IEEE80211_DL_TX (1<<8)
168#define IEEE80211_DL_RX (1<<9)
169#define IEEE80211_DL_QOS (1<<31)
170
171#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
172#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
173#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
174
175#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
176#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
177#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
178#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
179#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
180#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
181#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
182#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
183#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
184#include <linux/netdevice.h>
185#include <linux/if_arp.h> /* ARPHRD_ETHER */
186
187#ifndef WIRELESS_SPY
188#define WIRELESS_SPY /* enable iwspy support */
189#endif
190#include <net/iw_handler.h> /* new driver API */
191
192#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
193
194#ifndef ETH_P_80211_RAW
195#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
196#endif
197
198/* IEEE 802.11 defines */
199
200#define P80211_OUI_LEN 3
201
202struct ieee80211_snap_hdr {
203
204 u8 dsap; /* always 0xAA */
205 u8 ssap; /* always 0xAA */
206 u8 ctrl; /* always 0x03 */
207 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
208
209} __attribute__ ((packed));
210
211#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
212
213#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
214#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
215#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
216
217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
219
220/* Action categories - 802.11h */
221enum ieee80211_actioncategories {
222 WLAN_ACTION_SPECTRUM_MGMT = 0,
223 /* Reserved 1-127 */
224 /* Error 128-255 */
225};
226
227/* Action details - 802.11h */
228enum ieee80211_actiondetails {
229 WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0,
230 WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1,
231 WLAN_ACTION_CATEGORY_TPC_REQUEST = 2,
232 WLAN_ACTION_CATEGORY_TPC_REPORT = 3,
233 WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4,
234 /* 5 - 255 Reserved */
235};
236
237#define IEEE80211_STATMASK_SIGNAL (1<<0)
238#define IEEE80211_STATMASK_RSSI (1<<1)
239#define IEEE80211_STATMASK_NOISE (1<<2)
240#define IEEE80211_STATMASK_RATE (1<<3)
241#define IEEE80211_STATMASK_WEMASK 0x7
242
243#define IEEE80211_CCK_MODULATION (1<<0)
244#define IEEE80211_OFDM_MODULATION (1<<1)
245
246#define IEEE80211_24GHZ_BAND (1<<0)
247#define IEEE80211_52GHZ_BAND (1<<1)
248
249#define IEEE80211_CCK_RATE_1MB 0x02
250#define IEEE80211_CCK_RATE_2MB 0x04
251#define IEEE80211_CCK_RATE_5MB 0x0B
252#define IEEE80211_CCK_RATE_11MB 0x16
253#define IEEE80211_OFDM_RATE_6MB 0x0C
254#define IEEE80211_OFDM_RATE_9MB 0x12
255#define IEEE80211_OFDM_RATE_12MB 0x18
256#define IEEE80211_OFDM_RATE_18MB 0x24
257#define IEEE80211_OFDM_RATE_24MB 0x30
258#define IEEE80211_OFDM_RATE_36MB 0x48
259#define IEEE80211_OFDM_RATE_48MB 0x60
260#define IEEE80211_OFDM_RATE_54MB 0x6C
261#define IEEE80211_BASIC_RATE_MASK 0x80
262
263#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
264#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
265#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
266#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
267#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
268#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
269#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
270#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
271#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
272#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
273#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
274#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
275
276#define IEEE80211_CCK_RATES_MASK 0x0000000F
277#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
278 IEEE80211_CCK_RATE_2MB_MASK)
279#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
280 IEEE80211_CCK_RATE_5MB_MASK | \
281 IEEE80211_CCK_RATE_11MB_MASK)
282
283#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
284#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
285 IEEE80211_OFDM_RATE_12MB_MASK | \
286 IEEE80211_OFDM_RATE_24MB_MASK)
287#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
288 IEEE80211_OFDM_RATE_9MB_MASK | \
289 IEEE80211_OFDM_RATE_18MB_MASK | \
290 IEEE80211_OFDM_RATE_36MB_MASK | \
291 IEEE80211_OFDM_RATE_48MB_MASK | \
292 IEEE80211_OFDM_RATE_54MB_MASK)
293#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
294 IEEE80211_CCK_DEFAULT_RATES_MASK)
295
296#define IEEE80211_NUM_OFDM_RATES 8
297#define IEEE80211_NUM_CCK_RATES 4
298#define IEEE80211_OFDM_SHIFT_MASK_A 4
299
300/* NOTE: This data is for statistical purposes; not all hardware provides this
301 * information for frames received.
302 * For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
303 */
304struct ieee80211_rx_stats {
305 u32 mac_time;
306 s8 rssi;
307 u8 signal;
308 u8 noise;
309 u16 rate; /* in 100 kbps */
310 u8 received_channel;
311 u8 control;
312 u8 mask;
313 u8 freq;
314 u16 len;
315 u64 tsf;
316 u32 beacon_time;
317};
318
319/* IEEE 802.11 requires that STA supports concurrent reception of at least
320 * three fragmented frames. This define can be increased to support more
321 * concurrent frames, but it should be noted that each entry can consume about
322 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
323#define IEEE80211_FRAG_CACHE_LEN 4
324
325struct ieee80211_frag_entry {
326 unsigned long first_frag_time;
327 unsigned int seq;
328 unsigned int last_frag;
329 struct sk_buff *skb;
330 u8 src_addr[ETH_ALEN];
331 u8 dst_addr[ETH_ALEN];
332};
333
334struct ieee80211_stats {
335 unsigned int tx_unicast_frames;
336 unsigned int tx_multicast_frames;
337 unsigned int tx_fragments;
338 unsigned int tx_unicast_octets;
339 unsigned int tx_multicast_octets;
340 unsigned int tx_deferred_transmissions;
341 unsigned int tx_single_retry_frames;
342 unsigned int tx_multiple_retry_frames;
343 unsigned int tx_retry_limit_exceeded;
344 unsigned int tx_discards;
345 unsigned int rx_unicast_frames;
346 unsigned int rx_multicast_frames;
347 unsigned int rx_fragments;
348 unsigned int rx_unicast_octets;
349 unsigned int rx_multicast_octets;
350 unsigned int rx_fcs_errors;
351 unsigned int rx_discards_no_buffer;
352 unsigned int tx_discards_wrong_sa;
353 unsigned int rx_discards_undecryptable;
354 unsigned int rx_message_in_msg_fragments;
355 unsigned int rx_message_in_bad_msg_fragments;
356};
357
358struct ieee80211_device;
359
360#define SEC_KEY_1 (1<<0)
361#define SEC_KEY_2 (1<<1)
362#define SEC_KEY_3 (1<<2)
363#define SEC_KEY_4 (1<<3)
364#define SEC_ACTIVE_KEY (1<<4)
365#define SEC_AUTH_MODE (1<<5)
366#define SEC_UNICAST_GROUP (1<<6)
367#define SEC_LEVEL (1<<7)
368#define SEC_ENABLED (1<<8)
369#define SEC_ENCRYPT (1<<9)
370
371#define SEC_LEVEL_0 0 /* None */
372#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
373#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
374#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
375#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
376
377#define SEC_ALG_NONE 0
378#define SEC_ALG_WEP 1
379#define SEC_ALG_TKIP 2
380#define SEC_ALG_CCMP 3
381
382#define WEP_KEYS 4
383#define WEP_KEY_LEN 13
384#define SCM_KEY_LEN 32
385#define SCM_TEMPORAL_KEY_LENGTH 16
386
387struct ieee80211_security {
388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
389 u8 auth_mode;
390 u8 encode_alg[WEP_KEYS];
391 u8 key_sizes[WEP_KEYS];
392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
393 u8 level;
394 u16 flags;
395} __attribute__ ((packed));
396
397/*
398
399 802.11 data frame from AP
400
401 ,-------------------------------------------------------------------.
402Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
403 |------|------|---------|---------|---------|------|---------|------|
404Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
405 | | tion | (BSSID) | | | ence | data | |
406 `-------------------------------------------------------------------'
407
408Total: 28-2340 bytes
409
410*/
411
412#define BEACON_PROBE_SSID_ID_POSITION 12
413
414/* Management Frame Information Element Types */
415enum ieee80211_mfie {
416 MFIE_TYPE_SSID = 0,
417 MFIE_TYPE_RATES = 1,
418 MFIE_TYPE_FH_SET = 2,
419 MFIE_TYPE_DS_SET = 3,
420 MFIE_TYPE_CF_SET = 4,
421 MFIE_TYPE_TIM = 5,
422 MFIE_TYPE_IBSS_SET = 6,
423 MFIE_TYPE_COUNTRY = 7,
424 MFIE_TYPE_HOP_PARAMS = 8,
425 MFIE_TYPE_HOP_TABLE = 9,
426 MFIE_TYPE_REQUEST = 10,
427 MFIE_TYPE_CHALLENGE = 16,
428 MFIE_TYPE_POWER_CONSTRAINT = 32,
429 MFIE_TYPE_POWER_CAPABILITY = 33,
430 MFIE_TYPE_TPC_REQUEST = 34,
431 MFIE_TYPE_TPC_REPORT = 35,
432 MFIE_TYPE_SUPP_CHANNELS = 36,
433 MFIE_TYPE_CSA = 37,
434 MFIE_TYPE_MEASURE_REQUEST = 38,
435 MFIE_TYPE_MEASURE_REPORT = 39,
436 MFIE_TYPE_QUIET = 40,
437 MFIE_TYPE_IBSS_DFS = 41,
438 MFIE_TYPE_ERP_INFO = 42,
439 MFIE_TYPE_RSN = 48,
440 MFIE_TYPE_RATES_EX = 50,
441 MFIE_TYPE_GENERIC = 221,
442 MFIE_TYPE_QOS_PARAMETER = 222,
443};
444
445struct ieee80211_hdr_1addr {
446 __le16 frame_ctl;
447 __le16 duration_id;
448 u8 addr1[ETH_ALEN];
449 u8 payload[0];
450} __attribute__ ((packed));
451
452struct ieee80211_hdr_2addr {
453 __le16 frame_ctl;
454 __le16 duration_id;
455 u8 addr1[ETH_ALEN];
456 u8 addr2[ETH_ALEN];
457 u8 payload[0];
458} __attribute__ ((packed));
459
460struct ieee80211_hdr_3addr {
461 __le16 frame_ctl;
462 __le16 duration_id;
463 u8 addr1[ETH_ALEN];
464 u8 addr2[ETH_ALEN];
465 u8 addr3[ETH_ALEN];
466 __le16 seq_ctl;
467 u8 payload[0];
468} __attribute__ ((packed));
469
470struct ieee80211_hdr_4addr {
471 __le16 frame_ctl;
472 __le16 duration_id;
473 u8 addr1[ETH_ALEN];
474 u8 addr2[ETH_ALEN];
475 u8 addr3[ETH_ALEN];
476 __le16 seq_ctl;
477 u8 addr4[ETH_ALEN];
478 u8 payload[0];
479} __attribute__ ((packed));
480
481struct ieee80211_hdr_3addrqos {
482 __le16 frame_ctl;
483 __le16 duration_id;
484 u8 addr1[ETH_ALEN];
485 u8 addr2[ETH_ALEN];
486 u8 addr3[ETH_ALEN];
487 __le16 seq_ctl;
488 u8 payload[0];
489 __le16 qos_ctl;
490} __attribute__ ((packed));
491
492struct ieee80211_info_element {
493 u8 id;
494 u8 len;
495 u8 data[0];
496} __attribute__ ((packed));
497
498/*
499 * These are the data types that can make up management packets
500 *
501 u16 auth_algorithm;
502 u16 auth_sequence;
503 u16 beacon_interval;
504 u16 capability;
505 u8 current_ap[ETH_ALEN];
506 u16 listen_interval;
507 struct {
508 u16 association_id:14, reserved:2;
509 } __attribute__ ((packed));
510 u32 time_stamp[2];
511 u16 reason;
512 u16 status;
513*/
514
515struct ieee80211_auth {
516 struct ieee80211_hdr_3addr header;
517 __le16 algorithm;
518 __le16 transaction;
519 __le16 status;
520 /* challenge */
521 struct ieee80211_info_element info_element[0];
522} __attribute__ ((packed));
523
524struct ieee80211_channel_switch {
525 u8 id;
526 u8 len;
527 u8 mode;
528 u8 channel;
529 u8 count;
530} __attribute__ ((packed));
531
532struct ieee80211_action {
533 struct ieee80211_hdr_3addr header;
534 u8 category;
535 u8 action;
536 union {
537 struct ieee80211_action_exchange {
538 u8 token;
539 struct ieee80211_info_element info_element[0];
540 } exchange;
541 struct ieee80211_channel_switch channel_switch;
542
543 } format;
544} __attribute__ ((packed));
545
546struct ieee80211_disassoc {
547 struct ieee80211_hdr_3addr header;
548 __le16 reason;
549} __attribute__ ((packed));
550
551/* Alias deauth for disassoc */
552#define ieee80211_deauth ieee80211_disassoc
553
554struct ieee80211_probe_request {
555 struct ieee80211_hdr_3addr header;
556 /* SSID, supported rates */
557 struct ieee80211_info_element info_element[0];
558} __attribute__ ((packed));
559
560struct ieee80211_probe_response {
561 struct ieee80211_hdr_3addr header;
562 __le32 time_stamp[2];
563 __le16 beacon_interval;
564 __le16 capability;
565 /* SSID, supported rates, FH params, DS params,
566 * CF params, IBSS params, TIM (if beacon), RSN */
567 struct ieee80211_info_element info_element[0];
568} __attribute__ ((packed));
569
570/* Alias beacon for probe_response */
571#define ieee80211_beacon ieee80211_probe_response
572
573struct ieee80211_assoc_request {
574 struct ieee80211_hdr_3addr header;
575 __le16 capability;
576 __le16 listen_interval;
577 /* SSID, supported rates, RSN */
578 struct ieee80211_info_element info_element[0];
579} __attribute__ ((packed));
580
581struct ieee80211_reassoc_request {
582 struct ieee80211_hdr_3addr header;
583 __le16 capability;
584 __le16 listen_interval;
585 u8 current_ap[ETH_ALEN];
586 struct ieee80211_info_element info_element[0];
587} __attribute__ ((packed));
588
589struct ieee80211_assoc_response {
590 struct ieee80211_hdr_3addr header;
591 __le16 capability;
592 __le16 status;
593 __le16 aid;
594 /* supported rates */
595 struct ieee80211_info_element info_element[0];
596} __attribute__ ((packed));
597
598struct ieee80211_txb {
599 u8 nr_frags;
600 u8 encrypted;
601 u8 rts_included;
602 u8 reserved;
603 u16 frag_size;
604 u16 payload_size;
605 struct sk_buff *fragments[0];
606};
607
608/* SWEEP TABLE ENTRIES NUMBER */
609#define MAX_SWEEP_TAB_ENTRIES 42
610#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
611/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
612 * only use 8, and then use extended rates for the remaining supported
613 * rates. Other APs, however, stick all of their supported rates on the
614 * main rates information element... */
615#define MAX_RATES_LENGTH ((u8)12)
616#define MAX_RATES_EX_LENGTH ((u8)16)
617#define MAX_NETWORK_COUNT 128
618
619#define CRC_LENGTH 4U
620
621#define MAX_WPA_IE_LEN 64
622
623#define NETWORK_HAS_OFDM (1<<1)
624#define NETWORK_HAS_CCK (1<<2)
625
626/* QoS structure */
627#define NETWORK_HAS_QOS_PARAMETERS (1<<3)
628#define NETWORK_HAS_QOS_INFORMATION (1<<4)
629#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
630 NETWORK_HAS_QOS_INFORMATION)
631
632/* 802.11h */
633#define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
634#define NETWORK_HAS_CSA (1<<6)
635#define NETWORK_HAS_QUIET (1<<7)
636#define NETWORK_HAS_IBSS_DFS (1<<8)
637#define NETWORK_HAS_TPC_REPORT (1<<9)
638
639#define NETWORK_HAS_ERP_VALUE (1<<10)
640
641#define QOS_QUEUE_NUM 4
642#define QOS_OUI_LEN 3
643#define QOS_OUI_TYPE 2
644#define QOS_ELEMENT_ID 221
645#define QOS_OUI_INFO_SUB_TYPE 0
646#define QOS_OUI_PARAM_SUB_TYPE 1
647#define QOS_VERSION_1 1
648#define QOS_AIFSN_MIN_VALUE 2
649
650struct ieee80211_qos_information_element {
651 u8 elementID;
652 u8 length;
653 u8 qui[QOS_OUI_LEN];
654 u8 qui_type;
655 u8 qui_subtype;
656 u8 version;
657 u8 ac_info;
658} __attribute__ ((packed));
659
660struct ieee80211_qos_ac_parameter {
661 u8 aci_aifsn;
662 u8 ecw_min_max;
663 __le16 tx_op_limit;
664} __attribute__ ((packed));
665
666struct ieee80211_qos_parameter_info {
667 struct ieee80211_qos_information_element info_element;
668 u8 reserved;
669 struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
670} __attribute__ ((packed));
671
672struct ieee80211_qos_parameters {
673 __le16 cw_min[QOS_QUEUE_NUM];
674 __le16 cw_max[QOS_QUEUE_NUM];
675 u8 aifs[QOS_QUEUE_NUM];
676 u8 flag[QOS_QUEUE_NUM];
677 __le16 tx_op_limit[QOS_QUEUE_NUM];
678} __attribute__ ((packed));
679
680struct ieee80211_qos_data {
681 struct ieee80211_qos_parameters parameters;
682 int active;
683 int supported;
684 u8 param_count;
685 u8 old_param_count;
686};
687
688struct ieee80211_tim_parameters {
689 u8 tim_count;
690 u8 tim_period;
691} __attribute__ ((packed));
692
693/*******************************************************/
694
695enum { /* ieee80211_basic_report.map */
696 IEEE80211_BASIC_MAP_BSS = (1 << 0),
697 IEEE80211_BASIC_MAP_OFDM = (1 << 1),
698 IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2),
699 IEEE80211_BASIC_MAP_RADAR = (1 << 3),
700 IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4),
701 /* Bits 5-7 are reserved */
702
703};
704struct ieee80211_basic_report {
705 u8 channel;
706 __le64 start_time;
707 __le16 duration;
708 u8 map;
709} __attribute__ ((packed));
710
711enum { /* ieee80211_measurement_request.mode */
712 /* Bit 0 is reserved */
713 IEEE80211_MEASUREMENT_ENABLE = (1 << 1),
714 IEEE80211_MEASUREMENT_REQUEST = (1 << 2),
715 IEEE80211_MEASUREMENT_REPORT = (1 << 3),
716 /* Bits 4-7 are reserved */
717};
718
719enum {
720 IEEE80211_REPORT_BASIC = 0, /* required */
721 IEEE80211_REPORT_CCA = 1, /* optional */
722 IEEE80211_REPORT_RPI = 2, /* optional */
723 /* 3-255 reserved */
724};
725
726struct ieee80211_measurement_params {
727 u8 channel;
728 __le64 start_time;
729 __le16 duration;
730} __attribute__ ((packed));
731
732struct ieee80211_measurement_request {
733 struct ieee80211_info_element ie;
734 u8 token;
735 u8 mode;
736 u8 type;
737 struct ieee80211_measurement_params params[0];
738} __attribute__ ((packed));
739
740struct ieee80211_measurement_report {
741 struct ieee80211_info_element ie;
742 u8 token;
743 u8 mode;
744 u8 type;
745 union {
746 struct ieee80211_basic_report basic[0];
747 } u;
748} __attribute__ ((packed));
749
750struct ieee80211_tpc_report {
751 u8 transmit_power;
752 u8 link_margin;
753} __attribute__ ((packed));
754
755struct ieee80211_channel_map {
756 u8 channel;
757 u8 map;
758} __attribute__ ((packed));
759
760struct ieee80211_ibss_dfs {
761 struct ieee80211_info_element ie;
762 u8 owner[ETH_ALEN];
763 u8 recovery_interval;
764 struct ieee80211_channel_map channel_map[0];
765};
766
767struct ieee80211_csa {
768 u8 mode;
769 u8 channel;
770 u8 count;
771} __attribute__ ((packed));
772
773struct ieee80211_quiet {
774 u8 count;
775 u8 period;
776 u8 duration;
777 u8 offset;
778} __attribute__ ((packed));
779
780struct ieee80211_network {
781 /* These entries are used to identify a unique network */
782 u8 bssid[ETH_ALEN];
783 u8 channel;
784 /* Ensure null-terminated for any debug msgs */
785 u8 ssid[IW_ESSID_MAX_SIZE + 1];
786 u8 ssid_len;
787
788 struct ieee80211_qos_data qos_data;
789
790 /* These are network statistics */
791 struct ieee80211_rx_stats stats;
792 u16 capability;
793 u8 rates[MAX_RATES_LENGTH];
794 u8 rates_len;
795 u8 rates_ex[MAX_RATES_EX_LENGTH];
796 u8 rates_ex_len;
797 unsigned long last_scanned;
798 u8 mode;
799 u32 flags;
800 u32 last_associate;
801 u32 time_stamp[2];
802 u16 beacon_interval;
803 u16 listen_interval;
804 u16 atim_window;
805 u8 erp_value;
806 u8 wpa_ie[MAX_WPA_IE_LEN];
807 size_t wpa_ie_len;
808 u8 rsn_ie[MAX_WPA_IE_LEN];
809 size_t rsn_ie_len;
810 struct ieee80211_tim_parameters tim;
811
812 /* 802.11h info */
813
814 /* Power Constraint - mandatory if spctrm mgmt required */
815 u8 power_constraint;
816
817 /* TPC Report - mandatory if spctrm mgmt required */
818 struct ieee80211_tpc_report tpc_report;
819
820 /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
821 * NOTE: This is variable length and so must be allocated dynamically */
822 struct ieee80211_ibss_dfs *ibss_dfs;
823
824 /* Channel Switch Announcement - optional if spctrm mgmt required */
825 struct ieee80211_csa csa;
826
827 /* Quiet - optional if spctrm mgmt required */
828 struct ieee80211_quiet quiet;
829
830 struct list_head list;
831};
832
833enum ieee80211_state {
834 IEEE80211_UNINITIALIZED = 0,
835 IEEE80211_INITIALIZED,
836 IEEE80211_ASSOCIATING,
837 IEEE80211_ASSOCIATED,
838 IEEE80211_AUTHENTICATING,
839 IEEE80211_AUTHENTICATED,
840 IEEE80211_SHUTDOWN
841};
842
843#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
844#define DEFAULT_FTS 2346
845
846#define CFG_IEEE80211_RESERVE_FCS (1<<0)
847#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
848#define CFG_IEEE80211_RTS (1<<2)
849
850#define IEEE80211_24GHZ_MIN_CHANNEL 1
851#define IEEE80211_24GHZ_MAX_CHANNEL 14
852#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
853 IEEE80211_24GHZ_MIN_CHANNEL + 1)
854
855#define IEEE80211_52GHZ_MIN_CHANNEL 34
856#define IEEE80211_52GHZ_MAX_CHANNEL 165
857#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
858 IEEE80211_52GHZ_MIN_CHANNEL + 1)
859
860enum {
861 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
862 IEEE80211_CH_80211H_RULES = (1 << 1),
863 IEEE80211_CH_B_ONLY = (1 << 2),
864 IEEE80211_CH_NO_IBSS = (1 << 3),
865 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
866 IEEE80211_CH_RADAR_DETECT = (1 << 5),
867 IEEE80211_CH_INVALID = (1 << 6),
868};
869
870struct ieee80211_channel {
871 u32 freq; /* in MHz */
872 u8 channel;
873 u8 flags;
874 u8 max_power; /* in dBm */
875};
876
877struct ieee80211_geo {
878 u8 name[4];
879 u8 bg_channels;
880 u8 a_channels;
881 struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS];
882 struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS];
883};
884
885struct ieee80211_device {
886 struct net_device *dev;
887 struct ieee80211_security sec;
888
889 /* Bookkeeping structures */
890 struct net_device_stats stats;
891 struct ieee80211_stats ieee_stats;
892
893 struct ieee80211_geo geo;
894
895 /* Probe / Beacon management */
896 struct list_head network_free_list;
897 struct list_head network_list;
898 struct ieee80211_network *networks;
899 int scans;
900 int scan_age;
901
902 int iw_mode; /* operating mode (IW_MODE_*) */
903 struct iw_spy_data spy_data; /* iwspy support */
904
905 spinlock_t lock;
906
907 int tx_headroom; /* Set to size of any additional room needed at front
908 * of allocated Tx SKBs */
909 u32 config;
910
911 /* WEP and other encryption related settings at the device level */
912 int open_wep; /* Set to 1 to allow unencrypted frames */
913
914 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
915 * WEP key changes */
916
917 /* If the host performs {en,de}cryption, then set to 1 */
918 int host_encrypt;
919 int host_encrypt_msdu;
920 int host_decrypt;
921 /* host performs multicast decryption */
922 int host_mc_decrypt;
923
924 /* host should strip IV and ICV from protected frames */
925 /* meaningful only when hardware decryption is being used */
926 int host_strip_iv_icv;
927
928 int host_open_frag;
929 int host_build_iv;
930 int ieee802_1x; /* is IEEE 802.1X used */
931
932 /* WPA data */
933 int wpa_enabled;
934 int drop_unencrypted;
935 int privacy_invoked;
936 size_t wpa_ie_len;
937 u8 *wpa_ie;
938
939 struct lib80211_crypt_info crypt_info;
940
941 int bcrx_sta_key; /* use individual keys to override default keys even
942 * with RX of broad/multicast frames */
943
944 /* Fragmentation structures */
945 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
946 unsigned int frag_next_idx;
947 u16 fts; /* Fragmentation Threshold */
948 u16 rts; /* RTS threshold */
949
950 /* Association info */
951 u8 bssid[ETH_ALEN];
952
953 enum ieee80211_state state;
954
955 int mode; /* A, B, G */
956 int modulation; /* CCK, OFDM */
957 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
958 int abg_true; /* ABG flag */
959
960 int perfect_rssi;
961 int worst_rssi;
962
963 u16 prev_seq_ctl; /* used to drop duplicate frames */
964
965 /* Callback functions */
966 void (*set_security) (struct net_device * dev,
967 struct ieee80211_security * sec);
968 int (*hard_start_xmit) (struct ieee80211_txb * txb,
969 struct net_device * dev, int pri);
970 int (*reset_port) (struct net_device * dev);
971 int (*is_queue_full) (struct net_device * dev, int pri);
972
973 int (*handle_management) (struct net_device * dev,
974 struct ieee80211_network * network, u16 type);
975 int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
976
977 /* Typical STA methods */
978 int (*handle_auth) (struct net_device * dev,
979 struct ieee80211_auth * auth);
980 int (*handle_deauth) (struct net_device * dev,
981 struct ieee80211_deauth * auth);
982 int (*handle_action) (struct net_device * dev,
983 struct ieee80211_action * action,
984 struct ieee80211_rx_stats * stats);
985 int (*handle_disassoc) (struct net_device * dev,
986 struct ieee80211_disassoc * assoc);
987 int (*handle_beacon) (struct net_device * dev,
988 struct ieee80211_beacon * beacon,
989 struct ieee80211_network * network);
990 int (*handle_probe_response) (struct net_device * dev,
991 struct ieee80211_probe_response * resp,
992 struct ieee80211_network * network);
993 int (*handle_probe_request) (struct net_device * dev,
994 struct ieee80211_probe_request * req,
995 struct ieee80211_rx_stats * stats);
996 int (*handle_assoc_response) (struct net_device * dev,
997 struct ieee80211_assoc_response * resp,
998 struct ieee80211_network * network);
999
1000 /* Typical AP methods */
1001 int (*handle_assoc_request) (struct net_device * dev);
1002 int (*handle_reassoc_request) (struct net_device * dev,
1003 struct ieee80211_reassoc_request * req);
1004
1005 /* This must be the last item so that it points to the data
1006 * allocated beyond this structure by alloc_ieee80211 */
1007 u8 priv[0];
1008};
1009
1010#define IEEE_A (1<<0)
1011#define IEEE_B (1<<1)
1012#define IEEE_G (1<<2)
1013#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1014
1015static inline void *ieee80211_priv(struct net_device *dev)
1016{
1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1018}
1019
1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1021 int mode)
1022{
1023 /*
1024 * It is possible for both access points and our device to support
1025 * combinations of modes, so as long as there is one valid combination
1026 * of ap/device supported modes, then return success
1027 *
1028 */
1029 if ((mode & IEEE_A) &&
1030 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1031 (ieee->freq_band & IEEE80211_52GHZ_BAND))
1032 return 1;
1033
1034 if ((mode & IEEE_G) &&
1035 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1036 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1037 return 1;
1038
1039 if ((mode & IEEE_B) &&
1040 (ieee->modulation & IEEE80211_CCK_MODULATION) &&
1041 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1042 return 1;
1043
1044 return 0;
1045}
1046
1047static inline int ieee80211_get_hdrlen(u16 fc)
1048{
1049 int hdrlen = IEEE80211_3ADDR_LEN;
1050 u16 stype = WLAN_FC_GET_STYPE(fc);
1051
1052 switch (WLAN_FC_GET_TYPE(fc)) {
1053 case IEEE80211_FTYPE_DATA:
1054 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1055 hdrlen = IEEE80211_4ADDR_LEN;
1056 if (stype & IEEE80211_STYPE_QOS_DATA)
1057 hdrlen += 2;
1058 break;
1059 case IEEE80211_FTYPE_CTL:
1060 switch (WLAN_FC_GET_STYPE(fc)) {
1061 case IEEE80211_STYPE_CTS:
1062 case IEEE80211_STYPE_ACK:
1063 hdrlen = IEEE80211_1ADDR_LEN;
1064 break;
1065 default:
1066 hdrlen = IEEE80211_2ADDR_LEN;
1067 break;
1068 }
1069 break;
1070 }
1071
1072 return hdrlen;
1073}
1074
1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1076{
1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1078 case IEEE80211_1ADDR_LEN:
1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1080 case IEEE80211_2ADDR_LEN:
1081 return ((struct ieee80211_hdr_2addr *)hdr)->payload;
1082 case IEEE80211_3ADDR_LEN:
1083 return ((struct ieee80211_hdr_3addr *)hdr)->payload;
1084 case IEEE80211_4ADDR_LEN:
1085 return ((struct ieee80211_hdr_4addr *)hdr)->payload;
1086 }
1087 return NULL;
1088}
1089
1090static inline int ieee80211_is_ofdm_rate(u8 rate)
1091{
1092 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1093 case IEEE80211_OFDM_RATE_6MB:
1094 case IEEE80211_OFDM_RATE_9MB:
1095 case IEEE80211_OFDM_RATE_12MB:
1096 case IEEE80211_OFDM_RATE_18MB:
1097 case IEEE80211_OFDM_RATE_24MB:
1098 case IEEE80211_OFDM_RATE_36MB:
1099 case IEEE80211_OFDM_RATE_48MB:
1100 case IEEE80211_OFDM_RATE_54MB:
1101 return 1;
1102 }
1103 return 0;
1104}
1105
1106static inline int ieee80211_is_cck_rate(u8 rate)
1107{
1108 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1109 case IEEE80211_CCK_RATE_1MB:
1110 case IEEE80211_CCK_RATE_2MB:
1111 case IEEE80211_CCK_RATE_5MB:
1112 case IEEE80211_CCK_RATE_11MB:
1113 return 1;
1114 }
1115 return 0;
1116}
1117
1118/* ieee80211.c */
1119extern void free_ieee80211(struct net_device *dev);
1120extern struct net_device *alloc_ieee80211(int sizeof_priv);
1121
1122extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1123
1124/* ieee80211_tx.c */
1125extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
1126extern void ieee80211_txb_free(struct ieee80211_txb *);
1127
1128/* ieee80211_rx.c */
1129extern void ieee80211_rx_any(struct ieee80211_device *ieee,
1130 struct sk_buff *skb, struct ieee80211_rx_stats *stats);
1131extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1132 struct ieee80211_rx_stats *rx_stats);
1133/* make sure to set stats->len */
1134extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1135 struct ieee80211_hdr_4addr *header,
1136 struct ieee80211_rx_stats *stats);
1137extern void ieee80211_network_reset(struct ieee80211_network *network);
1138
1139/* ieee80211_geo.c */
1140extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device
1141 *ieee);
1142extern int ieee80211_set_geo(struct ieee80211_device *ieee,
1143 const struct ieee80211_geo *geo);
1144
1145extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee,
1146 u8 channel);
1147extern int ieee80211_channel_to_index(struct ieee80211_device *ieee,
1148 u8 channel);
1149extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);
1150extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee,
1151 u8 channel);
1152extern const struct ieee80211_channel *ieee80211_get_channel(struct
1153 ieee80211_device
1154 *ieee, u8 channel);
1155extern u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee,
1156 u8 channel);
1157
1158/* ieee80211_wx.c */
1159extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
1160 struct iw_request_info *info,
1161 union iwreq_data *wrqu, char *key);
1162extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
1163 struct iw_request_info *info,
1164 union iwreq_data *wrqu, char *key);
1165extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
1166 struct iw_request_info *info,
1167 union iwreq_data *wrqu, char *key);
1168extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
1169 struct iw_request_info *info,
1170 union iwreq_data *wrqu, char *extra);
1171extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
1172 struct iw_request_info *info,
1173 union iwreq_data *wrqu, char *extra);
1174
1175static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1176{
1177 ieee->scans++;
1178}
1179
1180static inline int ieee80211_get_scans(struct ieee80211_device *ieee)
1181{
1182 return ieee->scans;
1183}
1184
1185#endif /* IEEE80211_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 384698cb773a..23c3f3d97779 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -230,8 +230,10 @@ enum ieee80211_radiotap_type {
230 * 802.11 header and payload 230 * 802.11 header and payload
231 * (to 32-bit boundary) 231 * (to 32-bit boundary)
232 */ 232 */
233#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
234
233/* For IEEE80211_RADIOTAP_RX_FLAGS */ 235/* For IEEE80211_RADIOTAP_RX_FLAGS */
234#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ 236#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */
235 237
236/* For IEEE80211_RADIOTAP_TX_FLAGS */ 238/* For IEEE80211_RADIOTAP_TX_FLAGS */
237#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 239#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index c8effa4b1feb..38b78132019b 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -39,8 +39,6 @@ struct inet6_ifaddr
39 39
40 __u32 valid_lft; 40 __u32 valid_lft;
41 __u32 prefered_lft; 41 __u32 prefered_lft;
42 unsigned long cstamp; /* created timestamp */
43 unsigned long tstamp; /* updated timestamp */
44 atomic_t refcnt; 42 atomic_t refcnt;
45 spinlock_t lock; 43 spinlock_t lock;
46 44
@@ -49,6 +47,9 @@ struct inet6_ifaddr
49 47
50 __u16 scope; 48 __u16 scope;
51 49
50 unsigned long cstamp; /* created timestamp */
51 unsigned long tstamp; /* updated timestamp */
52
52 struct timer_list timer; 53 struct timer_list timer;
53 54
54 struct inet6_dev *idev; 55 struct inet6_dev *idev;
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 7040a782c656..9b5d08f4f6e8 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -113,12 +113,12 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
113static inline int INET_ECN_set_ce(struct sk_buff *skb) 113static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case cpu_to_be16(ETH_P_IP):
117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(ip_hdr(skb)); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case cpu_to_be16(ETH_P_IPV6):
122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(ipv6_hdr(skb)); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e081eefd6f47..39f2dc943908 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -61,7 +61,8 @@ void inet_frag_destroy(struct inet_frag_queue *q,
61 struct inet_frags *f, int *work); 61 struct inet_frags *f, int *work);
62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); 62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f);
63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
64 struct inet_frags *f, void *key, unsigned int hash); 64 struct inet_frags *f, void *key, unsigned int hash)
65 __releases(&f->lock);
65 66
66static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 67static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
67{ 68{
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index d0a043153cc6..a44e2248b2ef 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -82,6 +82,7 @@ struct inet_bind_bucket {
82#endif 82#endif
83 unsigned short port; 83 unsigned short port;
84 signed short fastreuse; 84 signed short fastreuse;
85 int num_owners;
85 struct hlist_node node; 86 struct hlist_node node;
86 struct hlist_head owners; 87 struct hlist_head owners;
87}; 88};
@@ -133,7 +134,7 @@ struct inet_hashinfo {
133 struct inet_bind_hashbucket *bhash; 134 struct inet_bind_hashbucket *bhash;
134 135
135 unsigned int bhash_size; 136 unsigned int bhash_size;
136 /* Note : 4 bytes padding on 64 bit arches */ 137 /* 4 bytes hole on 64 bit */
137 138
138 struct kmem_cache *bind_bucket_cachep; 139 struct kmem_cache *bind_bucket_cachep;
139 140
@@ -150,6 +151,7 @@ struct inet_hashinfo {
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE] 151 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp; 152 ____cacheline_aligned_in_smp;
152 153
154 atomic_t bsockets;
153}; 155};
154 156
155static inline struct inet_ehash_bucket *inet_ehash_bucket( 157static inline struct inet_ehash_bucket *inet_ehash_bucket(
diff --git a/include/net/ip.h b/include/net/ip.h
index 10868139e656..4ac7577f98d0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -55,6 +55,7 @@ struct ipcm_cookie
55 __be32 addr; 55 __be32 addr;
56 int oif; 56 int oif;
57 struct ip_options *opt; 57 struct ip_options *opt;
58 union skb_shared_tx shtx;
58}; 59};
59 60
60#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ab9b003ab671..bbae1e87efcd 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -184,8 +184,8 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
184/* 184/*
185 * The port number of FTP service (in network order). 185 * The port number of FTP service (in network order).
186 */ 186 */
187#define FTPPORT __constant_htons(21) 187#define FTPPORT cpu_to_be16(21)
188#define FTPDATA __constant_htons(20) 188#define FTPDATA cpu_to_be16(20)
189 189
190/* 190/*
191 * TCP State Values 191 * TCP State Values
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6d5b58a1c743..c1f16fc49ade 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -196,8 +196,8 @@ struct ip6_flowlabel
196 struct net *fl_net; 196 struct net *fl_net;
197}; 197};
198 198
199#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) 199#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
200#define IPV6_FLOWLABEL_MASK __constant_htonl(0x000FFFFF) 200#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
201 201
202struct ipv6_fl_socklist 202struct ipv6_fl_socklist
203{ 203{
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 4cc0b4eca948..a14121dd1932 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,7 +27,7 @@ struct ipx_address {
27 27
28struct ipxhdr { 28struct ipxhdr {
29 __be16 ipx_checksum __attribute__ ((packed)); 29 __be16 ipx_checksum __attribute__ ((packed));
30#define IPX_NO_CHECKSUM __constant_htons(0xFFFF) 30#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
31 __be16 ipx_pktsize __attribute__ ((packed)); 31 __be16 ipx_pktsize __attribute__ ((packed));
32 __u8 ipx_tctrl; 32 __u8 ipx_tctrl;
33 __u8 ipx_type; 33 __u8 ipx_type;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 559422fc0943..3b83a80e3fe0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,12 +93,9 @@ struct ieee80211_ht_bss_info {
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
97 * for A-MPDU operation.
98 */ 96 */
99enum ieee80211_max_queues { 97enum ieee80211_max_queues {
100 IEEE80211_MAX_QUEUES = 16, 98 IEEE80211_MAX_QUEUES = 4,
101 IEEE80211_MAX_AMPDU_QUEUES = 16,
102}; 99};
103 100
104/** 101/**
@@ -207,7 +204,7 @@ struct ieee80211_bss_conf {
207 u16 beacon_int; 204 u16 beacon_int;
208 u16 assoc_capability; 205 u16 assoc_capability;
209 u64 timestamp; 206 u64 timestamp;
210 u64 basic_rates; 207 u32 basic_rates;
211 struct ieee80211_bss_ht_conf ht; 208 struct ieee80211_bss_ht_conf ht;
212}; 209};
213 210
@@ -245,6 +242,12 @@ struct ieee80211_bss_conf {
245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 242 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
246 * set by rate control algorithms to indicate probe rate, will 243 * set by rate control algorithms to indicate probe rate, will
247 * be cleared for fragmented frames (except on the last fragment) 244 * be cleared for fragmented frames (except on the last fragment)
245 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
246 * set this flag in the driver; indicates that the rate control
247 * algorithm was used and should be notified of TX status
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out.
248 */ 251 */
249enum mac80211_tx_control_flags { 252enum mac80211_tx_control_flags {
250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -260,8 +263,30 @@ enum mac80211_tx_control_flags {
260 IEEE80211_TX_STAT_AMPDU = BIT(10), 263 IEEE80211_TX_STAT_AMPDU = BIT(10),
261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 264 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
263}; 268};
264 269
270/**
271 * enum mac80211_rate_control_flags - per-rate flags set by the
272 * Rate Control algorithm.
273 *
274 * These flags are set by the Rate control algorithm for each rate during tx,
275 * in the @flags member of struct ieee80211_tx_rate.
276 *
277 * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
278 * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
279 * This is set if the current BSS requires ERP protection.
280 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
281 * @IEEE80211_TX_RC_MCS: HT rate.
282 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
283 * Greenfield mode.
284 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
285 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
286 * adjacent 20 MHz channels, if the current channel type is
287 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
288 * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
289 */
265enum mac80211_rate_control_flags { 290enum mac80211_rate_control_flags {
266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), 291 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 292 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
@@ -500,17 +525,6 @@ enum ieee80211_conf_flags {
500 IEEE80211_CONF_PS = (1<<1), 525 IEEE80211_CONF_PS = (1<<1),
501}; 526};
502 527
503/* XXX: remove all this once drivers stop trying to use it */
504static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
505{
506 return 0;
507}
508#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
509
510struct ieee80211_ht_conf {
511 bool enabled;
512 enum nl80211_channel_type channel_type;
513};
514 528
515/** 529/**
516 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
@@ -520,10 +534,10 @@ struct ieee80211_ht_conf {
520 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
521 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
522 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
523 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
524 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed 539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
525 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
526 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
527 */ 541 */
528enum ieee80211_conf_changed { 542enum ieee80211_conf_changed {
529 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -531,10 +545,10 @@ enum ieee80211_conf_changed {
531 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
532 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
533 IEEE80211_CONF_CHANGE_PS = BIT(4), 547 IEEE80211_CONF_CHANGE_PS = BIT(4),
534 IEEE80211_CONF_CHANGE_POWER = BIT(5), 548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
535 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 549 IEEE80211_CONF_CHANGE_POWER = BIT(6),
536 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
537 IEEE80211_CONF_CHANGE_HT = BIT(8), 551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
538}; 552};
539 553
540/** 554/**
@@ -547,8 +561,9 @@ enum ieee80211_conf_changed {
547 * @listen_interval: listen interval in units of beacon interval 561 * @listen_interval: listen interval in units of beacon interval
548 * @flags: configuration flags defined above 562 * @flags: configuration flags defined above
549 * @power_level: requested transmit power (in dBm) 563 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
550 * @channel: the channel to tune to 565 * @channel: the channel to tune to
551 * @ht: the HT configuration for the device 566 * @channel_type: the channel (HT) type
552 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
553 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
554 * but actually means the number of transmissions not the number of retries 569 * but actually means the number of transmissions not the number of retries
@@ -559,7 +574,7 @@ enum ieee80211_conf_changed {
559struct ieee80211_conf { 574struct ieee80211_conf {
560 int beacon_int; 575 int beacon_int;
561 u32 flags; 576 u32 flags;
562 int power_level; 577 int power_level, dynamic_ps_timeout;
563 578
564 u16 listen_interval; 579 u16 listen_interval;
565 bool radio_enabled; 580 bool radio_enabled;
@@ -567,7 +582,7 @@ struct ieee80211_conf {
567 u8 long_frame_max_tx_count, short_frame_max_tx_count; 582 u8 long_frame_max_tx_count, short_frame_max_tx_count;
568 583
569 struct ieee80211_channel *channel; 584 struct ieee80211_channel *channel;
570 struct ieee80211_ht_conf ht; 585 enum nl80211_channel_type channel_type;
571}; 586};
572 587
573/** 588/**
@@ -630,10 +645,12 @@ struct ieee80211_if_init_conf {
630 * @IEEE80211_IFCC_BSSID: The BSSID changed. 645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
631 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
632 * (currently AP and MESH only), use ieee80211_beacon_get(). 647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
633 */ 649 */
634enum ieee80211_if_conf_change { 650enum ieee80211_if_conf_change {
635 IEEE80211_IFCC_BSSID = BIT(0), 651 IEEE80211_IFCC_BSSID = BIT(0),
636 IEEE80211_IFCC_BEACON = BIT(1), 652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
637}; 654};
638 655
639/** 656/**
@@ -641,13 +658,16 @@ enum ieee80211_if_conf_change {
641 * 658 *
642 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
643 * @bssid: BSSID of the network we are associated to/creating. 660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
644 * 663 *
645 * This structure is passed to the config_interface() callback of 664 * This structure is passed to the config_interface() callback of
646 * &struct ieee80211_hw. 665 * &struct ieee80211_hw.
647 */ 666 */
648struct ieee80211_if_conf { 667struct ieee80211_if_conf {
649 u32 changed; 668 u32 changed;
650 u8 *bssid; 669 const u8 *bssid;
670 bool enable_beacon;
651}; 671};
652 672
653/** 673/**
@@ -655,11 +675,13 @@ struct ieee80211_if_conf {
655 * @ALG_WEP: WEP40 or WEP104 675 * @ALG_WEP: WEP40 or WEP104
656 * @ALG_TKIP: TKIP 676 * @ALG_TKIP: TKIP
657 * @ALG_CCMP: CCMP (AES) 677 * @ALG_CCMP: CCMP (AES)
678 * @ALG_AES_CMAC: AES-128-CMAC
658 */ 679 */
659enum ieee80211_key_alg { 680enum ieee80211_key_alg {
660 ALG_WEP, 681 ALG_WEP,
661 ALG_TKIP, 682 ALG_TKIP,
662 ALG_CCMP, 683 ALG_CCMP,
684 ALG_AES_CMAC,
663}; 685};
664 686
665/** 687/**
@@ -688,12 +710,16 @@ enum ieee80211_key_len {
688 * generation in software. 710 * generation in software.
689 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 711 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
690 * that the key is pairwise rather then a shared key. 712 * that the key is pairwise rather then a shared key.
713 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
714 * CCMP key if it requires CCMP encryption of management frames (MFP) to
715 * be done in software.
691 */ 716 */
692enum ieee80211_key_flags { 717enum ieee80211_key_flags {
693 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 718 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
694 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 719 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
695 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 720 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
696 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 721 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
722 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
697}; 723};
698 724
699/** 725/**
@@ -714,8 +740,8 @@ enum ieee80211_key_flags {
714 * - Temporal Encryption Key (128 bits) 740 * - Temporal Encryption Key (128 bits)
715 * - Temporal Authenticator Tx MIC Key (64 bits) 741 * - Temporal Authenticator Tx MIC Key (64 bits)
716 * - Temporal Authenticator Rx MIC Key (64 bits) 742 * - Temporal Authenticator Rx MIC Key (64 bits)
717 * @icv_len: FIXME 743 * @icv_len: The ICV length for this key type
718 * @iv_len: FIXME 744 * @iv_len: The IV length for this key type
719 */ 745 */
720struct ieee80211_key_conf { 746struct ieee80211_key_conf {
721 enum ieee80211_key_alg alg; 747 enum ieee80211_key_alg alg;
@@ -759,7 +785,7 @@ enum set_key_cmd {
759 * sizeof(void *), size is determined in hw information. 785 * sizeof(void *), size is determined in hw information.
760 */ 786 */
761struct ieee80211_sta { 787struct ieee80211_sta {
762 u64 supp_rates[IEEE80211_NUM_BANDS]; 788 u32 supp_rates[IEEE80211_NUM_BANDS];
763 u8 addr[ETH_ALEN]; 789 u8 addr[ETH_ALEN];
764 u16 aid; 790 u16 aid;
765 struct ieee80211_sta_ht_cap ht_cap; 791 struct ieee80211_sta_ht_cap ht_cap;
@@ -833,11 +859,6 @@ enum ieee80211_tkip_key_type {
833 * expect values between 0 and @max_signal. 859 * expect values between 0 and @max_signal.
834 * If possible please provide dB or dBm instead. 860 * If possible please provide dB or dBm instead.
835 * 861 *
836 * @IEEE80211_HW_SIGNAL_DB:
837 * Hardware gives signal values in dB, decibel difference from an
838 * arbitrary, fixed reference. We expect values between 0 and @max_signal.
839 * If possible please provide dBm instead.
840 *
841 * @IEEE80211_HW_SIGNAL_DBM: 862 * @IEEE80211_HW_SIGNAL_DBM:
842 * Hardware gives signal values in dBm, decibel difference from 863 * Hardware gives signal values in dBm, decibel difference from
843 * one milliwatt. This is the preferred method since it is standardized 864 * one milliwatt. This is the preferred method since it is standardized
@@ -854,10 +875,22 @@ enum ieee80211_tkip_key_type {
854 * @IEEE80211_HW_AMPDU_AGGREGATION: 875 * @IEEE80211_HW_AMPDU_AGGREGATION:
855 * Hardware supports 11n A-MPDU aggregation. 876 * Hardware supports 11n A-MPDU aggregation.
856 * 877 *
857 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS: 878 * @IEEE80211_HW_SUPPORTS_PS:
858 * Hardware which has dynamic power save support, meaning 879 * Hardware has power save support (i.e. can go to sleep).
859 * that power save is enabled in idle periods, and don't need support 880 *
860 * from stack. 881 * @IEEE80211_HW_PS_NULLFUNC_STACK:
882 * Hardware requires nullfunc frame handling in stack, implies
883 * stack support for dynamic PS.
884 *
885 * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
886 * Hardware has support for dynamic PS.
887 *
888 * @IEEE80211_HW_MFP_CAPABLE:
889 * Hardware supports management frame protection (MFP, IEEE 802.11w).
890 *
891 * @IEEE80211_HW_BEACON_FILTER:
892 * Hardware supports dropping of irrelevant beacon frames to
893 * avoid waking up cpu.
861 */ 894 */
862enum ieee80211_hw_flags { 895enum ieee80211_hw_flags {
863 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 896 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -865,12 +898,15 @@ enum ieee80211_hw_flags {
865 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 898 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
866 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 899 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
867 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 900 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
868 IEEE80211_HW_SIGNAL_DB = 1<<6, 901 IEEE80211_HW_SIGNAL_DBM = 1<<6,
869 IEEE80211_HW_SIGNAL_DBM = 1<<7, 902 IEEE80211_HW_NOISE_DBM = 1<<7,
870 IEEE80211_HW_NOISE_DBM = 1<<8, 903 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
871 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 904 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
872 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, 905 IEEE80211_HW_SUPPORTS_PS = 1<<10,
873 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11, 906 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
907 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
908 IEEE80211_HW_MFP_CAPABLE = 1<<13,
909 IEEE80211_HW_BEACON_FILTER = 1<<14,
874}; 910};
875 911
876/** 912/**
@@ -890,9 +926,8 @@ enum ieee80211_hw_flags {
890 * @workqueue: single threaded workqueue available for driver use, 926 * @workqueue: single threaded workqueue available for driver use,
891 * allocated by mac80211 on registration and flushed when an 927 * allocated by mac80211 on registration and flushed when an
892 * interface is removed. 928 * interface is removed.
893 * NOTICE: All work performed on this workqueue should NEVER 929 * NOTICE: All work performed on this workqueue must not
894 * acquire the RTNL lock (i.e. Don't use the function 930 * acquire the RTNL lock.
895 * ieee80211_iterate_active_interfaces())
896 * 931 *
897 * @priv: pointer to private area that was allocated for driver use 932 * @priv: pointer to private area that was allocated for driver use
898 * along with this structure. 933 * along with this structure.
@@ -914,12 +949,6 @@ enum ieee80211_hw_flags {
914 * data packets. WMM/QoS requires at least four, these 949 * data packets. WMM/QoS requires at least four, these
915 * queues need to have configurable access parameters. 950 * queues need to have configurable access parameters.
916 * 951 *
917 * @ampdu_queues: number of available hardware transmit queues
918 * for A-MPDU packets, these have no access parameters
919 * because they're used only for A-MPDU frames. Note that
920 * mac80211 will not currently use any of the regular queues
921 * for aggregation.
922 *
923 * @rate_control_algorithm: rate control algorithm for this hardware. 952 * @rate_control_algorithm: rate control algorithm for this hardware.
924 * If unset (NULL), the default algorithm will be used. Must be 953 * If unset (NULL), the default algorithm will be used. Must be
925 * set before calling ieee80211_register_hw(). 954 * set before calling ieee80211_register_hw().
@@ -944,7 +973,6 @@ struct ieee80211_hw {
944 int vif_data_size; 973 int vif_data_size;
945 int sta_data_size; 974 int sta_data_size;
946 u16 queues; 975 u16 queues;
947 u16 ampdu_queues;
948 u16 max_listen_interval; 976 u16 max_listen_interval;
949 s8 max_signal; 977 s8 max_signal;
950 u8 max_rates; 978 u8 max_rates;
@@ -952,6 +980,19 @@ struct ieee80211_hw {
952}; 980};
953 981
954/** 982/**
983 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
984 *
985 * @wiphy: the &struct wiphy which we want to query
986 *
987 * mac80211 drivers can use this to get to their respective
988 * &struct ieee80211_hw. Drivers wishing to get to their own private
989 * structure can then access it via hw->priv. Note that mac802111 drivers should
990 * not use wiphy_priv() to try to get their private driver structure as this
991 * is already used internally by mac80211.
992 */
993struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
994
995/**
955 * SET_IEEE80211_DEV - set device for 802.11 hardware 996 * SET_IEEE80211_DEV - set device for 802.11 hardware
956 * 997 *
957 * @hw: the &struct ieee80211_hw to set the device for 998 * @hw: the &struct ieee80211_hw to set the device for
@@ -973,16 +1014,6 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
973 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 1014 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
974} 1015}
975 1016
976static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
977{
978 return hw->queues;
979}
980
981static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
982{
983 return hw->queues + hw->ampdu_queues;
984}
985
986static inline struct ieee80211_rate * 1017static inline struct ieee80211_rate *
987ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 1018ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
988 const struct ieee80211_tx_info *c) 1019 const struct ieee80211_tx_info *c)
@@ -1018,16 +1049,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1018 * 1049 *
1019 * The set_key() callback in the &struct ieee80211_ops for a given 1050 * The set_key() callback in the &struct ieee80211_ops for a given
1020 * device is called to enable hardware acceleration of encryption and 1051 * device is called to enable hardware acceleration of encryption and
1021 * decryption. The callback takes an @address parameter that will be 1052 * decryption. The callback takes a @sta parameter that will be NULL
1022 * the broadcast address for default keys, the other station's hardware 1053 * for default keys or keys used for transmission only, or point to
1023 * address for individual keys or the zero address for keys that will 1054 * the station information for the peer for individual keys.
1024 * be used only for transmission.
1025 * Multiple transmission keys with the same key index may be used when 1055 * Multiple transmission keys with the same key index may be used when
1026 * VLANs are configured for an access point. 1056 * VLANs are configured for an access point.
1027 * 1057 *
1028 * The @local_address parameter will always be set to our own address,
1029 * this is only relevant if you support multiple local addresses.
1030 *
1031 * When transmitting, the TX control data will use the @hw_key_idx 1058 * When transmitting, the TX control data will use the @hw_key_idx
1032 * selected by the driver by modifying the &struct ieee80211_key_conf 1059 * selected by the driver by modifying the &struct ieee80211_key_conf
1033 * pointed to by the @key parameter to the set_key() function. 1060 * pointed to by the @key parameter to the set_key() function.
@@ -1061,6 +1088,60 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1061 */ 1088 */
1062 1089
1063/** 1090/**
1091 * DOC: Powersave support
1092 *
1093 * mac80211 has support for various powersave implementations.
1094 *
1095 * First, it can support hardware that handles all powersaving by
1096 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
1097 * hardware flag. In that case, it will be told about the desired
1098 * powersave mode depending on the association status, and the driver
1099 * must take care of sending nullfunc frames when necessary, i.e. when
1100 * entering and leaving powersave mode. The driver is required to look at
1101 * the AID in beacons and signal to the AP that it woke up when it finds
1102 * traffic directed to it. This mode supports dynamic PS by simply
1103 * enabling/disabling PS.
1104 *
1105 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
1106 * flag to indicate that it can support dynamic PS mode itself (see below).
1107 *
1108 * Other hardware designs cannot send nullfunc frames by themselves and also
1109 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will
1113 * wake up the hardware when multicast traffic is announced in the beacon.
1114 *
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending
1120 * a frame so that reply frames need not be buffered and therefore delayed
1121 * to the next wakeup. This can either be supported by hardware, in which case
1122 * the driver needs to look at the @dynamic_ps_timeout hardware configuration
1123 * value, or by the stack if all nullfunc handling is in the stack.
1124 */
1125
1126/**
1127 * DOC: Beacon filter support
1128 *
1129 * Some hardware have beacon filter support to reduce host cpu wakeups
1130 * which will reduce system power consumption. It usuallly works so that
1131 * the firmware creates a checksum of the beacon but omits all constantly
1132 * changing elements (TSF, TIM etc). Whenever the checksum changes the
1133 * beacon is forwarded to the host, otherwise it will be just dropped. That
1134 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed.
1136 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
1138 * The driver needs to enable beacon filter support whenever power save is
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
1140 * the stack will not check for beacon miss at all and the driver needs to
1141 * notify about complete loss of beacons with ieee80211_beacon_loss().
1142 */
1143
1144/**
1064 * DOC: Frame filtering 1145 * DOC: Frame filtering
1065 * 1146 *
1066 * mac80211 requires to see many management frames for proper 1147 * mac80211 requires to see many management frames for proper
@@ -1149,14 +1230,14 @@ enum ieee80211_filter_flags {
1149 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1230 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1150 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1231 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1151 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1232 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1152 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation 1233 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
1153 */ 1234 */
1154enum ieee80211_ampdu_mlme_action { 1235enum ieee80211_ampdu_mlme_action {
1155 IEEE80211_AMPDU_RX_START, 1236 IEEE80211_AMPDU_RX_START,
1156 IEEE80211_AMPDU_RX_STOP, 1237 IEEE80211_AMPDU_RX_STOP,
1157 IEEE80211_AMPDU_TX_START, 1238 IEEE80211_AMPDU_TX_START,
1158 IEEE80211_AMPDU_TX_STOP, 1239 IEEE80211_AMPDU_TX_STOP,
1159 IEEE80211_AMPDU_TX_RESUME, 1240 IEEE80211_AMPDU_TX_OPERATIONAL,
1160}; 1241};
1161 1242
1162/** 1243/**
@@ -1172,6 +1253,8 @@ enum ieee80211_ampdu_mlme_action {
1172 * configuration in the TX control data. This handler should, 1253 * configuration in the TX control data. This handler should,
1173 * preferably, never fail and stop queues appropriately, more 1254 * preferably, never fail and stop queues appropriately, more
1174 * importantly, however, it must never fail for A-MPDU-queues. 1255 * importantly, however, it must never fail for A-MPDU-queues.
1256 * This function should return NETDEV_TX_OK except in very
1257 * limited cases.
1175 * Must be implemented and atomic. 1258 * Must be implemented and atomic.
1176 * 1259 *
1177 * @start: Called before the first netdevice attached to the hardware 1260 * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1295,12 @@ enum ieee80211_ampdu_mlme_action {
1212 * 1295 *
1213 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1296 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1214 * function to change hardware configuration, e.g., channel. 1297 * function to change hardware configuration, e.g., channel.
1298 * This function should never fail but returns a negative error code
1299 * if it does.
1215 * 1300 *
1216 * @config_interface: Handler for configuration requests related to interfaces 1301 * @config_interface: Handler for configuration requests related to interfaces
1217 * (e.g. BSSID changes.) 1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1218 * 1304 *
1219 * @bss_info_changed: Handler for configuration requests related to BSS 1305 * @bss_info_changed: Handler for configuration requests related to BSS
1220 * parameters that may vary during BSS's lifespan, and may affect low 1306 * parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1318,9 @@ enum ieee80211_ampdu_mlme_action {
1232 * 1318 *
1233 * @set_key: See the section "Hardware crypto acceleration" 1319 * @set_key: See the section "Hardware crypto acceleration"
1234 * This callback can sleep, and is only called between add_interface 1320 * This callback can sleep, and is only called between add_interface
1235 * and remove_interface calls, i.e. while the interface with the 1321 * and remove_interface calls, i.e. while the given virtual interface
1236 * given local_address is enabled. 1322 * is enabled.
1323 * Returns a negative error code if the key can't be added.
1237 * 1324 *
1238 * @update_tkip_key: See the section "Hardware crypto acceleration" 1325 * @update_tkip_key: See the section "Hardware crypto acceleration"
1239 * This callback will be called in the context of Rx. Called for drivers 1326 * This callback will be called in the context of Rx. Called for drivers
@@ -1241,12 +1328,22 @@ enum ieee80211_ampdu_mlme_action {
1241 * 1328 *
1242 * @hw_scan: Ask the hardware to service the scan request, no need to start 1329 * @hw_scan: Ask the hardware to service the scan request, no need to start
1243 * the scan state machine in stack. The scan must honour the channel 1330 * the scan state machine in stack. The scan must honour the channel
1244 * configuration done by the regulatory agent in the wiphy's registered 1331 * configuration done by the regulatory agent in the wiphy's
1245 * bands. When the scan finishes, ieee80211_scan_completed() must be 1332 * registered bands. The hardware (or the driver) needs to make sure
1246 * called; note that it also must be called when the scan cannot finish 1333 * that power save is disabled. When the scan finishes,
1247 * because the hardware is turned off! Anything else is a bug! 1334 * ieee80211_scan_completed() must be called; note that it also must
1335 * be called when the scan cannot finish because the hardware is
1336 * turned off! Anything else is a bug! Returns a negative error code
1337 * which will be seen in userspace.
1338 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification.
1341 *
1342 * @sw_scan_complete: Notifier function that is called just after a software scan
1343 * finished. Can be NULL, if the driver doesn't need this notification.
1248 * 1344 *
1249 * @get_stats: return low-level statistics 1345 * @get_stats: Return low-level statistics.
1346 * Returns zero if statistics are available.
1250 * 1347 *
1251 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1348 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1252 * callback should be provided to read the TKIP transmit IVs (both IV32 1349 * callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,16 +1357,21 @@ enum ieee80211_ampdu_mlme_action {
1260 * 1357 *
1261 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1358 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1262 * bursting) for a hardware TX queue. 1359 * bursting) for a hardware TX queue.
1360 * Returns a negative error code on failure.
1263 * 1361 *
1264 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1362 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1265 * to get number of currently queued packets (queue length), maximum queue 1363 * to get number of currently queued packets (queue length), maximum queue
1266 * size (limit), and total number of packets sent using each TX queue 1364 * size (limit), and total number of packets sent using each TX queue
1267 * (count). The 'stats' pointer points to an array that has hw->queues + 1365 * (count). The 'stats' pointer points to an array that has hw->queues
1268 * hw->ampdu_queues items. 1366 * items.
1269 * 1367 *
1270 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1368 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1271 * this is only used for IBSS mode debugging and, as such, is not a 1369 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1272 * required function. Must be atomic. 1370 * required function.
1371 *
1372 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1373 * Currently, this is only used for IBSS mode debugging. Is not a
1374 * required function.
1273 * 1375 *
1274 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1376 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1275 * with other STAs in the IBSS. This is only used in IBSS mode. This 1377 * with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1279,13 +1381,15 @@ enum ieee80211_ampdu_mlme_action {
1279 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1381 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1280 * This is needed only for IBSS mode and the result of this function is 1382 * This is needed only for IBSS mode and the result of this function is
1281 * used to determine whether to reply to Probe Requests. 1383 * used to determine whether to reply to Probe Requests.
1384 * Returns non-zero if this device sent the last beacon.
1282 * 1385 *
1283 * @ampdu_action: Perform a certain A-MPDU action 1386 * @ampdu_action: Perform a certain A-MPDU action
1284 * The RA/TID combination determines the destination and TID we want 1387 * The RA/TID combination determines the destination and TID we want
1285 * the ampdu action to be performed for. The action is defined through 1388 * the ampdu action to be performed for. The action is defined through
1286 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1389 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1287 * is the first frame we expect to perform the action on. notice 1390 * is the first frame we expect to perform the action on. Notice
1288 * that TX/RX_STOP can pass NULL for this parameter. 1391 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure.
1289 */ 1393 */
1290struct ieee80211_ops { 1394struct ieee80211_ops {
1291 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,12 +1414,15 @@ struct ieee80211_ops {
1310 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1414 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1311 bool set); 1415 bool set);
1312 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1416 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1313 const u8 *local_address, const u8 *address, 1417 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1314 struct ieee80211_key_conf *key); 1418 struct ieee80211_key_conf *key);
1315 void (*update_tkip_key)(struct ieee80211_hw *hw, 1419 void (*update_tkip_key)(struct ieee80211_hw *hw,
1316 struct ieee80211_key_conf *conf, const u8 *address, 1420 struct ieee80211_key_conf *conf, const u8 *address,
1317 u32 iv32, u16 *phase1key); 1421 u32 iv32, u16 *phase1key);
1318 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1422 int (*hw_scan)(struct ieee80211_hw *hw,
1423 struct cfg80211_scan_request *req);
1424 void (*sw_scan_start)(struct ieee80211_hw *hw);
1425 void (*sw_scan_complete)(struct ieee80211_hw *hw);
1319 int (*get_stats)(struct ieee80211_hw *hw, 1426 int (*get_stats)(struct ieee80211_hw *hw,
1320 struct ieee80211_low_level_stats *stats); 1427 struct ieee80211_low_level_stats *stats);
1321 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1428 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1328,6 +1435,7 @@ struct ieee80211_ops {
1328 int (*get_tx_stats)(struct ieee80211_hw *hw, 1435 int (*get_tx_stats)(struct ieee80211_hw *hw,
1329 struct ieee80211_tx_queue_stats *stats); 1436 struct ieee80211_tx_queue_stats *stats);
1330 u64 (*get_tsf)(struct ieee80211_hw *hw); 1437 u64 (*get_tsf)(struct ieee80211_hw *hw);
1438 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1331 void (*reset_tsf)(struct ieee80211_hw *hw); 1439 void (*reset_tsf)(struct ieee80211_hw *hw);
1332 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1440 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1333 int (*ampdu_action)(struct ieee80211_hw *hw, 1441 int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1752,8 +1860,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1752 * mac80211 that the scan finished. 1860 * mac80211 that the scan finished.
1753 * 1861 *
1754 * @hw: the hardware that finished the scan 1862 * @hw: the hardware that finished the scan
1863 * @aborted: set to true if scan was aborted
1755 */ 1864 */
1756void ieee80211_scan_completed(struct ieee80211_hw *hw); 1865void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
1757 1866
1758/** 1867/**
1759 * ieee80211_iterate_active_interfaces - iterate active interfaces 1868 * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1882,10 +1991,30 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1882struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, 1991struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1883 const u8 *addr); 1992 const u8 *addr);
1884 1993
1994/**
1995 * ieee80211_beacon_loss - inform hardware does not receive beacons
1996 *
1997 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1998 *
1999 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2000 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2001 * hardware is not receiving beacons with this function.
2002 */
2003void ieee80211_beacon_loss(struct ieee80211_vif *vif);
1885 2004
1886/* Rate control API */ 2005/* Rate control API */
1887 2006
1888/** 2007/**
2008 * enum rate_control_changed - flags to indicate which parameter changed
2009 *
2010 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
2011 * changed, rate control algorithm can update its internal state if needed.
2012 */
2013enum rate_control_changed {
2014 IEEE80211_RC_HT_CHANGED = BIT(0)
2015};
2016
2017/**
1889 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 2018 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1890 * 2019 *
1891 * @hw: The hardware the algorithm is invoked for. 2020 * @hw: The hardware the algorithm is invoked for.
@@ -1921,6 +2050,9 @@ struct rate_control_ops {
1921 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 2050 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1922 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 2051 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1923 struct ieee80211_sta *sta, void *priv_sta); 2052 struct ieee80211_sta *sta, void *priv_sta);
2053 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2054 struct ieee80211_sta *sta,
2055 void *priv_sta, u32 changed);
1924 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2056 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1925 void *priv_sta); 2057 void *priv_sta);
1926 2058
@@ -1962,4 +2094,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
1962int ieee80211_rate_control_register(struct rate_control_ops *ops); 2094int ieee80211_rate_control_register(struct rate_control_ops *ops);
1963void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2095void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1964 2096
2097static inline bool
2098conf_is_ht20(struct ieee80211_conf *conf)
2099{
2100 return conf->channel_type == NL80211_CHAN_HT20;
2101}
2102
2103static inline bool
2104conf_is_ht40_minus(struct ieee80211_conf *conf)
2105{
2106 return conf->channel_type == NL80211_CHAN_HT40MINUS;
2107}
2108
2109static inline bool
2110conf_is_ht40_plus(struct ieee80211_conf *conf)
2111{
2112 return conf->channel_type == NL80211_CHAN_HT40PLUS;
2113}
2114
2115static inline bool
2116conf_is_ht40(struct ieee80211_conf *conf)
2117{
2118 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
2119}
2120
2121static inline bool
2122conf_is_ht(struct ieee80211_conf *conf)
2123{
2124 return conf->channel_type != NL80211_CHAN_NO_HT;
2125}
2126
1965#endif /* MAC80211_H */ 2127#endif /* MAC80211_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 2e0c53641cbe..6c3f964de9e1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -91,8 +91,7 @@ struct nf_conn_help {
91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h> 92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
93 93
94struct nf_conn 94struct nf_conn {
95{
96 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 95 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
97 plus 1 for any connection(s) we are `master' for */ 96 plus 1 for any connection(s) we are `master' for */
98 struct nf_conntrack ct_general; 97 struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn
126#ifdef CONFIG_NET_NS 125#ifdef CONFIG_NET_NS
127 struct net *ct_net; 126 struct net *ct_net;
128#endif 127#endif
129 struct rcu_head rcu;
130}; 128};
131 129
132static inline struct nf_conn * 130static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)
190extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 188extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
191extern void nf_ct_l3proto_module_put(unsigned short l3proto); 189extern void nf_ct_l3proto_module_put(unsigned short l3proto);
192 190
193extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced); 191/*
194extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, 192 * Allocate a hashtable of hlist_head (if nulls == 0),
195 unsigned int size); 193 * or hlist_nulls_head (if nulls == 1)
194 */
195extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls);
196
197extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
196 198
197extern struct nf_conntrack_tuple_hash * 199extern struct nf_conntrack_tuple_hash *
198__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 200__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
@@ -287,7 +289,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
287 289
288extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
289extern unsigned int nf_conntrack_htable_size; 291extern unsigned int nf_conntrack_htable_size;
290extern int nf_conntrack_max; 292extern unsigned int nf_conntrack_max;
291 293
292#define NF_CT_STAT_INC(net, count) \ 294#define NF_CT_STAT_INC(net, count) \
293 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) 295 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++)
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index c25068e38516..5a449b44ba33 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -62,7 +62,8 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
62 if (ct && ct != &nf_conntrack_untracked) { 62 if (ct && ct != &nf_conntrack_untracked) {
63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
64 ret = __nf_conntrack_confirm(skb); 64 ret = __nf_conntrack_confirm(skb);
65 nf_ct_deliver_cached_events(ct); 65 if (likely(ret == NF_ACCEPT))
66 nf_ct_deliver_cached_events(ct);
66 } 67 }
67 return ret; 68 return ret;
68} 69}
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 66d65a7caa39..ee2a4b369a04 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -14,6 +14,8 @@
14 14
15struct module; 15struct module;
16 16
17#define NF_CT_HELPER_NAME_LEN 16
18
17struct nf_conntrack_helper 19struct nf_conntrack_helper
18{ 20{
19 struct hlist_node hnode; /* Internal use. */ 21 struct hlist_node hnode; /* Internal use. */
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 0378676c3dd8..9f99d36d5de9 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -53,10 +53,17 @@ struct nf_conntrack_l3proto
53 int (*tuple_to_nlattr)(struct sk_buff *skb, 53 int (*tuple_to_nlattr)(struct sk_buff *skb,
54 const struct nf_conntrack_tuple *t); 54 const struct nf_conntrack_tuple *t);
55 55
56 /*
57 * Calculate size of tuple nlattr
58 */
59 int (*nlattr_tuple_size)(void);
60
56 int (*nlattr_to_tuple)(struct nlattr *tb[], 61 int (*nlattr_to_tuple)(struct nlattr *tb[],
57 struct nf_conntrack_tuple *t); 62 struct nf_conntrack_tuple *t);
58 const struct nla_policy *nla_policy; 63 const struct nla_policy *nla_policy;
59 64
65 size_t nla_size;
66
60#ifdef CONFIG_SYSCTL 67#ifdef CONFIG_SYSCTL
61 struct ctl_table_header *ctl_table_header; 68 struct ctl_table_header *ctl_table_header;
62 struct ctl_path *ctl_table_path; 69 struct ctl_path *ctl_table_path;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index debdaf75cecf..ba32ed7bdabe 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -64,16 +64,22 @@ struct nf_conntrack_l4proto
64 /* convert protoinfo to nfnetink attributes */ 64 /* convert protoinfo to nfnetink attributes */
65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
66 const struct nf_conn *ct); 66 const struct nf_conn *ct);
67 /* Calculate protoinfo nlattr size */
68 int (*nlattr_size)(void);
67 69
68 /* convert nfnetlink attributes to protoinfo */ 70 /* convert nfnetlink attributes to protoinfo */
69 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct); 71 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct);
70 72
71 int (*tuple_to_nlattr)(struct sk_buff *skb, 73 int (*tuple_to_nlattr)(struct sk_buff *skb,
72 const struct nf_conntrack_tuple *t); 74 const struct nf_conntrack_tuple *t);
75 /* Calculate tuple nlattr size */
76 int (*nlattr_tuple_size)(void);
73 int (*nlattr_to_tuple)(struct nlattr *tb[], 77 int (*nlattr_to_tuple)(struct nlattr *tb[],
74 struct nf_conntrack_tuple *t); 78 struct nf_conntrack_tuple *t);
75 const struct nla_policy *nla_policy; 79 const struct nla_policy *nla_policy;
76 80
81 size_t nla_size;
82
77#ifdef CONFIG_SYSCTL 83#ifdef CONFIG_SYSCTL
78 struct ctl_table_header **ctl_table_header; 84 struct ctl_table_header **ctl_table_header;
79 struct ctl_table *ctl_table; 85 struct ctl_table *ctl_table;
@@ -90,10 +96,7 @@ struct nf_conntrack_l4proto
90 struct module *me; 96 struct module *me;
91}; 97};
92 98
93/* Existing built-in protocols */ 99/* Existing built-in generic protocol */
94extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
95extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
96extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 100extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 101
99#define MAX_NF_CT_PROTO 256 102#define MAX_NF_CT_PROTO 256
@@ -101,11 +104,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
101extern struct nf_conntrack_l4proto * 104extern struct nf_conntrack_l4proto *
102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 105__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
103 106
104extern struct nf_conntrack_l4proto *
105nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
106
107extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
108
109/* Protocol registration. */ 107/* Protocol registration. */
110extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 108extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
111extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 109extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
@@ -115,6 +113,7 @@ extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
115 const struct nf_conntrack_tuple *tuple); 113 const struct nf_conntrack_tuple *tuple);
116extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 114extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
117 struct nf_conntrack_tuple *t); 115 struct nf_conntrack_tuple *t);
116extern int nf_ct_port_nlattr_tuple_size(void);
118extern const struct nla_policy nf_ct_port_nla_policy[]; 117extern const struct nla_policy nf_ct_port_nla_policy[];
119 118
120#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index f2f6aa73dc10..2628c154d40e 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/netfilter/x_tables.h> 13#include <linux/netfilter/x_tables.h>
14#include <linux/netfilter/nf_conntrack_tuple_common.h> 14#include <linux/netfilter/nf_conntrack_tuple_common.h>
15#include <linux/list_nulls.h>
15 16
16/* A `tuple' is a structure containing the information to uniquely 17/* A `tuple' is a structure containing the information to uniquely
17 identify a connection. ie. if two packets have the same tuple, they 18 identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
146 ((enum ip_conntrack_dir)(h)->tuple.dst.dir) 147 ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
147 148
148/* Connections have two entries in the hash table: one for each way */ 149/* Connections have two entries in the hash table: one for each way */
149struct nf_conntrack_tuple_hash 150struct nf_conntrack_tuple_hash {
150{ 151 struct hlist_nulls_node hnnode;
151 struct hlist_node hnode;
152 struct nf_conntrack_tuple tuple; 152 struct nf_conntrack_tuple tuple;
153}; 153};
154 154
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 7182c06974f4..920997f1aff0 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -1,6 +1,8 @@
1#ifndef _NF_LOG_H 1#ifndef _NF_LOG_H
2#define _NF_LOG_H 2#define _NF_LOG_H
3 3
4#include <linux/netfilter.h>
5
4/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will 6/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
5 * disappear once iptables is replaced with pkttables. Please DO NOT use them 7 * disappear once iptables is replaced with pkttables. Please DO NOT use them
6 * for any new code! */ 8 * for any new code! */
@@ -40,12 +42,15 @@ struct nf_logger {
40 struct module *me; 42 struct module *me;
41 nf_logfn *logfn; 43 nf_logfn *logfn;
42 char *name; 44 char *name;
45 struct list_head list[NFPROTO_NUMPROTO];
43}; 46};
44 47
45/* Function to register/unregister log function. */ 48/* Function to register/unregister log function. */
46int nf_log_register(u_int8_t pf, const struct nf_logger *logger); 49int nf_log_register(u_int8_t pf, struct nf_logger *logger);
47void nf_log_unregister(const struct nf_logger *logger); 50void nf_log_unregister(struct nf_logger *logger);
48void nf_log_unregister_pf(u_int8_t pf); 51
52int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger);
53void nf_log_unbind_pf(u_int8_t pf);
49 54
50/* Calls the registered backend logging function */ 55/* Calls the registered backend logging function */
51void nf_log_packet(u_int8_t pf, 56void nf_log_packet(u_int8_t pf,
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 749011eedc0b..60ebbc1fef46 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -36,6 +36,7 @@
36#include <linux/in.h> 36#include <linux/in.h>
37#include <linux/in6.h> 37#include <linux/in6.h>
38#include <net/netlink.h> 38#include <net/netlink.h>
39#include <net/request_sock.h>
39#include <asm/atomic.h> 40#include <asm/atomic.h>
40 41
41struct cipso_v4_doi; 42struct cipso_v4_doi;
@@ -406,6 +407,7 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
406 */ 407 */
407int netlbl_enabled(void); 408int netlbl_enabled(void);
408int netlbl_sock_setattr(struct sock *sk, 409int netlbl_sock_setattr(struct sock *sk,
410 u16 family,
409 const struct netlbl_lsm_secattr *secattr); 411 const struct netlbl_lsm_secattr *secattr);
410void netlbl_sock_delattr(struct sock *sk); 412void netlbl_sock_delattr(struct sock *sk);
411int netlbl_sock_getattr(struct sock *sk, 413int netlbl_sock_getattr(struct sock *sk,
@@ -413,6 +415,9 @@ int netlbl_sock_getattr(struct sock *sk,
413int netlbl_conn_setattr(struct sock *sk, 415int netlbl_conn_setattr(struct sock *sk,
414 struct sockaddr *addr, 416 struct sockaddr *addr,
415 const struct netlbl_lsm_secattr *secattr); 417 const struct netlbl_lsm_secattr *secattr);
418int netlbl_req_setattr(struct request_sock *req,
419 const struct netlbl_lsm_secattr *secattr);
420void netlbl_req_delattr(struct request_sock *req);
416int netlbl_skbuff_setattr(struct sk_buff *skb, 421int netlbl_skbuff_setattr(struct sk_buff *skb,
417 u16 family, 422 u16 family,
418 const struct netlbl_lsm_secattr *secattr); 423 const struct netlbl_lsm_secattr *secattr);
@@ -519,7 +524,8 @@ static inline int netlbl_enabled(void)
519 return 0; 524 return 0;
520} 525}
521static inline int netlbl_sock_setattr(struct sock *sk, 526static inline int netlbl_sock_setattr(struct sock *sk,
522 const struct netlbl_lsm_secattr *secattr) 527 u16 family,
528 const struct netlbl_lsm_secattr *secattr)
523{ 529{
524 return -ENOSYS; 530 return -ENOSYS;
525} 531}
@@ -537,6 +543,15 @@ static inline int netlbl_conn_setattr(struct sock *sk,
537{ 543{
538 return -ENOSYS; 544 return -ENOSYS;
539} 545}
546static inline int netlbl_req_setattr(struct request_sock *req,
547 const struct netlbl_lsm_secattr *secattr)
548{
549 return -ENOSYS;
550}
551static inline void netlbl_req_delattr(struct request_sock *req)
552{
553 return;
554}
540static inline int netlbl_skbuff_setattr(struct sk_buff *skb, 555static inline int netlbl_skbuff_setattr(struct sk_buff *skb,
541 u16 family, 556 u16 family,
542 const struct netlbl_lsm_secattr *secattr) 557 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 8a6150a3f4c7..eddb50289d6d 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -230,6 +230,7 @@ extern int nla_validate(struct nlattr *head, int len, int maxtype,
230extern int nla_parse(struct nlattr *tb[], int maxtype, 230extern int nla_parse(struct nlattr *tb[], int maxtype,
231 struct nlattr *head, int len, 231 struct nlattr *head, int len,
232 const struct nla_policy *policy); 232 const struct nla_policy *policy);
233extern int nla_policy_len(const struct nla_policy *, int);
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 234extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 235extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 236 size_t dstsize);
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index f4498a62881b..9dc58402bc09 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -2,6 +2,7 @@
2#define __NETNS_CONNTRACK_H 2#define __NETNS_CONNTRACK_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h>
5#include <asm/atomic.h> 6#include <asm/atomic.h>
6 7
7struct ctl_table_header; 8struct ctl_table_header;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;
10struct netns_ct { 11struct netns_ct {
11 atomic_t count; 12 atomic_t count;
12 unsigned int expect_count; 13 unsigned int expect_count;
13 struct hlist_head *hash; 14 struct hlist_nulls_head *hash;
14 struct hlist_head *expect_hash; 15 struct hlist_head *expect_hash;
15 struct hlist_head unconfirmed; 16 struct hlist_nulls_head unconfirmed;
16 struct ip_conntrack_stat *stat; 17 struct ip_conntrack_stat *stat;
17#ifdef CONFIG_NF_CONNTRACK_EVENTS 18#ifdef CONFIG_NF_CONNTRACK_EVENTS
18 struct nf_conntrack_ecache *ecache; 19 struct nf_conntrack_ecache *ecache;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 977f482d97a9..2eb3814d6258 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -54,5 +54,18 @@ struct netns_ipv4 {
54 54
55 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
56 atomic_t rt_genid; 56 atomic_t rt_genid;
57
58#ifdef CONFIG_IP_MROUTE
59 struct sock *mroute_sk;
60 struct mfc_cache **mfc_cache_array;
61 struct vif_device *vif_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
67 int mroute_reg_vif_num;
68#endif
69#endif
57}; 70};
58#endif 71#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index f06852bba62a..15696b1fd30f 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -59,10 +59,6 @@ enum {
59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ 59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ 60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
61 61
62struct nr_private {
63 struct net_device_stats stats;
64};
65
66struct nr_sock { 62struct nr_sock {
67 struct sock sock; 63 struct sock sock;
68 ax25_address user_addr, source_addr, dest_addr; 64 ax25_address user_addr, source_addr, dest_addr;
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 057b0a8a2885..d43f71b5ec00 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -105,7 +105,6 @@ void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
105 105
106int phonet_sysctl_init(void); 106int phonet_sysctl_init(void);
107void phonet_sysctl_exit(void); 107void phonet_sysctl_exit(void);
108void phonet_netlink_register(void);
109int isi_register(void); 108int isi_register(void);
110void isi_unregister(void); 109void isi_unregister(void);
111 110
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index aa1c59a1d33f..5054dc5ea2c2 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -28,7 +28,7 @@ struct phonet_device_list {
28 spinlock_t lock; 28 spinlock_t lock;
29}; 29};
30 30
31extern struct phonet_device_list pndevs; 31struct phonet_device_list *phonet_device_list(struct net *net);
32 32
33struct phonet_device { 33struct phonet_device {
34 struct list_head list; 34 struct list_head list;
@@ -36,8 +36,9 @@ struct phonet_device {
36 DECLARE_BITMAP(addrs, 64); 36 DECLARE_BITMAP(addrs, 64);
37}; 37};
38 38
39void phonet_device_init(void); 39int phonet_device_init(void);
40void phonet_device_exit(void); 40void phonet_device_exit(void);
41int phonet_netlink_register(void);
41struct net_device *phonet_device_get(struct net *net); 42struct net_device *phonet_device_get(struct net *net);
42 43
43int phonet_address_add(struct net_device *dev, u8 addr); 44int phonet_address_add(struct net_device *dev, u8 addr);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 4082f39f5079..e37fe3129c17 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -85,6 +85,7 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
85 struct nlattr *tab); 85 struct nlattr *tab);
86extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 86extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
87extern void qdisc_put_stab(struct qdisc_size_table *tab); 87extern void qdisc_put_stab(struct qdisc_size_table *tab);
88extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
88 89
89extern void __qdisc_run(struct Qdisc *q); 90extern void __qdisc_run(struct Qdisc *q);
90 91
diff --git a/include/net/psnap.h b/include/net/psnap.h
index b2e01cc3fc8a..fe456c295b04 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,7 +1,11 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *orig_dev)); 4extern struct datalink_proto *
5register_snap_client(const unsigned char *desc,
6 int (*rcvfunc)(struct sk_buff *, struct net_device *,
7 struct packet_type *,
8 struct net_device *orig_dev));
5extern void unregister_snap_client(struct datalink_proto *proto); 9extern void unregister_snap_client(struct datalink_proto *proto);
6 10
7#endif 11#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f8c47429044a..964ffa0d8815 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -42,24 +42,17 @@ struct Qdisc
42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); 42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
43 struct sk_buff * (*dequeue)(struct Qdisc *dev); 43 struct sk_buff * (*dequeue)(struct Qdisc *dev);
44 unsigned flags; 44 unsigned flags;
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_WARN_NONWC (1 << 16)
48 int padded; 49 int padded;
49 struct Qdisc_ops *ops; 50 struct Qdisc_ops *ops;
50 struct qdisc_size_table *stab; 51 struct qdisc_size_table *stab;
52 struct list_head list;
51 u32 handle; 53 u32 handle;
52 u32 parent; 54 u32 parent;
53 atomic_t refcnt; 55 atomic_t refcnt;
54 unsigned long state;
55 struct sk_buff *gso_skb;
56 struct sk_buff_head q;
57 struct netdev_queue *dev_queue;
58 struct Qdisc *next_sched;
59 struct list_head list;
60
61 struct gnet_stats_basic bstats;
62 struct gnet_stats_queue qstats;
63 struct gnet_stats_rate_est rate_est; 56 struct gnet_stats_rate_est rate_est;
64 int (*reshape_fail)(struct sk_buff *skb, 57 int (*reshape_fail)(struct sk_buff *skb,
65 struct Qdisc *q); 58 struct Qdisc *q);
@@ -70,6 +63,17 @@ struct Qdisc
70 * and it will live until better solution will be invented. 63 * and it will live until better solution will be invented.
71 */ 64 */
72 struct Qdisc *__parent; 65 struct Qdisc *__parent;
66 struct netdev_queue *dev_queue;
67 struct Qdisc *next_sched;
68
69 struct sk_buff *gso_skb;
70 /*
71 * For performance sake on SMP, we put highly modified fields at the end
72 */
73 unsigned long state;
74 struct sk_buff_head q;
75 struct gnet_stats_basic bstats;
76 struct gnet_stats_queue qstats;
73}; 77};
74 78
75struct Qdisc_class_ops 79struct Qdisc_class_ops
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 2fec3c366e81..befc8d2a1b9f 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -46,14 +46,14 @@
46#include <net/sctp/sctp.h> 46#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 47#include <linux/crc32c.h>
48 48
49static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length) 49static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
50{ 50{
51 return (__force __be32)crc32c((__force u32)crc, buffer, length); 51 return crc32c(crc, buffer, length);
52} 52}
53 53
54static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length) 54static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
55{ 55{
56 __be32 crc = ~cpu_to_be32(0); 56 __u32 crc = ~(__u32)0;
57 __u8 zero[sizeof(__u32)] = {0}; 57 __u8 zero[sizeof(__u32)] = {0};
58 58
59 /* Optimize this routine to be SCTP specific, knowing how 59 /* Optimize this routine to be SCTP specific, knowing how
@@ -72,12 +72,12 @@ static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
72 return crc; 72 return crc;
73} 73}
74 74
75static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) 75static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
76{ 76{
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __be32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__be32 crc32)
81{ 81{
82 return (__force __be32)~cpu_to_le32((__force u32)crc32); 82 return cpu_to_le32(~crc32);
83} 83}
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 88988ab03d75..3b966802e05d 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -77,7 +77,8 @@ typedef enum {
77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ 77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ 78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ 79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
80 SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */ 80 SCTP_CMD_TRANSPORT_HB_SENT, /* Reset the status of a transport. */
81 SCTP_CMD_TRANSPORT_IDLE, /* Do manipulations on idle transport */
81 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */ 82 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
82 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */ 83 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
83 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */ 84 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index bbb7742195b0..9f80a7668289 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -62,13 +62,6 @@
62 * and will continue to evolve. 62 * and will continue to evolve.
63 */ 63 */
64 64
65
66
67#ifdef TEST_FRAME
68#undef CONFIG_SCTP_DBG_OBJCNT
69#undef CONFIG_SYSCTL
70#endif /* TEST_FRAME */
71
72#include <linux/types.h> 65#include <linux/types.h>
73#include <linux/slab.h> 66#include <linux/slab.h>
74#include <linux/in.h> 67#include <linux/in.h>
@@ -138,6 +131,8 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 131unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 132 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 133void sctp_sock_rfree(struct sk_buff *skb);
134void sctp_copy_sock(struct sock *newsk, struct sock *sk,
135 struct sctp_association *asoc);
141extern struct percpu_counter sctp_sockets_allocated; 136extern struct percpu_counter sctp_sockets_allocated;
142 137
143/* 138/*
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 9661d7b765f0..23f08fe1d50a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -218,6 +218,10 @@ extern struct sctp_globals {
218 218
219 /* Flag to idicate if SCTP-AUTH is enabled */ 219 /* Flag to idicate if SCTP-AUTH is enabled */
220 int auth_enable; 220 int auth_enable;
221
222 /* Flag to indicate whether computing and verifying checksum
223 * is disabled. */
224 int checksum_disable;
221} sctp_globals; 225} sctp_globals;
222 226
223#define sctp_rto_initial (sctp_globals.rto_initial) 227#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -252,6 +256,7 @@ extern struct sctp_globals {
252#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 256#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
253#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 257#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
254#define sctp_auth_enable (sctp_globals.auth_enable) 258#define sctp_auth_enable (sctp_globals.auth_enable)
259#define sctp_checksum_disable (sctp_globals.checksum_disable)
255 260
256/* SCTP Socket type: UDP or TCP style. */ 261/* SCTP Socket type: UDP or TCP style. */
257typedef enum { 262typedef enum {
@@ -905,8 +910,10 @@ struct sctp_transport {
905 * should be set. Every time the RTT 910 * should be set. Every time the RTT
906 * calculation completes (i.e. the DATA chunk 911 * calculation completes (i.e. the DATA chunk
907 * is SACK'd) clear this flag. 912 * is SACK'd) clear this flag.
913 * hb_sent : a flag that signals that we have a pending heartbeat.
908 */ 914 */
909 __u8 rto_pending; 915 __u8 rto_pending;
916 __u8 hb_sent;
910 917
911 /* Flag to track the current fast recovery state */ 918 /* Flag to track the current fast recovery state */
912 __u8 fast_recovery; 919 __u8 fast_recovery;
diff --git a/include/net/sock.h b/include/net/sock.h
index eefeeaf7fc46..4bb1ff9fd15b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -158,7 +158,7 @@ struct sock_common {
158 * @sk_allocation: allocation mode 158 * @sk_allocation: allocation mode
159 * @sk_sndbuf: size of send buffer in bytes 159 * @sk_sndbuf: size of send buffer in bytes
160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
161 * %SO_OOBINLINE settings 161 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -488,6 +488,13 @@ enum sock_flags {
488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ 488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
491 SOCK_TIMESTAMPING_TX_HARDWARE, /* %SOF_TIMESTAMPING_TX_HARDWARE */
492 SOCK_TIMESTAMPING_TX_SOFTWARE, /* %SOF_TIMESTAMPING_TX_SOFTWARE */
493 SOCK_TIMESTAMPING_RX_HARDWARE, /* %SOF_TIMESTAMPING_RX_HARDWARE */
494 SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
495 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
496 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
497 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
491}; 498};
492 499
493static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 500static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -944,6 +951,11 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
944 unsigned long size, 951 unsigned long size,
945 int noblock, 952 int noblock,
946 int *errcode); 953 int *errcode);
954extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
955 unsigned long header_len,
956 unsigned long data_len,
957 int noblock,
958 int *errcode);
947extern void *sock_kmalloc(struct sock *sk, int size, 959extern void *sock_kmalloc(struct sock *sk, int size,
948 gfp_t priority); 960 gfp_t priority);
949extern void sock_kfree_s(struct sock *sk, void *mem, int size); 961extern void sock_kfree_s(struct sock *sk, void *mem, int size);
@@ -1340,14 +1352,45 @@ static __inline__ void
1340sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1352sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1341{ 1353{
1342 ktime_t kt = skb->tstamp; 1354 ktime_t kt = skb->tstamp;
1355 struct skb_shared_hwtstamps *hwtstamps = skb_hwtstamps(skb);
1343 1356
1344 if (sock_flag(sk, SOCK_RCVTSTAMP)) 1357 /*
1358 * generate control messages if
1359 * - receive time stamping in software requested (SOCK_RCVTSTAMP
1360 * or SOCK_TIMESTAMPING_RX_SOFTWARE)
1361 * - software time stamp available and wanted
1362 * (SOCK_TIMESTAMPING_SOFTWARE)
1363 * - hardware time stamps available and wanted
1364 * (SOCK_TIMESTAMPING_SYS_HARDWARE or
1365 * SOCK_TIMESTAMPING_RAW_HARDWARE)
1366 */
1367 if (sock_flag(sk, SOCK_RCVTSTAMP) ||
1368 sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
1369 (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
1370 (hwtstamps->hwtstamp.tv64 &&
1371 sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) ||
1372 (hwtstamps->syststamp.tv64 &&
1373 sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
1345 __sock_recv_timestamp(msg, sk, skb); 1374 __sock_recv_timestamp(msg, sk, skb);
1346 else 1375 else
1347 sk->sk_stamp = kt; 1376 sk->sk_stamp = kt;
1348} 1377}
1349 1378
1350/** 1379/**
1380 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
1381 * @msg: outgoing packet
1382 * @sk: socket sending this packet
1383 * @shtx: filled with instructions for time stamping
1384 *
1385 * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
1386 * parameters are invalid.
1387 */
1388extern int sock_tx_timestamp(struct msghdr *msg,
1389 struct sock *sk,
1390 union skb_shared_tx *shtx);
1391
1392
1393/**
1351 * sk_eat_skb - Release a skb if it is no longer needed 1394 * sk_eat_skb - Release a skb if it is no longer needed
1352 * @sk: socket to eat this skb from 1395 * @sk: socket to eat this skb from
1353 * @skb: socket buffer to eat 1396 * @skb: socket buffer to eat
@@ -1415,7 +1458,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
1415 return NULL; 1458 return NULL;
1416} 1459}
1417 1460
1418extern void sock_enable_timestamp(struct sock *sk); 1461extern void sock_enable_timestamp(struct sock *sk, int flag);
1419extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1462extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1420extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1463extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1421 1464
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 218235de8963..1b94b9bfe2dc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -481,7 +481,16 @@ static inline void tcp_clear_xmit_timers(struct sock *sk)
481} 481}
482 482
483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
484extern unsigned int tcp_current_mss(struct sock *sk, int large); 484extern unsigned int tcp_current_mss(struct sock *sk);
485
486/* Bound MSS / TSO packet size with the half of the window */
487static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
488{
489 if (tp->max_window && pktsize > (tp->max_window >> 1))
490 return max(tp->max_window >> 1, 68U - tp->tcp_header_len);
491 else
492 return pktsize;
493}
485 494
486/* tcp.c */ 495/* tcp.c */
487extern void tcp_get_info(struct sock *, struct tcp_info *); 496extern void tcp_get_info(struct sock *, struct tcp_info *);
@@ -607,21 +616,6 @@ static inline int tcp_skb_mss(const struct sk_buff *skb)
607 return skb_shinfo(skb)->gso_size; 616 return skb_shinfo(skb)->gso_size;
608} 617}
609 618
610static inline void tcp_dec_pcount_approx_int(__u32 *count, const int decr)
611{
612 if (*count) {
613 *count -= decr;
614 if ((int)*count < 0)
615 *count = 0;
616 }
617}
618
619static inline void tcp_dec_pcount_approx(__u32 *count,
620 const struct sk_buff *skb)
621{
622 tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb));
623}
624
625/* Events passed to congestion control interface */ 619/* Events passed to congestion control interface */
626enum tcp_ca_event { 620enum tcp_ca_event {
627 CA_EVENT_TX_START, /* first transmit when no packets in flight */ 621 CA_EVENT_TX_START, /* first transmit when no packets in flight */
@@ -685,6 +679,7 @@ extern void tcp_get_allowed_congestion_control(char *buf, size_t len);
685extern int tcp_set_allowed_congestion_control(char *allowed); 679extern int tcp_set_allowed_congestion_control(char *allowed);
686extern int tcp_set_congestion_control(struct sock *sk, const char *name); 680extern int tcp_set_congestion_control(struct sock *sk, const char *name);
687extern void tcp_slow_start(struct tcp_sock *tp); 681extern void tcp_slow_start(struct tcp_sock *tp);
682extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
688 683
689extern struct tcp_congestion_ops tcp_init_congestion_ops; 684extern struct tcp_congestion_ops tcp_init_congestion_ops;
690extern u32 tcp_reno_ssthresh(struct sock *sk); 685extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -821,15 +816,15 @@ static inline void tcp_push_pending_frames(struct sock *sk)
821{ 816{
822 struct tcp_sock *tp = tcp_sk(sk); 817 struct tcp_sock *tp = tcp_sk(sk);
823 818
824 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); 819 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
825} 820}
826 821
827static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 822static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
828{ 823{
829 tp->snd_wl1 = seq; 824 tp->snd_wl1 = seq;
830} 825}
831 826
832static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 827static inline void tcp_update_wl(struct tcp_sock *tp, u32 seq)
833{ 828{
834 tp->snd_wl1 = seq; 829 tp->snd_wl1 = seq;
835} 830}
@@ -925,7 +920,6 @@ extern void tcp_done(struct sock *sk);
925static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 920static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
926{ 921{
927 rx_opt->dsack = 0; 922 rx_opt->dsack = 0;
928 rx_opt->eff_sacks = 0;
929 rx_opt->num_sacks = 0; 923 rx_opt->num_sacks = 0;
930} 924}
931 925
@@ -997,11 +991,21 @@ static inline int tcp_fin_time(const struct sock *sk)
997 return fin_timeout; 991 return fin_timeout;
998} 992}
999 993
1000static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) 994static inline int tcp_paws_check(const struct tcp_options_received *rx_opt,
995 int paws_win)
1001{ 996{
1002 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 997 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1003 return 0; 998 return 1;
1004 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 999 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1000 return 1;
1001
1002 return 0;
1003}
1004
1005static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1006 int rst)
1007{
1008 if (tcp_paws_check(rx_opt, 0))
1005 return 0; 1009 return 0;
1006 1010
1007 /* RST segments are not recommended to carry timestamp, 1011 /* RST segments are not recommended to carry timestamp,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 876b6f2bb4fd..bfb240c6cf79 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -46,7 +46,7 @@ extern int datagram_send_ctl(struct net *net,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass);
48 48
49#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) 49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 50
51/* 51/*
52 * address family specific functions 52 * address family specific functions
diff --git a/include/net/udp.h b/include/net/udp.h
index 90e6ce56be65..93dbe294d459 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -124,6 +124,8 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
124 sk_common_release(sk); 124 sk_common_release(sk);
125} 125}
126 126
127extern int ipv4_rcv_saddr_equal(const struct sock *sk1,
128 const struct sock *sk2);
127extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 129extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
128 int (*)(const struct sock*,const struct sock*)); 130 int (*)(const struct sock*,const struct sock*));
129 131
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 21c5d966142d..64a76208580c 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -69,6 +69,9 @@ enum ieee80211_channel_flags {
69 * @band: band this channel belongs to. 69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi 70 * @max_antenna_gain: maximum antenna gain in dBi
71 * @max_power: maximum transmission power (in dBm) 71 * @max_power: maximum transmission power (in dBm)
72 * @beacon_found: helper to regulatory code to indicate when a beacon
73 * has been found on this channel. Use regulatory_hint_found_beacon()
74 * to enable this, this is is useful only on 5 GHz band.
72 * @orig_mag: internal use 75 * @orig_mag: internal use
73 * @orig_mpwr: internal use 76 * @orig_mpwr: internal use
74 */ 77 */
@@ -80,6 +83,7 @@ struct ieee80211_channel {
80 u32 flags; 83 u32 flags;
81 int max_antenna_gain; 84 int max_antenna_gain;
82 int max_power; 85 int max_power;
86 bool beacon_found;
83 u32 orig_flags; 87 u32 orig_flags;
84 int orig_mag, orig_mpwr; 88 int orig_mag, orig_mpwr;
85}; 89};
@@ -181,12 +185,26 @@ struct ieee80211_supported_band {
181 * struct wiphy - wireless hardware description 185 * struct wiphy - wireless hardware description
182 * @idx: the wiphy index assigned to this item 186 * @idx: the wiphy index assigned to this item
183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device 188 * @custom_regulatory: tells us the driver for this device
185 * has its own regulatory solution and cannot identify the 189 * has its own custom regulatory domain and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the 191 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE). 192 * initiator is %REGDOM_SET_BY_CORE).
193 * @strict_regulatory: tells us the driver for this device will ignore
194 * regulatory domain settings until it gets its own regulatory domain
195 * via its regulatory_hint(). After its gets its own regulatory domain
196 * it will only allow further regulatory domain settings to further
197 * enhance compliance. For example if channel 13 and 14 are disabled
198 * by this regulatory domain no user regulatory domain can enable these
199 * channels at a later time. This can be used for devices which do not
200 * have calibration information gauranteed for frequencies or settings
201 * outside of its regulatory domain.
189 * @reg_notifier: the driver's regulatory notification callback 202 * @reg_notifier: the driver's regulatory notification callback
203 * @regd: the driver's regulatory domain, if one was requested via
204 * the regulatory_hint() API. This can be used by the driver
205 * on the reg_notifier() if it chooses to ignore future
206 * regulatory domain changes caused by other drivers.
207 * @signal_type: signal type reported in &struct cfg80211_bss.
190 */ 208 */
191struct wiphy { 209struct wiphy {
192 /* assign these fields before you register the wiphy */ 210 /* assign these fields before you register the wiphy */
@@ -197,7 +215,13 @@ struct wiphy {
197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
198 u16 interface_modes; 216 u16 interface_modes;
199 217
200 bool fw_handles_regulatory; 218 bool custom_regulatory;
219 bool strict_regulatory;
220
221 enum cfg80211_signal_type signal_type;
222
223 int bss_priv_size;
224 u8 max_scan_ssids;
201 225
202 /* If multiple wiphys are registered and you're handed e.g. 226 /* If multiple wiphys are registered and you're handed e.g.
203 * a regular netdev with assigned ieee80211_ptr, you won't 227 * a regular netdev with assigned ieee80211_ptr, you won't
@@ -209,10 +233,13 @@ struct wiphy {
209 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
210 234
211 /* Lets us get back the wiphy on the callback */ 235 /* Lets us get back the wiphy on the callback */
212 int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby); 236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
213 238
214 /* fields below are read-only, assigned by cfg80211 */ 239 /* fields below are read-only, assigned by cfg80211 */
215 240
241 const struct ieee80211_regdomain *regd;
242
216 /* the item in /sys/class/ieee80211/ points to this, 243 /* the item in /sys/class/ieee80211/ points to this,
217 * you need use set_wiphy_dev() (see below) */ 244 * you need use set_wiphy_dev() (see below) */
218 struct device dev; 245 struct device dev;
@@ -361,7 +388,7 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
361 */ 388 */
362struct ieee80211_rate * 389struct ieee80211_rate *
363ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate); 391 u32 basic_rates, int bitrate);
365 392
366/** 393/**
367 * regulatory_hint - driver hint to the wireless core a regulatory domain 394 * regulatory_hint - driver hint to the wireless core a regulatory domain
@@ -378,8 +405,15 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
378 * domain should be in or by providing a completely build regulatory domain. 405 * domain should be in or by providing a completely build regulatory domain.
379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
380 * for a regulatory domain structure for the respective country. 407 * for a regulatory domain structure for the respective country.
408 *
409 * The wiphy must have been registered to cfg80211 prior to this call.
410 * For cfg80211 drivers this means you must first use wiphy_register(),
411 * for mac80211 drivers you must first use ieee80211_register_hw().
412 *
413 * Drivers should check the return value, its possible you can get
414 * an -ENOMEM.
381 */ 415 */
382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); 416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
383 417
384/** 418/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain 419 * regulatory_hint_11d - hints a country IE as a regulatory domain
@@ -395,4 +429,44 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
395extern void regulatory_hint_11d(struct wiphy *wiphy, 429extern void regulatory_hint_11d(struct wiphy *wiphy,
396 u8 *country_ie, 430 u8 *country_ie,
397 u8 country_ie_len); 431 u8 country_ie_len);
432/**
433 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
434 * @wiphy: the wireless device we want to process the regulatory domain on
435 * @regd: the custom regulatory domain to use for this wiphy
436 *
437 * Drivers can sometimes have custom regulatory domains which do not apply
438 * to a specific country. Drivers can use this to apply such custom regulatory
439 * domains. This routine must be called prior to wiphy registration. The
440 * custom regulatory domain will be trusted completely and as such previous
441 * default channel settings will be disregarded. If no rule is found for a
442 * channel on the regulatory domain the channel will be disabled.
443 */
444extern void wiphy_apply_custom_regulatory(
445 struct wiphy *wiphy,
446 const struct ieee80211_regdomain *regd);
447
448/**
449 * freq_reg_info - get regulatory information for the given frequency
450 * @wiphy: the wiphy for which we want to process this rule for
451 * @center_freq: Frequency in KHz for which we want regulatory information for
452 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
453 * you can set this to 0. If this frequency is allowed we then set
454 * this value to the maximum allowed bandwidth.
455 * @reg_rule: the regulatory rule which we have for this frequency
456 *
457 * Use this function to get the regulatory rule for a specific frequency on
458 * a given wireless device. If the device has a specific regulatory domain
459 * it wants to follow we respect that unless a country IE has been received
460 * and processed already.
461 *
462 * Returns 0 if it was able to find a valid regulatory rule which does
463 * apply to the given center_freq otherwise it returns non-zero. It will
464 * also return -ERANGE if we determine the given center_freq does not even have
465 * a regulatory rule for a frequency range in the center_freq's band. See
466 * freq_in_rule_band() for our current definition of a band -- this is purely
467 * subjective and right now its 802.11 specific.
468 */
469extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
470 const struct ieee80211_reg_rule **reg_rule);
471
398#endif /* __NET_WIRELESS_H */ 472#endif /* __NET_WIRELESS_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index ec7c6d99ed3f..938858304300 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -314,12 +314,12 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
314 */ 314 */
315void ib_destroy_cm_id(struct ib_cm_id *cm_id); 315void ib_destroy_cm_id(struct ib_cm_id *cm_id);
316 316
317#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL) 317#define IB_SERVICE_ID_AGN_MASK cpu_to_be64(0xFF00000000000000ULL)
318#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL) 318#define IB_CM_ASSIGN_SERVICE_ID cpu_to_be64(0x0200000000000000ULL)
319#define IB_CMA_SERVICE_ID __constant_cpu_to_be64(0x0000000001000000ULL) 319#define IB_CMA_SERVICE_ID cpu_to_be64(0x0000000001000000ULL)
320#define IB_CMA_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFF000000ULL) 320#define IB_CMA_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFF000000ULL)
321#define IB_SDP_SERVICE_ID __constant_cpu_to_be64(0x0000000000010000ULL) 321#define IB_SDP_SERVICE_ID cpu_to_be64(0x0000000000010000ULL)
322#define IB_SDP_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFFFF0000ULL) 322#define IB_SDP_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
323 323
324struct ib_cm_compare_data { 324struct ib_cm_compare_data {
325 u8 data[IB_CM_COMPARE_SIZE]; 325 u8 data[IB_CM_COMPARE_SIZE];
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 5f6c40fffcf4..d3b9401b77b0 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -107,7 +107,7 @@
107#define IB_MGMT_RMPP_STATUS_ABORT_MAX 127 107#define IB_MGMT_RMPP_STATUS_ABORT_MAX 127
108 108
109#define IB_QP0 0 109#define IB_QP0 0
110#define IB_QP1 __constant_htonl(1) 110#define IB_QP1 cpu_to_be32(1)
111#define IB_QP1_QKEY 0x80010000 111#define IB_QP1_QKEY 0x80010000
112#define IB_QP_SET_QKEY 0x80000000 112#define IB_QP_SET_QKEY 0x80000000
113 113
@@ -290,7 +290,7 @@ static inline void ib_set_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr, u8 rtime)
290 */ 290 */
291static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags) 291static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags)
292{ 292{
293 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF1) | 293 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF8) |
294 (flags & 0x7); 294 (flags & 0x7);
295} 295}
296 296
diff --git a/include/rdma/ib_smi.h b/include/rdma/ib_smi.h
index aaca0878668f..98b9086d769a 100644
--- a/include/rdma/ib_smi.h
+++ b/include/rdma/ib_smi.h
@@ -63,25 +63,25 @@ struct ib_smp {
63 u8 return_path[IB_SMP_MAX_PATH_HOPS]; 63 u8 return_path[IB_SMP_MAX_PATH_HOPS];
64} __attribute__ ((packed)); 64} __attribute__ ((packed));
65 65
66#define IB_SMP_DIRECTION __constant_htons(0x8000) 66#define IB_SMP_DIRECTION cpu_to_be16(0x8000)
67 67
68/* Subnet management attributes */ 68/* Subnet management attributes */
69#define IB_SMP_ATTR_NOTICE __constant_htons(0x0002) 69#define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002)
70#define IB_SMP_ATTR_NODE_DESC __constant_htons(0x0010) 70#define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010)
71#define IB_SMP_ATTR_NODE_INFO __constant_htons(0x0011) 71#define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011)
72#define IB_SMP_ATTR_SWITCH_INFO __constant_htons(0x0012) 72#define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012)
73#define IB_SMP_ATTR_GUID_INFO __constant_htons(0x0014) 73#define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014)
74#define IB_SMP_ATTR_PORT_INFO __constant_htons(0x0015) 74#define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015)
75#define IB_SMP_ATTR_PKEY_TABLE __constant_htons(0x0016) 75#define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016)
76#define IB_SMP_ATTR_SL_TO_VL_TABLE __constant_htons(0x0017) 76#define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017)
77#define IB_SMP_ATTR_VL_ARB_TABLE __constant_htons(0x0018) 77#define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018)
78#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE __constant_htons(0x0019) 78#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019)
79#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE __constant_htons(0x001A) 79#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A)
80#define IB_SMP_ATTR_MCAST_FORWARD_TABLE __constant_htons(0x001B) 80#define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B)
81#define IB_SMP_ATTR_SM_INFO __constant_htons(0x0020) 81#define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020)
82#define IB_SMP_ATTR_VENDOR_DIAG __constant_htons(0x0030) 82#define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030)
83#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031) 83#define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031)
84#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00) 84#define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00)
85 85
86struct ib_port_info { 86struct ib_port_info {
87 __be64 mkey; 87 __be64 mkey;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 936e333e7ce5..c179318edd92 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -388,7 +388,7 @@ enum {
388 IB_MULTICAST_QPN = 0xffffff 388 IB_MULTICAST_QPN = 0xffffff
389}; 389};
390 390
391#define IB_LID_PERMISSIVE __constant_htons(0xFFFF) 391#define IB_LID_PERMISSIVE cpu_to_be16(0xFFFF)
392 392
393enum ib_ah_flags { 393enum ib_ah_flags {
394 IB_AH_GRH = 1 394 IB_AH_GRH = 1
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index f271d9cc0fc2..ccb3dbe90463 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -25,13 +25,6 @@
25 */ 25 */
26 26
27/* 27/*
28 * The FCoE ethertype eventually goes in net/if_ether.h.
29 */
30#ifndef ETH_P_FCOE
31#define ETH_P_FCOE 0x8906 /* FCOE ether type */
32#endif
33
34/*
35 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. 28 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
36 */ 29 */
37#ifndef FC_FCOE_OUI 30#ifndef FC_FCOE_OUI
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
new file mode 100644
index 000000000000..0627a9ae6347
--- /dev/null
+++ b/include/scsi/fc/fc_fip.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
3 *
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
16 */
17#ifndef _FC_FIP_H_
18#define _FC_FIP_H_
19
20/*
21 * This version is based on:
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
23 */
24
25/*
26 * The FIP ethertype eventually goes in net/if_ether.h.
27 */
28#ifndef ETH_P_FIP
29#define ETH_P_FIP 0x8914 /* FIP Ethertype */
30#endif
31
32#define FIP_DEF_PRI 128 /* default selection priority */
33#define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
34#define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
35#define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */
36#define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
37
38/*
39 * Multicast MAC addresses. T11-adopted.
40 */
41#define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
42#define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
43#define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
44
45#define FIP_VER 1 /* version for fip_header */
46
47struct fip_header {
48 __u8 fip_ver; /* upper 4 bits are the version */
49 __u8 fip_resv1; /* reserved */
50 __be16 fip_op; /* operation code */
51 __u8 fip_resv2; /* reserved */
52 __u8 fip_subcode; /* lower 4 bits are sub-code */
53 __be16 fip_dl_len; /* length of descriptors in words */
54 __be16 fip_flags; /* header flags */
55} __attribute__((packed));
56
57#define FIP_VER_SHIFT 4
58#define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
59#define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
60#define FIP_BPW 4 /* bytes per word for lengths */
61
62/*
63 * fip_op.
64 */
65enum fip_opcode {
66 FIP_OP_DISC = 1, /* discovery, advertisement, etc. */
67 FIP_OP_LS = 2, /* Link Service request or reply */
68 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
69 FIP_OP_VLAN = 4, /* VLAN discovery */
70 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
71 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
72};
73
74/*
75 * Subcodes for FIP_OP_DISC.
76 */
77enum fip_disc_subcode {
78 FIP_SC_SOL = 1, /* solicitation */
79 FIP_SC_ADV = 2, /* advertisement */
80};
81
82/*
83 * Subcodes for FIP_OP_LS.
84 */
85enum fip_trans_subcode {
86 FIP_SC_REQ = 1, /* request */
87 FIP_SC_REP = 2, /* reply */
88};
89
90/*
91 * Subcodes for FIP_OP_RESET.
92 */
93enum fip_reset_subcode {
94 FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */
95 FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */
96};
97
98/*
99 * Subcodes for FIP_OP_VLAN.
100 */
101enum fip_vlan_subcode {
102 FIP_SC_VL_REQ = 1, /* request */
103 FIP_SC_VL_REP = 2, /* reply */
104};
105
106/*
107 * flags in header fip_flags.
108 */
109enum fip_flag {
110 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
111 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
112 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
113 FIP_FL_SOL = 0x0002, /* this is a solicited message */
114 FIP_FL_FPORT = 0x0001, /* sent from an F port */
115};
116
117/*
118 * Common descriptor header format.
119 */
120struct fip_desc {
121 __u8 fip_dtype; /* type - see below */
122 __u8 fip_dlen; /* length - in 32-bit words */
123};
124
125enum fip_desc_type {
126 FIP_DT_PRI = 1, /* priority for forwarder selection */
127 FIP_DT_MAC = 2, /* MAC address */
128 FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */
129 FIP_DT_NAME = 4, /* switch name or node name */
130 FIP_DT_FAB = 5, /* fabric descriptor */
131 FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */
132 FIP_DT_FLOGI = 7, /* FLOGI request or response */
133 FIP_DT_FDISC = 8, /* FDISC request or response */
134 FIP_DT_LOGO = 9, /* LOGO request or response */
135 FIP_DT_ELP = 10, /* ELP request or response */
136 FIP_DT_VN_ID = 11, /* VN_Node Identifier */
137 FIP_DT_FKA = 12, /* advertisement keep-alive period */
138 FIP_DT_VENDOR = 13, /* vendor ID */
139 FIP_DT_VLAN = 14, /* vlan number */
140 FIP_DT_LIMIT, /* max defined desc_type + 1 */
141 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
142};
143
144/*
145 * FIP_DT_PRI - priority descriptor.
146 */
147struct fip_pri_desc {
148 struct fip_desc fd_desc;
149 __u8 fd_resvd;
150 __u8 fd_pri; /* FCF priority: higher is better */
151} __attribute__((packed));
152
153/*
154 * FIP_DT_MAC - MAC address descriptor.
155 */
156struct fip_mac_desc {
157 struct fip_desc fd_desc;
158 __u8 fd_mac[ETH_ALEN];
159} __attribute__((packed));
160
161/*
162 * FIP_DT_MAP - descriptor.
163 */
164struct fip_map_desc {
165 struct fip_desc fd_desc;
166 __u8 fd_resvd[3];
167 __u8 fd_map[3];
168} __attribute__((packed));
169
170/*
171 * FIP_DT_NAME descriptor.
172 */
173struct fip_wwn_desc {
174 struct fip_desc fd_desc;
175 __u8 fd_resvd[2];
176 __be64 fd_wwn; /* 64-bit WWN, unaligned */
177} __attribute__((packed));
178
179/*
180 * FIP_DT_FAB descriptor.
181 */
182struct fip_fab_desc {
183 struct fip_desc fd_desc;
184 __be16 fd_vfid; /* virtual fabric ID */
185 __u8 fd_resvd;
186 __u8 fd_map[3]; /* FC-MAP value */
187 __be64 fd_wwn; /* fabric name, unaligned */
188} __attribute__((packed));
189
190/*
191 * FIP_DT_FCOE_SIZE descriptor.
192 */
193struct fip_size_desc {
194 struct fip_desc fd_desc;
195 __be16 fd_size;
196} __attribute__((packed));
197
198/*
199 * Descriptor that encapsulates an ELS or ILS frame.
200 * The encapsulated frame immediately follows this header, without
201 * SOF, EOF, or CRC.
202 */
203struct fip_encaps {
204 struct fip_desc fd_desc;
205 __u8 fd_resvd[2];
206} __attribute__((packed));
207
208/*
209 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
210 */
211struct fip_vn_desc {
212 struct fip_desc fd_desc;
213 __u8 fd_mac[ETH_ALEN];
214 __u8 fd_resvd;
215 __u8 fd_fc_id[3];
216 __be64 fd_wwpn; /* port name, unaligned */
217} __attribute__((packed));
218
219/*
220 * FIP_DT_FKA - Advertisement keep-alive period.
221 */
222struct fip_fka_desc {
223 struct fip_desc fd_desc;
224 __u8 fd_resvd[2];
225 __be32 fd_fka_period; /* adv./keep-alive period in mS */
226} __attribute__((packed));
227
228/*
229 * FIP_DT_VENDOR descriptor.
230 */
231struct fip_vendor_desc {
232 struct fip_desc fd_desc;
233 __u8 fd_resvd[2];
234 __u8 fd_vendor_id[8];
235} __attribute__((packed));
236
237#endif /* _FC_FIP_H_ */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 04d34a71355f..59511057cee0 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -54,8 +54,7 @@
54#define fr_eof(fp) (fr_cb(fp)->fr_eof) 54#define fr_eof(fp) (fr_cb(fp)->fr_eof)
55#define fr_flags(fp) (fr_cb(fp)->fr_flags) 55#define fr_flags(fp) (fr_cb(fp)->fr_flags)
56#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) 56#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
57#define fr_cmd(fp) (fr_cb(fp)->fr_cmd) 57#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
58#define fr_dir(fp) (fr_cmd(fp)->sc_data_direction)
59#define fr_crc(fp) (fr_cb(fp)->fr_crc) 58#define fr_crc(fp) (fr_cb(fp)->fr_crc)
60 59
61struct fc_frame { 60struct fc_frame {
@@ -66,7 +65,7 @@ struct fcoe_rcv_info {
66 struct packet_type *ptype; 65 struct packet_type *ptype;
67 struct fc_lport *fr_dev; /* transport layer private pointer */ 66 struct fc_lport *fr_dev; /* transport layer private pointer */
68 struct fc_seq *fr_seq; /* for use with exchange manager */ 67 struct fc_seq *fr_seq; /* for use with exchange manager */
69 struct scsi_cmnd *fr_cmd; /* for use of scsi command */ 68 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
70 u32 fr_crc; 69 u32 fr_crc;
71 u16 fr_max_payload; /* max FC payload */ 70 u16 fr_max_payload; /* max FC payload */
72 enum fc_sof fr_sof; /* start of frame delimiter */ 71 enum fc_sof fr_sof; /* start of frame delimiter */
@@ -218,20 +217,6 @@ static inline bool fc_frame_is_cmd(const struct fc_frame *fp)
218 return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD; 217 return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD;
219} 218}
220 219
221static inline bool fc_frame_is_read(const struct fc_frame *fp)
222{
223 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
224 return fr_dir(fp) == DMA_FROM_DEVICE;
225 return false;
226}
227
228static inline bool fc_frame_is_write(const struct fc_frame *fp)
229{
230 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
231 return fr_dir(fp) == DMA_TO_DEVICE;
232 return false;
233}
234
235/* 220/*
236 * Check for leaks. 221 * Check for leaks.
237 * Print the frame header of any currently allocated frame, assuming there 222 * Print the frame header of any currently allocated frame, assuming there
diff --git a/include/scsi/fc_transport_fcoe.h b/include/scsi/fc_transport_fcoe.h
deleted file mode 100644
index 8dca2af14ffc..000000000000
--- a/include/scsi/fc_transport_fcoe.h
+++ /dev/null
@@ -1,54 +0,0 @@
1#ifndef FC_TRANSPORT_FCOE_H
2#define FC_TRANSPORT_FCOE_H
3
4#include <linux/device.h>
5#include <linux/netdevice.h>
6#include <scsi/scsi_host.h>
7#include <scsi/libfc.h>
8
9/**
10 * struct fcoe_transport - FCoE transport struct for generic transport
11 * for Ethernet devices as well as pure HBAs
12 *
13 * @name: name for thsi transport
14 * @bus: physical bus type (pci_bus_type)
15 * @driver: physical bus driver for network device
16 * @create: entry create function
17 * @destroy: exit destroy function
18 * @list: list of transports
19 */
20struct fcoe_transport {
21 char *name;
22 unsigned short vendor;
23 unsigned short device;
24 struct bus_type *bus;
25 struct device_driver *driver;
26 int (*create)(struct net_device *device);
27 int (*destroy)(struct net_device *device);
28 bool (*match)(struct net_device *device);
29 struct list_head list;
30 struct list_head devlist;
31 struct mutex devlock;
32};
33
34/**
35 * MODULE_ALIAS_FCOE_PCI
36 *
37 * some care must be taken with this, vendor and device MUST be a hex value
38 * preceded with 0x and with letters in lower case (0x12ab, not 0x12AB or 12AB)
39 */
40#define MODULE_ALIAS_FCOE_PCI(vendor, device) \
41 MODULE_ALIAS("fcoe-pci-" __stringify(vendor) "-" __stringify(device))
42
43/* exported funcs */
44int fcoe_transport_attach(struct net_device *netdev);
45int fcoe_transport_release(struct net_device *netdev);
46int fcoe_transport_register(struct fcoe_transport *t);
47int fcoe_transport_unregister(struct fcoe_transport *t);
48int fcoe_load_transport_driver(struct net_device *netdev);
49int __init fcoe_transport_init(void);
50int __exit fcoe_transport_exit(void);
51
52/* fcow_sw is the default transport */
53extern struct fcoe_transport fcoe_sw_transport;
54#endif /* FC_TRANSPORT_FCOE_H */
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index a2e126b86e3e..0303a6a098cc 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/timer.h> 23#include <linux/timer.h>
24#include <linux/if.h> 24#include <linux/if.h>
25#include <linux/percpu.h>
25 26
26#include <scsi/scsi_transport.h> 27#include <scsi/scsi_transport.h>
27#include <scsi/scsi_transport_fc.h> 28#include <scsi/scsi_transport_fc.h>
@@ -245,6 +246,7 @@ struct fc_fcp_pkt {
245 */ 246 */
246 struct fcp_cmnd cdb_cmd; 247 struct fcp_cmnd cdb_cmd;
247 size_t xfer_len; 248 size_t xfer_len;
249 u16 xfer_ddp; /* this xfer is ddped */
248 u32 xfer_contig_end; /* offset of end of contiguous xfer */ 250 u32 xfer_contig_end; /* offset of end of contiguous xfer */
249 u16 max_payload; /* max payload size in bytes */ 251 u16 max_payload; /* max payload size in bytes */
250 252
@@ -267,6 +269,15 @@ struct fc_fcp_pkt {
267 u8 recov_retry; /* count of recovery retries */ 269 u8 recov_retry; /* count of recovery retries */
268 struct fc_seq *recov_seq; /* sequence for REC or SRR */ 270 struct fc_seq *recov_seq; /* sequence for REC or SRR */
269}; 271};
272/*
273 * FC_FCP HELPER FUNCTIONS
274 *****************************/
275static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
276{
277 if (fsp && fsp->cmd)
278 return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE;
279 return false;
280}
270 281
271/* 282/*
272 * Structure and function definitions for managing Fibre Channel Exchanges 283 * Structure and function definitions for managing Fibre Channel Exchanges
@@ -400,6 +411,21 @@ struct libfc_function_template {
400 void *arg, unsigned int timer_msec); 411 void *arg, unsigned int timer_msec);
401 412
402 /* 413 /*
414 * Sets up the DDP context for a given exchange id on the given
415 * scatterlist if LLD supports DDP for large receive.
416 *
417 * STATUS: OPTIONAL
418 */
419 int (*ddp_setup)(struct fc_lport *lp, u16 xid,
420 struct scatterlist *sgl, unsigned int sgc);
421 /*
422 * Completes the DDP transfer and returns the length of data DDPed
423 * for the given exchange id.
424 *
425 * STATUS: OPTIONAL
426 */
427 int (*ddp_done)(struct fc_lport *lp, u16 xid);
428 /*
403 * Send a frame using an existing sequence and exchange. 429 * Send a frame using an existing sequence and exchange.
404 * 430 *
405 * STATUS: OPTIONAL 431 * STATUS: OPTIONAL
@@ -636,7 +662,8 @@ struct fc_lport {
636 unsigned long boot_time; 662 unsigned long boot_time;
637 663
638 struct fc_host_statistics host_stats; 664 struct fc_host_statistics host_stats;
639 struct fcoe_dev_stats *dev_stats[NR_CPUS]; 665 struct fcoe_dev_stats *dev_stats;
666
640 u64 wwpn; 667 u64 wwpn;
641 u64 wwnn; 668 u64 wwnn;
642 u8 retry_count; 669 u8 retry_count;
@@ -654,6 +681,7 @@ struct fc_lport {
654 u16 link_speed; 681 u16 link_speed;
655 u16 link_supported_speeds; 682 u16 link_supported_speeds;
656 u16 lro_xid; /* max xid for fcoe lro */ 683 u16 lro_xid; /* max xid for fcoe lro */
684 unsigned int lso_max; /* max large send size */
657 struct fc_ns_fts fcts; /* FC-4 type masks */ 685 struct fc_ns_fts fcts; /* FC-4 type masks */
658 struct fc_els_rnid_gen rnid_gen; /* RNID information */ 686 struct fc_els_rnid_gen rnid_gen; /* RNID information */
659 687
@@ -668,11 +696,6 @@ struct fc_lport {
668/* 696/*
669 * FC_LPORT HELPER FUNCTIONS 697 * FC_LPORT HELPER FUNCTIONS
670 *****************************/ 698 *****************************/
671static inline void *lport_priv(const struct fc_lport *lp)
672{
673 return (void *)(lp + 1);
674}
675
676static inline int fc_lport_test_ready(struct fc_lport *lp) 699static inline int fc_lport_test_ready(struct fc_lport *lp)
677{ 700{
678 return lp->state == LPORT_ST_READY; 701 return lp->state == LPORT_ST_READY;
@@ -696,6 +719,42 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
696 lp->state = state; 719 lp->state = state;
697} 720}
698 721
722static inline int fc_lport_init_stats(struct fc_lport *lp)
723{
724 /* allocate per cpu stats block */
725 lp->dev_stats = alloc_percpu(struct fcoe_dev_stats);
726 if (!lp->dev_stats)
727 return -ENOMEM;
728 return 0;
729}
730
731static inline void fc_lport_free_stats(struct fc_lport *lp)
732{
733 free_percpu(lp->dev_stats);
734}
735
736static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
737{
738 return per_cpu_ptr(lp->dev_stats, smp_processor_id());
739}
740
741static inline void *lport_priv(const struct fc_lport *lp)
742{
743 return (void *)(lp + 1);
744}
745
746/**
747 * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
748 * @sht: ptr to the scsi host templ
749 * @priv_size: size of private data after fc_lport
750 *
751 * Returns: ptr to Scsi_Host
752 */
753static inline struct Scsi_Host *
754libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
755{
756 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
757}
699 758
700/* 759/*
701 * LOCAL PORT LAYER 760 * LOCAL PORT LAYER
@@ -821,6 +880,11 @@ int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
821void fc_fcp_destroy(struct fc_lport *); 880void fc_fcp_destroy(struct fc_lport *);
822 881
823/* 882/*
883 * Set up direct-data placement for this I/O request
884 */
885void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
886
887/*
824 * ELS/CT interface 888 * ELS/CT interface
825 *****************************/ 889 *****************************/
826/* 890/*
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 941818f29f59..666cc131732e 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved. 2 * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
3 * Copyright (c) 2007-2008 Intel Corporation. All rights reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -20,152 +21,144 @@
20#ifndef _LIBFCOE_H 21#ifndef _LIBFCOE_H
21#define _LIBFCOE_H 22#define _LIBFCOE_H
22 23
24#include <linux/etherdevice.h>
25#include <linux/if_ether.h>
23#include <linux/netdevice.h> 26#include <linux/netdevice.h>
24#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/workqueue.h>
25#include <scsi/fc/fc_fcoe.h> 29#include <scsi/fc/fc_fcoe.h>
26#include <scsi/libfc.h> 30#include <scsi/libfc.h>
27 31
28/* 32/*
29 * this percpu struct for fcoe 33 * FIP tunable parameters.
30 */ 34 */
31struct fcoe_percpu_s { 35#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
32 int cpu; 36#define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */
33 struct task_struct *thread; 37#define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */
34 struct sk_buff_head fcoe_rx_list; 38
35 struct page *crc_eof_page; 39/**
36 int crc_eof_offset; 40 * enum fip_state - internal state of FCoE controller.
41 * @FIP_ST_DISABLED: controller has been disabled or not yet enabled.
42 * @FIP_ST_LINK_WAIT: the physical link is down or unusable.
43 * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode.
44 * @FIP_ST_NON_FIP: non-FIP mode selected.
45 * @FIP_ST_ENABLED: FIP mode selected.
46 */
47enum fip_state {
48 FIP_ST_DISABLED,
49 FIP_ST_LINK_WAIT,
50 FIP_ST_AUTO,
51 FIP_ST_NON_FIP,
52 FIP_ST_ENABLED,
37}; 53};
38 54
39/* 55/**
40 * the fcoe sw transport private data 56 * struct fcoe_ctlr - FCoE Controller and FIP state.
57 * @state: internal FIP state for network link and FIP or non-FIP mode.
58 * @lp: &fc_lport: libfc local port.
59 * @sel_fcf: currently selected FCF, or NULL.
60 * @fcfs: list of discovered FCFs.
61 * @fcf_count: number of discovered FCF entries.
62 * @sol_time: time when a multicast solicitation was last sent.
63 * @sel_time: time after which to select an FCF.
64 * @port_ka_time: time of next port keep-alive.
65 * @ctlr_ka_time: time of next controller keep-alive.
66 * @timer: timer struct used for all delayed events.
67 * @link_work: &work_struct for doing FCF selection.
68 * @recv_work: &work_struct for receiving FIP frames.
69 * @fip_recv_list: list of received FIP frames.
70 * @user_mfs: configured maximum FC frame size, including FC header.
71 * @flogi_oxid: exchange ID of most recent fabric login.
72 * @flogi_count: number of FLOGI attempts in AUTO mode.
73 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @dest_addr: MAC address of the selected FC forwarder.
77 * @ctl_src_addr: the native MAC address of our local port.
78 * @data_src_addr: the assigned MAC address for the local port after FLOGI.
79 * @send: LLD-supplied function to handle sending of FIP Ethernet frames.
80 * @update_mac: LLD-supplied function to handle changes to MAC addresses.
81 * @lock: lock protecting this structure.
82 *
83 * This structure is used by all FCoE drivers. It contains information
84 * needed by all FCoE low-level drivers (LLDs) as well as internal state
85 * for FIP, and fields shared with the LLDS.
41 */ 86 */
42struct fcoe_softc { 87struct fcoe_ctlr {
43 struct list_head list; 88 enum fip_state state;
44 struct fc_lport *lp; 89 struct fc_lport *lp;
45 struct net_device *real_dev; 90 struct fcoe_fcf *sel_fcf;
46 struct net_device *phys_dev; /* device with ethtool_ops */ 91 struct list_head fcfs;
47 struct packet_type fcoe_packet_type; 92 u16 fcf_count;
48 struct sk_buff_head fcoe_pending_queue; 93 unsigned long sol_time;
49 u8 fcoe_pending_queue_active; 94 unsigned long sel_time;
50 95 unsigned long port_ka_time;
96 unsigned long ctlr_ka_time;
97 struct timer_list timer;
98 struct work_struct link_work;
99 struct work_struct recv_work;
100 struct sk_buff_head fip_recv_list;
101 u16 user_mfs;
102 u16 flogi_oxid;
103 u8 flogi_count;
104 u8 link;
105 u8 last_link;
106 u8 map_dest;
51 u8 dest_addr[ETH_ALEN]; 107 u8 dest_addr[ETH_ALEN];
52 u8 ctl_src_addr[ETH_ALEN]; 108 u8 ctl_src_addr[ETH_ALEN];
53 u8 data_src_addr[ETH_ALEN]; 109 u8 data_src_addr[ETH_ALEN];
54 /*
55 * fcoe protocol address learning related stuff
56 */
57 u16 flogi_oxid;
58 u8 flogi_progress;
59 u8 address_mode;
60};
61
62static inline struct net_device *fcoe_netdev(
63 const struct fc_lport *lp)
64{
65 return ((struct fcoe_softc *)lport_priv(lp))->real_dev;
66}
67
68static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)
69{
70 return (struct fcoe_hdr *)skb_network_header(skb);
71}
72
73static inline int skb_fcoe_offset(const struct sk_buff *skb)
74{
75 return skb_network_offset(skb);
76}
77
78static inline struct fc_frame_header *skb_fc_header(const struct sk_buff *skb)
79{
80 return (struct fc_frame_header *)skb_transport_header(skb);
81}
82
83static inline int skb_fc_offset(const struct sk_buff *skb)
84{
85 return skb_transport_offset(skb);
86}
87
88static inline void skb_reset_fc_header(struct sk_buff *skb)
89{
90 skb_reset_network_header(skb);
91 skb_set_transport_header(skb, skb_network_offset(skb) +
92 sizeof(struct fcoe_hdr));
93}
94 110
95static inline bool skb_fc_is_data(const struct sk_buff *skb) 111 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
96{ 112 void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new);
97 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_SOL_DATA; 113 spinlock_t lock;
98} 114};
99
100static inline bool skb_fc_is_cmd(const struct sk_buff *skb)
101{
102 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD;
103}
104
105static inline bool skb_fc_has_exthdr(const struct sk_buff *skb)
106{
107 return (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_VFTH) ||
108 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_IFRH) ||
109 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_ENCH);
110}
111
112static inline bool skb_fc_is_roff(const struct sk_buff *skb)
113{
114 return skb_fc_header(skb)->fh_f_ctl[2] & FC_FC_REL_OFF;
115}
116 115
117static inline u16 skb_fc_oxid(const struct sk_buff *skb) 116/*
118{ 117 * struct fcoe_fcf - Fibre-Channel Forwarder.
119 return be16_to_cpu(skb_fc_header(skb)->fh_ox_id); 118 * @list: list linkage.
120} 119 * @time: system time (jiffies) when an advertisement was last received.
120 * @switch_name: WWN of switch from advertisement.
121 * @fabric_name: WWN of fabric from advertisement.
122 * @fc_map: FC_MAP value from advertisement.
123 * @fcf_mac: Ethernet address of the FCF.
124 * @vfid: virtual fabric ID.
125 * @pri: seletion priority, smaller values are better.
126 * @flags: flags received from advertisement.
127 * @fka_period: keep-alive period, in jiffies.
128 *
129 * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that
130 * passes FCoE frames on to an FC fabric. This structure represents
131 * one FCF from which advertisements have been received.
132 *
133 * When looking up an FCF, @switch_name, @fabric_name, @fc_map, @vfid, and
134 * @fcf_mac together form the lookup key.
135 */
136struct fcoe_fcf {
137 struct list_head list;
138 unsigned long time;
121 139
122static inline u16 skb_fc_rxid(const struct sk_buff *skb) 140 u64 switch_name;
123{ 141 u64 fabric_name;
124 return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); 142 u32 fc_map;
125} 143 u16 vfid;
144 u8 fcf_mac[ETH_ALEN];
126 145
127/* FIXME - DMA_BIDIRECTIONAL ? */ 146 u8 pri;
128#define skb_cb(skb) ((struct fcoe_rcv_info *)&((skb)->cb[0])) 147 u16 flags;
129#define skb_cmd(skb) (skb_cb(skb)->fr_cmd) 148 u32 fka_period;
130#define skb_dir(skb) (skb_cmd(skb)->sc_data_direction) 149};
131static inline bool skb_fc_is_read(const struct sk_buff *skb)
132{
133 if (skb_fc_is_cmd(skb) && skb_cmd(skb))
134 return skb_dir(skb) == DMA_FROM_DEVICE;
135 return false;
136}
137 150
138static inline bool skb_fc_is_write(const struct sk_buff *skb) 151/* FIP API functions */
139{ 152void fcoe_ctlr_init(struct fcoe_ctlr *);
140 if (skb_fc_is_cmd(skb) && skb_cmd(skb)) 153void fcoe_ctlr_destroy(struct fcoe_ctlr *);
141 return skb_dir(skb) == DMA_TO_DEVICE; 154void fcoe_ctlr_link_up(struct fcoe_ctlr *);
142 return false; 155int fcoe_ctlr_link_down(struct fcoe_ctlr *);
143} 156int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *);
157void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
158int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa);
144 159
145/* libfcoe funcs */ 160/* libfcoe funcs */
146int fcoe_reset(struct Scsi_Host *shost); 161u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
147u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
148 unsigned int scheme, unsigned int port);
149
150u32 fcoe_fc_crc(struct fc_frame *fp);
151int fcoe_xmit(struct fc_lport *, struct fc_frame *);
152int fcoe_rcv(struct sk_buff *, struct net_device *,
153 struct packet_type *, struct net_device *);
154
155int fcoe_percpu_receive_thread(void *arg);
156void fcoe_clean_pending_queue(struct fc_lport *lp);
157void fcoe_percpu_clean(struct fc_lport *lp);
158void fcoe_watchdog(ulong vp);
159int fcoe_link_ok(struct fc_lport *lp);
160
161struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
162int fcoe_hostlist_add(const struct fc_lport *);
163int fcoe_hostlist_remove(const struct fc_lport *);
164
165struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int);
166int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); 162int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
167 163
168/* fcoe sw hba */
169int __init fcoe_sw_init(void);
170int __exit fcoe_sw_exit(void);
171#endif /* _LIBFCOE_H */ 164#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7360e1916e75..7ffaed2f94dd 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -45,18 +45,10 @@ struct iscsi_session;
45struct iscsi_nopin; 45struct iscsi_nopin;
46struct device; 46struct device;
47 47
48/* #define DEBUG_SCSI */
49#ifdef DEBUG_SCSI
50#define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
51#else
52#define debug_scsi(fmt...)
53#endif
54
55#define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */ 48#define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */
56#define ISCSI_MGMT_CMDS_MAX 15 49#define ISCSI_MGMT_CMDS_MAX 15
57 50
58#define ISCSI_DEF_CMD_PER_LUN 32 51#define ISCSI_DEF_CMD_PER_LUN 32
59#define ISCSI_MAX_CMD_PER_LUN 128
60 52
61/* Task Mgmt states */ 53/* Task Mgmt states */
62enum { 54enum {
@@ -326,6 +318,9 @@ struct iscsi_host {
326 spinlock_t lock; 318 spinlock_t lock;
327 int num_sessions; 319 int num_sessions;
328 int state; 320 int state;
321
322 struct workqueue_struct *workq;
323 char workq_name[20];
329}; 324};
330 325
331/* 326/*
@@ -351,7 +346,8 @@ extern int iscsi_host_get_param(struct Scsi_Host *shost,
351 enum iscsi_host_param param, char *buf); 346 enum iscsi_host_param param, char *buf);
352extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev); 347extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev);
353extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, 348extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
354 int dd_data_size, uint16_t qdepth); 349 int dd_data_size,
350 bool xmit_can_sleep);
355extern void iscsi_host_remove(struct Scsi_Host *shost); 351extern void iscsi_host_remove(struct Scsi_Host *shost);
356extern void iscsi_host_free(struct Scsi_Host *shost); 352extern void iscsi_host_free(struct Scsi_Host *shost);
357 353
@@ -382,11 +378,12 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
382extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 378extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
383 int); 379 int);
384extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 380extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
385extern void iscsi_session_failure(struct iscsi_cls_session *cls_session, 381extern void iscsi_session_failure(struct iscsi_session *session,
386 enum iscsi_err err); 382 enum iscsi_err err);
387extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 383extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
388 enum iscsi_param param, char *buf); 384 enum iscsi_param param, char *buf);
389extern void iscsi_suspend_tx(struct iscsi_conn *conn); 385extern void iscsi_suspend_tx(struct iscsi_conn *conn);
386extern void iscsi_conn_queue_work(struct iscsi_conn *conn);
390 387
391#define iscsi_conn_printk(prefix, _c, fmt, a...) \ 388#define iscsi_conn_printk(prefix, _c, fmt, a...) \
392 iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ 389 iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
new file mode 100644
index 000000000000..f888a6fda073
--- /dev/null
+++ b/include/scsi/osd_attributes.h
@@ -0,0 +1,327 @@
1#ifndef __OSD_ATTRIBUTES_H__
2#define __OSD_ATTRIBUTES_H__
3
4#include "osd_protocol.h"
5
6/*
7 * Contains types and constants that define attribute pages and attribute
8 * numbers and their data types.
9 */
10
11#define ATTR_SET(pg, id, l, ptr) \
12 { .attr_page = pg, .attr_id = id, .len = l, .val_ptr = ptr }
13
14#define ATTR_DEF(pg, id, l) ATTR_SET(pg, id, l, NULL)
15
16/* osd-r10 4.7.3 Attributes pages */
17enum {
18 OSD_APAGE_OBJECT_FIRST = 0x0,
19 OSD_APAGE_OBJECT_DIRECTORY = 0,
20 OSD_APAGE_OBJECT_INFORMATION = 1,
21 OSD_APAGE_OBJECT_QUOTAS = 2,
22 OSD_APAGE_OBJECT_TIMESTAMP = 3,
23 OSD_APAGE_OBJECT_COLLECTIONS = 4,
24 OSD_APAGE_OBJECT_SECURITY = 5,
25 OSD_APAGE_OBJECT_LAST = 0x2fffffff,
26
27 OSD_APAGE_PARTITION_FIRST = 0x30000000,
28 OSD_APAGE_PARTITION_DIRECTORY = OSD_APAGE_PARTITION_FIRST + 0,
29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
32 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
33 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
34
35 OSD_APAGE_COLLECTION_FIRST = 0x60000000,
36 OSD_APAGE_COLLECTION_DIRECTORY = OSD_APAGE_COLLECTION_FIRST + 0,
37 OSD_APAGE_COLLECTION_INFORMATION = OSD_APAGE_COLLECTION_FIRST + 1,
38 OSD_APAGE_COLLECTION_TIMESTAMP = OSD_APAGE_COLLECTION_FIRST + 3,
39 OSD_APAGE_COLLECTION_SECURITY = OSD_APAGE_COLLECTION_FIRST + 5,
40 OSD_APAGE_COLLECTION_LAST = 0x8FFFFFFF,
41
42 OSD_APAGE_ROOT_FIRST = 0x90000000,
43 OSD_APAGE_ROOT_DIRECTORY = OSD_APAGE_ROOT_FIRST + 0,
44 OSD_APAGE_ROOT_INFORMATION = OSD_APAGE_ROOT_FIRST + 1,
45 OSD_APAGE_ROOT_QUOTAS = OSD_APAGE_ROOT_FIRST + 2,
46 OSD_APAGE_ROOT_TIMESTAMP = OSD_APAGE_ROOT_FIRST + 3,
47 OSD_APAGE_ROOT_SECURITY = OSD_APAGE_ROOT_FIRST + 5,
48 OSD_APAGE_ROOT_LAST = 0xBFFFFFFF,
49
50 OSD_APAGE_RESERVED_TYPE_FIRST = 0xC0000000,
51 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
52
53 OSD_APAGE_COMMON_FIRST = 0xF0000000,
54 OSD_APAGE_COMMON_LAST = 0xFFFFFFFE,
55
56 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
57};
58
59/* subcategories of attr pages within each range above */
60enum {
61 OSD_APAGE_STD_FIRST = 0x0,
62 OSD_APAGE_STD_DIRECTORY = 0,
63 OSD_APAGE_STD_INFORMATION = 1,
64 OSD_APAGE_STD_QUOTAS = 2,
65 OSD_APAGE_STD_TIMESTAMP = 3,
66 OSD_APAGE_STD_COLLECTIONS = 4,
67 OSD_APAGE_STD_POLICY_SECURITY = 5,
68 OSD_APAGE_STD_LAST = 0x0000007F,
69
70 OSD_APAGE_RESERVED_FIRST = 0x00000080,
71 OSD_APAGE_RESERVED_LAST = 0x00007FFF,
72
73 OSD_APAGE_OTHER_STD_FIRST = 0x00008000,
74 OSD_APAGE_OTHER_STD_LAST = 0x0000EFFF,
75
76 OSD_APAGE_PUBLIC_FIRST = 0x0000F000,
77 OSD_APAGE_PUBLIC_LAST = 0x0000FFFF,
78
79 OSD_APAGE_APP_DEFINED_FIRST = 0x00010000,
80 OSD_APAGE_APP_DEFINED_LAST = 0x1FFFFFFF,
81
82 OSD_APAGE_VENDOR_SPECIFIC_FIRST = 0x20000000,
83 OSD_APAGE_VENDOR_SPECIFIC_LAST = 0x2FFFFFFF,
84};
85
86enum {
87 OSD_ATTR_PAGE_IDENTIFICATION = 0, /* in all pages 40 bytes */
88};
89
90struct page_identification {
91 u8 vendor_identification[8];
92 u8 page_identification[32];
93} __packed;
94
95struct osd_attr_page_header {
96 __be32 page_number;
97 __be32 page_length;
98} __packed;
99
100/* 7.1.2.8 Root Information attributes page (OSD_APAGE_ROOT_INFORMATION) */
101enum {
102 OSD_ATTR_RI_OSD_SYSTEM_ID = 0x3, /* 20 */
103 OSD_ATTR_RI_VENDOR_IDENTIFICATION = 0x4, /* 8 */
104 OSD_ATTR_RI_PRODUCT_IDENTIFICATION = 0x5, /* 16 */
105 OSD_ATTR_RI_PRODUCT_MODEL = 0x6, /* 32 */
106 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
107 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
108 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
109 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
110 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
111 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
112 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
113};
114/* Root_Information_attributes_page does not have a get_page structure */
115
116/* 7.1.2.9 Partition Information attributes page
117 * (OSD_APAGE_PARTITION_INFORMATION)
118 */
119enum {
120 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
121 OSD_ATTR_PI_USERNAME = 0x9, /* variable */
122 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
123 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
124};
125/* Partition Information attributes page does not have a get_page structure */
126
127/* 7.1.2.10 Collection Information attributes page
128 * (OSD_APAGE_COLLECTION_INFORMATION)
129 */
130enum {
131 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
132 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
133 OSD_ATTR_CI_USERNAME = 0x9, /* variable */
134 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
135};
136/* Collection Information attributes page does not have a get_page structure */
137
138/* 7.1.2.11 User Object Information attributes page
139 * (OSD_APAGE_OBJECT_INFORMATION)
140 */
141enum {
142 OSD_ATTR_OI_PARTITION_ID = 0x1, /* 8 */
143 OSD_ATTR_OI_OBJECT_ID = 0x2, /* 8 */
144 OSD_ATTR_OI_USERNAME = 0x9, /* variable */
145 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
147};
148/* Object Information attributes page does not have a get_page structure */
149
150/* 7.1.2.12 Root Quotas attributes page (OSD_APAGE_ROOT_QUOTAS) */
151enum {
152 OSD_ATTR_RQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
153 OSD_ATTR_RQ_PARTITION_CAPACITY_QUOTA = 0x10001, /* 8 */
154 OSD_ATTR_RQ_PARTITION_OBJECT_COUNT = 0x10002, /* 8 */
155 OSD_ATTR_RQ_PARTITION_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
156 OSD_ATTR_RQ_PARTITION_COUNT = 0x20002, /* 8 */
157};
158
159struct Root_Quotas_attributes_page {
160 struct osd_attr_page_header hdr; /* id=R+2, size=0x24 */
161 __be64 default_maximum_user_object_length;
162 __be64 partition_capacity_quota;
163 __be64 partition_object_count;
164 __be64 partition_collections_per_user_object;
165 __be64 partition_count;
166} __packed;
167
168/* 7.1.2.13 Partition Quotas attributes page (OSD_APAGE_PARTITION_QUOTAS)*/
169enum {
170 OSD_ATTR_PQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
171 OSD_ATTR_PQ_CAPACITY_QUOTA = 0x10001, /* 8 */
172 OSD_ATTR_PQ_OBJECT_COUNT = 0x10002, /* 8 */
173 OSD_ATTR_PQ_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
174};
175
176struct Partition_Quotas_attributes_page {
177 struct osd_attr_page_header hdr; /* id=P+2, size=0x1C */
178 __be64 default_maximum_user_object_length;
179 __be64 capacity_quota;
180 __be64 object_count;
181 __be64 collections_per_user_object;
182} __packed;
183
184/* 7.1.2.14 User Object Quotas attributes page (OSD_APAGE_OBJECT_QUOTAS) */
185enum {
186 OSD_ATTR_OQ_MAXIMUM_LENGTH = 0x1, /* 8 */
187};
188
189struct Object_Quotas_attributes_page {
190 struct osd_attr_page_header hdr; /* id=U+2, size=0x8 */
191 __be64 maximum_length;
192} __packed;
193
194/* 7.1.2.15 Root Timestamps attributes page (OSD_APAGE_ROOT_TIMESTAMP) */
195enum {
196 OSD_ATTR_RT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
197 OSD_ATTR_RT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
198 OSD_ATTR_RT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
199};
200
201struct root_timestamps_attributes_page {
202 struct osd_attr_page_header hdr; /* id=R+3, size=0xD */
203 struct osd_timestamp attributes_accessed_time;
204 struct osd_timestamp attributes_modified_time;
205 u8 timestamp_bypass;
206} __packed;
207
208/* 7.1.2.16 Partition Timestamps attributes page
209 * (OSD_APAGE_PARTITION_TIMESTAMP)
210 */
211enum {
212 OSD_ATTR_PT_CREATED_TIME = 0x1, /* 6 */
213 OSD_ATTR_PT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
214 OSD_ATTR_PT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
215 OSD_ATTR_PT_DATA_ACCESSED_TIME = 0x4, /* 6 */
216 OSD_ATTR_PT_DATA_MODIFIED_TIME = 0x5, /* 6 */
217 OSD_ATTR_PT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
218};
219
220struct partition_timestamps_attributes_page {
221 struct osd_attr_page_header hdr; /* id=P+3, size=0x1F */
222 struct osd_timestamp created_time;
223 struct osd_timestamp attributes_accessed_time;
224 struct osd_timestamp attributes_modified_time;
225 struct osd_timestamp data_accessed_time;
226 struct osd_timestamp data_modified_time;
227 u8 timestamp_bypass;
228} __packed;
229
230/* 7.1.2.17/18 Collection/Object Timestamps attributes page
231 * (OSD_APAGE_COLLECTION_TIMESTAMP/OSD_APAGE_OBJECT_TIMESTAMP)
232 */
233enum {
234 OSD_ATTR_OT_CREATED_TIME = 0x1, /* 6 */
235 OSD_ATTR_OT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
236 OSD_ATTR_OT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
237 OSD_ATTR_OT_DATA_ACCESSED_TIME = 0x4, /* 6 */
238 OSD_ATTR_OT_DATA_MODIFIED_TIME = 0x5, /* 6 */
239};
240
241/* same for collection */
242struct object_timestamps_attributes_page {
243 struct osd_attr_page_header hdr; /* id=C+3/3, size=0x1E */
244 struct osd_timestamp created_time;
245 struct osd_timestamp attributes_accessed_time;
246 struct osd_timestamp attributes_modified_time;
247 struct osd_timestamp data_accessed_time;
248 struct osd_timestamp data_modified_time;
249} __packed;
250
251/* 7.1.2.19 Collections attributes page */
252/* TBD */
253
254/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
255enum {
256 OSD_ATTR_RS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
257 OSD_ATTR_RS_OLDEST_VALID_NONCE_LIMIT = 0x2, /* 6 */
258 OSD_ATTR_RS_NEWEST_VALID_NONCE_LIMIT = 0x3, /* 6 */
259 OSD_ATTR_RS_PARTITION_DEFAULT_SECURITY_METHOD = 0x6, /* 1 */
260 OSD_ATTR_RS_SUPPORTED_SECURITY_METHODS = 0x7, /* 2 */
261 OSD_ATTR_RS_ADJUSTABLE_CLOCK = 0x9, /* 6 */
262 OSD_ATTR_RS_MASTER_KEY_IDENTIFIER = 0x7FFD, /* 0 or 7 */
263 OSD_ATTR_RS_ROOT_KEY_IDENTIFIER = 0x7FFE, /* 0 or 7 */
264 OSD_ATTR_RS_SUPPORTED_INTEGRITY_ALGORITHM_0 = 0x80000000,/* 1,(x16)*/
265 OSD_ATTR_RS_SUPPORTED_DH_GROUP_0 = 0x80000010,/* 1,(x16)*/
266};
267
268struct root_security_attributes_page {
269 struct osd_attr_page_header hdr; /* id=R+5, size=0x3F */
270 u8 default_security_method;
271 u8 partition_default_security_method;
272 __be16 supported_security_methods;
273 u8 mki_valid_rki_valid;
274 struct osd_timestamp oldest_valid_nonce_limit;
275 struct osd_timestamp newest_valid_nonce_limit;
276 struct osd_timestamp adjustable_clock;
277 u8 master_key_identifier[32-25];
278 u8 root_key_identifier[39-32];
279 u8 supported_integrity_algorithm[16];
280 u8 supported_dh_group[16];
281} __packed;
282
283/* 7.1.2.21 Partition Policy/Security attributes page
284 * (OSD_APAGE_PARTITION_SECURITY)
285 */
286enum {
287 OSD_ATTR_PS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
288 OSD_ATTR_PS_OLDEST_VALID_NONCE = 0x2, /* 6 */
289 OSD_ATTR_PS_NEWEST_VALID_NONCE = 0x3, /* 6 */
290 OSD_ATTR_PS_REQUEST_NONCE_LIST_DEPTH = 0x4, /* 2 */
291 OSD_ATTR_PS_FROZEN_WORKING_KEY_BIT_MASK = 0x5, /* 2 */
292 OSD_ATTR_PS_PARTITION_KEY_IDENTIFIER = 0x7FFF, /* 0 or 7 */
293 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_FIRST = 0x8000, /* 0 or 7 */
294 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_LAST = 0x800F, /* 0 or 7 */
295 OSD_ATTR_PS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
296 OSD_ATTR_PS_USER_OBJECT_POLICY_ACCESS_TAG = 0x40000002, /* 4 */
297};
298
299struct partition_security_attributes_page {
300 struct osd_attr_page_header hdr; /* id=p+5, size=0x8f */
301 u8 reserved[3];
302 u8 default_security_method;
303 struct osd_timestamp oldest_valid_nonce;
304 struct osd_timestamp newest_valid_nonce;
305 __be16 request_nonce_list_depth;
306 __be16 frozen_working_key_bit_mask;
307 __be32 policy_access_tag;
308 __be32 user_object_policy_access_tag;
309 u8 pki_valid;
310 __be16 wki_00_0f_vld;
311 struct osd_key_identifier partition_key_identifier;
312 struct osd_key_identifier working_key_identifiers[16];
313} __packed;
314
315/* 7.1.2.22/23 Collection/Object Policy-Security attributes page
316 * (OSD_APAGE_COLLECTION_SECURITY/OSD_APAGE_OBJECT_SECURITY)
317 */
318enum {
319 OSD_ATTR_OS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
320};
321
322struct object_security_attributes_page {
323 struct osd_attr_page_header hdr; /* id=C+5/5, size=4 */
324 __be32 policy_access_tag;
325} __packed;
326
327#endif /*ndef __OSD_ATTRIBUTES_H__*/
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
new file mode 100644
index 000000000000..b24d9616eb46
--- /dev/null
+++ b/include/scsi/osd_initiator.h
@@ -0,0 +1,433 @@
1/*
2 * osd_initiator.h - OSD initiator API definition
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 *
13 */
14#ifndef __OSD_INITIATOR_H__
15#define __OSD_INITIATOR_H__
16
17#include "osd_protocol.h"
18#include "osd_types.h"
19
20#include <linux/blkdev.h>
21
22/* Note: "NI" in comments below means "Not Implemented yet" */
23
24/* Configure of code:
25 * #undef if you *don't* want OSD v1 support in runtime.
26 * If #defined the initiator will dynamically configure to encode OSD v1
27 * CDB's if the target is detected to be OSD v1 only.
28 * OSD v2 only commands, options, and attributes will be ignored if target
29 * is v1 only.
30 * If #defined will result in bigger/slower code (OK Slower maybe not)
31 * Q: Should this be CONFIG_SCSI_OSD_VER1_SUPPORT and set from Kconfig?
32 */
33#define OSD_VER1_SUPPORT y
34
35enum osd_std_version {
36 OSD_VER_NONE = 0,
37 OSD_VER1 = 1,
38 OSD_VER2 = 2,
39};
40
41/*
42 * Object-based Storage Device.
43 * This object represents an OSD device.
44 * It is not a full linux device in any way. It is only
45 * a place to hang resources associated with a Linux
46 * request Q and some default properties.
47 */
48struct osd_dev {
49 struct scsi_device *scsi_device;
50 unsigned def_timeout;
51
52#ifdef OSD_VER1_SUPPORT
53 enum osd_std_version version;
54#endif
55};
56
57/* Retrieve/return osd_dev(s) for use by Kernel clients */
58struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/
59void osduld_put_device(struct osd_dev *od);
60
61/* Add/remove test ioctls from external modules */
62typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg);
63int osduld_register_test(unsigned ioctl, do_test_fn *do_test);
64void osduld_unregister_test(unsigned ioctl);
65
66/* These are called by uld at probe time */
67void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device);
68void osd_dev_fini(struct osd_dev *od);
69
70/* some hi level device operations */
71int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */
72
73/* we might want to use function vector in the future */
74static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
75{
76#ifdef OSD_VER1_SUPPORT
77 od->version = v;
78#endif
79}
80
81struct osd_request;
82typedef void (osd_req_done_fn)(struct osd_request *or, void *private);
83
84struct osd_request {
85 struct osd_cdb cdb;
86 struct osd_data_out_integrity_info out_data_integ;
87 struct osd_data_in_integrity_info in_data_integ;
88
89 struct osd_dev *osd_dev;
90 struct request *request;
91
92 struct _osd_req_data_segment {
93 void *buff;
94 unsigned alloc_size; /* 0 here means: don't call kfree */
95 unsigned total_bytes;
96 } set_attr, enc_get_attr, get_attr;
97
98 struct _osd_io_info {
99 struct bio *bio;
100 u64 total_bytes;
101 struct request *req;
102 struct _osd_req_data_segment *last_seg;
103 u8 *pad_buff;
104 } out, in;
105
106 gfp_t alloc_flags;
107 unsigned timeout;
108 unsigned retries;
109 u8 sense[OSD_MAX_SENSE_LEN];
110 enum osd_attributes_mode attributes_mode;
111
112 osd_req_done_fn *async_done;
113 void *async_private;
114 int async_error;
115};
116
117/* OSD Version control */
118static inline bool osd_req_is_ver1(struct osd_request *or)
119{
120#ifdef OSD_VER1_SUPPORT
121 return or->osd_dev->version == OSD_VER1;
122#else
123 return false;
124#endif
125}
126
127/*
128 * How to use the osd library:
129 *
130 * osd_start_request
131 * Allocates a request.
132 *
133 * osd_req_*
134 * Call one of, to encode the desired operation.
135 *
136 * osd_add_{get,set}_attr
137 * Optionally add attributes to the CDB, list or page mode.
138 *
139 * osd_finalize_request
140 * Computes final data out/in offsets and signs the request,
141 * making it ready for execution.
142 *
143 * osd_execute_request
144 * May be called to execute it through the block layer. Other wise submit
145 * the associated block request in some other way.
146 *
147 * After execution:
148 * osd_req_decode_sense
149 * Decodes sense information to verify execution results.
150 *
151 * osd_req_decode_get_attr
152 * Retrieve osd_add_get_attr_list() values if used.
153 *
154 * osd_end_request
155 * Must be called to deallocate the request.
156 */
157
158/**
159 * osd_start_request - Allocate and initialize an osd_request
160 *
161 * @osd_dev: OSD device that holds the scsi-device and default values
162 * that the request is associated with.
163 * @gfp: The allocation flags to use for request allocation, and all
164 * subsequent allocations. This will be stored at
165 * osd_request->alloc_flags, can be changed by user later
166 *
167 * Allocate osd_request and initialize all members to the
168 * default/initial state.
169 */
170struct osd_request *osd_start_request(struct osd_dev *od, gfp_t gfp);
171
172enum osd_req_options {
173 OSD_REQ_FUA = 0x08, /* Force Unit Access */
174 OSD_REQ_DPO = 0x10, /* Disable Page Out */
175
176 OSD_REQ_BYPASS_TIMESTAMPS = 0x80,
177};
178
179/**
180 * osd_finalize_request - Sign request and prepare request for execution
181 *
182 * @or: osd_request to prepare
183 * @options: combination of osd_req_options bit flags or 0.
184 * @cap: A Pointer to an OSD_CAP_LEN bytes buffer that is received from
185 * The security manager as capabilities for this cdb.
186 * @cap_key: The cryptographic key used to sign the cdb/data. Can be null
187 * if NOSEC is used.
188 *
189 * The actual request and bios are only allocated here, so are the get_attr
190 * buffers that will receive the returned attributes. Copy's @cap to cdb.
191 * Sign the cdb/data with @cap_key.
192 */
193int osd_finalize_request(struct osd_request *or,
194 u8 options, const void *cap, const u8 *cap_key);
195
196/**
197 * osd_execute_request - Execute the request synchronously through block-layer
198 *
199 * @or: osd_request to Executed
200 *
201 * Calls blk_execute_rq to q the command and waits for completion.
202 */
203int osd_execute_request(struct osd_request *or);
204
205/**
206 * osd_execute_request_async - Execute the request without waitting.
207 *
208 * @or: - osd_request to Executed
209 * @done: (Optional) - Called at end of execution
210 * @private: - Will be passed to @done function
211 *
212 * Calls blk_execute_rq_nowait to queue the command. When execution is done
213 * optionally calls @done with @private as parameter. @or->async_error will
214 * have the return code
215 */
216int osd_execute_request_async(struct osd_request *or,
217 osd_req_done_fn *done, void *private);
218
219/**
220 * osd_req_decode_sense_full - Decode sense information after execution.
221 *
222 * @or: - osd_request to examine
223 * @osi - Recievs a more detailed error report information (optional).
224 * @silent - Do not print to dmsg (Even if enabled)
225 * @bad_obj_list - Some commands act on multiple objects. Failed objects will
226 * be recieved here (optional)
227 * @max_obj - Size of @bad_obj_list.
228 * @bad_attr_list - List of failing attributes (optional)
229 * @max_attr - Size of @bad_attr_list.
230 *
231 * After execution, sense + return code can be analyzed using this function. The
232 * return code is the final disposition on the error. So it is possible that a
233 * CHECK_CONDITION was returned from target but this will return NO_ERROR, for
234 * example on recovered errors. All parameters are optional if caller does
235 * not need any returned information.
236 * Note: This function will also dump the error to dmsg according to settings
237 * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the
238 * command would routinely fail, to not spam the dmsg file.
239 */
240struct osd_sense_info {
241 int key; /* one of enum scsi_sense_keys */
242 int additional_code ; /* enum osd_additional_sense_codes */
243 union { /* Sense specific information */
244 u16 sense_info;
245 u16 cdb_field_offset; /* scsi_invalid_field_in_cdb */
246 };
247 union { /* Command specific information */
248 u64 command_info;
249 };
250
251 u32 not_initiated_command_functions; /* osd_command_functions_bits */
252 u32 completed_command_functions; /* osd_command_functions_bits */
253 struct osd_obj_id obj;
254 struct osd_attr attr;
255};
256
257int osd_req_decode_sense_full(struct osd_request *or,
258 struct osd_sense_info *osi, bool silent,
259 struct osd_obj_id *bad_obj_list, int max_obj,
260 struct osd_attr *bad_attr_list, int max_attr);
261
262static inline int osd_req_decode_sense(struct osd_request *or,
263 struct osd_sense_info *osi)
264{
265 return osd_req_decode_sense_full(or, osi, false, NULL, 0, NULL, 0);
266}
267
268/**
269 * osd_end_request - return osd_request to free store
270 *
271 * @or: osd_request to free
272 *
273 * Deallocate all osd_request resources (struct req's, BIOs, buffers, etc.)
274 */
275void osd_end_request(struct osd_request *or);
276
277/*
278 * CDB Encoding
279 *
280 * Note: call only one of the following methods.
281 */
282
283/*
284 * Device commands
285 */
286void osd_req_set_master_seed_xchg(struct osd_request *or, ...);/* NI */
287void osd_req_set_master_key(struct osd_request *or, ...);/* NI */
288
289void osd_req_format(struct osd_request *or, u64 tot_capacity);
290
291/* list all partitions
292 * @list header must be initialized to zero on first run.
293 *
294 * Call osd_is_obj_list_done() to find if we got the complete list.
295 */
296int osd_req_list_dev_partitions(struct osd_request *or,
297 osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem);
298
299void osd_req_flush_obsd(struct osd_request *or,
300 enum osd_options_flush_scope_values);
301
302void osd_req_perform_scsi_command(struct osd_request *or,
303 const u8 *cdb, ...);/* NI */
304void osd_req_task_management(struct osd_request *or, ...);/* NI */
305
306/*
307 * Partition commands
308 */
309void osd_req_create_partition(struct osd_request *or, osd_id partition);
310void osd_req_remove_partition(struct osd_request *or, osd_id partition);
311
312void osd_req_set_partition_key(struct osd_request *or,
313 osd_id partition, u8 new_key_id[OSD_CRYPTO_KEYID_SIZE],
314 u8 seed[OSD_CRYPTO_SEED_SIZE]);/* NI */
315
316/* list all collections in the partition
317 * @list header must be init to zero on first run.
318 *
319 * Call osd_is_obj_list_done() to find if we got the complete list.
320 */
321int osd_req_list_partition_collections(struct osd_request *or,
322 osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
323 unsigned nelem);
324
325/* list all objects in the partition
326 * @list header must be init to zero on first run.
327 *
328 * Call osd_is_obj_list_done() to find if we got the complete list.
329 */
330int osd_req_list_partition_objects(struct osd_request *or,
331 osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
332 unsigned nelem);
333
334void osd_req_flush_partition(struct osd_request *or,
335 osd_id partition, enum osd_options_flush_scope_values);
336
337/*
338 * Collection commands
339 */
340void osd_req_create_collection(struct osd_request *or,
341 const struct osd_obj_id *);/* NI */
342void osd_req_remove_collection(struct osd_request *or,
343 const struct osd_obj_id *);/* NI */
344
345/* list all objects in the collection */
346int osd_req_list_collection_objects(struct osd_request *or,
347 const struct osd_obj_id *, osd_id initial_id,
348 struct osd_obj_id_list *list, unsigned nelem);
349
350/* V2 only filtered list of objects in the collection */
351void osd_req_query(struct osd_request *or, ...);/* NI */
352
353void osd_req_flush_collection(struct osd_request *or,
354 const struct osd_obj_id *, enum osd_options_flush_scope_values);
355
356void osd_req_get_member_attrs(struct osd_request *or, ...);/* V2-only NI */
357void osd_req_set_member_attrs(struct osd_request *or, ...);/* V2-only NI */
358
359/*
360 * Object commands
361 */
362void osd_req_create_object(struct osd_request *or, struct osd_obj_id *);
363void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
364
365void osd_req_write(struct osd_request *or,
366 const struct osd_obj_id *, struct bio *data_out, u64 offset);
367void osd_req_append(struct osd_request *or,
368 const struct osd_obj_id *, struct bio *data_out);/* NI */
369void osd_req_create_write(struct osd_request *or,
370 const struct osd_obj_id *, struct bio *data_out, u64 offset);/* NI */
371void osd_req_clear(struct osd_request *or,
372 const struct osd_obj_id *, u64 offset, u64 len);/* NI */
373void osd_req_punch(struct osd_request *or,
374 const struct osd_obj_id *, u64 offset, u64 len);/* V2-only NI */
375
376void osd_req_flush_object(struct osd_request *or,
377 const struct osd_obj_id *, enum osd_options_flush_scope_values,
378 /*V2*/ u64 offset, /*V2*/ u64 len);
379
380void osd_req_read(struct osd_request *or,
381 const struct osd_obj_id *, struct bio *data_in, u64 offset);
382
383/*
384 * Root/Partition/Collection/Object Attributes commands
385 */
386
387/* get before set */
388void osd_req_get_attributes(struct osd_request *or, const struct osd_obj_id *);
389
390/* set before get */
391void osd_req_set_attributes(struct osd_request *or, const struct osd_obj_id *);
392
393/*
394 * Attributes appended to most commands
395 */
396
397/* Attributes List mode (or V2 CDB) */
398 /*
399 * TODO: In ver2 if at finalize time only one attr was set and no gets,
400 * then the Attributes CDB mode is used automatically to save IO.
401 */
402
403/* set a list of attributes. */
404int osd_req_add_set_attr_list(struct osd_request *or,
405 const struct osd_attr *, unsigned nelem);
406
407/* get a list of attributes */
408int osd_req_add_get_attr_list(struct osd_request *or,
409 const struct osd_attr *, unsigned nelem);
410
411/*
412 * Attributes list decoding
413 * Must be called after osd_request.request was executed
414 * It is called in a loop to decode the returned get_attr
415 * (see osd_add_get_attr)
416 */
417int osd_req_decode_get_attr_list(struct osd_request *or,
418 struct osd_attr *, int *nelem, void **iterator);
419
420/* Attributes Page mode */
421
422/*
423 * Read an attribute page and optionally set one attribute
424 *
425 * Retrieves the attribute page directly to a user buffer.
426 * @attr_page_data shall stay valid until end of execution.
427 * See osd_attributes.h for common page structures
428 */
429int osd_req_add_get_attr_page(struct osd_request *or,
430 u32 page_id, void *attr_page_data, unsigned max_page_len,
431 const struct osd_attr *set_one);
432
433#endif /* __OSD_LIB_H__ */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
new file mode 100644
index 000000000000..cd3cbf764650
--- /dev/null
+++ b/include/scsi/osd_protocol.h
@@ -0,0 +1,579 @@
1/*
2 * osd_protocol.h - OSD T10 standard C definitions.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 *
13 * This file contains types and constants that are defined by the protocol
14 * Note: All names and symbols are taken from the OSD standard's text.
15 */
16#ifndef __OSD_PROTOCOL_H__
17#define __OSD_PROTOCOL_H__
18
19#include <linux/types.h>
20#include <asm/unaligned.h>
21#include <scsi/scsi.h>
22
23enum {
24 OSDv1_ADDITIONAL_CDB_LENGTH = 192,
25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
26 OSDv1_CAP_LEN = 80,
27 /* Latest supported version */
28/* OSD_ADDITIONAL_CDB_LENGTH = 216,*/
29 OSD_ADDITIONAL_CDB_LENGTH =
30 OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */
31 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
32/* OSD_CAP_LEN = 104,*/
33 OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
34
35 OSD_SYSTEMID_LEN = 20,
36 OSD_CRYPTO_KEYID_SIZE = 20,
37 /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/
38 OSD_CRYPTO_SEED_SIZE = 4,
39 OSD_CRYPTO_NONCE_SIZE = 12,
40 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
41
42 OSD_PARTITION_FIRST_ID = 0x10000,
43 OSD_OBJECT_FIRST_ID = 0x10000,
44};
45
46/* (osd-r10 5.2.4)
47 * osd2r03: 5.2.3 Caching control bits
48 */
49enum osd_options_byte {
50 OSD_CDB_FUA = 0x08, /* Force Unit Access */
51 OSD_CDB_DPO = 0x10, /* Disable Page Out */
52};
53
54/*
55 * osd2r03: 5.2.5 Isolation.
56 * First 3 bits, V2-only.
57 * Also for attr 110h "default isolation method" at Root Information page
58 */
59enum osd_options_byte_isolation {
60 OSD_ISOLATION_DEFAULT = 0,
61 OSD_ISOLATION_NONE = 1,
62 OSD_ISOLATION_STRICT = 2,
63 OSD_ISOLATION_RANGE = 4,
64 OSD_ISOLATION_FUNCTIONAL = 5,
65 OSD_ISOLATION_VENDOR = 7,
66};
67
68/* (osd-r10: 6.7)
69 * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION
70 */
71enum osd_options_flush_scope_values {
72 OSD_CDB_FLUSH_ALL = 0,
73 OSD_CDB_FLUSH_ATTR_ONLY = 1,
74
75 OSD_CDB_FLUSH_ALL_RECURSIVE = 2,
76 /* V2-only */
77 OSD_CDB_FLUSH_ALL_RANGE = 2,
78};
79
80/* osd2r03: 5.2.10 Timestamps control */
81enum {
82 OSD_CDB_NORMAL_TIMESTAMPS = 0,
83 OSD_CDB_BYPASS_TIMESTAMPS = 0x7f,
84};
85
86/* (osd-r10: 5.2.2.1)
87 * osd2r03: 5.2.4.1 Get and set attributes CDB format selection
88 * 2 bits at second nibble of command_specific_options byte
89 */
90enum osd_attributes_mode {
91 /* V2-only */
92 OSD_CDB_SET_ONE_ATTR = 0x10,
93
94 OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20,
95 OSD_CDB_GET_SET_ATTR_LISTS = 0x30,
96
97 OSD_CDB_GET_SET_ATTR_MASK = 0x30,
98};
99
100/* (osd-r10: 4.12.5)
101 * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets
102 * byte offset = mantissa * (2^(exponent+8))
103 * struct {
104 * unsigned mantissa: 28;
105 * int exponent: 04;
106 * }
107 */
108typedef __be32 __bitwise osd_cdb_offset;
109
110enum {
111 OSD_OFFSET_UNUSED = 0xFFFFFFFF,
112 OSD_OFFSET_MAX_BITS = 28,
113
114 OSDv1_OFFSET_MIN_SHIFT = 8,
115 OSD_OFFSET_MIN_SHIFT = 3,
116 OSD_OFFSET_MAX_SHIFT = 16,
117};
118
119/* Return the smallest allowed encoded offset that contains @offset.
120 *
121 * The actual encoded offset returned is @offset + *padding.
122 * (up to max_shift, non-inclusive)
123 */
124osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding,
125 int min_shift, int max_shift);
126
127/* Minimum alignment is 256 bytes
128 * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive)
129 * which is 8 to 23 but IBM code restricts it to 16, so be it.
130 */
131static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding)
132{
133 return __osd_encode_offset(offset, padding,
134 OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
135}
136
137/* Minimum 8 bytes alignment
138 * Same as v1 but since exponent can be signed than a less than
139 * 256 alignment can be reached with small offsets (<2GB)
140 */
141static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding)
142{
143 return __osd_encode_offset(offset, padding,
144 OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
145}
146
147/* osd2r03: 5.2.1 Overview */
148struct osd_cdb_head {
149 struct scsi_varlen_cdb_hdr varlen_cdb;
150/*10*/ u8 options;
151 u8 command_specific_options;
152 u8 timestamp_control;
153/*13*/ u8 reserved1[3];
154/*16*/ __be64 partition;
155/*24*/ __be64 object;
156/*32*/ union { /* V1 vs V2 alignment differences */
157 struct __osdv1_cdb_addr_len {
158/*32*/ __be32 list_identifier;/* Rarely used */
159/*36*/ __be64 length;
160/*44*/ __be64 start_address;
161 } __packed v1;
162
163 struct __osdv2_cdb_addr_len {
164 /* called allocation_length in some commands */
165/*32*/ __be64 length;
166/*40*/ __be64 start_address;
167/*48*/ __be32 list_identifier;/* Rarely used */
168 } __packed v2;
169 };
170/*52*/ union { /* selected attributes mode Page/List/Single */
171 struct osd_attributes_page_mode {
172/*52*/ __be32 get_attr_page;
173/*56*/ __be32 get_attr_alloc_length;
174/*60*/ osd_cdb_offset get_attr_offset;
175
176/*64*/ __be32 set_attr_page;
177/*68*/ __be32 set_attr_id;
178/*72*/ __be32 set_attr_length;
179/*76*/ osd_cdb_offset set_attr_offset;
180/*80*/ } __packed attrs_page;
181
182 struct osd_attributes_list_mode {
183/*52*/ __be32 get_attr_desc_bytes;
184/*56*/ osd_cdb_offset get_attr_desc_offset;
185
186/*60*/ __be32 get_attr_alloc_length;
187/*64*/ osd_cdb_offset get_attr_offset;
188
189/*68*/ __be32 set_attr_bytes;
190/*72*/ osd_cdb_offset set_attr_offset;
191 __be32 not_used;
192/*80*/ } __packed attrs_list;
193
194 /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */
195 struct osd_attributes_cdb_mode {
196/*52*/ __be32 set_attr_page;
197/*56*/ __be32 set_attr_id;
198/*60*/ __be16 set_attr_len;
199/*62*/ u8 set_attr_val[18];
200/*80*/ } __packed attrs_cdb;
201/*52*/ u8 get_set_attributes_parameters[28];
202 };
203} __packed;
204/*80*/
205
206/*160 v1*/
207/*184 v2*/
208struct osd_security_parameters {
209/*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
210/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
211/*192*/osd_cdb_offset data_in_integrity_check_offset;
212/*196*/osd_cdb_offset data_out_integrity_check_offset;
213} __packed;
214/*200 v1*/
215/*224 v2*/
216
217/* FIXME: osdv2_security_parameters */
218
219struct osdv1_cdb {
220 struct osd_cdb_head h;
221 u8 caps[OSDv1_CAP_LEN];
222 struct osd_security_parameters sec_params;
223} __packed;
224
225struct osdv2_cdb {
226 struct osd_cdb_head h;
227 u8 caps[OSD_CAP_LEN];
228 struct osd_security_parameters sec_params;
229 /* FIXME: osdv2_security_parameters */
230} __packed;
231
232struct osd_cdb {
233 union {
234 struct osdv1_cdb v1;
235 struct osdv2_cdb v2;
236 u8 buff[OSD_TOTAL_CDB_LEN];
237 };
238} __packed;
239
240static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
241{
242 return (struct osd_cdb_head *)ocdb->buff;
243}
244
245/* define both version actions
246 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
247 */
248#define OSD_ACT___(Name, Num) \
249 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \
250 OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num),
251
252/* V2 only actions */
253#define OSD_ACT_V2(Name, Num) \
254 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num),
255
256#define OSD_ACT_V1_V2(Name, Num1, Num2) \
257 OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \
258 OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1),
259
260enum osd_service_actions {
261 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
262 OSD_ACT___(FORMAT_OSD, 0x01)
263 OSD_ACT___(CREATE, 0x02)
264 OSD_ACT___(LIST, 0x03)
265 OSD_ACT_V2(PUNCH, 0x04)
266 OSD_ACT___(READ, 0x05)
267 OSD_ACT___(WRITE, 0x06)
268 OSD_ACT___(APPEND, 0x07)
269 OSD_ACT___(FLUSH, 0x08)
270 OSD_ACT_V2(CLEAR, 0x09)
271 OSD_ACT___(REMOVE, 0x0A)
272 OSD_ACT___(CREATE_PARTITION, 0x0B)
273 OSD_ACT___(REMOVE_PARTITION, 0x0C)
274 OSD_ACT___(GET_ATTRIBUTES, 0x0E)
275 OSD_ACT___(SET_ATTRIBUTES, 0x0F)
276 OSD_ACT___(CREATE_AND_WRITE, 0x12)
277 OSD_ACT___(CREATE_COLLECTION, 0x15)
278 OSD_ACT___(REMOVE_COLLECTION, 0x16)
279 OSD_ACT___(LIST_COLLECTION, 0x17)
280 OSD_ACT___(SET_KEY, 0x18)
281 OSD_ACT___(SET_MASTER_KEY, 0x19)
282 OSD_ACT___(FLUSH_COLLECTION, 0x1A)
283 OSD_ACT___(FLUSH_PARTITION, 0x1B)
284 OSD_ACT___(FLUSH_OSD, 0x1C)
285
286 OSD_ACT_V2(QUERY, 0x20)
287 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
288 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
289 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
290 OSD_ACT_V2(READ_MAP, 0x31)
291
292 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
293 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
294 /* 0x8F80 to 0x8FFF are Vendor specific */
295};
296
297/* osd2r03: 7.1.3.2 List entry format for retrieving attributes */
298struct osd_attributes_list_attrid {
299 __be32 attr_page;
300 __be32 attr_id;
301} __packed;
302
303/*
304 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
305 * for setting attributes
306 * NOTE: v2 is 8-bytes aligned, v1 is not aligned.
307 */
308struct osd_attributes_list_element {
309 __be32 attr_page;
310 __be32 attr_id;
311 __be16 attr_bytes;
312 u8 attr_val[0];
313} __packed;
314
315enum {
316 OSDv1_ATTRIBUTES_ELEM_ALIGN = 1,
317 OSD_ATTRIBUTES_ELEM_ALIGN = 8,
318};
319
320enum {
321 OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF,
322 OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF,
323};
324
325static inline unsigned osdv1_attr_list_elem_size(unsigned len)
326{
327 return ALIGN(len + sizeof(struct osd_attributes_list_element),
328 OSDv1_ATTRIBUTES_ELEM_ALIGN);
329}
330
331static inline unsigned osdv2_attr_list_elem_size(unsigned len)
332{
333 return ALIGN(len + sizeof(struct osd_attributes_list_element),
334 OSD_ATTRIBUTES_ELEM_ALIGN);
335}
336
337/*
338 * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values
339 */
340enum osd_attr_list_types {
341 OSD_ATTR_LIST_GET = 0x1, /* descriptors only */
342 OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/
343 OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/
344 OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/
345};
346
347/* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */
348struct osd_attributes_list_multi_header {
349 __be64 object_id;
350 u8 object_type; /* object_type enum below */
351 u8 reserved[5];
352 __be16 list_bytes;
353 /* followed by struct osd_attributes_list_element's */
354};
355
356struct osdv1_attributes_list_header {
357 u8 type; /* low 4-bit only */
358 u8 pad;
359 __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */
360 /*
361 * type=9 followed by struct osd_attributes_list_element's
362 * type=E followed by struct osd_attributes_list_multi_header's
363 */
364} __packed;
365
366static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h)
367{
368 return be16_to_cpu(h->list_bytes);
369}
370
371struct osdv2_attributes_list_header {
372 u8 type; /* lower 4-bits only */
373 u8 pad[3];
374/*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */
375 /*
376 * type=9 followed by struct osd_attributes_list_element's
377 * type=E followed by struct osd_attributes_list_multi_header's
378 */
379} __packed;
380
381static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h)
382{
383 return be32_to_cpu(h->list_bytes);
384}
385
386/* (osd-r10 6.13)
387 * osd2r03: 6.15 LIST (Table 79) LIST command parameter data.
388 * for root_lstchg below
389 */
390enum {
391 OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */
392 OSD_OBJ_ID_LIST_LSTCHG = 0x2,
393};
394
395/*
396 * osd2r03: 6.15.2 LIST command parameter data
397 * (Also for LIST COLLECTION)
398 */
399struct osd_obj_id_list {
400 __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */
401 __be64 continuation_id;
402 __be32 list_identifier;
403 u8 pad[3];
404 u8 root_lstchg;
405 __be64 object_ids[0];
406} __packed;
407
408static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list,
409 bool *is_changed)
410{
411 *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG));
412 return 0 != list->continuation_id;
413}
414
415/*
416 * osd2r03: 4.12.4.5 The ALLDATA security method
417 */
418struct osd_data_out_integrity_info {
419 __be64 data_bytes;
420 __be64 set_attributes_bytes;
421 __be64 get_attributes_bytes;
422 __be64 integrity_check_value;
423} __packed;
424
425struct osd_data_in_integrity_info {
426 __be64 data_bytes;
427 __be64 retrieved_attributes_bytes;
428 __be64 integrity_check_value;
429} __packed;
430
431struct osd_timestamp {
432 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
433} __packed;
434/* FIXME: define helper functions to convert to/from osd time format */
435
436/*
437 * Capability & Security definitions
438 * osd2r03: 4.11.2.2 Capability format
439 * osd2r03: 5.2.8 Security parameters
440 */
441
442struct osd_key_identifier {
443 u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */
444} __packed;
445
446/* for osd_capability.format */
447enum {
448 OSD_SEC_CAP_FORMAT_NO_CAPS = 0,
449 OSD_SEC_CAP_FORMAT_VER1 = 1,
450 OSD_SEC_CAP_FORMAT_VER2 = 2,
451};
452
453/* security_method */
454enum {
455 OSD_SEC_NOSEC = 0,
456 OSD_SEC_CAPKEY = 1,
457 OSD_SEC_CMDRSP = 2,
458 OSD_SEC_ALLDATA = 3,
459};
460
461enum object_type {
462 OSD_SEC_OBJ_ROOT = 0x1,
463 OSD_SEC_OBJ_PARTITION = 0x2,
464 OSD_SEC_OBJ_COLLECTION = 0x40,
465 OSD_SEC_OBJ_USER = 0x80,
466};
467
468enum osd_capability_bit_masks {
469 OSD_SEC_CAP_APPEND = BIT(0),
470 OSD_SEC_CAP_OBJ_MGMT = BIT(1),
471 OSD_SEC_CAP_REMOVE = BIT(2),
472 OSD_SEC_CAP_CREATE = BIT(3),
473 OSD_SEC_CAP_SET_ATTR = BIT(4),
474 OSD_SEC_CAP_GET_ATTR = BIT(5),
475 OSD_SEC_CAP_WRITE = BIT(6),
476 OSD_SEC_CAP_READ = BIT(7),
477
478 OSD_SEC_CAP_NONE1 = BIT(8),
479 OSD_SEC_CAP_NONE2 = BIT(9),
480 OSD_SEC_CAP_NONE3 = BIT(10),
481 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
482 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
483 OSD_SEC_CAP_POL_SEC = BIT(13),
484 OSD_SEC_CAP_GLOBAL = BIT(14),
485 OSD_SEC_CAP_DEV_MGMT = BIT(15),
486};
487
488/* for object_descriptor_type (hi nibble used) */
489enum {
490 OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */
491 OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */
492 OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */
493 OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */
494};
495
496/* (osd-r10:4.9.2.2)
497 * osd2r03:4.11.2.2 Capability format
498 */
499struct osd_capability_head {
500 u8 format; /* low nibble */
501 u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */
502 u8 security_method;
503 u8 reserved1;
504/*04*/ struct osd_timestamp expiration_time;
505/*10*/ u8 audit[20];
506/*30*/ u8 discriminator[12];
507/*42*/ struct osd_timestamp object_created_time;
508/*48*/ u8 object_type;
509/*49*/ u8 permissions_bit_mask[5];
510/*54*/ u8 reserved2;
511/*55*/ u8 object_descriptor_type; /* high nibble */
512} __packed;
513
514/*56 v1*/
515struct osdv1_cap_object_descriptor {
516 union {
517 struct {
518/*56*/ __be32 policy_access_tag;
519/*60*/ __be64 allowed_partition_id;
520/*68*/ __be64 allowed_object_id;
521/*76*/ __be32 reserved;
522 } __packed obj_desc;
523
524/*56*/ u8 object_descriptor[24];
525 };
526} __packed;
527/*80 v1*/
528
529/*56 v2*/
530struct osd_cap_object_descriptor {
531 union {
532 struct {
533/*56*/ __be32 allowed_attributes_access;
534/*60*/ __be32 policy_access_tag;
535/*64*/ __be16 boot_epoch;
536/*66*/ u8 reserved[6];
537/*72*/ __be64 allowed_partition_id;
538/*80*/ __be64 allowed_object_id;
539/*88*/ __be64 allowed_range_length;
540/*96*/ __be64 allowed_range_start;
541 } __packed obj_desc;
542
543/*56*/ u8 object_descriptor[48];
544 };
545} __packed;
546/*104 v2*/
547
548struct osdv1_capability {
549 struct osd_capability_head h;
550 struct osdv1_cap_object_descriptor od;
551} __packed;
552
553struct osd_capability {
554 struct osd_capability_head h;
555/* struct osd_cap_object_descriptor od;*/
556 struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */
557} __packed;
558
559/**
560 * osd_sec_set_caps - set cap-bits into the capabilities header
561 *
562 * @cap: The osd_capability_head to set cap bits to.
563 * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values
564 *
565 * permissions_bit_mask is unaligned use below to set into caps
566 * in a version independent way
567 */
568static inline void osd_sec_set_caps(struct osd_capability_head *cap,
569 u16 bit_mask)
570{
571 /*
572 *Note: The bits above are defined LE order this is because this way
573 * they can grow in the future to more then 16, and still retain
574 * there constant values.
575 */
576 put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
577}
578
579#endif /* ndef __OSD_PROTOCOL_H__ */
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
new file mode 100644
index 000000000000..4c09fee8ae1e
--- /dev/null
+++ b/include/scsi/osd_sec.h
@@ -0,0 +1,45 @@
1/*
2 * osd_sec.h - OSD security manager API
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 *
13 */
14#ifndef __OSD_SEC_H__
15#define __OSD_SEC_H__
16
17#include "osd_protocol.h"
18#include "osd_types.h"
19
20/*
21 * Contains types and constants of osd capabilities and security
22 * encoding/decoding.
23 * API is trying to keep security abstract so initiator of an object
24 * based pNFS client knows as little as possible about security and
25 * capabilities. It is the Server's osd-initiator place to know more.
26 * Also can be used by osd-target.
27 */
28void osd_sec_encode_caps(void *caps, ...);/* NI */
29void osd_sec_init_nosec_doall_caps(void *caps,
30 const struct osd_obj_id *obj, bool is_collection, const bool is_v1);
31
32bool osd_is_sec_alldata(struct osd_security_parameters *sec_params);
33
34/* Conditionally sign the CDB according to security setting in ocdb
35 * with cap_key */
36void osd_sec_sign_cdb(struct osd_cdb *ocdb, const u8 *cap_key);
37
38/* Unconditionally sign the BIO data with cap_key.
39 * Check for osd_is_sec_alldata() was done prior to calling this. */
40void osd_sec_sign_data(void *data_integ, struct bio *bio, const u8 *cap_key);
41
42/* Version independent copy of caps into the cdb */
43void osd_set_caps(struct osd_cdb *cdb, const void *caps);
44
45#endif /* ndef __OSD_SEC_H__ */
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
new file mode 100644
index 000000000000..ff9b33c773c7
--- /dev/null
+++ b/include/scsi/osd_sense.h
@@ -0,0 +1,260 @@
1/*
2 * osd_sense.h - OSD Related sense handling definitions.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 *
13 * This file contains types and constants that are defined by the protocol
14 * Note: All names and symbols are taken from the OSD standard's text.
15 */
16#ifndef __OSD_SENSE_H__
17#define __OSD_SENSE_H__
18
19#include <scsi/osd_protocol.h>
20
21/* SPC3r23 4.5.6 Sense key and sense code definitions table 27 */
22enum scsi_sense_keys {
23 scsi_sk_no_sense = 0x0,
24 scsi_sk_recovered_error = 0x1,
25 scsi_sk_not_ready = 0x2,
26 scsi_sk_medium_error = 0x3,
27 scsi_sk_hardware_error = 0x4,
28 scsi_sk_illegal_request = 0x5,
29 scsi_sk_unit_attention = 0x6,
30 scsi_sk_data_protect = 0x7,
31 scsi_sk_blank_check = 0x8,
32 scsi_sk_vendor_specific = 0x9,
33 scsi_sk_copy_aborted = 0xa,
34 scsi_sk_aborted_command = 0xb,
35 scsi_sk_volume_overflow = 0xd,
36 scsi_sk_miscompare = 0xe,
37 scsi_sk_reserved = 0xf,
38};
39
40/* SPC3r23 4.5.6 Sense key and sense code definitions table 28 */
41/* Note: only those which can be returned by an OSD target. Most of
42 * these errors are taken care of by the generic scsi layer.
43 */
44enum osd_additional_sense_codes {
45 scsi_no_additional_sense_information = 0x0000,
46 scsi_operation_in_progress = 0x0016,
47 scsi_cleaning_requested = 0x0017,
48 scsi_lunr_cause_not_reportable = 0x0400,
49 scsi_logical_unit_is_in_process_of_becoming_ready = 0x0401,
50 scsi_lunr_initializing_command_required = 0x0402,
51 scsi_lunr_manual_intervention_required = 0x0403,
52 scsi_lunr_operation_in_progress = 0x0407,
53 scsi_lunr_selftest_in_progress = 0x0409,
54 scsi_luna_asymmetric_access_state_transition = 0x040a,
55 scsi_luna_target_port_in_standby_state = 0x040b,
56 scsi_luna_target_port_in_unavailable_state = 0x040c,
57 scsi_lunr_notify_enable_spinup_required = 0x0411,
58 scsi_logical_unit_does_not_respond_to_selection = 0x0500,
59 scsi_logical_unit_communication_failure = 0x0800,
60 scsi_logical_unit_communication_timeout = 0x0801,
61 scsi_logical_unit_communication_parity_error = 0x0802,
62 scsi_error_log_overflow = 0x0a00,
63 scsi_warning = 0x0b00,
64 scsi_warning_specified_temperature_exceeded = 0x0b01,
65 scsi_warning_enclosure_degraded = 0x0b02,
66 scsi_write_error_unexpected_unsolicited_data = 0x0c0c,
67 scsi_write_error_not_enough_unsolicited_data = 0x0c0d,
68 scsi_invalid_information_unit = 0x0e00,
69 scsi_invalid_field_in_command_information_unit = 0x0e03,
70 scsi_read_error_failed_retransmission_request = 0x1113,
71 scsi_parameter_list_length_error = 0x1a00,
72 scsi_invalid_command_operation_code = 0x2000,
73 scsi_invalid_field_in_cdb = 0x2400,
74 osd_security_audit_value_frozen = 0x2404,
75 osd_security_working_key_frozen = 0x2405,
76 osd_nonce_not_unique = 0x2406,
77 osd_nonce_timestamp_out_of_range = 0x2407,
78 scsi_logical_unit_not_supported = 0x2500,
79 scsi_invalid_field_in_parameter_list = 0x2600,
80 scsi_parameter_not_supported = 0x2601,
81 scsi_parameter_value_invalid = 0x2602,
82 scsi_invalid_release_of_persistent_reservation = 0x2604,
83 osd_invalid_dataout_buffer_integrity_check_value = 0x260f,
84 scsi_not_ready_to_ready_change_medium_may_have_changed = 0x2800,
85 scsi_power_on_reset_or_bus_device_reset_occurred = 0x2900,
86 scsi_power_on_occurred = 0x2901,
87 scsi_scsi_bus_reset_occurred = 0x2902,
88 scsi_bus_device_reset_function_occurred = 0x2903,
89 scsi_device_internal_reset = 0x2904,
90 scsi_transceiver_mode_changed_to_single_ended = 0x2905,
91 scsi_transceiver_mode_changed_to_lvd = 0x2906,
92 scsi_i_t_nexus_loss_occurred = 0x2907,
93 scsi_parameters_changed = 0x2a00,
94 scsi_mode_parameters_changed = 0x2a01,
95 scsi_asymmetric_access_state_changed = 0x2a06,
96 scsi_priority_changed = 0x2a08,
97 scsi_command_sequence_error = 0x2c00,
98 scsi_previous_busy_status = 0x2c07,
99 scsi_previous_task_set_full_status = 0x2c08,
100 scsi_previous_reservation_conflict_status = 0x2c09,
101 osd_partition_or_collection_contains_user_objects = 0x2c0a,
102 scsi_commands_cleared_by_another_initiator = 0x2f00,
103 scsi_cleaning_failure = 0x3007,
104 scsi_enclosure_failure = 0x3400,
105 scsi_enclosure_services_failure = 0x3500,
106 scsi_unsupported_enclosure_function = 0x3501,
107 scsi_enclosure_services_unavailable = 0x3502,
108 scsi_enclosure_services_transfer_failure = 0x3503,
109 scsi_enclosure_services_transfer_refused = 0x3504,
110 scsi_enclosure_services_checksum_error = 0x3505,
111 scsi_rounded_parameter = 0x3700,
112 osd_read_past_end_of_user_object = 0x3b17,
113 scsi_logical_unit_has_not_self_configured_yet = 0x3e00,
114 scsi_logical_unit_failure = 0x3e01,
115 scsi_timeout_on_logical_unit = 0x3e02,
116 scsi_logical_unit_failed_selftest = 0x3e03,
117 scsi_logical_unit_unable_to_update_selftest_log = 0x3e04,
118 scsi_target_operating_conditions_have_changed = 0x3f00,
119 scsi_microcode_has_been_changed = 0x3f01,
120 scsi_inquiry_data_has_changed = 0x3f03,
121 scsi_echo_buffer_overwritten = 0x3f0f,
122 scsi_diagnostic_failure_on_component_nn_first = 0x4080,
123 scsi_diagnostic_failure_on_component_nn_last = 0x40ff,
124 scsi_message_error = 0x4300,
125 scsi_internal_target_failure = 0x4400,
126 scsi_select_or_reselect_failure = 0x4500,
127 scsi_scsi_parity_error = 0x4700,
128 scsi_data_phase_crc_error_detected = 0x4701,
129 scsi_scsi_parity_error_detected_during_st_data_phase = 0x4702,
130 scsi_asynchronous_information_protection_error_detected = 0x4704,
131 scsi_protocol_service_crc_error = 0x4705,
132 scsi_phy_test_function_in_progress = 0x4706,
133 scsi_invalid_message_error = 0x4900,
134 scsi_command_phase_error = 0x4a00,
135 scsi_data_phase_error = 0x4b00,
136 scsi_logical_unit_failed_self_configuration = 0x4c00,
137 scsi_overlapped_commands_attempted = 0x4e00,
138 osd_quota_error = 0x5507,
139 scsi_failure_prediction_threshold_exceeded = 0x5d00,
140 scsi_failure_prediction_threshold_exceeded_false = 0x5dff,
141 scsi_voltage_fault = 0x6500,
142};
143
144enum scsi_descriptor_types {
145 scsi_sense_information = 0x0,
146 scsi_sense_command_specific_information = 0x1,
147 scsi_sense_key_specific = 0x2,
148 scsi_sense_field_replaceable_unit = 0x3,
149 scsi_sense_stream_commands = 0x4,
150 scsi_sense_block_commands = 0x5,
151 osd_sense_object_identification = 0x6,
152 osd_sense_response_integrity_check = 0x7,
153 osd_sense_attribute_identification = 0x8,
154 scsi_sense_ata_return = 0x9,
155
156 scsi_sense_Reserved_first = 0x0A,
157 scsi_sense_Reserved_last = 0x7F,
158 scsi_sense_Vendor_specific_first = 0x80,
159 scsi_sense_Vendor_specific_last = 0xFF,
160};
161
162struct scsi_sense_descriptor { /* for picking into desc type */
163 u8 descriptor_type; /* one of enum scsi_descriptor_types */
164 u8 additional_length; /* n - 1 */
165 u8 data[];
166} __packed;
167
168/* OSD deploys only scsi descriptor_based sense buffers */
169struct scsi_sense_descriptor_based {
170/*0*/ u8 response_code; /* 0x72 or 0x73 */
171/*1*/ u8 sense_key; /* one of enum scsi_sense_keys (4 lower bits) */
172/*2*/ __be16 additional_sense_code; /* enum osd_additional_sense_codes */
173/*4*/ u8 Reserved[3];
174/*7*/ u8 additional_sense_length; /* n - 7 */
175/*8*/ struct scsi_sense_descriptor ssd[0]; /* variable length, 1 or more */
176} __packed;
177
178/* some descriptors deployed by OSD */
179
180/* SPC3r23 4.5.2.3 Command-specific information sense data descriptor */
181/* Note: this is the same for descriptor_type=00 but with type=00 the
182 * Reserved[0] == 0x80 (ie. bit-7 set)
183 */
184struct scsi_sense_command_specific_data_descriptor {
185/*0*/ u8 descriptor_type; /* (00h/01h) */
186/*1*/ u8 additional_length; /* (0Ah) */
187/*2*/ u8 Reserved[2];
188/*4*/ __be64 information;
189} __packed;
190/*12*/
191
192struct scsi_sense_key_specific_data_descriptor {
193/*0*/ u8 descriptor_type; /* (02h) */
194/*1*/ u8 additional_length; /* (06h) */
195/*2*/ u8 Reserved[2];
196/* SKSV, C/D, Reserved (2), BPV, BIT POINTER (3) */
197/*4*/ u8 sksv_cd_bpv_bp;
198/*5*/ __be16 value; /* field-pointer/progress-value/retry-count/... */
199/*7*/ u8 Reserved2;
200} __packed;
201/*8*/
202
203/* 4.16.2.1 OSD error identification sense data descriptor - table 52 */
204/* Note: these bits are defined LE order for easy definition, this way the BIT()
205 * number is the same as in the documentation. Below members at
206 * osd_sense_identification_data_descriptor are therefore defined __le32.
207 */
208enum osd_command_functions_bits {
209 OSD_CFB_COMMAND = BIT(4),
210 OSD_CFB_CMD_CAP_VERIFIED = BIT(5),
211 OSD_CFB_VALIDATION = BIT(7),
212 OSD_CFB_IMP_ST_ATT = BIT(12),
213 OSD_CFB_SET_ATT = BIT(20),
214 OSD_CFB_SA_CAP_VERIFIED = BIT(21),
215 OSD_CFB_GET_ATT = BIT(28),
216 OSD_CFB_GA_CAP_VERIFIED = BIT(29),
217};
218
219struct osd_sense_identification_data_descriptor {
220/*0*/ u8 descriptor_type; /* (06h) */
221/*1*/ u8 additional_length; /* (1Eh) */
222/*2*/ u8 Reserved[6];
223/*8*/ __le32 not_initiated_functions; /*osd_command_functions_bits*/
224/*12*/ __le32 completed_functions; /*osd_command_functions_bits*/
225/*16*/ __be64 partition_id;
226/*24*/ __be64 object_id;
227} __packed;
228/*32*/
229
230struct osd_sense_response_integrity_check_descriptor {
231/*0*/ u8 descriptor_type; /* (07h) */
232/*1*/ u8 additional_length; /* (20h) */
233/*2*/ u8 integrity_check_value[32]; /*FIXME: OSDv2_CRYPTO_KEYID_SIZE*/
234} __packed;
235/*34*/
236
237struct osd_sense_attributes_data_descriptor {
238/*0*/ u8 descriptor_type; /* (08h) */
239/*1*/ u8 additional_length; /* (n-2) */
240/*2*/ u8 Reserved[6];
241 struct osd_sense_attr {
242/*8*/ __be32 attr_page;
243/*12*/ __be32 attr_id;
244/*16*/ } sense_attrs[0]; /* 1 or more */
245} __packed;
246/*variable*/
247
248/* Dig into scsi_sk_illegal_request/scsi_invalid_field_in_cdb errors */
249
250/*FIXME: Support also field in CAPS*/
251#define OSD_CDB_OFFSET(F) offsetof(struct osd_cdb_head, F)
252
253enum osdv2_cdb_field_offset {
254 OSDv1_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v1.start_address),
255 OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address),
256 OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition),
257 OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object),
258};
259
260#endif /* ndef __OSD_SENSE_H__ */
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
new file mode 100644
index 000000000000..3f5e88cc75c0
--- /dev/null
+++ b/include/scsi/osd_types.h
@@ -0,0 +1,40 @@
1/*
2 * osd_types.h - Types and constants which are not part of the protocol.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 *
13 * Contains types and constants that are implementation specific and are
14 * used by more than one part of the osd library.
15 * (Eg initiator/target/security_manager/...)
16 */
17#ifndef __OSD_TYPES_H__
18#define __OSD_TYPES_H__
19
20struct osd_systemid {
21 u8 data[OSD_SYSTEMID_LEN];
22};
23
24typedef u64 __bitwise osd_id;
25
26struct osd_obj_id {
27 osd_id partition;
28 osd_id id;
29};
30
31static const struct __weak osd_obj_id osd_root_object = {0, 0};
32
33struct osd_attr {
34 u32 attr_page;
35 u32 attr_id;
36 u16 len; /* byte count of operand */
37 void *val_ptr; /* in network order */
38};
39
40#endif /* ndef __OSD_TYPES_H__ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index a109165714d6..084478e14d24 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -9,7 +9,8 @@
9#define _SCSI_SCSI_H 9#define _SCSI_SCSI_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <scsi/scsi_cmnd.h> 12
13struct scsi_cmnd;
13 14
14/* 15/*
15 * The maximum number of SG segments that we will put inside a 16 * The maximum number of SG segments that we will put inside a
@@ -263,6 +264,7 @@ static inline int scsi_status_is_good(int status)
263#define TYPE_RAID 0x0c 264#define TYPE_RAID 0x0c
264#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ 265#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
265#define TYPE_RBC 0x0e 266#define TYPE_RBC 0x0e
267#define TYPE_OSD 0x11
266#define TYPE_NO_LUN 0x7f 268#define TYPE_NO_LUN 0x7f
267 269
268/* SCSI protocols; these are taken from SPC-3 section 7.5 */ 270/* SCSI protocols; these are taken from SPC-3 section 7.5 */
@@ -402,16 +404,6 @@ static inline int scsi_is_wlun(unsigned int lun)
402#define DRIVER_HARD 0x07 404#define DRIVER_HARD 0x07
403#define DRIVER_SENSE 0x08 405#define DRIVER_SENSE 0x08
404 406
405#define SUGGEST_RETRY 0x10
406#define SUGGEST_ABORT 0x20
407#define SUGGEST_REMAP 0x30
408#define SUGGEST_DIE 0x40
409#define SUGGEST_SENSE 0x80
410#define SUGGEST_IS_OK 0xff
411
412#define DRIVER_MASK 0x0f
413#define SUGGEST_MASK 0xf0
414
415/* 407/*
416 * Internal return values. 408 * Internal return values.
417 */ 409 */
@@ -447,23 +439,6 @@ static inline int scsi_is_wlun(unsigned int lun)
447#define msg_byte(result) (((result) >> 8) & 0xff) 439#define msg_byte(result) (((result) >> 8) & 0xff)
448#define host_byte(result) (((result) >> 16) & 0xff) 440#define host_byte(result) (((result) >> 16) & 0xff)
449#define driver_byte(result) (((result) >> 24) & 0xff) 441#define driver_byte(result) (((result) >> 24) & 0xff)
450#define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
451
452static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
453{
454 cmd->result |= status << 8;
455}
456
457static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
458{
459 cmd->result |= status << 16;
460}
461
462static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
463{
464 cmd->result |= status << 24;
465}
466
467 442
468#define sense_class(sense) (((sense) >> 4) & 0x7) 443#define sense_class(sense) (((sense) >> 4) & 0x7)
469#define sense_error(sense) ((sense) & 0xf) 444#define sense_error(sense) ((sense) & 0xf)
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 855bf95963e7..43b50d36925c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -291,4 +291,19 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)
291#define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ 291#define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \
292 for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) 292 for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i)
293 293
294static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
295{
296 cmd->result |= status << 8;
297}
298
299static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
300{
301 cmd->result |= status << 16;
302}
303
304static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
305{
306 cmd->result |= status << 24;
307}
308
294#endif /* _SCSI_SCSI_CMND_H */ 309#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 01a4c58f8bad..3f566af3f101 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -340,6 +340,7 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
340 struct scsi_sense_hdr *); 340 struct scsi_sense_hdr *);
341extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 341extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
342 int retries, struct scsi_sense_hdr *sshdr); 342 int retries, struct scsi_sense_hdr *sshdr);
343extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page);
343extern int scsi_device_set_state(struct scsi_device *sdev, 344extern int scsi_device_set_state(struct scsi_device *sdev,
344 enum scsi_device_state state); 345 enum scsi_device_state state);
345extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, 346extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
@@ -370,12 +371,6 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
370 int data_direction, void *buffer, unsigned bufflen, 371 int data_direction, void *buffer, unsigned bufflen,
371 struct scsi_sense_hdr *, int timeout, int retries, 372 struct scsi_sense_hdr *, int timeout, int retries,
372 int *resid); 373 int *resid);
373extern int scsi_execute_async(struct scsi_device *sdev,
374 const unsigned char *cmd, int cmd_len, int data_direction,
375 void *buffer, unsigned bufflen, int use_sg,
376 int timeout, int retries, void *privdata,
377 void (*done)(void *, char *, int, int),
378 gfp_t gfp);
379 374
380static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) 375static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
381{ 376{
@@ -400,7 +395,8 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
400 */ 395 */
401static inline int scsi_device_online(struct scsi_device *sdev) 396static inline int scsi_device_online(struct scsi_device *sdev)
402{ 397{
403 return sdev->sdev_state != SDEV_OFFLINE; 398 return (sdev->sdev_state != SDEV_OFFLINE &&
399 sdev->sdev_state != SDEV_DEL);
404} 400}
405static inline int scsi_device_blocked(struct scsi_device *sdev) 401static inline int scsi_device_blocked(struct scsi_device *sdev)
406{ 402{
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b50aabe2861e..457588e1119b 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -88,7 +88,7 @@ struct iscsi_transport {
88 uint64_t host_param_mask; 88 uint64_t host_param_mask;
89 struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, 89 struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep,
90 uint16_t cmds_max, uint16_t qdepth, 90 uint16_t cmds_max, uint16_t qdepth,
91 uint32_t sn, uint32_t *hn); 91 uint32_t sn);
92 void (*destroy_session) (struct iscsi_cls_session *session); 92 void (*destroy_session) (struct iscsi_cls_session *session);
93 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, 93 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
94 uint32_t cid); 94 uint32_t cid);
@@ -206,8 +206,6 @@ struct iscsi_cls_session {
206struct iscsi_cls_host { 206struct iscsi_cls_host {
207 atomic_t nr_scans; 207 atomic_t nr_scans;
208 struct mutex mutex; 208 struct mutex mutex;
209 struct workqueue_struct *scan_workq;
210 char scan_workq_name[20];
211}; 209};
212 210
213extern void iscsi_host_for_each_session(struct Scsi_Host *shost, 211extern void iscsi_host_for_each_session(struct Scsi_Host *shost,
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index b3aa62ee3c8d..d010858c33c2 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -169,5 +169,7 @@ extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
169 169
170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); 170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); 171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
172extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
173 struct snd_timer **rtimer);
172 174
173#endif /* __SOUND_AD1816A_H */ 175#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 1c02ed1d7c4a..6add80fc2512 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -23,9 +23,10 @@
23#ifndef __SOUND_ASOUND_H 23#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H
25 25
26#include <linux/types.h>
27
26#ifdef __KERNEL__ 28#ifdef __KERNEL__
27#include <linux/ioctl.h> 29#include <linux/ioctl.h>
28#include <linux/types.h>
29#include <linux/time.h> 30#include <linux/time.h>
30#include <asm/byteorder.h> 31#include <asm/byteorder.h>
31 32
@@ -126,12 +127,10 @@ struct snd_hwdep_dsp_image {
126 unsigned long driver_data; /* W: driver-specific data */ 127 unsigned long driver_data; /* W: driver-specific data */
127}; 128};
128 129
129enum { 130#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
130 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 131#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
131 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info), 132#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
132 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status), 133#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
133 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
134};
135 134
136/***************************************************************************** 135/*****************************************************************************
137 * * 136 * *
@@ -342,7 +341,7 @@ struct snd_interval {
342#define SNDRV_MASK_MAX 256 341#define SNDRV_MASK_MAX 256
343 342
344struct snd_mask { 343struct snd_mask {
345 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 344 __u32 bits[(SNDRV_MASK_MAX+31)/32];
346}; 345};
347 346
348struct snd_pcm_hw_params { 347struct snd_pcm_hw_params {
@@ -385,7 +384,7 @@ struct snd_pcm_sw_params {
385 384
386struct snd_pcm_channel_info { 385struct snd_pcm_channel_info {
387 unsigned int channel; 386 unsigned int channel;
388 off_t offset; /* mmap offset */ 387 __kernel_off_t offset; /* mmap offset */
389 unsigned int first; /* offset to first sample in bits */ 388 unsigned int first; /* offset to first sample in bits */
390 unsigned int step; /* samples distance in bits */ 389 unsigned int step; /* samples distance in bits */
391}; 390};
@@ -451,40 +450,35 @@ enum {
451 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 450 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
452}; 451};
453 452
454enum { 453#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
455 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 454#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
456 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), 455#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
457 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 456#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
458 SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int), 457#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
459 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), 458#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
460 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), 459#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
461 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 460#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
462 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params), 461#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
463 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status), 462#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
464 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t), 463#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
465 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 464#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
466 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr), 465#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
467 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info), 466#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
468 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 467#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
469 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 468#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
470 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 469#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
471 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 470#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
472 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 471#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
473 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 472#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
474 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t), 473#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
475 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 474#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
476 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 475#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
477 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t), 476#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
478 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi), 477#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
479 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi), 478#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
480 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern), 479#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
481 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern), 480#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
482 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 481#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
483 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
484};
485
486/* Trick to make alsa-lib/acinclude.m4 happy */
487#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
488 482
489/***************************************************************************** 483/*****************************************************************************
490 * * 484 * *
@@ -538,14 +532,12 @@ struct snd_rawmidi_status {
538 unsigned char reserved[16]; /* reserved for future use */ 532 unsigned char reserved[16]; /* reserved for future use */
539}; 533};
540 534
541enum { 535#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
542 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 536#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
543 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info), 537#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
544 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params), 538#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
545 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status), 539#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
546 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 540#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
547 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
548};
549 541
550/* 542/*
551 * Timer section - /dev/snd/timer 543 * Timer section - /dev/snd/timer
@@ -654,23 +646,21 @@ struct snd_timer_status {
654 unsigned char reserved[64]; /* reserved */ 646 unsigned char reserved[64]; /* reserved */
655}; 647};
656 648
657enum { 649#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
658 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 650#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
659 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id), 651#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
660 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 652#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
661 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo), 653#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
662 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams), 654#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
663 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus), 655#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
664 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select), 656#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
665 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info), 657#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
666 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params), 658#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
667 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status), 659/* The following four ioctls are changed since 1.0.9 due to confliction */
668 /* The following four ioctls are changed since 1.0.9 due to confliction */ 660#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
669 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 661#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
670 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 662#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
671 SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2), 663#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
672 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
673};
674 664
675struct snd_timer_read { 665struct snd_timer_read {
676 unsigned int resolution; 666 unsigned int resolution;
@@ -789,7 +779,7 @@ struct snd_ctl_elem_info {
789 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 779 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
790 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 780 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
791 unsigned int count; /* count of values */ 781 unsigned int count; /* count of values */
792 pid_t owner; /* owner's PID of this control */ 782 __kernel_pid_t owner; /* owner's PID of this control */
793 union { 783 union {
794 struct { 784 struct {
795 long min; /* R: minimum value */ 785 long min; /* R: minimum value */
@@ -847,33 +837,31 @@ struct snd_ctl_tlv {
847 unsigned int tlv[0]; /* first TLV */ 837 unsigned int tlv[0]; /* first TLV */
848}; 838};
849 839
850enum { 840#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
851 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 841#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
852 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), 842#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
853 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list), 843#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
854 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info), 844#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
855 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value), 845#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
856 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value), 846#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
857 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id), 847#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
858 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id), 848#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
859 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 849#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
860 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), 850#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
861 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), 851#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
862 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), 852#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
863 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv), 853#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
864 SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv), 854#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
865 SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv), 855#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
866 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 856#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
867 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), 857#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
868 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 858#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
869 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info), 859#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
870 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 860#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
871 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 861#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
872 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info), 862#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
873 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 863#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
874 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 864#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
875 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
876};
877 865
878/* 866/*
879 * Read interface. 867 * Read interface.
@@ -919,18 +907,4 @@ struct snd_ctl_event {
919#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" 907#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
920#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what 908#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
921 909
922/*
923 *
924 */
925
926struct snd_xferv {
927 const struct iovec *vector;
928 unsigned long count;
929};
930
931enum {
932 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
933 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
934};
935
936#endif /* __SOUND_ASOUND_H */ 910#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/atmel-abdac.h b/include/sound/atmel-abdac.h
new file mode 100644
index 000000000000..edff6a8ba1b5
--- /dev/null
+++ b/include/sound/atmel-abdac.h
@@ -0,0 +1,23 @@
1/*
2 * Driver for the Atmel Audio Bitstream DAC (ABDAC)
3 *
4 * Copyright (C) 2009 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H
11#define __INCLUDE_SOUND_ATMEL_ABDAC_H
12
13#include <linux/dw_dmac.h>
14
15/**
16 * struct atmel_abdac_pdata - board specific ABDAC configuration
17 * @dws: DMA slave interface to use for sound playback.
18 */
19struct atmel_abdac_pdata {
20 struct dw_dma_slave dws;
21};
22
23#endif /* __INCLUDE_SOUND_ATMEL_ABDAC_H */
diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
new file mode 100644
index 000000000000..e6aabdb45865
--- /dev/null
+++ b/include/sound/atmel-ac97c.h
@@ -0,0 +1,40 @@
1/*
2 * Driver for the Atmel AC97C controller
3 *
4 * Copyright (C) 2005-2009 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H
11#define __INCLUDE_SOUND_ATMEL_AC97C_H
12
13#include <linux/dw_dmac.h>
14
15#define AC97C_CAPTURE 0x01
16#define AC97C_PLAYBACK 0x02
17#define AC97C_BOTH (AC97C_CAPTURE | AC97C_PLAYBACK)
18
19/**
20 * struct atmel_ac97c_pdata - board specific AC97C configuration
21 * @rx_dws: DMA slave interface to use for sound capture.
22 * @tx_dws: DMA slave interface to use for sound playback.
23 * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
24 * optional to use, set to -ENODEV if not in use. AC97 layer will
25 * try to do a software reset of the external codec anyway.
26 * @flags: Flags for which directions should be enabled.
27 *
28 * If the user do not want to use a DMA channel for playback or capture, i.e.
29 * only one feature is required on the board. The slave for playback or capture
30 * can be set to NULL. The AC97C driver will take use of this when setting up
31 * the sound streams.
32 */
33struct ac97c_platform_data {
34 struct dw_dma_slave rx_dws;
35 struct dw_dma_slave tx_dws;
36 unsigned int flags;
37 int reset_pin;
38};
39
40#endif /* __INCLUDE_SOUND_ATMEL_AC97C_H */
diff --git a/include/sound/control.h b/include/sound/control.h
index 4721b4bba053..ef96f07aa03b 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -171,6 +171,54 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
171 */ 171 */
172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, 172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
173 const unsigned int *tlv); 173 const unsigned int *tlv);
174int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); 174int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
175 175 unsigned int flags);
176/* optional flags for slave */
177#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0)
178
179/**
180 * snd_ctl_add_slave - Add a virtual slave control
181 * @master: vmaster element
182 * @slave: slave element to add
183 *
184 * Add a virtual slave control to the given master element created via
185 * snd_ctl_create_virtual_master() beforehand.
186 * Returns zero if successful or a negative error code.
187 *
188 * All slaves must be the same type (returning the same information
189 * via info callback). The fucntion doesn't check it, so it's your
190 * responsibility.
191 *
192 * Also, some additional limitations:
193 * at most two channels,
194 * logarithmic volume control (dB level) thus no linear volume,
195 * master can only attenuate the volume without gain
196 */
197static inline int
198snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
199{
200 return _snd_ctl_add_slave(master, slave, 0);
201}
202
203/**
204 * snd_ctl_add_slave_uncached - Add a virtual slave control
205 * @master: vmaster element
206 * @slave: slave element to add
207 *
208 * Add a virtual slave control to the given master.
209 * Unlike snd_ctl_add_slave(), the element added via this function
210 * is supposed to have volatile values, and get callback is called
211 * at each time quried from the master.
212 *
213 * When the control peeks the hardware values directly and the value
214 * can be changed by other means than the put callback of the element,
215 * this function should be used to keep the value always up-to-date.
216 */
217static inline int
218snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
219 struct snd_kcontrol *slave)
220{
221 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
222}
223
176#endif /* __SOUND_CONTROL_H */ 224#endif /* __SOUND_CONTROL_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index f632484bc743..3dea79829acc 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -97,9 +97,9 @@ struct snd_device {
97 97
98struct snd_monitor_file { 98struct snd_monitor_file {
99 struct file *file; 99 struct file *file;
100 struct snd_monitor_file *next;
101 const struct file_operations *disconnected_f_op; 100 const struct file_operations *disconnected_f_op;
102 struct list_head shutdown_list; 101 struct list_head shutdown_list; /* still need to shutdown */
102 struct list_head list; /* link of monitor files */
103}; 103};
104 104
105/* main structure for soundcard */ 105/* main structure for soundcard */
@@ -134,7 +134,7 @@ struct snd_card {
134 struct snd_info_entry *proc_id; /* the card id */ 134 struct snd_info_entry *proc_id; /* the card id */
135 struct proc_dir_entry *proc_root_link; /* number link to real id */ 135 struct proc_dir_entry *proc_root_link; /* number link to real id */
136 136
137 struct snd_monitor_file *files; /* all files associated to this card */ 137 struct list_head files_list; /* all files associated to this card */
138 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown 138 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown
139 state */ 139 state */
140 spinlock_t files_lock; /* lock the files for this card */ 140 spinlock_t files_lock; /* lock the files for this card */
@@ -296,8 +296,20 @@ int snd_card_locked(int card);
296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); 296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
297#endif 297#endif
298 298
299int snd_card_create(int idx, const char *id,
300 struct module *module, int extra_size,
301 struct snd_card **card_ret);
302
303static inline __deprecated
299struct snd_card *snd_card_new(int idx, const char *id, 304struct snd_card *snd_card_new(int idx, const char *id,
300 struct module *module, int extra_size); 305 struct module *module, int extra_size)
306{
307 struct snd_card *card;
308 if (snd_card_create(idx, id, module, extra_size, &card) < 0)
309 return NULL;
310 return card;
311}
312
301int snd_card_disconnect(struct snd_card *card); 313int snd_card_disconnect(struct snd_card *card);
302int snd_card_free(struct snd_card *card); 314int snd_card_free(struct snd_card *card);
303int snd_card_free_when_closed(struct snd_card *card); 315int snd_card_free_when_closed(struct snd_card *card);
@@ -446,21 +458,33 @@ static inline int __snd_bug_on(int cond)
446struct snd_pci_quirk { 458struct snd_pci_quirk {
447 unsigned short subvendor; /* PCI subvendor ID */ 459 unsigned short subvendor; /* PCI subvendor ID */
448 unsigned short subdevice; /* PCI subdevice ID */ 460 unsigned short subdevice; /* PCI subdevice ID */
461 unsigned short subdevice_mask; /* bitmask to match */
449 int value; /* value */ 462 int value; /* value */
450#ifdef CONFIG_SND_DEBUG_VERBOSE 463#ifdef CONFIG_SND_DEBUG_VERBOSE
451 const char *name; /* name of the device (optional) */ 464 const char *name; /* name of the device (optional) */
452#endif 465#endif
453}; 466};
454 467
455#define _SND_PCI_QUIRK_ID(vend,dev) \ 468#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
456 .subvendor = (vend), .subdevice = (dev) 469 .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
470#define _SND_PCI_QUIRK_ID(vend, dev) \
471 _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
457#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 472#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
458#ifdef CONFIG_SND_DEBUG_VERBOSE 473#ifdef CONFIG_SND_DEBUG_VERBOSE
459#define SND_PCI_QUIRK(vend,dev,xname,val) \ 474#define SND_PCI_QUIRK(vend,dev,xname,val) \
460 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} 475 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
476#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
477 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
478#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
479 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
480 .value = (val), .name = (xname)}
461#else 481#else
462#define SND_PCI_QUIRK(vend,dev,xname,val) \ 482#define SND_PCI_QUIRK(vend,dev,xname,val) \
463 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 483 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
484#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
485 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
486#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
487 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
464#endif 488#endif
465 489
466const struct snd_pci_quirk * 490const struct snd_pci_quirk *
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 10ee28eac018..6a664c3f7c1e 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1,6 +1,8 @@
1#ifndef __SOUND_EMU10K1_H 1#ifndef __SOUND_EMU10K1_H
2#define __SOUND_EMU10K1_H 2#define __SOUND_EMU10K1_H
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
6 * Creative Labs, Inc. 8 * Creative Labs, Inc.
@@ -34,6 +36,7 @@
34#include <sound/timer.h> 36#include <sound/timer.h>
35#include <linux/interrupt.h> 37#include <linux/interrupt.h>
36#include <linux/mutex.h> 38#include <linux/mutex.h>
39
37#include <asm/io.h> 40#include <asm/io.h>
38 41
39/* ------------------- DEFINES -------------------- */ 42/* ------------------- DEFINES -------------------- */
@@ -2171,7 +2174,7 @@ struct snd_emu10k1_fx8010_code {
2171 char name[128]; 2174 char name[128];
2172 2175
2173 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 2176 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
2174 u_int32_t __user *gpr_map; /* initializers */ 2177 __u32 __user *gpr_map; /* initializers */
2175 2178
2176 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 2179 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
2177 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */ 2180 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
@@ -2184,11 +2187,11 @@ struct snd_emu10k1_fx8010_code {
2184 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */ 2187 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
2185 2188
2186 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 2189 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
2187 u_int32_t __user *tram_data_map; /* data initializers */ 2190 __u32 __user *tram_data_map; /* data initializers */
2188 u_int32_t __user *tram_addr_map; /* map initializers */ 2191 __u32 __user *tram_addr_map; /* map initializers */
2189 2192
2190 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 2193 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
2191 u_int32_t __user *code; /* one instruction - 64 bits */ 2194 __u32 __user *code; /* one instruction - 64 bits */
2192}; 2195};
2193 2196
2194struct snd_emu10k1_fx8010_tram { 2197struct snd_emu10k1_fx8010_tram {
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index d9eea013c753..8c05e47a4090 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -27,18 +27,28 @@
27 27
28struct snd_hwdep; 28struct snd_hwdep;
29 29
30/* hwdep file ops; all ops can be NULL */
30struct snd_hwdep_ops { 31struct snd_hwdep_ops {
31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig); 32 long long (*llseek)(struct snd_hwdep *hw, struct file *file,
32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset); 33 long long offset, int orig);
33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset); 34 long (*read)(struct snd_hwdep *hw, char __user *buf,
34 int (*open) (struct snd_hwdep * hw, struct file * file); 35 long count, loff_t *offset);
35 int (*release) (struct snd_hwdep *hw, struct file * file); 36 long (*write)(struct snd_hwdep *hw, const char __user *buf,
36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait); 37 long count, loff_t *offset);
37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*open)(struct snd_hwdep *hw, struct file * file);
38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 39 int (*release)(struct snd_hwdep *hw, struct file * file);
39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma); 40 unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,
40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status); 41 poll_table *wait);
41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image); 42 int (*ioctl)(struct snd_hwdep *hw, struct file *file,
43 unsigned int cmd, unsigned long arg);
44 int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
45 unsigned int cmd, unsigned long arg);
46 int (*mmap)(struct snd_hwdep *hw, struct file *file,
47 struct vm_area_struct *vma);
48 int (*dsp_status)(struct snd_hwdep *hw,
49 struct snd_hwdep_dsp_status *status);
50 int (*dsp_load)(struct snd_hwdep *hw,
51 struct snd_hwdep_dsp_image *image);
42}; 52};
43 53
44struct snd_hwdep { 54struct snd_hwdep {
@@ -61,9 +71,9 @@ struct snd_hwdep {
61 void (*private_free) (struct snd_hwdep *hwdep); 71 void (*private_free) (struct snd_hwdep *hwdep);
62 72
63 struct mutex open_mutex; 73 struct mutex open_mutex;
64 int used; 74 int used; /* reference counter */
65 unsigned int dsp_loaded; 75 unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
66 unsigned int exclusive: 1; 76 unsigned int exclusive:1; /* exclusive access mode */
67}; 77};
68 78
69extern int snd_hwdep_new(struct snd_card *card, char *id, int device, 79extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 2e0315cdd0d6..6b013c6f6a04 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -30,6 +30,9 @@ struct input_dev;
30/** 30/**
31 * Jack types which can be reported. These values are used as a 31 * Jack types which can be reported. These values are used as a
32 * bitmask. 32 * bitmask.
33 *
34 * Note that this must be kept in sync with the lookup table in
35 * sound/core/jack.c.
33 */ 36 */
34enum snd_jack_types { 37enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001, 38 SND_JACK_HEADPHONE = 0x0001,
@@ -37,6 +40,8 @@ enum snd_jack_types {
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, 40 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38 SND_JACK_LINEOUT = 0x0004, 41 SND_JACK_LINEOUT = 0x0004,
39 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */ 42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
43 SND_JACK_VIDEOOUT = 0x0010,
44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
40}; 45};
41 46
42struct snd_jack { 47struct snd_jack {
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 40c5a6fa6bcd..8904b1900d7f 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -364,7 +364,6 @@ struct snd_pcm_substream {
364 /* -- timer section -- */ 364 /* -- timer section -- */
365 struct snd_timer *timer; /* timer */ 365 struct snd_timer *timer; /* timer */
366 unsigned timer_running: 1; /* time is running */ 366 unsigned timer_running: 1; /* time is running */
367 spinlock_t timer_lock;
368 /* -- next substream -- */ 367 /* -- next substream -- */
369 struct snd_pcm_substream *next; 368 struct snd_pcm_substream *next;
370 /* -- linked substreams -- */ 369 /* -- linked substreams -- */
@@ -451,7 +450,7 @@ struct snd_pcm_notify {
451 450
452extern const struct file_operations snd_pcm_f_ops[2]; 451extern const struct file_operations snd_pcm_f_ops[2];
453 452
454int snd_pcm_new(struct snd_card *card, char *id, int device, 453int snd_pcm_new(struct snd_card *card, const char *id, int device,
455 int playback_count, int capture_count, 454 int playback_count, int capture_count,
456 struct snd_pcm **rpcm); 455 struct snd_pcm **rpcm);
457int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 456int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
index 2fd3d251d9a5..2c894b600e5b 100644
--- a/include/sound/pxa2xx-lib.h
+++ b/include/sound/pxa2xx-lib.h
@@ -42,4 +42,19 @@ extern int pxa2xx_ac97_hw_resume(void);
42extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); 42extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
43extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); 43extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
44 44
45/* AC97 platform_data */
46/**
47 * struct pxa2xx_ac97_platform_data - pxa ac97 platform data
48 * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95)
49 * a -1 value means no gpio will be used for reset
50 *
51 * Platform data should only be specified for pxa27x CPUs where a silicon bug
52 * prevents correct operation of the reset line. If not specified, the default
53 * behaviour is to consider gpio 113 as the AC97 reset line, which is the
54 * default on most boards.
55 */
56struct pxa2xx_ac97_platform_data {
57 int reset_gpio;
58};
59
45#endif 60#endif
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index b550a416d075..c23c26585700 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -42,7 +42,6 @@
42#define SNDRV_RAWMIDI_LFLG_INPUT (1<<1) 42#define SNDRV_RAWMIDI_LFLG_INPUT (1<<1)
43#define SNDRV_RAWMIDI_LFLG_OPEN (3<<0) 43#define SNDRV_RAWMIDI_LFLG_OPEN (3<<0)
44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
46 45
47struct snd_rawmidi; 46struct snd_rawmidi;
48struct snd_rawmidi_substream; 47struct snd_rawmidi_substream;
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 85f93c5fe1e4..4e62ee1e4115 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -249,6 +249,7 @@ struct snd_sb {
249#define SB_ALS4000_3D_AUTO_MUTE 0x52 249#define SB_ALS4000_3D_AUTO_MUTE 0x52
250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53 250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54 251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
252#define SB_ALS4000_CR3_CONFIGURATION 0xc3 /* bit 7 is Digital Loop Enable */
252#define SB_ALS4000_QSOUND 0xdb 253#define SB_ALS4000_QSOUND 0xdb
253 254
254/* IRQ setting bitmap */ 255/* IRQ setting bitmap */
@@ -330,7 +331,8 @@ enum {
330 SB_MIX_DOUBLE, 331 SB_MIX_DOUBLE,
331 SB_MIX_INPUT_SW, 332 SB_MIX_INPUT_SW,
332 SB_MIX_CAPTURE_PRO, 333 SB_MIX_CAPTURE_PRO,
333 SB_MIX_CAPTURE_DT019X 334 SB_MIX_CAPTURE_DT019X,
335 SB_MIX_MONO_CAPTURE_ALS4K
334}; 336};
335 337
336#define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \ 338#define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 5d1ab9c4950f..1bce7fd1725f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -202,13 +202,11 @@ struct snd_emux_misc_mode {
202 int value2; /* reserved */ 202 int value2; /* reserved */
203}; 203};
204 204
205enum { 205#define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int)
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206#define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info)
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info), 207#define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82)
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208#define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83)
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209#define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int)
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210#define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode)
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212};
213 211
214#endif /* __SOUND_SFNT_INFO_H */ 212#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 24247f763608..13676472ddfc 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -203,7 +203,7 @@ struct snd_soc_dai {
203 int (*resume)(struct snd_soc_dai *dai); 203 int (*resume)(struct snd_soc_dai *dai);
204 204
205 /* ops */ 205 /* ops */
206 struct snd_soc_dai_ops ops; 206 struct snd_soc_dai_ops *ops;
207 207
208 /* DAI capabilities */ 208 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture; 209 struct snd_soc_pcm_stream capture;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index dfa804958820..a7def6a9a030 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -76,6 +76,11 @@
76 wcontrols, wncontrols)\ 76 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
79#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \
80 wcontrols, wncontrols)\
81{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \
82 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
83 .num_kcontrols = wncontrols}
79#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ 84#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
80{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 85{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
81 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} 86 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
@@ -101,6 +106,11 @@
101{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 106{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
102 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 107 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
103 .event = wevent, .event_flags = wflags} 108 .event = wevent, .event_flags = wflags}
109#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \
110 wcontrols, wncontrols, wevent, wflags) \
111{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
112 .invert = winvert, .kcontrols = wcontrols, \
113 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
104#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ 114#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
105{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 115{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
106 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ 116 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \
@@ -182,6 +192,12 @@
182 .get = snd_soc_dapm_get_value_enum_double, \ 192 .get = snd_soc_dapm_get_value_enum_double, \
183 .put = snd_soc_dapm_put_value_enum_double, \ 193 .put = snd_soc_dapm_put_value_enum_double, \
184 .private_value = (unsigned long)&xenum } 194 .private_value = (unsigned long)&xenum }
195#define SOC_DAPM_PIN_SWITCH(xname) \
196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
197 .info = snd_soc_dapm_info_pin_switch, \
198 .get = snd_soc_dapm_get_pin_switch, \
199 .put = snd_soc_dapm_put_pin_switch, \
200 .private_value = (unsigned long)xname }
185 201
186/* dapm stream operations */ 202/* dapm stream operations */
187#define SND_SOC_DAPM_STREAM_NOP 0x0 203#define SND_SOC_DAPM_STREAM_NOP 0x0
@@ -228,6 +244,12 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
228 struct snd_ctl_elem_value *ucontrol); 244 struct snd_ctl_elem_value *ucontrol);
229int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, 245int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
230 struct snd_ctl_elem_value *ucontrol); 246 struct snd_ctl_elem_value *ucontrol);
247int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
248 struct snd_ctl_elem_info *uinfo);
249int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
250 struct snd_ctl_elem_value *uncontrol);
251int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
252 struct snd_ctl_elem_value *uncontrol);
231int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 253int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
232 const struct snd_soc_dapm_widget *widget); 254 const struct snd_soc_dapm_widget *widget);
233int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 255int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
@@ -250,10 +272,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
250int snd_soc_dapm_sys_add(struct device *dev); 272int snd_soc_dapm_sys_add(struct device *dev);
251 273
252/* dapm audio pin control and status */ 274/* dapm audio pin control and status */
253int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); 275int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
254int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); 276int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
255int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin); 277int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
256int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); 278int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
257int snd_soc_dapm_sync(struct snd_soc_codec *codec); 279int snd_soc_dapm_sync(struct snd_soc_codec *codec);
258 280
259/* dapm widget types */ 281/* dapm widget types */
@@ -263,6 +285,7 @@ enum snd_soc_dapm_type {
263 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 285 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
264 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ 286 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
265 snd_soc_dapm_mixer, /* mixes several analog signals together */ 287 snd_soc_dapm_mixer, /* mixes several analog signals together */
288 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
266 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 289 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
267 snd_soc_dapm_adc, /* analog to digital converter */ 290 snd_soc_dapm_adc, /* analog to digital converter */
268 snd_soc_dapm_dac, /* digital to analog converter */ 291 snd_soc_dapm_dac, /* digital to analog converter */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 24593ac3ea19..a40bc6f316fc 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -16,6 +16,8 @@
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/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/interrupt.h>
20#include <linux/kernel.h>
19#include <sound/core.h> 21#include <sound/core.h>
20#include <sound/pcm.h> 22#include <sound/pcm.h>
21#include <sound/control.h> 23#include <sound/control.h>
@@ -154,6 +156,8 @@ enum snd_soc_bias_level {
154 SND_SOC_BIAS_OFF, 156 SND_SOC_BIAS_OFF,
155}; 157};
156 158
159struct snd_jack;
160struct snd_soc_card;
157struct snd_soc_device; 161struct snd_soc_device;
158struct snd_soc_pcm_stream; 162struct snd_soc_pcm_stream;
159struct snd_soc_ops; 163struct snd_soc_ops;
@@ -164,6 +168,11 @@ struct snd_soc_platform;
164struct snd_soc_codec; 168struct snd_soc_codec;
165struct soc_enum; 169struct soc_enum;
166struct snd_soc_ac97_ops; 170struct snd_soc_ac97_ops;
171struct snd_soc_jack;
172struct snd_soc_jack_pin;
173#ifdef CONFIG_GPIOLIB
174struct snd_soc_jack_gpio;
175#endif
167 176
168typedef int (*hw_write_t)(void *,const char* ,int); 177typedef int (*hw_write_t)(void *,const char* ,int);
169typedef int (*hw_read_t)(void *,char* ,int); 178typedef int (*hw_read_t)(void *,char* ,int);
@@ -184,6 +193,19 @@ int snd_soc_init_card(struct snd_soc_device *socdev);
184int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 193int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
185 const struct snd_pcm_hardware *hw); 194 const struct snd_pcm_hardware *hw);
186 195
196/* Jack reporting */
197int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
198 struct snd_soc_jack *jack);
199void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
200int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
201 struct snd_soc_jack_pin *pins);
202#ifdef CONFIG_GPIOLIB
203int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
204 struct snd_soc_jack_gpio *gpios);
205void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
206 struct snd_soc_jack_gpio *gpios);
207#endif
208
187/* codec IO */ 209/* codec IO */
188#define snd_soc_read(codec, reg) codec->read(codec, reg) 210#define snd_soc_read(codec, reg) codec->read(codec, reg)
189#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) 211#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
@@ -203,6 +225,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
203 */ 225 */
204struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 226struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
205 void *data, char *long_name); 227 void *data, char *long_name);
228int snd_soc_add_controls(struct snd_soc_codec *codec,
229 const struct snd_kcontrol_new *controls, int num_controls);
206int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 230int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
207 struct snd_ctl_elem_info *uinfo); 231 struct snd_ctl_elem_info *uinfo);
208int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, 232int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -237,6 +261,48 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
237int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 261int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
238 struct snd_ctl_elem_value *ucontrol); 262 struct snd_ctl_elem_value *ucontrol);
239 263
264/**
265 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
266 *
267 * @pin: name of the pin to update
268 * @mask: bits to check for in reported jack status
269 * @invert: if non-zero then pin is enabled when status is not reported
270 */
271struct snd_soc_jack_pin {
272 struct list_head list;
273 const char *pin;
274 int mask;
275 bool invert;
276};
277
278/**
279 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
280 *
281 * @gpio: gpio number
282 * @name: gpio name
283 * @report: value to report when jack detected
284 * @invert: report presence in low state
285 * @debouce_time: debouce time in ms
286 */
287#ifdef CONFIG_GPIOLIB
288struct snd_soc_jack_gpio {
289 unsigned int gpio;
290 const char *name;
291 int report;
292 int invert;
293 int debounce_time;
294 struct snd_soc_jack *jack;
295 struct work_struct work;
296};
297#endif
298
299struct snd_soc_jack {
300 struct snd_jack *jack;
301 struct snd_soc_card *card;
302 struct list_head pins;
303 int status;
304};
305
240/* SoC PCM stream information */ 306/* SoC PCM stream information */
241struct snd_soc_pcm_stream { 307struct snd_soc_pcm_stream {
242 char *stream_name; 308 char *stream_name;
@@ -384,6 +450,8 @@ struct snd_soc_card {
384 450
385 struct snd_soc_device *socdev; 451 struct snd_soc_device *socdev;
386 452
453 struct snd_soc_codec *codec;
454
387 struct snd_soc_platform *platform; 455 struct snd_soc_platform *platform;
388 struct delayed_work delayed_work; 456 struct delayed_work delayed_work;
389 struct work_struct deferred_resume_work; 457 struct work_struct deferred_resume_work;
@@ -393,7 +461,6 @@ struct snd_soc_card {
393struct snd_soc_device { 461struct snd_soc_device {
394 struct device *dev; 462 struct device *dev;
395 struct snd_soc_card *card; 463 struct snd_soc_card *card;
396 struct snd_soc_codec *codec;
397 struct snd_soc_codec_device *codec_dev; 464 struct snd_soc_codec_device *codec_dev;
398 void *codec_data; 465 void *codec_data;
399}; 466};
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 426899e529c5..5718a02d3afb 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -22,8 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/videodev.h> 25#include <linux/videodev2.h>
26#include <media/v4l2-dev.h> 26#include <media/v4l2-dev.h>
27#include <media/v4l2-ioctl.h>
27 28
28struct snd_tea575x; 29struct snd_tea575x;
29 30
@@ -35,11 +36,10 @@ struct snd_tea575x_ops {
35 36
36struct snd_tea575x { 37struct snd_tea575x {
37 struct snd_card *card; 38 struct snd_card *card;
38 struct video_device vd; /* video device */ 39 struct video_device *vd; /* video device */
39 struct v4l2_file_operations fops;
40 int dev_nr; /* requested device number + 1 */ 40 int dev_nr; /* requested device number + 1 */
41 int vd_registered; /* video device is registered */
42 int tea5759; /* 5759 chip is present */ 41 int tea5759; /* 5759 chip is present */
42 int mute; /* Device is muted? */
43 unsigned int freq_fixup; /* crystal onboard */ 43 unsigned int freq_fixup; /* crystal onboard */
44 unsigned int val; /* hw value */ 44 unsigned int val; /* hw value */
45 unsigned long freq; /* frequency */ 45 unsigned long freq; /* frequency */
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
deleted file mode 100644
index 110d5dc3a2be..000000000000
--- a/include/sound/uda1341.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/include/linux/l3/uda1341.h
3 *
4 * Philips UDA1341 mixer device driver for ALSA
5 *
6 * Copyright (c) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License.
10 *
11 * History:
12 *
13 * 2002-03-13 Tomas Kasparek Initial release - based on uda1341.h from OSS
14 * 2002-03-30 Tomas Kasparek Proc filesystem support, complete mixer and DSP
15 * features support
16 */
17
18#define UDA1341_ALSA_NAME "snd-uda1341"
19
20/*
21 * Default rate set after inicialization
22 */
23#define AUDIO_RATE_DEFAULT 44100
24
25/*
26 * UDA1341 L3 address and command types
27 */
28#define UDA1341_L3ADDR 5
29#define UDA1341_DATA0 (UDA1341_L3ADDR << 2 | 0)
30#define UDA1341_DATA1 (UDA1341_L3ADDR << 2 | 1)
31#define UDA1341_STATUS (UDA1341_L3ADDR << 2 | 2)
32
33enum uda1341_onoff {
34 OFF=0,
35 ON,
36};
37
38enum uda1341_format {
39 I2S=0,
40 LSB16,
41 LSB18,
42 LSB20,
43 MSB,
44 LSB16MSB,
45 LSB18MSB,
46 LSB20MSB,
47};
48
49enum uda1341_fs {
50 F512=0,
51 F384,
52 F256,
53 Funused,
54};
55
56enum uda1341_peak {
57 BEFORE=0,
58 AFTER,
59};
60
61enum uda1341_filter {
62 FLAT=0,
63 MIN,
64 MIN2,
65 MAX,
66};
67
68enum uda1341_mixer {
69 DOUBLE,
70 LINE,
71 MIC,
72 MIXER,
73};
74
75enum uda1341_deemp {
76 NONE,
77 D32,
78 D44,
79 D48,
80};
81
82enum uda1341_config {
83 CMD_READ_REG = 0,
84 CMD_RESET,
85 CMD_FS,
86 CMD_FORMAT,
87 CMD_OGAIN,
88 CMD_IGAIN,
89 CMD_DAC,
90 CMD_ADC,
91 CMD_VOLUME,
92 CMD_BASS,
93 CMD_TREBBLE,
94 CMD_PEAK,
95 CMD_DEEMP,
96 CMD_MUTE,
97 CMD_FILTER,
98 CMD_CH1,
99 CMD_CH2,
100 CMD_MIC,
101 CMD_MIXER,
102 CMD_AGC,
103 CMD_IG,
104 CMD_AGC_TIME,
105 CMD_AGC_LEVEL,
106#ifdef CONFIG_PM
107 CMD_SUSPEND,
108 CMD_RESUME,
109#endif
110 CMD_LAST,
111};
112
113enum write_through {
114 //used in update_bits (write_cfg) to avoid l3_write - just update local copy of regs.
115 REGS_ONLY=0,
116 //update local regs and write value to uda1341 - do l3_write
117 FLUSH,
118};
119
120int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
121
122/*
123 * Local variables:
124 * indent-tabs-mode: t
125 * End:
126 */
diff --git a/include/sound/version.h b/include/sound/version.h
index 2b48237e23bf..a7e74e23ad2e 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.18a" 2#define CONFIG_SND_VERSION "1.0.19"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wss.h b/include/sound/wss.h
index fd01f22825cd..6d65f322f1d5 100644
--- a/include/sound/wss.h
+++ b/include/sound/wss.h
@@ -154,6 +154,7 @@ int snd_wss_create(struct snd_card *card,
154 unsigned short hardware, 154 unsigned short hardware,
155 unsigned short hwshare, 155 unsigned short hwshare,
156 struct snd_wss **rchip); 156 struct snd_wss **rchip);
157int snd_wss_free(struct snd_wss *chip);
157int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); 158int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
158int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); 159int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
159int snd_wss_mixer(struct snd_wss *chip); 160int snd_wss_mixer(struct snd_wss *chip);
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h
index ad8b7857855a..28ee69f9cd46 100644
--- a/include/trace/kmemtrace.h
+++ b/include/trace/kmemtrace.h
@@ -9,65 +9,53 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12#include <linux/tracepoint.h>
12#include <linux/types.h> 13#include <linux/types.h>
13#include <linux/marker.h>
14
15enum kmemtrace_type_id {
16 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
17 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
18 KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
19};
20 14
21#ifdef CONFIG_KMEMTRACE 15#ifdef CONFIG_KMEMTRACE
22
23extern void kmemtrace_init(void); 16extern void kmemtrace_init(void);
24 17#else
25extern void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id,
26 unsigned long call_site,
27 const void *ptr,
28 size_t bytes_req,
29 size_t bytes_alloc,
30 gfp_t gfp_flags,
31 int node);
32
33extern void kmemtrace_mark_free(enum kmemtrace_type_id type_id,
34 unsigned long call_site,
35 const void *ptr);
36
37#else /* CONFIG_KMEMTRACE */
38
39static inline void kmemtrace_init(void) 18static inline void kmemtrace_init(void)
40{ 19{
41} 20}
42 21#endif
43static inline void kmemtrace_mark_alloc_node(enum kmemtrace_type_id type_id, 22
44 unsigned long call_site, 23DECLARE_TRACE(kmalloc,
45 const void *ptr, 24 TP_PROTO(unsigned long call_site,
46 size_t bytes_req, 25 const void *ptr,
47 size_t bytes_alloc, 26 size_t bytes_req,
48 gfp_t gfp_flags, 27 size_t bytes_alloc,
49 int node) 28 gfp_t gfp_flags),
50{ 29 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
51} 30DECLARE_TRACE(kmem_cache_alloc,
52 31 TP_PROTO(unsigned long call_site,
53static inline void kmemtrace_mark_free(enum kmemtrace_type_id type_id, 32 const void *ptr,
54 unsigned long call_site, 33 size_t bytes_req,
55 const void *ptr) 34 size_t bytes_alloc,
56{ 35 gfp_t gfp_flags),
57} 36 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
58 37DECLARE_TRACE(kmalloc_node,
59#endif /* CONFIG_KMEMTRACE */ 38 TP_PROTO(unsigned long call_site,
60 39 const void *ptr,
61static inline void kmemtrace_mark_alloc(enum kmemtrace_type_id type_id, 40 size_t bytes_req,
62 unsigned long call_site, 41 size_t bytes_alloc,
63 const void *ptr, 42 gfp_t gfp_flags,
64 size_t bytes_req, 43 int node),
65 size_t bytes_alloc, 44 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
66 gfp_t gfp_flags) 45DECLARE_TRACE(kmem_cache_alloc_node,
67{ 46 TP_PROTO(unsigned long call_site,
68 kmemtrace_mark_alloc_node(type_id, call_site, ptr, 47 const void *ptr,
69 bytes_req, bytes_alloc, gfp_flags, -1); 48 size_t bytes_req,
70} 49 size_t bytes_alloc,
50 gfp_t gfp_flags,
51 int node),
52 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
53DECLARE_TRACE(kfree,
54 TP_PROTO(unsigned long call_site, const void *ptr),
55 TP_ARGS(call_site, ptr));
56DECLARE_TRACE(kmem_cache_free,
57 TP_PROTO(unsigned long call_site, const void *ptr),
58 TP_ARGS(call_site, ptr));
71 59
72#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
73 61
diff --git a/include/trace/skb.h b/include/trace/skb.h
new file mode 100644
index 000000000000..b66206d9be72
--- /dev/null
+++ b/include/trace/skb.h
@@ -0,0 +1,11 @@
1#ifndef _TRACE_SKB_H_
2#define _TRACE_SKB_H_
3
4#include <linux/skbuff.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(kfree_skb,
8 TP_PROTO(struct sk_buff *skb, void *location),
9 TP_ARGS(skb, location));
10
11#endif
diff --git a/include/video/aty128.h b/include/video/aty128.h
index 51ac69f05bdc..f0851e3bb7cc 100644
--- a/include/video/aty128.h
+++ b/include/video/aty128.h
@@ -415,7 +415,7 @@
415#define PWR_MGT_SLOWDOWN_MCLK 0x00002000 415#define PWR_MGT_SLOWDOWN_MCLK 0x00002000
416 416
417#define PMI_PMSCR_REG 0x60 417#define PMI_PMSCR_REG 0x60
418 418
419/* used by ATI bug fix for hardware ROM */ 419/* used by ATI bug fix for hardware ROM */
420#define RAGE128_MPP_TB_CONFIG 0x01c0 420#define RAGE128_MPP_TB_CONFIG 0x01c0
421 421
diff --git a/include/video/broadsheetfb.h b/include/video/broadsheetfb.h
new file mode 100644
index 000000000000..a758534c0272
--- /dev/null
+++ b/include/video/broadsheetfb.h
@@ -0,0 +1,59 @@
1/*
2 * broadsheetfb.h - definitions for the broadsheet framebuffer driver
3 *
4 * Copyright (C) 2008 by Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 */
11
12#ifndef _LINUX_BROADSHEETFB_H_
13#define _LINUX_BROADSHEETFB_H_
14
15/* Broadsheet command defines */
16#define BS_CMD_INIT_SYS_RUN 0x06
17#define BS_CMD_INIT_DSPE_CFG 0x09
18#define BS_CMD_INIT_DSPE_TMG 0x0A
19#define BS_CMD_INIT_ROTMODE 0x0B
20#define BS_CMD_RD_REG 0x10
21#define BS_CMD_WR_REG 0x11
22#define BS_CMD_LD_IMG 0x20
23#define BS_CMD_LD_IMG_AREA 0x22
24#define BS_CMD_LD_IMG_END 0x23
25#define BS_CMD_WAIT_DSPE_TRG 0x28
26#define BS_CMD_WAIT_DSPE_FREND 0x29
27#define BS_CMD_RD_WFM_INFO 0x30
28#define BS_CMD_UPD_INIT 0x32
29#define BS_CMD_UPD_FULL 0x33
30#define BS_CMD_UPD_GDRV_CLR 0x37
31
32/* Broadsheet pin interface specific defines */
33#define BS_CS 0x01
34#define BS_DC 0x02
35#define BS_WR 0x03
36
37/* struct used by broadsheet. board specific stuff comes from *board */
38struct broadsheetfb_par {
39 struct fb_info *info;
40 struct broadsheet_board *board;
41 void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val);
42 u16 (*read_reg)(struct broadsheetfb_par *, u16 reg);
43 wait_queue_head_t waitq;
44};
45
46/* board specific routines */
47struct broadsheet_board {
48 struct module *owner;
49 int (*init)(struct broadsheetfb_par *);
50 int (*wait_for_rdy)(struct broadsheetfb_par *);
51 void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8);
52 void (*set_hdb)(struct broadsheetfb_par *, u16);
53 u16 (*get_hdb)(struct broadsheetfb_par *);
54 void (*cleanup)(struct broadsheetfb_par *);
55 int (*get_panel_type)(void);
56 int (*setup_irq)(struct fb_info *);
57};
58
59#endif
diff --git a/include/video/cirrus.h b/include/video/cirrus.h
index b2776b6c8679..9a5e9ee30782 100644
--- a/include/video/cirrus.h
+++ b/include/video/cirrus.h
@@ -32,7 +32,6 @@
32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */ 32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */
33 33
34/*** VGA Sequencer Registers ***/ 34/*** VGA Sequencer Registers ***/
35#define CL_SEQR0 0x0 /* Reset */
36/* the following are from the "extension registers" group */ 35/* the following are from the "extension registers" group */
37#define CL_SEQR6 0x6 /* Unlock ALL Extensions */ 36#define CL_SEQR6 0x6 /* Unlock ALL Extensions */
38#define CL_SEQR7 0x7 /* Extended Sequencer Mode */ 37#define CL_SEQR7 0x7 /* Extended Sequencer Mode */
@@ -71,6 +70,7 @@
71#define CL_CRT1B 0x1b /* Extended Display Controls */ 70#define CL_CRT1B 0x1b /* Extended Display Controls */
72#define CL_CRT1C 0x1c /* Sync adjust and genlock register */ 71#define CL_CRT1C 0x1c /* Sync adjust and genlock register */
73#define CL_CRT1D 0x1d /* Overlay Extended Control register */ 72#define CL_CRT1D 0x1d /* Overlay Extended Control register */
73#define CL_CRT1E 0x1e /* Another overflow register */
74#define CL_CRT25 0x25 /* Part Status Register */ 74#define CL_CRT25 0x25 /* Part Status Register */
75#define CL_CRT27 0x27 /* ID Register */ 75#define CL_CRT27 0x27 /* ID Register */
76#define CL_CRT51 0x51 /* P4 disable "flicker fixer" */ 76#define CL_CRT51 0x51 /* P4 disable "flicker fixer" */
diff --git a/include/video/newport.h b/include/video/newport.h
index 1f5ebeaa818f..001b935e71c4 100644
--- a/include/video/newport.h
+++ b/include/video/newport.h
@@ -453,7 +453,7 @@ static __inline__ int newport_wait(struct newport_regs *regs)
453{ 453{
454 int t = BUSY_TIMEOUT; 454 int t = BUSY_TIMEOUT;
455 455
456 while (t--) 456 while (--t)
457 if (!(regs->cset.status & NPORT_STAT_GBUSY)) 457 if (!(regs->cset.status & NPORT_STAT_GBUSY))
458 break; 458 break;
459 return !t; 459 return !t;
@@ -463,7 +463,7 @@ static __inline__ int newport_bfwait(struct newport_regs *regs)
463{ 463{
464 int t = BUSY_TIMEOUT; 464 int t = BUSY_TIMEOUT;
465 465
466 while (t--) 466 while (--t)
467 if(!(regs->cset.status & NPORT_STAT_BBUSY)) 467 if(!(regs->cset.status & NPORT_STAT_BBUSY))
468 break; 468 break;
469 return !t; 469 return !t;
diff --git a/include/video/radeon.h b/include/video/radeon.h
index e072b16b39ab..56b188abfb54 100644
--- a/include/video/radeon.h
+++ b/include/video/radeon.h
@@ -5,12 +5,12 @@
5#define RADEON_REGSIZE 0x4000 5#define RADEON_REGSIZE 0x4000
6 6
7 7
8#define MM_INDEX 0x0000 8#define MM_INDEX 0x0000
9#define MM_DATA 0x0004 9#define MM_DATA 0x0004
10#define BUS_CNTL 0x0030 10#define BUS_CNTL 0x0030
11#define HI_STAT 0x004C 11#define HI_STAT 0x004C
12#define BUS_CNTL1 0x0034 12#define BUS_CNTL1 0x0034
13#define I2C_CNTL_1 0x0094 13#define I2C_CNTL_1 0x0094
14#define CNFG_CNTL 0x00E0 14#define CNFG_CNTL 0x00E0
15#define CNFG_MEMSIZE 0x00F8 15#define CNFG_MEMSIZE 0x00F8
16#define CNFG_APER_0_BASE 0x0100 16#define CNFG_APER_0_BASE 0x0100
@@ -18,8 +18,8 @@
18#define CNFG_APER_SIZE 0x0108 18#define CNFG_APER_SIZE 0x0108
19#define CNFG_REG_1_BASE 0x010C 19#define CNFG_REG_1_BASE 0x010C
20#define CNFG_REG_APER_SIZE 0x0110 20#define CNFG_REG_APER_SIZE 0x0110
21#define PAD_AGPINPUT_DELAY 0x0164 21#define PAD_AGPINPUT_DELAY 0x0164
22#define PAD_CTLR_STRENGTH 0x0168 22#define PAD_CTLR_STRENGTH 0x0168
23#define PAD_CTLR_UPDATE 0x016C 23#define PAD_CTLR_UPDATE 0x016C
24#define PAD_CTLR_MISC 0x0aa0 24#define PAD_CTLR_MISC 0x0aa0
25#define AGP_CNTL 0x0174 25#define AGP_CNTL 0x0174
@@ -27,171 +27,171 @@
27#define CAP0_TRIG_CNTL 0x0950 27#define CAP0_TRIG_CNTL 0x0950
28#define CAP1_TRIG_CNTL 0x09c0 28#define CAP1_TRIG_CNTL 0x09c0
29#define VIPH_CONTROL 0x0C40 29#define VIPH_CONTROL 0x0C40
30#define VENDOR_ID 0x0F00 30#define VENDOR_ID 0x0F00
31#define DEVICE_ID 0x0F02 31#define DEVICE_ID 0x0F02
32#define COMMAND 0x0F04 32#define COMMAND 0x0F04
33#define STATUS 0x0F06 33#define STATUS 0x0F06
34#define REVISION_ID 0x0F08 34#define REVISION_ID 0x0F08
35#define REGPROG_INF 0x0F09 35#define REGPROG_INF 0x0F09
36#define SUB_CLASS 0x0F0A 36#define SUB_CLASS 0x0F0A
37#define BASE_CODE 0x0F0B 37#define BASE_CODE 0x0F0B
38#define CACHE_LINE 0x0F0C 38#define CACHE_LINE 0x0F0C
39#define LATENCY 0x0F0D 39#define LATENCY 0x0F0D
40#define HEADER 0x0F0E 40#define HEADER 0x0F0E
41#define BIST 0x0F0F 41#define BIST 0x0F0F
42#define REG_MEM_BASE 0x0F10 42#define REG_MEM_BASE 0x0F10
43#define REG_IO_BASE 0x0F14 43#define REG_IO_BASE 0x0F14
44#define REG_REG_BASE 0x0F18 44#define REG_REG_BASE 0x0F18
45#define ADAPTER_ID 0x0F2C 45#define ADAPTER_ID 0x0F2C
46#define BIOS_ROM 0x0F30 46#define BIOS_ROM 0x0F30
47#define CAPABILITIES_PTR 0x0F34 47#define CAPABILITIES_PTR 0x0F34
48#define INTERRUPT_LINE 0x0F3C 48#define INTERRUPT_LINE 0x0F3C
49#define INTERRUPT_PIN 0x0F3D 49#define INTERRUPT_PIN 0x0F3D
50#define MIN_GRANT 0x0F3E 50#define MIN_GRANT 0x0F3E
51#define MAX_LATENCY 0x0F3F 51#define MAX_LATENCY 0x0F3F
52#define ADAPTER_ID_W 0x0F4C 52#define ADAPTER_ID_W 0x0F4C
53#define PMI_CAP_ID 0x0F50 53#define PMI_CAP_ID 0x0F50
54#define PMI_NXT_CAP_PTR 0x0F51 54#define PMI_NXT_CAP_PTR 0x0F51
55#define PMI_PMC_REG 0x0F52 55#define PMI_PMC_REG 0x0F52
56#define PM_STATUS 0x0F54 56#define PM_STATUS 0x0F54
57#define PMI_DATA 0x0F57 57#define PMI_DATA 0x0F57
58#define AGP_CAP_ID 0x0F58 58#define AGP_CAP_ID 0x0F58
59#define AGP_STATUS 0x0F5C 59#define AGP_STATUS 0x0F5C
60#define AGP_COMMAND 0x0F60 60#define AGP_COMMAND 0x0F60
61#define AIC_CTRL 0x01D0 61#define AIC_CTRL 0x01D0
62#define AIC_STAT 0x01D4 62#define AIC_STAT 0x01D4
63#define AIC_PT_BASE 0x01D8 63#define AIC_PT_BASE 0x01D8
64#define AIC_LO_ADDR 0x01DC 64#define AIC_LO_ADDR 0x01DC
65#define AIC_HI_ADDR 0x01E0 65#define AIC_HI_ADDR 0x01E0
66#define AIC_TLB_ADDR 0x01E4 66#define AIC_TLB_ADDR 0x01E4
67#define AIC_TLB_DATA 0x01E8 67#define AIC_TLB_DATA 0x01E8
68#define DAC_CNTL 0x0058 68#define DAC_CNTL 0x0058
69#define DAC_CNTL2 0x007c 69#define DAC_CNTL2 0x007c
70#define CRTC_GEN_CNTL 0x0050 70#define CRTC_GEN_CNTL 0x0050
71#define MEM_CNTL 0x0140 71#define MEM_CNTL 0x0140
72#define MC_CNTL 0x0140 72#define MC_CNTL 0x0140
73#define EXT_MEM_CNTL 0x0144 73#define EXT_MEM_CNTL 0x0144
74#define MC_TIMING_CNTL 0x0144 74#define MC_TIMING_CNTL 0x0144
75#define MC_AGP_LOCATION 0x014C 75#define MC_AGP_LOCATION 0x014C
76#define MEM_IO_CNTL_A0 0x0178 76#define MEM_IO_CNTL_A0 0x0178
77#define MEM_REFRESH_CNTL 0x0178 77#define MEM_REFRESH_CNTL 0x0178
78#define MEM_INIT_LATENCY_TIMER 0x0154 78#define MEM_INIT_LATENCY_TIMER 0x0154
79#define MC_INIT_GFX_LAT_TIMER 0x0154 79#define MC_INIT_GFX_LAT_TIMER 0x0154
80#define MEM_SDRAM_MODE_REG 0x0158 80#define MEM_SDRAM_MODE_REG 0x0158
81#define AGP_BASE 0x0170 81#define AGP_BASE 0x0170
82#define MEM_IO_CNTL_A1 0x017C 82#define MEM_IO_CNTL_A1 0x017C
83#define MC_READ_CNTL_AB 0x017C 83#define MC_READ_CNTL_AB 0x017C
84#define MEM_IO_CNTL_B0 0x0180 84#define MEM_IO_CNTL_B0 0x0180
85#define MC_INIT_MISC_LAT_TIMER 0x0180 85#define MC_INIT_MISC_LAT_TIMER 0x0180
86#define MEM_IO_CNTL_B1 0x0184 86#define MEM_IO_CNTL_B1 0x0184
87#define MC_IOPAD_CNTL 0x0184 87#define MC_IOPAD_CNTL 0x0184
88#define MC_DEBUG 0x0188 88#define MC_DEBUG 0x0188
89#define MC_STATUS 0x0150 89#define MC_STATUS 0x0150
90#define MEM_IO_OE_CNTL 0x018C 90#define MEM_IO_OE_CNTL 0x018C
91#define MC_CHIP_IO_OE_CNTL_AB 0x018C 91#define MC_CHIP_IO_OE_CNTL_AB 0x018C
92#define MC_FB_LOCATION 0x0148 92#define MC_FB_LOCATION 0x0148
93#define HOST_PATH_CNTL 0x0130 93#define HOST_PATH_CNTL 0x0130
94#define MEM_VGA_WP_SEL 0x0038 94#define MEM_VGA_WP_SEL 0x0038
95#define MEM_VGA_RP_SEL 0x003C 95#define MEM_VGA_RP_SEL 0x003C
96#define HDP_DEBUG 0x0138 96#define HDP_DEBUG 0x0138
97#define SW_SEMAPHORE 0x013C 97#define SW_SEMAPHORE 0x013C
98#define CRTC2_GEN_CNTL 0x03f8 98#define CRTC2_GEN_CNTL 0x03f8
99#define CRTC2_DISPLAY_BASE_ADDR 0x033c 99#define CRTC2_DISPLAY_BASE_ADDR 0x033c
100#define SURFACE_CNTL 0x0B00 100#define SURFACE_CNTL 0x0B00
101#define SURFACE0_LOWER_BOUND 0x0B04 101#define SURFACE0_LOWER_BOUND 0x0B04
102#define SURFACE1_LOWER_BOUND 0x0B14 102#define SURFACE1_LOWER_BOUND 0x0B14
103#define SURFACE2_LOWER_BOUND 0x0B24 103#define SURFACE2_LOWER_BOUND 0x0B24
104#define SURFACE3_LOWER_BOUND 0x0B34 104#define SURFACE3_LOWER_BOUND 0x0B34
105#define SURFACE4_LOWER_BOUND 0x0B44 105#define SURFACE4_LOWER_BOUND 0x0B44
106#define SURFACE5_LOWER_BOUND 0x0B54 106#define SURFACE5_LOWER_BOUND 0x0B54
107#define SURFACE6_LOWER_BOUND 0x0B64 107#define SURFACE6_LOWER_BOUND 0x0B64
108#define SURFACE7_LOWER_BOUND 0x0B74 108#define SURFACE7_LOWER_BOUND 0x0B74
109#define SURFACE0_UPPER_BOUND 0x0B08 109#define SURFACE0_UPPER_BOUND 0x0B08
110#define SURFACE1_UPPER_BOUND 0x0B18 110#define SURFACE1_UPPER_BOUND 0x0B18
111#define SURFACE2_UPPER_BOUND 0x0B28 111#define SURFACE2_UPPER_BOUND 0x0B28
112#define SURFACE3_UPPER_BOUND 0x0B38 112#define SURFACE3_UPPER_BOUND 0x0B38
113#define SURFACE4_UPPER_BOUND 0x0B48 113#define SURFACE4_UPPER_BOUND 0x0B48
114#define SURFACE5_UPPER_BOUND 0x0B58 114#define SURFACE5_UPPER_BOUND 0x0B58
115#define SURFACE6_UPPER_BOUND 0x0B68 115#define SURFACE6_UPPER_BOUND 0x0B68
116#define SURFACE7_UPPER_BOUND 0x0B78 116#define SURFACE7_UPPER_BOUND 0x0B78
117#define SURFACE0_INFO 0x0B0C 117#define SURFACE0_INFO 0x0B0C
118#define SURFACE1_INFO 0x0B1C 118#define SURFACE1_INFO 0x0B1C
119#define SURFACE2_INFO 0x0B2C 119#define SURFACE2_INFO 0x0B2C
120#define SURFACE3_INFO 0x0B3C 120#define SURFACE3_INFO 0x0B3C
121#define SURFACE4_INFO 0x0B4C 121#define SURFACE4_INFO 0x0B4C
122#define SURFACE5_INFO 0x0B5C 122#define SURFACE5_INFO 0x0B5C
123#define SURFACE6_INFO 0x0B6C 123#define SURFACE6_INFO 0x0B6C
124#define SURFACE7_INFO 0x0B7C 124#define SURFACE7_INFO 0x0B7C
125#define SURFACE_ACCESS_FLAGS 0x0BF8 125#define SURFACE_ACCESS_FLAGS 0x0BF8
126#define SURFACE_ACCESS_CLR 0x0BFC 126#define SURFACE_ACCESS_CLR 0x0BFC
127#define GEN_INT_CNTL 0x0040 127#define GEN_INT_CNTL 0x0040
128#define GEN_INT_STATUS 0x0044 128#define GEN_INT_STATUS 0x0044
129#define CRTC_EXT_CNTL 0x0054 129#define CRTC_EXT_CNTL 0x0054
130#define RB3D_CNTL 0x1C3C 130#define RB3D_CNTL 0x1C3C
131#define WAIT_UNTIL 0x1720 131#define WAIT_UNTIL 0x1720
132#define ISYNC_CNTL 0x1724 132#define ISYNC_CNTL 0x1724
133#define RBBM_GUICNTL 0x172C 133#define RBBM_GUICNTL 0x172C
134#define RBBM_STATUS 0x0E40 134#define RBBM_STATUS 0x0E40
135#define RBBM_STATUS_alt_1 0x1740 135#define RBBM_STATUS_alt_1 0x1740
136#define RBBM_CNTL 0x00EC 136#define RBBM_CNTL 0x00EC
137#define RBBM_CNTL_alt_1 0x0E44 137#define RBBM_CNTL_alt_1 0x0E44
138#define RBBM_SOFT_RESET 0x00F0 138#define RBBM_SOFT_RESET 0x00F0
139#define RBBM_SOFT_RESET_alt_1 0x0E48 139#define RBBM_SOFT_RESET_alt_1 0x0E48
140#define NQWAIT_UNTIL 0x0E50 140#define NQWAIT_UNTIL 0x0E50
141#define RBBM_DEBUG 0x0E6C 141#define RBBM_DEBUG 0x0E6C
142#define RBBM_CMDFIFO_ADDR 0x0E70 142#define RBBM_CMDFIFO_ADDR 0x0E70
143#define RBBM_CMDFIFO_DATAL 0x0E74 143#define RBBM_CMDFIFO_DATAL 0x0E74
144#define RBBM_CMDFIFO_DATAH 0x0E78 144#define RBBM_CMDFIFO_DATAH 0x0E78
145#define RBBM_CMDFIFO_STAT 0x0E7C 145#define RBBM_CMDFIFO_STAT 0x0E7C
146#define CRTC_STATUS 0x005C 146#define CRTC_STATUS 0x005C
147#define GPIO_VGA_DDC 0x0060 147#define GPIO_VGA_DDC 0x0060
148#define GPIO_DVI_DDC 0x0064 148#define GPIO_DVI_DDC 0x0064
149#define GPIO_MONID 0x0068 149#define GPIO_MONID 0x0068
150#define GPIO_CRT2_DDC 0x006c 150#define GPIO_CRT2_DDC 0x006c
151#define PALETTE_INDEX 0x00B0 151#define PALETTE_INDEX 0x00B0
152#define PALETTE_DATA 0x00B4 152#define PALETTE_DATA 0x00B4
153#define PALETTE_30_DATA 0x00B8 153#define PALETTE_30_DATA 0x00B8
154#define CRTC_H_TOTAL_DISP 0x0200 154#define CRTC_H_TOTAL_DISP 0x0200
155#define CRTC_H_SYNC_STRT_WID 0x0204 155#define CRTC_H_SYNC_STRT_WID 0x0204
156#define CRTC_V_TOTAL_DISP 0x0208 156#define CRTC_V_TOTAL_DISP 0x0208
157#define CRTC_V_SYNC_STRT_WID 0x020C 157#define CRTC_V_SYNC_STRT_WID 0x020C
158#define CRTC_VLINE_CRNT_VLINE 0x0210 158#define CRTC_VLINE_CRNT_VLINE 0x0210
159#define CRTC_CRNT_FRAME 0x0214 159#define CRTC_CRNT_FRAME 0x0214
160#define CRTC_GUI_TRIG_VLINE 0x0218 160#define CRTC_GUI_TRIG_VLINE 0x0218
161#define CRTC_DEBUG 0x021C 161#define CRTC_DEBUG 0x021C
162#define CRTC_OFFSET_RIGHT 0x0220 162#define CRTC_OFFSET_RIGHT 0x0220
163#define CRTC_OFFSET 0x0224 163#define CRTC_OFFSET 0x0224
164#define CRTC_OFFSET_CNTL 0x0228 164#define CRTC_OFFSET_CNTL 0x0228
165#define CRTC_PITCH 0x022C 165#define CRTC_PITCH 0x022C
166#define OVR_CLR 0x0230 166#define OVR_CLR 0x0230
167#define OVR_WID_LEFT_RIGHT 0x0234 167#define OVR_WID_LEFT_RIGHT 0x0234
168#define OVR_WID_TOP_BOTTOM 0x0238 168#define OVR_WID_TOP_BOTTOM 0x0238
169#define DISPLAY_BASE_ADDR 0x023C 169#define DISPLAY_BASE_ADDR 0x023C
170#define SNAPSHOT_VH_COUNTS 0x0240 170#define SNAPSHOT_VH_COUNTS 0x0240
171#define SNAPSHOT_F_COUNT 0x0244 171#define SNAPSHOT_F_COUNT 0x0244
172#define N_VIF_COUNT 0x0248 172#define N_VIF_COUNT 0x0248
173#define SNAPSHOT_VIF_COUNT 0x024C 173#define SNAPSHOT_VIF_COUNT 0x024C
174#define FP_CRTC_H_TOTAL_DISP 0x0250 174#define FP_CRTC_H_TOTAL_DISP 0x0250
175#define FP_CRTC_V_TOTAL_DISP 0x0254 175#define FP_CRTC_V_TOTAL_DISP 0x0254
176#define CRT_CRTC_H_SYNC_STRT_WID 0x0258 176#define CRT_CRTC_H_SYNC_STRT_WID 0x0258
177#define CRT_CRTC_V_SYNC_STRT_WID 0x025C 177#define CRT_CRTC_V_SYNC_STRT_WID 0x025C
178#define CUR_OFFSET 0x0260 178#define CUR_OFFSET 0x0260
179#define CUR_HORZ_VERT_POSN 0x0264 179#define CUR_HORZ_VERT_POSN 0x0264
180#define CUR_HORZ_VERT_OFF 0x0268 180#define CUR_HORZ_VERT_OFF 0x0268
181#define CUR_CLR0 0x026C 181#define CUR_CLR0 0x026C
182#define CUR_CLR1 0x0270 182#define CUR_CLR1 0x0270
183#define FP_HORZ_VERT_ACTIVE 0x0278 183#define FP_HORZ_VERT_ACTIVE 0x0278
184#define CRTC_MORE_CNTL 0x027C 184#define CRTC_MORE_CNTL 0x027C
185#define CRTC_H_CUTOFF_ACTIVE_EN (1<<4) 185#define CRTC_H_CUTOFF_ACTIVE_EN (1<<4)
186#define CRTC_V_CUTOFF_ACTIVE_EN (1<<5) 186#define CRTC_V_CUTOFF_ACTIVE_EN (1<<5)
187#define DAC_EXT_CNTL 0x0280 187#define DAC_EXT_CNTL 0x0280
188#define FP_GEN_CNTL 0x0284 188#define FP_GEN_CNTL 0x0284
189#define FP_HORZ_STRETCH 0x028C 189#define FP_HORZ_STRETCH 0x028C
190#define FP_VERT_STRETCH 0x0290 190#define FP_VERT_STRETCH 0x0290
191#define FP_H_SYNC_STRT_WID 0x02C4 191#define FP_H_SYNC_STRT_WID 0x02C4
192#define FP_V_SYNC_STRT_WID 0x02C8 192#define FP_V_SYNC_STRT_WID 0x02C8
193#define AUX_WINDOW_HORZ_CNTL 0x02D8 193#define AUX_WINDOW_HORZ_CNTL 0x02D8
194#define AUX_WINDOW_VERT_CNTL 0x02DC 194#define AUX_WINDOW_VERT_CNTL 0x02DC
195//#define DDA_CONFIG 0x02e0 195//#define DDA_CONFIG 0x02e0
196//#define DDA_ON_OFF 0x02e4 196//#define DDA_ON_OFF 0x02e4
197#define DVI_I2C_CNTL_1 0x02e4 197#define DVI_I2C_CNTL_1 0x02e4
@@ -199,192 +199,192 @@
199#define GRPH2_BUFFER_CNTL 0x03F0 199#define GRPH2_BUFFER_CNTL 0x03F0
200#define VGA_BUFFER_CNTL 0x02F4 200#define VGA_BUFFER_CNTL 0x02F4
201#define OV0_Y_X_START 0x0400 201#define OV0_Y_X_START 0x0400
202#define OV0_Y_X_END 0x0404 202#define OV0_Y_X_END 0x0404
203#define OV0_PIPELINE_CNTL 0x0408 203#define OV0_PIPELINE_CNTL 0x0408
204#define OV0_REG_LOAD_CNTL 0x0410 204#define OV0_REG_LOAD_CNTL 0x0410
205#define OV0_SCALE_CNTL 0x0420 205#define OV0_SCALE_CNTL 0x0420
206#define OV0_V_INC 0x0424 206#define OV0_V_INC 0x0424
207#define OV0_P1_V_ACCUM_INIT 0x0428 207#define OV0_P1_V_ACCUM_INIT 0x0428
208#define OV0_P23_V_ACCUM_INIT 0x042C 208#define OV0_P23_V_ACCUM_INIT 0x042C
209#define OV0_P1_BLANK_LINES_AT_TOP 0x0430 209#define OV0_P1_BLANK_LINES_AT_TOP 0x0430
210#define OV0_P23_BLANK_LINES_AT_TOP 0x0434 210#define OV0_P23_BLANK_LINES_AT_TOP 0x0434
211#define OV0_BASE_ADDR 0x043C 211#define OV0_BASE_ADDR 0x043C
212#define OV0_VID_BUF0_BASE_ADRS 0x0440 212#define OV0_VID_BUF0_BASE_ADRS 0x0440
213#define OV0_VID_BUF1_BASE_ADRS 0x0444 213#define OV0_VID_BUF1_BASE_ADRS 0x0444
214#define OV0_VID_BUF2_BASE_ADRS 0x0448 214#define OV0_VID_BUF2_BASE_ADRS 0x0448
215#define OV0_VID_BUF3_BASE_ADRS 0x044C 215#define OV0_VID_BUF3_BASE_ADRS 0x044C
216#define OV0_VID_BUF4_BASE_ADRS 0x0450 216#define OV0_VID_BUF4_BASE_ADRS 0x0450
217#define OV0_VID_BUF5_BASE_ADRS 0x0454 217#define OV0_VID_BUF5_BASE_ADRS 0x0454
218#define OV0_VID_BUF_PITCH0_VALUE 0x0460 218#define OV0_VID_BUF_PITCH0_VALUE 0x0460
219#define OV0_VID_BUF_PITCH1_VALUE 0x0464 219#define OV0_VID_BUF_PITCH1_VALUE 0x0464
220#define OV0_AUTO_FLIP_CNTRL 0x0470 220#define OV0_AUTO_FLIP_CNTRL 0x0470
221#define OV0_DEINTERLACE_PATTERN 0x0474 221#define OV0_DEINTERLACE_PATTERN 0x0474
222#define OV0_SUBMIT_HISTORY 0x0478 222#define OV0_SUBMIT_HISTORY 0x0478
223#define OV0_H_INC 0x0480 223#define OV0_H_INC 0x0480
224#define OV0_STEP_BY 0x0484 224#define OV0_STEP_BY 0x0484
225#define OV0_P1_H_ACCUM_INIT 0x0488 225#define OV0_P1_H_ACCUM_INIT 0x0488
226#define OV0_P23_H_ACCUM_INIT 0x048C 226#define OV0_P23_H_ACCUM_INIT 0x048C
227#define OV0_P1_X_START_END 0x0494 227#define OV0_P1_X_START_END 0x0494
228#define OV0_P2_X_START_END 0x0498 228#define OV0_P2_X_START_END 0x0498
229#define OV0_P3_X_START_END 0x049C 229#define OV0_P3_X_START_END 0x049C
230#define OV0_FILTER_CNTL 0x04A0 230#define OV0_FILTER_CNTL 0x04A0
231#define OV0_FOUR_TAP_COEF_0 0x04B0 231#define OV0_FOUR_TAP_COEF_0 0x04B0
232#define OV0_FOUR_TAP_COEF_1 0x04B4 232#define OV0_FOUR_TAP_COEF_1 0x04B4
233#define OV0_FOUR_TAP_COEF_2 0x04B8 233#define OV0_FOUR_TAP_COEF_2 0x04B8
234#define OV0_FOUR_TAP_COEF_3 0x04BC 234#define OV0_FOUR_TAP_COEF_3 0x04BC
235#define OV0_FOUR_TAP_COEF_4 0x04C0 235#define OV0_FOUR_TAP_COEF_4 0x04C0
236#define OV0_FLAG_CNTRL 0x04DC 236#define OV0_FLAG_CNTRL 0x04DC
237#define OV0_SLICE_CNTL 0x04E0 237#define OV0_SLICE_CNTL 0x04E0
238#define OV0_VID_KEY_CLR_LOW 0x04E4 238#define OV0_VID_KEY_CLR_LOW 0x04E4
239#define OV0_VID_KEY_CLR_HIGH 0x04E8 239#define OV0_VID_KEY_CLR_HIGH 0x04E8
240#define OV0_GRPH_KEY_CLR_LOW 0x04EC 240#define OV0_GRPH_KEY_CLR_LOW 0x04EC
241#define OV0_GRPH_KEY_CLR_HIGH 0x04F0 241#define OV0_GRPH_KEY_CLR_HIGH 0x04F0
242#define OV0_KEY_CNTL 0x04F4 242#define OV0_KEY_CNTL 0x04F4
243#define OV0_TEST 0x04F8 243#define OV0_TEST 0x04F8
244#define SUBPIC_CNTL 0x0540 244#define SUBPIC_CNTL 0x0540
245#define SUBPIC_DEFCOLCON 0x0544 245#define SUBPIC_DEFCOLCON 0x0544
246#define SUBPIC_Y_X_START 0x054C 246#define SUBPIC_Y_X_START 0x054C
247#define SUBPIC_Y_X_END 0x0550 247#define SUBPIC_Y_X_END 0x0550
248#define SUBPIC_V_INC 0x0554 248#define SUBPIC_V_INC 0x0554
249#define SUBPIC_H_INC 0x0558 249#define SUBPIC_H_INC 0x0558
250#define SUBPIC_BUF0_OFFSET 0x055C 250#define SUBPIC_BUF0_OFFSET 0x055C
251#define SUBPIC_BUF1_OFFSET 0x0560 251#define SUBPIC_BUF1_OFFSET 0x0560
252#define SUBPIC_LC0_OFFSET 0x0564 252#define SUBPIC_LC0_OFFSET 0x0564
253#define SUBPIC_LC1_OFFSET 0x0568 253#define SUBPIC_LC1_OFFSET 0x0568
254#define SUBPIC_PITCH 0x056C 254#define SUBPIC_PITCH 0x056C
255#define SUBPIC_BTN_HLI_COLCON 0x0570 255#define SUBPIC_BTN_HLI_COLCON 0x0570
256#define SUBPIC_BTN_HLI_Y_X_START 0x0574 256#define SUBPIC_BTN_HLI_Y_X_START 0x0574
257#define SUBPIC_BTN_HLI_Y_X_END 0x0578 257#define SUBPIC_BTN_HLI_Y_X_END 0x0578
258#define SUBPIC_PALETTE_INDEX 0x057C 258#define SUBPIC_PALETTE_INDEX 0x057C
259#define SUBPIC_PALETTE_DATA 0x0580 259#define SUBPIC_PALETTE_DATA 0x0580
260#define SUBPIC_H_ACCUM_INIT 0x0584 260#define SUBPIC_H_ACCUM_INIT 0x0584
261#define SUBPIC_V_ACCUM_INIT 0x0588 261#define SUBPIC_V_ACCUM_INIT 0x0588
262#define DISP_MISC_CNTL 0x0D00 262#define DISP_MISC_CNTL 0x0D00
263#define DAC_MACRO_CNTL 0x0D04 263#define DAC_MACRO_CNTL 0x0D04
264#define DISP_PWR_MAN 0x0D08 264#define DISP_PWR_MAN 0x0D08
265#define DISP_TEST_DEBUG_CNTL 0x0D10 265#define DISP_TEST_DEBUG_CNTL 0x0D10
266#define DISP_HW_DEBUG 0x0D14 266#define DISP_HW_DEBUG 0x0D14
267#define DAC_CRC_SIG1 0x0D18 267#define DAC_CRC_SIG1 0x0D18
268#define DAC_CRC_SIG2 0x0D1C 268#define DAC_CRC_SIG2 0x0D1C
269#define OV0_LIN_TRANS_A 0x0D20 269#define OV0_LIN_TRANS_A 0x0D20
270#define OV0_LIN_TRANS_B 0x0D24 270#define OV0_LIN_TRANS_B 0x0D24
271#define OV0_LIN_TRANS_C 0x0D28 271#define OV0_LIN_TRANS_C 0x0D28
272#define OV0_LIN_TRANS_D 0x0D2C 272#define OV0_LIN_TRANS_D 0x0D2C
273#define OV0_LIN_TRANS_E 0x0D30 273#define OV0_LIN_TRANS_E 0x0D30
274#define OV0_LIN_TRANS_F 0x0D34 274#define OV0_LIN_TRANS_F 0x0D34
275#define OV0_GAMMA_0_F 0x0D40 275#define OV0_GAMMA_0_F 0x0D40
276#define OV0_GAMMA_10_1F 0x0D44 276#define OV0_GAMMA_10_1F 0x0D44
277#define OV0_GAMMA_20_3F 0x0D48 277#define OV0_GAMMA_20_3F 0x0D48
278#define OV0_GAMMA_40_7F 0x0D4C 278#define OV0_GAMMA_40_7F 0x0D4C
279#define OV0_GAMMA_380_3BF 0x0D50 279#define OV0_GAMMA_380_3BF 0x0D50
280#define OV0_GAMMA_3C0_3FF 0x0D54 280#define OV0_GAMMA_3C0_3FF 0x0D54
281#define DISP_MERGE_CNTL 0x0D60 281#define DISP_MERGE_CNTL 0x0D60
282#define DISP_OUTPUT_CNTL 0x0D64 282#define DISP_OUTPUT_CNTL 0x0D64
283#define DISP_LIN_TRANS_GRPH_A 0x0D80 283#define DISP_LIN_TRANS_GRPH_A 0x0D80
284#define DISP_LIN_TRANS_GRPH_B 0x0D84 284#define DISP_LIN_TRANS_GRPH_B 0x0D84
285#define DISP_LIN_TRANS_GRPH_C 0x0D88 285#define DISP_LIN_TRANS_GRPH_C 0x0D88
286#define DISP_LIN_TRANS_GRPH_D 0x0D8C 286#define DISP_LIN_TRANS_GRPH_D 0x0D8C
287#define DISP_LIN_TRANS_GRPH_E 0x0D90 287#define DISP_LIN_TRANS_GRPH_E 0x0D90
288#define DISP_LIN_TRANS_GRPH_F 0x0D94 288#define DISP_LIN_TRANS_GRPH_F 0x0D94
289#define DISP_LIN_TRANS_VID_A 0x0D98 289#define DISP_LIN_TRANS_VID_A 0x0D98
290#define DISP_LIN_TRANS_VID_B 0x0D9C 290#define DISP_LIN_TRANS_VID_B 0x0D9C
291#define DISP_LIN_TRANS_VID_C 0x0DA0 291#define DISP_LIN_TRANS_VID_C 0x0DA0
292#define DISP_LIN_TRANS_VID_D 0x0DA4 292#define DISP_LIN_TRANS_VID_D 0x0DA4
293#define DISP_LIN_TRANS_VID_E 0x0DA8 293#define DISP_LIN_TRANS_VID_E 0x0DA8
294#define DISP_LIN_TRANS_VID_F 0x0DAC 294#define DISP_LIN_TRANS_VID_F 0x0DAC
295#define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0 295#define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0
296#define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4 296#define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4
297#define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8 297#define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8
298#define RMX_HORZ_PHASE 0x0DBC 298#define RMX_HORZ_PHASE 0x0DBC
299#define DAC_EMBEDDED_SYNC_CNTL 0x0DC0 299#define DAC_EMBEDDED_SYNC_CNTL 0x0DC0
300#define DAC_BROAD_PULSE 0x0DC4 300#define DAC_BROAD_PULSE 0x0DC4
301#define DAC_SKEW_CLKS 0x0DC8 301#define DAC_SKEW_CLKS 0x0DC8
302#define DAC_INCR 0x0DCC 302#define DAC_INCR 0x0DCC
303#define DAC_NEG_SYNC_LEVEL 0x0DD0 303#define DAC_NEG_SYNC_LEVEL 0x0DD0
304#define DAC_POS_SYNC_LEVEL 0x0DD4 304#define DAC_POS_SYNC_LEVEL 0x0DD4
305#define DAC_BLANK_LEVEL 0x0DD8 305#define DAC_BLANK_LEVEL 0x0DD8
306#define CLOCK_CNTL_INDEX 0x0008 306#define CLOCK_CNTL_INDEX 0x0008
307#define CLOCK_CNTL_DATA 0x000C 307#define CLOCK_CNTL_DATA 0x000C
308#define CP_RB_CNTL 0x0704 308#define CP_RB_CNTL 0x0704
309#define CP_RB_BASE 0x0700 309#define CP_RB_BASE 0x0700
310#define CP_RB_RPTR_ADDR 0x070C 310#define CP_RB_RPTR_ADDR 0x070C
311#define CP_RB_RPTR 0x0710 311#define CP_RB_RPTR 0x0710
312#define CP_RB_WPTR 0x0714 312#define CP_RB_WPTR 0x0714
313#define CP_RB_WPTR_DELAY 0x0718 313#define CP_RB_WPTR_DELAY 0x0718
314#define CP_IB_BASE 0x0738 314#define CP_IB_BASE 0x0738
315#define CP_IB_BUFSZ 0x073C 315#define CP_IB_BUFSZ 0x073C
316#define SCRATCH_REG0 0x15E0 316#define SCRATCH_REG0 0x15E0
317#define GUI_SCRATCH_REG0 0x15E0 317#define GUI_SCRATCH_REG0 0x15E0
318#define SCRATCH_REG1 0x15E4 318#define SCRATCH_REG1 0x15E4
319#define GUI_SCRATCH_REG1 0x15E4 319#define GUI_SCRATCH_REG1 0x15E4
320#define SCRATCH_REG2 0x15E8 320#define SCRATCH_REG2 0x15E8
321#define GUI_SCRATCH_REG2 0x15E8 321#define GUI_SCRATCH_REG2 0x15E8
322#define SCRATCH_REG3 0x15EC 322#define SCRATCH_REG3 0x15EC
323#define GUI_SCRATCH_REG3 0x15EC 323#define GUI_SCRATCH_REG3 0x15EC
324#define SCRATCH_REG4 0x15F0 324#define SCRATCH_REG4 0x15F0
325#define GUI_SCRATCH_REG4 0x15F0 325#define GUI_SCRATCH_REG4 0x15F0
326#define SCRATCH_REG5 0x15F4 326#define SCRATCH_REG5 0x15F4
327#define GUI_SCRATCH_REG5 0x15F4 327#define GUI_SCRATCH_REG5 0x15F4
328#define SCRATCH_UMSK 0x0770 328#define SCRATCH_UMSK 0x0770
329#define SCRATCH_ADDR 0x0774 329#define SCRATCH_ADDR 0x0774
330#define DP_BRUSH_FRGD_CLR 0x147C 330#define DP_BRUSH_FRGD_CLR 0x147C
331#define DP_BRUSH_BKGD_CLR 0x1478 331#define DP_BRUSH_BKGD_CLR 0x1478
332#define DST_LINE_START 0x1600 332#define DST_LINE_START 0x1600
333#define DST_LINE_END 0x1604 333#define DST_LINE_END 0x1604
334#define SRC_OFFSET 0x15AC 334#define SRC_OFFSET 0x15AC
335#define SRC_PITCH 0x15B0 335#define SRC_PITCH 0x15B0
336#define SRC_TILE 0x1704 336#define SRC_TILE 0x1704
337#define SRC_PITCH_OFFSET 0x1428 337#define SRC_PITCH_OFFSET 0x1428
338#define SRC_X 0x1414 338#define SRC_X 0x1414
339#define SRC_Y 0x1418 339#define SRC_Y 0x1418
340#define SRC_X_Y 0x1590 340#define SRC_X_Y 0x1590
341#define SRC_Y_X 0x1434 341#define SRC_Y_X 0x1434
342#define DST_Y_X 0x1438 342#define DST_Y_X 0x1438
343#define DST_WIDTH_HEIGHT 0x1598 343#define DST_WIDTH_HEIGHT 0x1598
344#define DST_HEIGHT_WIDTH 0x143c 344#define DST_HEIGHT_WIDTH 0x143c
345#define DST_OFFSET 0x1404 345#define DST_OFFSET 0x1404
346#define SRC_CLUT_ADDRESS 0x1780 346#define SRC_CLUT_ADDRESS 0x1780
347#define SRC_CLUT_DATA 0x1784 347#define SRC_CLUT_DATA 0x1784
348#define SRC_CLUT_DATA_RD 0x1788 348#define SRC_CLUT_DATA_RD 0x1788
349#define HOST_DATA0 0x17C0 349#define HOST_DATA0 0x17C0
350#define HOST_DATA1 0x17C4 350#define HOST_DATA1 0x17C4
351#define HOST_DATA2 0x17C8 351#define HOST_DATA2 0x17C8
352#define HOST_DATA3 0x17CC 352#define HOST_DATA3 0x17CC
353#define HOST_DATA4 0x17D0 353#define HOST_DATA4 0x17D0
354#define HOST_DATA5 0x17D4 354#define HOST_DATA5 0x17D4
355#define HOST_DATA6 0x17D8 355#define HOST_DATA6 0x17D8
356#define HOST_DATA7 0x17DC 356#define HOST_DATA7 0x17DC
357#define HOST_DATA_LAST 0x17E0 357#define HOST_DATA_LAST 0x17E0
358#define DP_SRC_ENDIAN 0x15D4 358#define DP_SRC_ENDIAN 0x15D4
359#define DP_SRC_FRGD_CLR 0x15D8 359#define DP_SRC_FRGD_CLR 0x15D8
360#define DP_SRC_BKGD_CLR 0x15DC 360#define DP_SRC_BKGD_CLR 0x15DC
361#define SC_LEFT 0x1640 361#define SC_LEFT 0x1640
362#define SC_RIGHT 0x1644 362#define SC_RIGHT 0x1644
363#define SC_TOP 0x1648 363#define SC_TOP 0x1648
364#define SC_BOTTOM 0x164C 364#define SC_BOTTOM 0x164C
365#define SRC_SC_RIGHT 0x1654 365#define SRC_SC_RIGHT 0x1654
366#define SRC_SC_BOTTOM 0x165C 366#define SRC_SC_BOTTOM 0x165C
367#define DP_CNTL 0x16C0 367#define DP_CNTL 0x16C0
368#define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0 368#define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0
369#define DP_DATATYPE 0x16C4 369#define DP_DATATYPE 0x16C4
370#define DP_MIX 0x16C8 370#define DP_MIX 0x16C8
371#define DP_WRITE_MSK 0x16CC 371#define DP_WRITE_MSK 0x16CC
372#define DP_XOP 0x17F8 372#define DP_XOP 0x17F8
373#define CLR_CMP_CLR_SRC 0x15C4 373#define CLR_CMP_CLR_SRC 0x15C4
374#define CLR_CMP_CLR_DST 0x15C8 374#define CLR_CMP_CLR_DST 0x15C8
375#define CLR_CMP_CNTL 0x15C0 375#define CLR_CMP_CNTL 0x15C0
376#define CLR_CMP_MSK 0x15CC 376#define CLR_CMP_MSK 0x15CC
377#define DSTCACHE_MODE 0x1710 377#define DSTCACHE_MODE 0x1710
378#define DSTCACHE_CTLSTAT 0x1714 378#define DSTCACHE_CTLSTAT 0x1714
379#define DEFAULT_PITCH_OFFSET 0x16E0 379#define DEFAULT_PITCH_OFFSET 0x16E0
380#define DEFAULT_SC_BOTTOM_RIGHT 0x16E8 380#define DEFAULT_SC_BOTTOM_RIGHT 0x16E8
381#define DEFAULT_SC_TOP_LEFT 0x16EC 381#define DEFAULT_SC_TOP_LEFT 0x16EC
382#define SRC_PITCH_OFFSET 0x1428 382#define SRC_PITCH_OFFSET 0x1428
383#define DST_PITCH_OFFSET 0x142C 383#define DST_PITCH_OFFSET 0x142C
384#define DP_GUI_MASTER_CNTL 0x146C 384#define DP_GUI_MASTER_CNTL 0x146C
385#define SC_TOP_LEFT 0x16EC 385#define SC_TOP_LEFT 0x16EC
386#define SC_BOTTOM_RIGHT 0x16F0 386#define SC_BOTTOM_RIGHT 0x16F0
387#define SRC_SC_BOTTOM_RIGHT 0x16F4 387#define SRC_SC_BOTTOM_RIGHT 0x16F4
388#define RB2D_DSTCACHE_MODE 0x3428 388#define RB2D_DSTCACHE_MODE 0x3428
389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */ 389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */
390#define LVDS_GEN_CNTL 0x02d0 390#define LVDS_GEN_CNTL 0x02d0
@@ -686,7 +686,7 @@
686#define VERT_FP_LOOP_STRETCH (0x7 << 28) 686#define VERT_FP_LOOP_STRETCH (0x7 << 28)
687#define VERT_STRETCH_RESERVED 0xf1000000 687#define VERT_STRETCH_RESERVED 0xf1000000
688 688
689/* DAC_CNTL bit constants */ 689/* DAC_CNTL bit constants */
690#define DAC_8BIT_EN 0x00000100 690#define DAC_8BIT_EN 0x00000100
691#define DAC_4BPP_PIX_ORDER 0x00000200 691#define DAC_4BPP_PIX_ORDER 0x00000200
692#define DAC_CRC_EN 0x00080000 692#define DAC_CRC_EN 0x00080000
@@ -700,7 +700,7 @@
700#define DAC_CMP_EN (1 << 3) 700#define DAC_CMP_EN (1 << 3)
701#define DAC_CMP_OUTPUT (1 << 7) 701#define DAC_CMP_OUTPUT (1 << 7)
702 702
703/* DAC_CNTL2 bit constants */ 703/* DAC_CNTL2 bit constants */
704#define DAC2_EXPAND_MODE (1 << 14) 704#define DAC2_EXPAND_MODE (1 << 14)
705#define DAC2_CMP_EN (1 << 7) 705#define DAC2_CMP_EN (1 << 7)
706#define DAC2_PALETTE_ACCESS_CNTL (1 << 5) 706#define DAC2_PALETTE_ACCESS_CNTL (1 << 5)
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index fe41b8407946..c3b2a2aa7140 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -14,13 +14,16 @@
14#define S1D13XXXFB_H 14#define S1D13XXXFB_H
15 15
16#define S1D_PALETTE_SIZE 256 16#define S1D_PALETTE_SIZE 256
17#define S1D13506_CHIP_REV 4 /* expected chip revision number for s1d13506 */ 17#define S1D_FBID "S1D13xxx"
18#define S1D13806_CHIP_REV 7 /* expected chip revision number for s1d13806 */ 18#define S1D_DEVICENAME "s1d13xxxfb"
19#define S1D_FBID "S1D13806" 19
20#define S1D_DEVICENAME "s1d13806fb" 20/* S1DREG_REV_CODE register = prod_id (6 bits) + revision (2 bits) */
21#define S1D13505_PROD_ID 0x3 /* 000011 */
22#define S1D13506_PROD_ID 0x4 /* 000100 */
23#define S1D13806_PROD_ID 0x7 /* 000111 */
21 24
22/* register definitions (tested on s1d13896) */ 25/* register definitions (tested on s1d13896) */
23#define S1DREG_REV_CODE 0x0000 /* Revision Code Register */ 26#define S1DREG_REV_CODE 0x0000 /* Prod + Rev Code Register */
24#define S1DREG_MISC 0x0001 /* Miscellaneous Register */ 27#define S1DREG_MISC 0x0001 /* Miscellaneous Register */
25#define S1DREG_GPIO_CNF0 0x0004 /* General IO Pins Configuration Register 0 */ 28#define S1DREG_GPIO_CNF0 0x0004 /* General IO Pins Configuration Register 0 */
26#define S1DREG_GPIO_CNF1 0x0005 /* General IO Pins Configuration Register 1 */ 29#define S1DREG_GPIO_CNF1 0x0005 /* General IO Pins Configuration Register 1 */
@@ -141,10 +144,11 @@ struct s1d13xxxfb_regval {
141 u8 value; 144 u8 value;
142}; 145};
143 146
144
145struct s1d13xxxfb_par { 147struct s1d13xxxfb_par {
146 void __iomem *regs; 148 void __iomem *regs;
147 unsigned char display; 149 unsigned char display;
150 unsigned char prod_id;
151 unsigned char revision;
148 152
149 unsigned int pseudo_palette[16]; 153 unsigned int pseudo_palette[16];
150#ifdef CONFIG_PM 154#ifdef CONFIG_PM
diff --git a/include/video/tdfx.h b/include/video/tdfx.h
index 7431d9681e57..befbaf0a92d8 100644
--- a/include/video/tdfx.h
+++ b/include/video/tdfx.h
@@ -1,6 +1,9 @@
1#ifndef _TDFX_H 1#ifndef _TDFX_H
2#define _TDFX_H 2#define _TDFX_H
3 3
4#include <linux/i2c.h>
5#include <linux/i2c-algo-bit.h>
6
4/* membase0 register offsets */ 7/* membase0 register offsets */
5#define STATUS 0x00 8#define STATUS 0x00
6#define PCIINIT0 0x04 9#define PCIINIT0 0x04
@@ -123,6 +126,18 @@
123#define VIDCFG_PIXFMT_SHIFT 18 126#define VIDCFG_PIXFMT_SHIFT 18
124#define DACMODE_2X BIT(0) 127#define DACMODE_2X BIT(0)
125 128
129/* I2C bit locations in the VIDSERPARPORT register */
130#define DDC_ENAB 0x00040000
131#define DDC_SCL_OUT 0x00080000
132#define DDC_SDA_OUT 0x00100000
133#define DDC_SCL_IN 0x00200000
134#define DDC_SDA_IN 0x00400000
135#define I2C_ENAB 0x00800000
136#define I2C_SCL_OUT 0x01000000
137#define I2C_SDA_OUT 0x02000000
138#define I2C_SCL_IN 0x04000000
139#define I2C_SDA_IN 0x08000000
140
126/* VGA rubbish, need to change this for multihead support */ 141/* VGA rubbish, need to change this for multihead support */
127#define MISC_W 0x3c2 142#define MISC_W 0x3c2
128#define MISC_R 0x3cc 143#define MISC_R 0x3cc
@@ -168,12 +183,23 @@ struct banshee_reg {
168 unsigned long miscinit0; 183 unsigned long miscinit0;
169}; 184};
170 185
186struct tdfx_par;
187
188struct tdfxfb_i2c_chan {
189 struct tdfx_par *par;
190 struct i2c_adapter adapter;
191 struct i2c_algo_bit_data algo;
192};
193
171struct tdfx_par { 194struct tdfx_par {
172 u32 max_pixclock; 195 u32 max_pixclock;
173 u32 palette[16]; 196 u32 palette[16];
174 void __iomem *regbase_virt; 197 void __iomem *regbase_virt;
175 unsigned long iobase; 198 unsigned long iobase;
176 int mtrr_handle; 199 int mtrr_handle;
200#ifdef CONFIG_FB_3DFX_I2C
201 struct tdfxfb_i2c_chan chan[2];
202#endif
177}; 203};
178 204
179#endif /* __KERNEL__ */ 205#endif /* __KERNEL__ */